@kopai/app 0.14.7 → 0.15.0

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.
@@ -60,7 +60,7 @@ Error generating stack: `+e.message+`
60
60
 
61
61
  `)}return o.write(`payload.value = newResult;`),o.write(`return payload;`),o.compile()},o,s=F,c=!et.jitless,l=c&&oe.value,u=t.catchall,d;e._zod.parse=(i,f)=>{d??=r.value;let p=i.value;return s(p)?c&&l&&f?.async===!1&&f.jitless!==!0?(o||=a(t.shape),i=o(i,f),u?Fr([],p,i,f,d,e,f?.abortEarly===!0):i):n(i,f):(i.issues.push({expected:`object`,code:`invalid_type`,input:p,inst:e}),i)}});function Rr(e,t,n,r){for(let n of e)if(n.issues.length===0)return t.value=n.value,t;let i=e.filter(e=>!we(e));return i.length===1?(t.value=i[0].value,i[0]):(t.issues.push({code:`invalid_union`,input:t.value,inst:n,errors:e.map(e=>e.issues.map(e=>ke(e,r,tt())))}),t)}var zr=R(`$ZodUnion`,(e,t)=>{Nn.init(e,t),We(e,`optin`,e=>e.def.options.some(e=>e._zod.optin===`defaulted`)?`defaulted`:e.def.options.some(e=>e._zod.optin!==void 0)?`optional`:void 0),We(e,`optout`,e=>e.def.options.some(e=>e._zod.optout===`optional`)?`optional`:void 0),We(e,`values`,e=>{if(e.def.options.every(e=>e._zod.values))return new Set(e.def.options.flatMap(e=>Array.from(e._zod.values)))}),We(e,`pattern`,e=>{if(e.def.options.every(e=>e._zod.pattern)){let t=e.def.options.map(e=>e._zod.pattern);return RegExp(`^(${t.map(e=>E(e.source)).join(`|`)})$`)}});let n=t.options.length===1?t.options[0]._zod.run:null;e._zod.parse=(r,i)=>{if(n)return n(r,i);let a=!1,o=[];for(let e of t.options){let t=e._zod.run({value:r.value,issues:[]},i);if(t instanceof Promise)o.push(t),a=!0;else{if(t.issues.length===0)return t;o.push(t)}}return a?Promise.all(o).then(t=>Rr(t,r,e,i)):Rr(o,r,e,i)}});function Br(e){let t=new Map;for(let n of e.options){let r=n._zod.propValues?.[e.discriminator];if(!r||r.size===0)throw Error(`Invalid discriminated union option at index "${e.options.indexOf(n)}"`);for(let e of r)if(t.has(e)){if(e!==void 0)throw Error(`Duplicate discriminator value "${String(e)}"`);t.set(e,null)}else t.set(e,n)}return t}var Vr=R(`$ZodDiscriminatedUnion`,(e,t)=>{t.inclusive=!1,zr.init(e,t);let n=e._zod.parse;We(e,`propValues`,e=>{let t={},n=0;for(let r of e.def.options){let i=r._zod.propValues;if(!i||Object.keys(i).length===0)throw Error(`Invalid discriminated union option at index "${e.def.options.indexOf(r)}"`);i[e.def.discriminator]?.has(void 0)&&n++;for(let[e,n]of Object.entries(i)){Object.prototype.hasOwnProperty.call(t,e)||A(t,e,new Set);for(let r of n)t[e].add(r)}}return!e.def.unionFallback&&n>1&&t[e.def.discriminator]?.delete(void 0),t}),t.options.forEach((e,n)=>{let r=j(e._zod.def);if(r&&!Object.prototype.hasOwnProperty.call(r,t.discriminator))throw Error(`Invalid discriminated union option at index "${n}"`)});let r=w(()=>Br(t));e._zod.parse=(i,a)=>{let o=i.value;if(!F(o))return i.issues.push({code:`invalid_type`,expected:`object`,input:o,inst:e}),i;let s=o?.[t.discriminator],c=r.value.get(s);return c&&(s!==void 0||a.direction!==`backward`)?c._zod.run(i,a):t.unionFallback||a.direction===`backward`?n(i,a):(i.issues.push({code:`invalid_union`,errors:[],note:`No matching discriminator`,discriminator:t.discriminator,options:Array.from(r.value.keys()).filter(e=>r.value.get(e)!==null),input:o,path:[t.discriminator],inst:e}),i)}}),Hr=R(`$ZodIntersection`,(e,t)=>{Nn.init(e,t),e._zod.parse=(e,n)=>{let r=e.value,i=t.left._zod.run({value:r,issues:[]},n),a=t.right._zod.run({value:r,issues:[]},n);return i instanceof Promise||a instanceof Promise?Promise.all([i,a]).then(([t,n])=>Wr(e,t,n)):Wr(e,i,a)}});function Ur(e,t){if(e===t||e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(se(e)&&se(t)){let n=Object.keys(t),r=Object.keys(e).filter(e=>n.indexOf(e)!==-1),i={...e,...t};Object.prototype.hasOwnProperty.call(i,`__proto__`)&&delete i.__proto__;for(let n of r){if(n===`__proto__`)continue;let r=Ur(e[n],t[n]);if(!r.valid)return{valid:!1,mergeErrorPath:[n,...r.mergeErrorPath]};i[n]=r.data}return{valid:!0,data:i}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};let n=[];for(let r=0;r<e.length;r++){let i=e[r],a=t[r],o=Ur(i,a);if(!o.valid)return{valid:!1,mergeErrorPath:[r,...o.mergeErrorPath]};n.push(o.data)}return{valid:!0,data:n}}return{valid:!1,mergeErrorPath:[]}}function Wr(e,t,n){let r=new Map,i,a=new Map,o=(e,t)=>{let n;if(e.code===`unrecognized_keys`&&!e.path?.length)i??=e,n=e.keys;else if(e.code===`invalid_key`&&e.origin===`record`&&e.path?.length===1){let t=String(e.path[0]);a.has(t)||a.set(t,e),n=[t]}else return!1;for(let e of n)r.has(e)||r.set(e,{}),r.get(e)[t]=!0;return!0};for(let n of t.issues)o(n,`l`)||e.issues.push(n);for(let t of n.issues)o(t,`r`)||e.issues.push(t);let s=[...r].filter(([,e])=>e.l&&e.r).map(([e])=>e);if(s.length){let t=i?s.filter(e=>i.keys.includes(e)):[];t.length&&e.issues.push({...i,keys:t});for(let n of s)!t.includes(n)&&a.has(n)&&e.issues.push(a.get(n))}let c=Ur(t.value,n.value);if(!c.valid){if(we(e))return e;throw Error(`Unmergable intersection. Error path: ${JSON.stringify(c.mergeErrorPath)}`)}return e.value=c.data,e}var Gr=R(`$ZodRecord`,(e,t)=>{Nn.init(e,t);let n=et.memoizer;n?.attach(e),e._zod.parse=(r,i)=>{let a=r.value;if(!se(a))return r.issues.push({expected:`record`,code:`invalid_type`,input:a,inst:e}),r;let o=[],s=t.keyType._zod.values;if(s&&!t.partial){r.value=n?n.alloc(e,r,{},i):{};let c=new Set;for(let n of s)if(typeof n==`string`||typeof n==`number`||typeof n==`symbol`){if(c.add(typeof n==`number`?n.toString():n),n===`__proto__`)continue;let s=t.keyType._zod.run({value:n,issues:[]},i);if(s instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);if(s.issues.length){r.issues.push({code:`invalid_key`,origin:`record`,issues:s.issues.map(e=>ke(e,i,tt())),input:n,path:[n],inst:e});continue}let l=s.value;if(l===`__proto__`)continue;let u=t.valueType._zod.run({value:a[n],issues:[]},i);u instanceof Promise?o.push(u.then(e=>{e.issues.length&&r.issues.push(...Ee(n,e.issues)),r.value[l]=e.value})):(u.issues.length&&r.issues.push(...Ee(n,u.issues)),r.value[l]=u.value)}let l;for(let e in a)if(!c.has(e)){if(t.mode===`loose`){if(e===`__proto__`)continue;r.value[e]=a[e]}else l??=[],l.push(e)}l&&l.length>0&&r.issues.push({code:`unrecognized_keys`,input:a,inst:e,keys:l,continue:!0})}else{r.value=n?n.alloc(e,r,{},i):{};let c;for(let n of Reflect.ownKeys(a)){if(n===`__proto__`||!Object.prototype.propertyIsEnumerable.call(a,n))continue;let l=t.keyType._zod.run({value:n,issues:[]},i);if(l instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);if(typeof n==`string`&&sn.test(n)&&l.issues.length){let e=t.keyType._zod.run({value:Number(n),issues:[]},i);if(e instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);e.issues.length===0&&(l=e)}if(l.issues.length){t.mode===`loose`?r.value[n]=a[n]:s?(c??=[],c.push(n)):r.issues.push({code:`invalid_key`,origin:`record`,issues:l.issues.map(e=>ke(e,i,tt())),input:n,path:[n],inst:e});continue}let u=l.value;if(u===`__proto__`)continue;let d=t.valueType._zod.run({value:a[n],issues:[]},i);d instanceof Promise?o.push(d.then(e=>{e.issues.length&&r.issues.push(...Ee(n,e.issues)),r.value[u]=e.value})):(d.issues.length&&r.issues.push(...Ee(n,d.issues)),r.value[u]=d.value)}c&&c.length>0&&r.issues.push({code:`unrecognized_keys`,input:a,inst:e,keys:c,continue:!0})}return o.length?Promise.all(o).then(()=>r):r}}),Kr=R(`$ZodEnum`,(e,t)=>{Nn.init(e,t);let n=b(t.entries),r=new Set(n);e._zod.values=r,We(e,`pattern`,e=>{let t=b(e.def.entries).filter(e=>le.has(typeof e));return RegExp(t.length?`^(${t.map(e=>ue(e.toString())).join(`|`)})$`:`^[^\\s\\S]$`)}),e._zod.parse=(t,i)=>{let a=t.value;return r.has(a)||t.issues.push({code:`invalid_value`,values:n,input:a,inst:e}),t}}),qr=R(`$ZodLiteral`,(e,t)=>{Nn.init(e,t);let n=new Set(t.values);e._zod.values=n,We(e,`pattern`,e=>{let t=e.def.values;return RegExp(t.length?`^(${t.map(e=>typeof e==`string`?ue(e):e?ue(e.toString()):String(e)).join(`|`)})$`:`^[^\\s\\S]$`)}),e._zod.parse=(r,i)=>{let a=r.value;return n.has(a)||r.issues.push({code:`invalid_value`,values:t.values,input:a,inst:e}),r}}),Jr=R(`$ZodTransform`,(e,t)=>{Nn.init(e,t),e._zod.optin=`optional`,et.memoizer?.guard(e),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new $e(e.constructor.name);let i=t.transform(n.value,n);if(r.async)return(i instanceof Promise?i:Promise.resolve(i)).then(e=>(n.value=e,n));if(i instanceof Promise)throw new Qe;return n.value=i,n}});function Yr(e,t){return e.value=t.issues.length?void 0:t.value,e}var Xr=R(`$ZodOptional`,(e,t)=>{Nn.init(e,t),We(e,`optin`,e=>e.def.innerType._zod.optin===`defaulted`?`defaulted`:`optional`),e._zod.optout=`optional`,We(e,`values`,e=>{let t=e.def.innerType._zod.values;return t?new Set([...t,void 0]):void 0}),We(e,`pattern`,e=>{let t=e.def.innerType._zod.pattern;return t?RegExp(`^(${E(t.source)})?$`):void 0}),e._zod.parse=(e,n)=>{if(e.value===void 0){if(t.innerType._zod.optin!==`defaulted`)return e;let r=t.innerType._zod.run({value:e.value,issues:[]},n);return r instanceof Promise?r.then(t=>Yr(e,t)):Yr(e,r)}return t.innerType._zod.run(e,n)}}),Zr=R(`$ZodExactOptional`,(e,t)=>{Xr.init(e,t),We(e,`values`,e=>e.def.innerType._zod.values),We(e,`pattern`,e=>e.def.innerType._zod.pattern),e._zod.parse=(e,n)=>t.innerType._zod.run(e,n)}),Qr=R(`$ZodNullable`,(e,t)=>{Nn.init(e,t),We(e,`optin`,e=>e.def.innerType._zod.optin),We(e,`optout`,e=>e.def.innerType._zod.optout),We(e,`pattern`,e=>{let t=e.def.innerType._zod.pattern;return t?RegExp(`^(${E(t.source)}|null)$`):void 0}),We(e,`values`,e=>e.def.innerType._zod.values?new Set([...e.def.innerType._zod.values,null]):void 0),e._zod.parse=(e,n)=>e.value===null?e:t.innerType._zod.run(e,n)}),$r=R(`$ZodDefault`,(e,t)=>{Nn.init(e,t),e._zod.optin=`defaulted`,We(e,`values`,e=>e.def.innerType._zod.values),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);if(e.value===void 0)return e.value=t.defaultValue,e;let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(e=>ei(e,t)):ei(r,t)}});function ei(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}var ti=R(`$ZodPrefault`,(e,t)=>{Nn.init(e,t),e._zod.optin=`defaulted`,We(e,`values`,e=>e.def.innerType._zod.values),e._zod.parse=(e,n)=>(n.direction===`backward`||e.value===void 0&&(e.value=t.defaultValue),t.innerType._zod.run(e,n))}),ni=R(`$ZodNonOptional`,(e,t)=>{Nn.init(e,t),We(e,`values`,e=>{let t=e.def.innerType._zod.values;return t?new Set([...t].filter(e=>e!==void 0)):void 0}),e._zod.parse=(n,r)=>{let i=t.innerType._zod.run(n,r);return i instanceof Promise?i.then(t=>ri(t,e)):ri(i,e)}});function ri(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:`invalid_type`,expected:`nonoptional`,input:e.value,inst:t}),e}function ii(e,t,n,r){return t.issues.length?(e.value=n.catchValue({...t,value:e.value,error:{issues:t.issues.map(e=>ke(e,r,tt()))},input:e.value}),e):(e.value=t.value,t.memo&&(e.memo=!0),e)}var ai=R(`$ZodCatch`,(e,t)=>{Nn.init(e,t),We(e,`optin`,e=>e.def.innerType._zod.optin===`defaulted`?`defaulted`:`optional`),We(e,`optout`,e=>e.def.innerType._zod.optout),We(e,`values`,e=>e.def.innerType._zod.values),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);let r=t.innerType._zod.run({value:e.value,issues:[]},n);return r instanceof Promise?r.then(r=>ii(e,r,t,n)):ii(e,r,t,n)}}),oi=R(`$ZodPipe`,(e,t)=>{Nn.init(e,t),We(e,`values`,e=>e.def.in._zod.values),We(e,`optin`,e=>e.def.in._zod.optin),We(e,`optout`,e=>e.def.out._zod.optout),We(e,`propValues`,e=>e.def.in._zod.propValues),e._zod.parse=(e,n)=>{if(n.direction===`backward`){let r=t.out._zod.run(e,n);return r instanceof Promise?r.then(e=>si(e,t.in,n)):si(r,t.in,n)}let r=t.in._zod.run(e,n);return r instanceof Promise?r.then(e=>si(e,t.out,n)):si(r,t.out,n)}});function si(e,t,n){return e.issues.some(e=>e.code!==`unrecognized_keys`)?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},n)}var ci=R(`$ZodReadonly`,(e,t)=>{Nn.init(e,t),We(e,`propValues`,e=>e.def.innerType._zod.propValues),We(e,`values`,e=>e.def.innerType._zod.values),We(e,`optin`,e=>e.def.innerType?._zod?.optin),We(e,`optout`,e=>e.def.innerType?._zod?.optout),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(li):li(r)}});function li(e){return e.memo||(e.value=Object.freeze(e.value)),e}var ui=R(`$ZodLazy`,(e,t)=>{Nn.init(e,t),k(e._zod,`innerType`,()=>{let e=t;return e._cachedInner||=t.getter(),e._cachedInner}),We(e,`pattern`,e=>e.innerType?._zod?.pattern),We(e,`propValues`,e=>e.innerType?._zod?.propValues),We(e,`optin`,e=>e.innerType?._zod?.optin??void 0),We(e,`optout`,e=>e.innerType?._zod?.optout??void 0),e._zod.parse=(t,n)=>e._zod.innerType._zod.run(t,n)}),di=R(`$ZodCustom`,(e,t)=>{pn.init(e,t),Nn.init(e,t),e._zod.parse=(e,t)=>e,e._zod.check=n=>{let r=n.value,i=t.fn(r);if(i instanceof Promise)return i.then(t=>fi(t,n,r,e));fi(i,n,r,e)}});function fi(e,t,n,r){if(!e){let e={code:`custom`,input:n,inst:r,path:[...r._zod.def.path??[]],continue:!r._zod.def.abort};r._zod.def.params&&(e.params=r._zod.def.params),t.issues.push(Pe(e))}}var pi=class extends Error{constructor(){super(`Cannot parse a reference cycle that closes through a transform`),this.name=`ZodCyclicError`}},mi=`~memo`,hi=[];function gi(e){return typeof e==`object`&&!!e}function _i(e){return e.map(e=>e.path?{...e,path:e.path.slice()}:{...e})}var vi=new WeakMap,yi=0,bi=1,xi=2;function Si(e,t,n){let r=vi.get(e);if(r!==void 0)return r?xi:yi;if(t.has(e))return xi;t.add(e);let i=yi,a=e=>{if(i!==xi&&e?._zod){let r=Si(e,t,n);r>i&&(i=r)}},o=(e,r)=>{let i=yi;for(let a of Reflect.ownKeys(e)){let o=Object.getOwnPropertyDescriptor(e,a);if(r&&!o.enumerable)continue;let s=o.get?bi:o.value?._zod?Si(o.value,t,n):yi;s>i&&(i=s)}return i},s=e=>{e>i&&(i=e)},c=e._zod.def;switch(c.type){case`object`:{let e=j(c);s(e?o(e,!0):bi),a(c.catchall);break}case`array`:a(c.element);break;case`tuple`:for(let e of c.items)a(e);a(c.rest);break;case`record`:case`map`:a(c.keyType),a(c.valueType);break;case`set`:a(c.valueType);break;case`union`:for(let e of c.options)a(e);break;case`intersection`:a(c.left),a(c.right);break;case`optional`:case`nullable`:case`default`:case`prefault`:case`catch`:case`readonly`:case`nonoptional`:case`promise`:case`success`:a(c.innerType);break;case`pipe`:a(c.in),a(c.out);break;case`function`:a(c.input),a(c.output);break;case`lazy`:{let r=c._cachedInner??(n?e._zod.innerType:void 0);s(r?Si(r,t,!1):bi);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(let e in c){let t=Object.getOwnPropertyDescriptor(c,e);if(!t||t.get)continue;let n=t.value;if(n&&typeof n==`object`){if(n._zod)a(n);else if(Array.isArray(n))for(let e of n)a(e)}}}return t.delete(e),Ci(e,i)}function Ci(e,t){return t!==bi&&vi.set(e,t===xi),t}function wi(e,t){let n=e.buckets.get(t);return n||(n=new WeakMap,e.buckets.set(t,n)),n}var Ti,Ei=[],Di={alloc(e,t,n){let r=Ti;if(!r)return n;Ti=void 0;let i={value:n,issues:null};return r.set(t.value,i),Ei.push(i),n},guard(e){var t;(t=e._zod).deferred??(t.deferred=[]),e._zod.deferred.push(()=>{let t=e._zod.parse,n=(e,n)=>{if(n.direction!==`backward`&&ki(n,e.value))throw new pi;return t(e,n)};e._zod.parse=n,e._zod.run===t&&(e._zod.run=n)})},attach(e){var t;let n,r=!1,i,a;(t=e._zod).deferred??(t.deferred=[]),e._zod.deferred.push(()=>{let t=e._zod.parse,o=(s,c)=>{if(n===void 0){let i=Si(e,new Set,!1);if(i===yi)return e._zod.parse=t,e._zod.run===o&&(e._zod.run=t),t(s,c);i===xi||r?n=!0:r=!0}let l=s.value;if(!gi(l))return t(s,c);let u=c[mi];u||(u={buckets:new WeakMap,backEdges:void 0},c[mi]=u);let d;i===c?d=a:(d=wi(u,e),i=c,a=d);let f=d.get(l);if(f)return s.value=f.value,f.issues?f.issues.length&&s.issues.push(..._i(f.issues)):(s.memo=!0,u.backEdges??(u.backEdges=new WeakSet),u.backEdges.add(f.value)),s;Ti=d;let p=Ei.length,m=t(s,c);Ti=void 0;let h=Ei.length>p?Ei.pop():void 0;return m instanceof Promise?m.then(e=>(h&&(h.issues=e.issues.length?_i(e.issues):hi),e)):(h&&(h.issues=m.issues.length?_i(m.issues):hi),m)};e._zod.parse=o,e._zod.run===t&&(e._zod.run=o)})}};function Oi(){return Di}function ki(e,t){let n=e[mi]?.backEdges;return n!==void 0&&gi(t)&&n.has(t)}var Ai=()=>{let e={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 t(t){return e[t]??null}let n={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`,currency_code:`currency code`,credit_card:`credit card number`,iban:`IBAN`,jwt:`JWT`,template_literal:`input`},r={nan:`NaN`};function i(e,t){return e===`number`&&typeof t==`number`&&!Number.isFinite(t)?String(t):r[e]??e}return e=>{switch(e.code){case`invalid_type`:return`Invalid input: expected ${i(e.expected)}, received ${i(Ne(e.input),e.input)}`;case`invalid_value`:return e.values.length===1?`Invalid input: expected ${fe(e.values[0])}`:`Invalid option: expected one of ${x(e.values,`|`)}`;case`too_big`:{let n=e.exact?`exactly `:e.inclusive?`<=`:`<`,r=t(e.origin);return r?`Too big: expected ${e.origin??`value`} to have ${n}${e.maximum.toString()} ${r.unit??`elements`}`:`Too big: expected ${e.origin??`value`} to be ${n}${e.maximum.toString()}`}case`too_small`:{let n=e.exact?`exactly `:e.inclusive?`>=`:`>`,r=t(e.origin);return r?`Too small: expected ${e.origin} to have ${n}${e.minimum.toString()} ${r.unit}`:`Too small: expected ${e.origin} to be ${n}${e.minimum.toString()}`}case`invalid_format`:{let t=e;return t.format===`starts_with`?`Invalid string: must start with "${t.prefix}"`:t.format===`ends_with`?`Invalid string: must end with "${t.suffix}"`:t.format===`includes`?`Invalid string: must include "${t.includes}"`:t.format===`regex`?`Invalid string: must match pattern ${t.pattern}`:`Invalid ${n[t.format]??e.format}`}case`not_multiple_of`:return`Invalid number: must be a multiple of ${e.divisor}`;case`unrecognized_keys`:return`Unrecognized key${e.keys.length>1?`s`:``}: ${x(e.keys,`, `)}`;case`invalid_key`:return`Invalid key in ${e.origin}`;case`invalid_union`:return e.options&&Array.isArray(e.options)&&e.options.length>0?`Invalid discriminator value. Expected ${e.options.map(e=>`'${e}'`).join(` | `)}`:e.inclusive===!1?`Invalid input: more than one option matched`:`Invalid input`;case`invalid_element`:return`Invalid value in ${e.origin}`;default:return`Invalid input`}}};function ji(){return{localeError:Ai()}}var Mi,Ni=class{constructor(){this._map=new WeakMap,this._idmap=new Map}add(e,...t){let n=t[0];return this._map.set(e,n),n&&typeof n==`object`&&`id`in n&&this._idmap.set(n.id,e),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(e){let t=this._map.get(e);return t&&typeof t==`object`&&`id`in t&&this._idmap.delete(t.id),this._map.delete(e),this}get(e){let t=e._zod.parent;if(t){let n={...this.get(t)??{}};delete n.id;let r={...n,...this._map.get(e)};return Object.keys(r).length?r:void 0}return this._map.get(e)}has(e){return this._map.has(e)}};function Pi(){return new Ni}(Mi=globalThis).__zod_globalRegistry??(Mi.__zod_globalRegistry=Pi());var Fi=globalThis.__zod_globalRegistry;function Ii(e){return e.checks&&=[...e.checks],e}function Li(e,t){return new e(Ii({type:`string`,...I(t)}))}function Ri(e,t){return new e({type:`string`,format:`email`,check:`string_format`,abort:!1,...I(t)})}function zi(e,t){return new e({type:`string`,format:`guid`,check:`string_format`,abort:!1,...I(t)})}function Bi(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,...I(t)})}function Vi(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v4`,...I(t)})}function Hi(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v6`,...I(t)})}function Ui(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v7`,...I(t)})}function Wi(e,t){return new e({type:`string`,format:`url`,check:`string_format`,abort:!1,...I(t)})}function Gi(e,t){return new e({type:`string`,format:`emoji`,check:`string_format`,abort:!1,...I(t)})}function Ki(e,t){return new e({type:`string`,format:`nanoid`,check:`string_format`,abort:!1,...I(t)})}function qi(e,t){return new e({type:`string`,format:`cuid`,check:`string_format`,abort:!1,...I(t)})}function Ji(e,t){return new e({type:`string`,format:`cuid2`,check:`string_format`,abort:!1,...I(t)})}function Yi(e,t){return new e({type:`string`,format:`ulid`,check:`string_format`,abort:!1,...I(t)})}function Xi(e,t){return new e({type:`string`,format:`xid`,check:`string_format`,abort:!1,...I(t)})}function Zi(e,t){return new e({type:`string`,format:`ksuid`,check:`string_format`,abort:!1,...I(t)})}function Qi(e,t){return new e({type:`string`,format:`ipv4`,check:`string_format`,abort:!1,...I(t)})}function $i(e,t){return new e({type:`string`,format:`ipv6`,check:`string_format`,abort:!1,...I(t)})}function ea(e,t){return new e({type:`string`,format:`cidrv4`,check:`string_format`,abort:!1,...I(t)})}function ta(e,t){return new e({type:`string`,format:`cidrv6`,check:`string_format`,abort:!1,...I(t)})}function na(e,t){return new e({type:`string`,format:`base64`,check:`string_format`,abort:!1,...I(t)})}function ra(e,t){return new e({type:`string`,format:`base64url`,check:`string_format`,abort:!1,...I(t)})}function ia(e,t){return new e({type:`string`,format:`e164`,check:`string_format`,abort:!1,...I(t)})}function aa(e,t){return new e({type:`string`,format:`jwt`,check:`string_format`,abort:!1,...I(t)})}function oa(e,t){return new e({type:`string`,format:`datetime`,check:`string_format`,offset:!1,local:!1,precision:null,...I(t)})}function sa(e,t){return new e({type:`string`,format:`date`,check:`string_format`,...I(t)})}function ca(e,t){return new e({type:`string`,format:`time`,check:`string_format`,precision:null,...I(t)})}function la(e,t){return new e({type:`string`,format:`duration`,check:`string_format`,...I(t)})}function ua(e,t){return new e(Ii({type:`number`,checks:[],...I(t)}))}function da(e,t){return new e({type:`number`,check:`number_format`,abort:!1,format:`safeint`,...I(t)})}function fa(e,t){return new e({type:`boolean`,...I(t)})}function pa(e,t){return new e({type:`undefined`,...I(t)})}function ma(e,t){return new e({type:`null`,...I(t)})}function ha(e){return new e({type:`unknown`})}function ga(e,t){return new e({type:`never`,...I(t)})}function _a(e,t){return new gn({check:`less_than`,...I(t),value:e,inclusive:!1})}function va(e,t){return new gn({check:`less_than`,...I(t),value:e,inclusive:!0})}function ya(e,t){return new _n({check:`greater_than`,...I(t),value:e,inclusive:!1})}function ba(e,t){return new _n({check:`greater_than`,...I(t),value:e,inclusive:!0})}function xa(e,t){return new vn({check:`multiple_of`,...I(t),value:e})}function Sa(e,t){return new bn({check:`max_length`,...I(t),maximum:e})}function Ca(e,t){return new xn({check:`min_length`,...I(t),minimum:e})}function wa(e,t){return new Sn({check:`length_equals`,...I(t),length:e})}function Ta(e,t){return new wn({check:`string_format`,format:`regex`,...I(t),pattern:e})}function Ea(e){return new Tn({check:`string_format`,format:`lowercase`,...I(e)})}function Da(e){return new En({check:`string_format`,format:`uppercase`,...I(e)})}function Oa(e,t){return new Dn({check:`string_format`,format:`includes`,...I(t),includes:e})}function ka(e,t){return new On({check:`string_format`,format:`starts_with`,...I(t),prefix:e})}function Aa(e,t){return new kn({check:`string_format`,format:`ends_with`,...I(t),suffix:e})}function ja(e){return new An({check:`overwrite`,tx:e})}function Ma(e){return ja(t=>t.normalize(e))}function Na(){return ja(e=>e.trim())}function Pa(){return ja(e=>e.toLowerCase())}function Fa(){return ja(e=>e.toUpperCase())}function Ia(){return ja(e=>ie(e))}function La(e,t,n){return new e({type:`array`,element:t,...I(n)})}function Ra(e,t,n){return new e({type:`custom`,check:`custom`,fn:t,...I(n)})}function za(e,t){let n=Ba(t=>(t.addIssue=e=>{if(typeof e==`string`)t.issues.push(Pe(e,t.value,n._zod.def));else{let r=e;r.fatal&&(r.continue=!1),r.code??=`custom`,`input`in r||(r.input=t.value),r.inst??=n,r.continue??=!n._zod.def.abort,t.issues.push(Pe(r))}},e(t.value,t)),t);return n}function Ba(e,t){let n=new pn({check:`custom`,...I(t)});return n._zod.check=e,n}function Va(e,...t){for(let n of t)for(let t of Reflect.ownKeys(n))Object.prototype.propertyIsEnumerable.call(n,t)&&A(e,t,n[t]);return e}function Ha(e){let t=e?.target??`draft-2020-12`;return t===`draft-4`&&(t=`draft-04`),t===`draft-7`&&(t=`draft-07`),{processors:e.processors??{},metadataRegistry:e?.metadata??Fi,target:t,unrepresentable:e?.unrepresentable??`throw`,override:e?.override??(()=>{}),io:e?.io??`output`,counter:0,seen:new Map,sharedDefsExtractedFor:void 0,sharedEmitDoneFor:void 0,cycles:e?.cycles??`ref`,reused:e?.reused??`inline`,intersections:[],deferred:[],external:e?.external??void 0}}function Ua(e,t,n,r,i){let a=typeof t.unrepresentable==`function`?t.unrepresentable({zodSchema:e,path:r.path,message:i}):t.unrepresentable;if(a===`any`)return!1;if(a===void 0||a===`throw`)throw Error(i);return Object.assign(n,a),!0}function Wa(e,t,n={path:[],schemaPath:[]}){var r;let i=e._zod.def,a=t.seen.get(e);if(a)return a.count++,n.schemaPath.includes(e)&&(a.cycle=n.path),a.schema;let o={schema:{},count:1,cycle:void 0,path:n.path};t.seen.set(e,o),t.sharedDefsExtractedFor=void 0,t.sharedEmitDoneFor=void 0;let s=e._zod.toJSONSchema?.();if(s)o.schema=s;else{let r={...n,schemaPath:[...n.schemaPath,e],path:n.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,o.schema,r);else{let n=o.schema,a=t.processors[i.type];if(!a)throw Error(`[toJSONSchema]: Non-representable type encountered: ${i.type}`);a(e,t,n,r)}let a=e._zod.parent;a&&(o.ref||=a,Wa(a,t,r),t.seen.get(a).isParent=!0)}let c=t.metadataRegistry.get(e);return c&&Va(o.schema,c),t.io===`input`&&eo(e)&&(delete o.schema.examples,delete o.schema.default),t.io===`input`&&`_prefault`in o.schema&&((r=o.schema).default??(r.default=o.schema._prefault)),delete o.schema._prefault,t.seen.get(e).schema}function Ga(e){return e.replace(/~/g,`~0`).replace(/\//g,`~1`)}function Ka(e,t){let n=e.seen.get(t);if(!n)throw Error(`Unprocessed schema. This is a bug in Zod.`);if(e.external&&e.sharedDefsExtractedFor===e.external)return;let r=new Map;for(let t of e.seen.entries()){let n=e.metadataRegistry.get(t[0])?.id;if(n){let e=r.get(n);if(e&&e!==t[0])throw Error(`Duplicate schema id "${n}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);r.set(n,t[0])}}let i=t=>{let r=e.target===`draft-2020-12`?`$defs`:`definitions`;if(e.external){let n=e.external.registry.get(t[0])?.id,i=e.external.uri??(e=>e);if(n)return{ref:i(n)};let a=t[1].defId??t[1].schema.id??`schema${e.counter++}`;return t[1].defId=a,{defId:a,ref:`${i(`__shared`)}#/${r}/${Ga(a)}`}}let i=`#/${r}/`;if(t[1]===n&&!t[1].schema.id)return{ref:`#`};let a=t[1].schema.id??`__schema${e.counter++}`;return{defId:a,ref:i+Ga(a)}},a=e=>{if(e[1].schema.$ref)return;let t=e[1],{ref:n,defId:r}=i(e);t.def={...t.schema},r&&(t.defId=r);let a=t.schema;for(let e in a)delete a[e];a.$ref=n};if(e.cycles===`throw`)for(let t of e.seen.entries()){let e=t[1];if(e.cycle)throw Error(`Cycle detected: #/${e.cycle?.join(`/`)}/<root>
62
62
 
63
- Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let n of e.seen.entries()){let r=n[1];if(t===n[0]){a(n);continue}if(e.external){let r=e.external.registry.get(n[0])?.id;if(t!==n[0]&&r){a(n);continue}}if(e.metadataRegistry.get(n[0])?.id){a(n);continue}if(r.cycle){a(n);continue}r.count>1&&e.reused===`ref`&&a(n)}e.external&&(e.sharedDefsExtractedFor=e.external)}function qa(e){let t=e.anyOf;if(!Array.isArray(t)||t.length===0||e.type!==void 0)return;let n=[];for(let e of t){if(!e||typeof e!=`object`)return;qa(e);let t=Object.keys(e);if(t.length!==1||t[0]!==`type`)return;let r=e.type;for(let e of Array.isArray(r)?r:[r]){if(typeof e!=`string`)return;n.includes(e)||n.push(e)}}delete e.anyOf,e.type=n.length===1?n[0]:n}var Ja=new Set([`type`,`properties`,`required`,`additionalProperties`]),Ya=[`oneOf`,`anyOf`];function Xa(e){let t=e.additionalProperties;return t===void 0||t===!1||typeof t!=`object`||!t?null:Object.keys(t).length?t:null}function Za(e){let t=[];for(let n of e){if(typeof n!=`object`||n.type!==`object`)return null;for(let e in n)if(!Ja.has(e))return null;t.push(n)}let n={},r=new Set;for(let e of t){for(let r in e.properties){if(Object.prototype.hasOwnProperty.call(n,r))continue;let e=[];for(let n of t){let t=n.properties?.[r]??Xa(n);t!=null&&(e.some(e=>JSON.stringify(e)===JSON.stringify(t))||e.push(t))}A(n,r,e.length===1?e[0]:Za(e)??{allOf:e})}for(let t of e.required??[])r.add(t)}let i={type:`object`,properties:n};if(r.size&&(i.required=[...r]),t.every(e=>e.additionalProperties===!1))i.additionalProperties=!1;else{let e=[];for(let n of t){let t=Xa(n);t&&!e.some(e=>JSON.stringify(e)===JSON.stringify(t))&&e.push(t)}e.length===1?i.additionalProperties=e[0]:e.length>1&&(i.additionalProperties={allOf:e})}return i}function Qa(e){let t=e.allOf;if(!Array.isArray(t)||t.length<2)return;for(let t of Ja)if(t in e)return;let n=t.filter(e=>Ya.some(t=>Array.isArray(e[t]))),r=null;if(!n.length)r=Za(t);else{let e=n[0],i=Ya.find(t=>Array.isArray(e[t]));if(Object.keys(e).length!==1)return;let a=t.filter(t=>t!==e),o=e[i].map(e=>Za([...a,e]));if(o.some(e=>!e))return;r={[i]:o}}r&&(delete e.allOf,Va(e,r))}function $a(e,t){let n=e.seen.get(t);if(!n)throw Error(`Unprocessed schema. This is a bug in Zod.`);let r=t=>{let n=e.seen.get(t);if(n.ref===null)return;let i=n.def??n.schema,a={...i},o=n.ref;if(n.ref=null,o){r(o);let n=e.seen.get(o),s=n.schema;if(s.$ref&&(e.target===`draft-07`||e.target===`draft-04`||e.target===`openapi-3.0`)?(i.allOf=i.allOf??[],i.allOf.push(s)):Va(i,s),Va(i,a),t._zod.parent===o)for(let e in i)e!==`$ref`&&e!==`allOf`&&(e in a||delete i[e]);if(s.$ref&&n.def)for(let e in i)e!==`$ref`&&e!==`allOf`&&e in n.def&&JSON.stringify(i[e])===JSON.stringify(n.def[e])&&delete i[e]}let s=t._zod.parent;if(s&&s!==o){r(s);let t=e.seen.get(s);if(t?.schema.$ref&&(i.$ref=t.schema.$ref,t.def))for(let e in i)e!==`$ref`&&e!==`allOf`&&e in t.def&&JSON.stringify(i[e])===JSON.stringify(t.def[e])&&delete i[e]}e.override({zodSchema:t,jsonSchema:i,path:n.path??[]})};if(!e.external||e.sharedEmitDoneFor!==e.external){for(let t of[...e.seen.entries()].reverse())r(t[0]);if(e.target!==`openapi-3.0`)for(let t of e.seen.entries())qa(t[1].def??t[1].schema);for(let t of e.deferred)t();if(e.intersections.length){let t=new Map;for(let n of e.seen.values())for(let e of[n.schema,n.def]){let n=e?.allOf;if(!Array.isArray(n))continue;let r=t.get(n);r?r.push(e):t.set(n,[e])}for(let n of e.intersections)for(let e of t.get(n)??[])Qa(e)}}let i={};if(e.target===`draft-2020-12`?i.$schema=`https://json-schema.org/draft/2020-12/schema`:e.target===`draft-07`?i.$schema=`http://json-schema.org/draft-07/schema#`:e.target===`draft-04`?i.$schema=`http://json-schema.org/draft-04/schema#`:e.target,e.external?.uri){let n=e.external.registry.get(t)?.id;if(!n)throw Error("Schema is missing an `id` property");i.$id=e.external.uri(n)}Va(i,n.defId?n.schema:n.def??n.schema);let a=e.metadataRegistry.get(t)?.id;a!==void 0&&i.id===a&&delete i.id;let o=e.external?.defs??{};if(!e.external||e.sharedEmitDoneFor!==e.external)for(let t of e.seen.entries()){let e=t[1];e.def&&e.defId&&(e.def.id===e.defId&&delete e.def.id,A(o,e.defId,e.def))}e.external&&(e.sharedEmitDoneFor=e.external),e.external||Object.keys(o).length>0&&(e.target===`draft-2020-12`?i.$defs=o:i.definitions=o);try{let n=JSON.parse(JSON.stringify(i));return Object.defineProperty(n,"~standard",{value:{...t[`~standard`],jsonSchema:{input:no(t,`input`,e.processors),output:no(t,`output`,e.processors)}},enumerable:!1,writable:!1}),n}catch{throw Error(`Error converting schema to JSON.`)}}function eo(e,t){let n=t??{seen:new Set};if(n.seen.has(e))return!1;n.seen.add(e);let r=e._zod.def;if(r.type===`transform`)return!0;if(r.type===`array`)return eo(r.element,n);if(r.type===`set`)return eo(r.valueType,n);if(r.type===`lazy`)return eo(r.getter(),n);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 eo(r.innerType,n);if(r.type===`intersection`)return eo(r.left,n)||eo(r.right,n);if(r.type===`record`||r.type===`map`)return eo(r.keyType,n)||eo(r.valueType,n);if(r.type===`pipe`)return e._zod.traits.has(`$ZodCodec`)?!0:eo(r.in,n)||eo(r.out,n);if(r.type===`object`){for(let e in r.shape)if(eo(r.shape[e],n))return!0;return!1}if(r.type===`union`){for(let e of r.options)if(eo(e,n))return!0;return!1}if(r.type===`tuple`){for(let e of r.items)if(eo(e,n))return!0;return!!(r.rest&&eo(r.rest,n))}return!1}var to=(e,t={})=>n=>{let r=Ha({...n,processors:t});return Wa(e,r),Ka(r,e),$a(r,e)},no=(e,t,n={})=>r=>{let{libraryOptions:i,target:a}=r??{},o=Ha({...i??{},target:a,io:t,processors:n});return Wa(e,o),Ka(o,e),$a(o,e)},ro=(e,t,n)=>{(e[t]===void 0||n>e[t])&&(e[t]=n)},io=(e,t,n)=>{(e[t]===void 0||n<e[t])&&(e[t]=n)},ao=(e,t)=>{ro(e,`minimum`,t),io(e,`maximum`,t)},oo=(e,t)=>{e.multipleOf??=[],e.multipleOf.includes(t)||e.multipleOf.push(t)},so=(e,t)=>{e.patterns??=new Set,e.patterns.add(t)},co=(e,t)=>{e.mime=e.mime?e.mime.filter(e=>t.includes(e)):[...t]},lo=(e,t)=>{e.format=t,t.includes(`int`)&&(e.isInt=!0)},uo=(e,t)=>ro(e,`minimum`,t.minimum),fo=(e,t)=>io(e,`maximum`,t.maximum),po=e=>(t,n)=>{lo(t,n.format);let[r,i]=e[n.format];ro(t,`minimum`,r),io(t,`maximum`,i)},mo={greater_than:(e,t)=>ro(e,t.inclusive?`minimum`:`exclusiveMinimum`,t.value),less_than:(e,t)=>io(e,t.inclusive?`maximum`:`exclusiveMaximum`,t.value),multiple_of:(e,t)=>oo(e,t.value),number_format:po(L),bigint_format:po(me),min_length:uo,max_length:fo,length_equals:(e,t)=>ao(e,t.length),min_size:uo,max_size:fo,size_equals:(e,t)=>ao(e,t.size),string_format:(e,t)=>{lo(e,t.format),t.pattern&&so(e,t.pattern),(t.format===`base64`||t.format===`base64url`)&&(e.contentEncoding=t.format),(t.local||t.precision===-1)&&(e.laxFormat=!0)},mime_type:(e,t)=>co(e,t.mime)};function ho(e){let t={},n=e._zod.def,r=e._zod.traits.has(`$ZodCheck`)?[e,...n.checks??[]]:n.checks??[];for(let e of r)mo[e._zod.def.check]?.(t,e._zod.def);let i=e._zod.bag;i.minimum!==void 0&&ro(t,`minimum`,i.minimum),i.exclusiveMinimum!==void 0&&ro(t,`exclusiveMinimum`,i.exclusiveMinimum),i.maximum!==void 0&&io(t,`maximum`,i.maximum),i.exclusiveMaximum!==void 0&&io(t,`exclusiveMaximum`,i.exclusiveMaximum),i.multipleOf!==void 0&&oo(t,i.multipleOf),i.format!==void 0&&(t.format??=i.format,i.format.includes(`int`)&&(t.isInt=!0)),i.mime&&co(t,i.mime);for(let e of i.patterns??[])so(t,e);return t}var go={guid:`uuid`,url:`uri`,datetime:`date-time`,json_string:`json-string`,regex:``},_o=new Map([[hr,Jt],[_r,Yt]]),vo=e=>_o.get(e)??e,yo=(e,t,n,r)=>{let i=n;i.type=`string`;let{minimum:a,maximum:o,format:s,patterns:c,contentEncoding:l,laxFormat:u}=ho(e);if(typeof a==`number`&&(i.minLength=a),typeof o==`number`&&(i.maxLength=o),s&&(i.format=go[s]??s,i.format===``&&delete i.format,(s===`time`||u)&&delete i.format),l&&(i.contentEncoding=l),c&&c.size>0){let e=[...c].map(vo);e.length===1?i.pattern=e[0].source:e.length>1&&(i.allOf=[...e.map(e=>({...t.target===`draft-07`||t.target===`draft-04`||t.target===`openapi-3.0`?{type:`string`}:{},pattern:e.source}))])}},bo=(e,t,n,r)=>{let i=n,{minimum:a,maximum:o,multipleOf:s,exclusiveMaximum:c,exclusiveMinimum:l,isInt:u}=ho(e);i.type=u?`integer`:`number`;let d=typeof l==`number`&&l>=(a??-1/0),f=typeof c==`number`&&c<=(o??1/0),p=t.target===`draft-04`||t.target===`openapi-3.0`;if(d?p?(i.minimum=l,i.exclusiveMinimum=!0):i.exclusiveMinimum=l:typeof a==`number`&&(i.minimum=a),f?p?(i.maximum=c,i.exclusiveMaximum=!0):i.exclusiveMaximum=c:typeof o==`number`&&(i.maximum=o),s){let n=new Set;for(let a of s)Number.isFinite(a)&&a!==0?n.add(Math.abs(a)):Ua(e,t,i,r,`A multipleOf divisor of ${a} cannot be represented in JSON Schema`);let[a,...o]=n;a!==void 0&&(i.multipleOf=a),o.length&&(i.allOf=[...i.allOf??[],...o.map(e=>({multipleOf:e}))])}},xo=(e,t,n,r)=>{n.type=`boolean`},So=(e,t,n,r)=>{t.target===`openapi-3.0`?(n.type=`string`,n.nullable=!0,n.enum=[null]):n.type=`null`},Co=(e,t,n,r)=>{Ua(e,t,n,r,`Undefined cannot be represented in JSON Schema`)},wo=(e,t,n,r)=>{n.not={}},To=(e,t,n,r)=>{let i=e._zod.def,a=b(i.entries);if(a.length===0){n.not={};return}a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),n.enum=a},Eo=(e,t,n,r)=>{let i=e._zod.def;if(i.values.length===0){n.not={};return}let a=[];for(let o of i.values)if(o===void 0){if(Ua(e,t,n,r,"Literal `undefined` cannot be represented in JSON Schema"))return}else if(typeof o==`bigint`){if(Ua(e,t,n,r,`BigInt literals cannot be represented in JSON Schema`))return;a.push(Number(o))}else a.push(o);if(a.length!==0){if(a.length===1){let e=a[0];n.type=e===null?`null`:typeof e,t.target===`draft-04`||t.target===`openapi-3.0`?n.enum=[e]:n.const=e}else a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),a.every(e=>typeof e==`boolean`)&&(n.type=`boolean`),a.every(e=>e===null)&&(n.type=`null`),n.enum=a}},Do=(e,t,n,r)=>{Ua(e,t,n,r,`Custom types cannot be represented in JSON Schema`)},Oo=(e,t,n,r)=>{Ua(e,t,n,r,`Transforms cannot be represented in JSON Schema`)},ko=(e,t,n,r)=>{let i=n,a=e._zod.def,{minimum:o,maximum:s}=ho(e);typeof o==`number`&&(i.minItems=o),typeof s==`number`&&(i.maxItems=s),i.type=`array`,i.items=Wa(a.element,t,{...r,path:[...r.path,`items`]})};function Ao(e){let t=e._zod.def;return t.type===`pipe`&&t.in._zod.traits.has(`$ZodTransform`)?Ao(t.out):t.type===`catch`?Ao(t.innerType):e._zod.optin}var jo=(e,t,n,r)=>{let i=n,a=e._zod.def,o=a.shape;if(Object.getOwnPropertySymbols(o).length&&Ua(e,t,i,r,`Symbol keys cannot be represented in JSON Schema`))return;i.type=`object`,i.properties={};for(let e in o)A(i.properties,e,Wa(o[e],t,{...r,path:[...r.path,`properties`,e]}));let s=[];for(let e of Object.keys(o)){let n=a.shape[e];(t.io===`input`?Ao(n)===void 0:n._zod.optout===void 0)&&s.push(e)}s.length>0&&(i.required=s),a.catchall?._zod.def.type===`never`?i.additionalProperties=!1:a.catchall?a.catchall&&(i.additionalProperties=Wa(a.catchall,t,{...r,path:[...r.path,`additionalProperties`]})):t.io===`output`&&(i.additionalProperties=!1)},Mo=(e,t,n,r)=>{let i=e._zod.def,a=i.inclusive===!1,o=i.options.map((e,n)=>Wa(e,t,{...r,path:[...r.path,a?`oneOf`:`anyOf`,n]}));a?n.oneOf=o:n.anyOf=o},No=(e,t,n,r)=>{let i=e._zod.def,a=Wa(i.left,t,{...r,path:[...r.path,`allOf`,0]}),o=Wa(i.right,t,{...r,path:[...r.path,`allOf`,1]}),s=e=>`allOf`in e&&Object.keys(e).length===1,c=[...s(a)?a.allOf:[a],...s(o)?o.allOf:[o]];n.allOf=c,t.intersections.push(c)};function Po(e,t,n){if(t.$ref){if(n.has(t))return t;n.add(t);let r=e.get(t)?.def;if(!r)return t;let i=Po(e,r,n);return i===r?t:i}for(let r of[`anyOf`,`oneOf`]){let i=t[r];if(!Array.isArray(i))continue;let a=i.map(t=>Po(e,t,n));a.some((e,t)=>e!==i[t])&&(t={...t,[r]:a})}let r=Array.isArray(t.type)?t.type:[t.type],i=!r.includes(`string`)&&r.some(e=>e===`number`||e===`integer`),a=t.enum??(t.const===void 0?void 0:[t.const]);if(!i&&!a?.some(e=>typeof e==`number`))return t;let{minimum:o,maximum:s,exclusiveMinimum:c,exclusiveMaximum:l,multipleOf:u,format:d,id:f,...p}=t;return p.enum?p.enum=p.enum.map(e=>typeof e==`number`?String(e):e):typeof p.const==`number`&&(p.const=String(p.const)),i?(p.type=`string`,a||(p.pattern=(r.includes(`number`)?sn:on).source),p):p}var Fo=new WeakMap;function Io(e){let t=new Map;for(let n of e.seen.values())n.def&&!t.has(n.schema)&&t.set(n.schema,n);let n=new Map;for(let r of Fo.get(e)??[]){let i=e.seen.get(r),a=(i?.def??i?.schema)?.propertyNames;if(!a||a===!0||n.has(a))continue;let o=Po(t,a,new Set);o!==a&&n.set(a,o)}if(n.size)for(let t of e.seen.values())for(let e of[t.schema,t.def]){let t=e&&n.get(e.propertyNames);t&&(e.propertyNames=t)}}var Lo=(e,t,n,r)=>{let i=n,a=e._zod.def;i.type=`object`;let o=a.keyType,s=ho(o).patterns;if(a.mode===`loose`&&s&&s.size>0){let e=Wa(a.valueType,t,{...r,path:[...r.path,`patternProperties`,`*`]});i.patternProperties={};for(let t of s)A(i.patternProperties,vo(t).source,e)}else{if(t.target===`draft-07`||t.target===`draft-2020-12`){i.propertyNames=Wa(a.keyType,t,{...r,path:[...r.path,`propertyNames`]});let n=Fo.get(t);n||(n=[],Fo.set(t,n),t.deferred.push(()=>Io(t))),n.push(e)}i.additionalProperties=Wa(a.valueType,t,{...r,path:[...r.path,`additionalProperties`]})}let c=o._zod.values,l=t.io===`input`&&Ao(a.valueType)!==void 0;if(c&&!a.partial&&!l){let e=[...c].filter(e=>typeof e==`string`||typeof e==`number`);e.length>0&&(i.required=e.map(String))}},Ro=(e,t,n,r)=>{let i=e._zod.def,a=Wa(i.innerType,t,r),o=t.seen.get(e);t.target===`openapi-3.0`?(o.ref=i.innerType,n.nullable=!0):n.anyOf=[a,{type:`null`}]},zo=(e,t,n,r)=>{let i=e._zod.def;Wa(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},Bo=Symbol();function Vo(e,t,n,r,i){let a=!1,o=JSON.stringify(e,(e,t)=>typeof t==`bigint`?(a=!0,null):t);return a?(Ua(t,n,r,i,`BigInt defaults cannot be represented in JSON Schema`),Bo):JSON.parse(o)}var Ho=(e,t,n,r)=>{let i=e._zod.def;Wa(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType;let o=Vo(i.defaultValue,e,t,n,r);o!==Bo&&(n.default=o)},Uo=(e,t,n,r)=>{let i=e._zod.def;Wa(i.innerType,t,r);let a=t.seen.get(e);if(a.ref=i.innerType,t.io!==`input`)return;let o=Vo(i.defaultValue,e,t,n,r);o!==Bo&&(n._prefault=o)},Wo=(e,t,n,r)=>{let i=e._zod.def;Wa(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType;let o;try{o=i.catchValue(void 0)}catch{Ua(e,t,n,r,`Dynamic catch values are not supported in JSON Schema`);return}n.default=o},z=(e,t,n,r)=>{let i=e._zod.def,a=i.in._zod.traits.has(`$ZodTransform`),o=t.io===`input`?a?i.out:i.in:i.out;Wa(o,t,r);let s=t.seen.get(e);s.ref=o},Go=(e,t,n,r)=>{let i=e._zod.def;Wa(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.readOnly=!0},Ko=(e,t,n,r)=>{let i=e._zod.def;Wa(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},qo=(e,t,n,r)=>{let i=e._zod.innerType;Wa(i,t,r);let a=t.seen.get(e);a.ref=i},Jo=new WeakSet([Object.prototype,Error.prototype]);function Yo(e,t,n){Object.defineProperty(e,t,{configurable:!0,enumerable:!1,get(){let e=n(this);return Object.defineProperty(this,t,{value:e,configurable:!0,writable:!0}),e},set(e){Object.defineProperty(this,t,{value:e,configurable:!0,writable:!0})}})}var Xo=R(`ZodError`,(e,t)=>{ct.init(e,t),e.name=`ZodError`;let n=Object.getPrototypeOf(e);Jo.has(n)||(Jo.add(n),Yo(n,`format`,e=>t=>dt(e,t)),Yo(n,`flatten`,e=>t=>ut(e,t)),Yo(n,`addIssue`,e=>t=>{e.issues.push(t),e.message=JSON.stringify(e.issues,S,2)}),Yo(n,`addIssues`,e=>t=>{e.issues.push(...t),e.message=JSON.stringify(e.issues,S,2)}),Object.defineProperty(n,"isEmpty",{configurable:!0,enumerable:!1,get(){return this.issues.length===0}}))},void 0,{Parent:Error}),Zo=pt(Xo),Qo=mt(Xo),$o=ht(Xo),es=_t(Xo),ts=Ct(Xo),ns=wt(Xo),rs=Tt(Xo),is=Et(Xo),as=Dt(Xo),os=Ot(Xo),ss=kt(Xo),cs=At(Xo);function ls(){et.localeError||tt(ji())}function us(){et.memoizer||tt({memoizer:Oi()})}var ds=R(`ZodType`,(e,t)=>(ls(),Nn.init(e,t),e.def=t,e.type=t.type,e),{check(...e){let t=this.def;return this.clone(P(t,{checks:[...t.checks??[],...e.map(e=>typeof e==`function`?{_zod:{check:e,def:{check:`custom`},onattach:[]}}:e)]}),{parent:!0})},with(...e){return this.check(...e)},clone(e,t){return de(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},refine(e,t){return this.check(jc(e,t))},superRefine(e,t){return this.check(Mc(e,t))},overwrite(e){return this.check(ja(e))},optional(){return fc(this)},exactOptional(){return mc(this)},nullable(){return gc(this)},nullish(){return fc(gc(this))},nonoptional(e){return Sc(this,e)},array(){return U(this)},or(e){return G([this,e])},and(e){return ic(this,e)},transform(e){return Ec(this,uc(e))},default(e){return vc(this,e)},prefault(e){return bc(this,e)},catch(e){return wc(this,e)},pipe(e){return Ec(this,e)},readonly(){return Oc(this)},describe(e){let t=this.clone();return Fi.add(t,{description:e}),t},meta(...e){if(e.length===0)return Fi.get(this);let t=this.clone();return Fi.add(t,e[0]),t},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(e,...t){return t.length===0?e(this):e(this,...t)},get"~standard"(){return Le(this,`~standard`,{...In(this),jsonSchema:{input:no(this,`input`),output:no(this,`output`)}})},set"~standard"(e){Ie(this,`~standard`,e)},parse:function e(t,n){return Zo(this,t,n,{callee:e})},parseAsync:async function e(t,n){return await Qo(this,t,n,{callee:e})},safeParse(e,t){return $o(this,e,t)},async safeParseAsync(e,t){return es(this,e,t)},get spa(){return this?.safeParseAsync},set spa(e){Ie(this,`spa`,e)},validate(e,t){return bt(this,e,t)},validateAsync(e,t){return St(this,e,t)},encode:function e(t,n){return ts(this,t,n,{callee:e})},decode:function e(t,n){return ns(this,t,n,{callee:e})},encodeAsync:async function e(t,n){return await rs(this,t,n,{callee:e})},decodeAsync:async function e(t,n){return await is(this,t,n,{callee:e})},safeEncode(e,t){return as(this,e,t)},safeDecode(e,t){return os(this,e,t)},async safeEncodeAsync(e,t){return ss(this,e,t)},async safeDecodeAsync(e,t){return cs(this,e,t)},toJSONSchema(e){return to(this,{})(e)},get description(){return Fi.get(this)?.description},get _def(){return this._zod.def}}),fs=R(`_ZodString`,(e,t)=>{Ln.init(e,t),ds.init(e,t),e._zod.processJSONSchema=(t,n,r)=>yo(e,t,n,r)},Re({format:e=>ho(e).format??null,minLength:e=>ho(e).minimum??null,maxLength:e=>ho(e).maximum??null},{regex(...e){return this.check(Ta(...e))},includes(...e){return this.check(Oa(...e))},startsWith(...e){return this.check(ka(...e))},endsWith(...e){return this.check(Aa(...e))},min(...e){return this.check(Ca(...e))},max(...e){return this.check(Sa(...e))},length(...e){return this.check(wa(...e))},nonempty(...e){return this.check(Ca(1,...e))},lowercase(e){return this.check(Ea(e))},uppercase(e){return this.check(Da(e))},trim(){return this.check(Na())},normalize(...e){return this.check(Ma(...e))},toLowerCase(){return this.check(Pa())},toUpperCase(){return this.check(Fa())},slugify(){return this.check(Ia())}})),ps=R(`ZodString`,(e,t)=>{Ln.init(e,t),fs.init(e,t)},{email(e){return this.check(Ri(ys,e))},url(e){return this.check(Wi(Ss,e))},jwt(e){return this.check(aa(Ls,e))},emoji(e){return this.check(Gi(Cs,e))},guid(e){return this.check(zi(bs,e))},uuid(e){return this.check(Bi(xs,e))},uuidv4(e){return this.check(Vi(xs,e))},uuidv6(e){return this.check(Hi(xs,e))},uuidv7(e){return this.check(Ui(xs,e))},nanoid(e){return this.check(Ki(ws,e))},cuid(e){return this.check(qi(Ts,e))},cuid2(e){return this.check(Ji(Es,e))},ulid(e){return this.check(Yi(Ds,e))},base64(e){return this.check(na(Ps,e))},base64url(e){return this.check(ra(Fs,e))},xid(e){return this.check(Xi(Os,e))},ksuid(e){return this.check(Zi(ks,e))},ipv4(e){return this.check(Qi(As,e))},ipv6(e){return this.check($i(js,e))},cidrv4(e){return this.check(ea(Ms,e))},cidrv6(e){return this.check(ta(Ns,e))},e164(e){return this.check(ia(Is,e))},datetime(e){return this.check(oa(hs,e))},date(e){return this.check(sa(gs,e))},time(e){return this.check(ca(_s,e))},duration(e){return this.check(la(vs,e))}});function B(e){return Li(ps,e)}var ms=R(`ZodStringFormat`,(e,t)=>{Rn.init(e,t),fs.init(e,t)}),hs=R(`ZodISODateTime`,(e,t)=>{rr.init(e,t),ms.init(e,t)}),gs=R(`ZodISODate`,(e,t)=>{ir.init(e,t),ms.init(e,t)}),_s=R(`ZodISOTime`,(e,t)=>{ar.init(e,t),ms.init(e,t)}),vs=R(`ZodISODuration`,(e,t)=>{or.init(e,t),ms.init(e,t)}),ys=R(`ZodEmail`,(e,t)=>{Vn.init(e,t),ms.init(e,t)}),bs=R(`ZodGUID`,(e,t)=>{zn.init(e,t),ms.init(e,t)}),xs=R(`ZodUUID`,(e,t)=>{Bn.init(e,t),ms.init(e,t)}),Ss=R(`ZodURL`,(e,t)=>{Yn.init(e,t),ms.init(e,t)}),Cs=R(`ZodEmoji`,(e,t)=>{Xn.init(e,t),ms.init(e,t)}),ws=R(`ZodNanoID`,(e,t)=>{Zn.init(e,t),ms.init(e,t)}),Ts=R(`ZodCUID`,(e,t)=>{Qn.init(e,t),ms.init(e,t)}),Es=R(`ZodCUID2`,(e,t)=>{$n.init(e,t),ms.init(e,t)}),Ds=R(`ZodULID`,(e,t)=>{er.init(e,t),ms.init(e,t)}),Os=R(`ZodXID`,(e,t)=>{tr.init(e,t),ms.init(e,t)}),ks=R(`ZodKSUID`,(e,t)=>{nr.init(e,t),ms.init(e,t)}),As=R(`ZodIPv4`,(e,t)=>{sr.init(e,t),ms.init(e,t)}),js=R(`ZodIPv6`,(e,t)=>{ur.init(e,t),ms.init(e,t)}),Ms=R(`ZodCIDRv4`,(e,t)=>{dr.init(e,t),ms.init(e,t)}),Ns=R(`ZodCIDRv6`,(e,t)=>{pr.init(e,t),ms.init(e,t)}),Ps=R(`ZodBase64`,(e,t)=>{gr.init(e,t),ms.init(e,t)}),Fs=R(`ZodBase64URL`,(e,t)=>{yr.init(e,t),ms.init(e,t)}),Is=R(`ZodE164`,(e,t)=>{br.init(e,t),ms.init(e,t)}),Ls=R(`ZodJWT`,(e,t)=>{Sr.init(e,t),ms.init(e,t)}),Rs=R(`ZodNumber`,(e,t)=>{Cr.init(e,t),ds.init(e,t),e._zod.processJSONSchema=(t,n,r)=>bo(e,t,n,r),e.isFinite=!0},Re({minValue:e=>{let{minimum:t,exclusiveMinimum:n}=ho(e);return Math.max(t??-1/0,n??-1/0)},maxValue:e=>{let{maximum:t,exclusiveMaximum:n}=ho(e);return Math.min(t??1/0,n??1/0)},isInt:e=>{let{isInt:t,multipleOf:n}=ho(e);return!!t||!!n?.some(Number.isSafeInteger)},format:e=>ho(e).format??null},{gt(e,t){return this.check(ya(e,t))},gte(e,t){return this.check(ba(e,t))},min(e,t){return this.check(ba(e,t))},lt(e,t){return this.check(_a(e,t))},lte(e,t){return this.check(va(e,t))},max(e,t){return this.check(va(e,t))},int(e){return this.check(Bs(e))},safe(e){return this.check(Bs(e))},positive(e){return this.check(ya(0,e))},nonnegative(e){return this.check(ba(0,e))},negative(e){return this.check(_a(0,e))},nonpositive(e){return this.check(va(0,e))},multipleOf(e,t){return this.check(xa(e,t))},step(e,t){return this.check(xa(e,t))},finite(){return this}}));function V(e){return ua(Rs,e)}var zs=R(`ZodNumberFormat`,(e,t)=>{wr.init(e,t),Rs.init(e,t)});function Bs(e){return da(zs,e)}var Vs=R(`ZodBoolean`,(e,t)=>{Tr.init(e,t),ds.init(e,t),e._zod.processJSONSchema=(t,n,r)=>xo(e,t,n,r)});function Hs(e){return fa(Vs,e)}var Us=R(`ZodUndefined`,(e,t)=>{Er.init(e,t),ds.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Co(e,t,n,r)});function H(e){return pa(Us,e)}var Ws=R(`ZodNull`,(e,t)=>{Dr.init(e,t),ds.init(e,t),e._zod.processJSONSchema=(t,n,r)=>So(e,t,n,r)});function Gs(e){return ma(Ws,e)}var Ks=R(`ZodUnknown`,(e,t)=>{Or.init(e,t),ds.init(e,t),e._zod.processJSONSchema=(e,t,n)=>void 0});function qs(){return ha(Ks)}var Js=R(`ZodNever`,(e,t)=>{kr.init(e,t),ds.init(e,t),e._zod.processJSONSchema=(t,n,r)=>wo(e,t,n,r)});function Ys(e){return ga(Js,e)}var Xs=R(`ZodArray`,(e,t)=>{us(),jr.init(e,t),ds.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ko(e,t,n,r),e.element=t.element},{min(e,t){return this.check(Ca(e,t))},nonempty(e){return this.check(Ca(1,e))},max(e,t){return this.check(Sa(e,t))},length(e,t){return this.check(wa(e,t))},unwrap(){return this.element}});function U(e,t){return La(Xs,e,t)}var Zs=R(`ZodObject`,(e,t)=>{us(),Lr.init(e,t),ds.init(e,t),e._zod.processJSONSchema=(t,n,r)=>jo(e,t,n,r),Ge(e,`shape`,e=>e._zod.def.shape,!1)},{keyof(){return K(Object.keys(this._zod.def.shape))},catchall(e){return this.clone(P(this._zod.def,{catchall:e}))},passthrough(){return this.clone(P(this._zod.def,{catchall:qs()}))},loose(){return this.clone(P(this._zod.def,{catchall:qs()}))},strict(){return this.clone(P(this._zod.def,{catchall:Ys()}))},strip(){return this.clone(P(this._zod.def,{catchall:void 0}))},extend(e){return ve(this,e)},safeExtend(e){return be(this,e)},merge(e){return xe(this,e)},pick(e){return he(this,e)},omit(e){return _e(this,e)},partial(...e){return Se(dc,this,e[0])},exactPartial(...e){return Se(pc,this,e[0],`exactPartial`)},required(...e){return Ce(xc,this,e[0])}});function W(e,t){return new Zs({type:`object`,shape:e??{},...I(t)})}function Qs(e,t){return new Zs({type:`object`,shape:e,catchall:Ys(),...I(t)})}function $s(e,t){return new Zs({type:`object`,shape:e,catchall:qs(),...I(t)})}var ec=R(`ZodUnion`,(e,t)=>{zr.init(e,t),ds.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Mo(e,t,n,r),e.options=t.options});function G(e,t){return new ec({type:`union`,options:e,...I(t)})}var tc=R(`ZodDiscriminatedUnion`,(e,t)=>{ec.init(e,t),Vr.init(e,t)});function nc(e,t,n){return new tc({type:`union`,options:t,discriminator:e,...I(n)})}var rc=R(`ZodIntersection`,(e,t)=>{Hr.init(e,t),ds.init(e,t),e._zod.processJSONSchema=(t,n,r)=>No(e,t,n,r)});function ic(e,t){return new rc({type:`intersection`,left:e,right:t})}var ac=R(`ZodRecord`,(e,t)=>{us(),Gr.init(e,t),ds.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Lo(e,t,n,r),e.keyType=t.keyType,e.valueType=t.valueType});function oc(e,t,n){return!t||!t._zod?new ac({type:`record`,keyType:B(),valueType:e,...I(t)}):new ac({type:`record`,keyType:e,valueType:t,...I(n)})}var sc=R(`ZodEnum`,(e,t)=>{Kr.init(e,t),ds.init(e,t),e._zod.processJSONSchema=(t,n,r)=>To(e,t,n,r),e.enum=t.entries,e.options=[...e._zod.values];let n=new Set(Object.keys(t.entries));e.extract=(e,r)=>{let i={};for(let r of e)if(n.has(r))i[r]=t.entries[r];else throw Error(`Key ${r} not found in enum`);return new sc({...t,checks:[],...I(r),entries:i})},e.exclude=(e,r)=>{let i={...t.entries};for(let t of e)if(n.has(t))delete i[t];else throw Error(`Key ${t} not found in enum`);return new sc({...t,checks:[],...I(r),entries:i})}});function K(e,t){return new sc({type:`enum`,entries:Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e,...I(t)})}var cc=R(`ZodLiteral`,(e,t)=>{qr.init(e,t),ds.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Eo(e,t,n,r),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function q(e,t){return new cc({type:`literal`,values:Array.isArray(e)?e:[e],...I(t)})}var lc=R(`ZodTransform`,(e,t)=>{us(),Jr.init(e,t),ds.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Oo(e,t,n,r),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new $e(e.constructor.name);n.addIssue=r=>{if(typeof r==`string`)n.issues.push(Pe(r,n.value,t));else{let t=r;t.fatal&&(t.continue=!1),t.code??=`custom`,`input`in t||(t.input=n.value),t.inst??=e,n.issues.push(Pe(t))}};let i=t.transform(n.value,n);return i instanceof Promise?i.then(e=>(n.value=e,n)):(n.value=i,n)}});function uc(e){return new lc({type:`transform`,transform:e})}var dc=R(`ZodOptional`,(e,t)=>{Xr.init(e,t),ds.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ko(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function fc(e){return new dc({type:`optional`,innerType:e})}var pc=R(`ZodExactOptional`,(e,t)=>{Zr.init(e,t),ds.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ko(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function mc(e){return new pc({type:`optional`,innerType:e})}var hc=R(`ZodNullable`,(e,t)=>{Qr.init(e,t),ds.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ro(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function gc(e){return new hc({type:`nullable`,innerType:e})}var _c=R(`ZodDefault`,(e,t)=>{$r.init(e,t),ds.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ho(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function vc(e,t){return new _c({type:`default`,innerType:e,get defaultValue(){return typeof t==`function`?t():ce(t)}})}var yc=R(`ZodPrefault`,(e,t)=>{ti.init(e,t),ds.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Uo(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function bc(e,t){return new yc({type:`prefault`,innerType:e,get defaultValue(){return typeof t==`function`?t():ce(t)}})}var xc=R(`ZodNonOptional`,(e,t)=>{ni.init(e,t),ds.init(e,t),e._zod.processJSONSchema=(t,n,r)=>zo(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Sc(e,t){return new xc({type:`nonoptional`,innerType:e,...I(t)})}var Cc=R(`ZodCatch`,(e,t)=>{ai.init(e,t),ds.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Wo(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function wc(e,t){return new Cc({type:`catch`,innerType:e,catchValue:typeof t==`function`?t:qe(t)})}var Tc=R(`ZodPipe`,(e,t)=>{oi.init(e,t),ds.init(e,t),e._zod.processJSONSchema=(t,n,r)=>z(e,t,n,r),e.in=t.in,e.out=t.out});function Ec(e,t){return new Tc({type:`pipe`,in:e,out:t})}var Dc=R(`ZodReadonly`,(e,t)=>{ci.init(e,t),ds.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Go(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Oc(e){return new Dc({type:`readonly`,innerType:e})}var kc=R(`ZodLazy`,(e,t)=>{ui.init(e,t),ds.init(e,t),e._zod.processJSONSchema=(t,n,r)=>qo(e,t,n,r),e.unwrap=()=>e._zod.def.getter()});function J(e){return new kc({type:`lazy`,getter:e})}var Ac=R(`ZodCustom`,(e,t)=>{di.init(e,t),ds.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Do(e,t,n,r)});function jc(e,t={}){return Ra(Ac,e,t)}function Mc(e,t){return za(e,t)}function Nc(e){return oa(hs,e)}var Pc=Object.defineProperty,Fc=(e,t)=>{let n={};for(var r in e)Pc(n,r,{get:e[r],enumerable:!0});return t||Pc(n,Symbol.toStringTag,{value:`Module`}),n},Ic=Fc({aggregatedMetricSchema:()=>qc,metricsBaseSchema:()=>Bc,otelExponentialHistogramSchema:()=>Wc,otelGaugeSchema:()=>Vc,otelHistogramSchema:()=>Uc,otelLogsSchema:()=>zc,otelMetricsSchema:()=>Kc,otelSumSchema:()=>Hc,otelSummarySchema:()=>Gc,otelTracesSchema:()=>Rc}),Lc=J(()=>G([B(),V(),Hs(),U(Lc),oc(B(),Lc)])),Rc=W({SpanId:B().describe(`Unique identifier for a span within a trace. The ID is an 8-byte array.`),Timestamp:B().describe(`Start time of the span. UNIX Epoch time in nanoseconds since 00:00:00 UTC on 1 January 1970. Expressed as string in JSON.`),TraceId:B().describe(`Unique identifier for a trace. All spans from the same trace share the same trace_id. The ID is a 16-byte array.`),Duration:B().optional().describe(`Duration of the span in nanoseconds (end_time - start_time). Expressed as string in JSON.`),"Events.Attributes":U(oc(B(),Lc)).optional().describe(`Attribute key/value pairs on the event (one object per event).`),"Events.Name":U(B()).optional().describe(`Name of the event. Semantically required to be non-empty.`),"Events.Timestamp":U(B()).optional().describe(`Time the event occurred (nanoseconds). Expressed as strings in JSON.`),"Links.Attributes":U(oc(B(),Lc)).optional().describe(`Attribute key/value pairs on the link (one object per link).`),"Links.SpanId":U(B()).optional().describe(`Unique identifier for the linked span. The ID is an 8-byte array.`),"Links.TraceId":U(B()).optional().describe(`Unique identifier of a trace that the linked span is part of. The ID is a 16-byte array.`),"Links.TraceState":U(B()).optional().describe(`The trace_state associated with the link.`),ParentSpanId:B().optional().describe(`The span_id of this span's parent span. Empty if this is a root span.`),ResourceAttributes:oc(B(),Lc).optional().describe(`Attributes that describe the resource.`),ScopeName:B().optional().describe(`Name denoting the instrumentation scope.`),ScopeVersion:B().optional().describe(`Version of the instrumentation scope.`),ServiceName:B().optional().describe(`Service name from resource attributes (service.name).`),SpanAttributes:oc(B(),Lc).optional().describe(`Key/value pairs describing the span.`),SpanKind:B().optional().describe(`Type of span (Unspecified, Internal, Server, Client, Producer, Consumer). Used to identify relationships between spans.`),SpanName:B().optional().describe(`Description of the span's operation. E.g., qualified method name or file name with line number.`),StatusCode:B().optional().describe(`Status code (Unset, Ok, Error).`),StatusMessage:B().optional().describe(`Developer-facing human readable error message.`),TraceState:B().optional().describe(`Conveys information about request position in multiple distributed tracing graphs. W3C trace-context format.`)}),zc=W({Timestamp:B().describe(`Time when the event occurred. UNIX Epoch time in nanoseconds since 00:00:00 UTC on 1 January 1970. Expressed as string in JSON.`),Body:B().optional().describe(`Body of the log record. Can be a human-readable string message or structured data.`),EventName:B().optional().describe(`A unique identifier of event category/type. Presence identifies this log record as an event.`),LogAttributes:oc(B(),Lc).optional().describe(`Additional attributes that describe the specific event occurrence.`),ResourceAttributes:oc(B(),Lc).optional().describe(`Attributes that describe the resource.`),ResourceSchemaUrl:B().optional().describe(`Schema URL for the resource data.`),ScopeAttributes:oc(B(),Lc).optional().describe(`Attributes of the instrumentation scope.`),ScopeName:B().optional().describe(`Name denoting the instrumentation scope.`),ScopeSchemaUrl:B().optional().describe(`Schema URL for the scope data.`),ScopeVersion:B().optional().describe(`Version of the instrumentation scope.`),ServiceName:B().optional().describe(`Service name from resource attributes (service.name).`),SeverityNumber:V().optional().describe(`Numerical value of the severity, normalized to values described in Log Data Model.`),SeverityText:B().optional().describe(`Severity text (also known as log level). Original string representation as known at the source.`),SpanId:B().optional().describe(`Unique identifier for a span within a trace. The ID is an 8-byte array.`),TraceFlags:V().optional().describe(`Bit field. 8 least significant bits are trace flags as defined in W3C Trace Context.`),TraceId:B().optional().describe(`Unique identifier for a trace. All logs from the same trace share the same trace_id. The ID is a 16-byte array.`)}),Bc=W({TimeUnix:B().describe(`Time when the data point was recorded. UNIX Epoch time in nanoseconds. Expressed as string in JSON.`),StartTimeUnix:B().describe(`Start time for cumulative/delta metrics. UNIX Epoch time in nanoseconds. Expressed as string in JSON.`),Attributes:oc(B(),Lc).optional().describe(`Key/value pairs that uniquely identify the timeseries.`),MetricName:B().optional().describe(`The name of the metric.`),MetricDescription:B().optional().describe(`A description of the metric, which can be used in documentation.`),MetricUnit:B().optional().describe(`The unit in which the metric value is reported (UCUM format).`),ResourceAttributes:oc(B(),Lc).optional().describe(`Attributes that describe the resource.`),ResourceSchemaUrl:B().optional().describe(`Schema URL for the resource data.`),ScopeAttributes:oc(B(),Lc).optional().describe(`Attributes of the instrumentation scope.`),ScopeDroppedAttrCount:V().optional().describe(`Number of attributes dropped from the scope.`),ScopeName:B().optional().describe(`Name denoting the instrumentation scope.`),ScopeSchemaUrl:B().optional().describe(`Schema URL for the scope data.`),ScopeVersion:B().optional().describe(`Version of the instrumentation scope.`),ServiceName:B().optional().describe(`Service name from resource attributes (service.name).`),"Exemplars.FilteredAttributes":U(oc(B(),Lc)).optional().describe(`Filtered attributes of exemplars.`),"Exemplars.SpanId":U(B()).optional().describe(`Span IDs associated with exemplars.`),"Exemplars.TimeUnix":U(B()).optional().describe(`Timestamps of exemplars (nanoseconds). Expressed as strings in JSON.`),"Exemplars.TraceId":U(B()).optional().describe(`Trace IDs associated with exemplars.`),"Exemplars.Value":U(V()).optional().describe(`Values of exemplars.`)}),Vc=Bc.extend({MetricType:q(`Gauge`).describe(`Gauge metric type.`),Value:V().describe(`Current scalar value.`),Flags:V().optional().describe(`Flags that apply to this data point (see DataPointFlags).`)}),Hc=Bc.extend({MetricType:q(`Sum`).describe(`Sum metric type.`),Value:V().describe(`Scalar sum value.`),Flags:V().optional().describe(`Flags that apply to this data point (see DataPointFlags).`),AggregationTemporality:B().optional().describe(`Aggregation temporality (DELTA or CUMULATIVE).`),IsMonotonic:V().optional().describe(`Whether the sum is monotonic (0 = false, 1 = true).`)}),Uc=Bc.extend({MetricType:q(`Histogram`).describe(`Histogram metric type.`),Count:V().optional().describe(`Number of values in the histogram.`),Sum:V().optional().describe(`Sum of all values.`),Min:V().nullable().optional().describe(`Minimum value recorded.`),Max:V().nullable().optional().describe(`Maximum value recorded.`),BucketCounts:U(V()).optional().describe(`Count of values in each bucket.`),ExplicitBounds:U(V()).optional().describe(`Bucket boundaries.`),AggregationTemporality:B().optional().describe(`Aggregation temporality (DELTA or CUMULATIVE).`)}),Wc=Bc.extend({MetricType:q(`ExponentialHistogram`).describe(`Exponential histogram metric type.`),Count:V().optional().describe(`Number of values in the histogram.`),Sum:V().optional().describe(`Sum of all values.`),Min:V().nullable().optional().describe(`Minimum value recorded.`),Max:V().nullable().optional().describe(`Maximum value recorded.`),Scale:V().optional().describe(`Resolution of the histogram. Boundaries are at powers of base.`),ZeroCount:V().optional().describe(`Count of values that are exactly zero.`),PositiveBucketCounts:U(V()).optional().describe(`Counts for positive value buckets.`),PositiveOffset:V().optional().describe(`Offset for positive bucket indices.`),NegativeBucketCounts:U(V()).optional().describe(`Counts for negative value buckets.`),NegativeOffset:V().optional().describe(`Offset for negative bucket indices.`),ZeroThreshold:V().optional().describe(`Width of the zero region. Values within [-ZeroThreshold, ZeroThreshold] go to the zero count bucket.`),AggregationTemporality:B().optional().describe(`Aggregation temporality (DELTA or CUMULATIVE).`)}),Gc=Bc.extend({MetricType:q(`Summary`).describe(`Summary metric type.`),Count:V().optional().describe(`Number of values in the summary.`),Sum:V().optional().describe(`Sum of all values.`),"ValueAtQuantiles.Quantile":U(V()).optional().describe(`Quantile values (0.0 to 1.0).`),"ValueAtQuantiles.Value":U(V()).optional().describe(`Values at each quantile.`)}),Kc=nc(`MetricType`,[Vc,Hc,Uc,Wc,Gc]),qc=W({groups:oc(B(),Lc).describe(`Group-by key/value pairs (e.g. { 'tenant.id': 'otel_tenant_2' }).`),value:V().describe(`The aggregated value.`)}),Jc=function(e){return e[e.SPAN_FLAGS_DO_NOT_USE=0]=`SPAN_FLAGS_DO_NOT_USE`,e[e.SPAN_FLAGS_TRACE_FLAGS_MASK=255]=`SPAN_FLAGS_TRACE_FLAGS_MASK`,e[e.SPAN_FLAGS_CONTEXT_HAS_IS_REMOTE_MASK=256]=`SPAN_FLAGS_CONTEXT_HAS_IS_REMOTE_MASK`,e[e.SPAN_FLAGS_CONTEXT_IS_REMOTE_MASK=512]=`SPAN_FLAGS_CONTEXT_IS_REMOTE_MASK`,e[e.UNRECOGNIZED=-1]=`UNRECOGNIZED`,e}({}),Yc=function(e){return e[e.SPAN_KIND_UNSPECIFIED=0]=`SPAN_KIND_UNSPECIFIED`,e[e.SPAN_KIND_INTERNAL=1]=`SPAN_KIND_INTERNAL`,e[e.SPAN_KIND_SERVER=2]=`SPAN_KIND_SERVER`,e[e.SPAN_KIND_CLIENT=3]=`SPAN_KIND_CLIENT`,e[e.SPAN_KIND_PRODUCER=4]=`SPAN_KIND_PRODUCER`,e[e.SPAN_KIND_CONSUMER=5]=`SPAN_KIND_CONSUMER`,e[e.UNRECOGNIZED=-1]=`UNRECOGNIZED`,e}({}),Xc=function(e){return e[e.STATUS_CODE_UNSET=0]=`STATUS_CODE_UNSET`,e[e.STATUS_CODE_OK=1]=`STATUS_CODE_OK`,e[e.STATUS_CODE_ERROR=2]=`STATUS_CODE_ERROR`,e[e.UNRECOGNIZED=-1]=`UNRECOGNIZED`,e}({}),Zc=function(e){return e[e.SEVERITY_NUMBER_UNSPECIFIED=0]=`SEVERITY_NUMBER_UNSPECIFIED`,e[e.SEVERITY_NUMBER_TRACE=1]=`SEVERITY_NUMBER_TRACE`,e[e.SEVERITY_NUMBER_TRACE2=2]=`SEVERITY_NUMBER_TRACE2`,e[e.SEVERITY_NUMBER_TRACE3=3]=`SEVERITY_NUMBER_TRACE3`,e[e.SEVERITY_NUMBER_TRACE4=4]=`SEVERITY_NUMBER_TRACE4`,e[e.SEVERITY_NUMBER_DEBUG=5]=`SEVERITY_NUMBER_DEBUG`,e[e.SEVERITY_NUMBER_DEBUG2=6]=`SEVERITY_NUMBER_DEBUG2`,e[e.SEVERITY_NUMBER_DEBUG3=7]=`SEVERITY_NUMBER_DEBUG3`,e[e.SEVERITY_NUMBER_DEBUG4=8]=`SEVERITY_NUMBER_DEBUG4`,e[e.SEVERITY_NUMBER_INFO=9]=`SEVERITY_NUMBER_INFO`,e[e.SEVERITY_NUMBER_INFO2=10]=`SEVERITY_NUMBER_INFO2`,e[e.SEVERITY_NUMBER_INFO3=11]=`SEVERITY_NUMBER_INFO3`,e[e.SEVERITY_NUMBER_INFO4=12]=`SEVERITY_NUMBER_INFO4`,e[e.SEVERITY_NUMBER_WARN=13]=`SEVERITY_NUMBER_WARN`,e[e.SEVERITY_NUMBER_WARN2=14]=`SEVERITY_NUMBER_WARN2`,e[e.SEVERITY_NUMBER_WARN3=15]=`SEVERITY_NUMBER_WARN3`,e[e.SEVERITY_NUMBER_WARN4=16]=`SEVERITY_NUMBER_WARN4`,e[e.SEVERITY_NUMBER_ERROR=17]=`SEVERITY_NUMBER_ERROR`,e[e.SEVERITY_NUMBER_ERROR2=18]=`SEVERITY_NUMBER_ERROR2`,e[e.SEVERITY_NUMBER_ERROR3=19]=`SEVERITY_NUMBER_ERROR3`,e[e.SEVERITY_NUMBER_ERROR4=20]=`SEVERITY_NUMBER_ERROR4`,e[e.SEVERITY_NUMBER_FATAL=21]=`SEVERITY_NUMBER_FATAL`,e[e.SEVERITY_NUMBER_FATAL2=22]=`SEVERITY_NUMBER_FATAL2`,e[e.SEVERITY_NUMBER_FATAL3=23]=`SEVERITY_NUMBER_FATAL3`,e[e.SEVERITY_NUMBER_FATAL4=24]=`SEVERITY_NUMBER_FATAL4`,e[e.UNRECOGNIZED=-1]=`UNRECOGNIZED`,e}({}),Qc=function(e){return e[e.LOG_RECORD_FLAGS_DO_NOT_USE=0]=`LOG_RECORD_FLAGS_DO_NOT_USE`,e[e.LOG_RECORD_FLAGS_TRACE_FLAGS_MASK=255]=`LOG_RECORD_FLAGS_TRACE_FLAGS_MASK`,e[e.UNRECOGNIZED=-1]=`UNRECOGNIZED`,e}({}),$c=function(e){return e[e.AGGREGATION_TEMPORALITY_UNSPECIFIED=0]=`AGGREGATION_TEMPORALITY_UNSPECIFIED`,e[e.AGGREGATION_TEMPORALITY_DELTA=1]=`AGGREGATION_TEMPORALITY_DELTA`,e[e.AGGREGATION_TEMPORALITY_CUMULATIVE=2]=`AGGREGATION_TEMPORALITY_CUMULATIVE`,e[e.UNRECOGNIZED=-1]=`UNRECOGNIZED`,e}({}),el=function(e){return e[e.DATA_POINT_FLAGS_DO_NOT_USE=0]=`DATA_POINT_FLAGS_DO_NOT_USE`,e[e.DATA_POINT_FLAGS_NO_RECORDED_VALUE_MASK=1]=`DATA_POINT_FLAGS_NO_RECORDED_VALUE_MASK`,e[e.UNRECOGNIZED=-1]=`UNRECOGNIZED`,e}({}),tl=W({schemaUrl:G([B(),H()]).optional(),type:G([B(),H()]).optional(),idKeys:G([U(B()),H()]).optional(),descriptionKeys:G([U(B()),H()]).optional()});K(Jc);var nl=K(Yc),rl=K(Xc),il=K(Zc);K(Qc);var al=G([K($c),V()]);G([K(el),V()]),W({offset:G([V(),H()]).optional(),bucketCounts:G([U(G([B(),V()])),H()]).optional()});var ol=W({quantile:G([V(),H()]).optional(),value:G([V(),H()]).optional()}),sl=W({message:G([B(),H()]).optional(),code:G([rl,H()]).optional()}),cl=J(()=>W({stringValue:G([B(),H()]).optional(),boolValue:G([Hs(),H()]).optional(),intValue:G([B(),V(),H()]).optional(),doubleValue:G([V(),H()]).optional(),arrayValue:G([ll,H()]).optional(),kvlistValue:G([ul,H()]).optional(),bytesValue:G([B(),H()]).optional()})),ll=J(()=>W({values:G([U(cl),H()]).optional()})),ul=J(()=>W({values:G([U(dl),H()]).optional()})),dl=J(()=>W({key:G([B(),H()]).optional(),value:G([cl,H()]).optional()})),fl=J(()=>W({name:G([B(),H()]).optional(),version:G([B(),H()]).optional(),attributes:G([U(dl),H()]).optional(),droppedAttributesCount:G([V(),H()]).optional()})),pl=J(()=>W({attributes:G([U(dl),H()]).optional(),droppedAttributesCount:G([V(),H()]).optional(),entityRefs:G([U(tl),H()]).optional()}));J(()=>W({resourceSpans:G([U(ml),H()]).optional()}));var ml=J(()=>W({resource:G([pl,H()]).optional(),scopeSpans:G([U(hl),H()]).optional(),schemaUrl:G([B(),H()]).optional()})),hl=J(()=>W({scope:G([fl,H()]).optional(),spans:G([U(gl),H()]).optional(),schemaUrl:G([B(),H()]).optional()})),gl=J(()=>W({traceId:G([B(),H()]).optional(),spanId:G([B(),H()]).optional(),traceState:G([B(),H()]).optional(),parentSpanId:G([B(),H()]).optional(),flags:G([V(),H()]).optional(),name:G([B(),H()]).optional(),kind:G([nl,H()]).optional(),startTimeUnixNano:G([B(),H()]).optional(),endTimeUnixNano:G([B(),H()]).optional(),attributes:G([U(dl),H()]).optional(),droppedAttributesCount:G([V(),H()]).optional(),events:G([U(_l),H()]).optional(),droppedEventsCount:G([V(),H()]).optional(),links:G([U(vl),H()]).optional(),droppedLinksCount:G([V(),H()]).optional(),status:G([sl,H()]).optional()})),_l=J(()=>W({timeUnixNano:G([B(),H()]).optional(),name:G([B(),H()]).optional(),attributes:G([U(dl),H()]).optional(),droppedAttributesCount:G([V(),H()]).optional()})),vl=J(()=>W({traceId:G([B(),H()]).optional(),spanId:G([B(),H()]).optional(),traceState:G([B(),H()]).optional(),attributes:G([U(dl),H()]).optional(),droppedAttributesCount:G([V(),H()]).optional(),flags:G([V(),H()]).optional()}));J(()=>W({resourceLogs:G([U(yl),H()]).optional()}));var yl=J(()=>W({resource:G([pl,H()]).optional(),scopeLogs:G([U(bl),H()]).optional(),schemaUrl:G([B(),H()]).optional()})),bl=J(()=>W({scope:G([fl,H()]).optional(),logRecords:G([U(xl),H()]).optional(),schemaUrl:G([B(),H()]).optional()})),xl=J(()=>W({timeUnixNano:G([B(),H()]).optional(),observedTimeUnixNano:G([B(),H()]).optional(),severityNumber:G([il,H()]).optional(),severityText:G([B(),H()]).optional(),body:G([cl,H()]).optional(),attributes:G([U(dl),H()]).optional(),droppedAttributesCount:G([V(),H()]).optional(),flags:G([V(),H()]).optional(),traceId:G([B(),H()]).optional(),spanId:G([B(),H()]).optional(),eventName:G([B(),H()]).optional()}));J(()=>W({dataPoints:G([U(Sl),H()]).optional()}));var Sl=J(()=>W({attributes:G([U(dl),H()]).optional(),startTimeUnixNano:G([B(),H()]).optional(),timeUnixNano:G([B(),H()]).optional(),count:G([B(),V(),H()]).optional(),sum:G([V(),H()]).optional(),quantileValues:G([U(ol),H()]).optional(),flags:G([V(),H()]).optional()})),Cl=W({quantile:G([V(),H()]).optional(),value:G([V(),H()]).optional()}),wl=W({offset:G([V(),H()]).optional(),bucketCounts:G([U(G([B(),V()])),H()]).optional()}),Tl=J(()=>W({filteredAttributes:G([U(dl),H()]).optional(),timeUnixNano:G([B(),H()]).optional(),asDouble:G([V(),H()]).optional(),asInt:G([B(),H()]).optional(),spanId:G([B(),H()]).optional(),traceId:B().optional()})),El=J(()=>W({attributes:G([U(dl),H()]).optional(),startTimeUnixNano:G([B(),H()]).optional(),timeUnixNano:G([B(),H()]).optional(),asDouble:G([V(),H()]).optional(),asInt:G([B(),H()]).optional(),exemplars:G([U(Tl),H()]).optional(),flags:G([V(),H()]).optional()})),Dl=J(()=>W({attributes:G([U(dl),H()]).optional(),startTimeUnixNano:G([B(),H()]).optional(),timeUnixNano:G([B(),H()]).optional(),count:G([B(),V(),H()]).optional(),sum:G([V(),H()]).optional(),bucketCounts:G([U(G([B(),V()])),H()]).optional(),explicitBounds:G([U(V()),H()]).optional(),exemplars:G([U(Tl),H()]).optional(),flags:G([V(),H()]).optional(),min:G([V(),H()]).optional(),max:G([V(),H()]).optional()})),Ol=J(()=>W({attributes:G([U(dl),H()]).optional(),startTimeUnixNano:G([B(),H()]).optional(),timeUnixNano:G([B(),H()]).optional(),count:G([B(),V(),H()]).optional(),sum:G([V(),H()]).optional(),scale:G([V(),H()]).optional(),zeroCount:G([B(),V(),H()]).optional(),positive:G([wl,H()]).optional(),negative:G([wl,H()]).optional(),flags:G([V(),H()]).optional(),exemplars:G([U(Tl),H()]).optional(),min:G([V(),H()]).optional(),max:G([V(),H()]).optional(),zeroThreshold:G([V(),H()]).optional()})),kl=J(()=>W({attributes:G([U(dl),H()]).optional(),startTimeUnixNano:G([B(),H()]).optional(),timeUnixNano:G([B(),H()]).optional(),count:G([B(),V(),H()]).optional(),sum:G([V(),H()]).optional(),quantileValues:G([U(Cl),H()]).optional(),flags:G([V(),H()]).optional()})),Al=J(()=>W({dataPoints:G([U(El),H()]).optional()})),jl=J(()=>W({dataPoints:G([U(El),H()]).optional(),aggregationTemporality:G([al,H()]).optional(),isMonotonic:G([Hs(),H()]).optional()})),Ml=J(()=>W({dataPoints:G([U(Dl),H()]).optional(),aggregationTemporality:G([al,H()]).optional()})),Nl=J(()=>W({dataPoints:G([U(Ol),H()]).optional(),aggregationTemporality:G([al,H()]).optional()})),Pl=J(()=>W({dataPoints:G([U(kl),H()]).optional()})),Fl=J(()=>W({name:G([B(),H()]).optional(),description:G([B(),H()]).optional(),unit:G([B(),H()]).optional(),gauge:G([Al,H()]).optional(),sum:G([jl,H()]).optional(),histogram:G([Ml,H()]).optional(),exponentialHistogram:G([Nl,H()]).optional(),summary:G([Pl,H()]).optional(),metadata:G([U(dl),H()]).optional()})),Il=J(()=>W({scope:G([fl,H()]).optional(),metrics:G([U(Fl),H()]).optional(),schemaUrl:G([B(),H()]).optional()})),Ll=J(()=>W({resource:G([pl,H()]).optional(),scopeMetrics:G([U(Il),H()]).optional(),schemaUrl:G([B(),H()]).optional()}));J(()=>W({resourceMetrics:G([U(Ll),H()]).optional()}));var Rl=Fc({logsDataFilterSchema:()=>Vl,metricsDataFilterSchema:()=>Hl,traceSummariesFilterSchema:()=>Ul,traceSummaryRowSchema:()=>Gl,traceSummaryServiceSchema:()=>Wl,tracesDataFilterSchema:()=>Bl}),zl=B().regex(/^\d+$/,`Expected nanoseconds as a digit-only string`),Bl=W({traceId:B().optional().describe(`Unique identifier for a trace. All spans from the same trace share the same trace_id. The ID is a 16-byte array.`),spanId:B().optional().describe(`Unique identifier for a span within a trace. The ID is an 8-byte array.`),parentSpanId:B().optional().describe(`The span_id of this span's parent span. Empty if this is a root span.`),serviceName:B().optional().describe(`Service name from resource attributes (service.name).`),spanName:B().optional().describe(`Description of the span's operation. E.g., qualified method name or file name with line number.`),spanKind:B().optional().describe(`Type of span (INTERNAL, SERVER, CLIENT, PRODUCER, CONSUMER). Used to identify relationships between spans.`),statusCode:B().optional().describe(`Status code (UNSET, OK, ERROR).`),scopeName:B().optional().describe(`Name denoting the instrumentation scope.`),timestampMin:zl.optional().describe(`Minimum start time of the span. UNIX Epoch time in nanoseconds since 00:00:00 UTC on 1 January 1970. Expressed as string in JSON.`),timestampMax:zl.optional().describe(`Maximum start time of the span. UNIX Epoch time in nanoseconds since 00:00:00 UTC on 1 January 1970. Expressed as string in JSON.`),durationMin:zl.optional().describe(`Minimum duration of the span in nanoseconds (end_time - start_time). Expressed as string in JSON.`),durationMax:zl.optional().describe(`Maximum duration of the span in nanoseconds (end_time - start_time). Expressed as string in JSON.`),spanAttributes:oc(B(),B()).optional().describe(`Key/value pairs describing the span.`),resourceAttributes:oc(B(),B()).optional().describe(`Attributes that describe the resource.`),eventsAttributes:oc(B(),B()).optional().describe(`Attribute key/value pairs on the event.`),linksAttributes:oc(B(),B()).optional().describe(`Attribute key/value pairs on the link.`),limit:V().int().positive().max(1e3).optional().describe(`Max items to return. Default determined by datasource.`),cursor:B().optional().describe(`Opaque cursor from previous response for next page.`),sortOrder:K([`ASC`,`DESC`]).optional().describe(`Sort by timestamp. ASC = oldest first, DESC = newest first.`)}),Vl=W({traceId:B().optional().describe(`Unique identifier for a trace. All logs from the same trace share the same trace_id. The ID is a 16-byte array.`),spanId:B().optional().describe(`Unique identifier for a span within a trace. The ID is an 8-byte array.`),serviceName:B().optional().describe(`Service name from resource attributes (service.name).`),scopeName:B().optional().describe(`Name denoting the instrumentation scope.`),eventName:B().optional().describe(`A unique identifier of event category/type. Filters logs that are events with this name.`),severityText:B().optional().describe(`Severity text (also known as log level). Original string representation as known at the source.`),severityNumberMin:V().optional().describe(`Minimum severity number (inclusive). Normalized to values described in Log Data Model.`),severityNumberMax:V().optional().describe(`Maximum severity number (inclusive). Normalized to values described in Log Data Model.`),bodyContains:B().optional().describe(`Filter logs where body contains this substring.`),timestampMin:zl.optional().describe(`Minimum time when the event occurred. UNIX Epoch time in nanoseconds since 00:00:00 UTC on 1 January 1970. Expressed as string in JSON.`),timestampMax:zl.optional().describe(`Maximum time when the event occurred. UNIX Epoch time in nanoseconds since 00:00:00 UTC on 1 January 1970. Expressed as string in JSON.`),logAttributes:oc(B(),B()).optional().describe(`Additional attributes that describe the specific event occurrence.`),resourceAttributes:oc(B(),B()).optional().describe(`Attributes that describe the resource.`),scopeAttributes:oc(B(),B()).optional().describe(`Attributes of the instrumentation scope.`),limit:V().int().positive().max(1e3).optional().describe(`Max items to return. Default determined by datasource.`),cursor:B().optional().describe(`Opaque cursor from previous response for next page.`),sortOrder:K([`ASC`,`DESC`]).optional().describe(`Sort by timestamp. ASC = oldest first, DESC = newest first.`)}),Hl=W({metricType:K([`Gauge`,`Sum`,`Histogram`,`ExponentialHistogram`,`Summary`]).describe(`Metric type to query.`),metricName:B().optional().describe(`The name of the metric.`),serviceName:B().optional().describe(`Service name from resource attributes (service.name).`),scopeName:B().optional().describe(`Name denoting the instrumentation scope.`),timeUnixMin:zl.optional().describe(`Minimum time when the data point was recorded. UNIX Epoch time in nanoseconds. Expressed as string in JSON.`),timeUnixMax:zl.optional().describe(`Maximum time when the data point was recorded. UNIX Epoch time in nanoseconds. Expressed as string in JSON.`),attributes:oc(B(),B()).optional().describe(`Key/value pairs that uniquely identify the timeseries.`),resourceAttributes:oc(B(),B()).optional().describe(`Attributes that describe the resource.`),scopeAttributes:oc(B(),B()).optional().describe(`Attributes of the instrumentation scope.`),aggregate:K([`sum`,`avg`,`min`,`max`,`count`]).optional().describe(`Aggregation function to apply to metric values. When set, returns aggregated results instead of raw data points.`),groupBy:U(B()).optional().describe(`Attribute keys to group by when aggregating (e.g. ['tenant.id', 'signal']).`),limit:V().int().positive().max(1e3).optional().describe(`Max items to return. Default determined by datasource.`),cursor:B().optional().describe(`Opaque cursor from previous response for next page.`),sortOrder:K([`ASC`,`DESC`]).optional().describe(`Sort by timestamp. ASC = oldest first, DESC = newest first.`)}).refine(e=>!(e.groupBy&&!e.aggregate),{message:`groupBy requires aggregate to be set`,path:[`groupBy`]}).refine(e=>!(e.aggregate&&e.cursor),{message:`cursor is incompatible with aggregate`,path:[`cursor`]}).refine(e=>!e.aggregate||e.metricType===`Gauge`||e.metricType===`Sum`,{message:`aggregate is only supported for Gauge and Sum metric types`,path:[`aggregate`]}),Ul=W({serviceName:B().optional(),spanName:B().optional(),timestampMin:zl.optional(),timestampMax:zl.optional(),durationMin:zl.optional(),durationMax:zl.optional(),spanAttributes:oc(B(),B()).optional(),resourceAttributes:oc(B(),B()).optional(),limit:V().int().min(1).max(1e3).default(20),cursor:B().optional(),sortOrder:K([`ASC`,`DESC`]).default(`DESC`)}),Wl=W({name:B(),count:V(),hasError:Hs()}),Gl=W({traceId:B(),rootServiceName:B(),rootSpanName:B(),startTimeNs:B(),durationNs:B(),spanCount:V(),errorCount:V(),services:U(Wl)}),Kl=Fc({createDashboardParams:()=>Xl,dashboardSchema:()=>Yl,regexSemverNumberedGroups:()=>ql,searchDashboardsFilter:()=>Zl,semverSchema:()=>Jl}),ql=/^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$/,Jl=B().regex(ql).brand(),Yl=W({name:B(),id:B(),createdAt:Nc(),metadata:oc(B(),qs()),uiTreeVersion:Jl,uiTree:$s({}).describe(`free-form object representing a uiTree to be rendered by @kopai/ui`)}),Xl=W({name:B(),metadata:oc(B(),qs()).optional().default({}),uiTreeVersion:Jl,uiTree:$s({}).describe(`free-form object representing a uiTree to be rendered by @kopai/ui`)}),Zl=W({name:B().optional(),createdAtMin:Nc().optional(),createdAtMax:Nc().optional(),uiTreeVersion:Jl.optional(),uiTreeVersionCompatible:Jl.optional(),metadata:oc(B(),B()).optional(),limit:V().int().min(1).max(1e3).optional().default(100),cursor:B().optional(),sortOrder:K([`ASC`,`DESC`]).optional().default(`DESC`)}),Ql=Fc({HavingExpr:()=>Lu,KopaiQuery:()=>Qu,LogAggregateQuerySchema:()=>Ju,LogAttrContainer:()=>cu,LogColumn:()=>Cu,LogRawQuerySchema:()=>Yu,METRIC_STRUCTURAL_COLUMNS_BY_TYPE:()=>cd,METRIC_TYPES:()=>ad,MODES:()=>td,MetricAggregateQuerySchema:()=>Xu,MetricAttrContainer:()=>lu,MetricColumn:()=>wu,MetricRawQuerySchema:()=>Zu,NUMERIC_STRUCTURAL_COLUMNS:()=>od,NumericOp:()=>ku,SIGNALS:()=>ed,Signal:()=>ou,TimeDimension:()=>Hu,TraceAggregateQuerySchema:()=>Ku,TraceAttrContainer:()=>su,TraceColumn:()=>Su,TraceRawQuerySchema:()=>qu,assertColumnPartition:()=>bu,branchSchemaFor:()=>id,durationStringToNanos:()=>ru,isDurationString:()=>nu,isQueryMode:()=>rd,isSignal:()=>nd}),$l=/^[1-9]\d*[smhdw]$/,eu=B().regex($l,{error:`Duration must be a positive integer > 0 + unit (s,m,h,d,w) — e.g. "30s", "2h", "7d".`}).describe(`Duration string: positive integer > 0 + unit suffix. Units: s=seconds, m=minutes, h=hours, d=days, w=weeks. Examples: "30s", "30m", "2h", "7d", "2w".`),tu={s:1e9,m:6e10,h:36e11,d:864e11,w:6048e11};function nu(e){return $l.test(e)}function ru(e){return $l.test(e)?Number(e.slice(0,-1))*(tu[e.slice(-1)]??0):e}var iu=B().regex(/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(\.\d+)?Z$/,{error:`Must be ISO 8601 UTC datetime — e.g. "2024-01-01T00:00:00.000Z".`}).describe(`ISO 8601 UTC datetime. Example: "2024-01-01T00:00:00.000Z". Millisecond precision is sufficient.`),au=B().regex(/^[A-Za-z_][A-Za-z0-9_]*$/,{error:`Alias must start with a letter or underscore and contain only letters, digits, and underscores — e.g. p95_duration, error_count, requests_per_second.`}).describe(`Alias for the measure in result rows. Must be unique within the query and match /^[A-Za-z_][A-Za-z0-9_]*$/. Use snake_case — e.g. p95_duration, error_count, requests_per_second.`),ou=K([`traces`,`logs`,`metrics`]),su=K([`SpanAttributes`,`ResourceAttributes`]).describe(`Attribute map on a trace row. SpanAttributes = span-specific; ResourceAttributes = process/host/service attrs.`),cu=K([`LogAttributes`,`ResourceAttributes`,`ScopeAttributes`]).describe(`Attribute map on a log row. LogAttributes = record-specific; ResourceAttributes = process/host/service attrs; ScopeAttributes = instrumentation scope.`),lu=K([`Attributes`,`ResourceAttributes`,`ScopeAttributes`]).describe(`Attribute map on a metric data point. Attributes = data-point attrs; ResourceAttributes = process/host/service; ScopeAttributes = instrumentation scope.`),uu=`service.name,service.namespace,service.version,service.instance.id,deployment.environment.name,host.name,host.id,host.arch,host.type,host.ip,container.id,container.name,container.image.name,container.image.tag,container.runtime,k8s.cluster.name,k8s.cluster.uid,k8s.namespace.name,k8s.node.name,k8s.node.uid,k8s.pod.name,k8s.pod.uid,k8s.container.name,k8s.container.restart_count,k8s.deployment.name,k8s.deployment.uid,k8s.statefulset.name,k8s.statefulset.uid,k8s.daemonset.name,k8s.daemonset.uid,k8s.job.name,k8s.job.uid,k8s.cronjob.name,k8s.cronjob.uid,k8s.replicaset.name,k8s.replicaset.uid,cloud.provider,cloud.region,cloud.availability_zone,cloud.account.id,cloud.platform,cloud.resource_id,process.pid,process.executable.name,process.command,process.command_line,process.runtime.name,process.runtime.version,process.runtime.description,telemetry.sdk.name,telemetry.sdk.version,telemetry.sdk.language,telemetry.distro.name,telemetry.distro.version,os.type,os.name,os.version,os.description`.split(`,`),du=`http.request.method,http.request.method_original,http.response.status_code,http.route,http.request.resend_count,url.full,url.path,url.scheme,url.query,url.fragment,server.address,server.port,client.address,client.port,network.protocol.name,network.protocol.version,network.transport,network.type,network.peer.address,network.peer.port,network.local.address,network.local.port,user_agent.original,db.system.name,db.namespace,db.collection.name,db.operation.name,db.operation.batch.size,db.query.text,db.query.summary,db.response.status_code,db.stored_procedure.name,rpc.system.name,rpc.service,rpc.method,rpc.method_original,rpc.response.status_code,rpc.grpc.status_code,messaging.system,messaging.destination.name,messaging.operation.type,messaging.message.id,messaging.message.body.size,gen_ai.system,gen_ai.operation.name,gen_ai.request.model,gen_ai.response.model,gen_ai.usage.input_tokens,gen_ai.usage.output_tokens,exception.type,exception.message,exception.stacktrace,error.type,code.function.name,code.namespace,code.file.path,code.line.number,code.stacktrace,thread.id,thread.name,enduser.id,enduser.role`.split(`,`),fu=`log.level,log.file.name,log.file.path,log.iostream,log.record.uid,exception.type,exception.message,exception.stacktrace,error.type,code.function.name,code.namespace,code.file.path,code.line.number,code.stacktrace,thread.id,thread.name,http.request.method,http.response.status_code,http.route,url.full,url.path,client.address,server.address,user_agent.original,gen_ai.system,gen_ai.operation.name,gen_ai.request.model,gen_ai.response.model,enduser.id,enduser.role`.split(`,`),pu=[`http.request.method`,`http.response.status_code`,`http.route`,`server.address`,`server.port`,`url.scheme`,`network.protocol.name`,`network.protocol.version`,`db.system.name`,`db.namespace`,`db.collection.name`,`db.operation.name`,`rpc.system.name`,`rpc.service`,`rpc.method`,`messaging.system`,`messaging.destination.name`,`messaging.operation.type`,`error.type`],mu=[`SpanId`,`TraceId`,`ParentSpanId`,`Timestamp`,`Duration`,`SpanKind`,`SpanName`,`StatusCode`,`StatusMessage`,`TraceState`,`ScopeName`,`ScopeVersion`],hu=[`Timestamp`,`Body`,`EventName`,`SeverityNumber`,`SeverityText`,`SpanId`,`TraceId`,`TraceFlags`,`ScopeName`,`ScopeVersion`,`ScopeSchemaUrl`,`ResourceSchemaUrl`],gu=`TimeUnix,StartTimeUnix,MetricName,MetricDescription,MetricUnit,MetricType,ScopeName,ScopeVersion,ScopeSchemaUrl,ResourceSchemaUrl,Value,Count,Sum,Min,Max,AggregationTemporality,IsMonotonic,Flags,Scale,ZeroCount,BucketCounts,ExplicitBounds,PositiveBucketCounts,PositiveOffset,NegativeBucketCounts,NegativeOffset,ValueAtQuantiles.Quantile,ValueAtQuantiles.Value`.split(`,`),_u=new Set([`SpanAttributes`,`ResourceAttributes`,`ServiceName`,`Events.Attributes`,`Events.Name`,`Events.Timestamp`,`Links.Attributes`,`Links.SpanId`,`Links.TraceId`,`Links.TraceState`]),vu=new Set([`LogAttributes`,`ResourceAttributes`,`ScopeAttributes`,`ServiceName`]),yu=new Set([`Attributes`,`ResourceAttributes`,`ScopeAttributes`,`ServiceName`,`ScopeDroppedAttrCount`,`ZeroThreshold`,`Exemplars.FilteredAttributes`,`Exemplars.SpanId`,`Exemplars.TimeUnix`,`Exemplars.TraceId`,`Exemplars.Value`]);function bu(e,t,n,r){let i=new Set(n),a=t.filter(e=>!i.has(e)&&!r.has(e));if(a.length>0)throw Error(`kopai-query: ${e} storage schema has unaccounted field(s) ${JSON.stringify(a)}. Add to STRUCTURAL or EXCLUDED list.`);let o=new Set(t),s=n.filter(e=>!o.has(e));if(s.length>0)throw Error(`kopai-query: ${e} STRUCTURAL contains stale field(s) ${JSON.stringify(s)} not in storage schema.`);let c=n.filter(e=>r.has(e));if(c.length>0)throw Error(`kopai-query: ${e} field(s) ${JSON.stringify(c)} appear in BOTH STRUCTURAL and EXCLUDED (XOR violated). Remove from one list.`)}function xu(){let e=[{name:`traces`,schemaKeys:Object.keys(Rc.shape),structural:mu,excluded:_u},{name:`logs`,schemaKeys:Object.keys(zc.shape),structural:hu,excluded:vu},{name:`metrics`,schemaKeys:[...new Set(Kc.options.flatMap(e=>Object.keys(e.shape)))],structural:gu,excluded:yu}];for(let{name:t,schemaKeys:n,structural:r,excluded:i}of e)bu(t,n,r,i);let t=Object.keys(Bc.shape),n=new Set(gu),r=t.filter(e=>!n.has(e)&&!yu.has(e));if(r.length>0)throw Error(`kopai-query: metricsBaseSchema has unaccounted field(s) ${JSON.stringify(r)}.`)}xu();var Su=K([...mu,...uu,...du]).describe(`Trace column. PascalCase = structural OTel schema field; dotted = OTel semantic-convention attribute. Use the { container, key } form for any non-semantic-convention attribute.`),Cu=K([...hu,...uu,...fu]).describe(`Log column. PascalCase = structural OTel schema field; dotted = OTel semantic-convention attribute. Use the { container, key } form for any non-semantic-convention attribute.`),wu=K([...gu,...uu,...pu]).describe(`Metric column. PascalCase = structural OTel schema field; dotted = OTel semantic-convention attribute. MetricType-specific structural columns (Sum/Count/Min/Max on Histogram, Value on Gauge/Sum) require an equivalent filter on MetricType. Use the { container, key } form for any non-semantic-convention attribute.`),Tu=e=>Qs({container:e,key:B().min(1).describe(`Attribute key inside the container, as stored in OTel. Example: "http.route", "service.version".`)}).describe(`Reference to a value inside a nested OTel attribute map. Use this for any attribute not exposed as a top-level column.`),Eu=G([Su,Tu(su)]).describe(`Trace column reference. Either a top-level column name (string) or a nested attribute reference (object).`),Du=G([Cu,Tu(cu)]).describe(`Log column reference. Either a top-level column name (string) or a nested attribute reference (object).`),Ou=G([wu,Tu(lu)]).describe(`Metric column reference. Either a top-level column name (string) or a nested attribute reference (object).`),ku=K([`SUM`,`AVG`,`MIN`,`MAX`,`P50`,`P75`,`P90`,`P95`,`P99`,`P999`,`RATE_AVG`,`RATE_SUM`,`RATE_MAX`]).describe(`Aggregation that requires a numeric column. RATE_* divides the aggregate by the time-bucket width. NOTE: the percentile ops (P50–P999) are supported only on the ClickHouse backend; the SQLite backend rejects them with a validation error.`),Au=G([Qs({op:q(`COUNT`),as:au}).describe(`Row count over the matched span set.`),Qs({op:q(`ERROR_RATE`),as:au}).describe(`Fraction of spans with StatusCode=ERROR. Result is in [0, 1].`),Qs({op:q(`THROUGHPUT`),as:au}).describe(`Spans per second over the time bucket (or the full window if output=summary).`),Qs({op:q(`COUNT_DISTINCT`),column:Eu,as:au}).describe("Approximate count of distinct non-null values of the column (HyperLogLog-style — backed by ClickHouse `uniq`). Use COUNT with a filter if exact deduplication is required."),Qs({op:ku,column:Eu,as:au}).describe(`Numeric aggregation. Column must be numeric (e.g. Duration, or a numeric attribute).`)]).describe(`Aggregation expression for the traces signal.`),ju=G([Qs({op:q(`COUNT`),as:au}).describe(`Row count over the matched log set.`),Qs({op:q(`COUNT_DISTINCT`),column:Du,as:au}).describe("Approximate count of distinct non-null values of the column (HyperLogLog-style — backed by ClickHouse `uniq`). Use COUNT with a filter if exact deduplication is required."),Qs({op:ku,column:Du,as:au}).describe(`Numeric aggregation. Column must be numeric (e.g. SeverityNumber, or a numeric attribute).`)]).describe(`Aggregation expression for the logs signal.`),Mu=G([Qs({op:q(`COUNT`),as:au}).describe(`Row count over the matched metric data-point set.`),Qs({op:q(`COUNT_DISTINCT`),column:Ou,as:au}).describe("Approximate count of distinct non-null values of the column (HyperLogLog-style — backed by ClickHouse `uniq`). Use COUNT with a filter if exact deduplication is required."),Qs({op:ku,column:Ou,as:au}).describe(`Numeric aggregation. For heterogeneous MetricType, filter by MetricType so the chosen column exists for every matched row.`)]).describe(`Aggregation expression for the metrics signal.`),Nu=e=>{let t=nc(`op`,[Qs({column:e,op:K([`eq`,`neq`]),value:G([B(),V(),Hs()])}),Qs({column:e,op:K([`contains`,`notContains`,`startsWith`,`endsWith`]),value:B()}),Qs({column:e,op:K([`gt`,`gte`,`lt`,`lte`]),value:V()}),Qs({column:e,op:K([`in`,`notIn`]),values:G([U(B()).min(1),U(V()).min(1)]).describe(`Non-empty array of match values. All elements must be the same type — either all strings or all numbers.`)}),Qs({column:e,op:K([`isNull`,`isNotNull`])})]).describe("Leaf filter on a column. Discriminated on `op`: eq/neq accept string|number|boolean; contains/notContains/startsWith/endsWith require a string; gt/gte/lt/lte require a number; in/notIn take a non-empty `values` array whose elements are all strings or all numbers (mixed arrays are rejected); isNull/isNotNull take no value."),n=J(()=>G([t,Qs({and:U(n).min(1)}).describe(`All children must match (AND).`),Qs({or:U(n).min(1)}).describe(`Any child matches (OR).`)]));return n},Pu=Nu(Eu),Fu=Nu(Du),Iu=Nu(Ou),Lu=Qs({measure:B().min(1).describe("Alias of a measure defined in this query's `measures` array."),op:K([`eq`,`neq`,`gt`,`gte`,`lt`,`lte`]),value:V()}).describe(`Post-aggregation filter. Applied after grouping — equivalent to SQL HAVING. Use only when filtering on a measure's value (e.g. error_count > 100).`),Ru=e=>nc(`type`,[Qs({type:q(`dimension`),column:e,direction:K([`asc`,`desc`])}),Qs({type:q(`measure`),alias:B().min(1).describe("Alias of a measure defined in this query's `measures` array."),direction:K([`asc`,`desc`])})]).describe("Sort key. In aggregate mode a dimension column must also appear in `dimensions`, and a measure alias must match one declared in `measures`. In raw mode any structural column is sortable (the backend returns the full denormalized row regardless of `dimensions`); measure-typed sort is not allowed."),zu=Ru(Eu),Bu=Ru(Du),Vu=Ru(Ou),Hu=nc(`type`,[Qs({type:q(`relative`),lookback:eu.describe(`Window length ending now. Example: "2h" = the last 2 hours.`)}).describe(`Relative time window ending at query time.`),Qs({type:q(`absolute`),startTime:iu.describe(`Window start (inclusive).`),endTime:iu.describe(`Window end (exclusive).`)}).describe(`Absolute time window with fixed ISO datetimes.`)]).describe(`Time window for the query. Required on every query — bounds the rows scanned and (for time-series output) the bucketing range.`),Uu=nc(`type`,[Qs({type:q(`summary`)}).describe(`Single aggregated value per group, across the entire time window.`),Qs({type:q(`timeSeries`),granularity:eu.describe(`Bucket width. Example: "5m" = 5-minute buckets across the time window.`)}).describe("Bucketed time-series. One row per (group, bucket). Adds a `bucket_start` ISO datetime to each result row.")]).describe(`Shape of the aggregate result. summary = one row per group; timeSeries = one row per (group, bucket).`),Wu=V().int().min(1).max(1e4).optional().describe(`Maximum rows to return. Server applies a default if omitted. Hard cap = 10000.`),Gu=B().optional().describe(`Opaque pagination token for raw mode. Omit on the first page; pass the value returned by the previous response to fetch the next page. Cursor is bound to the original query parameters — do not mutate the query between pages.`),Ku=Qs({signal:q(`traces`),mode:q(`aggregate`),measures:U(Au).min(1).describe(`One or more aggregations to compute.`),dimensions:U(Eu).optional().describe(`GROUP BY columns. Omit for a single aggregated row across all matched spans.`),filters:U(Pu).optional().describe(`Pre-aggregation filters. Multiple entries are combined with AND. Use a logical filter to express OR.`),havings:U(Lu).optional().describe(`Post-aggregation filters on measure aliases. Combined with AND.`),timeDimension:Hu,orderBy:U(zu).optional().describe(`Sort keys applied in array order.`),output:Uu,limit:Wu}).describe(`Aggregate query over traces (spans).`),qu=Qs({signal:q(`traces`),mode:q(`raw`),dimensions:U(Eu).optional().describe(`Optional projection. Omit to return the full denormalized OTel row (structural columns + attribute maps). When provided, the server may narrow the SELECT — but result rows still match the denormalized OTel shape.`),filters:U(Pu).optional(),timeDimension:Hu,orderBy:U(zu).optional(),limit:Wu,cursor:Gu}).describe(`Raw span search. Returns denormalized OTel trace rows — no aggregation.`),Ju=Qs({signal:q(`logs`),mode:q(`aggregate`),measures:U(ju).min(1),dimensions:U(Du).optional().describe(`GROUP BY columns. Omit for a single aggregated row across all matched log records.`),filters:U(Fu).optional(),havings:U(Lu).optional(),timeDimension:Hu,orderBy:U(Bu).optional(),output:Uu,limit:Wu}).describe(`Aggregate query over logs.`),Yu=Qs({signal:q(`logs`),mode:q(`raw`),dimensions:U(Du).optional().describe(`Optional projection. Omit to return the full denormalized OTel row (structural columns + attribute maps). When provided, the server may narrow the SELECT — but result rows still match the denormalized OTel shape.`),filters:U(Fu).optional(),timeDimension:Hu,orderBy:U(Bu).optional(),limit:Wu,cursor:Gu}).describe(`Raw log search. Returns denormalized OTel log rows — no aggregation.`),Xu=Qs({signal:q(`metrics`),mode:q(`aggregate`),measures:U(Mu).min(1),dimensions:U(Ou).optional().describe(`GROUP BY columns. Omit for a single aggregated row across all matched data points.`),filters:U(Iu).optional(),havings:U(Lu).optional(),timeDimension:Hu,orderBy:U(Vu).optional(),output:Uu,limit:Wu}).describe(`Aggregate query over metrics data points.`),Zu=Qs({signal:q(`metrics`),mode:q(`raw`),dimensions:U(Ou).optional().describe(`Optional projection. Omit to return the full denormalized OTel row (structural columns + attribute maps). When provided, the server may narrow the SELECT — but result rows still match the denormalized OTel shape.`),filters:U(Iu).optional(),timeDimension:Hu,orderBy:U(Vu).optional(),limit:Wu,cursor:Gu}).describe(`Raw metric data-point search. Returns denormalized OTel metric rows — no aggregation.`),Qu=G([Ku,qu,Ju,Yu,Xu,Zu]).describe("Telemetry query. Pick `signal` (traces/logs/metrics) and `mode` (aggregate/raw); the rest of the shape follows from that pair."),$u={traces:{aggregate:Ku,raw:qu},logs:{aggregate:Ju,raw:Yu},metrics:{aggregate:Xu,raw:Zu}},ed=ou.options,td=[`aggregate`,`raw`];function nd(e){return typeof e==`string`&&ed.includes(e)}function rd(e){return typeof e==`string`&&td.includes(e)}function id(e,t){if(nd(e)&&rd(t))return $u[e][t]}var ad=[`Gauge`,`Sum`,`Histogram`,`ExponentialHistogram`,`Summary`],od={traces:new Set([`Duration`]),logs:new Set([`SeverityNumber`,`TraceFlags`]),metrics:new Set([`Value`,`Count`,`Sum`,`Min`,`Max`,`Scale`,`ZeroCount`,`PositiveOffset`,`NegativeOffset`,`IsMonotonic`,`Flags`])};function sd(){let e=new Set(gu),t={Gauge:new Set,Sum:new Set,Histogram:new Set,ExponentialHistogram:new Set,Summary:new Set};for(let n of Kc.options){let r=n.shape.MetricType.value;t[r]=new Set(Object.keys(n.shape).filter(t=>e.has(t)))}return t}var cd=sd(),ld=8;function ud(e){return e?._zod?.def}function dd(e){let t=e;for(let e=0;t&&e<20;e++){let e=ud(t);if(e?.type===`optional`||e?.type===`nullable`||e?.type==="default"){t=e.innerType;continue}if(e?.type===`lazy`&&e.getter){t=e.getter();continue}return t}return t}function fd(e,t){let n=dd(e);for(let e of t)if(n=pd(n,e),!n)return;return n}function pd(e,t){let n=ud(e);if(n?.type===`object`)return dd(n.shape?.[String(t)]);if(n?.type===`array`)return dd(n.element);if(n?.type===`union`)return md(n.options??[],t)}function md(e,t){let n=[...new Set(e.map(e=>pd(dd(e),t)).filter(e=>!!e))];if(n.length<=1)return n[0];let r=n.map(vd);return r.every(e=>e?.length)?K([...new Set(r.flat())]):G(n)}function hd(e,t){let n=e;for(let e of t){if(typeof n!=`object`||!n)return;n=n[String(e)]}return n}function gd(e){let t=ud(dd(e))?.shape,n=new Map;if(!t)return n;for(let[e,r]of Object.entries(t)){let t=ud(dd(r));if(t?.type===`literal`){let r=t.values??[];r.length===1&&n.set(e,r[0])}}return n}function _d(e){let t=ud(dd(e));if(t?.type===`enum`)return Object.keys(t.entries??{})}function vd(e){let t=ud(dd(e));if(t?.type===`literal`){let e=(t.values??[]).filter(e=>typeof e==`string`);return e.length?e:void 0}return _d(e)}function yd(e){return e.length<=ld?e.map(e=>`"${e}"`).join(`, `):`${e.slice(0,ld).map(e=>`"${e}"`).join(`, `)} and ${e.length-ld} others`}function bd(e){return e.toLowerCase().replace(/[^a-z0-9]/g,``)}function xd(e,t){let n=bd(e);return t.find(e=>bd(e)===n)}function Sd(e,t){if(e===t)return!0;let[n,r]=e.length<=t.length?[e,t]:[t,e];if(r.length-n.length>1)return!1;let i=0;for(;i<n.length&&n[i]===r[i];)i++;let a=0;for(;a<n.length-i&&n[n.length-1-a]===r[r.length-1-a];)a++;let o=n.length-i-a;return r.length===n.length?o<=1||o===2&&n[i]===r[i+1]&&n[i+1]===r[i]:o===0}function Cd(e,t){let n=t.filter(t=>t!==e),r=xd(e,n);if(r)return r;let i=bd(e),a=n.filter(e=>Sd(i,bd(e)));return a.length===1?a[0]:void 0}function wd(e){let t=ud(dd(e));return t?t.type===`union`?[...new Set((t.options??[]).flatMap(e=>wd(e)))]:Object.keys(t.shape??{}):[]}function Td(e,t){let n=ud(dd(e));if(n?.type!==`union`)return e?[dd(e)]:[];let r=(n.options??[]).flatMap(e=>Td(e,t)),i=r.filter(e=>{if(Ad(e,t)===0)return!1;let n=ud(dd(e))?.shape??{};return Object.entries(n).every(([e,n])=>{let r=vd(n),i=hd(t,[e]);return!r||typeof i!=`string`||r.includes(i)})});return i.length?i:r}function Ed(e,t){let n=Td(e,t);return n.length?[...new Set(n.flatMap(wd))]:wd(e)}function Dd(e,t,n,r){let i=Ed(t,n);return e.map(e=>{let t=Cd(e,i),n=i.length?` Accepted keys here: ${yd(i)}.`:``;return{path:r?`${r}.${e}`:e,message:t?`Unknown key "${e}". Did you mean "${t}"?`:`Unknown key "${e}".${n}`}})}function Od(e,t){return vd(ud(dd(e))?.shape?.[t])??[]}function kd(e,t,n){if(!e.length)return;let r=e.map(e=>new Set(e.issues.filter(e=>e.path.length===1).map(e=>String(e.path[0])))).reduce((e,t)=>new Set([...e].filter(e=>t.has(e))));if(r.size!==1)return;let i=[...r][0],a=[...new Set(e.flatMap(e=>Od(e.option,i)))];if(!a.length)return;let o=hd(t,[i]),s=xd(String(o),a);return{key:i,suggestion:s,issue:{path:n?`${n}.${i}`:i,message:s?`Unknown ${i} ${typeof o==`string`?`"${o}"`:String(o)}. Did you mean "${s}"?`:`Expected ${i} to be one of ${yd(a)}.`}}}function Ad(e,t){let n=ud(dd(e));if(n?.type===`union`)return Math.max(0,...(n.options??[]).map(e=>Ad(e,t)));let r=n?.shape;return!r||typeof t!=`object`||!t?0:Object.keys(t).filter(e=>e in r).length}function jd(e,t){return(ud(e)?.options??[]).map(e=>{let n=e.safeParse(t),r=n.success?[]:n.error.issues,i=gd(e);return{option:e,issues:r,wrongShape:r.some(e=>e.path.length===1&&i.has(String(e.path[0])))}})}function Md(e,t){let n=e.filter(e=>!e.wrongShape&&e.issues.length);if(n.length)return n.reduce((e,n)=>{let r=Ad(n.option,t)-Ad(e.option,t);return r===0?n.issues.length<e.issues.length?n:e:r>0?n:e})}function Nd(e,t,n,r){if(t===void 0)return{path:n,message:`Required. Expected one of ${yd(e)}.${r}`};let i=typeof t==`string`?xd(t,e):void 0,a=typeof t==`string`?`"${t}"`:String(t);return{path:n,message:i?`Unknown value ${a}. Did you mean "${i}"?`:`Unknown value ${a}. Expected one of ${yd(e)}.${r}`}}var Pd=12;function Fd(e,t,n,r,i,a){let o=new Set;for(let r of n){if(r.code!==`unrecognized_keys`)continue;let n=Ed(fd(e,r.path),hd(t,r.path));for(let e of r.keys??[]){let i=Cd(e,n);if(!i)continue;let a=[...r.path,i];hd(t,a)===void 0&&o.add(a.map(String).join(`.`))}}return n.flatMap(n=>{let s=[...r,...n.path].map(String).join(`.`);if(n.code!==`unrecognized_keys`&&o.has(n.path.map(String).join(`.`)))return[];let c=fd(e,n.path),l=hd(t,n.path),u=ud(c)?.type;if(n.code===`unrecognized_keys`&&n.keys?.length)return Dd(n.keys,c,l,s);if(c&&u===`union`&&i<Pd){let e=ud(c)?.options??[],t=e.some(e=>ud(dd(e))?.type===`object`)&&e.some(e=>_d(e)?.length)?` Use { container, key } for an attribute that is not a known column.`:a,o=jd(c,l),u=kd(o,l,s);if(u){let e=u.suggestion?o.find(e=>Od(e.option,u.key).includes(u.suggestion)):void 0,a=e?Fd(e.option,l,e.issues.filter(e=>e.path.length===0||String(e.path[0])!==u.key),[...r,...n.path],i+1,t):[];return[u.issue,...a]}let d=Md(o,l);if(d)return Fd(d.option,l,d.issues,[...r,...n.path],i+1,t)}if(c&&u===`enum`){let e=_d(c);if(e?.length)return[Nd(e,l,s,a)]}return[{path:s,message:n.message}]})}function Id(e,t,n){return Fd(e,t,n,[],0,``)}var Ld=Fc({KopaiQueryValidationError:()=>Rd,METRIC_TYPE_TO_TABLE:()=>tf,NUMBER_COMPARATOR_SQL:()=>ef,SPAN_KIND_NAMES:()=>Jd,STATUS_CODE_ERROR_LITERAL:()=>Zd,STATUS_CODE_NAMES:()=>qd,allStructuralColumns:()=>_f,assertMetricType:()=>af,collectFilterColumns:()=>vf,collectFilterLeaves:()=>yf,columnRefProjectionKey:()=>mf,compileTimeWindow:()=>Kd,durationToNanos:()=>Ud,extractMetricType:()=>Sf,findMetricTypePin:()=>xf,granularityToSeconds:()=>Wd,isMetricType:()=>rf,parseKopaiQuery:()=>wf,resolveColumn:()=>pf,spanKindName:()=>Xd,statusCodeName:()=>Yd,timeColumnForSignal:()=>Qd,validateKopaiQuery:()=>Cf}),Rd=class extends Error{constructor(e){super(e),this.name=`KopaiQueryValidationError`}},zd={s:1000000000n,m:60n*1000000000n,h:60n*60n*1000000000n,d:24n*60n*60n*1000000000n,w:7n*24n*60n*60n*1000000000n},Bd={s:1,m:60,h:3600,d:86400,w:604800};function Vd(e){return e===`s`||e===`m`||e===`h`||e===`d`||e===`w`}function Hd(e){let t=/^(\d+)([smhdw])$/.exec(e);if(!t||t[1]===void 0||t[2]===void 0||!Vd(t[2]))throw new Rd(`Invalid duration "${e}". Expected positive integer + unit (s,m,h,d,w).`);let n=BigInt(t[1]);if(n===0n)throw new Rd(`Invalid duration "${e}". Expected positive integer + unit (s,m,h,d,w).`);return{value:n,unit:t[2]}}function Ud(e){let{value:t,unit:n}=Hd(e);return t*zd[n]}function Wd(e){let{value:t,unit:n}=Hd(e);return Number(t)*Bd[n]}function Gd(e){let t=Date.parse(e);if(Number.isNaN(t))throw new Rd(`Invalid ISO datetime "${e}".`);return BigInt(t)*1000000n}function Kd(e,t=new Date){let n,r;if(e.type===`relative`)r=BigInt(t.getTime())*1000000n,n=r-Ud(e.lookback);else if(n=Gd(e.startTime),r=Gd(e.endTime),r<=n)throw new Rd(`Time window endTime (${e.endTime}) must be after startTime (${e.startTime}).`);return{startNs:n,endNs:r}}var qd=[`Unset`,`Ok`,`Error`],Jd=[`Unspecified`,`Internal`,`Server`,`Client`,`Producer`,`Consumer`];function Yd(e){return e===void 0?``:qd[e]??``}function Xd(e){return e===void 0?``:Jd[e]??``}var Zd=`Error`;function Qd(e){return e===`metrics`?`TimeUnix`:`Timestamp`}var $d={traces:new Set([`Timestamp`]),logs:new Set([`Timestamp`]),metrics:new Set([`TimeUnix`,`StartTimeUnix`])},ef={eq:`=`,neq:`<>`,gt:`>`,gte:`>=`,lt:`<`,lte:`<=`},tf={Gauge:`otel_metrics_gauge`,Sum:`otel_metrics_sum`,Histogram:`otel_metrics_histogram`,ExponentialHistogram:`otel_metrics_exponential_histogram`,Summary:`otel_metrics_summary`},nf=new Set(ad);function rf(e){return nf.has(e)}function af(e){if(!rf(e))throw new Rd(`Invalid MetricType "${e}". Expected one of: ${ad.join(`, `)}.`);return e}var of=/^[A-Z]/,sf=e=>new Set(e.filter(e=>of.test(e))),cf=sf(Su.options),lf=sf(Cu.options),uf=sf(wu.options),df=new Set(`service.name,service.namespace,service.version,service.instance.id,deployment.environment.name,host.name,host.id,host.arch,host.type,host.ip,container.id,container.name,container.image.name,container.image.tag,container.runtime,k8s.cluster.name,k8s.cluster.uid,k8s.namespace.name,k8s.node.name,k8s.node.uid,k8s.pod.name,k8s.pod.uid,k8s.container.name,k8s.container.restart_count,k8s.deployment.name,k8s.deployment.uid,k8s.statefulset.name,k8s.statefulset.uid,k8s.daemonset.name,k8s.daemonset.uid,k8s.job.name,k8s.job.uid,k8s.cronjob.name,k8s.cronjob.uid,k8s.replicaset.name,k8s.replicaset.uid,cloud.provider,cloud.region,cloud.availability_zone,cloud.account.id,cloud.platform,cloud.resource_id,process.pid,process.executable.name,process.command,process.command_line,process.runtime.name,process.runtime.version,process.runtime.description,telemetry.sdk.name,telemetry.sdk.version,telemetry.sdk.language,telemetry.distro.name,telemetry.distro.version,os.type,os.name,os.version,os.description`.split(`,`));function ff(e){switch(e){case`traces`:return`SpanAttributes`;case`logs`:return`LogAttributes`;case`metrics`:return`Attributes`}}function pf(e,t){return typeof t==`object`?{kind:`attribute`,container:t.container,key:t.key}:(e===`traces`?cf:e===`logs`?lf:uf).has(t)?{kind:`structural`,column:t}:{kind:`semconvAttr`,container:df.has(t)?`ResourceAttributes`:ff(e),key:t}}function mf(e){return typeof e==`string`?e:`${e.container}.${e.key}`}function hf(e){return typeof e==`string`?!0:typeof e!=`object`||!e?!1:`container`in e&&typeof e.container==`string`&&`key`in e&&typeof e.key==`string`}function gf(e,t){if(!hf(e))throw new Rd(`${t}: expected a column reference (string or {container, key}), got ${typeof e}.`);return mf(e)}function _f(e){return e===`traces`?[...cf]:e===`logs`?[...lf]:[...uf]}function vf(e){let t=[];if(!e)return t;for(let n of e)`and`in n?t.push(...vf(n.and)):`or`in n?t.push(...vf(n.or)):t.push(n.column);return t}function yf(e){let t=[];if(!e)return t;for(let n of e)`and`in n?t.push(...yf(n.and)):`or`in n?t.push(...yf(n.or)):t.push(n);return t}function bf(e){let t=[];if(e.dimensions&&t.push(...e.dimensions),t.push(...vf(e.filters)),e.mode===`aggregate`)for(let n of e.measures)`column`in n&&t.push(n.column);if(e.orderBy)for(let n of e.orderBy)n.type===`dimension`&&hf(n.column)&&t.push(n.column);return t}function xf(e,t){if(!e||e.length===0)return{kind:`none`};let n=null;for(let r of e){if(`and`in r||`or`in r){let e=`and`in r,i=xf(`and`in r?r.and:r.or,t&&e);if(i.kind===`ambiguous`)return i;if(i.kind===`pinned`){if(!t||!e)return{kind:`ambiguous`,reason:`MetricType filter inside an OR branch cannot pin the metric table. Place MetricType at the top level (AND).`};if(n!==null&&n!==i.value)return{kind:`ambiguous`,reason:`Conflicting MetricType filters (${n} vs ${i.value}).`};n=i.value}continue}if(r.column===`MetricType`){if(!t)return{kind:`ambiguous`,reason:`MetricType filter inside an OR branch cannot pin the metric table. Place MetricType at the top level (AND).`};if(r.op===`eq`&&typeof r.value==`string`){if(n!==null&&n!==r.value)return{kind:`ambiguous`,reason:`Conflicting MetricType filters (${n} vs ${r.value}).`};n=r.value}else if(r.op===`in`){if(r.values.length!==1)return{kind:`ambiguous`,reason:`v1 supports only a single MetricType per query (got ${String(r.values.length)} values).`};let e=r.values[0];if(typeof e!=`string`)return{kind:`ambiguous`,reason:`MetricType filter values must be strings (got ${typeof e}).`};if(n!==null&&n!==e)return{kind:`ambiguous`,reason:`Conflicting MetricType filters (${n} vs ${e}).`};n=e}else return{kind:`ambiguous`,reason:`MetricType filter must use op 'eq' (string value) or 'in' (single string value); got op '${r.op}'.`}}}return n===null?{kind:`none`}:{kind:`pinned`,value:n}}function Sf(e){if(e.signal!==`metrics`)throw new Rd(`extractMetricType called for a non-metric query.`);let t=xf(e.filters,!0);if(t.kind===`ambiguous`)throw new Rd(t.reason);if(t.kind===`none`)throw new Rd(`Metric query missing MetricType filter.`);return af(t.value)}function Cf(e){if(e.timeDimension.type===`absolute`){let{startTime:t,endTime:n}=e.timeDimension,r=Date.parse(t),i=Date.parse(n);if(Number.isNaN(r)||Number.isNaN(i))throw new Rd(`timeDimension.${Number.isNaN(r)?`startTime`:`endTime`} "${Number.isNaN(r)?t:n}" is not a valid ISO 8601 UTC datetime.`);if(r>=i)throw new Rd(`timeDimension.startTime "${t}" is not before endTime "${n}"; endTime is exclusive, so this window matches nothing. Swap the bounds if they are reversed.`)}if(e.signal===`metrics`){let t=xf(e.filters,!0);if(t.kind===`ambiguous`)throw new Rd(t.reason);if(t.kind===`none`)throw new Rd(`Metric queries require a MetricType filter at the top level, e.g. {column:'MetricType', op:'eq', value:'Gauge'}.`);let n=af(t.value),r=cd[n];for(let t of bf(e))if(typeof t==`string`&&t!==`MetricType`&&pf(`metrics`,t).kind===`structural`&&!r.has(t))throw new Rd(`Column "${t}" does not exist on MetricType "${n}". Structural columns available for ${n}: ${[...r].sort().join(`, `)}.`)}if(e.mode===`aggregate`){let t=new Set;for(let n of e.measures){if(t.has(n.as))throw new Rd(`Duplicate measure alias "${n.as}".`);t.add(n.as)}if(e.havings){for(let n of e.havings)if(!t.has(n.measure))throw new Rd(`having.measure "${n.measure}" does not match any measure alias.`)}if(e.orderBy){let n=new Set;for(let t of e.dimensions??[])n.add(mf(t));for(let r of e.orderBy)if(r.type===`measure`){if(!t.has(r.alias))throw new Rd(`orderBy measure "${r.alias}" does not match any measure alias.`)}else{let e=gf(r.column,`orderBy column`);if(!n.has(e))throw new Rd(`orderBy dimension "${e}" must appear in dimensions.`)}}}else if(e.orderBy){for(let t of e.orderBy)if(t.type===`measure`)throw new Rd(`orderBy measure is not allowed in raw mode.`)}if(e.signal!==`metrics`){let t=e.mode===`aggregate`?e.measures.flatMap(e=>`column`in e?[e.column]:[]):[],n=[...e.dimensions??[],...vf(e.filters),...t];for(let e of n)if(typeof e==`string`&&e===`MetricType`)throw new Rd(`Column "MetricType" is only valid on metric queries.`)}let t=new Set([...od[e.signal],...$d[e.signal]]);for(let n of yf(e.filters)){let r=n.column;if(typeof r!=`string`||r===`MetricType`||pf(e.signal,r).kind!==`structural`)continue;let i;switch(n.op){case`gt`:case`gte`:case`lt`:case`lte`:i=!0;break;case`eq`:case`neq`:i=typeof n.value==`number`;break;case`in`:case`notIn`:i=typeof n.values[0]==`number`;break;default:i=!1}if(i&&!t.has(r))throw new Rd(`Column "${r}" is not numeric; the "${n.op}" operator/value requires a numeric column. Use a string value, or choose a numeric column.`)}}function wf(e){if(typeof e!=`object`||!e||Array.isArray(e))return{ok:!1,issues:[{path:``,message:`Expected a query object.`}]};let{signal:t,mode:n}=e,r=[];if(nd(t)||r.push({path:`signal`,message:`Expected one of ${ed.join(`, `)}.`}),rd(n)||r.push({path:`mode`,message:`Expected one of ${td.join(`, `)}.`}),r.length>0)return{ok:!1,issues:r};let i=id(t,n);if(!i)return{ok:!1,issues:[{path:``,message:`No query shape for signal "${String(t)}" in "${String(n)}" mode.`}]};let a=i.safeParse(e);if(!a.success)return{ok:!1,issues:Id(i,e,a.error.issues)};try{Cf(a.data)}catch(e){return{ok:!1,issues:[{path:``,message:e instanceof Error?e.message:String(e)}]}}return{ok:!0,data:a.data}}var Tf=o((e=>{var t=Symbol.for(`react.transitional.element`),n=Symbol.for(`react.fragment`);function r(e,n,r){var i=null;if(r!==void 0&&(i=``+r),n.key!==void 0&&(i=``+n.key),`key`in n)for(var a in r={},n)a!==`key`&&(r[a]=n[a]);else r=n;return n=r.ref,{$$typeof:t,type:e,key:i,ref:n===void 0?null:n,props:r}}e.Fragment=n,e.jsx=r,e.jsxs=r})),Y=o(((e,t)=>{t.exports=Tf()}))(),Ef=v.createContext(void 0),Df=e=>{let t=v.useContext(Ef);if(e)return e;if(!t)throw Error(`No QueryClient set, use QueryClientProvider to set one`);return t},Of=({client:e,children:t})=>(v.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),(0,Y.jsx)(Ef.Provider,{value:e,children:t})),kf={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},Af=new class{#e=kf;setTimeoutProvider(e){this.#e=e}setTimeout(e,t){return this.#e.setTimeout(e,t)}clearTimeout(e){this.#e.clearTimeout(e)}setInterval(e,t){return this.#e.setInterval(e,t)}clearInterval(e){this.#e.clearInterval(e)}};function jf(e){setTimeout(e,0)}var Mf=typeof window>`u`||`Deno`in globalThis;function Nf(){}function Pf(e,t){return typeof e==`function`?e(t):e}function Ff(e){return typeof e==`number`&&e>=0&&e!==1/0}function If(e,t){return Math.max(e+(t||0)-Date.now(),0)}function Lf(e,t){return typeof e==`function`?e(t):e}function Rf(e,t){let{type:n=`all`,exact:r,fetchStatus:i,predicate:a,queryKey:o,stale:s}=e;if(o){if(r){if(t.queryHash!==Bf(o,t.options))return!1}else if(!Hf(t.queryKey,o))return!1}if(n!==`all`){let e=t.isActive();if(n===`active`&&!e||n===`inactive`&&e)return!1}return!(typeof s==`boolean`&&t.isStale()!==s||i&&i!==t.state.fetchStatus||a&&!a(t))}function zf(e,t){let{exact:n,status:r,predicate:i,mutationKey:a}=e;if(a){if(!t.options.mutationKey)return!1;if(n){if(Vf(t.options.mutationKey)!==Vf(a))return!1}else if(!Hf(t.options.mutationKey,a))return!1}return!(r&&t.state.status!==r||i&&!i(t))}function Bf(e,t){return(t?.queryKeyHashFn||Vf)(e)}function Vf(e){return JSON.stringify(e,(e,t)=>qf(t)?Object.keys(t).sort().reduce((e,n)=>(e[n]=t[n],e),{}):t)}function Hf(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(e&&t&&typeof e==`object`&&typeof t==`object`){if(Array.isArray(e)&&Array.isArray(t)){for(let n=0;n<t.length;n++)if(!Hf(e[n],t[n]))return!1;return!0}let n=Object.keys(t);for(let r of n)if(!Hf(e[r],t[r]))return!1;return!0}return!1}var Uf=Object.prototype.hasOwnProperty;function Wf(e,t,n=0){if(e===t)return e;if(n>500)return t;let r=Kf(e)&&Kf(t);if(!r&&!(qf(e)&&qf(t)))return t;let i=(r?e:Object.keys(e)).length,a=r?t:Object.keys(t),o=a.length,s=r?Array(o):{},c=0;for(let l=0;l<o;l++){let o=r?l:a[l],u=e[o],d=t[o];if(u===d){s[o]=u,(r?l<i:Uf.call(e,o))&&c++;continue}if(u===null||d===null||typeof u!=`object`||typeof d!=`object`){s[o]=d;continue}let f=Wf(u,d,n+1);s[o]=f,f===u&&c++}return i===o&&c===i?e:s}function Gf(e,t){if(!t||Object.keys(e).length!==Object.keys(t).length)return!1;for(let n in e)if(e[n]!==t[n])return!1;return!0}function Kf(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function qf(e){if(!Jf(e))return!1;let t=e.constructor;if(t===void 0)return!0;let n=t.prototype;return!(!Jf(n)||!n.hasOwnProperty(`isPrototypeOf`)||Object.getPrototypeOf(e)!==Object.prototype)}function Jf(e){return Object.prototype.toString.call(e)===`[object Object]`}function Yf(e){return new Promise(t=>{Af.setTimeout(t,e)})}function Xf(e,t,n){return typeof n.structuralSharing==`function`?n.structuralSharing(e,t):n.structuralSharing===!1?t:Wf(e,t)}function Zf(e,t,n=0){let r=[...e,t];return n&&r.length>n?r.slice(1):r}function Qf(e,t,n=0){let r=[t,...e];return n&&r.length>n?r.slice(0,-1):r}var $f=Symbol();function ep(e,t){return!e.queryFn&&t?.initialPromise?()=>t.initialPromise:!e.queryFn||e.queryFn===$f?()=>Promise.reject(Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function tp(e,t){return typeof e==`function`?e(...t):!!e}function np(e,t,n){let r=!1,i;return Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(i??=t(),r?i:(r=!0,i.aborted?n():i.addEventListener(`abort`,n,{once:!0}),i))}),e}var rp=()=>Mf,ip=()=>rp(),ap=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(e){return this.listeners.add(e),this.onSubscribe(),()=>{this.listeners.delete(e),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},op=new class extends ap{#e;#t;#n;constructor(){super(),this.#n=e=>{if(typeof window<`u`&&window.addEventListener){let t=()=>e();return window.addEventListener(`visibilitychange`,t,!1),()=>{window.removeEventListener(`visibilitychange`,t)}}}}onSubscribe(){this.#t||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#n=e,this.#t?.(),this.#t=e(e=>{typeof e==`boolean`?this.setFocused(e):this.onFocus()})}setFocused(e){this.#e!==e&&(this.#e=e,this.onFocus())}onFocus(){let e=this.isFocused();this.listeners.forEach(t=>{t(e)})}isFocused(){return typeof this.#e==`boolean`?this.#e:globalThis.document?.visibilityState!==`hidden`}},sp=jf;function cp(){let e=[],t=0,n=e=>{e()},r=e=>{e()},i=sp,a=r=>{t?e.push(r):i(()=>{n(r)})},o=()=>{let t=e;e=[],t.length&&i(()=>{r(()=>{t.forEach(e=>{n(e)})})})};return{batch:e=>{let n;t++;try{n=e()}finally{t--,t||o()}return n},batchCalls:e=>(...t)=>{a(()=>{e(...t)})},schedule:a,setNotifyFunction:e=>{n=e},setBatchNotifyFunction:e=>{r=e},setScheduler:e=>{i=e}}}var lp=cp(),up=new class extends ap{#e=!0;#t;#n;constructor(){super(),this.#n=e=>{if(typeof window<`u`&&window.addEventListener){let t=()=>e(!0),n=()=>e(!1);return window.addEventListener(`online`,t,!1),window.addEventListener(`offline`,n,!1),()=>{window.removeEventListener(`online`,t),window.removeEventListener(`offline`,n)}}}}onSubscribe(){this.#t||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#n=e,this.#t?.(),this.#t=e(this.setOnline.bind(this))}setOnline(e){this.#e!==e&&(this.#e=e,this.listeners.forEach(t=>{t(e)}))}isOnline(){return this.#e}};function dp(e){return Math.min(1e3*2**e,3e4)}function fp(e){return(e??`online`)!==`online`||up.isOnline()}var pp=class extends Error{constructor(e){super(`CancelledError`),this.revert=e?.revert,this.silent=e?.silent}};function mp(e){let t=!1,n=0,r,i=`pending`,a,o,s=new Promise((e,t)=>{a=e,o=t});s.catch(Nf);let c=()=>i!==`pending`,l=t=>{if(!c()){let n=new pp(t);h(n),e.onCancel?.(n)}},u=()=>{t=!0},d=()=>{t=!1},f=()=>op.isFocused()&&(e.networkMode===`always`||up.isOnline())&&e.canRun(),p=()=>fp(e.networkMode)&&e.canRun(),m=e=>{c()||(r?.(),i=`resolved`,a(e))},h=e=>{c()||(r?.(),i=`rejected`,o(e))},g=()=>new Promise(t=>{r=e=>{(c()||f())&&t(e)},e.onPause?.()}).then(()=>{r=void 0,c()||e.onContinue?.()}),_=()=>{if(c())return;let r,i=n===0?e.initialPromise:void 0;try{r=i??e.fn()}catch(e){r=Promise.reject(e)}Promise.resolve(r).then(m).catch(r=>{if(c())return;let i=e.retry??(ip()?0:3),a=e.retryDelay??dp,o=typeof a==`function`?a(n,r):a,s=i===!0||typeof i==`number`&&n<i||typeof i==`function`&&i(n,r);if(t||!s){h(r);return}n++,e.onFail?.(n,r),Yf(o).then(()=>f()?void 0:g()).then(()=>{t?h(r):_()})})};return{promise:s,status:()=>i,cancel:l,continue:()=>(r?.(),s),cancelRetry:u,continueRetry:d,canStart:p,start:()=>(p()?_():g().then(_),s)}}var hp=class{#e;destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),Ff(this.gcTime)&&(this.#e=Af.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(ip()?1/0:3e5))}clearGcTimeout(){this.#e!==void 0&&(Af.clearTimeout(this.#e),this.#e=void 0)}};function gp(e){return{onFetch:(t,n)=>{let r=t.options,i=t.fetchOptions?.meta?.fetchMore?.direction,a=t.state.data?.pages||[],o=t.state.data?.pageParams||[],s={pages:[],pageParams:[]},c=0,l=async()=>{let n=!1,l=e=>{np(e,()=>t.signal,()=>n=!0)},u=ep(t.options,t.fetchOptions),d=async(e,r,i)=>{if(n)return Promise.reject(t.signal.reason);if(r==null&&e.pages.length)return Promise.resolve(e);let a=(()=>{let e={client:t.client,queryKey:t.queryKey,pageParam:r,direction:i?`backward`:`forward`,meta:t.options.meta};return l(e),e})(),o=await u(a),{maxPages:s}=t.options,c=i?Qf:Zf;return{pages:c(e.pages,o,s),pageParams:c(e.pageParams,r,s)}};if(i&&a.length){let e=i===`backward`,t=e?vp:_p,n={pages:a,pageParams:o};s=await d(n,t(r,n),e)}else{let t=e??a.length;do{let e=c===0?o[0]??r.initialPageParam:_p(r,s);if(c>0&&e==null)break;s=await d(s,e),c++}while(c<t)}return s};t.fetchFn=t.options.persister?()=>t.options.persister?.(l,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},n):l}}}function _p(e,{pages:t,pageParams:n}){let r=t.length-1;return t.length>0?e.getNextPageParam(t[r],t,n[r],n):void 0}function vp(e,{pages:t,pageParams:n}){return t.length>0?e.getPreviousPageParam?.(t[0],t,n[0],n):void 0}var yp=class extends hp{#e;#t;#n;#r;#i;#a;#o;#s;constructor(e){super(),this.#s=!1,this.#o=e.defaultOptions,this.setOptions(e.options),this.observers=[],this.#i=e.client,this.#r=this.#i.getQueryCache(),this.queryKey=e.queryKey,this.queryHash=e.queryHash,this.#t=Sp(this.options),this.state=e.state??this.#t,this.scheduleGc()}get meta(){return this.options.meta}get queryType(){return this.#e}get promise(){return this.#a?.promise}setOptions(e){if(this.options={...this.#o,...e},e?._type&&(this.#e=e._type),this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){let e=Sp(this.options);e.data!==void 0&&(this.setState(xp(e.data,e.dataUpdatedAt)),this.#t=e)}}optionalRemove(){!this.observers.length&&this.state.fetchStatus===`idle`&&this.#r.remove(this)}setData(e,t){let n=Xf(this.state.data,e,this.options);return this.#c({data:n,type:`success`,dataUpdatedAt:t?.updatedAt,manual:t?.manual}),n}setState(e){this.#c({type:`setState`,state:e})}cancel(e){let t=this.#a?.promise;return this.#a?.cancel(e),t?t.then(Nf).catch(Nf):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}get resetState(){return this.#t}reset(){this.destroy(),this.setState(this.resetState)}isActive(){return this.observers.some(e=>Lf(e.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===$f||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.getObserversCount()>0&&this.observers.some(e=>Lf(e.options.staleTime,this)===`static`)}isStale(){return this.getObserversCount()>0?this.observers.some(e=>e.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(e=0){return this.state.data===void 0?!0:e===`static`?!1:this.state.isInvalidated?!0:!If(this.state.dataUpdatedAt,e)}onFocus(){this.observers.find(e=>e.shouldFetchOnWindowFocus())?.refetch({cancelRefetch:!1}),this.#a?.continue()}onOnline(){this.observers.find(e=>e.shouldFetchOnReconnect())?.refetch({cancelRefetch:!1}),this.#a?.continue()}addObserver(e){this.observers.includes(e)||(this.observers.push(e),this.clearGcTimeout(),this.#r.notify({type:`observerAdded`,query:this,observer:e}))}removeObserver(e){let t=this.observers.indexOf(e);t!==-1&&(this.observers.splice(t,1),this.observers.length||(this.#a&&(this.#s||this.state.fetchStatus===`paused`&&this.state.status===`pending`?this.#a.cancel({revert:!0}):this.#a.cancelRetry()),this.scheduleGc()),this.#r.notify({type:`observerRemoved`,query:this,observer:e}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||this.#c({type:`invalidate`})}async fetch(e,t){if(this.state.fetchStatus!==`idle`&&this.#a?.status()!==`rejected`){if(this.state.data!==void 0&&t?.cancelRefetch)this.cancel({silent:!0});else if(this.#a)return this.#a.continueRetry(),this.#a.promise}if(e&&this.setOptions(e),!this.options.queryFn){let e=this.observers.find(e=>e.options.queryFn);e&&this.setOptions(e.options)}let n=new AbortController,r=e=>{Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(this.#s=!0,n.signal)})},i=()=>{let e=ep(this.options,t),n=(()=>{let e={client:this.#i,queryKey:this.queryKey,meta:this.meta};return r(e),e})();return this.#s=!1,this.options.persister?this.options.persister(e,n,this):e(n)},a=(()=>{let e={fetchOptions:t,options:this.options,queryKey:this.queryKey,client:this.#i,state:this.state,fetchFn:i};return r(e),e})();(this.#e===`infinite`?gp(this.options.pages):this.options.behavior)?.onFetch(a,this),this.#n=this.state,(this.state.fetchStatus===`idle`||this.state.fetchMeta!==a.fetchOptions?.meta)&&this.#c({type:`fetch`,meta:a.fetchOptions?.meta});let o=this.#a=mp({initialPromise:t?.initialPromise,fn:a.fetchFn,onCancel:e=>{e instanceof pp&&e.revert&&this.setState({...this.#n,fetchStatus:`idle`}),n.abort()},onFail:(e,t)=>{this.#c({type:`failed`,failureCount:e,error:t})},onPause:()=>{this.#c({type:`pause`})},onContinue:()=>{this.#c({type:`continue`})},retry:a.options.retry,retryDelay:a.options.retryDelay,networkMode:a.options.networkMode,canRun:()=>!0});try{let e=await o.start();if(e===void 0)throw Error(`${this.queryHash} data is undefined`);return this.setData(e),this.#r.config.onSuccess?.(e,this),this.#r.config.onSettled?.(e,this.state.error,this),e}catch(e){if(e instanceof pp){if(e.silent)return this.#a.promise;if(e.revert){if(this.state.data===void 0)throw e;return this.state.data}}throw this.#c({type:`error`,error:e}),this.#r.config.onError?.(e,this),this.#r.config.onSettled?.(this.state.data,e,this),e}finally{this.#a===o&&(this.#a=void 0),this.scheduleGc()}}#c(e){let t=t=>{switch(e.type){case`failed`:return{...t,fetchFailureCount:e.failureCount,fetchFailureReason:e.error};case`pause`:return{...t,fetchStatus:`paused`};case`continue`:return{...t,fetchStatus:`fetching`};case`fetch`:return{...t,...bp(t.data,this.options),fetchMeta:e.meta??null};case`success`:let n={...t,...xp(e.data,e.dataUpdatedAt),dataUpdateCount:t.dataUpdateCount+1,...!e.manual&&{fetchStatus:`idle`,fetchFailureCount:0,fetchFailureReason:null}};return this.#n=e.manual?n:void 0,n;case`error`:let r=e.error;return{...t,error:r,errorUpdateCount:t.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:t.fetchFailureCount+1,fetchFailureReason:r,fetchStatus:`idle`,status:`error`,isInvalidated:!0};case`invalidate`:return{...t,isInvalidated:!0};case`setState`:return{...t,...e.state}}};this.state=t(this.state),lp.batch(()=>{this.observers.slice().forEach(e=>{e.onQueryUpdate()}),this.#r.notify({query:this,type:`updated`,action:e})})}};function bp(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:fp(t.networkMode)?`fetching`:`paused`,...e===void 0&&{error:null,status:`pending`}}}function xp(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:`success`}}function Sp(e){let t=typeof e.initialData==`function`?e.initialData():e.initialData,n=t!==void 0,r=n?typeof e.initialDataUpdatedAt==`function`?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:n?r??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:n?`success`:`pending`,fetchStatus:`idle`}}var Cp=class extends ap{#e;#t=void 0;#n=void 0;#r=void 0;#i;#a;#o;#s;#c;#l;#u;#d;#f;#p=new Set;constructor(e,t){super(),this.options=t,this.#e=e,this.#o=null,this.bindMethods(),this.setOptions(t)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(this.#t.addObserver(this),Tp(this.#t,this.options)?this.#m():this.updateResult(),this.#y())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return Ep(this.#t,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return Ep(this.#t,this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,this.#b(),this.#x(),this.#t.removeObserver(this)}setOptions(e){let t=this.options,n=this.#t;if(this.options=this.#e.defaultQueryOptions(e),this.options.enabled!==void 0&&typeof this.options.enabled!=`boolean`&&typeof this.options.enabled!=`function`&&typeof Lf(this.options.enabled,this.#t)!=`boolean`)throw Error(`Expected enabled to be a boolean or a callback that returns a boolean`);this.#S(),this.#t.setOptions(this.options),t._defaulted&&!Gf(this.options,t)&&this.#e.getQueryCache().notify({type:`observerOptionsUpdated`,query:this.#t,observer:this});let r=this.hasListeners();r&&Dp(this.#t,n,this.options,t)&&this.#m(),this.updateResult(),r&&(this.#t!==n||Lf(this.options.enabled,this.#t)!==Lf(t.enabled,this.#t)||Lf(this.options.staleTime,this.#t)!==Lf(t.staleTime,this.#t))&&this.#g();let i=this.#_();r&&(this.#t!==n||Lf(this.options.enabled,this.#t)!==Lf(t.enabled,this.#t)||i!==this.#f)&&this.#v(i)}getOptimisticResult(e){let t=this.#e.getQueryCache().build(this.#e,e),n=this.createResult(t,e);return Gf(this.getCurrentResult(),n)||(this.#r=n,this.#a=this.options,this.#i=this.#t.state),n}getCurrentResult(){return this.#r}trackResult(e,t){return new Proxy(e,{get:(e,n)=>(this.trackProp(n),t?.(n),Reflect.get(e,n))})}trackProp(e){this.#p.add(e)}getCurrentQuery(){return this.#t}refetch({...e}={}){return this.fetch({...e})}fetchOptimistic(e){let t=this.#e.defaultQueryOptions(e),n=this.#e.getQueryCache().build(this.#e,t),r=()=>{},i,a=new Promise(e=>{i=e,r=this.#e.getQueryCache().subscribe(i=>{i.type===`updated`&&i.query.queryHash===n.queryHash&&n.state.data!==void 0&&(r(),e(this.createResult(n,t)))})});return Promise.race([n.fetch().then(()=>{let e=this.createResult(n,t);return i?.(e),e}).finally(()=>{r()}),a])}fetch(e){return this.#m({...e,cancelRefetch:e.cancelRefetch??!0}).then(()=>(this.updateResult(),this.#r))}#m(e){this.#S();let t=this.#t.fetch(this.options,e);return e?.throwOnError||(t=t.catch(Nf)),t}#h(e){return!ip()&&Lf(this.options.enabled,this.#t)!==!1&&Ff(e)}#g(){this.#b();let e=Lf(this.options.staleTime,this.#t);if(this.#r.isStale||!this.#h(e))return;let t=If(this.#r.dataUpdatedAt,e)+1;this.#u=Af.setTimeout(()=>{this.#r.isStale||this.updateResult()},t)}#_(){return(typeof this.options.refetchInterval==`function`?this.options.refetchInterval(this.#t):this.options.refetchInterval)??!1}#v(e){this.#x(),this.#f=e,this.#f!==0&&this.#h(this.#f)&&(this.#d=Af.setInterval(()=>{(this.options.refetchIntervalInBackground||op.isFocused())&&this.#m()},this.#f))}#y(){this.#g(),this.#v(this.#_())}#b(){this.#u!==void 0&&(Af.clearTimeout(this.#u),this.#u=void 0)}#x(){this.#d!==void 0&&(Af.clearInterval(this.#d),this.#d=void 0)}createResult(e,t){let n=this.#t,r=this.options,i=this.#r,a=this.#i,o=this.#a,s=e===n?this.#n:e.state,{state:c}=e,l={...c},u=!1,d;if(t._optimisticResults){let i=this.hasListeners(),a=!i&&Tp(e,t),o=i&&Dp(e,n,t,r);(a||o)&&(l={...l,...bp(c.data,e.options)}),t._optimisticResults===`isRestoring`&&(l.fetchStatus=`idle`)}let{error:f,errorUpdatedAt:p,status:m}=l;d=l.data;let h=!1;if(t.placeholderData!==void 0&&d===void 0&&m===`pending`){let e;i?.isPlaceholderData&&t.placeholderData===o?.placeholderData?(e=i.data,h=!0):e=typeof t.placeholderData==`function`?t.placeholderData(this.#l?.state.data,this.#l):t.placeholderData,e!==void 0&&(m=`success`,d=Xf(i?.data,e,t),u=!0)}if(t.select&&d!==void 0&&!h){if(i&&d===a?.data&&t.select===this.#s)d=this.#c;else try{this.#s=t.select,d=t.select(d),d=Xf(i?.data,d,t),this.#c=d,this.#o=null}catch(e){this.#o=e}}else d===void 0&&(this.#o=null);this.#o&&(f=this.#o,d=this.#c,p=Date.now(),m=`error`,u=!1);let g=l.fetchStatus===`fetching`,_=m===`pending`,v=m===`error`,y=_&&g,b=d!==void 0;return{status:m,fetchStatus:l.fetchStatus,isPending:_,isSuccess:m===`success`,isError:v,isInitialLoading:y,isLoading:y,data:d,dataUpdatedAt:l.dataUpdatedAt,error:f,errorUpdatedAt:p,failureCount:l.fetchFailureCount,failureReason:l.fetchFailureReason,errorUpdateCount:l.errorUpdateCount,isFetched:e.isFetched(),isFetchedAfterMount:l.dataUpdateCount>s.dataUpdateCount||l.errorUpdateCount>s.errorUpdateCount,isFetching:g,isRefetching:g&&!_,isLoadingError:v&&!b,isPaused:l.fetchStatus===`paused`,isPlaceholderData:u,isRefetchError:v&&b,isStale:Op(e,t),refetch:this.refetch,isEnabled:Lf(t.enabled,e)!==!1}}updateResult(){let e=this.#r,t=this.createResult(this.#t,this.options);if(this.#i=this.#t.state,this.#a=this.options,this.#i.data!==void 0&&(this.#l=this.#t),Gf(t,e))return;this.#r=t;let n=(()=>{if(!e)return!0;let{notifyOnChangeProps:t}=this.options,n=typeof t==`function`?t():t;if(n===`all`||!n&&!this.#p.size)return!0;let r=new Set(n??this.#p);return this.options.throwOnError&&r.add(`error`),Object.keys(this.#r).some(t=>{let n=t;return this.#r[n]!==e[n]&&r.has(n)})})();lp.batch(()=>{n&&this.listeners.forEach(e=>{e(this.#r)}),this.#e.getQueryCache().notify({query:this.#t,type:`observerResultsUpdated`})})}#S(){let e=this.#e.getQueryCache().build(this.#e,this.options);if(e===this.#t)return;let t=this.#t;this.#t=e,this.#n=e.state,this.hasListeners()&&(t?.removeObserver(this),e.addObserver(this))}onQueryUpdate(){this.updateResult(),this.hasListeners()&&this.#y()}};function wp(e,t){return Lf(t.enabled,e)!==!1&&e.state.data===void 0&&(e.state.status!==`error`||Lf(t.retryOnMount,e)!==!1)}function Tp(e,t){return wp(e,t)||e.state.data!==void 0&&Ep(e,t,t.refetchOnMount)}function Ep(e,t,n){if(Lf(t.enabled,e)!==!1&&Lf(t.staleTime,e)!==`static`){let r=typeof n==`function`?n(e):n;return r===`always`||r!==!1&&Op(e,t)}return!1}function Dp(e,t,n,r){return(e!==t||Lf(r.enabled,e)===!1)&&(!n.suspense||e.state.status!==`error`)&&Op(e,n)}function Op(e,t){return Lf(t.enabled,e)!==!1&&e.isStaleByTime(Lf(t.staleTime,e))}var kp=class extends hp{#e;#t;#n;#r;constructor(e){super(),this.#e=e.client,this.mutationId=e.mutationId,this.#n=e.mutationCache,this.#t=[],this.state=e.state||Ap(),this.setOptions(e.options),this.scheduleGc()}setOptions(e){this.options=e,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(e){this.#t.includes(e)||(this.#t.push(e),this.clearGcTimeout(),this.#n.notify({type:`observerAdded`,mutation:this,observer:e}))}removeObserver(e){this.#t=this.#t.filter(t=>t!==e),this.scheduleGc(),this.#n.notify({type:`observerRemoved`,mutation:this,observer:e})}optionalRemove(){this.#t.length||(this.state.status===`pending`?this.scheduleGc():this.#n.remove(this))}continue(){return this.#r?.continue()??(this.state.status===`pending`?this.execute(this.state.variables):Promise.resolve())}async execute(e){let t=()=>{this.#i({type:`continue`})},n={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey},r=this.#r=mp({fn:()=>this.options.mutationFn?this.options.mutationFn(e,n):Promise.reject(Error(`No mutationFn found`)),onFail:(e,t)=>{this.#i({type:`failed`,failureCount:e,error:t})},onPause:()=>{this.#i({type:`pause`})},onContinue:t,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>this.#n.canRun(this)}),i=this.state.status===`pending`,a=!r.canStart();try{if(i)t();else{this.#i({type:`pending`,variables:e,isPaused:a}),this.#n.config.onMutate&&await this.#n.config.onMutate(e,this,n);let t=await this.options.onMutate?.(e,n);t!==this.state.context&&this.#i({type:`pending`,context:t,variables:e,isPaused:a})}let o=await r.start();return await this.#n.config.onSuccess?.(o,e,this.state.context,this,n),await this.options.onSuccess?.(o,e,this.state.context,n),await this.#n.config.onSettled?.(o,null,this.state.variables,this.state.context,this,n),await this.options.onSettled?.(o,null,e,this.state.context,n),this.#i({type:`success`,data:o}),o}catch(t){try{await this.#n.config.onError?.(t,e,this.state.context,this,n)}catch(e){Promise.reject(e)}try{await this.options.onError?.(t,e,this.state.context,n)}catch(e){Promise.reject(e)}try{await this.#n.config.onSettled?.(void 0,t,this.state.variables,this.state.context,this,n)}catch(e){Promise.reject(e)}try{await this.options.onSettled?.(void 0,t,e,this.state.context,n)}catch(e){Promise.reject(e)}throw this.#i({type:`error`,error:t}),t}finally{this.#r===r&&(this.#r=void 0),this.#n.runNext(this)}}#i(e){let t=t=>{switch(e.type){case`failed`:return{...t,failureCount:e.failureCount,failureReason:e.error};case`pause`:return{...t,isPaused:!0};case`continue`:return{...t,isPaused:!1};case`pending`:return{...t,context:e.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:e.isPaused,status:`pending`,variables:e.variables,submittedAt:Date.now()};case`success`:return{...t,data:e.data,failureCount:0,failureReason:null,error:null,status:`success`,isPaused:!1};case`error`:return{...t,data:void 0,error:e.error,failureCount:t.failureCount+1,failureReason:e.error,isPaused:!1,status:`error`}}};this.state=t(this.state),lp.batch(()=>{this.#t.forEach(t=>{t.onMutationUpdate(e)}),this.#n.notify({mutation:this,type:`updated`,action:e})})}};function Ap(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:`idle`,variables:void 0,submittedAt:0}}var jp=class extends ap{#e;#t;#n;constructor(e={}){super(),this.config=e,this.#e=new Set,this.#t=new Map,this.#n=0}build(e,t,n){let r=new kp({client:e,mutationCache:this,mutationId:++this.#n,options:e.defaultMutationOptions(t),state:n});return this.add(r),r}add(e){this.#e.add(e);let t=Mp(e);if(typeof t==`string`){let n=this.#t.get(t);n?n.push(e):this.#t.set(t,[e])}this.notify({type:`added`,mutation:e})}remove(e){if(this.#e.delete(e)){let t=Mp(e);if(typeof t==`string`){let n=this.#t.get(t);if(n){if(n.length>1){let t=n.indexOf(e);t!==-1&&n.splice(t,1)}else n[0]===e&&this.#t.delete(t)}}}this.notify({type:`removed`,mutation:e})}canRun(e){let t=Mp(e);if(typeof t==`string`){let n=this.#t.get(t)?.find(e=>e.state.status===`pending`);return!n||n===e}return!0}runNext(e){let t=Mp(e);return typeof t==`string`?(this.#t.get(t)?.find(t=>t!==e&&t.state.isPaused))?.continue()??Promise.resolve():Promise.resolve()}clear(){lp.batch(()=>{this.#e.forEach(e=>{this.notify({type:`removed`,mutation:e})}),this.#e.clear(),this.#t.clear()})}getAll(){return Array.from(this.#e)}find(e){let t={exact:!0,...e};return this.getAll().find(e=>zf(t,e))}findAll(e={}){return this.getAll().filter(t=>zf(e,t))}notify(e){lp.batch(()=>{this.listeners.forEach(t=>{t(e)})})}resumePausedMutations(){let e=this.getAll().filter(e=>e.state.isPaused);return lp.batch(()=>Promise.all(e.map(e=>e.continue().catch(Nf))))}};function Mp(e){return e.options.scope?.id}var Np=class extends ap{#e;constructor(e={}){super(),this.config=e,this.#e=new Map}build(e,t,n){let r=t.queryKey,i=t.queryHash??Bf(r,t),a=this.get(i);return a||(a=new yp({client:e,queryKey:r,queryHash:i,options:e.defaultQueryOptions(t),state:n,defaultOptions:e.getQueryDefaults(r)}),this.add(a)),a}add(e){this.#e.has(e.queryHash)||(this.#e.set(e.queryHash,e),this.notify({type:`added`,query:e}))}remove(e){let t=this.#e.get(e.queryHash);t&&(e.destroy(),t===e&&this.#e.delete(e.queryHash),this.notify({type:`removed`,query:e}))}clear(){lp.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}get(e){return this.#e.get(e)}getAll(){return[...this.#e.values()]}find(e){let t={exact:!0,...e};return this.getAll().find(e=>Rf(t,e))}findAll(e={}){let t=this.getAll();return Object.keys(e).length>0?t.filter(t=>Rf(e,t)):t}notify(e){lp.batch(()=>{this.listeners.forEach(t=>{t(e)})})}onFocus(){lp.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){lp.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},Pp=class{#e;#t;#n;#r;#i;#a;#o;#s;constructor(e={}){this.#e=e.queryCache||new Np,this.#t=e.mutationCache||new jp,this.#n=e.defaultOptions||{},this.#r=new Map,this.#i=new Map,this.#a=0}mount(){this.#a++,this.#a===1&&(this.#o=op.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onFocus())}),this.#s=up.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onOnline())}))}unmount(){this.#a--,this.#a===0&&(this.#o?.(),this.#o=void 0,this.#s?.(),this.#s=void 0)}isFetching(e){return this.#e.findAll({...e,fetchStatus:`fetching`}).length}isMutating(e){return this.#t.findAll({...e,status:`pending`}).length}getQueryData(e){let t=this.defaultQueryOptions({queryKey:e});return this.#e.get(t.queryHash)?.state.data}ensureQueryData(e){let t=this.defaultQueryOptions(e),n=this.#e.build(this,t),r=n.state.data;return r===void 0?this.fetchQuery(e):(e.revalidateIfStale&&n.isStaleByTime(Lf(t.staleTime,n))&&this.prefetchQuery(t),Promise.resolve(r))}getQueriesData(e){return this.#e.findAll(e).map(({queryKey:e,state:t})=>[e,t.data])}setQueryData(e,t,n){let r=this.defaultQueryOptions({queryKey:e}),i=this.#e.get(r.queryHash)?.state.data,a=Pf(t,i);if(a!==void 0)return this.#e.build(this,r).setData(a,{...n,manual:!0})}setQueriesData(e,t,n){return lp.batch(()=>this.#e.findAll(e).map(({queryKey:e})=>[e,this.setQueryData(e,t,n)]))}getQueryState(e){let t=this.defaultQueryOptions({queryKey:e});return this.#e.get(t.queryHash)?.state}removeQueries(e){let t=this.#e;lp.batch(()=>{t.findAll(e).forEach(e=>{t.remove(e)})})}resetQueries(e,t){let n=this.#e;return lp.batch(()=>{let r=n.findAll(e),i=new Set(r);return r.forEach(e=>{e.reset()}),this.refetchQueries({type:`active`,predicate:e=>i.has(e)},t)})}cancelQueries(e,t={}){let n={revert:!0,...t},r=lp.batch(()=>this.#e.findAll(e).map(e=>e.cancel(n)));return Promise.all(r).then(Nf).catch(Nf)}invalidateQueries(e,t={}){return lp.batch(()=>(this.#e.findAll(e).forEach(e=>{e.invalidate()}),e?.refetchType===`none`?Promise.resolve():this.refetchQueries({...e,type:e?.refetchType??e?.type??`active`},t)))}refetchQueries(e,t={}){let n={...t,cancelRefetch:t.cancelRefetch??!0},r=lp.batch(()=>this.#e.findAll(e).filter(e=>!e.isDisabled()&&!e.isStatic()).map(e=>{let t=e.fetch(void 0,n);return n.throwOnError||(t=t.catch(Nf)),e.state.fetchStatus===`paused`?Promise.resolve():t}));return Promise.all(r).then(Nf)}async query(e){let t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);let n=this.#e.build(this,t),r=n.isStaleByTime(Lf(t.staleTime,n))?await n.fetch(t):n.state.data,i=t.select;return i?i(r):r}fetchQuery(e){let t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);let n=this.#e.build(this,t);return n.isStaleByTime(Lf(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(Nf).catch(Nf)}infiniteQuery(e){return e._type=`infinite`,this.query(e)}fetchInfiniteQuery(e){return e._type=`infinite`,this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(Nf).catch(Nf)}ensureInfiniteQueryData(e){return e._type=`infinite`,this.ensureQueryData(e)}resumePausedMutations(){return up.isOnline()?this.#t.resumePausedMutations():Promise.resolve()}getQueryCache(){return this.#e}getMutationCache(){return this.#t}getDefaultOptions(){return this.#n}setDefaultOptions(e){this.#n=e}setQueryDefaults(e,t){this.#r.set(Vf(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){let t=[...this.#r.values()],n={};return t.forEach(t=>{Hf(e,t.queryKey)&&Object.assign(n,t.defaultOptions)}),n}setMutationDefaults(e,t){this.#i.set(Vf(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){let t=[...this.#i.values()],n={};return t.forEach(t=>{Hf(e,t.mutationKey)&&Object.assign(n,t.defaultOptions)}),n}defaultQueryOptions(e){if(e._defaulted)return e;let t={...this.#n.queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||=Bf(t.queryKey,t),t.refetchOnReconnect===void 0&&(t.refetchOnReconnect=t.networkMode!==`always`),t.throwOnError===void 0&&(t.throwOnError=!!t.suspense),!t.networkMode&&t.persister&&(t.networkMode=`offlineFirst`),t.queryFn===$f&&(t.enabled=!1),t}defaultMutationOptions(e){return e?._defaulted?e:{...this.#n.mutations,...e?.mutationKey&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){this.#e.clear(),this.#t.clear()}},Fp=v.createContext(!1),Ip=()=>v.useContext(Fp);Fp.Provider;function Lp(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var Rp=v.createContext(Lp()),zp=()=>v.useContext(Rp),Bp=(e,t,n)=>{let r=n?.state.error&&typeof e.throwOnError==`function`?tp(e.throwOnError,[n.state.error,n]):e.throwOnError;(e.suspense||r)&&(t.isReset()||(e.retryOnMount=!1))},Vp=e=>{v.useEffect(()=>{e.clearReset()},[e])},Hp=({result:e,errorResetBoundary:t,throwOnError:n,query:r,suspense:i})=>e.isError&&!t.isReset()&&!e.isFetching&&r&&(i&&e.data===void 0||tp(n,[e.error,r])),Up=e=>{if(e.suspense){let t=1e3,n=e=>e===`static`?e:Math.max(e??t,t),r=e.staleTime;e.staleTime=typeof r==`function`?(...e)=>n(r(...e)):n(r),typeof e.gcTime==`number`&&(e.gcTime=Math.max(e.gcTime,t))}},Wp=(e,t)=>e?.suspense&&t.isPending,Gp=(e,t,n)=>t.fetchOptimistic(e).catch(()=>{n.clearReset()});function Kp(e,t,n){let r=Ip(),i=zp(),a=Df(n),o=a.defaultQueryOptions(e),s=a.getQueryCache().get(o.queryHash),c=e.subscribed!==!1;o._optimisticResults=r?`isRestoring`:c?`optimistic`:void 0,Up(o),Bp(o,i,s),Vp(i);let[l]=v.useState(()=>new t(a,o)),u=l.getOptimisticResult(o),d=!r&&c;if(v.useSyncExternalStore(v.useCallback(e=>{let t=d?l.subscribe(lp.batchCalls(e)):Nf;return l.updateResult(),t},[l,d]),()=>l.getCurrentResult(),()=>l.getCurrentResult()),v.useEffect(()=>{l.setOptions(o)},[o,l]),Wp(o,u))throw Gp(o,l,i);if(Hp({result:u,errorResetBoundary:i,throwOnError:o.throwOnError,query:s,suspense:o.suspense}))throw u.error;return o.notifyOnChangeProps?u:l.trackResult(u)}function qp(e,t){return Kp(e,Cp,t)}var Jp=nc(`method`,[W({method:q(`searchTracesPage`),params:Rl.tracesDataFilterSchema,refetchIntervalMs:V().optional()}),W({method:q(`searchLogsPage`),params:Rl.logsDataFilterSchema,refetchIntervalMs:V().optional()}),W({method:q(`searchMetricsPage`),params:Rl.metricsDataFilterSchema,refetchIntervalMs:V().optional()}),W({method:q(`getTrace`),params:W({traceId:B()}),refetchIntervalMs:V().optional()}),W({method:q(`discoverMetrics`),params:W({}).optional(),refetchIntervalMs:V().optional()}),W({method:q(`getServices`),params:W({}).optional(),refetchIntervalMs:V().optional()}),W({method:q(`getOperations`),params:W({serviceName:B()}),refetchIntervalMs:V().optional()}),W({method:q(`searchTraceSummariesPage`),params:Rl.traceSummariesFilterSchema,refetchIntervalMs:V().optional()}),W({method:q(`searchAggregatedMetrics`),params:Rl.metricsDataFilterSchema,refetchIntervalMs:V().optional()}),W({method:q(`query`),params:Ql.KopaiQuery,refetchIntervalMs:V().optional()})]),Yp=K(Jp.options.map(e=>e.shape.method.value)),Xp=W({hasChildren:Hs(),description:B().describe(`Component description to be displayed by the prompt generator`),props:qs(),acceptsDataFrom:U(Yp).readonly().optional()}).describe(`All options and properties necessary to render the React component with renderer`);W({name:B().describe(`catalog name`),components:oc(B().describe(`React component name`),Xp)});function Zp(e){let t=nc(`type`,Object.keys(e.components).map(t=>({catalogItemName:t,component:e.components[t]})).filter(e=>!!e.component).map(({catalogItemName:e,component:t})=>W({key:B(),type:q(e),children:U(B()),parentKey:B(),dataSource:Jp.optional(),props:t.props}))),n=W({root:B().describe(`root uiElement key in the elements array`),elements:oc(B().describe(`equal to the element key`),t)});return{name:e.name,components:e.components,uiTreeSchema:n}}var Qp=Zp({name:`observability`,components:{Card:{props:W({title:B().nullable(),description:B().nullable(),padding:K([`sm`,`md`,`lg`]).nullable()}),hasChildren:!0,description:`A card container with optional title`},Grid:{props:W({columns:V().min(1).max(4).nullable(),gap:K([`sm`,`md`,`lg`]).nullable()}),hasChildren:!0,description:`Grid layout with configurable columns`},Stack:{props:W({direction:K([`horizontal`,`vertical`]).nullable(),gap:K([`sm`,`md`,`lg`]).nullable(),align:K([`start`,`center`,`end`,`stretch`]).nullable()}),hasChildren:!0,description:`Flex stack for horizontal or vertical layouts`},Heading:{props:W({text:B(),level:K([`h1`,`h2`,`h3`,`h4`]).nullable()}),hasChildren:!1,description:`Section heading`},Text:{props:W({content:B(),variant:K([`body`,`caption`,`label`]).nullable(),color:K([`default`,`muted`,`success`,`warning`,`danger`]).nullable()}),hasChildren:!1,description:`Text paragraph`},Badge:{props:W({text:B(),variant:K([`default`,`success`,`warning`,`danger`,`info`]).nullable()}),hasChildren:!1,description:`Small status badge`},Divider:{props:W({label:B().nullable()}),hasChildren:!1,description:`Visual divider`},Empty:{props:W({title:B(),description:B().nullable(),action:B().nullable(),actionLabel:B().nullable()}),hasChildren:!1,description:`Empty state placeholder`},LogTimeline:{props:W({height:V().nullable()}),hasChildren:!1,description:`Log timeline with virtual scroll, severity filtering, detail pane`,acceptsDataFrom:[`searchLogsPage`,`query`]},TraceDetail:{props:W({height:V().nullable()}),hasChildren:!1,description:`Trace detail with traceId input field and waterfall timeline`,acceptsDataFrom:[`searchTracesPage`,`searchTraceSummariesPage`,`query`]},MetricTimeSeries:{props:W({height:V().nullable(),showBrush:Hs().nullable(),yAxisLabel:B().nullable(),unit:B().nullable()}),hasChildren:!1,description:`Time series line chart for Gauge/Sum metrics`,acceptsDataFrom:[`searchMetricsPage`,`query`]},MetricHistogram:{props:W({height:V().nullable(),yAxisLabel:B().nullable(),unit:B().nullable()}),hasChildren:!1,description:`Histogram bar chart for distribution metrics`,acceptsDataFrom:[`searchMetricsPage`,`query`]},MetricStat:{props:W({label:B().nullable(),showSparkline:Hs().nullable()}),hasChildren:!1,description:`Single metric KPI card with sparkline and threshold coloring`,acceptsDataFrom:[`searchMetricsPage`,`searchAggregatedMetrics`,`query`]},MetricTable:{props:W({maxRows:V().nullable()}),hasChildren:!1,description:`Tabular display of metric data points`,acceptsDataFrom:[`searchMetricsPage`,`query`]},AggregateTable:{props:W({maxRows:V().int().positive().nullable(),units:oc(B(),B()).nullable(),labels:oc(B(),B()).nullable()}),hasChildren:!1,description:'Tabular display of aggregate query results — dimension and measure columns from a `query` dataSource in aggregate mode (e.g. top spans by AVG(Duration), request counts grouped by StatusCode). Columns are derived from the result rows, so it renders any signal\'s aggregate output. `units` maps a column name to its OTel unit so the cell renders in human terms — e.g. {"avg_duration_ns": "ns"} shows 23070000 as "23.07 ms". Understood units: ns/us/ms/s (duration ladder) and By (binary byte ladder); unmapped columns keep generic SI scaling. Headers are humanised automatically — snake_case, dotted and PascalCase names become Title Case ("span_count" -> "Span Count"), and a trailing unit token is dropped when that column is unit-annotated ("avg_duration_ns" + "ns" -> "Avg Duration") since the unit already shows in the cell. `labels` overrides the header for any column, which is the escape hatch when humanising mangles a name — e.g. {"SpanAttributes.http.route": "Route"}.',acceptsDataFrom:[`query`]},MetricDiscovery:{props:W({}),hasChildren:!1,description:`Table of discovered metric names, types, units and descriptions`,acceptsDataFrom:[`discoverMetrics`]}}}),$p=(0,v.createContext)(null),em=new Pp({defaultOptions:{queries:{staleTime:3e4,refetchOnWindowFocus:!1,retry:!1}}});function tm({client:e,children:t}){return(0,Y.jsx)(Of,{client:em,children:(0,Y.jsx)($p.Provider,{value:{client:e},children:t})})}function nm(){let e=(0,v.useContext)($p);if(!e)throw Error(`useKopaiSDK must be used within KopaiSDKProvider`);return e.client}function rm(e,t,n){switch(t.method){case`searchTracesPage`:return e.searchTracesPage(t.params,{signal:n});case`searchLogsPage`:return e.searchLogsPage(t.params,{signal:n});case`searchMetricsPage`:return e.searchMetricsPage(t.params,{signal:n});case`searchAggregatedMetrics`:return e.searchAggregatedMetrics(t.params,{signal:n});case`getTrace`:return e.getTrace(t.params.traceId,{signal:n});case`discoverMetrics`:return e.discoverMetrics({signal:n});case`getServices`:return e.getServices({signal:n});case`getOperations`:return e.getOperations(t.params.serviceName,{signal:n});case`searchTraceSummariesPage`:return e.searchTraceSummariesPage(t.params,{signal:n});case`query`:return e.query(t.params,{signal:n});default:throw Error(`Unknown method: ${t.method}`)}}function im(e){let t=nm(),{data:n,isFetching:r,error:i,refetch:a}=qp({queryKey:[`kopai`,e?.method,e?.params],queryFn:({signal:n})=>rm(t,e,n),enabled:!!e,refetchInterval:e?.refetchIntervalMs});return{data:n??null,loading:r,error:i??null,refetch:a}}function am(e,t){let n=Object.fromEntries(Object.entries(e.components).map(([e,t])=>[e,t.acceptsDataFrom]));return function({tree:e,fallback:r}){return(0,Y.jsx)(cm,{tree:e,registry:t,fallback:r,acceptsDataFromByType:n})}}function om({element:e,Component:t,acceptsDataFromByType:n,children:r}){let[i,a]=(0,v.useState)({}),o=n?.[e.type],s=!e.dataSource||n===void 0||(o?.includes(e.dataSource.method)??!1),{data:c,loading:l,error:u,refetch:d}=im((0,v.useMemo)(()=>{if(e.dataSource&&s)return{...e.dataSource,params:{...e.dataSource.params,...i}}},[e.dataSource,i,s]));if(!s&&e.dataSource){let t=o?.length?o.join(`, `):`none`;return console.error(`[ui-core] Component "${e.type}" does not accept dataSource method "${e.dataSource.method}". Accepted methods: ${t}.`),null}let f=(0,v.useCallback)(e=>{a(t=>({...t,...e}))},[]);return(0,Y.jsx)(t,{element:e,hasData:!0,response:c,loading:l,error:u,refetch:d,updateParams:f,children:r})}function sm({element:e,tree:t,registry:n,fallback:r,acceptsDataFromByType:i}){let a=n[e.type]??r;if(!a)return console.warn(`No renderer for component type: ${e.type}`),null;let o=e.children?.map(e=>{let a=t.elements[e];return a?(0,Y.jsx)(sm,{element:a,tree:t,registry:n,fallback:r,acceptsDataFromByType:i},e):null});return e.dataSource?(0,Y.jsx)(om,{element:e,Component:a,acceptsDataFromByType:i,children:o}):(0,Y.jsx)(a,{element:e,hasData:!1,children:o})}function cm({tree:e,registry:t,fallback:n,acceptsDataFromByType:r}){if(!e||!e.root)return null;let i=e.elements[e.root];return i?(0,Y.jsx)(sm,{element:i,tree:e,registry:t,fallback:n,acceptsDataFromByType:r}):null}function lm(e){let t=e.Body??``,n=0;for(let e=0;e<t.length;e++)n=(n<<5)-n+t.charCodeAt(e),n&=n;return`${e.Timestamp}-${e.ServiceName??``}-${Math.abs(n).toString(36)}`}var um=class{maxSize;rows=[];keys=new Set;constructor(e=1e3){this.maxSize=e}merge(e){for(let t of e){let e=lm(t);this.keys.has(e)||(this.keys.add(e),this.rows.push(t))}if(this.rows.sort((e,t)=>e.Timestamp<t.Timestamp?-1:+(e.Timestamp>t.Timestamp)),this.rows.length>this.maxSize){let e=this.rows.splice(0,this.rows.length-this.maxSize);for(let t of e)this.keys.delete(lm(t))}}getAll(){return this.rows.slice()}getNewestTimestamp(){if(this.rows.length!==0)return this.rows[this.rows.length-1].Timestamp}get size(){return this.rows.length}clear(){this.rows=[],this.keys.clear()}};function dm({params:e,pollIntervalMs:t=3e3,maxLogs:n=1e3,enabled:r=!0}){let i=nm(),a=(0,v.useRef)(new um(n)),[o,s]=(0,v.useState)(0),[c,l]=(0,v.useState)(!0),u=(0,v.useRef)(0),d=(0,v.useRef)(!1),f=JSON.stringify(e),p=(0,v.useRef)(f);(0,v.useEffect)(()=>{p.current!==f&&(p.current=f,a.current.clear(),d.current=!1,u.current=0,s(e=>e+1))},[f]);let{isFetching:m,error:h,refetch:g}=qp({queryKey:[`live-logs`,e],queryFn:async({signal:t})=>{let n={...e};if(p.current!==JSON.stringify(e)&&(d.current=!1),d.current){let e=a.current.getNewestTimestamp();e&&(n.timestampMin=String(BigInt(e)+1n))}let r=await i.searchLogsPage(n,{signal:t});return d.current=!0,r.data.length>0&&(u.current+=r.data.length,a.current.merge(r.data),s(e=>e+1)),r},enabled:r,refetchInterval:c?t:!1}),_=(0,v.useCallback)(e=>{l(e),e&&g()},[g]);return{logs:a.current.getAll(),isLive:c,totalReceived:u.current,loading:m,error:h??null,setLive:_}}var fm=class extends Error{code;status;type;detail;constructor(e){super(e.message),this.name=`KopaiError`,this.code=e.code,this.status=e.status,this.type=e.type,this.detail=e.detail}},pm=class extends Error{cause;constructor(e,t){super(e),this.name=`KopaiNetworkError`,this.cause=t}},mm=class extends Error{timeout;constructor(e){super(`Request timed out after ${e}ms`),this.name=`KopaiTimeoutError`,this.timeout=e}},hm=class extends Error{zodError;constructor(e){super(`Response validation failed: ${e.message}`),this.name=`KopaiValidationError`,this.zodError=e}},gm=3e4;async function _m(e,t,n){let{method:r=`GET`,body:i,headers:a={},baseHeaders:o={},signal:s,timeout:c,fetchFn:l,defaultTimeout:u}=n,d=c??u??gm,f=new AbortController,p=setTimeout(()=>f.abort(),d),m=s?AbortSignal.any([s,f.signal]):f.signal;try{let n=await l(e,{method:r,headers:{"Content-Type":`application/json`,...o,...a},body:i?JSON.stringify(i):void 0,signal:m});clearTimeout(p),n.ok||await vm(n);let s=await n.json(),c=t.safeParse(s);if(!c.success)throw new hm(c.error);return c.data}catch(e){throw clearTimeout(p),e instanceof fm||e instanceof hm||e instanceof mm||e instanceof pm?e:e instanceof DOMException&&e.name===`AbortError`?f.signal.aborted?new mm(d):e:e instanceof TypeError?new pm(e.message||`Network request failed`,e):e}}async function vm(e){let t;try{t=await e.json()}catch{t=null}if(t&&typeof t==`object`){let n=t,r=n.detail,i=n.title||n.message||`HTTP ${e.status}`;throw new fm({message:r?`${i}: ${r}`:i,code:n.code||`HTTP_${e.status}`,status:e.status,type:n.type||`about:blank`,detail:r})}throw new fm({message:`HTTP ${e.status}`,code:`HTTP_${e.status}`,status:e.status,type:`about:blank`})}async function*ym(e,t){let n;do{t?.throwIfAborted();let r=await e(n,t);for(let e of r.data)yield e;n=r.nextCursor??void 0}while(n)}var bm=3e4,xm=W({data:U(Ic.otelTracesSchema),nextCursor:B().nullable()}),Sm=W({data:U(Ic.otelLogsSchema),nextCursor:B().nullable()}),Cm=W({data:U(Ic.otelMetricsSchema),nextCursor:B().nullable()}),wm=W({data:U(Ic.aggregatedMetricSchema),nextCursor:Gs()}),Tm=W({data:U(oc(B(),G([B(),V(),Gs()])))}),Em=Kl.dashboardSchema,Dm=W({data:U(Kl.dashboardSchema),nextCursor:B().nullable()}),Om=W({services:U(B())}),km=W({operations:U(B())}),Am=W({data:U(Rl.traceSummaryRowSchema),nextCursor:B().nullable()}),jm=W({metrics:U(W({name:B(),type:K([`Gauge`,`Sum`,`Histogram`,`ExponentialHistogram`,`Summary`]),unit:B().optional(),description:B().optional(),attributes:W({values:oc(B(),U(B())),_truncated:Hs().optional()}),resourceAttributes:W({values:oc(B(),U(B())),_truncated:Hs().optional()})}))}),Mm=class{baseUrl;fetchFn;defaultTimeout;baseHeaders;constructor(e){this.baseUrl=e.baseUrl.replace(/\/$/,``),this.fetchFn=e.fetch??fetch,this.defaultTimeout=e.timeout??bm,this.baseHeaders={...e.headers},e.token&&(this.baseHeaders.Authorization=`Bearer ${e.token}`)}async getTrace(e,t){let n=U(Ic.otelTracesSchema);return _m(`${this.baseUrl}/signals/traces/${e}`,n,{method:`GET`,...t,baseHeaders:this.baseHeaders,fetchFn:this.fetchFn,defaultTimeout:this.defaultTimeout})}searchTraces(e,t){return ym((n,r)=>this.searchTracesPage({...e,cursor:n},{...t,signal:r}),t?.signal)}async searchTracesPage(e,t){let n=Rl.tracesDataFilterSchema.parse(e);return _m(`${this.baseUrl}/signals/traces/search`,xm,{method:`POST`,body:n,...t,baseHeaders:this.baseHeaders,fetchFn:this.fetchFn,defaultTimeout:this.defaultTimeout})}searchLogs(e,t){return ym((n,r)=>this.searchLogsPage({...e,cursor:n},{...t,signal:r}),t?.signal)}async searchLogsPage(e,t){let n=Rl.logsDataFilterSchema.parse(e);return _m(`${this.baseUrl}/signals/logs/search`,Sm,{method:`POST`,body:n,...t,baseHeaders:this.baseHeaders,fetchFn:this.fetchFn,defaultTimeout:this.defaultTimeout})}searchMetrics(e,t){return ym((n,r)=>this.searchMetricsPage({...e,cursor:n},{...t,signal:r}),t?.signal)}async searchMetricsPage(e,t){let n=Rl.metricsDataFilterSchema.parse(e);return _m(`${this.baseUrl}/signals/metrics/search`,Cm,{method:`POST`,body:n,...t,baseHeaders:this.baseHeaders,fetchFn:this.fetchFn,defaultTimeout:this.defaultTimeout})}async searchAggregatedMetrics(e,t){let n=Rl.metricsDataFilterSchema.parse(e);return _m(`${this.baseUrl}/signals/metrics/search`,wm,{method:`POST`,body:n,...t,baseHeaders:this.baseHeaders,fetchFn:this.fetchFn,defaultTimeout:this.defaultTimeout})}async discoverMetrics(e){return _m(`${this.baseUrl}/signals/metrics/discover`,jm,{method:`GET`,...e,baseHeaders:this.baseHeaders,fetchFn:this.fetchFn,defaultTimeout:this.defaultTimeout})}async getDashboard(e,t){return _m(`${this.baseUrl}/dashboards/${e}`,Em,{method:`GET`,...t,baseHeaders:this.baseHeaders,fetchFn:this.fetchFn,defaultTimeout:this.defaultTimeout})}async searchDashboardsPage(e,t){let n=Kl.searchDashboardsFilter.parse(e);return _m(`${this.baseUrl}/dashboards/search`,Dm,{method:`POST`,body:n,...t,baseHeaders:this.baseHeaders,fetchFn:this.fetchFn,defaultTimeout:this.defaultTimeout})}searchDashboards(e,t){return ym((n,r)=>this.searchDashboardsPage({...e,cursor:n},{...t,signal:r}),t?.signal)}async createDashboard(e,t){return _m(`${this.baseUrl}/dashboards`,Em,{method:`POST`,body:e,...t,baseHeaders:this.baseHeaders,fetchFn:this.fetchFn,defaultTimeout:this.defaultTimeout})}async getServices(e){return _m(`${this.baseUrl}/signals/services`,Om,{method:`GET`,...e,baseHeaders:this.baseHeaders,fetchFn:this.fetchFn,defaultTimeout:this.defaultTimeout})}async getOperations(e,t){let n=new URLSearchParams({serviceName:e});return _m(`${this.baseUrl}/signals/traces/operations?${n}`,km,{method:`GET`,...t,baseHeaders:this.baseHeaders,fetchFn:this.fetchFn,defaultTimeout:this.defaultTimeout})}async searchTraceSummariesPage(e,t){let n=Rl.traceSummariesFilterSchema.parse(e);return _m(`${this.baseUrl}/signals/traces/summaries`,Am,{method:`POST`,body:n,...t,baseHeaders:this.baseHeaders,fetchFn:this.fetchFn,defaultTimeout:this.defaultTimeout})}async queryTracesRaw(e,t){let n=Ql.TraceRawQuerySchema.parse(e);return Ld.validateKopaiQuery(n),_m(`${this.baseUrl}/signals/query/traces/raw`,xm,{method:`POST`,body:n,...t,baseHeaders:this.baseHeaders,fetchFn:this.fetchFn,defaultTimeout:this.defaultTimeout})}async queryTracesAggregate(e,t){let n=Ql.TraceAggregateQuerySchema.parse(e);return Ld.validateKopaiQuery(n),await _m(`${this.baseUrl}/signals/query/traces/aggregate`,Tm,{method:`POST`,body:n,...t,baseHeaders:this.baseHeaders,fetchFn:this.fetchFn,defaultTimeout:this.defaultTimeout})}async queryLogsRaw(e,t){let n=Ql.LogRawQuerySchema.parse(e);return Ld.validateKopaiQuery(n),_m(`${this.baseUrl}/signals/query/logs/raw`,Sm,{method:`POST`,body:n,...t,baseHeaders:this.baseHeaders,fetchFn:this.fetchFn,defaultTimeout:this.defaultTimeout})}async queryLogsAggregate(e,t){let n=Ql.LogAggregateQuerySchema.parse(e);return Ld.validateKopaiQuery(n),await _m(`${this.baseUrl}/signals/query/logs/aggregate`,Tm,{method:`POST`,body:n,...t,baseHeaders:this.baseHeaders,fetchFn:this.fetchFn,defaultTimeout:this.defaultTimeout})}async queryMetricsRaw(e,t){let n=Ql.MetricRawQuerySchema.parse(e);return Ld.validateKopaiQuery(n),_m(`${this.baseUrl}/signals/query/metrics/raw`,Cm,{method:`POST`,body:n,...t,baseHeaders:this.baseHeaders,fetchFn:this.fetchFn,defaultTimeout:this.defaultTimeout})}async queryMetricsAggregate(e,t){let n=Ql.MetricAggregateQuerySchema.parse(e);return Ld.validateKopaiQuery(n),await _m(`${this.baseUrl}/signals/query/metrics/aggregate`,Tm,{method:`POST`,body:n,...t,baseHeaders:this.baseHeaders,fetchFn:this.fetchFn,defaultTimeout:this.defaultTimeout})}async query(e,t){let n;return n=e.signal===`traces`&&e.mode===`raw`?await this.queryTracesRaw(e,t):e.signal===`traces`?await this.queryTracesAggregate(e,t):e.signal===`logs`&&e.mode===`raw`?await this.queryLogsRaw(e,t):e.signal===`logs`?await this.queryLogsAggregate(e,t):e.mode===`raw`?await this.queryMetricsRaw(e,t):await this.queryMetricsAggregate(e,t),n}};new Set(Ql.TraceColumn.options),new Set(Ql.LogColumn.options),new Set(Ql.MetricColumn.options);function Nm(e){var t,n,r=``;if(typeof e==`string`||typeof e==`number`)r+=e;else if(typeof e==`object`){if(Array.isArray(e)){var i=e.length;for(t=0;t<i;t++)e[t]&&(n=Nm(e[t]))&&(r&&(r+=` `),r+=n)}else for(n in e)e[n]&&(r&&(r+=` `),r+=n)}return r}function Pm(){for(var e,t,n=0,r=``,i=arguments.length;n<i;n++)(e=arguments[n])&&(t=Nm(e))&&(r&&(r+=` `),r+=t);return r}var Fm=`dangerouslySetInnerHTML.onCopy.onCopyCapture.onCut.onCutCapture.onPaste.onPasteCapture.onCompositionEnd.onCompositionEndCapture.onCompositionStart.onCompositionStartCapture.onCompositionUpdate.onCompositionUpdateCapture.onFocus.onFocusCapture.onBlur.onBlurCapture.onChange.onChangeCapture.onBeforeInput.onBeforeInputCapture.onInput.onInputCapture.onReset.onResetCapture.onSubmit.onSubmitCapture.onInvalid.onInvalidCapture.onLoad.onLoadCapture.onError.onErrorCapture.onKeyDown.onKeyDownCapture.onKeyPress.onKeyPressCapture.onKeyUp.onKeyUpCapture.onAbort.onAbortCapture.onCanPlay.onCanPlayCapture.onCanPlayThrough.onCanPlayThroughCapture.onDurationChange.onDurationChangeCapture.onEmptied.onEmptiedCapture.onEncrypted.onEncryptedCapture.onEnded.onEndedCapture.onLoadedData.onLoadedDataCapture.onLoadedMetadata.onLoadedMetadataCapture.onLoadStart.onLoadStartCapture.onPause.onPauseCapture.onPlay.onPlayCapture.onPlaying.onPlayingCapture.onProgress.onProgressCapture.onRateChange.onRateChangeCapture.onSeeked.onSeekedCapture.onSeeking.onSeekingCapture.onStalled.onStalledCapture.onSuspend.onSuspendCapture.onTimeUpdate.onTimeUpdateCapture.onVolumeChange.onVolumeChangeCapture.onWaiting.onWaitingCapture.onAuxClick.onAuxClickCapture.onClick.onClickCapture.onContextMenu.onContextMenuCapture.onDoubleClick.onDoubleClickCapture.onDrag.onDragCapture.onDragEnd.onDragEndCapture.onDragEnter.onDragEnterCapture.onDragExit.onDragExitCapture.onDragLeave.onDragLeaveCapture.onDragOver.onDragOverCapture.onDragStart.onDragStartCapture.onDrop.onDropCapture.onMouseDown.onMouseDownCapture.onMouseEnter.onMouseLeave.onMouseMove.onMouseMoveCapture.onMouseOut.onMouseOutCapture.onMouseOver.onMouseOverCapture.onMouseUp.onMouseUpCapture.onSelect.onSelectCapture.onTouchCancel.onTouchCancelCapture.onTouchEnd.onTouchEndCapture.onTouchMove.onTouchMoveCapture.onTouchStart.onTouchStartCapture.onPointerDown.onPointerDownCapture.onPointerMove.onPointerMoveCapture.onPointerUp.onPointerUpCapture.onPointerCancel.onPointerCancelCapture.onPointerEnter.onPointerEnterCapture.onPointerLeave.onPointerLeaveCapture.onPointerOver.onPointerOverCapture.onPointerOut.onPointerOutCapture.onGotPointerCapture.onGotPointerCaptureCapture.onLostPointerCapture.onLostPointerCaptureCapture.onScroll.onScrollCapture.onWheel.onWheelCapture.onAnimationStart.onAnimationStartCapture.onAnimationEnd.onAnimationEndCapture.onAnimationIteration.onAnimationIterationCapture.onTransitionEnd.onTransitionEndCapture`.split(`.`);function Im(e){return typeof e==`string`&&Fm.includes(e)}var Lm=new Set(`aria-activedescendant.aria-atomic.aria-autocomplete.aria-busy.aria-checked.aria-colcount.aria-colindex.aria-colspan.aria-controls.aria-current.aria-describedby.aria-details.aria-disabled.aria-errormessage.aria-expanded.aria-flowto.aria-haspopup.aria-hidden.aria-invalid.aria-keyshortcuts.aria-label.aria-labelledby.aria-level.aria-live.aria-modal.aria-multiline.aria-multiselectable.aria-orientation.aria-owns.aria-placeholder.aria-posinset.aria-pressed.aria-readonly.aria-relevant.aria-required.aria-roledescription.aria-rowcount.aria-rowindex.aria-rowspan.aria-selected.aria-setsize.aria-sort.aria-valuemax.aria-valuemin.aria-valuenow.aria-valuetext.className.color.height.id.lang.max.media.method.min.name.style.target.width.role.tabIndex.accentHeight.accumulate.additive.alignmentBaseline.allowReorder.alphabetic.amplitude.arabicForm.ascent.attributeName.attributeType.autoReverse.azimuth.baseFrequency.baselineShift.baseProfile.bbox.begin.bias.by.calcMode.capHeight.clip.clipPath.clipPathUnits.clipRule.colorInterpolation.colorInterpolationFilters.colorProfile.colorRendering.contentScriptType.contentStyleType.cursor.cx.cy.d.decelerate.descent.diffuseConstant.direction.display.divisor.dominantBaseline.dur.dx.dy.edgeMode.elevation.enableBackground.end.exponent.externalResourcesRequired.fill.fillOpacity.fillRule.filter.filterRes.filterUnits.floodColor.floodOpacity.focusable.fontFamily.fontSize.fontSizeAdjust.fontStretch.fontStyle.fontVariant.fontWeight.format.from.fx.fy.g1.g2.glyphName.glyphOrientationHorizontal.glyphOrientationVertical.glyphRef.gradientTransform.gradientUnits.hanging.horizAdvX.horizOriginX.href.ideographic.imageRendering.in2.in.intercept.k1.k2.k3.k4.k.kernelMatrix.kernelUnitLength.kerning.keyPoints.keySplines.keyTimes.lengthAdjust.letterSpacing.lightingColor.limitingConeAngle.local.markerEnd.markerHeight.markerMid.markerStart.markerUnits.markerWidth.mask.maskContentUnits.maskUnits.mathematical.mode.numOctaves.offset.opacity.operator.order.orient.orientation.origin.overflow.overlinePosition.overlineThickness.paintOrder.panose1.pathLength.patternContentUnits.patternTransform.patternUnits.pointerEvents.pointsAtX.pointsAtY.pointsAtZ.preserveAlpha.preserveAspectRatio.primitiveUnits.r.radius.refX.refY.renderingIntent.repeatCount.repeatDur.requiredExtensions.requiredFeatures.restart.result.rotate.rx.ry.seed.shapeRendering.slope.spacing.specularConstant.specularExponent.speed.spreadMethod.startOffset.stdDeviation.stemh.stemv.stitchTiles.stopColor.stopOpacity.strikethroughPosition.strikethroughThickness.string.stroke.strokeDasharray.strokeDashoffset.strokeLinecap.strokeLinejoin.strokeMiterlimit.strokeOpacity.strokeWidth.surfaceScale.systemLanguage.tableValues.targetX.targetY.textAnchor.textDecoration.textLength.textRendering.to.transform.u1.u2.underlinePosition.underlineThickness.unicode.unicodeBidi.unicodeRange.unitsPerEm.vAlphabetic.values.vectorEffect.version.vertAdvY.vertOriginX.vertOriginY.vHanging.vIdeographic.viewTarget.visibility.vMathematical.widths.wordSpacing.writingMode.x1.x2.x.xChannelSelector.xHeight.xlinkActuate.xlinkArcrole.xlinkHref.xlinkRole.xlinkShow.xlinkTitle.xlinkType.xmlBase.xmlLang.xmlns.xmlnsXlink.xmlSpace.y1.y2.y.yChannelSelector.z.zoomAndPan.ref.key.angle`.split(`.`));function Rm(e){return typeof e==`string`&&Lm.has(e)}function zm(e){return typeof e==`string`&&e.startsWith(`data-`)}function Bm(e){if(typeof e!=`object`||!e)return{};var t={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(Rm(n)||zm(n))&&(t[n]=e[n]);return t}function Vm(e){if(e==null)return null;if((0,v.isValidElement)(e)&&typeof e.props==`object`&&e.props!==null){var t=e.props;return Bm(t)}return typeof e==`object`&&!Array.isArray(e)?Bm(e):null}function Hm(e){var t={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(Rm(n)||zm(n)||Im(n))&&(t[n]=e[n]);return t}function Um(e){return e==null?null:(0,v.isValidElement)(e)?Hm(e.props):typeof e==`object`&&!Array.isArray(e)?Hm(e):null}var Wm=[`children`,`width`,`height`,`viewBox`,`className`,`style`,`title`,`desc`];function Gm(){return Gm=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Gm.apply(null,arguments)}function Km(e,t){if(e==null)return{};var n,r,i=qm(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)===-1&&{}.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}function qm(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}var Jm=(0,v.forwardRef)((e,t)=>{var n=e.children,r=e.width,i=e.height,a=e.viewBox,o=e.className,s=e.style,c=e.title,l=e.desc,u=Km(e,Wm),d=a||{width:r,height:i,x:0,y:0},f=Pm(`recharts-surface`,o);return v.createElement(`svg`,Gm({},Hm(u),{className:f,width:r,height:i,style:s,viewBox:`${d.x} ${d.y} ${d.width} ${d.height}`,ref:t}),v.createElement(`title`,null,c),v.createElement(`desc`,null,l),n)}),Ym=[`children`,`className`];function Xm(){return Xm=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Xm.apply(null,arguments)}function Zm(e,t){if(e==null)return{};var n,r,i=Qm(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)===-1&&{}.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}function Qm(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}var $m=v.forwardRef((e,t)=>{var n=e.children,r=e.className,i=Zm(e,Ym),a=Pm(`recharts-layer`,r);return v.createElement(`g`,Xm({className:a},Hm(i),{ref:t}),n)});function eh(e){return e===`__proto__`}var th=/\.|(\[(?:[^[\]]*|(["'])(?:(?!\2)[^\\]|\\.)*?\2)\])/;function nh(e){switch(typeof e){case`number`:case`symbol`:return!1;case`string`:return e===``||e.startsWith(`.`)||e.endsWith(`.`)?!1:th.test(e);default:return!1}}function rh(e){return typeof e==`string`||typeof e==`symbol`?e:Object.is(e?.valueOf?.(),-0)?`-0`:String(e)}function ih(e){return typeof e==`symbol`||e instanceof Symbol}function ah(e){return e==null?``:oh(e)}function oh(e){if(typeof e==`string`)return e;if(Array.isArray(e))return e.map(oh).join(`,`);if(ih(e))return e.toString();let t=e+``;return t===`0`&&Object.is(Number(e),-0)?`-0`:t}function sh(e){if(Array.isArray(e))return e.map(rh);if(typeof e==`symbol`)return[e];e=ah(e);let t=[],n=e.length;if(n===0)return t;let r=0,i=``,a=``,o=!1,s=!1,c=/^-?\d+(?:\.\d+)?$/;for(e.charCodeAt(0)===46&&t.push(``);r<n;){let l=e[r];if(a)l===`\\`&&r+1<n?(r++,i+=e[r]):l===a?a=``:i+=l;else if(o){if(l===`"`||l===`'`)a=l,s=!0;else if(l===`]`){if(o=!1,!s&&i.includes(`.`)&&!c.test(i)){let e=i.split(`.`);for(let n=0;n<e.length;n++)e[n]!==``&&t.push(e[n])}else t.push(i);i=``}else i+=l}else if(l===`[`)o=!0,s=!1,i&&=(t.push(i),``);else if(l===`.`){i&&=(t.push(i),``);let n=e[r+1];(n===void 0||n===`.`)&&t.push(``)}else i+=l;r++}return i&&t.push(i),t}function ch(e,t,n){if(e==null)return n;switch(typeof t){case`string`:{if(eh(t))return n;let r=e[t];return r===void 0?nh(t)&&!Object.hasOwn(e,t)?ch(e,sh(t),n):n:r}case`number`:case`symbol`:{typeof t==`number`&&(t=rh(t));let r=e[t];return r===void 0?n:r}default:{if(Array.isArray(t))return lh(e,t,n);if(t=Object.is(t?.valueOf(),-0)?`-0`:String(t),eh(t))return n;let r=e[t];return r===void 0?n:r}}}function lh(e,t,n){if(t.length===0)return n;let r=e;for(let e=0;e<t.length;e++){if(r==null||eh(t[e]))return n;r=r[t[e]]}return r===void 0?n:r}var uh=4;function dh(e){var t=10**(arguments.length>1&&arguments[1]!==void 0?arguments[1]:uh),n=Math.round(e*t)/t;return Object.is(n,-0)?0:n}function fh(e){var t=[...arguments].slice(1);return e.reduce((e,n,r)=>{var i=t[r-1];return typeof i==`string`?e+i+n:i===void 0?e+n:e+dh(i)+n},``)}var ph=e=>e===0?0:e>0?1:-1,mh=e=>typeof e==`number`&&e!=+e,hh=e=>typeof e==`string`&&e.length>1&&e.indexOf(`%`)===e.length-1,X=e=>(typeof e==`number`||e instanceof Number)&&!mh(e),gh=e=>X(e)||typeof e==`string`,_h=0,vh=e=>{var t=++_h;return`${e||``}${t}`},yh=function(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,r=arguments.length>3&&arguments[3]!==void 0&&arguments[3];if(!X(e)&&typeof e!=`string`)return n;var i;if(hh(e)){if(t==null)return n;var a=e.indexOf(`%`);i=t*parseFloat(e.slice(0,a))/100}else i=+e;return mh(i)&&(i=n),r&&t!=null&&i>t&&(i=t),i},bh=e=>{if(!Array.isArray(e))return!1;for(var t=e.length,n={},r=0;r<t;r++)if(!n[String(e[r])])n[String(e[r])]=!0;else return!0;return!1};function xh(e,t,n){return X(e)&&X(t)?dh(e+n*(t-e)):t}function Sh(e,t,n){if(e&&e.length)return e.find(e=>e&&(typeof t==`function`?t(e):ch(e,t))===n)}var Ch=e=>{for(var t=e.length,n=0,r=0,i=0,a=0,o=1/0,s=-1/0,c=0,l=0,u=0;u<t;u++)c=e[u]?.cx||0,l=e[u]?.cy||0,n+=c,r+=l,i+=c*l,a+=c*c,o=Math.min(o,c),s=Math.max(s,c);var d=t*a===n*n?0:(t*i-n*r)/(t*a-n*n);return{xmin:o,xmax:s,a:d,b:(r-d*n)/t}},wh=e=>e==null,Th=e=>wh(e)?e:`${e.charAt(0).toUpperCase()}${e.slice(1)}`;function Eh(e){return e!=null}function Dh(){}function Oh(e){if(e)return{x:e.x,y:e.y,upperWidth:`upperWidth`in e?e.upperWidth:e.width,lowerWidth:`lowerWidth`in e?e.lowerWidth:e.width,width:e.width,height:e.height}}function kh(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Ah(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?kh(Object(n),!0).forEach(function(t){jh(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):kh(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function jh(e,t,n){return(t=Mh(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Mh(e){var t=Nh(e,`string`);return typeof t==`symbol`?t:t+``}function Nh(e,t){if(typeof e!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(typeof r!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}var Ph=e=>{var t=e.viewBox,n=e.position,r=e.offset,i=r===void 0?0:r,a=e.parentViewBox,o=e.clamp,s=Oh(t),c=s.x,l=s.y,u=s.height,d=s.upperWidth,f=s.lowerWidth,p=c,m=c+(d-f)/2,h=(p+m)/2,g=(d+f)/2,_=p+d/2,v=u>=0?1:-1,y=v*i,b=v>0?`end`:`start`,x=v>0?`start`:`end`,S=d>=0?1:-1,C=S*i,w=S>0?`end`:`start`,T=S>0?`start`:`end`,E=a;if(n===`top`){var D={x:p+d/2,y:l-y,horizontalAnchor:`middle`,verticalAnchor:b};return o&&E&&(D.height=Math.max(l-E.y,0),D.width=d),D}if(n===`bottom`){var O={x:m+f/2,y:l+u+y,horizontalAnchor:`middle`,verticalAnchor:x};return o&&E&&(O.height=Math.max(E.y+E.height-(l+u),0),O.width=f),O}if(n===`left`){var k={x:h-C,y:l+u/2,horizontalAnchor:w,verticalAnchor:`middle`};return o&&E&&(k.width=Math.max(k.x-E.x,0),k.height=u),k}if(n===`right`){var A={x:h+g+C,y:l+u/2,horizontalAnchor:T,verticalAnchor:`middle`};return o&&E&&(A.width=Math.max(E.x+E.width-A.x,0),A.height=u),A}var j=o&&E?{width:g,height:u}:{};return n===`insideLeft`?Ah({x:h+C,y:l+u/2,horizontalAnchor:T,verticalAnchor:`middle`},j):n===`insideRight`?Ah({x:h+g-C,y:l+u/2,horizontalAnchor:w,verticalAnchor:`middle`},j):n===`insideTop`?Ah({x:p+d/2,y:l+y,horizontalAnchor:`middle`,verticalAnchor:x},j):n===`insideBottom`?Ah({x:m+f/2,y:l+u-y,horizontalAnchor:`middle`,verticalAnchor:b},j):n===`insideTopLeft`?Ah({x:p+C,y:l+y,horizontalAnchor:T,verticalAnchor:x},j):n===`insideTopRight`?Ah({x:p+d-C,y:l+y,horizontalAnchor:w,verticalAnchor:x},j):n===`insideBottomLeft`?Ah({x:m+C,y:l+u-y,horizontalAnchor:T,verticalAnchor:b},j):n===`insideBottomRight`?Ah({x:m+f-C,y:l+u-y,horizontalAnchor:w,verticalAnchor:b},j):n&&typeof n==`object`&&(X(n.x)||hh(n.x))&&(X(n.y)||hh(n.y))?Ah({x:c+yh(n.x,g),y:l+yh(n.y,u),horizontalAnchor:`end`,verticalAnchor:`end`},j):Ah({x:_,y:l+u/2,horizontalAnchor:`middle`,verticalAnchor:`middle`},j)},Fh=[`top`,`left`,`right`,`bottom`];function Ih(e){return e==null?!1:typeof e==`object`||Fh.includes(e)}var Lh=(0,v.createContext)(null),Rh=()=>(0,v.useContext)(Lh);function zh(e){return function(){return e}}var Bh=Math.cos,Vh=Math.sin,Hh=Math.sqrt,Uh=Math.PI;Uh/2;var Wh=2*Uh,Gh=Math.PI,Kh=2*Gh,qh=1e-6,Jh=Kh-qh;function Yh(e){this._+=e[0];for(let t=1,n=e.length;t<n;++t)this._+=arguments[t]+e[t]}function Xh(e){let t=Math.floor(e);if(!(t>=0))throw Error(`invalid digits: ${e}`);if(t>15)return Yh;let n=10**t;return function(e){this._+=e[0];for(let t=1,r=e.length;t<r;++t)this._+=Math.round(arguments[t]*n)/n+e[t]}}var Zh=class{constructor(e){this._x0=this._y0=this._x1=this._y1=null,this._=``,this._append=e==null?Yh:Xh(e)}moveTo(e,t){this._append`M${this._x0=this._x1=+e},${this._y0=this._y1=+t}`}closePath(){this._x1!==null&&(this._x1=this._x0,this._y1=this._y0,this._append`Z`)}lineTo(e,t){this._append`L${this._x1=+e},${this._y1=+t}`}quadraticCurveTo(e,t,n,r){this._append`Q${+e},${+t},${this._x1=+n},${this._y1=+r}`}bezierCurveTo(e,t,n,r,i,a){this._append`C${+e},${+t},${+n},${+r},${this._x1=+i},${this._y1=+a}`}arcTo(e,t,n,r,i){if(e=+e,t=+t,n=+n,r=+r,i=+i,i<0)throw Error(`negative radius: ${i}`);let a=this._x1,o=this._y1,s=n-e,c=r-t,l=a-e,u=o-t,d=l*l+u*u;if(this._x1===null)this._append`M${this._x1=e},${this._y1=t}`;else if(d>qh){if(!(Math.abs(u*s-c*l)>qh)||!i)this._append`L${this._x1=e},${this._y1=t}`;else{let f=n-a,p=r-o,m=s*s+c*c,h=f*f+p*p,g=Math.sqrt(m),_=Math.sqrt(d),v=i*Math.tan((Gh-Math.acos((m+d-h)/(2*g*_)))/2),y=v/_,b=v/g;Math.abs(y-1)>qh&&this._append`L${e+y*l},${t+y*u}`,this._append`A${i},${i},0,0,${+(u*f>l*p)},${this._x1=e+b*s},${this._y1=t+b*c}`}}}arc(e,t,n,r,i,a){if(e=+e,t=+t,n=+n,a=!!a,n<0)throw Error(`negative radius: ${n}`);let o=n*Math.cos(r),s=n*Math.sin(r),c=e+o,l=t+s,u=1^a,d=a?r-i:i-r;this._x1===null?this._append`M${c},${l}`:(Math.abs(this._x1-c)>qh||Math.abs(this._y1-l)>qh)&&this._append`L${c},${l}`,n&&(d<0&&(d=d%Kh+Kh),d>Jh?this._append`A${n},${n},0,1,${u},${e-o},${t-s}A${n},${n},0,1,${u},${this._x1=c},${this._y1=l}`:d>qh&&this._append`A${n},${n},0,${+(d>=Gh)},${u},${this._x1=e+n*Math.cos(i)},${this._y1=t+n*Math.sin(i)}`)}rect(e,t,n,r){this._append`M${this._x0=this._x1=+e},${this._y0=this._y1=+t}h${n=+n}v${+r}h${-n}Z`}toString(){return this._}};Zh.prototype;function Qh(e){let t=3;return e.digits=function(n){if(!arguments.length)return t;if(n==null)t=null;else{let e=Math.floor(n);if(!(e>=0))throw RangeError(`invalid digits: ${n}`);t=e}return e},()=>new Zh(t)}Array.prototype.slice;function $h(e){return typeof e==`object`&&`length`in e?e:Array.from(e)}function eg(e){this._context=e}eg.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:this._context.lineTo(e,t)}}};function tg(e){return new eg(e)}function ng(e){return e[0]}function rg(e){return e[1]}function ig(e,t){var n=zh(!0),r=null,i=tg,a=null,o=Qh(s);e=typeof e==`function`?e:e===void 0?ng:zh(e),t=typeof t==`function`?t:t===void 0?rg:zh(t);function s(s){var c,l=(s=$h(s)).length,u,d=!1,f;for(r??(a=i(f=o())),c=0;c<=l;++c)!(c<l&&n(u=s[c],c,s))===d&&((d=!d)?a.lineStart():a.lineEnd()),d&&a.point(+e(u,c,s),+t(u,c,s));if(f)return a=null,f+``||null}return s.x=function(t){return arguments.length?(e=typeof t==`function`?t:zh(+t),s):e},s.y=function(e){return arguments.length?(t=typeof e==`function`?e:zh(+e),s):t},s.defined=function(e){return arguments.length?(n=typeof e==`function`?e:zh(!!e),s):n},s.curve=function(e){return arguments.length?(i=e,r!=null&&(a=i(r)),s):i},s.context=function(e){return arguments.length?(e==null?r=a=null:a=i(r=e),s):r},s}function ag(e,t,n){var r=null,i=zh(!0),a=null,o=tg,s=null,c=Qh(l);e=typeof e==`function`?e:e===void 0?ng:zh(+e),t=typeof t==`function`?t:zh(t===void 0?0:+t),n=typeof n==`function`?n:n===void 0?rg:zh(+n);function l(l){var u,d,f,p=(l=$h(l)).length,m,h=!1,g,_=Array(p),v=Array(p);for(a??(s=o(g=c())),u=0;u<=p;++u){if(!(u<p&&i(m=l[u],u,l))===h){if(h=!h)d=u,s.areaStart(),s.lineStart();else{for(s.lineEnd(),s.lineStart(),f=u-1;f>=d;--f)s.point(_[f],v[f]);s.lineEnd(),s.areaEnd()}}h&&(_[u]=+e(m,u,l),v[u]=+t(m,u,l),s.point(r?+r(m,u,l):_[u],n?+n(m,u,l):v[u]))}if(g)return s=null,g+``||null}function u(){return ig().defined(i).curve(o).context(a)}return l.x=function(t){return arguments.length?(e=typeof t==`function`?t:zh(+t),r=null,l):e},l.x0=function(t){return arguments.length?(e=typeof t==`function`?t:zh(+t),l):e},l.x1=function(e){return arguments.length?(r=e==null?null:typeof e==`function`?e:zh(+e),l):r},l.y=function(e){return arguments.length?(t=typeof e==`function`?e:zh(+e),n=null,l):t},l.y0=function(e){return arguments.length?(t=typeof e==`function`?e:zh(+e),l):t},l.y1=function(e){return arguments.length?(n=e==null?null:typeof e==`function`?e:zh(+e),l):n},l.lineX0=l.lineY0=function(){return u().x(e).y(t)},l.lineY1=function(){return u().x(e).y(n)},l.lineX1=function(){return u().x(r).y(t)},l.defined=function(e){return arguments.length?(i=typeof e==`function`?e:zh(!!e),l):i},l.curve=function(e){return arguments.length?(o=e,a!=null&&(s=o(a)),l):o},l.context=function(e){return arguments.length?(e==null?a=s=null:s=o(a=e),l):a},l}var og=class{constructor(e,t){this._context=e,this._x=t}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._point=0}lineEnd(){(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line}point(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:this._x?this._context.bezierCurveTo(this._x0=(this._x0+e)/2,this._y0,this._x0,t,e,t):this._context.bezierCurveTo(this._x0,this._y0=(this._y0+t)/2,e,this._y0,e,t)}this._x0=e,this._y0=t}};function sg(e){return new og(e,!0)}function cg(e){return new og(e,!1)}var lg={draw(e,t){let n=Hh(t/Uh);e.moveTo(n,0),e.arc(0,0,n,0,Wh)}},ug={draw(e,t){let n=Hh(t/5)/2;e.moveTo(-3*n,-n),e.lineTo(-n,-n),e.lineTo(-n,-3*n),e.lineTo(n,-3*n),e.lineTo(n,-n),e.lineTo(3*n,-n),e.lineTo(3*n,n),e.lineTo(n,n),e.lineTo(n,3*n),e.lineTo(-n,3*n),e.lineTo(-n,n),e.lineTo(-3*n,n),e.closePath()}},dg=Hh(1/3),fg=dg*2,pg={draw(e,t){let n=Hh(t/fg),r=n*dg;e.moveTo(0,-n),e.lineTo(r,0),e.lineTo(0,n),e.lineTo(-r,0),e.closePath()}},mg={draw(e,t){let n=Hh(t),r=-n/2;e.rect(r,r,n,n)}},hg=.8908130915292852,gg=Vh(Uh/10)/Vh(7*Uh/10),_g=Vh(Wh/10)*gg,vg=-Bh(Wh/10)*gg,yg={draw(e,t){let n=Hh(t*hg),r=_g*n,i=vg*n;e.moveTo(0,-n),e.lineTo(r,i);for(let t=1;t<5;++t){let a=Wh*t/5,o=Bh(a),s=Vh(a);e.lineTo(s*n,-o*n),e.lineTo(o*r-s*i,s*r+o*i)}e.closePath()}},bg=Hh(3),xg={draw(e,t){let n=-Hh(t/(bg*3));e.moveTo(0,n*2),e.lineTo(-bg*n,-n),e.lineTo(bg*n,-n),e.closePath()}},Sg=-.5,Cg=Hh(3)/2,wg=1/Hh(12),Tg=(wg/2+1)*3,Eg={draw(e,t){let n=Hh(t/Tg),r=n/2,i=n*wg,a=r,o=n*wg+n,s=-a,c=o;e.moveTo(r,i),e.lineTo(a,o),e.lineTo(s,c),e.lineTo(Sg*r-Cg*i,Cg*r+Sg*i),e.lineTo(Sg*a-Cg*o,Cg*a+Sg*o),e.lineTo(Sg*s-Cg*c,Cg*s+Sg*c),e.lineTo(Sg*r+Cg*i,Sg*i-Cg*r),e.lineTo(Sg*a+Cg*o,Sg*o-Cg*a),e.lineTo(Sg*s+Cg*c,Sg*c-Cg*s),e.closePath()}};function Dg(e,t){let n=null,r=Qh(i);e=typeof e==`function`?e:zh(e||lg),t=typeof t==`function`?t:zh(t===void 0?64:+t);function i(){let i;if(n||=i=r(),e.apply(this,arguments).draw(n,+t.apply(this,arguments)),i)return n=null,i+``||null}return i.type=function(t){return arguments.length?(e=typeof t==`function`?t:zh(t),i):e},i.size=function(e){return arguments.length?(t=typeof e==`function`?e:zh(+e),i):t},i.context=function(e){return arguments.length?(n=e??null,i):n},i}function Og(){}function kg(e,t,n){e._context.bezierCurveTo((2*e._x0+e._x1)/3,(2*e._y0+e._y1)/3,(e._x0+2*e._x1)/3,(e._y0+2*e._y1)/3,(e._x0+4*e._x1+t)/6,(e._y0+4*e._y1+n)/6)}function Ag(e){this._context=e}Ag.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){switch(this._point){case 3:kg(this,this._x1,this._y1);case 2:this._context.lineTo(this._x1,this._y1)}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;break;case 2:this._point=3,this._context.lineTo((5*this._x0+this._x1)/6,(5*this._y0+this._y1)/6);default:kg(this,e,t)}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function jg(e){return new Ag(e)}function Mg(e){this._context=e}Mg.prototype={areaStart:Og,areaEnd:Og,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._y0=this._y1=this._y2=this._y3=this._y4=NaN,this._point=0},lineEnd:function(){switch(this._point){case 1:this._context.moveTo(this._x2,this._y2),this._context.closePath();break;case 2:this._context.moveTo((this._x2+2*this._x3)/3,(this._y2+2*this._y3)/3),this._context.lineTo((this._x3+2*this._x2)/3,(this._y3+2*this._y2)/3),this._context.closePath();break;case 3:this.point(this._x2,this._y2),this.point(this._x3,this._y3),this.point(this._x4,this._y4)}},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._x2=e,this._y2=t;break;case 1:this._point=2,this._x3=e,this._y3=t;break;case 2:this._point=3,this._x4=e,this._y4=t,this._context.moveTo((this._x0+4*this._x1+e)/6,(this._y0+4*this._y1+t)/6);break;default:kg(this,e,t)}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function Ng(e){return new Mg(e)}function Pg(e){this._context=e}Pg.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===3)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3;var n=(this._x0+4*this._x1+e)/6,r=(this._y0+4*this._y1+t)/6;this._line?this._context.lineTo(n,r):this._context.moveTo(n,r);break;case 3:this._point=4;default:kg(this,e,t)}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function Fg(e){return new Pg(e)}function Ig(e){this._context=e}Ig.prototype={areaStart:Og,areaEnd:Og,lineStart:function(){this._point=0},lineEnd:function(){this._point&&this._context.closePath()},point:function(e,t){e=+e,t=+t,this._point?this._context.lineTo(e,t):(this._point=1,this._context.moveTo(e,t))}};function Lg(e){return new Ig(e)}function Rg(e){return e<0?-1:1}function zg(e,t,n){var r=e._x1-e._x0,i=t-e._x1,a=(e._y1-e._y0)/(r||i<0&&-0),o=(n-e._y1)/(i||r<0&&-0),s=(a*i+o*r)/(r+i);return(Rg(a)+Rg(o))*Math.min(Math.abs(a),Math.abs(o),.5*Math.abs(s))||0}function Bg(e,t){var n=e._x1-e._x0;return n?(3*(e._y1-e._y0)/n-t)/2:t}function Vg(e,t,n){var r=e._x0,i=e._y0,a=e._x1,o=e._y1,s=(a-r)/3;e._context.bezierCurveTo(r+s,i+s*t,a-s,o-s*n,a,o)}function Hg(e){this._context=e}Hg.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=this._t0=NaN,this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x1,this._y1);break;case 3:Vg(this,this._t0,Bg(this,this._t0))}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){var n=NaN;if(e=+e,t=+t,e!==this._x1||t!==this._y1){switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;break;case 2:this._point=3,Vg(this,Bg(this,n=zg(this,e,t)),n);break;default:Vg(this,this._t0,n=zg(this,e,t))}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t,this._t0=n}}};function Ug(e){this._context=new Wg(e)}(Ug.prototype=Object.create(Hg.prototype)).point=function(e,t){Hg.prototype.point.call(this,t,e)};function Wg(e){this._context=e}Wg.prototype={moveTo:function(e,t){this._context.moveTo(t,e)},closePath:function(){this._context.closePath()},lineTo:function(e,t){this._context.lineTo(t,e)},bezierCurveTo:function(e,t,n,r,i,a){this._context.bezierCurveTo(t,e,r,n,a,i)}};function Gg(e){return new Hg(e)}function Kg(e){return new Ug(e)}function qg(e){this._context=e}qg.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=[],this._y=[]},lineEnd:function(){var e=this._x,t=this._y,n=e.length;if(n){if(this._line?this._context.lineTo(e[0],t[0]):this._context.moveTo(e[0],t[0]),n===2)this._context.lineTo(e[1],t[1]);else for(var r=Jg(e),i=Jg(t),a=0,o=1;o<n;++a,++o)this._context.bezierCurveTo(r[0][a],i[0][a],r[1][a],i[1][a],e[o],t[o])}(this._line||this._line!==0&&n===1)&&this._context.closePath(),this._line=1-this._line,this._x=this._y=null},point:function(e,t){this._x.push(+e),this._y.push(+t)}};function Jg(e){var t,n=e.length-1,r,i=Array(n),a=Array(n),o=Array(n);for(i[0]=0,a[0]=2,o[0]=e[0]+2*e[1],t=1;t<n-1;++t)i[t]=1,a[t]=4,o[t]=4*e[t]+2*e[t+1];for(i[n-1]=2,a[n-1]=7,o[n-1]=8*e[n-1]+e[n],t=1;t<n;++t)r=i[t]/a[t-1],a[t]-=r,o[t]-=r*o[t-1];for(i[n-1]=o[n-1]/a[n-1],t=n-2;t>=0;--t)i[t]=(o[t]-i[t+1])/a[t];for(a[n-1]=(e[n]+i[n-1])/2,t=0;t<n-1;++t)a[t]=2*e[t+1]-i[t+1];return[i,a]}function Yg(e){return new qg(e)}function Xg(e,t){this._context=e,this._t=t}Xg.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=this._y=NaN,this._point=0},lineEnd:function(){0<this._t&&this._t<1&&this._point===2&&this._context.lineTo(this._x,this._y),(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line>=0&&(this._t=1-this._t,this._line=1-this._line)},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:if(this._t<=0)this._context.lineTo(this._x,t),this._context.lineTo(e,t);else{var n=this._x*(1-this._t)+e*this._t;this._context.lineTo(n,this._y),this._context.lineTo(n,t)}}this._x=e,this._y=t}};function Zg(e){return new Xg(e,.5)}function Qg(e){return new Xg(e,0)}function $g(e){return new Xg(e,1)}function e_(e,t){if((o=e.length)>1)for(var n=1,r,i,a=e[t[0]],o,s=a.length;n<o;++n)for(i=a,a=e[t[n]],r=0;r<s;++r)a[r][1]+=a[r][0]=isNaN(i[r][1])?i[r][0]:i[r][1]}function t_(e){for(var t=e.length,n=Array(t);--t>=0;)n[t]=t;return n}function n_(e,t){return e[t]}function r_(e){let t=[];return t.key=e,t}function i_(){var e=zh([]),t=t_,n=e_,r=n_;function i(i){var a=Array.from(e.apply(this,arguments),r_),o,s=a.length,c=-1,l;for(let e of i)for(o=0,++c;o<s;++o)(a[o][c]=[0,+r(e,a[o].key,c,i)]).data=e;for(o=0,l=$h(t(a));o<s;++o)a[l[o]].index=o;return n(a,l),a}return i.keys=function(t){return arguments.length?(e=typeof t==`function`?t:zh(Array.from(t)),i):e},i.value=function(e){return arguments.length?(r=typeof e==`function`?e:zh(+e),i):r},i.order=function(e){return arguments.length?(t=e==null?t_:typeof e==`function`?e:zh(Array.from(e)),i):t},i.offset=function(e){return arguments.length?(n=e??e_,i):n},i}function a_(e,t){if((r=e.length)>0){for(var n,r,i=0,a=e[0].length,o;i<a;++i){for(o=n=0;n<r;++n)o+=e[n][i][1]||0;if(o)for(n=0;n<r;++n)e[n][i][1]/=o}e_(e,t)}}function o_(e,t){if((i=e.length)>0){for(var n=0,r=e[t[0]],i,a=r.length;n<a;++n){for(var o=0,s=0;o<i;++o)s+=e[o][n][1]||0;r[n][1]+=r[n][0]=-s/2}e_(e,t)}}function s_(e,t){if((o=e.length)>0&&(a=(i=e[t[0]]).length)>0){for(var n=0,r=1,i,a,o;r<a;++r){for(var s=0,c=0,l=0;s<o;++s){for(var u=e[t[s]],d=u[r][1]||0,f=(d-(u[r-1][1]||0))/2,p=0;p<s;++p){var m=e[t[p]],h=m[r][1]||0,g=m[r-1][1]||0;f+=h-g}c+=d,l+=f*d}i[r-1][1]+=i[r-1][0]=n,c&&(n-=l/c)}i[r-1][1]+=i[r-1][0]=n,e_(e,t)}}var c_=[`type`,`size`,`sizeType`];function l_(){return l_=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},l_.apply(null,arguments)}function u_(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function d_(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?u_(Object(n),!0).forEach(function(t){f_(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):u_(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function f_(e,t,n){return(t=p_(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function p_(e){var t=m_(e,`string`);return typeof t==`symbol`?t:t+``}function m_(e,t){if(typeof e!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(typeof r!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function h_(e,t){if(e==null)return{};var n,r,i=g_(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)===-1&&{}.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}function g_(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}var __={symbolCircle:lg,symbolCross:ug,symbolDiamond:pg,symbolSquare:mg,symbolStar:yg,symbolTriangle:xg,symbolWye:Eg},v_=Math.PI/180,y_=e=>__[`symbol${Th(e)}`]||lg,b_=(e,t,n)=>{if(t===`area`)return e;switch(n){case`cross`:return 5*e*e/9;case`diamond`:return .5*e*e/Math.sqrt(3);case`square`:return e*e;case`star`:var r=18*v_;return 1.25*e*e*(Math.tan(r)-Math.tan(r*2)*Math.tan(r)**2);case`triangle`:return Math.sqrt(3)*e*e/4;case`wye`:return(21-10*Math.sqrt(3))*e*e/8;default:return Math.PI*e*e/4}},x_=(e,t)=>{__[`symbol${Th(e)}`]=t},S_=e=>{var t=e.type,n=t===void 0?`circle`:t,r=e.size,i=r===void 0?64:r,a=e.sizeType,o=a===void 0?`area`:a,s=d_(d_({},h_(e,c_)),{},{type:n,size:i,sizeType:o}),c=`circle`;typeof n==`string`&&(c=n);var l=()=>{var e=y_(c),t=Dg().type(e).size(b_(i,o,c))();if(t!==null)return t},u=s.className,d=s.cx,f=s.cy,p=Hm(s);return X(d)&&X(f)&&X(i)?v.createElement(`path`,l_({},p,{className:Pm(`recharts-symbols`,u),transform:`translate(${d}, ${f})`,d:l()})):null};S_.registerSymbol=x_;var C_=e=>`radius`in e&&`startAngle`in e&&`endAngle`in e,w_=(e,t)=>{if(!e||typeof e==`function`||typeof e==`boolean`)return null;var n=e;if((0,v.isValidElement)(e)&&(n=e.props),typeof n!=`object`&&typeof n!=`function`)return null;var r={};return Object.keys(n).forEach(e=>{Im(e)&&typeof n[e]==`function`&&(r[e]=t||(t=>n[e](n,t)))}),r},T_=(e,t,n)=>r=>(e(t,n,r),null),E_=(e,t,n)=>{if(e===null||typeof e!=`object`&&typeof e!=`function`)return null;var r=null;return Object.keys(e).forEach(i=>{var a=e[i];Im(i)&&typeof a==`function`&&(r||={},r[i]=T_(a,t,n))}),r},D_=e=>Array.isArray(e)&&e.length>0;function O_(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function k_(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?O_(Object(n),!0).forEach(function(t){A_(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):O_(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function A_(e,t,n){return(t=j_(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function j_(e){var t=M_(e,`string`);return typeof t==`symbol`?t:t+``}function M_(e,t){if(typeof e!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(typeof r!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function N_(e,t){var n=k_({},e),r=t;return Object.keys(t).reduce((e,t)=>(e[t]===void 0&&r[t]!==void 0&&(e[t]=r[t]),e),n)}function P_(){return P_=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},P_.apply(null,arguments)}function F_(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function I_(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?F_(Object(n),!0).forEach(function(t){L_(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):F_(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function L_(e,t,n){return(t=R_(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function R_(e){var t=z_(e,`string`);return typeof t==`symbol`?t:t+``}function z_(e,t){if(typeof e!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(typeof r!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}var B_=32,V_={align:`center`,iconSize:14,inactiveColor:`#ccc`,layout:`horizontal`,verticalAlign:`middle`,labelStyle:{}};function H_(e){if(typeof e==`object`&&e&&`strokeDasharray`in e)return String(e.strokeDasharray)}function U_(e){var t=e.data,n=e.iconType,r=e.inactiveColor,i=B_/2,a=B_/6,o=B_/3,s=t.inactive?r:t.color,c=n??t.type;if(c===`none`)return null;if(c===`plainline`)return v.createElement(`line`,{strokeWidth:4,fill:`none`,stroke:s,strokeDasharray:H_(t.payload),x1:0,y1:i,x2:B_,y2:i,className:`recharts-legend-icon`});if(c===`line`)return v.createElement(`path`,{strokeWidth:4,fill:`none`,stroke:s,d:`M0,${i}h${o}
63
+ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let n of e.seen.entries()){let r=n[1];if(t===n[0]){a(n);continue}if(e.external){let r=e.external.registry.get(n[0])?.id;if(t!==n[0]&&r){a(n);continue}}if(e.metadataRegistry.get(n[0])?.id){a(n);continue}if(r.cycle){a(n);continue}r.count>1&&e.reused===`ref`&&a(n)}e.external&&(e.sharedDefsExtractedFor=e.external)}function qa(e){let t=e.anyOf;if(!Array.isArray(t)||t.length===0||e.type!==void 0)return;let n=[];for(let e of t){if(!e||typeof e!=`object`)return;qa(e);let t=Object.keys(e);if(t.length!==1||t[0]!==`type`)return;let r=e.type;for(let e of Array.isArray(r)?r:[r]){if(typeof e!=`string`)return;n.includes(e)||n.push(e)}}delete e.anyOf,e.type=n.length===1?n[0]:n}var Ja=new Set([`type`,`properties`,`required`,`additionalProperties`]),Ya=[`oneOf`,`anyOf`];function Xa(e){let t=e.additionalProperties;return t===void 0||t===!1||typeof t!=`object`||!t?null:Object.keys(t).length?t:null}function Za(e){let t=[];for(let n of e){if(typeof n!=`object`||n.type!==`object`)return null;for(let e in n)if(!Ja.has(e))return null;t.push(n)}let n={},r=new Set;for(let e of t){for(let r in e.properties){if(Object.prototype.hasOwnProperty.call(n,r))continue;let e=[];for(let n of t){let t=n.properties?.[r]??Xa(n);t!=null&&(e.some(e=>JSON.stringify(e)===JSON.stringify(t))||e.push(t))}A(n,r,e.length===1?e[0]:Za(e)??{allOf:e})}for(let t of e.required??[])r.add(t)}let i={type:`object`,properties:n};if(r.size&&(i.required=[...r]),t.every(e=>e.additionalProperties===!1))i.additionalProperties=!1;else{let e=[];for(let n of t){let t=Xa(n);t&&!e.some(e=>JSON.stringify(e)===JSON.stringify(t))&&e.push(t)}e.length===1?i.additionalProperties=e[0]:e.length>1&&(i.additionalProperties={allOf:e})}return i}function Qa(e){let t=e.allOf;if(!Array.isArray(t)||t.length<2)return;for(let t of Ja)if(t in e)return;let n=t.filter(e=>Ya.some(t=>Array.isArray(e[t]))),r=null;if(!n.length)r=Za(t);else{let e=n[0],i=Ya.find(t=>Array.isArray(e[t]));if(Object.keys(e).length!==1)return;let a=t.filter(t=>t!==e),o=e[i].map(e=>Za([...a,e]));if(o.some(e=>!e))return;r={[i]:o}}r&&(delete e.allOf,Va(e,r))}function $a(e,t){let n=e.seen.get(t);if(!n)throw Error(`Unprocessed schema. This is a bug in Zod.`);let r=t=>{let n=e.seen.get(t);if(n.ref===null)return;let i=n.def??n.schema,a={...i},o=n.ref;if(n.ref=null,o){r(o);let n=e.seen.get(o),s=n.schema;if(s.$ref&&(e.target===`draft-07`||e.target===`draft-04`||e.target===`openapi-3.0`)?(i.allOf=i.allOf??[],i.allOf.push(s)):Va(i,s),Va(i,a),t._zod.parent===o)for(let e in i)e!==`$ref`&&e!==`allOf`&&(e in a||delete i[e]);if(s.$ref&&n.def)for(let e in i)e!==`$ref`&&e!==`allOf`&&e in n.def&&JSON.stringify(i[e])===JSON.stringify(n.def[e])&&delete i[e]}let s=t._zod.parent;if(s&&s!==o){r(s);let t=e.seen.get(s);if(t?.schema.$ref&&(i.$ref=t.schema.$ref,t.def))for(let e in i)e!==`$ref`&&e!==`allOf`&&e in t.def&&JSON.stringify(i[e])===JSON.stringify(t.def[e])&&delete i[e]}e.override({zodSchema:t,jsonSchema:i,path:n.path??[]})};if(!e.external||e.sharedEmitDoneFor!==e.external){for(let t of[...e.seen.entries()].reverse())r(t[0]);if(e.target!==`openapi-3.0`)for(let t of e.seen.entries())qa(t[1].def??t[1].schema);for(let t of e.deferred)t();if(e.intersections.length){let t=new Map;for(let n of e.seen.values())for(let e of[n.schema,n.def]){let n=e?.allOf;if(!Array.isArray(n))continue;let r=t.get(n);r?r.push(e):t.set(n,[e])}for(let n of e.intersections)for(let e of t.get(n)??[])Qa(e)}}let i={};if(e.target===`draft-2020-12`?i.$schema=`https://json-schema.org/draft/2020-12/schema`:e.target===`draft-07`?i.$schema=`http://json-schema.org/draft-07/schema#`:e.target===`draft-04`?i.$schema=`http://json-schema.org/draft-04/schema#`:e.target,e.external?.uri){let n=e.external.registry.get(t)?.id;if(!n)throw Error("Schema is missing an `id` property");i.$id=e.external.uri(n)}Va(i,n.defId?n.schema:n.def??n.schema);let a=e.metadataRegistry.get(t)?.id;a!==void 0&&i.id===a&&delete i.id;let o=e.external?.defs??{};if(!e.external||e.sharedEmitDoneFor!==e.external)for(let t of e.seen.entries()){let e=t[1];e.def&&e.defId&&(e.def.id===e.defId&&delete e.def.id,A(o,e.defId,e.def))}e.external&&(e.sharedEmitDoneFor=e.external),e.external||Object.keys(o).length>0&&(e.target===`draft-2020-12`?i.$defs=o:i.definitions=o);try{let n=JSON.parse(JSON.stringify(i));return Object.defineProperty(n,"~standard",{value:{...t[`~standard`],jsonSchema:{input:no(t,`input`,e.processors),output:no(t,`output`,e.processors)}},enumerable:!1,writable:!1}),n}catch{throw Error(`Error converting schema to JSON.`)}}function eo(e,t){let n=t??{seen:new Set};if(n.seen.has(e))return!1;n.seen.add(e);let r=e._zod.def;if(r.type===`transform`)return!0;if(r.type===`array`)return eo(r.element,n);if(r.type===`set`)return eo(r.valueType,n);if(r.type===`lazy`)return eo(r.getter(),n);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 eo(r.innerType,n);if(r.type===`intersection`)return eo(r.left,n)||eo(r.right,n);if(r.type===`record`||r.type===`map`)return eo(r.keyType,n)||eo(r.valueType,n);if(r.type===`pipe`)return e._zod.traits.has(`$ZodCodec`)?!0:eo(r.in,n)||eo(r.out,n);if(r.type===`object`){for(let e in r.shape)if(eo(r.shape[e],n))return!0;return!1}if(r.type===`union`){for(let e of r.options)if(eo(e,n))return!0;return!1}if(r.type===`tuple`){for(let e of r.items)if(eo(e,n))return!0;return!!(r.rest&&eo(r.rest,n))}return!1}var to=(e,t={})=>n=>{let r=Ha({...n,processors:t});return Wa(e,r),Ka(r,e),$a(r,e)},no=(e,t,n={})=>r=>{let{libraryOptions:i,target:a}=r??{},o=Ha({...i??{},target:a,io:t,processors:n});return Wa(e,o),Ka(o,e),$a(o,e)},ro=(e,t,n)=>{(e[t]===void 0||n>e[t])&&(e[t]=n)},io=(e,t,n)=>{(e[t]===void 0||n<e[t])&&(e[t]=n)},ao=(e,t)=>{ro(e,`minimum`,t),io(e,`maximum`,t)},oo=(e,t)=>{e.multipleOf??=[],e.multipleOf.includes(t)||e.multipleOf.push(t)},so=(e,t)=>{e.patterns??=new Set,e.patterns.add(t)},co=(e,t)=>{e.mime=e.mime?e.mime.filter(e=>t.includes(e)):[...t]},lo=(e,t)=>{e.format=t,t.includes(`int`)&&(e.isInt=!0)},uo=(e,t)=>ro(e,`minimum`,t.minimum),fo=(e,t)=>io(e,`maximum`,t.maximum),po=e=>(t,n)=>{lo(t,n.format);let[r,i]=e[n.format];ro(t,`minimum`,r),io(t,`maximum`,i)},mo={greater_than:(e,t)=>ro(e,t.inclusive?`minimum`:`exclusiveMinimum`,t.value),less_than:(e,t)=>io(e,t.inclusive?`maximum`:`exclusiveMaximum`,t.value),multiple_of:(e,t)=>oo(e,t.value),number_format:po(L),bigint_format:po(me),min_length:uo,max_length:fo,length_equals:(e,t)=>ao(e,t.length),min_size:uo,max_size:fo,size_equals:(e,t)=>ao(e,t.size),string_format:(e,t)=>{lo(e,t.format),t.pattern&&so(e,t.pattern),(t.format===`base64`||t.format===`base64url`)&&(e.contentEncoding=t.format),(t.local||t.precision===-1)&&(e.laxFormat=!0)},mime_type:(e,t)=>co(e,t.mime)};function ho(e){let t={},n=e._zod.def,r=e._zod.traits.has(`$ZodCheck`)?[e,...n.checks??[]]:n.checks??[];for(let e of r)mo[e._zod.def.check]?.(t,e._zod.def);let i=e._zod.bag;i.minimum!==void 0&&ro(t,`minimum`,i.minimum),i.exclusiveMinimum!==void 0&&ro(t,`exclusiveMinimum`,i.exclusiveMinimum),i.maximum!==void 0&&io(t,`maximum`,i.maximum),i.exclusiveMaximum!==void 0&&io(t,`exclusiveMaximum`,i.exclusiveMaximum),i.multipleOf!==void 0&&oo(t,i.multipleOf),i.format!==void 0&&(t.format??=i.format,i.format.includes(`int`)&&(t.isInt=!0)),i.mime&&co(t,i.mime);for(let e of i.patterns??[])so(t,e);return t}var go={guid:`uuid`,url:`uri`,datetime:`date-time`,json_string:`json-string`,regex:``},_o=new Map([[hr,Jt],[_r,Yt]]),vo=e=>_o.get(e)??e,yo=(e,t,n,r)=>{let i=n;i.type=`string`;let{minimum:a,maximum:o,format:s,patterns:c,contentEncoding:l,laxFormat:u}=ho(e);if(typeof a==`number`&&(i.minLength=a),typeof o==`number`&&(i.maxLength=o),s&&(i.format=go[s]??s,i.format===``&&delete i.format,(s===`time`||u)&&delete i.format),l&&(i.contentEncoding=l),c&&c.size>0){let e=[...c].map(vo);e.length===1?i.pattern=e[0].source:e.length>1&&(i.allOf=[...e.map(e=>({...t.target===`draft-07`||t.target===`draft-04`||t.target===`openapi-3.0`?{type:`string`}:{},pattern:e.source}))])}},bo=(e,t,n,r)=>{let i=n,{minimum:a,maximum:o,multipleOf:s,exclusiveMaximum:c,exclusiveMinimum:l,isInt:u}=ho(e);i.type=u?`integer`:`number`;let d=typeof l==`number`&&l>=(a??-1/0),f=typeof c==`number`&&c<=(o??1/0),p=t.target===`draft-04`||t.target===`openapi-3.0`;if(d?p?(i.minimum=l,i.exclusiveMinimum=!0):i.exclusiveMinimum=l:typeof a==`number`&&(i.minimum=a),f?p?(i.maximum=c,i.exclusiveMaximum=!0):i.exclusiveMaximum=c:typeof o==`number`&&(i.maximum=o),s){let n=new Set;for(let a of s)Number.isFinite(a)&&a!==0?n.add(Math.abs(a)):Ua(e,t,i,r,`A multipleOf divisor of ${a} cannot be represented in JSON Schema`);let[a,...o]=n;a!==void 0&&(i.multipleOf=a),o.length&&(i.allOf=[...i.allOf??[],...o.map(e=>({multipleOf:e}))])}},xo=(e,t,n,r)=>{n.type=`boolean`},So=(e,t,n,r)=>{t.target===`openapi-3.0`?(n.type=`string`,n.nullable=!0,n.enum=[null]):n.type=`null`},Co=(e,t,n,r)=>{Ua(e,t,n,r,`Undefined cannot be represented in JSON Schema`)},wo=(e,t,n,r)=>{n.not={}},To=(e,t,n,r)=>{let i=e._zod.def,a=b(i.entries);if(a.length===0){n.not={};return}a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),n.enum=a},Eo=(e,t,n,r)=>{let i=e._zod.def;if(i.values.length===0){n.not={};return}let a=[];for(let o of i.values)if(o===void 0){if(Ua(e,t,n,r,"Literal `undefined` cannot be represented in JSON Schema"))return}else if(typeof o==`bigint`){if(Ua(e,t,n,r,`BigInt literals cannot be represented in JSON Schema`))return;a.push(Number(o))}else a.push(o);if(a.length!==0){if(a.length===1){let e=a[0];n.type=e===null?`null`:typeof e,t.target===`draft-04`||t.target===`openapi-3.0`?n.enum=[e]:n.const=e}else a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),a.every(e=>typeof e==`boolean`)&&(n.type=`boolean`),a.every(e=>e===null)&&(n.type=`null`),n.enum=a}},Do=(e,t,n,r)=>{Ua(e,t,n,r,`Custom types cannot be represented in JSON Schema`)},Oo=(e,t,n,r)=>{Ua(e,t,n,r,`Transforms cannot be represented in JSON Schema`)},ko=(e,t,n,r)=>{let i=n,a=e._zod.def,{minimum:o,maximum:s}=ho(e);typeof o==`number`&&(i.minItems=o),typeof s==`number`&&(i.maxItems=s),i.type=`array`,i.items=Wa(a.element,t,{...r,path:[...r.path,`items`]})};function Ao(e){let t=e._zod.def;return t.type===`pipe`&&t.in._zod.traits.has(`$ZodTransform`)?Ao(t.out):t.type===`catch`?Ao(t.innerType):e._zod.optin}var jo=(e,t,n,r)=>{let i=n,a=e._zod.def,o=a.shape;if(Object.getOwnPropertySymbols(o).length&&Ua(e,t,i,r,`Symbol keys cannot be represented in JSON Schema`))return;i.type=`object`,i.properties={};for(let e in o)A(i.properties,e,Wa(o[e],t,{...r,path:[...r.path,`properties`,e]}));let s=[];for(let e of Object.keys(o)){let n=a.shape[e];(t.io===`input`?Ao(n)===void 0:n._zod.optout===void 0)&&s.push(e)}s.length>0&&(i.required=s),a.catchall?._zod.def.type===`never`?i.additionalProperties=!1:a.catchall?a.catchall&&(i.additionalProperties=Wa(a.catchall,t,{...r,path:[...r.path,`additionalProperties`]})):t.io===`output`&&(i.additionalProperties=!1)},Mo=(e,t,n,r)=>{let i=e._zod.def,a=i.inclusive===!1,o=i.options.map((e,n)=>Wa(e,t,{...r,path:[...r.path,a?`oneOf`:`anyOf`,n]}));a?n.oneOf=o:n.anyOf=o},No=(e,t,n,r)=>{let i=e._zod.def,a=Wa(i.left,t,{...r,path:[...r.path,`allOf`,0]}),o=Wa(i.right,t,{...r,path:[...r.path,`allOf`,1]}),s=e=>`allOf`in e&&Object.keys(e).length===1,c=[...s(a)?a.allOf:[a],...s(o)?o.allOf:[o]];n.allOf=c,t.intersections.push(c)};function Po(e,t,n){if(t.$ref){if(n.has(t))return t;n.add(t);let r=e.get(t)?.def;if(!r)return t;let i=Po(e,r,n);return i===r?t:i}for(let r of[`anyOf`,`oneOf`]){let i=t[r];if(!Array.isArray(i))continue;let a=i.map(t=>Po(e,t,n));a.some((e,t)=>e!==i[t])&&(t={...t,[r]:a})}let r=Array.isArray(t.type)?t.type:[t.type],i=!r.includes(`string`)&&r.some(e=>e===`number`||e===`integer`),a=t.enum??(t.const===void 0?void 0:[t.const]);if(!i&&!a?.some(e=>typeof e==`number`))return t;let{minimum:o,maximum:s,exclusiveMinimum:c,exclusiveMaximum:l,multipleOf:u,format:d,id:f,...p}=t;return p.enum?p.enum=p.enum.map(e=>typeof e==`number`?String(e):e):typeof p.const==`number`&&(p.const=String(p.const)),i?(p.type=`string`,a||(p.pattern=(r.includes(`number`)?sn:on).source),p):p}var Fo=new WeakMap;function Io(e){let t=new Map;for(let n of e.seen.values())n.def&&!t.has(n.schema)&&t.set(n.schema,n);let n=new Map;for(let r of Fo.get(e)??[]){let i=e.seen.get(r),a=(i?.def??i?.schema)?.propertyNames;if(!a||a===!0||n.has(a))continue;let o=Po(t,a,new Set);o!==a&&n.set(a,o)}if(n.size)for(let t of e.seen.values())for(let e of[t.schema,t.def]){let t=e&&n.get(e.propertyNames);t&&(e.propertyNames=t)}}var Lo=(e,t,n,r)=>{let i=n,a=e._zod.def;i.type=`object`;let o=a.keyType,s=ho(o).patterns;if(a.mode===`loose`&&s&&s.size>0){let e=Wa(a.valueType,t,{...r,path:[...r.path,`patternProperties`,`*`]});i.patternProperties={};for(let t of s)A(i.patternProperties,vo(t).source,e)}else{if(t.target===`draft-07`||t.target===`draft-2020-12`){i.propertyNames=Wa(a.keyType,t,{...r,path:[...r.path,`propertyNames`]});let n=Fo.get(t);n||(n=[],Fo.set(t,n),t.deferred.push(()=>Io(t))),n.push(e)}i.additionalProperties=Wa(a.valueType,t,{...r,path:[...r.path,`additionalProperties`]})}let c=o._zod.values,l=t.io===`input`&&Ao(a.valueType)!==void 0;if(c&&!a.partial&&!l){let e=[...c].filter(e=>typeof e==`string`||typeof e==`number`);e.length>0&&(i.required=e.map(String))}},Ro=(e,t,n,r)=>{let i=e._zod.def,a=Wa(i.innerType,t,r),o=t.seen.get(e);t.target===`openapi-3.0`?(o.ref=i.innerType,n.nullable=!0):n.anyOf=[a,{type:`null`}]},zo=(e,t,n,r)=>{let i=e._zod.def;Wa(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},Bo=Symbol();function Vo(e,t,n,r,i){let a=!1,o=JSON.stringify(e,(e,t)=>typeof t==`bigint`?(a=!0,null):t);return a?(Ua(t,n,r,i,`BigInt defaults cannot be represented in JSON Schema`),Bo):JSON.parse(o)}var Ho=(e,t,n,r)=>{let i=e._zod.def;Wa(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType;let o=Vo(i.defaultValue,e,t,n,r);o!==Bo&&(n.default=o)},Uo=(e,t,n,r)=>{let i=e._zod.def;Wa(i.innerType,t,r);let a=t.seen.get(e);if(a.ref=i.innerType,t.io!==`input`)return;let o=Vo(i.defaultValue,e,t,n,r);o!==Bo&&(n._prefault=o)},Wo=(e,t,n,r)=>{let i=e._zod.def;Wa(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType;let o;try{o=i.catchValue(void 0)}catch{Ua(e,t,n,r,`Dynamic catch values are not supported in JSON Schema`);return}n.default=o},z=(e,t,n,r)=>{let i=e._zod.def,a=i.in._zod.traits.has(`$ZodTransform`),o=t.io===`input`?a?i.out:i.in:i.out;Wa(o,t,r);let s=t.seen.get(e);s.ref=o},Go=(e,t,n,r)=>{let i=e._zod.def;Wa(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.readOnly=!0},Ko=(e,t,n,r)=>{let i=e._zod.def;Wa(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},qo=(e,t,n,r)=>{let i=e._zod.innerType;Wa(i,t,r);let a=t.seen.get(e);a.ref=i},Jo=new WeakSet([Object.prototype,Error.prototype]);function Yo(e,t,n){Object.defineProperty(e,t,{configurable:!0,enumerable:!1,get(){let e=n(this);return Object.defineProperty(this,t,{value:e,configurable:!0,writable:!0}),e},set(e){Object.defineProperty(this,t,{value:e,configurable:!0,writable:!0})}})}var Xo=R(`ZodError`,(e,t)=>{ct.init(e,t),e.name=`ZodError`;let n=Object.getPrototypeOf(e);Jo.has(n)||(Jo.add(n),Yo(n,`format`,e=>t=>dt(e,t)),Yo(n,`flatten`,e=>t=>ut(e,t)),Yo(n,`addIssue`,e=>t=>{e.issues.push(t),e.message=JSON.stringify(e.issues,S,2)}),Yo(n,`addIssues`,e=>t=>{e.issues.push(...t),e.message=JSON.stringify(e.issues,S,2)}),Object.defineProperty(n,"isEmpty",{configurable:!0,enumerable:!1,get(){return this.issues.length===0}}))},void 0,{Parent:Error}),Zo=pt(Xo),Qo=mt(Xo),$o=ht(Xo),es=_t(Xo),ts=Ct(Xo),ns=wt(Xo),rs=Tt(Xo),is=Et(Xo),as=Dt(Xo),os=Ot(Xo),ss=kt(Xo),cs=At(Xo);function ls(){et.localeError||tt(ji())}function us(){et.memoizer||tt({memoizer:Oi()})}var ds=R(`ZodType`,(e,t)=>(ls(),Nn.init(e,t),e.def=t,e.type=t.type,e),{check(...e){let t=this.def;return this.clone(P(t,{checks:[...t.checks??[],...e.map(e=>typeof e==`function`?{_zod:{check:e,def:{check:`custom`},onattach:[]}}:e)]}),{parent:!0})},with(...e){return this.check(...e)},clone(e,t){return de(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},refine(e,t){return this.check(jc(e,t))},superRefine(e,t){return this.check(Mc(e,t))},overwrite(e){return this.check(ja(e))},optional(){return fc(this)},exactOptional(){return mc(this)},nullable(){return gc(this)},nullish(){return fc(gc(this))},nonoptional(e){return Sc(this,e)},array(){return U(this)},or(e){return G([this,e])},and(e){return ic(this,e)},transform(e){return Ec(this,uc(e))},default(e){return vc(this,e)},prefault(e){return bc(this,e)},catch(e){return wc(this,e)},pipe(e){return Ec(this,e)},readonly(){return Oc(this)},describe(e){let t=this.clone();return Fi.add(t,{description:e}),t},meta(...e){if(e.length===0)return Fi.get(this);let t=this.clone();return Fi.add(t,e[0]),t},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(e,...t){return t.length===0?e(this):e(this,...t)},get"~standard"(){return Le(this,`~standard`,{...In(this),jsonSchema:{input:no(this,`input`),output:no(this,`output`)}})},set"~standard"(e){Ie(this,`~standard`,e)},parse:function e(t,n){return Zo(this,t,n,{callee:e})},parseAsync:async function e(t,n){return await Qo(this,t,n,{callee:e})},safeParse(e,t){return $o(this,e,t)},async safeParseAsync(e,t){return es(this,e,t)},get spa(){return this?.safeParseAsync},set spa(e){Ie(this,`spa`,e)},validate(e,t){return bt(this,e,t)},validateAsync(e,t){return St(this,e,t)},encode:function e(t,n){return ts(this,t,n,{callee:e})},decode:function e(t,n){return ns(this,t,n,{callee:e})},encodeAsync:async function e(t,n){return await rs(this,t,n,{callee:e})},decodeAsync:async function e(t,n){return await is(this,t,n,{callee:e})},safeEncode(e,t){return as(this,e,t)},safeDecode(e,t){return os(this,e,t)},async safeEncodeAsync(e,t){return ss(this,e,t)},async safeDecodeAsync(e,t){return cs(this,e,t)},toJSONSchema(e){return to(this,{})(e)},get description(){return Fi.get(this)?.description},get _def(){return this._zod.def}}),fs=R(`_ZodString`,(e,t)=>{Ln.init(e,t),ds.init(e,t),e._zod.processJSONSchema=(t,n,r)=>yo(e,t,n,r)},Re({format:e=>ho(e).format??null,minLength:e=>ho(e).minimum??null,maxLength:e=>ho(e).maximum??null},{regex(...e){return this.check(Ta(...e))},includes(...e){return this.check(Oa(...e))},startsWith(...e){return this.check(ka(...e))},endsWith(...e){return this.check(Aa(...e))},min(...e){return this.check(Ca(...e))},max(...e){return this.check(Sa(...e))},length(...e){return this.check(wa(...e))},nonempty(...e){return this.check(Ca(1,...e))},lowercase(e){return this.check(Ea(e))},uppercase(e){return this.check(Da(e))},trim(){return this.check(Na())},normalize(...e){return this.check(Ma(...e))},toLowerCase(){return this.check(Pa())},toUpperCase(){return this.check(Fa())},slugify(){return this.check(Ia())}})),ps=R(`ZodString`,(e,t)=>{Ln.init(e,t),fs.init(e,t)},{email(e){return this.check(Ri(ys,e))},url(e){return this.check(Wi(Ss,e))},jwt(e){return this.check(aa(Ls,e))},emoji(e){return this.check(Gi(Cs,e))},guid(e){return this.check(zi(bs,e))},uuid(e){return this.check(Bi(xs,e))},uuidv4(e){return this.check(Vi(xs,e))},uuidv6(e){return this.check(Hi(xs,e))},uuidv7(e){return this.check(Ui(xs,e))},nanoid(e){return this.check(Ki(ws,e))},cuid(e){return this.check(qi(Ts,e))},cuid2(e){return this.check(Ji(Es,e))},ulid(e){return this.check(Yi(Ds,e))},base64(e){return this.check(na(Ps,e))},base64url(e){return this.check(ra(Fs,e))},xid(e){return this.check(Xi(Os,e))},ksuid(e){return this.check(Zi(ks,e))},ipv4(e){return this.check(Qi(As,e))},ipv6(e){return this.check($i(js,e))},cidrv4(e){return this.check(ea(Ms,e))},cidrv6(e){return this.check(ta(Ns,e))},e164(e){return this.check(ia(Is,e))},datetime(e){return this.check(oa(hs,e))},date(e){return this.check(sa(gs,e))},time(e){return this.check(ca(_s,e))},duration(e){return this.check(la(vs,e))}});function B(e){return Li(ps,e)}var ms=R(`ZodStringFormat`,(e,t)=>{Rn.init(e,t),fs.init(e,t)}),hs=R(`ZodISODateTime`,(e,t)=>{rr.init(e,t),ms.init(e,t)}),gs=R(`ZodISODate`,(e,t)=>{ir.init(e,t),ms.init(e,t)}),_s=R(`ZodISOTime`,(e,t)=>{ar.init(e,t),ms.init(e,t)}),vs=R(`ZodISODuration`,(e,t)=>{or.init(e,t),ms.init(e,t)}),ys=R(`ZodEmail`,(e,t)=>{Vn.init(e,t),ms.init(e,t)}),bs=R(`ZodGUID`,(e,t)=>{zn.init(e,t),ms.init(e,t)}),xs=R(`ZodUUID`,(e,t)=>{Bn.init(e,t),ms.init(e,t)}),Ss=R(`ZodURL`,(e,t)=>{Yn.init(e,t),ms.init(e,t)}),Cs=R(`ZodEmoji`,(e,t)=>{Xn.init(e,t),ms.init(e,t)}),ws=R(`ZodNanoID`,(e,t)=>{Zn.init(e,t),ms.init(e,t)}),Ts=R(`ZodCUID`,(e,t)=>{Qn.init(e,t),ms.init(e,t)}),Es=R(`ZodCUID2`,(e,t)=>{$n.init(e,t),ms.init(e,t)}),Ds=R(`ZodULID`,(e,t)=>{er.init(e,t),ms.init(e,t)}),Os=R(`ZodXID`,(e,t)=>{tr.init(e,t),ms.init(e,t)}),ks=R(`ZodKSUID`,(e,t)=>{nr.init(e,t),ms.init(e,t)}),As=R(`ZodIPv4`,(e,t)=>{sr.init(e,t),ms.init(e,t)}),js=R(`ZodIPv6`,(e,t)=>{ur.init(e,t),ms.init(e,t)}),Ms=R(`ZodCIDRv4`,(e,t)=>{dr.init(e,t),ms.init(e,t)}),Ns=R(`ZodCIDRv6`,(e,t)=>{pr.init(e,t),ms.init(e,t)}),Ps=R(`ZodBase64`,(e,t)=>{gr.init(e,t),ms.init(e,t)}),Fs=R(`ZodBase64URL`,(e,t)=>{yr.init(e,t),ms.init(e,t)}),Is=R(`ZodE164`,(e,t)=>{br.init(e,t),ms.init(e,t)}),Ls=R(`ZodJWT`,(e,t)=>{Sr.init(e,t),ms.init(e,t)}),Rs=R(`ZodNumber`,(e,t)=>{Cr.init(e,t),ds.init(e,t),e._zod.processJSONSchema=(t,n,r)=>bo(e,t,n,r),e.isFinite=!0},Re({minValue:e=>{let{minimum:t,exclusiveMinimum:n}=ho(e);return Math.max(t??-1/0,n??-1/0)},maxValue:e=>{let{maximum:t,exclusiveMaximum:n}=ho(e);return Math.min(t??1/0,n??1/0)},isInt:e=>{let{isInt:t,multipleOf:n}=ho(e);return!!t||!!n?.some(Number.isSafeInteger)},format:e=>ho(e).format??null},{gt(e,t){return this.check(ya(e,t))},gte(e,t){return this.check(ba(e,t))},min(e,t){return this.check(ba(e,t))},lt(e,t){return this.check(_a(e,t))},lte(e,t){return this.check(va(e,t))},max(e,t){return this.check(va(e,t))},int(e){return this.check(Bs(e))},safe(e){return this.check(Bs(e))},positive(e){return this.check(ya(0,e))},nonnegative(e){return this.check(ba(0,e))},negative(e){return this.check(_a(0,e))},nonpositive(e){return this.check(va(0,e))},multipleOf(e,t){return this.check(xa(e,t))},step(e,t){return this.check(xa(e,t))},finite(){return this}}));function V(e){return ua(Rs,e)}var zs=R(`ZodNumberFormat`,(e,t)=>{wr.init(e,t),Rs.init(e,t)});function Bs(e){return da(zs,e)}var Vs=R(`ZodBoolean`,(e,t)=>{Tr.init(e,t),ds.init(e,t),e._zod.processJSONSchema=(t,n,r)=>xo(e,t,n,r)});function Hs(e){return fa(Vs,e)}var Us=R(`ZodUndefined`,(e,t)=>{Er.init(e,t),ds.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Co(e,t,n,r)});function H(e){return pa(Us,e)}var Ws=R(`ZodNull`,(e,t)=>{Dr.init(e,t),ds.init(e,t),e._zod.processJSONSchema=(t,n,r)=>So(e,t,n,r)});function Gs(e){return ma(Ws,e)}var Ks=R(`ZodUnknown`,(e,t)=>{Or.init(e,t),ds.init(e,t),e._zod.processJSONSchema=(e,t,n)=>void 0});function qs(){return ha(Ks)}var Js=R(`ZodNever`,(e,t)=>{kr.init(e,t),ds.init(e,t),e._zod.processJSONSchema=(t,n,r)=>wo(e,t,n,r)});function Ys(e){return ga(Js,e)}var Xs=R(`ZodArray`,(e,t)=>{us(),jr.init(e,t),ds.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ko(e,t,n,r),e.element=t.element},{min(e,t){return this.check(Ca(e,t))},nonempty(e){return this.check(Ca(1,e))},max(e,t){return this.check(Sa(e,t))},length(e,t){return this.check(wa(e,t))},unwrap(){return this.element}});function U(e,t){return La(Xs,e,t)}var Zs=R(`ZodObject`,(e,t)=>{us(),Lr.init(e,t),ds.init(e,t),e._zod.processJSONSchema=(t,n,r)=>jo(e,t,n,r),Ge(e,`shape`,e=>e._zod.def.shape,!1)},{keyof(){return K(Object.keys(this._zod.def.shape))},catchall(e){return this.clone(P(this._zod.def,{catchall:e}))},passthrough(){return this.clone(P(this._zod.def,{catchall:qs()}))},loose(){return this.clone(P(this._zod.def,{catchall:qs()}))},strict(){return this.clone(P(this._zod.def,{catchall:Ys()}))},strip(){return this.clone(P(this._zod.def,{catchall:void 0}))},extend(e){return ve(this,e)},safeExtend(e){return be(this,e)},merge(e){return xe(this,e)},pick(e){return he(this,e)},omit(e){return _e(this,e)},partial(...e){return Se(dc,this,e[0])},exactPartial(...e){return Se(pc,this,e[0],`exactPartial`)},required(...e){return Ce(xc,this,e[0])}});function W(e,t){return new Zs({type:`object`,shape:e??{},...I(t)})}function Qs(e,t){return new Zs({type:`object`,shape:e,catchall:Ys(),...I(t)})}function $s(e,t){return new Zs({type:`object`,shape:e,catchall:qs(),...I(t)})}var ec=R(`ZodUnion`,(e,t)=>{zr.init(e,t),ds.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Mo(e,t,n,r),e.options=t.options});function G(e,t){return new ec({type:`union`,options:e,...I(t)})}var tc=R(`ZodDiscriminatedUnion`,(e,t)=>{ec.init(e,t),Vr.init(e,t)});function nc(e,t,n){return new tc({type:`union`,options:t,discriminator:e,...I(n)})}var rc=R(`ZodIntersection`,(e,t)=>{Hr.init(e,t),ds.init(e,t),e._zod.processJSONSchema=(t,n,r)=>No(e,t,n,r)});function ic(e,t){return new rc({type:`intersection`,left:e,right:t})}var ac=R(`ZodRecord`,(e,t)=>{us(),Gr.init(e,t),ds.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Lo(e,t,n,r),e.keyType=t.keyType,e.valueType=t.valueType});function oc(e,t,n){return!t||!t._zod?new ac({type:`record`,keyType:B(),valueType:e,...I(t)}):new ac({type:`record`,keyType:e,valueType:t,...I(n)})}var sc=R(`ZodEnum`,(e,t)=>{Kr.init(e,t),ds.init(e,t),e._zod.processJSONSchema=(t,n,r)=>To(e,t,n,r),e.enum=t.entries,e.options=[...e._zod.values];let n=new Set(Object.keys(t.entries));e.extract=(e,r)=>{let i={};for(let r of e)if(n.has(r))i[r]=t.entries[r];else throw Error(`Key ${r} not found in enum`);return new sc({...t,checks:[],...I(r),entries:i})},e.exclude=(e,r)=>{let i={...t.entries};for(let t of e)if(n.has(t))delete i[t];else throw Error(`Key ${t} not found in enum`);return new sc({...t,checks:[],...I(r),entries:i})}});function K(e,t){return new sc({type:`enum`,entries:Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e,...I(t)})}var cc=R(`ZodLiteral`,(e,t)=>{qr.init(e,t),ds.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Eo(e,t,n,r),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function q(e,t){return new cc({type:`literal`,values:Array.isArray(e)?e:[e],...I(t)})}var lc=R(`ZodTransform`,(e,t)=>{us(),Jr.init(e,t),ds.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Oo(e,t,n,r),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new $e(e.constructor.name);n.addIssue=r=>{if(typeof r==`string`)n.issues.push(Pe(r,n.value,t));else{let t=r;t.fatal&&(t.continue=!1),t.code??=`custom`,`input`in t||(t.input=n.value),t.inst??=e,n.issues.push(Pe(t))}};let i=t.transform(n.value,n);return i instanceof Promise?i.then(e=>(n.value=e,n)):(n.value=i,n)}});function uc(e){return new lc({type:`transform`,transform:e})}var dc=R(`ZodOptional`,(e,t)=>{Xr.init(e,t),ds.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ko(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function fc(e){return new dc({type:`optional`,innerType:e})}var pc=R(`ZodExactOptional`,(e,t)=>{Zr.init(e,t),ds.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ko(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function mc(e){return new pc({type:`optional`,innerType:e})}var hc=R(`ZodNullable`,(e,t)=>{Qr.init(e,t),ds.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ro(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function gc(e){return new hc({type:`nullable`,innerType:e})}var _c=R(`ZodDefault`,(e,t)=>{$r.init(e,t),ds.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ho(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function vc(e,t){return new _c({type:`default`,innerType:e,get defaultValue(){return typeof t==`function`?t():ce(t)}})}var yc=R(`ZodPrefault`,(e,t)=>{ti.init(e,t),ds.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Uo(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function bc(e,t){return new yc({type:`prefault`,innerType:e,get defaultValue(){return typeof t==`function`?t():ce(t)}})}var xc=R(`ZodNonOptional`,(e,t)=>{ni.init(e,t),ds.init(e,t),e._zod.processJSONSchema=(t,n,r)=>zo(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Sc(e,t){return new xc({type:`nonoptional`,innerType:e,...I(t)})}var Cc=R(`ZodCatch`,(e,t)=>{ai.init(e,t),ds.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Wo(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function wc(e,t){return new Cc({type:`catch`,innerType:e,catchValue:typeof t==`function`?t:qe(t)})}var Tc=R(`ZodPipe`,(e,t)=>{oi.init(e,t),ds.init(e,t),e._zod.processJSONSchema=(t,n,r)=>z(e,t,n,r),e.in=t.in,e.out=t.out});function Ec(e,t){return new Tc({type:`pipe`,in:e,out:t})}var Dc=R(`ZodReadonly`,(e,t)=>{ci.init(e,t),ds.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Go(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Oc(e){return new Dc({type:`readonly`,innerType:e})}var kc=R(`ZodLazy`,(e,t)=>{ui.init(e,t),ds.init(e,t),e._zod.processJSONSchema=(t,n,r)=>qo(e,t,n,r),e.unwrap=()=>e._zod.def.getter()});function J(e){return new kc({type:`lazy`,getter:e})}var Ac=R(`ZodCustom`,(e,t)=>{di.init(e,t),ds.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Do(e,t,n,r)});function jc(e,t={}){return Ra(Ac,e,t)}function Mc(e,t){return za(e,t)}function Nc(e){return oa(hs,e)}var Pc=Object.defineProperty,Fc=(e,t)=>{let n={};for(var r in e)Pc(n,r,{get:e[r],enumerable:!0});return t||Pc(n,Symbol.toStringTag,{value:`Module`}),n},Ic=Fc({aggregatedMetricSchema:()=>qc,metricsBaseSchema:()=>Bc,otelExponentialHistogramSchema:()=>Wc,otelGaugeSchema:()=>Vc,otelHistogramSchema:()=>Uc,otelLogsSchema:()=>zc,otelMetricsSchema:()=>Kc,otelSumSchema:()=>Hc,otelSummarySchema:()=>Gc,otelTracesSchema:()=>Rc}),Lc=J(()=>G([B(),V(),Hs(),U(Lc),oc(B(),Lc)])),Rc=W({SpanId:B().describe(`Unique identifier for a span within a trace. The ID is an 8-byte array.`),Timestamp:B().describe(`Start time of the span. UNIX Epoch time in nanoseconds since 00:00:00 UTC on 1 January 1970. Expressed as string in JSON.`),TraceId:B().describe(`Unique identifier for a trace. All spans from the same trace share the same trace_id. The ID is a 16-byte array.`),Duration:B().optional().describe(`Duration of the span in nanoseconds (end_time - start_time). Expressed as string in JSON.`),"Events.Attributes":U(oc(B(),Lc)).optional().describe(`Attribute key/value pairs on the event (one object per event).`),"Events.Name":U(B()).optional().describe(`Name of the event. Semantically required to be non-empty.`),"Events.Timestamp":U(B()).optional().describe(`Time the event occurred (nanoseconds). Expressed as strings in JSON.`),"Links.Attributes":U(oc(B(),Lc)).optional().describe(`Attribute key/value pairs on the link (one object per link).`),"Links.SpanId":U(B()).optional().describe(`Unique identifier for the linked span. The ID is an 8-byte array.`),"Links.TraceId":U(B()).optional().describe(`Unique identifier of a trace that the linked span is part of. The ID is a 16-byte array.`),"Links.TraceState":U(B()).optional().describe(`The trace_state associated with the link.`),ParentSpanId:B().optional().describe(`The span_id of this span's parent span. Empty if this is a root span.`),ResourceAttributes:oc(B(),Lc).optional().describe(`Attributes that describe the resource.`),ScopeName:B().optional().describe(`Name denoting the instrumentation scope.`),ScopeVersion:B().optional().describe(`Version of the instrumentation scope.`),ServiceName:B().optional().describe(`Service name from resource attributes (service.name).`),SpanAttributes:oc(B(),Lc).optional().describe(`Key/value pairs describing the span.`),SpanKind:B().optional().describe(`Type of span (Unspecified, Internal, Server, Client, Producer, Consumer). Used to identify relationships between spans.`),SpanName:B().optional().describe(`Description of the span's operation. E.g., qualified method name or file name with line number.`),StatusCode:B().optional().describe(`Status code (Unset, Ok, Error).`),StatusMessage:B().optional().describe(`Developer-facing human readable error message.`),TraceState:B().optional().describe(`Conveys information about request position in multiple distributed tracing graphs. W3C trace-context format.`)}),zc=W({Timestamp:B().describe(`Time when the event occurred. UNIX Epoch time in nanoseconds since 00:00:00 UTC on 1 January 1970. Expressed as string in JSON.`),Body:B().optional().describe(`Body of the log record. Can be a human-readable string message or structured data.`),EventName:B().optional().describe(`A unique identifier of event category/type. Presence identifies this log record as an event.`),LogAttributes:oc(B(),Lc).optional().describe(`Additional attributes that describe the specific event occurrence.`),ResourceAttributes:oc(B(),Lc).optional().describe(`Attributes that describe the resource.`),ResourceSchemaUrl:B().optional().describe(`Schema URL for the resource data.`),ScopeAttributes:oc(B(),Lc).optional().describe(`Attributes of the instrumentation scope.`),ScopeName:B().optional().describe(`Name denoting the instrumentation scope.`),ScopeSchemaUrl:B().optional().describe(`Schema URL for the scope data.`),ScopeVersion:B().optional().describe(`Version of the instrumentation scope.`),ServiceName:B().optional().describe(`Service name from resource attributes (service.name).`),SeverityNumber:V().optional().describe(`Numerical value of the severity, normalized to values described in Log Data Model.`),SeverityText:B().optional().describe(`Severity text (also known as log level). Original string representation as known at the source.`),SpanId:B().optional().describe(`Unique identifier for a span within a trace. The ID is an 8-byte array.`),TraceFlags:V().optional().describe(`Bit field. 8 least significant bits are trace flags as defined in W3C Trace Context.`),TraceId:B().optional().describe(`Unique identifier for a trace. All logs from the same trace share the same trace_id. The ID is a 16-byte array.`)}),Bc=W({TimeUnix:B().describe(`Time when the data point was recorded. UNIX Epoch time in nanoseconds. Expressed as string in JSON.`),StartTimeUnix:B().describe(`Start time for cumulative/delta metrics. UNIX Epoch time in nanoseconds. Expressed as string in JSON.`),Attributes:oc(B(),Lc).optional().describe(`Key/value pairs that uniquely identify the timeseries.`),MetricName:B().optional().describe(`The name of the metric.`),MetricDescription:B().optional().describe(`A description of the metric, which can be used in documentation.`),MetricUnit:B().optional().describe(`The unit in which the metric value is reported (UCUM format).`),ResourceAttributes:oc(B(),Lc).optional().describe(`Attributes that describe the resource.`),ResourceSchemaUrl:B().optional().describe(`Schema URL for the resource data.`),ScopeAttributes:oc(B(),Lc).optional().describe(`Attributes of the instrumentation scope.`),ScopeDroppedAttrCount:V().optional().describe(`Number of attributes dropped from the scope.`),ScopeName:B().optional().describe(`Name denoting the instrumentation scope.`),ScopeSchemaUrl:B().optional().describe(`Schema URL for the scope data.`),ScopeVersion:B().optional().describe(`Version of the instrumentation scope.`),ServiceName:B().optional().describe(`Service name from resource attributes (service.name).`),"Exemplars.FilteredAttributes":U(oc(B(),Lc)).optional().describe(`Filtered attributes of exemplars.`),"Exemplars.SpanId":U(B()).optional().describe(`Span IDs associated with exemplars.`),"Exemplars.TimeUnix":U(B()).optional().describe(`Timestamps of exemplars (nanoseconds). Expressed as strings in JSON.`),"Exemplars.TraceId":U(B()).optional().describe(`Trace IDs associated with exemplars.`),"Exemplars.Value":U(V()).optional().describe(`Values of exemplars.`)}),Vc=Bc.extend({MetricType:q(`Gauge`).describe(`Gauge metric type.`),Value:V().describe(`Current scalar value.`),Flags:V().optional().describe(`Flags that apply to this data point (see DataPointFlags).`)}),Hc=Bc.extend({MetricType:q(`Sum`).describe(`Sum metric type.`),Value:V().describe(`Scalar sum value.`),Flags:V().optional().describe(`Flags that apply to this data point (see DataPointFlags).`),AggregationTemporality:B().optional().describe(`Aggregation temporality (DELTA or CUMULATIVE).`),IsMonotonic:V().optional().describe(`Whether the sum is monotonic (0 = false, 1 = true).`)}),Uc=Bc.extend({MetricType:q(`Histogram`).describe(`Histogram metric type.`),Count:V().optional().describe(`Number of values in the histogram.`),Sum:V().optional().describe(`Sum of all values.`),Min:V().nullable().optional().describe(`Minimum value recorded.`),Max:V().nullable().optional().describe(`Maximum value recorded.`),BucketCounts:U(V()).optional().describe(`Count of values in each bucket.`),ExplicitBounds:U(V()).optional().describe(`Bucket boundaries.`),AggregationTemporality:B().optional().describe(`Aggregation temporality (DELTA or CUMULATIVE).`)}),Wc=Bc.extend({MetricType:q(`ExponentialHistogram`).describe(`Exponential histogram metric type.`),Count:V().optional().describe(`Number of values in the histogram.`),Sum:V().optional().describe(`Sum of all values.`),Min:V().nullable().optional().describe(`Minimum value recorded.`),Max:V().nullable().optional().describe(`Maximum value recorded.`),Scale:V().optional().describe(`Resolution of the histogram. Boundaries are at powers of base.`),ZeroCount:V().optional().describe(`Count of values that are exactly zero.`),PositiveBucketCounts:U(V()).optional().describe(`Counts for positive value buckets.`),PositiveOffset:V().optional().describe(`Offset for positive bucket indices.`),NegativeBucketCounts:U(V()).optional().describe(`Counts for negative value buckets.`),NegativeOffset:V().optional().describe(`Offset for negative bucket indices.`),ZeroThreshold:V().optional().describe(`Width of the zero region. Values within [-ZeroThreshold, ZeroThreshold] go to the zero count bucket.`),AggregationTemporality:B().optional().describe(`Aggregation temporality (DELTA or CUMULATIVE).`)}),Gc=Bc.extend({MetricType:q(`Summary`).describe(`Summary metric type.`),Count:V().optional().describe(`Number of values in the summary.`),Sum:V().optional().describe(`Sum of all values.`),"ValueAtQuantiles.Quantile":U(V()).optional().describe(`Quantile values (0.0 to 1.0).`),"ValueAtQuantiles.Value":U(V()).optional().describe(`Values at each quantile.`)}),Kc=nc(`MetricType`,[Vc,Hc,Uc,Wc,Gc]),qc=W({groups:oc(B(),Lc).describe(`Group-by key/value pairs (e.g. { 'tenant.id': 'otel_tenant_2' }).`),value:V().describe(`The aggregated value.`)}),Jc=function(e){return e[e.SPAN_FLAGS_DO_NOT_USE=0]=`SPAN_FLAGS_DO_NOT_USE`,e[e.SPAN_FLAGS_TRACE_FLAGS_MASK=255]=`SPAN_FLAGS_TRACE_FLAGS_MASK`,e[e.SPAN_FLAGS_CONTEXT_HAS_IS_REMOTE_MASK=256]=`SPAN_FLAGS_CONTEXT_HAS_IS_REMOTE_MASK`,e[e.SPAN_FLAGS_CONTEXT_IS_REMOTE_MASK=512]=`SPAN_FLAGS_CONTEXT_IS_REMOTE_MASK`,e[e.UNRECOGNIZED=-1]=`UNRECOGNIZED`,e}({}),Yc=function(e){return e[e.SPAN_KIND_UNSPECIFIED=0]=`SPAN_KIND_UNSPECIFIED`,e[e.SPAN_KIND_INTERNAL=1]=`SPAN_KIND_INTERNAL`,e[e.SPAN_KIND_SERVER=2]=`SPAN_KIND_SERVER`,e[e.SPAN_KIND_CLIENT=3]=`SPAN_KIND_CLIENT`,e[e.SPAN_KIND_PRODUCER=4]=`SPAN_KIND_PRODUCER`,e[e.SPAN_KIND_CONSUMER=5]=`SPAN_KIND_CONSUMER`,e[e.UNRECOGNIZED=-1]=`UNRECOGNIZED`,e}({}),Xc=function(e){return e[e.STATUS_CODE_UNSET=0]=`STATUS_CODE_UNSET`,e[e.STATUS_CODE_OK=1]=`STATUS_CODE_OK`,e[e.STATUS_CODE_ERROR=2]=`STATUS_CODE_ERROR`,e[e.UNRECOGNIZED=-1]=`UNRECOGNIZED`,e}({}),Zc=function(e){return e[e.SEVERITY_NUMBER_UNSPECIFIED=0]=`SEVERITY_NUMBER_UNSPECIFIED`,e[e.SEVERITY_NUMBER_TRACE=1]=`SEVERITY_NUMBER_TRACE`,e[e.SEVERITY_NUMBER_TRACE2=2]=`SEVERITY_NUMBER_TRACE2`,e[e.SEVERITY_NUMBER_TRACE3=3]=`SEVERITY_NUMBER_TRACE3`,e[e.SEVERITY_NUMBER_TRACE4=4]=`SEVERITY_NUMBER_TRACE4`,e[e.SEVERITY_NUMBER_DEBUG=5]=`SEVERITY_NUMBER_DEBUG`,e[e.SEVERITY_NUMBER_DEBUG2=6]=`SEVERITY_NUMBER_DEBUG2`,e[e.SEVERITY_NUMBER_DEBUG3=7]=`SEVERITY_NUMBER_DEBUG3`,e[e.SEVERITY_NUMBER_DEBUG4=8]=`SEVERITY_NUMBER_DEBUG4`,e[e.SEVERITY_NUMBER_INFO=9]=`SEVERITY_NUMBER_INFO`,e[e.SEVERITY_NUMBER_INFO2=10]=`SEVERITY_NUMBER_INFO2`,e[e.SEVERITY_NUMBER_INFO3=11]=`SEVERITY_NUMBER_INFO3`,e[e.SEVERITY_NUMBER_INFO4=12]=`SEVERITY_NUMBER_INFO4`,e[e.SEVERITY_NUMBER_WARN=13]=`SEVERITY_NUMBER_WARN`,e[e.SEVERITY_NUMBER_WARN2=14]=`SEVERITY_NUMBER_WARN2`,e[e.SEVERITY_NUMBER_WARN3=15]=`SEVERITY_NUMBER_WARN3`,e[e.SEVERITY_NUMBER_WARN4=16]=`SEVERITY_NUMBER_WARN4`,e[e.SEVERITY_NUMBER_ERROR=17]=`SEVERITY_NUMBER_ERROR`,e[e.SEVERITY_NUMBER_ERROR2=18]=`SEVERITY_NUMBER_ERROR2`,e[e.SEVERITY_NUMBER_ERROR3=19]=`SEVERITY_NUMBER_ERROR3`,e[e.SEVERITY_NUMBER_ERROR4=20]=`SEVERITY_NUMBER_ERROR4`,e[e.SEVERITY_NUMBER_FATAL=21]=`SEVERITY_NUMBER_FATAL`,e[e.SEVERITY_NUMBER_FATAL2=22]=`SEVERITY_NUMBER_FATAL2`,e[e.SEVERITY_NUMBER_FATAL3=23]=`SEVERITY_NUMBER_FATAL3`,e[e.SEVERITY_NUMBER_FATAL4=24]=`SEVERITY_NUMBER_FATAL4`,e[e.UNRECOGNIZED=-1]=`UNRECOGNIZED`,e}({}),Qc=function(e){return e[e.LOG_RECORD_FLAGS_DO_NOT_USE=0]=`LOG_RECORD_FLAGS_DO_NOT_USE`,e[e.LOG_RECORD_FLAGS_TRACE_FLAGS_MASK=255]=`LOG_RECORD_FLAGS_TRACE_FLAGS_MASK`,e[e.UNRECOGNIZED=-1]=`UNRECOGNIZED`,e}({}),$c=function(e){return e[e.AGGREGATION_TEMPORALITY_UNSPECIFIED=0]=`AGGREGATION_TEMPORALITY_UNSPECIFIED`,e[e.AGGREGATION_TEMPORALITY_DELTA=1]=`AGGREGATION_TEMPORALITY_DELTA`,e[e.AGGREGATION_TEMPORALITY_CUMULATIVE=2]=`AGGREGATION_TEMPORALITY_CUMULATIVE`,e[e.UNRECOGNIZED=-1]=`UNRECOGNIZED`,e}({}),el=function(e){return e[e.DATA_POINT_FLAGS_DO_NOT_USE=0]=`DATA_POINT_FLAGS_DO_NOT_USE`,e[e.DATA_POINT_FLAGS_NO_RECORDED_VALUE_MASK=1]=`DATA_POINT_FLAGS_NO_RECORDED_VALUE_MASK`,e[e.UNRECOGNIZED=-1]=`UNRECOGNIZED`,e}({}),tl=W({schemaUrl:G([B(),H()]).optional(),type:G([B(),H()]).optional(),idKeys:G([U(B()),H()]).optional(),descriptionKeys:G([U(B()),H()]).optional()});K(Jc);var nl=K(Yc),rl=K(Xc),il=K(Zc);K(Qc);var al=G([K($c),V()]);G([K(el),V()]),W({offset:G([V(),H()]).optional(),bucketCounts:G([U(G([B(),V()])),H()]).optional()});var ol=W({quantile:G([V(),H()]).optional(),value:G([V(),H()]).optional()}),sl=W({message:G([B(),H()]).optional(),code:G([rl,H()]).optional()}),cl=J(()=>W({stringValue:G([B(),H()]).optional(),boolValue:G([Hs(),H()]).optional(),intValue:G([B(),V(),H()]).optional(),doubleValue:G([V(),H()]).optional(),arrayValue:G([ll,H()]).optional(),kvlistValue:G([ul,H()]).optional(),bytesValue:G([B(),H()]).optional()})),ll=J(()=>W({values:G([U(cl),H()]).optional()})),ul=J(()=>W({values:G([U(dl),H()]).optional()})),dl=J(()=>W({key:G([B(),H()]).optional(),value:G([cl,H()]).optional()})),fl=J(()=>W({name:G([B(),H()]).optional(),version:G([B(),H()]).optional(),attributes:G([U(dl),H()]).optional(),droppedAttributesCount:G([V(),H()]).optional()})),pl=J(()=>W({attributes:G([U(dl),H()]).optional(),droppedAttributesCount:G([V(),H()]).optional(),entityRefs:G([U(tl),H()]).optional()}));J(()=>W({resourceSpans:G([U(ml),H()]).optional()}));var ml=J(()=>W({resource:G([pl,H()]).optional(),scopeSpans:G([U(hl),H()]).optional(),schemaUrl:G([B(),H()]).optional()})),hl=J(()=>W({scope:G([fl,H()]).optional(),spans:G([U(gl),H()]).optional(),schemaUrl:G([B(),H()]).optional()})),gl=J(()=>W({traceId:G([B(),H()]).optional(),spanId:G([B(),H()]).optional(),traceState:G([B(),H()]).optional(),parentSpanId:G([B(),H()]).optional(),flags:G([V(),H()]).optional(),name:G([B(),H()]).optional(),kind:G([nl,H()]).optional(),startTimeUnixNano:G([B(),H()]).optional(),endTimeUnixNano:G([B(),H()]).optional(),attributes:G([U(dl),H()]).optional(),droppedAttributesCount:G([V(),H()]).optional(),events:G([U(_l),H()]).optional(),droppedEventsCount:G([V(),H()]).optional(),links:G([U(vl),H()]).optional(),droppedLinksCount:G([V(),H()]).optional(),status:G([sl,H()]).optional()})),_l=J(()=>W({timeUnixNano:G([B(),H()]).optional(),name:G([B(),H()]).optional(),attributes:G([U(dl),H()]).optional(),droppedAttributesCount:G([V(),H()]).optional()})),vl=J(()=>W({traceId:G([B(),H()]).optional(),spanId:G([B(),H()]).optional(),traceState:G([B(),H()]).optional(),attributes:G([U(dl),H()]).optional(),droppedAttributesCount:G([V(),H()]).optional(),flags:G([V(),H()]).optional()}));J(()=>W({resourceLogs:G([U(yl),H()]).optional()}));var yl=J(()=>W({resource:G([pl,H()]).optional(),scopeLogs:G([U(bl),H()]).optional(),schemaUrl:G([B(),H()]).optional()})),bl=J(()=>W({scope:G([fl,H()]).optional(),logRecords:G([U(xl),H()]).optional(),schemaUrl:G([B(),H()]).optional()})),xl=J(()=>W({timeUnixNano:G([B(),H()]).optional(),observedTimeUnixNano:G([B(),H()]).optional(),severityNumber:G([il,H()]).optional(),severityText:G([B(),H()]).optional(),body:G([cl,H()]).optional(),attributes:G([U(dl),H()]).optional(),droppedAttributesCount:G([V(),H()]).optional(),flags:G([V(),H()]).optional(),traceId:G([B(),H()]).optional(),spanId:G([B(),H()]).optional(),eventName:G([B(),H()]).optional()}));J(()=>W({dataPoints:G([U(Sl),H()]).optional()}));var Sl=J(()=>W({attributes:G([U(dl),H()]).optional(),startTimeUnixNano:G([B(),H()]).optional(),timeUnixNano:G([B(),H()]).optional(),count:G([B(),V(),H()]).optional(),sum:G([V(),H()]).optional(),quantileValues:G([U(ol),H()]).optional(),flags:G([V(),H()]).optional()})),Cl=W({quantile:G([V(),H()]).optional(),value:G([V(),H()]).optional()}),wl=W({offset:G([V(),H()]).optional(),bucketCounts:G([U(G([B(),V()])),H()]).optional()}),Tl=J(()=>W({filteredAttributes:G([U(dl),H()]).optional(),timeUnixNano:G([B(),H()]).optional(),asDouble:G([V(),H()]).optional(),asInt:G([B(),H()]).optional(),spanId:G([B(),H()]).optional(),traceId:B().optional()})),El=J(()=>W({attributes:G([U(dl),H()]).optional(),startTimeUnixNano:G([B(),H()]).optional(),timeUnixNano:G([B(),H()]).optional(),asDouble:G([V(),H()]).optional(),asInt:G([B(),H()]).optional(),exemplars:G([U(Tl),H()]).optional(),flags:G([V(),H()]).optional()})),Dl=J(()=>W({attributes:G([U(dl),H()]).optional(),startTimeUnixNano:G([B(),H()]).optional(),timeUnixNano:G([B(),H()]).optional(),count:G([B(),V(),H()]).optional(),sum:G([V(),H()]).optional(),bucketCounts:G([U(G([B(),V()])),H()]).optional(),explicitBounds:G([U(V()),H()]).optional(),exemplars:G([U(Tl),H()]).optional(),flags:G([V(),H()]).optional(),min:G([V(),H()]).optional(),max:G([V(),H()]).optional()})),Ol=J(()=>W({attributes:G([U(dl),H()]).optional(),startTimeUnixNano:G([B(),H()]).optional(),timeUnixNano:G([B(),H()]).optional(),count:G([B(),V(),H()]).optional(),sum:G([V(),H()]).optional(),scale:G([V(),H()]).optional(),zeroCount:G([B(),V(),H()]).optional(),positive:G([wl,H()]).optional(),negative:G([wl,H()]).optional(),flags:G([V(),H()]).optional(),exemplars:G([U(Tl),H()]).optional(),min:G([V(),H()]).optional(),max:G([V(),H()]).optional(),zeroThreshold:G([V(),H()]).optional()})),kl=J(()=>W({attributes:G([U(dl),H()]).optional(),startTimeUnixNano:G([B(),H()]).optional(),timeUnixNano:G([B(),H()]).optional(),count:G([B(),V(),H()]).optional(),sum:G([V(),H()]).optional(),quantileValues:G([U(Cl),H()]).optional(),flags:G([V(),H()]).optional()})),Al=J(()=>W({dataPoints:G([U(El),H()]).optional()})),jl=J(()=>W({dataPoints:G([U(El),H()]).optional(),aggregationTemporality:G([al,H()]).optional(),isMonotonic:G([Hs(),H()]).optional()})),Ml=J(()=>W({dataPoints:G([U(Dl),H()]).optional(),aggregationTemporality:G([al,H()]).optional()})),Nl=J(()=>W({dataPoints:G([U(Ol),H()]).optional(),aggregationTemporality:G([al,H()]).optional()})),Pl=J(()=>W({dataPoints:G([U(kl),H()]).optional()})),Fl=J(()=>W({name:G([B(),H()]).optional(),description:G([B(),H()]).optional(),unit:G([B(),H()]).optional(),gauge:G([Al,H()]).optional(),sum:G([jl,H()]).optional(),histogram:G([Ml,H()]).optional(),exponentialHistogram:G([Nl,H()]).optional(),summary:G([Pl,H()]).optional(),metadata:G([U(dl),H()]).optional()})),Il=J(()=>W({scope:G([fl,H()]).optional(),metrics:G([U(Fl),H()]).optional(),schemaUrl:G([B(),H()]).optional()})),Ll=J(()=>W({resource:G([pl,H()]).optional(),scopeMetrics:G([U(Il),H()]).optional(),schemaUrl:G([B(),H()]).optional()}));J(()=>W({resourceMetrics:G([U(Ll),H()]).optional()}));var Rl=Fc({logsDataFilterSchema:()=>Vl,metricsDataFilterSchema:()=>Hl,traceSummariesFilterSchema:()=>Ul,traceSummaryRowSchema:()=>Gl,traceSummaryServiceSchema:()=>Wl,tracesDataFilterSchema:()=>Bl}),zl=B().regex(/^\d+$/,`Expected nanoseconds as a digit-only string`),Bl=W({traceId:B().optional().describe(`Unique identifier for a trace. All spans from the same trace share the same trace_id. The ID is a 16-byte array.`),spanId:B().optional().describe(`Unique identifier for a span within a trace. The ID is an 8-byte array.`),parentSpanId:B().optional().describe(`The span_id of this span's parent span. Empty if this is a root span.`),serviceName:B().optional().describe(`Service name from resource attributes (service.name).`),spanName:B().optional().describe(`Description of the span's operation. E.g., qualified method name or file name with line number.`),spanKind:B().optional().describe(`Type of span (INTERNAL, SERVER, CLIENT, PRODUCER, CONSUMER). Used to identify relationships between spans.`),statusCode:B().optional().describe(`Status code (UNSET, OK, ERROR).`),scopeName:B().optional().describe(`Name denoting the instrumentation scope.`),timestampMin:zl.optional().describe(`Minimum start time of the span. UNIX Epoch time in nanoseconds since 00:00:00 UTC on 1 January 1970. Expressed as string in JSON.`),timestampMax:zl.optional().describe(`Maximum start time of the span. UNIX Epoch time in nanoseconds since 00:00:00 UTC on 1 January 1970. Expressed as string in JSON.`),durationMin:zl.optional().describe(`Minimum duration of the span in nanoseconds (end_time - start_time). Expressed as string in JSON.`),durationMax:zl.optional().describe(`Maximum duration of the span in nanoseconds (end_time - start_time). Expressed as string in JSON.`),spanAttributes:oc(B(),B()).optional().describe(`Key/value pairs describing the span.`),resourceAttributes:oc(B(),B()).optional().describe(`Attributes that describe the resource.`),eventsAttributes:oc(B(),B()).optional().describe(`Attribute key/value pairs on the event.`),linksAttributes:oc(B(),B()).optional().describe(`Attribute key/value pairs on the link.`),limit:V().int().positive().max(1e3).optional().describe(`Max items to return. Default determined by datasource.`),cursor:B().optional().describe(`Opaque cursor from previous response for next page.`),sortOrder:K([`ASC`,`DESC`]).optional().describe(`Sort by timestamp. ASC = oldest first, DESC = newest first.`)}),Vl=W({traceId:B().optional().describe(`Unique identifier for a trace. All logs from the same trace share the same trace_id. The ID is a 16-byte array.`),spanId:B().optional().describe(`Unique identifier for a span within a trace. The ID is an 8-byte array.`),serviceName:B().optional().describe(`Service name from resource attributes (service.name).`),scopeName:B().optional().describe(`Name denoting the instrumentation scope.`),eventName:B().optional().describe(`A unique identifier of event category/type. Filters logs that are events with this name.`),severityText:B().optional().describe(`Severity text (also known as log level). Original string representation as known at the source.`),severityNumberMin:V().optional().describe(`Minimum severity number (inclusive). Normalized to values described in Log Data Model.`),severityNumberMax:V().optional().describe(`Maximum severity number (inclusive). Normalized to values described in Log Data Model.`),bodyContains:B().optional().describe(`Filter logs where body contains this substring.`),timestampMin:zl.optional().describe(`Minimum time when the event occurred. UNIX Epoch time in nanoseconds since 00:00:00 UTC on 1 January 1970. Expressed as string in JSON.`),timestampMax:zl.optional().describe(`Maximum time when the event occurred. UNIX Epoch time in nanoseconds since 00:00:00 UTC on 1 January 1970. Expressed as string in JSON.`),logAttributes:oc(B(),B()).optional().describe(`Additional attributes that describe the specific event occurrence.`),resourceAttributes:oc(B(),B()).optional().describe(`Attributes that describe the resource.`),scopeAttributes:oc(B(),B()).optional().describe(`Attributes of the instrumentation scope.`),limit:V().int().positive().max(1e3).optional().describe(`Max items to return. Default determined by datasource.`),cursor:B().optional().describe(`Opaque cursor from previous response for next page.`),sortOrder:K([`ASC`,`DESC`]).optional().describe(`Sort by timestamp. ASC = oldest first, DESC = newest first.`)}),Hl=W({metricType:K([`Gauge`,`Sum`,`Histogram`,`ExponentialHistogram`,`Summary`]).describe(`Metric type to query.`),metricName:B().optional().describe(`The name of the metric.`),serviceName:B().optional().describe(`Service name from resource attributes (service.name).`),scopeName:B().optional().describe(`Name denoting the instrumentation scope.`),timeUnixMin:zl.optional().describe(`Minimum time when the data point was recorded. UNIX Epoch time in nanoseconds. Expressed as string in JSON.`),timeUnixMax:zl.optional().describe(`Maximum time when the data point was recorded. UNIX Epoch time in nanoseconds. Expressed as string in JSON.`),attributes:oc(B(),B()).optional().describe(`Key/value pairs that uniquely identify the timeseries.`),resourceAttributes:oc(B(),B()).optional().describe(`Attributes that describe the resource.`),scopeAttributes:oc(B(),B()).optional().describe(`Attributes of the instrumentation scope.`),aggregate:K([`sum`,`avg`,`min`,`max`,`count`]).optional().describe(`Aggregation function to apply to metric values. When set, returns aggregated results instead of raw data points.`),groupBy:U(B()).optional().describe(`Attribute keys to group by when aggregating (e.g. ['tenant.id', 'signal']).`),limit:V().int().positive().max(1e3).optional().describe(`Max items to return. Default determined by datasource.`),cursor:B().optional().describe(`Opaque cursor from previous response for next page.`),sortOrder:K([`ASC`,`DESC`]).optional().describe(`Sort by timestamp. ASC = oldest first, DESC = newest first.`)}).refine(e=>!(e.groupBy&&!e.aggregate),{message:`groupBy requires aggregate to be set`,path:[`groupBy`]}).refine(e=>!(e.aggregate&&e.cursor),{message:`cursor is incompatible with aggregate`,path:[`cursor`]}).refine(e=>!e.aggregate||e.metricType===`Gauge`||e.metricType===`Sum`,{message:`aggregate is only supported for Gauge and Sum metric types`,path:[`aggregate`]}),Ul=W({serviceName:B().optional(),spanName:B().optional(),timestampMin:zl.optional(),timestampMax:zl.optional(),durationMin:zl.optional(),durationMax:zl.optional(),spanAttributes:oc(B(),B()).optional(),resourceAttributes:oc(B(),B()).optional(),limit:V().int().min(1).max(1e3).default(20),cursor:B().optional(),sortOrder:K([`ASC`,`DESC`]).default(`DESC`)}),Wl=W({name:B(),count:V(),hasError:Hs()}),Gl=W({traceId:B(),rootServiceName:B(),rootSpanName:B(),startTimeNs:B(),durationNs:B(),spanCount:V(),errorCount:V(),services:U(Wl)}),Kl=Fc({createDashboardParams:()=>Xl,dashboardSchema:()=>Yl,regexSemverNumberedGroups:()=>ql,searchDashboardsFilter:()=>Zl,semverSchema:()=>Jl}),ql=/^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$/,Jl=B().regex(ql).brand(),Yl=W({name:B(),id:B(),createdAt:Nc(),metadata:oc(B(),qs()),uiTreeVersion:Jl,uiTree:$s({}).describe(`free-form object representing a uiTree to be rendered by @kopai/ui`)}),Xl=W({name:B(),metadata:oc(B(),qs()).optional().default({}),uiTreeVersion:Jl,uiTree:$s({}).describe(`free-form object representing a uiTree to be rendered by @kopai/ui`)}),Zl=W({name:B().optional(),createdAtMin:Nc().optional(),createdAtMax:Nc().optional(),uiTreeVersion:Jl.optional(),uiTreeVersionCompatible:Jl.optional(),metadata:oc(B(),B()).optional(),limit:V().int().min(1).max(1e3).optional().default(100),cursor:B().optional(),sortOrder:K([`ASC`,`DESC`]).optional().default(`DESC`)}),Ql=Fc({HavingExpr:()=>Lu,KopaiQuery:()=>Qu,LogAggregateQuerySchema:()=>Ju,LogAttrContainer:()=>cu,LogColumn:()=>Cu,LogRawQuerySchema:()=>Yu,METRIC_STRUCTURAL_COLUMNS_BY_TYPE:()=>cd,METRIC_TYPES:()=>ad,MODES:()=>td,MetricAggregateQuerySchema:()=>Xu,MetricAttrContainer:()=>lu,MetricColumn:()=>wu,MetricRawQuerySchema:()=>Zu,NUMERIC_STRUCTURAL_COLUMNS:()=>od,NumericOp:()=>ku,SIGNALS:()=>ed,Signal:()=>ou,TimeDimension:()=>Hu,TraceAggregateQuerySchema:()=>Ku,TraceAttrContainer:()=>su,TraceColumn:()=>Su,TraceRawQuerySchema:()=>qu,assertColumnPartition:()=>bu,branchSchemaFor:()=>id,durationStringToNanos:()=>ru,isDurationString:()=>nu,isQueryMode:()=>rd,isSignal:()=>nd}),$l=/^[1-9]\d*[smhdw]$/,eu=B().regex($l,{error:`Duration must be a positive integer > 0 + unit (s,m,h,d,w) — e.g. "30s", "2h", "7d".`}).describe(`Duration string: positive integer > 0 + unit suffix. Units: s=seconds, m=minutes, h=hours, d=days, w=weeks. Examples: "30s", "30m", "2h", "7d", "2w".`),tu={s:1e9,m:6e10,h:36e11,d:864e11,w:6048e11};function nu(e){return $l.test(e)}function ru(e){return $l.test(e)?Number(e.slice(0,-1))*(tu[e.slice(-1)]??0):e}var iu=B().regex(/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(\.\d+)?Z$/,{error:`Must be ISO 8601 UTC datetime — e.g. "2024-01-01T00:00:00.000Z".`}).describe(`ISO 8601 UTC datetime. Example: "2024-01-01T00:00:00.000Z". Millisecond precision is sufficient.`),au=B().regex(/^[A-Za-z_][A-Za-z0-9_]*$/,{error:`Alias must start with a letter or underscore and contain only letters, digits, and underscores — e.g. p95_duration, error_count, requests_per_second.`}).describe(`Alias for the measure in result rows. Must be unique within the query and match /^[A-Za-z_][A-Za-z0-9_]*$/. Use snake_case — e.g. p95_duration, error_count, requests_per_second.`),ou=K([`traces`,`logs`,`metrics`]),su=K([`SpanAttributes`,`ResourceAttributes`]).describe(`Attribute map on a trace row. SpanAttributes = span-specific; ResourceAttributes = process/host/service attrs.`),cu=K([`LogAttributes`,`ResourceAttributes`,`ScopeAttributes`]).describe(`Attribute map on a log row. LogAttributes = record-specific; ResourceAttributes = process/host/service attrs; ScopeAttributes = instrumentation scope.`),lu=K([`Attributes`,`ResourceAttributes`,`ScopeAttributes`]).describe(`Attribute map on a metric data point. Attributes = data-point attrs; ResourceAttributes = process/host/service; ScopeAttributes = instrumentation scope.`),uu=`service.name,service.namespace,service.version,service.instance.id,deployment.environment.name,host.name,host.id,host.arch,host.type,host.ip,container.id,container.name,container.image.name,container.image.tag,container.runtime,k8s.cluster.name,k8s.cluster.uid,k8s.namespace.name,k8s.node.name,k8s.node.uid,k8s.pod.name,k8s.pod.uid,k8s.container.name,k8s.container.restart_count,k8s.deployment.name,k8s.deployment.uid,k8s.statefulset.name,k8s.statefulset.uid,k8s.daemonset.name,k8s.daemonset.uid,k8s.job.name,k8s.job.uid,k8s.cronjob.name,k8s.cronjob.uid,k8s.replicaset.name,k8s.replicaset.uid,cloud.provider,cloud.region,cloud.availability_zone,cloud.account.id,cloud.platform,cloud.resource_id,process.pid,process.executable.name,process.command,process.command_line,process.runtime.name,process.runtime.version,process.runtime.description,telemetry.sdk.name,telemetry.sdk.version,telemetry.sdk.language,telemetry.distro.name,telemetry.distro.version,os.type,os.name,os.version,os.description`.split(`,`),du=`http.request.method,http.request.method_original,http.response.status_code,http.route,http.request.resend_count,url.full,url.path,url.scheme,url.query,url.fragment,server.address,server.port,client.address,client.port,network.protocol.name,network.protocol.version,network.transport,network.type,network.peer.address,network.peer.port,network.local.address,network.local.port,user_agent.original,db.system.name,db.namespace,db.collection.name,db.operation.name,db.operation.batch.size,db.query.text,db.query.summary,db.response.status_code,db.stored_procedure.name,rpc.system.name,rpc.service,rpc.method,rpc.method_original,rpc.response.status_code,rpc.grpc.status_code,messaging.system,messaging.destination.name,messaging.operation.type,messaging.message.id,messaging.message.body.size,gen_ai.system,gen_ai.operation.name,gen_ai.request.model,gen_ai.response.model,gen_ai.usage.input_tokens,gen_ai.usage.output_tokens,exception.type,exception.message,exception.stacktrace,error.type,code.function.name,code.namespace,code.file.path,code.line.number,code.stacktrace,thread.id,thread.name,enduser.id,enduser.role`.split(`,`),fu=`log.level,log.file.name,log.file.path,log.iostream,log.record.uid,exception.type,exception.message,exception.stacktrace,error.type,code.function.name,code.namespace,code.file.path,code.line.number,code.stacktrace,thread.id,thread.name,http.request.method,http.response.status_code,http.route,url.full,url.path,client.address,server.address,user_agent.original,gen_ai.system,gen_ai.operation.name,gen_ai.request.model,gen_ai.response.model,enduser.id,enduser.role`.split(`,`),pu=[`http.request.method`,`http.response.status_code`,`http.route`,`server.address`,`server.port`,`url.scheme`,`network.protocol.name`,`network.protocol.version`,`db.system.name`,`db.namespace`,`db.collection.name`,`db.operation.name`,`rpc.system.name`,`rpc.service`,`rpc.method`,`messaging.system`,`messaging.destination.name`,`messaging.operation.type`,`error.type`],mu=[`SpanId`,`TraceId`,`ParentSpanId`,`Timestamp`,`Duration`,`SpanKind`,`SpanName`,`StatusCode`,`StatusMessage`,`TraceState`,`ScopeName`,`ScopeVersion`],hu=[`Timestamp`,`Body`,`EventName`,`SeverityNumber`,`SeverityText`,`SpanId`,`TraceId`,`TraceFlags`,`ScopeName`,`ScopeVersion`,`ScopeSchemaUrl`,`ResourceSchemaUrl`],gu=`TimeUnix,StartTimeUnix,MetricName,MetricDescription,MetricUnit,MetricType,ScopeName,ScopeVersion,ScopeSchemaUrl,ResourceSchemaUrl,Value,Count,Sum,Min,Max,AggregationTemporality,IsMonotonic,Flags,Scale,ZeroCount,BucketCounts,ExplicitBounds,PositiveBucketCounts,PositiveOffset,NegativeBucketCounts,NegativeOffset,ValueAtQuantiles.Quantile,ValueAtQuantiles.Value`.split(`,`),_u=new Set([`SpanAttributes`,`ResourceAttributes`,`ServiceName`,`Events.Attributes`,`Events.Name`,`Events.Timestamp`,`Links.Attributes`,`Links.SpanId`,`Links.TraceId`,`Links.TraceState`]),vu=new Set([`LogAttributes`,`ResourceAttributes`,`ScopeAttributes`,`ServiceName`]),yu=new Set([`Attributes`,`ResourceAttributes`,`ScopeAttributes`,`ServiceName`,`ScopeDroppedAttrCount`,`ZeroThreshold`,`Exemplars.FilteredAttributes`,`Exemplars.SpanId`,`Exemplars.TimeUnix`,`Exemplars.TraceId`,`Exemplars.Value`]);function bu(e,t,n,r){let i=new Set(n),a=t.filter(e=>!i.has(e)&&!r.has(e));if(a.length>0)throw Error(`kopai-query: ${e} storage schema has unaccounted field(s) ${JSON.stringify(a)}. Add to STRUCTURAL or EXCLUDED list.`);let o=new Set(t),s=n.filter(e=>!o.has(e));if(s.length>0)throw Error(`kopai-query: ${e} STRUCTURAL contains stale field(s) ${JSON.stringify(s)} not in storage schema.`);let c=n.filter(e=>r.has(e));if(c.length>0)throw Error(`kopai-query: ${e} field(s) ${JSON.stringify(c)} appear in BOTH STRUCTURAL and EXCLUDED (XOR violated). Remove from one list.`)}function xu(){let e=[{name:`traces`,schemaKeys:Object.keys(Rc.shape),structural:mu,excluded:_u},{name:`logs`,schemaKeys:Object.keys(zc.shape),structural:hu,excluded:vu},{name:`metrics`,schemaKeys:[...new Set(Kc.options.flatMap(e=>Object.keys(e.shape)))],structural:gu,excluded:yu}];for(let{name:t,schemaKeys:n,structural:r,excluded:i}of e)bu(t,n,r,i);let t=Object.keys(Bc.shape),n=new Set(gu),r=t.filter(e=>!n.has(e)&&!yu.has(e));if(r.length>0)throw Error(`kopai-query: metricsBaseSchema has unaccounted field(s) ${JSON.stringify(r)}.`)}xu();var Su=K([...mu,...uu,...du]).describe(`Trace column. PascalCase = structural OTel schema field; dotted = OTel semantic-convention attribute. Use the { container, key } form for any non-semantic-convention attribute.`),Cu=K([...hu,...uu,...fu]).describe(`Log column. PascalCase = structural OTel schema field; dotted = OTel semantic-convention attribute. Use the { container, key } form for any non-semantic-convention attribute.`),wu=K([...gu,...uu,...pu]).describe(`Metric column. PascalCase = structural OTel schema field; dotted = OTel semantic-convention attribute. MetricType-specific structural columns (Sum/Count/Min/Max on Histogram, Value on Gauge/Sum) require an equivalent filter on MetricType. Use the { container, key } form for any non-semantic-convention attribute.`),Tu=e=>Qs({container:e,key:B().min(1).describe(`Attribute key inside the container, as stored in OTel. Example: "http.route", "service.version".`)}).describe(`Reference to a value inside a nested OTel attribute map. Use this for any attribute not exposed as a top-level column.`),Eu=G([Su,Tu(su)]).describe(`Trace column reference. Either a top-level column name (string) or a nested attribute reference (object).`),Du=G([Cu,Tu(cu)]).describe(`Log column reference. Either a top-level column name (string) or a nested attribute reference (object).`),Ou=G([wu,Tu(lu)]).describe(`Metric column reference. Either a top-level column name (string) or a nested attribute reference (object).`),ku=K([`SUM`,`AVG`,`MIN`,`MAX`,`P50`,`P75`,`P90`,`P95`,`P99`,`P999`,`RATE_AVG`,`RATE_SUM`,`RATE_MAX`]).describe(`Aggregation that requires a numeric column. RATE_* divides the aggregate by the time-bucket width. NOTE: the percentile ops (P50–P999) are supported only on the ClickHouse backend; the SQLite backend rejects them with a validation error.`),Au=G([Qs({op:q(`COUNT`),as:au}).describe(`Row count over the matched span set.`),Qs({op:q(`ERROR_RATE`),as:au}).describe(`Fraction of spans with StatusCode=ERROR. Result is in [0, 1].`),Qs({op:q(`THROUGHPUT`),as:au}).describe(`Spans per second over the time bucket (or the full window if output=summary).`),Qs({op:q(`COUNT_DISTINCT`),column:Eu,as:au}).describe("Approximate count of distinct non-null values of the column (HyperLogLog-style — backed by ClickHouse `uniq`). Use COUNT with a filter if exact deduplication is required."),Qs({op:ku,column:Eu,as:au}).describe(`Numeric aggregation. Column must be numeric (e.g. Duration, or a numeric attribute).`)]).describe(`Aggregation expression for the traces signal.`),ju=G([Qs({op:q(`COUNT`),as:au}).describe(`Row count over the matched log set.`),Qs({op:q(`COUNT_DISTINCT`),column:Du,as:au}).describe("Approximate count of distinct non-null values of the column (HyperLogLog-style — backed by ClickHouse `uniq`). Use COUNT with a filter if exact deduplication is required."),Qs({op:ku,column:Du,as:au}).describe(`Numeric aggregation. Column must be numeric (e.g. SeverityNumber, or a numeric attribute).`)]).describe(`Aggregation expression for the logs signal.`),Mu=G([Qs({op:q(`COUNT`),as:au}).describe(`Row count over the matched metric data-point set.`),Qs({op:q(`COUNT_DISTINCT`),column:Ou,as:au}).describe("Approximate count of distinct non-null values of the column (HyperLogLog-style — backed by ClickHouse `uniq`). Use COUNT with a filter if exact deduplication is required."),Qs({op:ku,column:Ou,as:au}).describe(`Numeric aggregation. For heterogeneous MetricType, filter by MetricType so the chosen column exists for every matched row.`)]).describe(`Aggregation expression for the metrics signal.`),Nu=e=>{let t=nc(`op`,[Qs({column:e,op:K([`eq`,`neq`]),value:G([B(),V(),Hs()])}),Qs({column:e,op:K([`contains`,`notContains`,`startsWith`,`endsWith`]),value:B()}),Qs({column:e,op:K([`gt`,`gte`,`lt`,`lte`]),value:V()}),Qs({column:e,op:K([`in`,`notIn`]),values:G([U(B()).min(1),U(V()).min(1)]).describe(`Non-empty array of match values. All elements must be the same type — either all strings or all numbers.`)}),Qs({column:e,op:K([`isNull`,`isNotNull`])})]).describe("Leaf filter on a column. Discriminated on `op`: eq/neq accept string|number|boolean; contains/notContains/startsWith/endsWith require a string; gt/gte/lt/lte require a number; in/notIn take a non-empty `values` array whose elements are all strings or all numbers (mixed arrays are rejected); isNull/isNotNull take no value."),n=J(()=>G([t,Qs({and:U(n).min(1)}).describe(`All children must match (AND).`),Qs({or:U(n).min(1)}).describe(`Any child matches (OR).`)]));return n},Pu=Nu(Eu),Fu=Nu(Du),Iu=Nu(Ou),Lu=Qs({measure:B().min(1).describe("Alias of a measure defined in this query's `measures` array."),op:K([`eq`,`neq`,`gt`,`gte`,`lt`,`lte`]),value:V()}).describe(`Post-aggregation filter. Applied after grouping — equivalent to SQL HAVING. Use only when filtering on a measure's value (e.g. error_count > 100).`),Ru=e=>nc(`type`,[Qs({type:q(`dimension`),column:e,direction:K([`asc`,`desc`])}),Qs({type:q(`measure`),alias:B().min(1).describe("Alias of a measure defined in this query's `measures` array."),direction:K([`asc`,`desc`])})]).describe("Sort key. In aggregate mode a dimension column must also appear in `dimensions`, and a measure alias must match one declared in `measures`. In raw mode any structural column is sortable (the backend returns the full denormalized row regardless of `dimensions`); measure-typed sort is not allowed."),zu=Ru(Eu),Bu=Ru(Du),Vu=Ru(Ou),Hu=nc(`type`,[Qs({type:q(`relative`),lookback:eu.describe(`Window length ending now. Example: "2h" = the last 2 hours.`)}).describe(`Relative time window ending at query time.`),Qs({type:q(`absolute`),startTime:iu.describe(`Window start (inclusive).`),endTime:iu.describe(`Window end (exclusive).`)}).describe(`Absolute time window with fixed ISO datetimes.`)]).describe(`Time window for the query. Required on every query — bounds the rows scanned and (for time-series output) the bucketing range.`),Uu=nc(`type`,[Qs({type:q(`summary`)}).describe(`Single aggregated value per group, across the entire time window.`),Qs({type:q(`timeSeries`),granularity:eu.describe(`Bucket width. Example: "5m" = 5-minute buckets across the time window.`)}).describe("Bucketed time-series. One row per (group, bucket). Adds a `bucket_start` ISO datetime to each result row.")]).describe(`Shape of the aggregate result. summary = one row per group; timeSeries = one row per (group, bucket).`),Wu=V().int().min(1).max(1e4).optional().describe(`Maximum rows to return. Server applies a default if omitted. Hard cap = 10000.`),Gu=B().optional().describe(`Opaque pagination token for raw mode. Omit on the first page; pass the value returned by the previous response to fetch the next page. Cursor is bound to the original query parameters — do not mutate the query between pages.`),Ku=Qs({signal:q(`traces`),mode:q(`aggregate`),measures:U(Au).min(1).describe(`One or more aggregations to compute.`),dimensions:U(Eu).optional().describe(`GROUP BY columns. Omit for a single aggregated row across all matched spans.`),filters:U(Pu).optional().describe(`Pre-aggregation filters. Multiple entries are combined with AND. Use a logical filter to express OR.`),havings:U(Lu).optional().describe(`Post-aggregation filters on measure aliases. Combined with AND.`),timeDimension:Hu,orderBy:U(zu).optional().describe(`Sort keys applied in array order.`),output:Uu,limit:Wu}).describe(`Aggregate query over traces (spans).`),qu=Qs({signal:q(`traces`),mode:q(`raw`),dimensions:U(Eu).optional().describe(`Optional projection. Omit to return the full denormalized OTel row (structural columns + attribute maps). When provided, the server may narrow the SELECT — but result rows still match the denormalized OTel shape.`),filters:U(Pu).optional(),timeDimension:Hu,orderBy:U(zu).optional(),limit:Wu,cursor:Gu}).describe(`Raw span search. Returns denormalized OTel trace rows — no aggregation.`),Ju=Qs({signal:q(`logs`),mode:q(`aggregate`),measures:U(ju).min(1),dimensions:U(Du).optional().describe(`GROUP BY columns. Omit for a single aggregated row across all matched log records.`),filters:U(Fu).optional(),havings:U(Lu).optional(),timeDimension:Hu,orderBy:U(Bu).optional(),output:Uu,limit:Wu}).describe(`Aggregate query over logs.`),Yu=Qs({signal:q(`logs`),mode:q(`raw`),dimensions:U(Du).optional().describe(`Optional projection. Omit to return the full denormalized OTel row (structural columns + attribute maps). When provided, the server may narrow the SELECT — but result rows still match the denormalized OTel shape.`),filters:U(Fu).optional(),timeDimension:Hu,orderBy:U(Bu).optional(),limit:Wu,cursor:Gu}).describe(`Raw log search. Returns denormalized OTel log rows — no aggregation.`),Xu=Qs({signal:q(`metrics`),mode:q(`aggregate`),measures:U(Mu).min(1),dimensions:U(Ou).optional().describe(`GROUP BY columns. Omit for a single aggregated row across all matched data points.`),filters:U(Iu).optional(),havings:U(Lu).optional(),timeDimension:Hu,orderBy:U(Vu).optional(),output:Uu,limit:Wu}).describe(`Aggregate query over metrics data points.`),Zu=Qs({signal:q(`metrics`),mode:q(`raw`),dimensions:U(Ou).optional().describe(`Optional projection. Omit to return the full denormalized OTel row (structural columns + attribute maps). When provided, the server may narrow the SELECT — but result rows still match the denormalized OTel shape.`),filters:U(Iu).optional(),timeDimension:Hu,orderBy:U(Vu).optional(),limit:Wu,cursor:Gu}).describe(`Raw metric data-point search. Returns denormalized OTel metric rows — no aggregation.`),Qu=G([Ku,qu,Ju,Yu,Xu,Zu]).describe("Telemetry query. Pick `signal` (traces/logs/metrics) and `mode` (aggregate/raw); the rest of the shape follows from that pair."),$u={traces:{aggregate:Ku,raw:qu},logs:{aggregate:Ju,raw:Yu},metrics:{aggregate:Xu,raw:Zu}},ed=ou.options,td=[`aggregate`,`raw`];function nd(e){return typeof e==`string`&&ed.includes(e)}function rd(e){return typeof e==`string`&&td.includes(e)}function id(e,t){if(nd(e)&&rd(t))return $u[e][t]}var ad=[`Gauge`,`Sum`,`Histogram`,`ExponentialHistogram`,`Summary`],od={traces:new Set([`Duration`]),logs:new Set([`SeverityNumber`,`TraceFlags`]),metrics:new Set([`Value`,`Count`,`Sum`,`Min`,`Max`,`Scale`,`ZeroCount`,`PositiveOffset`,`NegativeOffset`,`IsMonotonic`,`Flags`])};function sd(){let e=new Set(gu),t={Gauge:new Set,Sum:new Set,Histogram:new Set,ExponentialHistogram:new Set,Summary:new Set};for(let n of Kc.options){let r=n.shape.MetricType.value;t[r]=new Set(Object.keys(n.shape).filter(t=>e.has(t)))}return t}var cd=sd(),ld=8;function ud(e){return e?._zod?.def}function dd(e){let t=e;for(let e=0;t&&e<20;e++){let e=ud(t);if(e?.type===`optional`||e?.type===`nullable`||e?.type==="default"){t=e.innerType;continue}if(e?.type===`lazy`&&e.getter){t=e.getter();continue}return t}return t}function fd(e,t){let n=dd(e);for(let e of t)if(n=pd(n,e),!n)return;return n}function pd(e,t){let n=ud(e);if(n?.type===`object`)return dd(n.shape?.[String(t)]);if(n?.type===`array`)return dd(n.element);if(n?.type===`union`)return md(n.options??[],t)}function md(e,t){let n=[...new Set(e.map(e=>pd(dd(e),t)).filter(e=>!!e))];if(n.length<=1)return n[0];let r=n.map(vd);return r.every(e=>e?.length)?K([...new Set(r.flat())]):G(n)}function hd(e,t){let n=e;for(let e of t){if(typeof n!=`object`||!n)return;n=n[String(e)]}return n}function gd(e){let t=ud(dd(e))?.shape,n=new Map;if(!t)return n;for(let[e,r]of Object.entries(t)){let t=ud(dd(r));if(t?.type===`literal`){let r=t.values??[];r.length===1&&n.set(e,r[0])}}return n}function _d(e){let t=ud(dd(e));if(t?.type===`enum`)return Object.keys(t.entries??{})}function vd(e){let t=ud(dd(e));if(t?.type===`literal`){let e=(t.values??[]).filter(e=>typeof e==`string`);return e.length?e:void 0}return _d(e)}function yd(e){return e.length<=ld?e.map(e=>`"${e}"`).join(`, `):`${e.slice(0,ld).map(e=>`"${e}"`).join(`, `)} and ${e.length-ld} others`}function bd(e){return e.toLowerCase().replace(/[^a-z0-9]/g,``)}function xd(e,t){let n=bd(e);return t.find(e=>bd(e)===n)}function Sd(e,t){if(e===t)return!0;let[n,r]=e.length<=t.length?[e,t]:[t,e];if(r.length-n.length>1)return!1;let i=0;for(;i<n.length&&n[i]===r[i];)i++;let a=0;for(;a<n.length-i&&n[n.length-1-a]===r[r.length-1-a];)a++;let o=n.length-i-a;return r.length===n.length?o<=1||o===2&&n[i]===r[i+1]&&n[i+1]===r[i]:o===0}function Cd(e,t){let n=t.filter(t=>t!==e),r=xd(e,n);if(r)return r;let i=bd(e),a=n.filter(e=>Sd(i,bd(e)));return a.length===1?a[0]:void 0}function wd(e){let t=ud(dd(e));return t?t.type===`union`?[...new Set((t.options??[]).flatMap(e=>wd(e)))]:Object.keys(t.shape??{}):[]}function Td(e,t){let n=ud(dd(e));if(n?.type!==`union`)return e?[dd(e)]:[];let r=(n.options??[]).flatMap(e=>Td(e,t)),i=r.filter(e=>{if(Ad(e,t)===0)return!1;let n=ud(dd(e))?.shape??{};return Object.entries(n).every(([e,n])=>{let r=vd(n),i=hd(t,[e]);return!r||typeof i!=`string`||r.includes(i)})});return i.length?i:r}function Ed(e,t){let n=Td(e,t);return n.length?[...new Set(n.flatMap(wd))]:wd(e)}function Dd(e,t,n,r){let i=Ed(t,n);return e.map(e=>{let t=Cd(e,i),n=i.length?` Accepted keys here: ${yd(i)}.`:``;return{path:r?`${r}.${e}`:e,message:t?`Unknown key "${e}". Did you mean "${t}"?`:`Unknown key "${e}".${n}`}})}function Od(e,t){return vd(ud(dd(e))?.shape?.[t])??[]}function kd(e,t,n){if(!e.length)return;let r=e.map(e=>new Set(e.issues.filter(e=>e.path.length===1).map(e=>String(e.path[0])))).reduce((e,t)=>new Set([...e].filter(e=>t.has(e))));if(r.size!==1)return;let i=[...r][0],a=[...new Set(e.flatMap(e=>Od(e.option,i)))];if(!a.length)return;let o=hd(t,[i]),s=xd(String(o),a);return{key:i,suggestion:s,issue:{path:n?`${n}.${i}`:i,message:s?`Unknown ${i} ${typeof o==`string`?`"${o}"`:String(o)}. Did you mean "${s}"?`:`Expected ${i} to be one of ${yd(a)}.`}}}function Ad(e,t){let n=ud(dd(e));if(n?.type===`union`)return Math.max(0,...(n.options??[]).map(e=>Ad(e,t)));let r=n?.shape;return!r||typeof t!=`object`||!t?0:Object.keys(t).filter(e=>e in r).length}function jd(e,t){return(ud(e)?.options??[]).map(e=>{let n=e.safeParse(t),r=n.success?[]:n.error.issues,i=gd(e);return{option:e,issues:r,wrongShape:r.some(e=>e.path.length===1&&i.has(String(e.path[0])))}})}function Md(e,t){let n=e.filter(e=>!e.wrongShape&&e.issues.length);if(n.length)return n.reduce((e,n)=>{let r=Ad(n.option,t)-Ad(e.option,t);return r===0?n.issues.length<e.issues.length?n:e:r>0?n:e})}function Nd(e,t,n,r){if(t===void 0)return{path:n,message:`Required. Expected one of ${yd(e)}.${r}`};let i=typeof t==`string`?xd(t,e):void 0,a=typeof t==`string`?`"${t}"`:String(t);return{path:n,message:i?`Unknown value ${a}. Did you mean "${i}"?`:`Unknown value ${a}. Expected one of ${yd(e)}.${r}`}}var Pd=12;function Fd(e,t,n,r,i,a){let o=new Set;for(let r of n){if(r.code!==`unrecognized_keys`)continue;let n=Ed(fd(e,r.path),hd(t,r.path));for(let e of r.keys??[]){let i=Cd(e,n);if(!i)continue;let a=[...r.path,i];hd(t,a)===void 0&&o.add(a.map(String).join(`.`))}}return n.flatMap(n=>{let s=[...r,...n.path].map(String).join(`.`);if(n.code!==`unrecognized_keys`&&o.has(n.path.map(String).join(`.`)))return[];let c=fd(e,n.path),l=hd(t,n.path),u=ud(c)?.type;if(n.code===`unrecognized_keys`&&n.keys?.length)return Dd(n.keys,c,l,s);if(c&&u===`union`&&i<Pd){let e=ud(c)?.options??[],t=e.some(e=>ud(dd(e))?.type===`object`)&&e.some(e=>_d(e)?.length)?` Use { container, key } for an attribute that is not a known column.`:a,o=jd(c,l),u=kd(o,l,s);if(u){let e=u.suggestion?o.find(e=>Od(e.option,u.key).includes(u.suggestion)):void 0,a=e?Fd(e.option,l,e.issues.filter(e=>e.path.length===0||String(e.path[0])!==u.key),[...r,...n.path],i+1,t):[];return[u.issue,...a]}let d=Md(o,l);if(d)return Fd(d.option,l,d.issues,[...r,...n.path],i+1,t)}if(c&&u===`enum`){let e=_d(c);if(e?.length)return[Nd(e,l,s,a)]}return[{path:s,message:n.message}]})}function Id(e,t,n){return Fd(e,t,n,[],0,``)}var Ld=Fc({KopaiQueryValidationError:()=>Rd,METRIC_TYPE_TO_TABLE:()=>tf,NUMBER_COMPARATOR_SQL:()=>ef,SPAN_KIND_NAMES:()=>Jd,STATUS_CODE_ERROR_LITERAL:()=>Zd,STATUS_CODE_NAMES:()=>qd,allStructuralColumns:()=>_f,assertMetricType:()=>af,collectFilterColumns:()=>vf,collectFilterLeaves:()=>yf,columnRefProjectionKey:()=>mf,compileTimeWindow:()=>Kd,durationToNanos:()=>Ud,extractMetricType:()=>Sf,findMetricTypePin:()=>xf,granularityToSeconds:()=>Wd,isMetricType:()=>rf,parseKopaiQuery:()=>wf,resolveColumn:()=>pf,spanKindName:()=>Xd,statusCodeName:()=>Yd,timeColumnForSignal:()=>Qd,validateKopaiQuery:()=>Cf}),Rd=class extends Error{constructor(e){super(e),this.name=`KopaiQueryValidationError`}},zd={s:1000000000n,m:60n*1000000000n,h:60n*60n*1000000000n,d:24n*60n*60n*1000000000n,w:7n*24n*60n*60n*1000000000n},Bd={s:1,m:60,h:3600,d:86400,w:604800};function Vd(e){return e===`s`||e===`m`||e===`h`||e===`d`||e===`w`}function Hd(e){let t=/^(\d+)([smhdw])$/.exec(e);if(!t||t[1]===void 0||t[2]===void 0||!Vd(t[2]))throw new Rd(`Invalid duration "${e}". Expected positive integer + unit (s,m,h,d,w).`);let n=BigInt(t[1]);if(n===0n)throw new Rd(`Invalid duration "${e}". Expected positive integer + unit (s,m,h,d,w).`);return{value:n,unit:t[2]}}function Ud(e){let{value:t,unit:n}=Hd(e);return t*zd[n]}function Wd(e){let{value:t,unit:n}=Hd(e);return Number(t)*Bd[n]}function Gd(e){let t=Date.parse(e);if(Number.isNaN(t))throw new Rd(`Invalid ISO datetime "${e}".`);return BigInt(t)*1000000n}function Kd(e,t=new Date){let n,r;if(e.type===`relative`)r=BigInt(t.getTime())*1000000n,n=r-Ud(e.lookback);else if(n=Gd(e.startTime),r=Gd(e.endTime),r<=n)throw new Rd(`Time window endTime (${e.endTime}) must be after startTime (${e.startTime}).`);return{startNs:n,endNs:r}}var qd=[`Unset`,`Ok`,`Error`],Jd=[`Unspecified`,`Internal`,`Server`,`Client`,`Producer`,`Consumer`];function Yd(e){return e===void 0?``:qd[e]??``}function Xd(e){return e===void 0?``:Jd[e]??``}var Zd=`Error`;function Qd(e){return e===`metrics`?`TimeUnix`:`Timestamp`}var $d={traces:new Set([`Timestamp`]),logs:new Set([`Timestamp`]),metrics:new Set([`TimeUnix`,`StartTimeUnix`])},ef={eq:`=`,neq:`<>`,gt:`>`,gte:`>=`,lt:`<`,lte:`<=`},tf={Gauge:`otel_metrics_gauge`,Sum:`otel_metrics_sum`,Histogram:`otel_metrics_histogram`,ExponentialHistogram:`otel_metrics_exponential_histogram`,Summary:`otel_metrics_summary`},nf=new Set(ad);function rf(e){return nf.has(e)}function af(e){if(!rf(e))throw new Rd(`Invalid MetricType "${e}". Expected one of: ${ad.join(`, `)}.`);return e}var of=/^[A-Z]/,sf=e=>new Set(e.filter(e=>of.test(e))),cf=sf(Su.options),lf=sf(Cu.options),uf=sf(wu.options),df=new Set(`service.name,service.namespace,service.version,service.instance.id,deployment.environment.name,host.name,host.id,host.arch,host.type,host.ip,container.id,container.name,container.image.name,container.image.tag,container.runtime,k8s.cluster.name,k8s.cluster.uid,k8s.namespace.name,k8s.node.name,k8s.node.uid,k8s.pod.name,k8s.pod.uid,k8s.container.name,k8s.container.restart_count,k8s.deployment.name,k8s.deployment.uid,k8s.statefulset.name,k8s.statefulset.uid,k8s.daemonset.name,k8s.daemonset.uid,k8s.job.name,k8s.job.uid,k8s.cronjob.name,k8s.cronjob.uid,k8s.replicaset.name,k8s.replicaset.uid,cloud.provider,cloud.region,cloud.availability_zone,cloud.account.id,cloud.platform,cloud.resource_id,process.pid,process.executable.name,process.command,process.command_line,process.runtime.name,process.runtime.version,process.runtime.description,telemetry.sdk.name,telemetry.sdk.version,telemetry.sdk.language,telemetry.distro.name,telemetry.distro.version,os.type,os.name,os.version,os.description`.split(`,`));function ff(e){switch(e){case`traces`:return`SpanAttributes`;case`logs`:return`LogAttributes`;case`metrics`:return`Attributes`}}function pf(e,t){return typeof t==`object`?{kind:`attribute`,container:t.container,key:t.key}:(e===`traces`?cf:e===`logs`?lf:uf).has(t)?{kind:`structural`,column:t}:{kind:`semconvAttr`,container:df.has(t)?`ResourceAttributes`:ff(e),key:t}}function mf(e){return typeof e==`string`?e:`${e.container}.${e.key}`}function hf(e){return typeof e==`string`?!0:typeof e!=`object`||!e?!1:`container`in e&&typeof e.container==`string`&&`key`in e&&typeof e.key==`string`}function gf(e,t){if(!hf(e))throw new Rd(`${t}: expected a column reference (string or {container, key}), got ${typeof e}.`);return mf(e)}function _f(e){return e===`traces`?[...cf]:e===`logs`?[...lf]:[...uf]}function vf(e){let t=[];if(!e)return t;for(let n of e)`and`in n?t.push(...vf(n.and)):`or`in n?t.push(...vf(n.or)):t.push(n.column);return t}function yf(e){let t=[];if(!e)return t;for(let n of e)`and`in n?t.push(...yf(n.and)):`or`in n?t.push(...yf(n.or)):t.push(n);return t}function bf(e){let t=[];if(e.dimensions&&t.push(...e.dimensions),t.push(...vf(e.filters)),e.mode===`aggregate`)for(let n of e.measures)`column`in n&&t.push(n.column);if(e.orderBy)for(let n of e.orderBy)n.type===`dimension`&&hf(n.column)&&t.push(n.column);return t}function xf(e,t){if(!e||e.length===0)return{kind:`none`};let n=null;for(let r of e){if(`and`in r||`or`in r){let e=`and`in r,i=xf(`and`in r?r.and:r.or,t&&e);if(i.kind===`ambiguous`)return i;if(i.kind===`pinned`){if(!t||!e)return{kind:`ambiguous`,reason:`MetricType filter inside an OR branch cannot pin the metric table. Place MetricType at the top level (AND).`};if(n!==null&&n!==i.value)return{kind:`ambiguous`,reason:`Conflicting MetricType filters (${n} vs ${i.value}).`};n=i.value}continue}if(r.column===`MetricType`){if(!t)return{kind:`ambiguous`,reason:`MetricType filter inside an OR branch cannot pin the metric table. Place MetricType at the top level (AND).`};if(r.op===`eq`&&typeof r.value==`string`){if(n!==null&&n!==r.value)return{kind:`ambiguous`,reason:`Conflicting MetricType filters (${n} vs ${r.value}).`};n=r.value}else if(r.op===`in`){if(r.values.length!==1)return{kind:`ambiguous`,reason:`v1 supports only a single MetricType per query (got ${String(r.values.length)} values).`};let e=r.values[0];if(typeof e!=`string`)return{kind:`ambiguous`,reason:`MetricType filter values must be strings (got ${typeof e}).`};if(n!==null&&n!==e)return{kind:`ambiguous`,reason:`Conflicting MetricType filters (${n} vs ${e}).`};n=e}else return{kind:`ambiguous`,reason:`MetricType filter must use op 'eq' (string value) or 'in' (single string value); got op '${r.op}'.`}}}return n===null?{kind:`none`}:{kind:`pinned`,value:n}}function Sf(e){if(e.signal!==`metrics`)throw new Rd(`extractMetricType called for a non-metric query.`);let t=xf(e.filters,!0);if(t.kind===`ambiguous`)throw new Rd(t.reason);if(t.kind===`none`)throw new Rd(`Metric query missing MetricType filter.`);return af(t.value)}function Cf(e){if(e.timeDimension.type===`absolute`){let{startTime:t,endTime:n}=e.timeDimension,r=Date.parse(t),i=Date.parse(n);if(Number.isNaN(r)||Number.isNaN(i))throw new Rd(`timeDimension.${Number.isNaN(r)?`startTime`:`endTime`} "${Number.isNaN(r)?t:n}" is not a valid ISO 8601 UTC datetime.`);if(r>=i)throw new Rd(`timeDimension.startTime "${t}" is not before endTime "${n}"; endTime is exclusive, so this window matches nothing. Swap the bounds if they are reversed.`)}if(e.signal===`metrics`){let t=xf(e.filters,!0);if(t.kind===`ambiguous`)throw new Rd(t.reason);if(t.kind===`none`)throw new Rd(`Metric queries require a MetricType filter at the top level, e.g. {column:'MetricType', op:'eq', value:'Gauge'}.`);let n=af(t.value),r=cd[n];for(let t of bf(e))if(typeof t==`string`&&t!==`MetricType`&&pf(`metrics`,t).kind===`structural`&&!r.has(t))throw new Rd(`Column "${t}" does not exist on MetricType "${n}". Structural columns available for ${n}: ${[...r].sort().join(`, `)}.`)}if(e.mode===`aggregate`){let t=new Set;for(let n of e.measures){if(t.has(n.as))throw new Rd(`Duplicate measure alias "${n.as}".`);t.add(n.as)}if(e.havings){for(let n of e.havings)if(!t.has(n.measure))throw new Rd(`having.measure "${n.measure}" does not match any measure alias.`)}if(e.orderBy){let n=new Set;for(let t of e.dimensions??[])n.add(mf(t));for(let r of e.orderBy)if(r.type===`measure`){if(!t.has(r.alias))throw new Rd(`orderBy measure "${r.alias}" does not match any measure alias.`)}else{let e=gf(r.column,`orderBy column`);if(!n.has(e))throw new Rd(`orderBy dimension "${e}" must appear in dimensions.`)}}}else if(e.orderBy){for(let t of e.orderBy)if(t.type===`measure`)throw new Rd(`orderBy measure is not allowed in raw mode.`)}if(e.signal!==`metrics`){let t=e.mode===`aggregate`?e.measures.flatMap(e=>`column`in e?[e.column]:[]):[],n=[...e.dimensions??[],...vf(e.filters),...t];for(let e of n)if(typeof e==`string`&&e===`MetricType`)throw new Rd(`Column "MetricType" is only valid on metric queries.`)}let t=new Set([...od[e.signal],...$d[e.signal]]);for(let n of yf(e.filters)){let r=n.column;if(typeof r!=`string`||r===`MetricType`||pf(e.signal,r).kind!==`structural`)continue;let i;switch(n.op){case`gt`:case`gte`:case`lt`:case`lte`:i=!0;break;case`eq`:case`neq`:i=typeof n.value==`number`;break;case`in`:case`notIn`:i=typeof n.values[0]==`number`;break;default:i=!1}if(i&&!t.has(r))throw new Rd(`Column "${r}" is not numeric; the "${n.op}" operator/value requires a numeric column. Use a string value, or choose a numeric column.`)}}function wf(e){if(typeof e!=`object`||!e||Array.isArray(e))return{ok:!1,issues:[{path:``,message:`Expected a query object.`}]};let{signal:t,mode:n}=e,r=[];if(nd(t)||r.push({path:`signal`,message:`Expected one of ${ed.join(`, `)}.`}),rd(n)||r.push({path:`mode`,message:`Expected one of ${td.join(`, `)}.`}),r.length>0)return{ok:!1,issues:r};let i=id(t,n);if(!i)return{ok:!1,issues:[{path:``,message:`No query shape for signal "${String(t)}" in "${String(n)}" mode.`}]};let a=i.safeParse(e);if(!a.success)return{ok:!1,issues:Id(i,e,a.error.issues)};try{Cf(a.data)}catch(e){return{ok:!1,issues:[{path:``,message:e instanceof Error?e.message:String(e)}]}}return{ok:!0,data:a.data}}var Tf=o((e=>{var t=Symbol.for(`react.transitional.element`),n=Symbol.for(`react.fragment`);function r(e,n,r){var i=null;if(r!==void 0&&(i=``+r),n.key!==void 0&&(i=``+n.key),`key`in n)for(var a in r={},n)a!==`key`&&(r[a]=n[a]);else r=n;return n=r.ref,{$$typeof:t,type:e,key:i,ref:n===void 0?null:n,props:r}}e.Fragment=n,e.jsx=r,e.jsxs=r})),Y=o(((e,t)=>{t.exports=Tf()}))(),Ef=v.createContext(void 0),Df=e=>{let t=v.useContext(Ef);if(e)return e;if(!t)throw Error(`No QueryClient set, use QueryClientProvider to set one`);return t},Of=({client:e,children:t})=>(v.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),(0,Y.jsx)(Ef.Provider,{value:e,children:t})),kf={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},Af=new class{#e=kf;setTimeoutProvider(e){this.#e=e}setTimeout(e,t){return this.#e.setTimeout(e,t)}clearTimeout(e){this.#e.clearTimeout(e)}setInterval(e,t){return this.#e.setInterval(e,t)}clearInterval(e){this.#e.clearInterval(e)}};function jf(e){setTimeout(e,0)}var Mf=typeof window>`u`||`Deno`in globalThis;function Nf(){}function Pf(e,t){return typeof e==`function`?e(t):e}function Ff(e){return typeof e==`number`&&e>=0&&e!==1/0}function If(e,t){return Math.max(e+(t||0)-Date.now(),0)}function Lf(e,t){return typeof e==`function`?e(t):e}function Rf(e,t){let{type:n=`all`,exact:r,fetchStatus:i,predicate:a,queryKey:o,stale:s}=e;if(o){if(r){if(t.queryHash!==Bf(o,t.options))return!1}else if(!Hf(t.queryKey,o))return!1}if(n!==`all`){let e=t.isActive();if(n===`active`&&!e||n===`inactive`&&e)return!1}return!(typeof s==`boolean`&&t.isStale()!==s||i&&i!==t.state.fetchStatus||a&&!a(t))}function zf(e,t){let{exact:n,status:r,predicate:i,mutationKey:a}=e;if(a){if(!t.options.mutationKey)return!1;if(n){if(Vf(t.options.mutationKey)!==Vf(a))return!1}else if(!Hf(t.options.mutationKey,a))return!1}return!(r&&t.state.status!==r||i&&!i(t))}function Bf(e,t){return(t?.queryKeyHashFn||Vf)(e)}function Vf(e){return JSON.stringify(e,(e,t)=>qf(t)?Object.keys(t).sort().reduce((e,n)=>(e[n]=t[n],e),{}):t)}function Hf(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(e&&t&&typeof e==`object`&&typeof t==`object`){if(Array.isArray(e)&&Array.isArray(t)){if(t.length>e.length)return!1;for(let n=0;n<t.length;n++)if(!Hf(e[n],t[n]))return!1;return!0}let n=Object.keys(t);for(let r of n)if(!Hf(e[r],t[r]))return!1;return!0}return!1}var Uf=Object.prototype.hasOwnProperty;function Wf(e,t,n=0){if(e===t)return e;if(n>500)return t;let r=Kf(e)&&Kf(t);if(!r&&!(qf(e)&&qf(t)))return t;let i=(r?e:Object.keys(e)).length,a=r?t:Object.keys(t),o=a.length,s=r?Array(o):{},c=0;for(let l=0;l<o;l++){let o=r?l:a[l],u=e[o],d=t[o];if(u===d){s[o]=u,(r?l<i:Uf.call(e,o))&&c++;continue}if(u===null||d===null||typeof u!=`object`||typeof d!=`object`){s[o]=d;continue}let f=Wf(u,d,n+1);s[o]=f,f===u&&c++}return i===o&&c===i?e:s}function Gf(e,t){if(!t||Object.keys(e).length!==Object.keys(t).length)return!1;for(let n in e)if(e[n]!==t[n])return!1;return!0}function Kf(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function qf(e){if(!Jf(e))return!1;let t=Object.getPrototypeOf(e),n=t?.constructor;if(n===void 0)return!0;if(typeof n!=`function`)return!1;let r=n.prototype;return!(!Jf(r)||!r.hasOwnProperty(`isPrototypeOf`)||t!==Object.prototype)}function Jf(e){return Object.prototype.toString.call(e)===`[object Object]`}function Yf(e){return new Promise(t=>{Af.setTimeout(t,e)})}function Xf(e,t,n){return typeof n.structuralSharing==`function`?n.structuralSharing(e,t):n.structuralSharing===!1?t:Wf(e,t)}function Zf(e,t,n=0){let r=[...e,t];return n&&r.length>n?r.slice(1):r}function Qf(e,t,n=0){let r=[t,...e];return n&&r.length>n?r.slice(0,-1):r}var $f=Symbol();function ep(e,t){return!e.queryFn&&t?.initialPromise?()=>t.initialPromise:!e.queryFn||e.queryFn===$f?()=>Promise.reject(Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function tp(e,t){return typeof e==`function`?e(...t):!!e}function np(e,t,n){let r=!1,i;return Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(i??=t(),r?i:(r=!0,i.aborted?n():i.addEventListener(`abort`,n,{once:!0}),i))}),e}var rp=()=>Mf,ip=()=>rp(),ap=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(e){return this.listeners.add(e),this.onSubscribe(),()=>{this.listeners.delete(e),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},op=new class extends ap{#e;#t;#n;constructor(){super(),this.#n=e=>{if(typeof window<`u`&&window.addEventListener){let t=()=>e();return window.addEventListener(`visibilitychange`,t,!1),()=>{window.removeEventListener(`visibilitychange`,t)}}}}onSubscribe(){this.#t||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#n=e,this.#t?.(),this.#t=e(e=>{typeof e==`boolean`?this.setFocused(e):this.onFocus()})}setFocused(e){this.#e!==e&&(this.#e=e,this.onFocus())}onFocus(){let e=this.isFocused();this.listeners.forEach(t=>{t(e)})}isFocused(){return typeof this.#e==`boolean`?this.#e:globalThis.document?.visibilityState!==`hidden`}},sp=jf;function cp(){let e=[],t=0,n=e=>{e()},r=e=>{e()},i=sp,a=r=>{t?e.push(r):i(()=>{n(r)})},o=()=>{let t=e;e=[],t.length&&i(()=>{r(()=>{t.forEach(e=>{n(e)})})})};return{batch:e=>{let n;t++;try{n=e()}finally{t--,t||o()}return n},batchCalls:e=>(...t)=>{a(()=>{e(...t)})},schedule:a,setNotifyFunction:e=>{n=e},setBatchNotifyFunction:e=>{r=e},setScheduler:e=>{i=e}}}var lp=cp(),up=new class extends ap{#e=!0;#t;#n;constructor(){super(),this.#n=e=>{if(typeof window<`u`&&window.addEventListener){let t=()=>e(!0),n=()=>e(!1);return window.addEventListener(`online`,t,!1),window.addEventListener(`offline`,n,!1),()=>{window.removeEventListener(`online`,t),window.removeEventListener(`offline`,n)}}}}onSubscribe(){this.#t||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#n=e,this.#t?.(),this.#t=e(this.setOnline.bind(this))}setOnline(e){this.#e!==e&&(this.#e=e,this.listeners.forEach(t=>{t(e)}))}isOnline(){return this.#e}};function dp(e){return Math.min(1e3*2**e,3e4)}function fp(e){return(e??`online`)!==`online`||up.isOnline()}var pp=class extends Error{constructor(e){super(`CancelledError`),this.revert=e?.revert,this.silent=e?.silent}};function mp(e){let t=!1,n=0,r,i=`pending`,a,o,s=new Promise((e,t)=>{a=e,o=t});s.catch(Nf);let c=()=>i!==`pending`,l=t=>{if(!c()){let n=new pp(t);h(n),e.onCancel?.(n)}},u=()=>{t=!0},d=()=>{t=!1},f=()=>op.isFocused()&&(e.networkMode===`always`||up.isOnline())&&e.canRun(),p=()=>fp(e.networkMode)&&e.canRun(),m=e=>{c()||(r?.(),i=`resolved`,a(e))},h=e=>{c()||(r?.(),i=`rejected`,o(e))},g=()=>new Promise(t=>{r=e=>{(c()||f())&&t(e)},e.onPause?.()}).then(()=>{r=void 0,c()||e.onContinue?.()}),_=()=>{if(c())return;let r,i=n===0?e.initialPromise:void 0;try{r=i??e.fn()}catch(e){r=Promise.reject(e)}Promise.resolve(r).then(m).catch(r=>{if(c())return;let i=e.retry??(ip()?0:3),a=e.retryDelay??dp,o=typeof a==`function`?a(n,r):a,s=i===!0||typeof i==`number`&&n<i||typeof i==`function`&&i(n,r);if(t||!s){h(r);return}n++,e.onFail?.(n,r),Yf(o).then(()=>f()?void 0:g()).then(()=>{t?h(r):_()})})};return{promise:s,status:()=>i,cancel:l,continue:()=>(r?.(),s),cancelRetry:u,continueRetry:d,canStart:p,start:()=>(p()?_():g().then(_),s)}}var hp=class{#e;destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),Ff(this.gcTime)&&(this.#e=Af.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(ip()?1/0:3e5))}clearGcTimeout(){this.#e!==void 0&&(Af.clearTimeout(this.#e),this.#e=void 0)}};function gp(e){return{onFetch:(t,n)=>{let r=t.options,i=t.fetchOptions?.meta?.fetchMore?.direction,a=t.state.data?.pages||[],o=t.state.data?.pageParams||[],s={pages:[],pageParams:[]},c=0,l=async()=>{let n=!1,l=e=>{np(e,()=>t.signal,()=>n=!0)},u=ep(t.options,t.fetchOptions),d=async(e,r,i)=>{if(n)return Promise.reject(t.signal.reason);if(r==null&&e.pages.length)return Promise.resolve(e);let a=(()=>{let e={client:t.client,queryKey:t.queryKey,pageParam:r,direction:i?`backward`:`forward`,meta:t.options.meta};return l(e),e})(),o=await u(a),{maxPages:s}=t.options,c=i?Qf:Zf;return{pages:c(e.pages,o,s),pageParams:c(e.pageParams,r,s)}};if(i&&a.length){let e=i===`backward`,t=e?vp:_p,n={pages:a,pageParams:o};s=await d(n,t(r,n),e)}else{let t=e??a.length;do{let e=c===0?o[0]??r.initialPageParam:_p(r,s);if(c>0&&e==null)break;s=await d(s,e),c++}while(c<t)}return s};t.fetchFn=t.options.persister?()=>t.options.persister?.(l,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},n):l}}}function _p(e,{pages:t,pageParams:n}){let r=t.length-1;return t.length>0?e.getNextPageParam(t[r],t,n[r],n):void 0}function vp(e,{pages:t,pageParams:n}){return t.length>0?e.getPreviousPageParam?.(t[0],t,n[0],n):void 0}var yp=class extends hp{#e;#t;#n;#r;#i;#a;#o;#s;constructor(e){super(),this.#s=!1,this.#o=e.defaultOptions,this.setOptions(e.options),this.observers=[],this.#i=e.client,this.#r=this.#i.getQueryCache(),this.queryKey=e.queryKey,this.queryHash=e.queryHash,this.#t=Sp(this.options),this.state=e.state??this.#t,this.scheduleGc()}get meta(){return this.options.meta}get queryType(){return this.#e}get promise(){return this.#a?.promise}setOptions(e){if(this.options={...this.#o,...e},e?._type&&(this.#e=e._type),this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){let e=Sp(this.options);e.data!==void 0&&(this.setState(xp(e.data,e.dataUpdatedAt)),this.#t=e)}}optionalRemove(){!this.observers.length&&this.state.fetchStatus===`idle`&&this.#r.remove(this)}setData(e,t){let n=Xf(this.state.data,e,this.options);return this.#c({data:n,type:`success`,dataUpdatedAt:t?.updatedAt,manual:t?.manual}),n}setState(e){this.#c({type:`setState`,state:e})}cancel(e){let t=this.#a?.promise;return this.#a?.cancel(e),t?t.then(Nf).catch(Nf):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}get resetState(){return this.#t}reset(){this.destroy(),this.setState(this.resetState)}isActive(){return this.observers.some(e=>Lf(e.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===$f||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.getObserversCount()>0&&this.observers.some(e=>Lf(e.options.staleTime,this)===`static`)}isStale(){return this.getObserversCount()>0?this.observers.some(e=>e.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(e=0){return this.state.data===void 0?!0:e===`static`?!1:this.state.isInvalidated?!0:!If(this.state.dataUpdatedAt,e)}onFocus(){this.observers.find(e=>e.shouldFetchOnWindowFocus())?.refetch({cancelRefetch:!1}),this.#a?.continue()}onOnline(){this.observers.find(e=>e.shouldFetchOnReconnect())?.refetch({cancelRefetch:!1}),this.#a?.continue()}addObserver(e){this.observers.includes(e)||(this.observers.push(e),this.clearGcTimeout(),this.#r.notify({type:`observerAdded`,query:this,observer:e}))}removeObserver(e){let t=this.observers.indexOf(e);t!==-1&&(this.observers.splice(t,1),this.observers.length||(this.#a&&(this.#s||this.state.fetchStatus===`paused`&&this.state.status===`pending`?this.#a.cancel({revert:!0}):this.#a.cancelRetry()),this.scheduleGc()),this.#r.notify({type:`observerRemoved`,query:this,observer:e}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||this.#c({type:`invalidate`})}async fetch(e,t){if(this.state.fetchStatus!==`idle`&&this.#a?.status()!==`rejected`){if(this.state.data!==void 0&&t?.cancelRefetch)this.cancel({silent:!0});else if(this.#a)return this.#a.continueRetry(),this.#a.promise}if(e&&this.setOptions(e),!this.options.queryFn){let e=this.observers.find(e=>e.options.queryFn);e&&this.setOptions(e.options)}let n=new AbortController,r=e=>{Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(this.#s=!0,n.signal)})},i=()=>{let e=ep(this.options,t),n=(()=>{let e={client:this.#i,queryKey:this.queryKey,meta:this.meta};return r(e),e})();return this.#s=!1,this.options.persister?this.options.persister(e,n,this):e(n)},a=(()=>{let e={fetchOptions:t,options:this.options,queryKey:this.queryKey,client:this.#i,state:this.state,fetchFn:i};return r(e),e})();(this.#e===`infinite`?gp(this.options.pages):this.options.behavior)?.onFetch(a,this),this.#n=this.state,(this.state.fetchStatus===`idle`||this.state.fetchMeta!==a.fetchOptions?.meta)&&this.#c({type:`fetch`,meta:a.fetchOptions?.meta});let o=this.#a=mp({initialPromise:t?.initialPromise,fn:a.fetchFn,onCancel:e=>{e instanceof pp&&e.revert&&this.setState({...this.#n,fetchStatus:`idle`}),n.abort()},onFail:(e,t)=>{this.#c({type:`failed`,failureCount:e,error:t})},onPause:()=>{this.#c({type:`pause`})},onContinue:()=>{this.#c({type:`continue`})},retry:a.options.retry,retryDelay:a.options.retryDelay,networkMode:a.options.networkMode,canRun:()=>!0});try{let e=await o.start();if(e===void 0)throw Error(`${this.queryHash} data is undefined`);return this.setData(e),this.#r.config.onSuccess?.(e,this),this.#r.config.onSettled?.(e,this.state.error,this),e}catch(e){if(e instanceof pp){if(e.silent)return this.#a.promise;if(e.revert){if(this.state.data===void 0)throw e;return this.state.data}}throw this.#c({type:`error`,error:e}),this.#r.config.onError?.(e,this),this.#r.config.onSettled?.(this.state.data,e,this),e}finally{this.#a===o&&(this.#a=void 0),this.scheduleGc()}}#c(e){let t=t=>{switch(e.type){case`failed`:return{...t,fetchFailureCount:e.failureCount,fetchFailureReason:e.error};case`pause`:return{...t,fetchStatus:`paused`};case`continue`:return{...t,fetchStatus:`fetching`};case`fetch`:return{...t,...bp(t.data,this.options),fetchMeta:e.meta??null};case`success`:let n={...t,...xp(e.data,e.dataUpdatedAt),dataUpdateCount:t.dataUpdateCount+1,...!e.manual&&{fetchStatus:`idle`,fetchFailureCount:0,fetchFailureReason:null}};return this.#n=e.manual?n:void 0,n;case`error`:let r=e.error;return{...t,error:r,errorUpdateCount:t.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:t.fetchFailureCount+1,fetchFailureReason:r,fetchStatus:`idle`,status:`error`,isInvalidated:!0};case`invalidate`:return{...t,isInvalidated:!0};case`setState`:return{...t,...e.state}}};this.state=t(this.state),lp.batch(()=>{this.observers.slice().forEach(e=>{e.onQueryUpdate()}),this.#r.notify({query:this,type:`updated`,action:e})})}};function bp(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:fp(t.networkMode)?`fetching`:`paused`,...e===void 0&&{error:null,status:`pending`}}}function xp(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:`success`}}function Sp(e){let t=typeof e.initialData==`function`?e.initialData():e.initialData,n=t!==void 0,r=n?typeof e.initialDataUpdatedAt==`function`?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:n?r??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:n?`success`:`pending`,fetchStatus:`idle`}}var Cp=class extends ap{#e;#t=void 0;#n=void 0;#r=void 0;#i;#a;#o;#s;#c;#l;#u;#d;#f;#p=new Set;constructor(e,t){super(),this.options=t,this.#e=e,this.#o=null,this.bindMethods(),this.setOptions(t)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(this.#t.addObserver(this),Tp(this.#t,this.options)?this.#m():this.updateResult(),this.#y())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return Ep(this.#t,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return Ep(this.#t,this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,this.#b(),this.#x(),this.#t.removeObserver(this)}setOptions(e){let t=this.options,n=this.#t;if(this.options=this.#e.defaultQueryOptions(e),this.options.enabled!==void 0&&typeof this.options.enabled!=`boolean`&&typeof this.options.enabled!=`function`&&typeof Lf(this.options.enabled,this.#t)!=`boolean`)throw Error(`Expected enabled to be a boolean or a callback that returns a boolean`);this.#S(),this.#t.setOptions(this.options),t._defaulted&&!Gf(this.options,t)&&this.#e.getQueryCache().notify({type:`observerOptionsUpdated`,query:this.#t,observer:this});let r=this.hasListeners();r&&Dp(this.#t,n,this.options,t)&&this.#m(),this.updateResult(),r&&(this.#t!==n||Lf(this.options.enabled,this.#t)!==Lf(t.enabled,this.#t)||Lf(this.options.staleTime,this.#t)!==Lf(t.staleTime,this.#t))&&this.#g();let i=this.#_();r&&(this.#t!==n||Lf(this.options.enabled,this.#t)!==Lf(t.enabled,this.#t)||i!==this.#f)&&this.#v(i)}getOptimisticResult(e){let t=this.#e.getQueryCache().build(this.#e,e),n=this.createResult(t,e);return Gf(this.getCurrentResult(),n)||(this.#r=n,this.#a=this.options,this.#i=this.#t.state),n}getCurrentResult(){return this.#r}trackResult(e,t){return new Proxy(e,{get:(e,n)=>(this.trackProp(n),t?.(n),Reflect.get(e,n))})}trackProp(e){this.#p.add(e)}getCurrentQuery(){return this.#t}refetch({...e}={}){return this.fetch({...e})}fetchOptimistic(e){let t=this.#e.defaultQueryOptions(e),n=this.#e.getQueryCache().build(this.#e,t),r=()=>{},i,a=new Promise(e=>{i=e,r=this.#e.getQueryCache().subscribe(i=>{i.type===`updated`&&i.query.queryHash===n.queryHash&&n.state.data!==void 0&&(r(),e(this.createResult(n,t)))})});return Promise.race([n.fetch().then(()=>{let e=this.createResult(n,t);return i?.(e),e}).finally(()=>{r()}),a])}fetch(e){return this.#m({...e,cancelRefetch:e.cancelRefetch??!0}).then(()=>(this.updateResult(),this.#r))}#m(e){this.#S();let t=this.#t.fetch(this.options,e);return e?.throwOnError||(t=t.catch(Nf)),t}#h(e){return!ip()&&Lf(this.options.enabled,this.#t)!==!1&&Ff(e)}#g(){this.#b();let e=Lf(this.options.staleTime,this.#t);if(this.#r.isStale||!this.#h(e))return;let t=If(this.#r.dataUpdatedAt,e)+1;this.#u=Af.setTimeout(()=>{this.#r.isStale||this.updateResult()},t)}#_(){return Lf(this.options.refetchInterval,this.#t)??!1}#v(e){this.#x(),this.#f=e,this.#f!==0&&this.#h(this.#f)&&(this.#d=Af.setInterval(()=>{(this.options.refetchIntervalInBackground||op.isFocused())&&this.#m()},this.#f))}#y(){this.#g(),this.#v(this.#_())}#b(){this.#u!==void 0&&(Af.clearTimeout(this.#u),this.#u=void 0)}#x(){this.#d!==void 0&&(Af.clearInterval(this.#d),this.#d=void 0)}createResult(e,t){let n=this.#t,r=this.options,i=this.#r,a=this.#i,o=this.#a,s=e===n?this.#n:e.state,{state:c}=e,l={...c},u=!1,d;if(t._optimisticResults){let i=this.hasListeners(),a=!i&&Tp(e,t),o=i&&Dp(e,n,t,r);(a||o)&&(l={...l,...bp(c.data,e.options)}),t._optimisticResults===`isRestoring`&&(l.fetchStatus=`idle`)}let{error:f,errorUpdatedAt:p,status:m}=l;d=l.data;let h=!1;if(t.placeholderData!==void 0&&d===void 0&&m===`pending`){let e;i?.isPlaceholderData&&t.placeholderData===o?.placeholderData?(e=i.data,h=!0):e=typeof t.placeholderData==`function`?t.placeholderData(this.#l?.state.data,this.#l):t.placeholderData,e!==void 0&&(m=`success`,d=Xf(i?.data,e,t),u=!0)}if(t.select&&d!==void 0&&!h){if(i&&d===a?.data&&t.select===this.#s)d=this.#c;else try{this.#s=t.select,d=t.select(d),d=Xf(i?.data,d,t),this.#c=d,this.#o=null}catch(e){this.#o=e}}else d===void 0&&(this.#o=null);this.#o&&(f=this.#o,d=this.#c,p=Date.now(),m=`error`,u=!1);let g=l.fetchStatus===`fetching`,_=m===`pending`,v=m===`error`,y=_&&g,b=d!==void 0;return{status:m,fetchStatus:l.fetchStatus,isPending:_,isSuccess:m===`success`,isError:v,isInitialLoading:y,isLoading:y,data:d,dataUpdatedAt:l.dataUpdatedAt,error:f,errorUpdatedAt:p,failureCount:l.fetchFailureCount,failureReason:l.fetchFailureReason,errorUpdateCount:l.errorUpdateCount,isFetched:e.isFetched(),isFetchedAfterMount:l.dataUpdateCount>s.dataUpdateCount||l.errorUpdateCount>s.errorUpdateCount,isFetching:g,isRefetching:g&&!_,isLoadingError:v&&!b,isPaused:l.fetchStatus===`paused`,isPlaceholderData:u,isRefetchError:v&&b,isStale:Op(e,t),refetch:this.refetch,isEnabled:Lf(t.enabled,e)!==!1}}updateResult(){let e=this.#r,t=this.createResult(this.#t,this.options);if(this.#i=this.#t.state,this.#a=this.options,this.#i.data!==void 0&&(this.#l=this.#t),Gf(t,e))return;this.#r=t;let n=(()=>{if(!e)return!0;let{notifyOnChangeProps:t}=this.options,n=typeof t==`function`?t():t;if(n===`all`||!n&&!this.#p.size)return!0;let r=new Set(n??this.#p);return this.options.throwOnError&&r.add(`error`),Object.keys(this.#r).some(t=>{let n=t;return this.#r[n]!==e[n]&&r.has(n)})})();lp.batch(()=>{n&&this.listeners.forEach(e=>{e(this.#r)}),this.#e.getQueryCache().notify({query:this.#t,type:`observerResultsUpdated`})})}#S(){let e=this.#e.getQueryCache().build(this.#e,this.options);if(e===this.#t)return;let t=this.#t;this.#t=e,this.#n=e.state,this.hasListeners()&&(t?.removeObserver(this),e.addObserver(this))}onQueryUpdate(){this.updateResult(),this.hasListeners()&&this.#y()}};function wp(e,t){return Lf(t.enabled,e)!==!1&&e.state.data===void 0&&(e.state.status!==`error`||Lf(t.retryOnMount,e)!==!1)}function Tp(e,t){return wp(e,t)||e.state.data!==void 0&&Ep(e,t,t.refetchOnMount)}function Ep(e,t,n){if(Lf(t.enabled,e)!==!1&&Lf(t.staleTime,e)!==`static`){let r=Lf(n,e);return r===`always`||r!==!1&&Op(e,t)}return!1}function Dp(e,t,n,r){return(e!==t||Lf(r.enabled,e)===!1)&&(!n.suspense||e.state.status!==`error`)&&Op(e,n)}function Op(e,t){return Lf(t.enabled,e)!==!1&&e.isStaleByTime(Lf(t.staleTime,e))}var kp=class extends hp{#e;#t;#n;#r;constructor(e){super(),this.#e=e.client,this.mutationId=e.mutationId,this.#n=e.mutationCache,this.#t=[],this.state=e.state||Ap(),this.setOptions(e.options),this.scheduleGc()}setOptions(e){this.options=e,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(e){this.#t.includes(e)||(this.#t.push(e),this.clearGcTimeout(),this.#n.notify({type:`observerAdded`,mutation:this,observer:e}))}removeObserver(e){this.#t=this.#t.filter(t=>t!==e),this.scheduleGc(),this.#n.notify({type:`observerRemoved`,mutation:this,observer:e})}optionalRemove(){this.#t.length||(this.state.status===`pending`?this.scheduleGc():this.#n.remove(this))}continue(){return this.#r?.continue()??(this.state.status===`pending`?this.execute(this.state.variables):Promise.resolve())}async execute(e){let t=()=>{this.#i({type:`continue`})},n={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey},r=this.#r=mp({fn:()=>this.options.mutationFn?this.options.mutationFn(e,n):Promise.reject(Error(`No mutationFn found`)),onFail:(e,t)=>{this.#i({type:`failed`,failureCount:e,error:t})},onPause:()=>{this.#i({type:`pause`})},onContinue:t,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>this.#n.canRun(this)}),i=this.state.status===`pending`,a=!r.canStart();try{if(i)t();else{this.#i({type:`pending`,variables:e,isPaused:a}),this.#n.config.onMutate&&await this.#n.config.onMutate(e,this,n);let t=await this.options.onMutate?.(e,n);t!==this.state.context&&this.#i({type:`pending`,context:t,variables:e,isPaused:a})}let o=await r.start();return await this.#n.config.onSuccess?.(o,e,this.state.context,this,n),await this.options.onSuccess?.(o,e,this.state.context,n),await this.#n.config.onSettled?.(o,null,this.state.variables,this.state.context,this,n),await this.options.onSettled?.(o,null,e,this.state.context,n),this.#i({type:`success`,data:o}),o}catch(t){try{await this.#n.config.onError?.(t,e,this.state.context,this,n)}catch(e){Promise.reject(e)}try{await this.options.onError?.(t,e,this.state.context,n)}catch(e){Promise.reject(e)}try{await this.#n.config.onSettled?.(void 0,t,this.state.variables,this.state.context,this,n)}catch(e){Promise.reject(e)}try{await this.options.onSettled?.(void 0,t,e,this.state.context,n)}catch(e){Promise.reject(e)}throw this.#i({type:`error`,error:t}),t}finally{this.#r===r&&(this.#r=void 0),this.#n.runNext(this)}}#i(e){let t=t=>{switch(e.type){case`failed`:return{...t,failureCount:e.failureCount,failureReason:e.error};case`pause`:return{...t,isPaused:!0};case`continue`:return{...t,isPaused:!1};case`pending`:return{...t,context:e.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:e.isPaused,status:`pending`,variables:e.variables,submittedAt:Date.now()};case`success`:return{...t,data:e.data,failureCount:0,failureReason:null,error:null,status:`success`,isPaused:!1};case`error`:return{...t,data:void 0,error:e.error,failureCount:t.failureCount+1,failureReason:e.error,isPaused:!1,status:`error`}}};this.state=t(this.state),lp.batch(()=>{this.#t.forEach(t=>{t.onMutationUpdate(e)}),this.#n.notify({mutation:this,type:`updated`,action:e})})}};function Ap(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:`idle`,variables:void 0,submittedAt:0}}var jp=class extends ap{#e;#t;#n;constructor(e={}){super(),this.config=e,this.#e=new Set,this.#t=new Map,this.#n=0}build(e,t,n){let r=new kp({client:e,mutationCache:this,mutationId:++this.#n,options:e.defaultMutationOptions(t),state:n});return this.add(r),r}add(e){this.#e.add(e);let t=Mp(e);if(typeof t==`string`){let n=this.#t.get(t);n?n.push(e):this.#t.set(t,[e])}this.notify({type:`added`,mutation:e})}remove(e){if(this.#e.delete(e)){let t=Mp(e);if(typeof t==`string`){let n=this.#t.get(t);if(n){if(n.length>1){let t=n.indexOf(e);t!==-1&&n.splice(t,1)}else n[0]===e&&this.#t.delete(t)}}}this.notify({type:`removed`,mutation:e})}canRun(e){let t=Mp(e);if(typeof t==`string`){let n=this.#t.get(t)?.find(e=>e.state.status===`pending`);return!n||n===e}return!0}runNext(e){let t=Mp(e);return typeof t==`string`?(this.#t.get(t)?.find(t=>t!==e&&t.state.isPaused))?.continue()??Promise.resolve():Promise.resolve()}clear(){lp.batch(()=>{this.#e.forEach(e=>{this.notify({type:`removed`,mutation:e})}),this.#e.clear(),this.#t.clear()})}getAll(){return Array.from(this.#e)}find(e){let t={exact:!0,...e};return this.getAll().find(e=>zf(t,e))}findAll(e={}){return this.getAll().filter(t=>zf(e,t))}notify(e){lp.batch(()=>{this.listeners.forEach(t=>{t(e)})})}resumePausedMutations(){let e=this.getAll().filter(e=>e.state.isPaused);return lp.batch(()=>Promise.all(e.map(e=>e.continue().catch(Nf))))}};function Mp(e){return e.options.scope?.id}var Np=class extends ap{#e;constructor(e={}){super(),this.config=e,this.#e=new Map}build(e,t,n){let r=t.queryKey,i=t.queryHash??Bf(r,t),a=this.get(i);return a||(a=new yp({client:e,queryKey:r,queryHash:i,options:e.defaultQueryOptions(t),state:n,defaultOptions:e.getQueryDefaults(r)}),this.add(a)),a}add(e){this.#e.has(e.queryHash)||(this.#e.set(e.queryHash,e),this.notify({type:`added`,query:e}))}remove(e){this.#e.get(e.queryHash)===e&&(e.destroy(),this.#e.delete(e.queryHash),this.notify({type:`removed`,query:e}))}clear(){lp.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}get(e){return this.#e.get(e)}getAll(){return[...this.#e.values()]}find(e){let t={exact:!0,...e};return this.getAll().find(e=>Rf(t,e))}findAll(e={}){let t=this.getAll();return Object.keys(e).length>0?t.filter(t=>Rf(e,t)):t}notify(e){lp.batch(()=>{this.listeners.forEach(t=>{t(e)})})}onFocus(){lp.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){lp.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},Pp=class{#e;#t;#n;#r;#i;#a;#o;#s;constructor(e={}){this.#e=e.queryCache||new Np,this.#t=e.mutationCache||new jp,this.#n=e.defaultOptions||{},this.#r=new Map,this.#i=new Map,this.#a=0}mount(){this.#a++,this.#a===1&&(this.#o=op.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onFocus())}),this.#s=up.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onOnline())}))}unmount(){this.#a--,this.#a===0&&(this.#o?.(),this.#o=void 0,this.#s?.(),this.#s=void 0)}isFetching(e){return this.#e.findAll({...e,fetchStatus:`fetching`}).length}isMutating(e){return this.#t.findAll({...e,status:`pending`}).length}getQueryData(e){let t=this.defaultQueryOptions({queryKey:e});return this.#e.get(t.queryHash)?.state.data}ensureQueryData(e){let t=this.defaultQueryOptions(e),n=this.#e.build(this,t),r=n.state.data;return r===void 0?this.fetchQuery(e):(e.revalidateIfStale&&n.isStaleByTime(Lf(t.staleTime,n))&&this.prefetchQuery(t),Promise.resolve(r))}getQueriesData(e){return this.#e.findAll(e).map(({queryKey:e,state:t})=>[e,t.data])}setQueryData(e,t,n){let r=this.defaultQueryOptions({queryKey:e}),i=this.#e.get(r.queryHash)?.state.data,a=Pf(t,i);if(a!==void 0)return this.#e.build(this,r).setData(a,{...n,manual:!0})}setQueriesData(e,t,n){return lp.batch(()=>this.#e.findAll(e).map(({queryKey:e})=>[e,this.setQueryData(e,t,n)]))}getQueryState(e){let t=this.defaultQueryOptions({queryKey:e});return this.#e.get(t.queryHash)?.state}removeQueries(e){let t=this.#e;lp.batch(()=>{t.findAll(e).forEach(e=>{t.remove(e)})})}resetQueries(e,t){let n=this.#e;return lp.batch(()=>{let r=n.findAll(e),i=new Set(r);return r.forEach(e=>{e.reset()}),this.refetchQueries({type:`active`,predicate:e=>i.has(e)},t)})}cancelQueries(e,t={}){let n={revert:!0,...t},r=lp.batch(()=>this.#e.findAll(e).map(e=>e.cancel(n)));return Promise.all(r).then(Nf).catch(Nf)}invalidateQueries(e,t={}){return lp.batch(()=>(this.#e.findAll(e).forEach(e=>{e.invalidate()}),e?.refetchType===`none`?Promise.resolve():this.refetchQueries({...e,type:e?.refetchType??e?.type??`active`},t)))}refetchQueries(e,t={}){let n={...t,cancelRefetch:t.cancelRefetch??!0},r=lp.batch(()=>this.#e.findAll(e).filter(e=>!e.isDisabled()&&!e.isStatic()).map(e=>{let t=e.fetch(void 0,n);return n.throwOnError||(t=t.catch(Nf)),e.state.fetchStatus===`paused`?Promise.resolve():t}));return Promise.all(r).then(Nf)}async query(e){let t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);let n=this.#e.build(this,t),r=n.isStaleByTime(Lf(t.staleTime,n))?await n.fetch(t):n.state.data,i=t.select;return i?i(r):r}fetchQuery(e){let t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);let n=this.#e.build(this,t);return n.isStaleByTime(Lf(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(Nf).catch(Nf)}infiniteQuery(e){return e._type=`infinite`,this.query(e)}fetchInfiniteQuery(e){return e._type=`infinite`,this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(Nf).catch(Nf)}ensureInfiniteQueryData(e){return e._type=`infinite`,this.ensureQueryData(e)}resumePausedMutations(){return up.isOnline()?this.#t.resumePausedMutations():Promise.resolve()}getQueryCache(){return this.#e}getMutationCache(){return this.#t}getDefaultOptions(){return this.#n}setDefaultOptions(e){this.#n=e}setQueryDefaults(e,t){this.#r.set(Vf(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){let t=[...this.#r.values()],n={};return t.forEach(t=>{Hf(e,t.queryKey)&&Object.assign(n,t.defaultOptions)}),n}setMutationDefaults(e,t){this.#i.set(Vf(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){let t=[...this.#i.values()],n={};return t.forEach(t=>{Hf(e,t.mutationKey)&&Object.assign(n,t.defaultOptions)}),n}defaultQueryOptions(e){if(e._defaulted)return e;let t={...this.#n.queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||=Bf(t.queryKey,t),t.refetchOnReconnect===void 0&&(t.refetchOnReconnect=t.networkMode!==`always`),t.throwOnError===void 0&&(t.throwOnError=!!t.suspense),!t.networkMode&&t.persister&&(t.networkMode=`offlineFirst`),t.queryFn===$f&&(t.enabled=!1),t}defaultMutationOptions(e){return e?._defaulted?e:{...this.#n.mutations,...e?.mutationKey&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){this.#e.clear(),this.#t.clear()}},Fp=v.createContext(!1),Ip=()=>v.useContext(Fp);Fp.Provider;function Lp(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var Rp=v.createContext(Lp()),zp=()=>v.useContext(Rp),Bp=(e,t,n)=>{let r=n?.state.error&&typeof e.throwOnError==`function`?tp(e.throwOnError,[n.state.error,n]):e.throwOnError;(e.suspense||r)&&(t.isReset()||(e.retryOnMount=!1))},Vp=e=>{v.useEffect(()=>{e.clearReset()},[e])},Hp=({result:e,errorResetBoundary:t,throwOnError:n,query:r,suspense:i})=>e.isError&&!t.isReset()&&!e.isFetching&&r&&(i&&e.data===void 0||tp(n,[e.error,r])),Up=e=>{if(e.suspense){let t=1e3,n=e=>e===`static`?e:Math.max(e??t,t),r=e.staleTime;e.staleTime=typeof r==`function`?(...e)=>n(r(...e)):n(r),typeof e.gcTime==`number`&&(e.gcTime=Math.max(e.gcTime,t))}},Wp=(e,t)=>e?.suspense&&t.isPending,Gp=(e,t,n)=>t.fetchOptimistic(e).catch(()=>{n.clearReset()});function Kp(e,t,n){let r=Ip(),i=zp(),a=Df(n),o=a.defaultQueryOptions(e),s=a.getQueryCache().get(o.queryHash),c=e.subscribed!==!1;o._optimisticResults=r?`isRestoring`:c?`optimistic`:void 0,Up(o),Bp(o,i,s),Vp(i);let[l]=v.useState(()=>new t(a,o)),u=l.getOptimisticResult(o),d=!r&&c;if(v.useSyncExternalStore(v.useCallback(e=>{let t=d?l.subscribe(lp.batchCalls(e)):Nf;return l.updateResult(),t},[l,d]),()=>l.getCurrentResult(),()=>l.getCurrentResult()),v.useEffect(()=>{l.setOptions(o)},[o,l]),Wp(o,u))throw Gp(o,l,i);if(Hp({result:u,errorResetBoundary:i,throwOnError:o.throwOnError,query:s,suspense:o.suspense}))throw u.error;return o.notifyOnChangeProps?u:l.trackResult(u)}function qp(e,t){return Kp(e,Cp,t)}var Jp=nc(`method`,[W({method:q(`searchTracesPage`),params:Rl.tracesDataFilterSchema,refetchIntervalMs:V().optional()}),W({method:q(`searchLogsPage`),params:Rl.logsDataFilterSchema,refetchIntervalMs:V().optional()}),W({method:q(`searchMetricsPage`),params:Rl.metricsDataFilterSchema,refetchIntervalMs:V().optional()}),W({method:q(`getTrace`),params:W({traceId:B()}),refetchIntervalMs:V().optional()}),W({method:q(`discoverMetrics`),params:W({}).optional(),refetchIntervalMs:V().optional()}),W({method:q(`getServices`),params:W({}).optional(),refetchIntervalMs:V().optional()}),W({method:q(`getOperations`),params:W({serviceName:B()}),refetchIntervalMs:V().optional()}),W({method:q(`searchTraceSummariesPage`),params:Rl.traceSummariesFilterSchema,refetchIntervalMs:V().optional()}),W({method:q(`searchAggregatedMetrics`),params:Rl.metricsDataFilterSchema,refetchIntervalMs:V().optional()}),W({method:q(`query`),params:Ql.KopaiQuery,refetchIntervalMs:V().optional()})]),Yp=K(Jp.options.map(e=>e.shape.method.value)),Xp=W({hasChildren:Hs(),description:B().describe(`Component description to be displayed by the prompt generator`),props:qs(),acceptsDataFrom:U(Yp).readonly().optional()}).describe(`All options and properties necessary to render the React component with renderer`);W({name:B().describe(`catalog name`),components:oc(B().describe(`React component name`),Xp)});function Zp(e){let t=nc(`type`,Object.keys(e.components).map(t=>({catalogItemName:t,component:e.components[t]})).filter(e=>!!e.component).map(({catalogItemName:e,component:t})=>W({key:B(),type:q(e),children:U(B()),parentKey:B(),dataSource:Jp.optional(),props:t.props}))),n=W({root:B().describe(`root uiElement key in the elements array`),elements:oc(B().describe(`equal to the element key`),t)});return{name:e.name,components:e.components,uiTreeSchema:n}}var Qp=Zp({name:`observability`,components:{Card:{props:W({title:B().nullable(),description:B().nullable(),padding:K([`sm`,`md`,`lg`]).nullable()}),hasChildren:!0,description:`A card container with optional title`},Grid:{props:W({columns:V().min(1).max(4).nullable(),gap:K([`sm`,`md`,`lg`]).nullable()}),hasChildren:!0,description:`Grid layout with configurable columns`},Stack:{props:W({direction:K([`horizontal`,`vertical`]).nullable(),gap:K([`sm`,`md`,`lg`]).nullable(),align:K([`start`,`center`,`end`,`stretch`]).nullable()}),hasChildren:!0,description:`Flex stack for horizontal or vertical layouts`},Heading:{props:W({text:B(),level:K([`h1`,`h2`,`h3`,`h4`]).nullable()}),hasChildren:!1,description:`Section heading`},Text:{props:W({content:B(),variant:K([`body`,`caption`,`label`]).nullable(),color:K([`default`,`muted`,`success`,`warning`,`danger`]).nullable()}),hasChildren:!1,description:`Text paragraph`},Badge:{props:W({text:B(),variant:K([`default`,`success`,`warning`,`danger`,`info`]).nullable()}),hasChildren:!1,description:`Small status badge`},Divider:{props:W({label:B().nullable()}),hasChildren:!1,description:`Visual divider`},Empty:{props:W({title:B(),description:B().nullable(),action:B().nullable(),actionLabel:B().nullable()}),hasChildren:!1,description:`Empty state placeholder`},LogTimeline:{props:W({height:V().nullable()}),hasChildren:!1,description:`Log timeline with virtual scroll, severity filtering, detail pane`,acceptsDataFrom:[`searchLogsPage`,`query`]},TraceDetail:{props:W({height:V().nullable()}),hasChildren:!1,description:`Trace detail with traceId input field and waterfall timeline`,acceptsDataFrom:[`searchTracesPage`,`searchTraceSummariesPage`,`query`]},MetricTimeSeries:{props:W({height:V().nullable(),showBrush:Hs().nullable(),yAxisLabel:B().nullable(),unit:B().nullable()}),hasChildren:!1,description:`Time series line chart for Gauge/Sum metrics`,acceptsDataFrom:[`searchMetricsPage`,`query`]},MetricHistogram:{props:W({height:V().nullable(),yAxisLabel:B().nullable(),unit:B().nullable()}),hasChildren:!1,description:`Histogram bar chart for distribution metrics`,acceptsDataFrom:[`searchMetricsPage`,`query`]},MetricStat:{props:W({label:B().nullable(),showSparkline:Hs().nullable()}),hasChildren:!1,description:`Single metric KPI card with sparkline and threshold coloring`,acceptsDataFrom:[`searchMetricsPage`,`searchAggregatedMetrics`,`query`]},MetricTable:{props:W({maxRows:V().nullable()}),hasChildren:!1,description:`Tabular display of metric data points`,acceptsDataFrom:[`searchMetricsPage`,`query`]},AggregateTable:{props:W({maxRows:V().int().positive().nullable(),units:oc(B(),B()).nullable(),labels:oc(B(),B()).nullable()}),hasChildren:!1,description:'Tabular display of aggregate query results — dimension and measure columns from a `query` dataSource in aggregate mode (e.g. top spans by AVG(Duration), request counts grouped by StatusCode). Columns are derived from the result rows, so it renders any signal\'s aggregate output. `units` maps a column name to its OTel unit so the cell renders in human terms — e.g. {"avg_duration_ns": "ns"} shows 23070000 as "23.07 ms". Understood units: ns/us/ms/s (duration ladder) and By (binary byte ladder); unmapped columns keep generic SI scaling. Headers are humanised automatically — snake_case, dotted and PascalCase names become Title Case ("span_count" -> "Span Count"), and a trailing unit token is dropped when that column is unit-annotated ("avg_duration_ns" + "ns" -> "Avg Duration") since the unit already shows in the cell. `labels` overrides the header for any column, which is the escape hatch when humanising mangles a name — e.g. {"SpanAttributes.http.route": "Route"}.',acceptsDataFrom:[`query`]},MetricDiscovery:{props:W({}),hasChildren:!1,description:`Table of discovered metric names, types, units and descriptions`,acceptsDataFrom:[`discoverMetrics`]}}}),$p=(0,v.createContext)(null),em=new Pp({defaultOptions:{queries:{staleTime:3e4,refetchOnWindowFocus:!1,retry:!1}}});function tm({client:e,children:t}){return(0,Y.jsx)(Of,{client:em,children:(0,Y.jsx)($p.Provider,{value:{client:e},children:t})})}function nm(){let e=(0,v.useContext)($p);if(!e)throw Error(`useKopaiSDK must be used within KopaiSDKProvider`);return e.client}function rm(e,t,n){switch(t.method){case`searchTracesPage`:return e.searchTracesPage(t.params,{signal:n});case`searchLogsPage`:return e.searchLogsPage(t.params,{signal:n});case`searchMetricsPage`:return e.searchMetricsPage(t.params,{signal:n});case`searchAggregatedMetrics`:return e.searchAggregatedMetrics(t.params,{signal:n});case`getTrace`:return e.getTrace(t.params.traceId,{signal:n});case`discoverMetrics`:return e.discoverMetrics({signal:n});case`getServices`:return e.getServices({signal:n});case`getOperations`:return e.getOperations(t.params.serviceName,{signal:n});case`searchTraceSummariesPage`:return e.searchTraceSummariesPage(t.params,{signal:n});case`query`:return e.query(t.params,{signal:n});default:throw Error(`Unknown method: ${t.method}`)}}function im(e){let t=nm(),{data:n,isFetching:r,error:i,refetch:a}=qp({queryKey:[`kopai`,e?.method,e?.params],queryFn:({signal:n})=>rm(t,e,n),enabled:!!e,refetchInterval:e?.refetchIntervalMs});return{data:n??null,loading:r,error:i??null,refetch:a}}function am(e,t){let n=Object.fromEntries(Object.entries(e.components).map(([e,t])=>[e,t.acceptsDataFrom]));return function({tree:e,fallback:r}){return(0,Y.jsx)(cm,{tree:e,registry:t,fallback:r,acceptsDataFromByType:n})}}function om({element:e,Component:t,acceptsDataFromByType:n,children:r}){let[i,a]=(0,v.useState)({}),o=n?.[e.type],s=!e.dataSource||n===void 0||(o?.includes(e.dataSource.method)??!1),{data:c,loading:l,error:u,refetch:d}=im((0,v.useMemo)(()=>{if(e.dataSource&&s)return{...e.dataSource,params:{...e.dataSource.params,...i}}},[e.dataSource,i,s]));if(!s&&e.dataSource){let t=o?.length?o.join(`, `):`none`;return console.error(`[ui-core] Component "${e.type}" does not accept dataSource method "${e.dataSource.method}". Accepted methods: ${t}.`),null}let f=(0,v.useCallback)(e=>{a(t=>({...t,...e}))},[]);return(0,Y.jsx)(t,{element:e,hasData:!0,response:c,loading:l,error:u,refetch:d,updateParams:f,children:r})}function sm({element:e,tree:t,registry:n,fallback:r,acceptsDataFromByType:i}){let a=n[e.type]??r;if(!a)return console.warn(`No renderer for component type: ${e.type}`),null;let o=e.children?.map(e=>{let a=t.elements[e];return a?(0,Y.jsx)(sm,{element:a,tree:t,registry:n,fallback:r,acceptsDataFromByType:i},e):null});return e.dataSource?(0,Y.jsx)(om,{element:e,Component:a,acceptsDataFromByType:i,children:o}):(0,Y.jsx)(a,{element:e,hasData:!1,children:o})}function cm({tree:e,registry:t,fallback:n,acceptsDataFromByType:r}){if(!e||!e.root)return null;let i=e.elements[e.root];return i?(0,Y.jsx)(sm,{element:i,tree:e,registry:t,fallback:n,acceptsDataFromByType:r}):null}function lm(e){let t=e.Body??``,n=0;for(let e=0;e<t.length;e++)n=(n<<5)-n+t.charCodeAt(e),n&=n;return`${e.Timestamp}-${e.ServiceName??``}-${Math.abs(n).toString(36)}`}var um=class{maxSize;rows=[];keys=new Set;constructor(e=1e3){this.maxSize=e}merge(e){for(let t of e){let e=lm(t);this.keys.has(e)||(this.keys.add(e),this.rows.push(t))}if(this.rows.sort((e,t)=>e.Timestamp<t.Timestamp?-1:+(e.Timestamp>t.Timestamp)),this.rows.length>this.maxSize){let e=this.rows.splice(0,this.rows.length-this.maxSize);for(let t of e)this.keys.delete(lm(t))}}getAll(){return this.rows.slice()}getNewestTimestamp(){if(this.rows.length!==0)return this.rows[this.rows.length-1].Timestamp}get size(){return this.rows.length}clear(){this.rows=[],this.keys.clear()}};function dm({params:e,pollIntervalMs:t=3e3,maxLogs:n=1e3,enabled:r=!0}){let i=nm(),a=(0,v.useRef)(new um(n)),[o,s]=(0,v.useState)(0),[c,l]=(0,v.useState)(!0),u=(0,v.useRef)(0),d=(0,v.useRef)(!1),f=JSON.stringify(e),p=(0,v.useRef)(f);(0,v.useEffect)(()=>{p.current!==f&&(p.current=f,a.current.clear(),d.current=!1,u.current=0,s(e=>e+1))},[f]);let{isFetching:m,error:h,refetch:g}=qp({queryKey:[`live-logs`,e],queryFn:async({signal:t})=>{let n={...e};if(p.current!==JSON.stringify(e)&&(d.current=!1),d.current){let e=a.current.getNewestTimestamp();e&&(n.timestampMin=String(BigInt(e)+1n))}let r=await i.searchLogsPage(n,{signal:t});return d.current=!0,r.data.length>0&&(u.current+=r.data.length,a.current.merge(r.data),s(e=>e+1)),r},enabled:r,refetchInterval:c?t:!1}),_=(0,v.useCallback)(e=>{l(e),e&&g()},[g]);return{logs:a.current.getAll(),isLive:c,totalReceived:u.current,loading:m,error:h??null,setLive:_}}var fm=class extends Error{code;status;type;detail;constructor(e){super(e.message),this.name=`KopaiError`,this.code=e.code,this.status=e.status,this.type=e.type,this.detail=e.detail}},pm=class extends Error{cause;constructor(e,t){super(e),this.name=`KopaiNetworkError`,this.cause=t}},mm=class extends Error{timeout;constructor(e){super(`Request timed out after ${e}ms`),this.name=`KopaiTimeoutError`,this.timeout=e}},hm=class extends Error{zodError;constructor(e){super(`Response validation failed: ${e.message}`),this.name=`KopaiValidationError`,this.zodError=e}},gm=3e4;async function _m(e,t,n){let{method:r=`GET`,body:i,headers:a={},baseHeaders:o={},signal:s,timeout:c,fetchFn:l,defaultTimeout:u}=n,d=c??u??gm,f=new AbortController,p=setTimeout(()=>f.abort(),d),m=s?AbortSignal.any([s,f.signal]):f.signal;try{let n=await l(e,{method:r,headers:{"Content-Type":`application/json`,...o,...a},body:i?JSON.stringify(i):void 0,signal:m});clearTimeout(p),n.ok||await vm(n);let s=await n.json(),c=t.safeParse(s);if(!c.success)throw new hm(c.error);return c.data}catch(e){throw clearTimeout(p),e instanceof fm||e instanceof hm||e instanceof mm||e instanceof pm?e:e instanceof DOMException&&e.name===`AbortError`?f.signal.aborted?new mm(d):e:e instanceof TypeError?new pm(e.message||`Network request failed`,e):e}}async function vm(e){let t;try{t=await e.json()}catch{t=null}if(t&&typeof t==`object`){let n=t,r=n.detail,i=n.title||n.message||`HTTP ${e.status}`;throw new fm({message:r?`${i}: ${r}`:i,code:n.code||`HTTP_${e.status}`,status:e.status,type:n.type||`about:blank`,detail:r})}throw new fm({message:`HTTP ${e.status}`,code:`HTTP_${e.status}`,status:e.status,type:`about:blank`})}async function*ym(e,t){let n;do{t?.throwIfAborted();let r=await e(n,t);for(let e of r.data)yield e;n=r.nextCursor??void 0}while(n)}var bm=3e4,xm=W({data:U(Ic.otelTracesSchema),nextCursor:B().nullable()}),Sm=W({data:U(Ic.otelLogsSchema),nextCursor:B().nullable()}),Cm=W({data:U(Ic.otelMetricsSchema),nextCursor:B().nullable()}),wm=W({data:U(Ic.aggregatedMetricSchema),nextCursor:Gs()}),Tm=W({data:U(oc(B(),G([B(),V(),Gs()])))}),Em=Kl.dashboardSchema,Dm=W({data:U(Kl.dashboardSchema),nextCursor:B().nullable()}),Om=W({services:U(B())}),km=W({operations:U(B())}),Am=W({data:U(Rl.traceSummaryRowSchema),nextCursor:B().nullable()}),jm=W({metrics:U(W({name:B(),type:K([`Gauge`,`Sum`,`Histogram`,`ExponentialHistogram`,`Summary`]),unit:B().optional(),description:B().optional(),attributes:W({values:oc(B(),U(B())),_truncated:Hs().optional()}),resourceAttributes:W({values:oc(B(),U(B())),_truncated:Hs().optional()})}))}),Mm=class{baseUrl;fetchFn;defaultTimeout;baseHeaders;constructor(e){this.baseUrl=e.baseUrl.replace(/\/$/,``),this.fetchFn=e.fetch??fetch,this.defaultTimeout=e.timeout??bm,this.baseHeaders={...e.headers},e.token&&(this.baseHeaders.Authorization=`Bearer ${e.token}`)}async getTrace(e,t){let n=U(Ic.otelTracesSchema);return _m(`${this.baseUrl}/signals/traces/${e}`,n,{method:`GET`,...t,baseHeaders:this.baseHeaders,fetchFn:this.fetchFn,defaultTimeout:this.defaultTimeout})}searchTraces(e,t){return ym((n,r)=>this.searchTracesPage({...e,cursor:n},{...t,signal:r}),t?.signal)}async searchTracesPage(e,t){let n=Rl.tracesDataFilterSchema.parse(e);return _m(`${this.baseUrl}/signals/traces/search`,xm,{method:`POST`,body:n,...t,baseHeaders:this.baseHeaders,fetchFn:this.fetchFn,defaultTimeout:this.defaultTimeout})}searchLogs(e,t){return ym((n,r)=>this.searchLogsPage({...e,cursor:n},{...t,signal:r}),t?.signal)}async searchLogsPage(e,t){let n=Rl.logsDataFilterSchema.parse(e);return _m(`${this.baseUrl}/signals/logs/search`,Sm,{method:`POST`,body:n,...t,baseHeaders:this.baseHeaders,fetchFn:this.fetchFn,defaultTimeout:this.defaultTimeout})}searchMetrics(e,t){return ym((n,r)=>this.searchMetricsPage({...e,cursor:n},{...t,signal:r}),t?.signal)}async searchMetricsPage(e,t){let n=Rl.metricsDataFilterSchema.parse(e);return _m(`${this.baseUrl}/signals/metrics/search`,Cm,{method:`POST`,body:n,...t,baseHeaders:this.baseHeaders,fetchFn:this.fetchFn,defaultTimeout:this.defaultTimeout})}async searchAggregatedMetrics(e,t){let n=Rl.metricsDataFilterSchema.parse(e);return _m(`${this.baseUrl}/signals/metrics/search`,wm,{method:`POST`,body:n,...t,baseHeaders:this.baseHeaders,fetchFn:this.fetchFn,defaultTimeout:this.defaultTimeout})}async discoverMetrics(e){return _m(`${this.baseUrl}/signals/metrics/discover`,jm,{method:`GET`,...e,baseHeaders:this.baseHeaders,fetchFn:this.fetchFn,defaultTimeout:this.defaultTimeout})}async getDashboard(e,t){return _m(`${this.baseUrl}/dashboards/${e}`,Em,{method:`GET`,...t,baseHeaders:this.baseHeaders,fetchFn:this.fetchFn,defaultTimeout:this.defaultTimeout})}async searchDashboardsPage(e,t){let n=Kl.searchDashboardsFilter.parse(e);return _m(`${this.baseUrl}/dashboards/search`,Dm,{method:`POST`,body:n,...t,baseHeaders:this.baseHeaders,fetchFn:this.fetchFn,defaultTimeout:this.defaultTimeout})}searchDashboards(e,t){return ym((n,r)=>this.searchDashboardsPage({...e,cursor:n},{...t,signal:r}),t?.signal)}async createDashboard(e,t){return _m(`${this.baseUrl}/dashboards`,Em,{method:`POST`,body:e,...t,baseHeaders:this.baseHeaders,fetchFn:this.fetchFn,defaultTimeout:this.defaultTimeout})}async getServices(e){return _m(`${this.baseUrl}/signals/services`,Om,{method:`GET`,...e,baseHeaders:this.baseHeaders,fetchFn:this.fetchFn,defaultTimeout:this.defaultTimeout})}async getOperations(e,t){let n=new URLSearchParams({serviceName:e});return _m(`${this.baseUrl}/signals/traces/operations?${n}`,km,{method:`GET`,...t,baseHeaders:this.baseHeaders,fetchFn:this.fetchFn,defaultTimeout:this.defaultTimeout})}async searchTraceSummariesPage(e,t){let n=Rl.traceSummariesFilterSchema.parse(e);return _m(`${this.baseUrl}/signals/traces/summaries`,Am,{method:`POST`,body:n,...t,baseHeaders:this.baseHeaders,fetchFn:this.fetchFn,defaultTimeout:this.defaultTimeout})}async queryTracesRaw(e,t){let n=Ql.TraceRawQuerySchema.parse(e);return Ld.validateKopaiQuery(n),_m(`${this.baseUrl}/signals/query/traces/raw`,xm,{method:`POST`,body:n,...t,baseHeaders:this.baseHeaders,fetchFn:this.fetchFn,defaultTimeout:this.defaultTimeout})}async queryTracesAggregate(e,t){let n=Ql.TraceAggregateQuerySchema.parse(e);return Ld.validateKopaiQuery(n),await _m(`${this.baseUrl}/signals/query/traces/aggregate`,Tm,{method:`POST`,body:n,...t,baseHeaders:this.baseHeaders,fetchFn:this.fetchFn,defaultTimeout:this.defaultTimeout})}async queryLogsRaw(e,t){let n=Ql.LogRawQuerySchema.parse(e);return Ld.validateKopaiQuery(n),_m(`${this.baseUrl}/signals/query/logs/raw`,Sm,{method:`POST`,body:n,...t,baseHeaders:this.baseHeaders,fetchFn:this.fetchFn,defaultTimeout:this.defaultTimeout})}async queryLogsAggregate(e,t){let n=Ql.LogAggregateQuerySchema.parse(e);return Ld.validateKopaiQuery(n),await _m(`${this.baseUrl}/signals/query/logs/aggregate`,Tm,{method:`POST`,body:n,...t,baseHeaders:this.baseHeaders,fetchFn:this.fetchFn,defaultTimeout:this.defaultTimeout})}async queryMetricsRaw(e,t){let n=Ql.MetricRawQuerySchema.parse(e);return Ld.validateKopaiQuery(n),_m(`${this.baseUrl}/signals/query/metrics/raw`,Cm,{method:`POST`,body:n,...t,baseHeaders:this.baseHeaders,fetchFn:this.fetchFn,defaultTimeout:this.defaultTimeout})}async queryMetricsAggregate(e,t){let n=Ql.MetricAggregateQuerySchema.parse(e);return Ld.validateKopaiQuery(n),await _m(`${this.baseUrl}/signals/query/metrics/aggregate`,Tm,{method:`POST`,body:n,...t,baseHeaders:this.baseHeaders,fetchFn:this.fetchFn,defaultTimeout:this.defaultTimeout})}async query(e,t){let n;return n=e.signal===`traces`&&e.mode===`raw`?await this.queryTracesRaw(e,t):e.signal===`traces`?await this.queryTracesAggregate(e,t):e.signal===`logs`&&e.mode===`raw`?await this.queryLogsRaw(e,t):e.signal===`logs`?await this.queryLogsAggregate(e,t):e.mode===`raw`?await this.queryMetricsRaw(e,t):await this.queryMetricsAggregate(e,t),n}};new Set(Ql.TraceColumn.options),new Set(Ql.LogColumn.options),new Set(Ql.MetricColumn.options);function Nm(e){var t,n,r=``;if(typeof e==`string`||typeof e==`number`)r+=e;else if(typeof e==`object`){if(Array.isArray(e)){var i=e.length;for(t=0;t<i;t++)e[t]&&(n=Nm(e[t]))&&(r&&(r+=` `),r+=n)}else for(n in e)e[n]&&(r&&(r+=` `),r+=n)}return r}function Pm(){for(var e,t,n=0,r=``,i=arguments.length;n<i;n++)(e=arguments[n])&&(t=Nm(e))&&(r&&(r+=` `),r+=t);return r}var Fm=`dangerouslySetInnerHTML.onCopy.onCopyCapture.onCut.onCutCapture.onPaste.onPasteCapture.onCompositionEnd.onCompositionEndCapture.onCompositionStart.onCompositionStartCapture.onCompositionUpdate.onCompositionUpdateCapture.onFocus.onFocusCapture.onBlur.onBlurCapture.onChange.onChangeCapture.onBeforeInput.onBeforeInputCapture.onInput.onInputCapture.onReset.onResetCapture.onSubmit.onSubmitCapture.onInvalid.onInvalidCapture.onLoad.onLoadCapture.onError.onErrorCapture.onKeyDown.onKeyDownCapture.onKeyPress.onKeyPressCapture.onKeyUp.onKeyUpCapture.onAbort.onAbortCapture.onCanPlay.onCanPlayCapture.onCanPlayThrough.onCanPlayThroughCapture.onDurationChange.onDurationChangeCapture.onEmptied.onEmptiedCapture.onEncrypted.onEncryptedCapture.onEnded.onEndedCapture.onLoadedData.onLoadedDataCapture.onLoadedMetadata.onLoadedMetadataCapture.onLoadStart.onLoadStartCapture.onPause.onPauseCapture.onPlay.onPlayCapture.onPlaying.onPlayingCapture.onProgress.onProgressCapture.onRateChange.onRateChangeCapture.onSeeked.onSeekedCapture.onSeeking.onSeekingCapture.onStalled.onStalledCapture.onSuspend.onSuspendCapture.onTimeUpdate.onTimeUpdateCapture.onVolumeChange.onVolumeChangeCapture.onWaiting.onWaitingCapture.onAuxClick.onAuxClickCapture.onClick.onClickCapture.onContextMenu.onContextMenuCapture.onDoubleClick.onDoubleClickCapture.onDrag.onDragCapture.onDragEnd.onDragEndCapture.onDragEnter.onDragEnterCapture.onDragExit.onDragExitCapture.onDragLeave.onDragLeaveCapture.onDragOver.onDragOverCapture.onDragStart.onDragStartCapture.onDrop.onDropCapture.onMouseDown.onMouseDownCapture.onMouseEnter.onMouseLeave.onMouseMove.onMouseMoveCapture.onMouseOut.onMouseOutCapture.onMouseOver.onMouseOverCapture.onMouseUp.onMouseUpCapture.onSelect.onSelectCapture.onTouchCancel.onTouchCancelCapture.onTouchEnd.onTouchEndCapture.onTouchMove.onTouchMoveCapture.onTouchStart.onTouchStartCapture.onPointerDown.onPointerDownCapture.onPointerMove.onPointerMoveCapture.onPointerUp.onPointerUpCapture.onPointerCancel.onPointerCancelCapture.onPointerEnter.onPointerEnterCapture.onPointerLeave.onPointerLeaveCapture.onPointerOver.onPointerOverCapture.onPointerOut.onPointerOutCapture.onGotPointerCapture.onGotPointerCaptureCapture.onLostPointerCapture.onLostPointerCaptureCapture.onScroll.onScrollCapture.onWheel.onWheelCapture.onAnimationStart.onAnimationStartCapture.onAnimationEnd.onAnimationEndCapture.onAnimationIteration.onAnimationIterationCapture.onTransitionEnd.onTransitionEndCapture`.split(`.`);function Im(e){return typeof e==`string`&&Fm.includes(e)}var Lm=new Set(`aria-activedescendant.aria-atomic.aria-autocomplete.aria-busy.aria-checked.aria-colcount.aria-colindex.aria-colspan.aria-controls.aria-current.aria-describedby.aria-details.aria-disabled.aria-errormessage.aria-expanded.aria-flowto.aria-haspopup.aria-hidden.aria-invalid.aria-keyshortcuts.aria-label.aria-labelledby.aria-level.aria-live.aria-modal.aria-multiline.aria-multiselectable.aria-orientation.aria-owns.aria-placeholder.aria-posinset.aria-pressed.aria-readonly.aria-relevant.aria-required.aria-roledescription.aria-rowcount.aria-rowindex.aria-rowspan.aria-selected.aria-setsize.aria-sort.aria-valuemax.aria-valuemin.aria-valuenow.aria-valuetext.className.color.height.id.lang.max.media.method.min.name.style.target.width.role.tabIndex.accentHeight.accumulate.additive.alignmentBaseline.allowReorder.alphabetic.amplitude.arabicForm.ascent.attributeName.attributeType.autoReverse.azimuth.baseFrequency.baselineShift.baseProfile.bbox.begin.bias.by.calcMode.capHeight.clip.clipPath.clipPathUnits.clipRule.colorInterpolation.colorInterpolationFilters.colorProfile.colorRendering.contentScriptType.contentStyleType.cursor.cx.cy.d.decelerate.descent.diffuseConstant.direction.display.divisor.dominantBaseline.dur.dx.dy.edgeMode.elevation.enableBackground.end.exponent.externalResourcesRequired.fill.fillOpacity.fillRule.filter.filterRes.filterUnits.floodColor.floodOpacity.focusable.fontFamily.fontSize.fontSizeAdjust.fontStretch.fontStyle.fontVariant.fontWeight.format.from.fx.fy.g1.g2.glyphName.glyphOrientationHorizontal.glyphOrientationVertical.glyphRef.gradientTransform.gradientUnits.hanging.horizAdvX.horizOriginX.href.ideographic.imageRendering.in2.in.intercept.k1.k2.k3.k4.k.kernelMatrix.kernelUnitLength.kerning.keyPoints.keySplines.keyTimes.lengthAdjust.letterSpacing.lightingColor.limitingConeAngle.local.markerEnd.markerHeight.markerMid.markerStart.markerUnits.markerWidth.mask.maskContentUnits.maskUnits.mathematical.mode.numOctaves.offset.opacity.operator.order.orient.orientation.origin.overflow.overlinePosition.overlineThickness.paintOrder.panose1.pathLength.patternContentUnits.patternTransform.patternUnits.pointerEvents.pointsAtX.pointsAtY.pointsAtZ.preserveAlpha.preserveAspectRatio.primitiveUnits.r.radius.refX.refY.renderingIntent.repeatCount.repeatDur.requiredExtensions.requiredFeatures.restart.result.rotate.rx.ry.seed.shapeRendering.slope.spacing.specularConstant.specularExponent.speed.spreadMethod.startOffset.stdDeviation.stemh.stemv.stitchTiles.stopColor.stopOpacity.strikethroughPosition.strikethroughThickness.string.stroke.strokeDasharray.strokeDashoffset.strokeLinecap.strokeLinejoin.strokeMiterlimit.strokeOpacity.strokeWidth.surfaceScale.systemLanguage.tableValues.targetX.targetY.textAnchor.textDecoration.textLength.textRendering.to.transform.u1.u2.underlinePosition.underlineThickness.unicode.unicodeBidi.unicodeRange.unitsPerEm.vAlphabetic.values.vectorEffect.version.vertAdvY.vertOriginX.vertOriginY.vHanging.vIdeographic.viewTarget.visibility.vMathematical.widths.wordSpacing.writingMode.x1.x2.x.xChannelSelector.xHeight.xlinkActuate.xlinkArcrole.xlinkHref.xlinkRole.xlinkShow.xlinkTitle.xlinkType.xmlBase.xmlLang.xmlns.xmlnsXlink.xmlSpace.y1.y2.y.yChannelSelector.z.zoomAndPan.ref.key.angle`.split(`.`));function Rm(e){return typeof e==`string`&&Lm.has(e)}function zm(e){return typeof e==`string`&&e.startsWith(`data-`)}function Bm(e){if(typeof e!=`object`||!e)return{};var t={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(Rm(n)||zm(n))&&(t[n]=e[n]);return t}function Vm(e){if(e==null)return null;if((0,v.isValidElement)(e)&&typeof e.props==`object`&&e.props!==null){var t=e.props;return Bm(t)}return typeof e==`object`&&!Array.isArray(e)?Bm(e):null}function Hm(e){var t={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(Rm(n)||zm(n)||Im(n))&&(t[n]=e[n]);return t}function Um(e){return e==null?null:(0,v.isValidElement)(e)?Hm(e.props):typeof e==`object`&&!Array.isArray(e)?Hm(e):null}var Wm=[`children`,`width`,`height`,`viewBox`,`className`,`style`,`title`,`desc`];function Gm(){return Gm=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Gm.apply(null,arguments)}function Km(e,t){if(e==null)return{};var n,r,i=qm(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)===-1&&{}.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}function qm(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}var Jm=(0,v.forwardRef)((e,t)=>{var n=e.children,r=e.width,i=e.height,a=e.viewBox,o=e.className,s=e.style,c=e.title,l=e.desc,u=Km(e,Wm),d=a||{width:r,height:i,x:0,y:0},f=Pm(`recharts-surface`,o);return v.createElement(`svg`,Gm({},Hm(u),{className:f,width:r,height:i,style:s,viewBox:`${d.x} ${d.y} ${d.width} ${d.height}`,ref:t}),v.createElement(`title`,null,c),v.createElement(`desc`,null,l),n)}),Ym=[`children`,`className`];function Xm(){return Xm=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Xm.apply(null,arguments)}function Zm(e,t){if(e==null)return{};var n,r,i=Qm(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)===-1&&{}.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}function Qm(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}var $m=v.forwardRef((e,t)=>{var n=e.children,r=e.className,i=Zm(e,Ym),a=Pm(`recharts-layer`,r);return v.createElement(`g`,Xm({className:a},Hm(i),{ref:t}),n)});function eh(e){return e===`__proto__`}var th=/\.|(\[(?:[^[\]]*|(["'])(?:(?!\2)[^\\]|\\.)*?\2)\])/;function nh(e){switch(typeof e){case`number`:case`symbol`:return!1;case`string`:return e===``||e.startsWith(`.`)||e.endsWith(`.`)?!1:th.test(e);default:return!1}}function rh(e){return typeof e==`string`||typeof e==`symbol`?e:Object.is(e?.valueOf?.(),-0)?`-0`:String(e)}function ih(e){return typeof e==`symbol`||e instanceof Symbol}function ah(e){return e==null?``:oh(e)}function oh(e){if(typeof e==`string`)return e;if(Array.isArray(e))return e.map(oh).join(`,`);if(ih(e))return e.toString();let t=e+``;return t===`0`&&Object.is(Number(e),-0)?`-0`:t}function sh(e){if(Array.isArray(e))return e.map(rh);if(typeof e==`symbol`)return[e];e=ah(e);let t=[],n=e.length;if(n===0)return t;let r=0,i=``,a=``,o=!1,s=!1,c=/^-?\d+(?:\.\d+)?$/;for(e.charCodeAt(0)===46&&t.push(``);r<n;){let l=e[r];if(a)l===`\\`&&r+1<n?(r++,i+=e[r]):l===a?a=``:i+=l;else if(o){if(l===`"`||l===`'`)a=l,s=!0;else if(l===`]`){if(o=!1,!s&&i.includes(`.`)&&!c.test(i)){let e=i.split(`.`);for(let n=0;n<e.length;n++)e[n]!==``&&t.push(e[n])}else t.push(i);i=``}else i+=l}else if(l===`[`)o=!0,s=!1,i&&=(t.push(i),``);else if(l===`.`){i&&=(t.push(i),``);let n=e[r+1];(n===void 0||n===`.`)&&t.push(``)}else i+=l;r++}return i&&t.push(i),t}function ch(e,t,n){if(e==null)return n;switch(typeof t){case`string`:{if(eh(t))return n;let r=e[t];return r===void 0?nh(t)&&!Object.hasOwn(e,t)?ch(e,sh(t),n):n:r}case`number`:case`symbol`:{typeof t==`number`&&(t=rh(t));let r=e[t];return r===void 0?n:r}default:{if(Array.isArray(t))return lh(e,t,n);if(t=Object.is(t?.valueOf(),-0)?`-0`:String(t),eh(t))return n;let r=e[t];return r===void 0?n:r}}}function lh(e,t,n){if(t.length===0)return n;let r=e;for(let e=0;e<t.length;e++){if(r==null||eh(t[e]))return n;r=r[t[e]]}return r===void 0?n:r}var uh=4;function dh(e){var t=10**(arguments.length>1&&arguments[1]!==void 0?arguments[1]:uh),n=Math.round(e*t)/t;return Object.is(n,-0)?0:n}function fh(e){var t=[...arguments].slice(1);return e.reduce((e,n,r)=>{var i=t[r-1];return typeof i==`string`?e+i+n:i===void 0?e+n:e+dh(i)+n},``)}var ph=e=>e===0?0:e>0?1:-1,mh=e=>typeof e==`number`&&e!=+e,hh=e=>typeof e==`string`&&e.length>1&&e.indexOf(`%`)===e.length-1,X=e=>(typeof e==`number`||e instanceof Number)&&!mh(e),gh=e=>X(e)||typeof e==`string`,_h=0,vh=e=>{var t=++_h;return`${e||``}${t}`},yh=function(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,r=arguments.length>3&&arguments[3]!==void 0&&arguments[3];if(!X(e)&&typeof e!=`string`)return n;var i;if(hh(e)){if(t==null)return n;var a=e.indexOf(`%`);i=t*parseFloat(e.slice(0,a))/100}else i=+e;return mh(i)&&(i=n),r&&t!=null&&i>t&&(i=t),i},bh=e=>{if(!Array.isArray(e))return!1;for(var t=e.length,n={},r=0;r<t;r++)if(!n[String(e[r])])n[String(e[r])]=!0;else return!0;return!1};function xh(e,t,n){return X(e)&&X(t)?dh(e+n*(t-e)):t}function Sh(e,t,n){if(e&&e.length)return e.find(e=>e&&(typeof t==`function`?t(e):ch(e,t))===n)}var Ch=e=>{for(var t=e.length,n=0,r=0,i=0,a=0,o=1/0,s=-1/0,c=0,l=0,u=0;u<t;u++)c=e[u]?.cx||0,l=e[u]?.cy||0,n+=c,r+=l,i+=c*l,a+=c*c,o=Math.min(o,c),s=Math.max(s,c);var d=t*a===n*n?0:(t*i-n*r)/(t*a-n*n);return{xmin:o,xmax:s,a:d,b:(r-d*n)/t}},wh=e=>e==null,Th=e=>wh(e)?e:`${e.charAt(0).toUpperCase()}${e.slice(1)}`;function Eh(e){return e!=null}function Dh(){}function Oh(e){if(e)return{x:e.x,y:e.y,upperWidth:`upperWidth`in e?e.upperWidth:e.width,lowerWidth:`lowerWidth`in e?e.lowerWidth:e.width,width:e.width,height:e.height}}function kh(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Ah(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?kh(Object(n),!0).forEach(function(t){jh(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):kh(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function jh(e,t,n){return(t=Mh(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Mh(e){var t=Nh(e,`string`);return typeof t==`symbol`?t:t+``}function Nh(e,t){if(typeof e!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(typeof r!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}var Ph=e=>{var t=e.viewBox,n=e.position,r=e.offset,i=r===void 0?0:r,a=e.parentViewBox,o=e.clamp,s=Oh(t),c=s.x,l=s.y,u=s.height,d=s.upperWidth,f=s.lowerWidth,p=c,m=c+(d-f)/2,h=(p+m)/2,g=(d+f)/2,_=p+d/2,v=u>=0?1:-1,y=v*i,b=v>0?`end`:`start`,x=v>0?`start`:`end`,S=d>=0?1:-1,C=S*i,w=S>0?`end`:`start`,T=S>0?`start`:`end`,E=a;if(n===`top`){var D={x:p+d/2,y:l-y,horizontalAnchor:`middle`,verticalAnchor:b};return o&&E&&(D.height=Math.max(l-E.y,0),D.width=d),D}if(n===`bottom`){var O={x:m+f/2,y:l+u+y,horizontalAnchor:`middle`,verticalAnchor:x};return o&&E&&(O.height=Math.max(E.y+E.height-(l+u),0),O.width=f),O}if(n===`left`){var k={x:h-C,y:l+u/2,horizontalAnchor:w,verticalAnchor:`middle`};return o&&E&&(k.width=Math.max(k.x-E.x,0),k.height=u),k}if(n===`right`){var A={x:h+g+C,y:l+u/2,horizontalAnchor:T,verticalAnchor:`middle`};return o&&E&&(A.width=Math.max(E.x+E.width-A.x,0),A.height=u),A}var j=o&&E?{width:g,height:u}:{};return n===`insideLeft`?Ah({x:h+C,y:l+u/2,horizontalAnchor:T,verticalAnchor:`middle`},j):n===`insideRight`?Ah({x:h+g-C,y:l+u/2,horizontalAnchor:w,verticalAnchor:`middle`},j):n===`insideTop`?Ah({x:p+d/2,y:l+y,horizontalAnchor:`middle`,verticalAnchor:x},j):n===`insideBottom`?Ah({x:m+f/2,y:l+u-y,horizontalAnchor:`middle`,verticalAnchor:b},j):n===`insideTopLeft`?Ah({x:p+C,y:l+y,horizontalAnchor:T,verticalAnchor:x},j):n===`insideTopRight`?Ah({x:p+d-C,y:l+y,horizontalAnchor:w,verticalAnchor:x},j):n===`insideBottomLeft`?Ah({x:m+C,y:l+u-y,horizontalAnchor:T,verticalAnchor:b},j):n===`insideBottomRight`?Ah({x:m+f-C,y:l+u-y,horizontalAnchor:w,verticalAnchor:b},j):n&&typeof n==`object`&&(X(n.x)||hh(n.x))&&(X(n.y)||hh(n.y))?Ah({x:c+yh(n.x,g),y:l+yh(n.y,u),horizontalAnchor:`end`,verticalAnchor:`end`},j):Ah({x:_,y:l+u/2,horizontalAnchor:`middle`,verticalAnchor:`middle`},j)},Fh=[`top`,`left`,`right`,`bottom`];function Ih(e){return e==null?!1:typeof e==`object`||Fh.includes(e)}var Lh=(0,v.createContext)(null),Rh=()=>(0,v.useContext)(Lh);function zh(e){return function(){return e}}var Bh=Math.cos,Vh=Math.sin,Hh=Math.sqrt,Uh=Math.PI;Uh/2;var Wh=2*Uh,Gh=Math.PI,Kh=2*Gh,qh=1e-6,Jh=Kh-qh;function Yh(e){this._+=e[0];for(let t=1,n=e.length;t<n;++t)this._+=arguments[t]+e[t]}function Xh(e){let t=Math.floor(e);if(!(t>=0))throw Error(`invalid digits: ${e}`);if(t>15)return Yh;let n=10**t;return function(e){this._+=e[0];for(let t=1,r=e.length;t<r;++t)this._+=Math.round(arguments[t]*n)/n+e[t]}}var Zh=class{constructor(e){this._x0=this._y0=this._x1=this._y1=null,this._=``,this._append=e==null?Yh:Xh(e)}moveTo(e,t){this._append`M${this._x0=this._x1=+e},${this._y0=this._y1=+t}`}closePath(){this._x1!==null&&(this._x1=this._x0,this._y1=this._y0,this._append`Z`)}lineTo(e,t){this._append`L${this._x1=+e},${this._y1=+t}`}quadraticCurveTo(e,t,n,r){this._append`Q${+e},${+t},${this._x1=+n},${this._y1=+r}`}bezierCurveTo(e,t,n,r,i,a){this._append`C${+e},${+t},${+n},${+r},${this._x1=+i},${this._y1=+a}`}arcTo(e,t,n,r,i){if(e=+e,t=+t,n=+n,r=+r,i=+i,i<0)throw Error(`negative radius: ${i}`);let a=this._x1,o=this._y1,s=n-e,c=r-t,l=a-e,u=o-t,d=l*l+u*u;if(this._x1===null)this._append`M${this._x1=e},${this._y1=t}`;else if(d>qh){if(!(Math.abs(u*s-c*l)>qh)||!i)this._append`L${this._x1=e},${this._y1=t}`;else{let f=n-a,p=r-o,m=s*s+c*c,h=f*f+p*p,g=Math.sqrt(m),_=Math.sqrt(d),v=i*Math.tan((Gh-Math.acos((m+d-h)/(2*g*_)))/2),y=v/_,b=v/g;Math.abs(y-1)>qh&&this._append`L${e+y*l},${t+y*u}`,this._append`A${i},${i},0,0,${+(u*f>l*p)},${this._x1=e+b*s},${this._y1=t+b*c}`}}}arc(e,t,n,r,i,a){if(e=+e,t=+t,n=+n,a=!!a,n<0)throw Error(`negative radius: ${n}`);let o=n*Math.cos(r),s=n*Math.sin(r),c=e+o,l=t+s,u=1^a,d=a?r-i:i-r;this._x1===null?this._append`M${c},${l}`:(Math.abs(this._x1-c)>qh||Math.abs(this._y1-l)>qh)&&this._append`L${c},${l}`,n&&(d<0&&(d=d%Kh+Kh),d>Jh?this._append`A${n},${n},0,1,${u},${e-o},${t-s}A${n},${n},0,1,${u},${this._x1=c},${this._y1=l}`:d>qh&&this._append`A${n},${n},0,${+(d>=Gh)},${u},${this._x1=e+n*Math.cos(i)},${this._y1=t+n*Math.sin(i)}`)}rect(e,t,n,r){this._append`M${this._x0=this._x1=+e},${this._y0=this._y1=+t}h${n=+n}v${+r}h${-n}Z`}toString(){return this._}};Zh.prototype;function Qh(e){let t=3;return e.digits=function(n){if(!arguments.length)return t;if(n==null)t=null;else{let e=Math.floor(n);if(!(e>=0))throw RangeError(`invalid digits: ${n}`);t=e}return e},()=>new Zh(t)}Array.prototype.slice;function $h(e){return typeof e==`object`&&`length`in e?e:Array.from(e)}function eg(e){this._context=e}eg.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:this._context.lineTo(e,t)}}};function tg(e){return new eg(e)}function ng(e){return e[0]}function rg(e){return e[1]}function ig(e,t){var n=zh(!0),r=null,i=tg,a=null,o=Qh(s);e=typeof e==`function`?e:e===void 0?ng:zh(e),t=typeof t==`function`?t:t===void 0?rg:zh(t);function s(s){var c,l=(s=$h(s)).length,u,d=!1,f;for(r??(a=i(f=o())),c=0;c<=l;++c)!(c<l&&n(u=s[c],c,s))===d&&((d=!d)?a.lineStart():a.lineEnd()),d&&a.point(+e(u,c,s),+t(u,c,s));if(f)return a=null,f+``||null}return s.x=function(t){return arguments.length?(e=typeof t==`function`?t:zh(+t),s):e},s.y=function(e){return arguments.length?(t=typeof e==`function`?e:zh(+e),s):t},s.defined=function(e){return arguments.length?(n=typeof e==`function`?e:zh(!!e),s):n},s.curve=function(e){return arguments.length?(i=e,r!=null&&(a=i(r)),s):i},s.context=function(e){return arguments.length?(e==null?r=a=null:a=i(r=e),s):r},s}function ag(e,t,n){var r=null,i=zh(!0),a=null,o=tg,s=null,c=Qh(l);e=typeof e==`function`?e:e===void 0?ng:zh(+e),t=typeof t==`function`?t:zh(t===void 0?0:+t),n=typeof n==`function`?n:n===void 0?rg:zh(+n);function l(l){var u,d,f,p=(l=$h(l)).length,m,h=!1,g,_=Array(p),v=Array(p);for(a??(s=o(g=c())),u=0;u<=p;++u){if(!(u<p&&i(m=l[u],u,l))===h){if(h=!h)d=u,s.areaStart(),s.lineStart();else{for(s.lineEnd(),s.lineStart(),f=u-1;f>=d;--f)s.point(_[f],v[f]);s.lineEnd(),s.areaEnd()}}h&&(_[u]=+e(m,u,l),v[u]=+t(m,u,l),s.point(r?+r(m,u,l):_[u],n?+n(m,u,l):v[u]))}if(g)return s=null,g+``||null}function u(){return ig().defined(i).curve(o).context(a)}return l.x=function(t){return arguments.length?(e=typeof t==`function`?t:zh(+t),r=null,l):e},l.x0=function(t){return arguments.length?(e=typeof t==`function`?t:zh(+t),l):e},l.x1=function(e){return arguments.length?(r=e==null?null:typeof e==`function`?e:zh(+e),l):r},l.y=function(e){return arguments.length?(t=typeof e==`function`?e:zh(+e),n=null,l):t},l.y0=function(e){return arguments.length?(t=typeof e==`function`?e:zh(+e),l):t},l.y1=function(e){return arguments.length?(n=e==null?null:typeof e==`function`?e:zh(+e),l):n},l.lineX0=l.lineY0=function(){return u().x(e).y(t)},l.lineY1=function(){return u().x(e).y(n)},l.lineX1=function(){return u().x(r).y(t)},l.defined=function(e){return arguments.length?(i=typeof e==`function`?e:zh(!!e),l):i},l.curve=function(e){return arguments.length?(o=e,a!=null&&(s=o(a)),l):o},l.context=function(e){return arguments.length?(e==null?a=s=null:s=o(a=e),l):a},l}var og=class{constructor(e,t){this._context=e,this._x=t}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._point=0}lineEnd(){(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line}point(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:this._x?this._context.bezierCurveTo(this._x0=(this._x0+e)/2,this._y0,this._x0,t,e,t):this._context.bezierCurveTo(this._x0,this._y0=(this._y0+t)/2,e,this._y0,e,t)}this._x0=e,this._y0=t}};function sg(e){return new og(e,!0)}function cg(e){return new og(e,!1)}var lg={draw(e,t){let n=Hh(t/Uh);e.moveTo(n,0),e.arc(0,0,n,0,Wh)}},ug={draw(e,t){let n=Hh(t/5)/2;e.moveTo(-3*n,-n),e.lineTo(-n,-n),e.lineTo(-n,-3*n),e.lineTo(n,-3*n),e.lineTo(n,-n),e.lineTo(3*n,-n),e.lineTo(3*n,n),e.lineTo(n,n),e.lineTo(n,3*n),e.lineTo(-n,3*n),e.lineTo(-n,n),e.lineTo(-3*n,n),e.closePath()}},dg=Hh(1/3),fg=dg*2,pg={draw(e,t){let n=Hh(t/fg),r=n*dg;e.moveTo(0,-n),e.lineTo(r,0),e.lineTo(0,n),e.lineTo(-r,0),e.closePath()}},mg={draw(e,t){let n=Hh(t),r=-n/2;e.rect(r,r,n,n)}},hg=.8908130915292852,gg=Vh(Uh/10)/Vh(7*Uh/10),_g=Vh(Wh/10)*gg,vg=-Bh(Wh/10)*gg,yg={draw(e,t){let n=Hh(t*hg),r=_g*n,i=vg*n;e.moveTo(0,-n),e.lineTo(r,i);for(let t=1;t<5;++t){let a=Wh*t/5,o=Bh(a),s=Vh(a);e.lineTo(s*n,-o*n),e.lineTo(o*r-s*i,s*r+o*i)}e.closePath()}},bg=Hh(3),xg={draw(e,t){let n=-Hh(t/(bg*3));e.moveTo(0,n*2),e.lineTo(-bg*n,-n),e.lineTo(bg*n,-n),e.closePath()}},Sg=-.5,Cg=Hh(3)/2,wg=1/Hh(12),Tg=(wg/2+1)*3,Eg={draw(e,t){let n=Hh(t/Tg),r=n/2,i=n*wg,a=r,o=n*wg+n,s=-a,c=o;e.moveTo(r,i),e.lineTo(a,o),e.lineTo(s,c),e.lineTo(Sg*r-Cg*i,Cg*r+Sg*i),e.lineTo(Sg*a-Cg*o,Cg*a+Sg*o),e.lineTo(Sg*s-Cg*c,Cg*s+Sg*c),e.lineTo(Sg*r+Cg*i,Sg*i-Cg*r),e.lineTo(Sg*a+Cg*o,Sg*o-Cg*a),e.lineTo(Sg*s+Cg*c,Sg*c-Cg*s),e.closePath()}};function Dg(e,t){let n=null,r=Qh(i);e=typeof e==`function`?e:zh(e||lg),t=typeof t==`function`?t:zh(t===void 0?64:+t);function i(){let i;if(n||=i=r(),e.apply(this,arguments).draw(n,+t.apply(this,arguments)),i)return n=null,i+``||null}return i.type=function(t){return arguments.length?(e=typeof t==`function`?t:zh(t),i):e},i.size=function(e){return arguments.length?(t=typeof e==`function`?e:zh(+e),i):t},i.context=function(e){return arguments.length?(n=e??null,i):n},i}function Og(){}function kg(e,t,n){e._context.bezierCurveTo((2*e._x0+e._x1)/3,(2*e._y0+e._y1)/3,(e._x0+2*e._x1)/3,(e._y0+2*e._y1)/3,(e._x0+4*e._x1+t)/6,(e._y0+4*e._y1+n)/6)}function Ag(e){this._context=e}Ag.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){switch(this._point){case 3:kg(this,this._x1,this._y1);case 2:this._context.lineTo(this._x1,this._y1)}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;break;case 2:this._point=3,this._context.lineTo((5*this._x0+this._x1)/6,(5*this._y0+this._y1)/6);default:kg(this,e,t)}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function jg(e){return new Ag(e)}function Mg(e){this._context=e}Mg.prototype={areaStart:Og,areaEnd:Og,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._y0=this._y1=this._y2=this._y3=this._y4=NaN,this._point=0},lineEnd:function(){switch(this._point){case 1:this._context.moveTo(this._x2,this._y2),this._context.closePath();break;case 2:this._context.moveTo((this._x2+2*this._x3)/3,(this._y2+2*this._y3)/3),this._context.lineTo((this._x3+2*this._x2)/3,(this._y3+2*this._y2)/3),this._context.closePath();break;case 3:this.point(this._x2,this._y2),this.point(this._x3,this._y3),this.point(this._x4,this._y4)}},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._x2=e,this._y2=t;break;case 1:this._point=2,this._x3=e,this._y3=t;break;case 2:this._point=3,this._x4=e,this._y4=t,this._context.moveTo((this._x0+4*this._x1+e)/6,(this._y0+4*this._y1+t)/6);break;default:kg(this,e,t)}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function Ng(e){return new Mg(e)}function Pg(e){this._context=e}Pg.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===3)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3;var n=(this._x0+4*this._x1+e)/6,r=(this._y0+4*this._y1+t)/6;this._line?this._context.lineTo(n,r):this._context.moveTo(n,r);break;case 3:this._point=4;default:kg(this,e,t)}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function Fg(e){return new Pg(e)}function Ig(e){this._context=e}Ig.prototype={areaStart:Og,areaEnd:Og,lineStart:function(){this._point=0},lineEnd:function(){this._point&&this._context.closePath()},point:function(e,t){e=+e,t=+t,this._point?this._context.lineTo(e,t):(this._point=1,this._context.moveTo(e,t))}};function Lg(e){return new Ig(e)}function Rg(e){return e<0?-1:1}function zg(e,t,n){var r=e._x1-e._x0,i=t-e._x1,a=(e._y1-e._y0)/(r||i<0&&-0),o=(n-e._y1)/(i||r<0&&-0),s=(a*i+o*r)/(r+i);return(Rg(a)+Rg(o))*Math.min(Math.abs(a),Math.abs(o),.5*Math.abs(s))||0}function Bg(e,t){var n=e._x1-e._x0;return n?(3*(e._y1-e._y0)/n-t)/2:t}function Vg(e,t,n){var r=e._x0,i=e._y0,a=e._x1,o=e._y1,s=(a-r)/3;e._context.bezierCurveTo(r+s,i+s*t,a-s,o-s*n,a,o)}function Hg(e){this._context=e}Hg.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=this._t0=NaN,this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x1,this._y1);break;case 3:Vg(this,this._t0,Bg(this,this._t0))}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){var n=NaN;if(e=+e,t=+t,e!==this._x1||t!==this._y1){switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;break;case 2:this._point=3,Vg(this,Bg(this,n=zg(this,e,t)),n);break;default:Vg(this,this._t0,n=zg(this,e,t))}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t,this._t0=n}}};function Ug(e){this._context=new Wg(e)}(Ug.prototype=Object.create(Hg.prototype)).point=function(e,t){Hg.prototype.point.call(this,t,e)};function Wg(e){this._context=e}Wg.prototype={moveTo:function(e,t){this._context.moveTo(t,e)},closePath:function(){this._context.closePath()},lineTo:function(e,t){this._context.lineTo(t,e)},bezierCurveTo:function(e,t,n,r,i,a){this._context.bezierCurveTo(t,e,r,n,a,i)}};function Gg(e){return new Hg(e)}function Kg(e){return new Ug(e)}function qg(e){this._context=e}qg.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=[],this._y=[]},lineEnd:function(){var e=this._x,t=this._y,n=e.length;if(n){if(this._line?this._context.lineTo(e[0],t[0]):this._context.moveTo(e[0],t[0]),n===2)this._context.lineTo(e[1],t[1]);else for(var r=Jg(e),i=Jg(t),a=0,o=1;o<n;++a,++o)this._context.bezierCurveTo(r[0][a],i[0][a],r[1][a],i[1][a],e[o],t[o])}(this._line||this._line!==0&&n===1)&&this._context.closePath(),this._line=1-this._line,this._x=this._y=null},point:function(e,t){this._x.push(+e),this._y.push(+t)}};function Jg(e){var t,n=e.length-1,r,i=Array(n),a=Array(n),o=Array(n);for(i[0]=0,a[0]=2,o[0]=e[0]+2*e[1],t=1;t<n-1;++t)i[t]=1,a[t]=4,o[t]=4*e[t]+2*e[t+1];for(i[n-1]=2,a[n-1]=7,o[n-1]=8*e[n-1]+e[n],t=1;t<n;++t)r=i[t]/a[t-1],a[t]-=r,o[t]-=r*o[t-1];for(i[n-1]=o[n-1]/a[n-1],t=n-2;t>=0;--t)i[t]=(o[t]-i[t+1])/a[t];for(a[n-1]=(e[n]+i[n-1])/2,t=0;t<n-1;++t)a[t]=2*e[t+1]-i[t+1];return[i,a]}function Yg(e){return new qg(e)}function Xg(e,t){this._context=e,this._t=t}Xg.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=this._y=NaN,this._point=0},lineEnd:function(){0<this._t&&this._t<1&&this._point===2&&this._context.lineTo(this._x,this._y),(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line>=0&&(this._t=1-this._t,this._line=1-this._line)},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:if(this._t<=0)this._context.lineTo(this._x,t),this._context.lineTo(e,t);else{var n=this._x*(1-this._t)+e*this._t;this._context.lineTo(n,this._y),this._context.lineTo(n,t)}}this._x=e,this._y=t}};function Zg(e){return new Xg(e,.5)}function Qg(e){return new Xg(e,0)}function $g(e){return new Xg(e,1)}function e_(e,t){if((o=e.length)>1)for(var n=1,r,i,a=e[t[0]],o,s=a.length;n<o;++n)for(i=a,a=e[t[n]],r=0;r<s;++r)a[r][1]+=a[r][0]=isNaN(i[r][1])?i[r][0]:i[r][1]}function t_(e){for(var t=e.length,n=Array(t);--t>=0;)n[t]=t;return n}function n_(e,t){return e[t]}function r_(e){let t=[];return t.key=e,t}function i_(){var e=zh([]),t=t_,n=e_,r=n_;function i(i){var a=Array.from(e.apply(this,arguments),r_),o,s=a.length,c=-1,l;for(let e of i)for(o=0,++c;o<s;++o)(a[o][c]=[0,+r(e,a[o].key,c,i)]).data=e;for(o=0,l=$h(t(a));o<s;++o)a[l[o]].index=o;return n(a,l),a}return i.keys=function(t){return arguments.length?(e=typeof t==`function`?t:zh(Array.from(t)),i):e},i.value=function(e){return arguments.length?(r=typeof e==`function`?e:zh(+e),i):r},i.order=function(e){return arguments.length?(t=e==null?t_:typeof e==`function`?e:zh(Array.from(e)),i):t},i.offset=function(e){return arguments.length?(n=e??e_,i):n},i}function a_(e,t){if((r=e.length)>0){for(var n,r,i=0,a=e[0].length,o;i<a;++i){for(o=n=0;n<r;++n)o+=e[n][i][1]||0;if(o)for(n=0;n<r;++n)e[n][i][1]/=o}e_(e,t)}}function o_(e,t){if((i=e.length)>0){for(var n=0,r=e[t[0]],i,a=r.length;n<a;++n){for(var o=0,s=0;o<i;++o)s+=e[o][n][1]||0;r[n][1]+=r[n][0]=-s/2}e_(e,t)}}function s_(e,t){if((o=e.length)>0&&(a=(i=e[t[0]]).length)>0){for(var n=0,r=1,i,a,o;r<a;++r){for(var s=0,c=0,l=0;s<o;++s){for(var u=e[t[s]],d=u[r][1]||0,f=(d-(u[r-1][1]||0))/2,p=0;p<s;++p){var m=e[t[p]],h=m[r][1]||0,g=m[r-1][1]||0;f+=h-g}c+=d,l+=f*d}i[r-1][1]+=i[r-1][0]=n,c&&(n-=l/c)}i[r-1][1]+=i[r-1][0]=n,e_(e,t)}}var c_=[`type`,`size`,`sizeType`];function l_(){return l_=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},l_.apply(null,arguments)}function u_(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function d_(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?u_(Object(n),!0).forEach(function(t){f_(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):u_(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function f_(e,t,n){return(t=p_(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function p_(e){var t=m_(e,`string`);return typeof t==`symbol`?t:t+``}function m_(e,t){if(typeof e!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(typeof r!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function h_(e,t){if(e==null)return{};var n,r,i=g_(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)===-1&&{}.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}function g_(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}var __={symbolCircle:lg,symbolCross:ug,symbolDiamond:pg,symbolSquare:mg,symbolStar:yg,symbolTriangle:xg,symbolWye:Eg},v_=Math.PI/180,y_=e=>__[`symbol${Th(e)}`]||lg,b_=(e,t,n)=>{if(t===`area`)return e;switch(n){case`cross`:return 5*e*e/9;case`diamond`:return .5*e*e/Math.sqrt(3);case`square`:return e*e;case`star`:var r=18*v_;return 1.25*e*e*(Math.tan(r)-Math.tan(r*2)*Math.tan(r)**2);case`triangle`:return Math.sqrt(3)*e*e/4;case`wye`:return(21-10*Math.sqrt(3))*e*e/8;default:return Math.PI*e*e/4}},x_=(e,t)=>{__[`symbol${Th(e)}`]=t},S_=e=>{var t=e.type,n=t===void 0?`circle`:t,r=e.size,i=r===void 0?64:r,a=e.sizeType,o=a===void 0?`area`:a,s=d_(d_({},h_(e,c_)),{},{type:n,size:i,sizeType:o}),c=`circle`;typeof n==`string`&&(c=n);var l=()=>{var e=y_(c),t=Dg().type(e).size(b_(i,o,c))();if(t!==null)return t},u=s.className,d=s.cx,f=s.cy,p=Hm(s);return X(d)&&X(f)&&X(i)?v.createElement(`path`,l_({},p,{className:Pm(`recharts-symbols`,u),transform:`translate(${d}, ${f})`,d:l()})):null};S_.registerSymbol=x_;var C_=e=>`radius`in e&&`startAngle`in e&&`endAngle`in e,w_=(e,t)=>{if(!e||typeof e==`function`||typeof e==`boolean`)return null;var n=e;if((0,v.isValidElement)(e)&&(n=e.props),typeof n!=`object`&&typeof n!=`function`)return null;var r={};return Object.keys(n).forEach(e=>{Im(e)&&typeof n[e]==`function`&&(r[e]=t||(t=>n[e](n,t)))}),r},T_=(e,t,n)=>r=>(e(t,n,r),null),E_=(e,t,n)=>{if(e===null||typeof e!=`object`&&typeof e!=`function`)return null;var r=null;return Object.keys(e).forEach(i=>{var a=e[i];Im(i)&&typeof a==`function`&&(r||={},r[i]=T_(a,t,n))}),r},D_=e=>Array.isArray(e)&&e.length>0;function O_(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function k_(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?O_(Object(n),!0).forEach(function(t){A_(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):O_(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function A_(e,t,n){return(t=j_(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function j_(e){var t=M_(e,`string`);return typeof t==`symbol`?t:t+``}function M_(e,t){if(typeof e!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(typeof r!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function N_(e,t){var n=k_({},e),r=t;return Object.keys(t).reduce((e,t)=>(e[t]===void 0&&r[t]!==void 0&&(e[t]=r[t]),e),n)}function P_(){return P_=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},P_.apply(null,arguments)}function F_(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function I_(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?F_(Object(n),!0).forEach(function(t){L_(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):F_(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function L_(e,t,n){return(t=R_(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function R_(e){var t=z_(e,`string`);return typeof t==`symbol`?t:t+``}function z_(e,t){if(typeof e!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(typeof r!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}var B_=32,V_={align:`center`,iconSize:14,inactiveColor:`#ccc`,layout:`horizontal`,verticalAlign:`middle`,labelStyle:{}};function H_(e){if(typeof e==`object`&&e&&`strokeDasharray`in e)return String(e.strokeDasharray)}function U_(e){var t=e.data,n=e.iconType,r=e.inactiveColor,i=B_/2,a=B_/6,o=B_/3,s=t.inactive?r:t.color,c=n??t.type;if(c===`none`)return null;if(c===`plainline`)return v.createElement(`line`,{strokeWidth:4,fill:`none`,stroke:s,strokeDasharray:H_(t.payload),x1:0,y1:i,x2:B_,y2:i,className:`recharts-legend-icon`});if(c===`line`)return v.createElement(`path`,{strokeWidth:4,fill:`none`,stroke:s,d:`M0,${i}h${o}
64
64
  A${a},${a},0,1,1,${2*o},${i}
65
65
  H${B_}M${2*o},${i}
66
66
  A${a},${a},0,1,1,${o},${i}`,className:`recharts-legend-icon`});if(c===`rect`)return v.createElement(`path`,{stroke:`none`,fill:s,d:`M0,${B_/8}h${B_}v${B_*3/4}h${-B_}z`,className:`recharts-legend-icon`});if(v.isValidElement(t.legendIcon)){var l=I_({},t);return delete l.legendIcon,v.cloneElement(t.legendIcon,l)}return v.createElement(S_,{fill:s,cx:i,cy:i,size:B_,sizeType:`diameter`,type:c})}function W_(e){var t=e.payload,n=e.iconSize,r=e.layout,i=e.formatter,a=e.inactiveColor,o=e.iconType,s=e.labelStyle,c={x:0,y:0,width:B_,height:B_},l={display:r===`horizontal`?`inline-block`:`block`,marginRight:10,whiteSpace:`nowrap`},u={display:`inline-block`,verticalAlign:`middle`,marginRight:4};return t.map((t,r)=>{var d=t.formatter||i,f=Pm({"recharts-legend-item":!0,[`legend-item-${r}`]:!0,inactive:t.inactive});if(t.type===`none`)return null;var p=typeof s==`object`?I_({},s):{};p.color=t.inactive?a:p.color||t.color,p.whiteSpace??=`normal`,p.overflowWrap??=`break-word`;var m=d?d(t.value,t,r):t.value;return v.createElement(`li`,P_({className:f,style:l,key:`legend-item-${r}`},E_(e,t,r)),v.createElement(Jm,{width:n,height:n,viewBox:c,style:u,"aria-label":t.value==null?`legend icon`:`${t.value} legend icon`},v.createElement(U_,{data:t,iconType:o,inactiveColor:a})),v.createElement(`span`,{className:`recharts-legend-item-text`,style:p},m))})}var G_=e=>{var t=N_(e,V_),n=t.payload,r=t.layout,i=t.align;if(!n||!n.length)return null;var a={padding:0,margin:0,textAlign:r===`horizontal`?i:`left`};return v.createElement(`ul`,{className:`recharts-default-legend`,style:a},v.createElement(W_,P_({},t,{payload:n})))};function K_(e,t){let n=new Map;for(let r=0;r<e.length;r++){let i=e[r],a=t(i,r,e);n.has(a)||n.set(a,i)}return Array.from(n.values())}function q_(e,t){return function(...n){return e.apply(this,n.slice(0,t))}}function J_(e){return e}function Y_(e){return Number.isSafeInteger(e)&&e>=0}function X_(e){return e!=null&&typeof e!=`function`&&Y_(e.length)}function Z_(e){return function(t){return ch(t,e)}}function Q_(e){return e==null||typeof e!=`object`&&typeof e!=`function`}function $_(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function ev(e){return Object.getOwnPropertySymbols(e).filter(t=>Object.prototype.propertyIsEnumerable.call(e,t))}function tv(e){return e==null?e===void 0?`[object Undefined]`:`[object Null]`:Object.prototype.toString.call(e)}var nv=`[object RegExp]`,rv=`[object String]`,iv=`[object Number]`,av=`[object Boolean]`,ov=`[object Arguments]`,sv=`[object Symbol]`,cv=`[object Date]`,lv=`[object Map]`,uv=`[object Set]`,dv=`[object Array]`,fv=`[object Function]`,pv=`[object ArrayBuffer]`,mv=`[object Object]`,hv=`[object Error]`,gv=`[object DataView]`,_v=`[object Uint8Array]`,vv=`[object Uint8ClampedArray]`,yv=`[object Uint16Array]`,bv=`[object Uint32Array]`,xv=`[object BigUint64Array]`,Sv=`[object Int8Array]`,Cv=`[object Int16Array]`,wv=`[object Int32Array]`,Tv=`[object BigInt64Array]`,Ev=`[object Float32Array]`,Dv=`[object Float64Array]`,Ov=typeof globalThis==`object`&&globalThis||typeof window==`object`&&window||typeof self==`object`&&self||typeof global==`object`&&global||(function(){return this})();function kv(e){return Ov.Buffer!==void 0&&Ov.Buffer.isBuffer(e)}function Av(e,t){return jv(e,void 0,e,new Map,t)}function jv(e,t,n,r=new Map,i=void 0){let a=i?.(e,t,n,r);if(a!==void 0)return a;if(Q_(e))return e;if(r.has(e))return r.get(e);if(Array.isArray(e)){let t=Array(e.length);r.set(e,t);for(let a=0;a<e.length;a++)t[a]=jv(e[a],a,n,r,i);return Object.hasOwn(e,`index`)&&(t.index=e.index),Object.hasOwn(e,`input`)&&(t.input=e.input),t}if(e instanceof Date)return new Date(e.getTime());if(e instanceof RegExp){let t=new RegExp(e.source,e.flags);return t.lastIndex=e.lastIndex,t}if(e instanceof Map){let t=new Map;r.set(e,t);for(let[a,o]of e)t.set(a,jv(o,a,n,r,i));return t}if(e instanceof Set){let t=new Set;r.set(e,t);for(let a of e)t.add(jv(a,void 0,n,r,i));return t}if(kv(e))return e.subarray();if($_(e)){let t=new(Object.getPrototypeOf(e)).constructor(e.length);r.set(e,t);for(let a=0;a<e.length;a++)t[a]=jv(e[a],a,n,r,i);return t}if(e instanceof ArrayBuffer||typeof SharedArrayBuffer<`u`&&e instanceof SharedArrayBuffer)return e.slice(0);if(e instanceof DataView){let t=new DataView(e.buffer.slice(0),e.byteOffset,e.byteLength);return r.set(e,t),Mv(t,e,n,r,i),t}if(typeof File<`u`&&e instanceof File){let t=new File([e],e.name,{type:e.type});return r.set(e,t),Mv(t,e,n,r,i),t}if(typeof Blob<`u`&&e instanceof Blob){let t=new Blob([e],{type:e.type});return r.set(e,t),Mv(t,e,n,r,i),t}if(e instanceof Error){let t=structuredClone(e);return r.set(e,t),t.message=e.message,t.name=e.name,t.stack=e.stack,t.cause=e.cause,t.constructor=e.constructor,Mv(t,e,n,r,i),t}if(e instanceof Boolean){let t=new Boolean(e.valueOf());return r.set(e,t),Mv(t,e,n,r,i),t}if(e instanceof Number){let t=new Number(e.valueOf());return r.set(e,t),Mv(t,e,n,r,i),t}if(e instanceof String){let t=new String(e.valueOf());return r.set(e,t),Mv(t,e,n,r,i),t}if(typeof e==`object`&&Nv(e)){let t=Object.create(Object.getPrototypeOf(e));return r.set(e,t),Mv(t,e,n,r,i),t}return e}function Mv(e,t,n=e,r,i){let a=[...Object.keys(t),...ev(t)];for(let o=0;o<a.length;o++){let s=a[o],c=Object.getOwnPropertyDescriptor(e,s);(c==null||c.writable)&&(e[s]=jv(t[s],s,n,r,i))}}function Nv(e){switch(tv(e)){case ov:case dv:case pv:case gv:case av:case cv:case Ev:case Dv:case Sv:case Cv:case wv:case lv:case iv:case mv:case nv:case uv:case rv:case sv:case _v:case vv:case yv:case bv:return!0;default:return!1}}function Pv(e){return jv(e,void 0,e,new Map,void 0)}function Fv(e,t){return e===t||Number.isNaN(e)&&Number.isNaN(t)}function Iv(e){return e!==null&&(typeof e==`object`||typeof e==`function`)}function Lv(e,t,n){return typeof n==`function`?Rv(e,t,function e(t,r,i,a,o,s){let c=n(t,r,i,a,o,s);return c===void 0?Rv(t,r,e,s,!1):!!c},new Map,!0):Lv(e,t,()=>void 0)}function Rv(e,t,n,r,i=!1){if(t===e)return!0;switch(typeof t){case`object`:return zv(e,t,n,r,i);case`function`:return Object.keys(t).length>0?Rv(e,{...t},n,r,i):Fv(e,t);default:return Iv(e)&&i?typeof t!=`string`||t===``:Fv(e,t)}}function zv(e,t,n,r,i=!1){if(t==null)return!0;if(Array.isArray(t))return Vv(e,t,n,r);if(t instanceof Map)return Bv(e,t,n,r);if(t instanceof Set)return Hv(e,t,n,r);let a=Object.keys(t);if(e==null)return i&&a.length===0;if(i)Q_(e)&&(e=Object(e));else{let t=tv(e);if(t!==`[object Object]`&&t!==`[object Arguments]`)return!1}if(a.length===0)return!0;if(r?.has(t))return r.get(t)===e;r?.set(t,e);try{for(let i=0;i<a.length;i++){let o=a[i];if(!(o in e)||t[o]===void 0&&e[o]!==void 0||t[o]===null&&e[o]!==null||!n(e[o],t[o],o,e,t,r))return!1}return!0}finally{r?.delete(t)}}function Bv(e,t,n,r){if(t.size===0)return!0;if(!(e instanceof Map))return!1;for(let[i,a]of t.entries())if(n(e.get(i),a,i,e,t,r)===!1)return!1;return!0}function Vv(e,t,n,r){if(t.length===0)return!0;if(!Array.isArray(e))return!1;let i=new Set;for(let a=0;a<t.length;a++){let o=t[a],s=!1;for(let c=0;c<e.length;c++){if(i.has(c))continue;let l=e[c],u=!1;if(n(l,o,a,e,t,r)&&(u=!0),u){i.add(c),s=!0;break}}if(!s)return!1}return!0}function Hv(e,t,n,r){return t.size===0||e instanceof Set&&Vv([...e],[...t],n,r)}function Uv(e,t){return Lv(e,t,()=>void 0)}function Wv(e){return e=Pv(e),t=>Uv(t,e)}function Gv(e,t){return Av(e,(n,r,i,a)=>{let o=t?.(n,r,i,a);if(o!==void 0)return o;if(typeof e==`object`){if(tv(e)===`[object Object]`&&typeof e.constructor!=`function`){let t={};return a.set(e,t),Mv(t,e,i,a),t}switch(Object.prototype.toString.call(e)){case iv:case rv:case av:{let t=new e.constructor(e?.valueOf());return Mv(t,e),t}case ov:{let t={};return Mv(t,e),t.length=e.length,t[Symbol.iterator]=e[Symbol.iterator],t}default:return}}})}function Kv(e){return Gv(e)}var qv=/^(?:0|[1-9]\d*)$/;function Jv(e,t=2**53-1){switch(typeof e){case`number`:return Number.isInteger(e)&&e>=0&&e<t;case`symbol`:return!1;case`string`:return qv.test(e)}}function Yv(e){return typeof e==`object`&&!!e&&tv(e)===`[object Arguments]`}function Xv(e,t){let n;if(n=Array.isArray(t)?t:typeof t==`string`&&nh(t)&&!(t in Object(e))?sh(t):[t],n.length===0)return!1;let r=e;for(let e=0;e<n.length;e++){let t=rh(n[e]);if((r==null||!Object.hasOwn(r,t))&&!((Array.isArray(r)||Yv(r))&&Jv(t)&&Number(t)<r.length))return!1;r=r[t]}return!0}function Zv(e,t){switch(typeof e){case`object`:Object.is(e?.valueOf(),-0)&&(e=`-0`);break;case`number`:e=rh(e)}return t=Kv(t),function(n){let r=ch(n,e);return r===void 0?Xv(n,e):t===void 0?r===void 0:Uv(r,t)}}function Qv(e){if(e==null)return J_;switch(typeof e){case`function`:return e;case`object`:return Array.isArray(e)&&e.length===2?Zv(e[0],e[1]):Wv(e);default:return Z_(e)}}function $v(e){return e===0?0:e}function ey(e,t=J_){return X_(e)?K_(Array.from(e),q_(Qv(t),1)).map($v):[]}function ty(e,t,n){return t===!0?ey(e,n):typeof t==`function`?ey(e,t):e}var ny=o((e=>{var t=d();function n(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var r=typeof Object.is==`function`?Object.is:n,i=t.useState,a=t.useEffect,o=t.useLayoutEffect,s=t.useDebugValue;function c(e,t){var n=t(),r=i({inst:{value:n,getSnapshot:t}}),c=r[0].inst,u=r[1];return o(function(){c.value=n,c.getSnapshot=t,l(c)&&u({inst:c})},[e,n,t]),a(function(){return l(c)&&u({inst:c}),e(function(){l(c)&&u({inst:c})})},[e]),s(n),n}function l(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!r(e,n)}catch{return!0}}function u(e,t){return t()}var f=typeof window>`u`||window.document===void 0||window.document.createElement===void 0?u:c;e.useSyncExternalStore=t.useSyncExternalStore===void 0?f:t.useSyncExternalStore})),ry=o(((e,t)=>{t.exports=ny()})),iy=o((e=>{var t=d(),n=ry();function r(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var i=typeof Object.is==`function`?Object.is:r,a=n.useSyncExternalStore,o=t.useRef,s=t.useEffect,c=t.useMemo,l=t.useDebugValue;e.useSyncExternalStoreWithSelector=function(e,t,n,r,u){var d=o(null);if(d.current===null){var f={hasValue:!1,value:null};d.current=f}else f=d.current;d=c(function(){function e(e){if(!a){if(a=!0,o=e,e=r(e),u!==void 0&&f.hasValue){var t=f.value;if(u(t,e))return s=t}return s=e}if(t=s,i(o,e))return t;var n=r(e);return u!==void 0&&u(t,n)?(o=e,t):(o=e,s=n)}var a=!1,o,s,c=n===void 0?null:n;return[function(){return e(t())},c===null?void 0:function(){return e(c())}]},[t,n,r,u]);var p=a(e,d[0],d[1]);return s(function(){f.hasValue=!0,f.value=p},[p]),l(p),p}})),ay=o(((e,t)=>{t.exports=iy()})),oy=(0,v.createContext)(null),sy=ay(),cy=e=>e,ly=()=>{var e=(0,v.useContext)(oy);return e?e.store.dispatch:cy},uy=()=>{},dy=()=>uy,fy=(e,t)=>e===t;function Z(e){var t=(0,v.useContext)(oy),n=(0,v.useMemo)(()=>t?t=>{if(t!=null)return e(t)}:uy,[t,e]);return(0,sy.useSyncExternalStoreWithSelector)(t?t.subscription.addNestedSub:dy,t?t.store.getState:uy,t?t.store.getState:uy,n,fy)}function py(e,t=`expected a function, instead received ${typeof e}`){if(typeof e!=`function`)throw TypeError(t)}function my(e,t=`expected all items to be functions, instead received the following types: `){if(!e.every(e=>typeof e==`function`)){let n=e.map(e=>typeof e==`function`?`function ${e.name||`unnamed`}()`:typeof e).join(`, `);throw TypeError(`${t}[${n}]`)}}var hy=e=>Array.isArray(e)?e:[e];function gy(e){let t=Array.isArray(e[0])?e[0]:e;return my(t,`createSelector expects all input-selectors to be functions, but received the following types: `),t}function _y(e,t){let n=[],{length:r}=e;for(let i=0;i<r;i++)n.push(e[i].apply(null,t));return n}var vy=class{constructor(e){this.value=e}deref(){return this.value}},yy=typeof WeakRef>`u`?vy:WeakRef,by=0,xy=1;function Sy(){return{s:by,v:void 0,o:null,p:null}}function Cy(e){return e instanceof yy?e.deref():e}function wy(e,t={}){let n=Sy(),{resultEqualityCheck:r}=t,i,a=0;function o(){let t=n,{length:o}=arguments;for(let e=0,n=o;e<n;e++){let n=arguments[e];if(typeof n==`function`||typeof n==`object`&&n){let e=t.o;e===null&&(t.o=e=new WeakMap);let r=e.get(n);r===void 0?(t=Sy(),e.set(n,t)):t=r}else{let e=t.p;e===null&&(t.p=e=new Map);let r=e.get(n);r===void 0?(t=Sy(),e.set(n,t)):t=r}}let s=t,c;if(t.s===xy)c=t.v;else if(c=e.apply(null,arguments),a++,r){let e=Cy(i);e!=null&&r(e,c)&&(c=e,a!==0&&a--),i=typeof c==`object`&&c||typeof c==`function`?new yy(c):c}return s.s=xy,s.v=c,c}return o.clearCache=()=>{n=Sy(),o.resetResultsCount()},o.resultsCount=()=>a,o.resetResultsCount=()=>{a=0},o}function Ty(e,...t){let n=typeof e==`function`?{memoize:e,memoizeOptions:t}:e,r=(...e)=>{let t=0,r=0,i,a={},o=e.pop();typeof o==`object`&&(a=o,o=e.pop()),py(o,`createSelector expects an output function after the inputs, but received: [${typeof o}]`);let{memoize:s,memoizeOptions:c=[],argsMemoize:l=wy,argsMemoizeOptions:u=[]}={...n,...a},d=hy(c),f=hy(u),p=gy(e),m=s(function(){return t++,o.apply(null,arguments)},...d),h=l(function(){r++;let e=_y(p,arguments);return i=m.apply(null,e),i},...f);return Object.assign(h,{resultFunc:o,memoizedResultFunc:m,dependencies:p,dependencyRecomputations:()=>r,resetDependencyRecomputations:()=>{r=0},lastResult:()=>i,recomputations:()=>t,resetRecomputations:()=>{t=0},memoize:s,argsMemoize:l})};return Object.assign(r,{withTypes:()=>r}),r}var Q=Ty(wy);function Ey(e,t=1){let n=[],r=Math.floor(t),i=(e,t)=>{for(let a=0;a<e.length;a++){let o=e[a];Array.isArray(o)&&t<r?i(o,t+1):n.push(o)}};return i(e,0),n}function Dy(e,t,n){return Iv(n)&&(typeof t==`number`&&X_(n)&&Jv(t)&&t<n.length||typeof t==`string`&&t in n)?Fv(n[t],e):!1}function Oy(e){return typeof e==`symbol`?1:e===null?2:e===void 0?3:e===e?0:4}var ky=(e,t,n)=>{if(e!==t){let r=Oy(e),i=Oy(t);if(r===i&&r===0){if(e<t)return n===`desc`?1:-1;if(e>t)return n===`desc`?-1:1}return n===`desc`?i-r:r-i}return 0},Ay=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,jy=/^\w*$/;function My(e,t){return Array.isArray(e)?!1:typeof e==`number`||typeof e==`boolean`||e==null||ih(e)?!0:typeof e==`string`&&(jy.test(e)||!Ay.test(e))||t!=null&&Object.hasOwn(t,e)}function Ny(e,t,n,r){if(e==null)return[];n=r?void 0:n,Array.isArray(e)||(e=X_(e)?Array.from(e):Object.values(e)),Array.isArray(t)||(t=t==null?[null]:[t]),t.length===0&&(t=[null]),Array.isArray(n)||(n=n==null?[]:[n]),n=n.map(e=>String(e));let i=(e,t)=>{let n=e,r=0;for(;r<t.length&&n!=null;++r)n=n[t[r]];return r>0&&r===t.length?n:void 0},a=(e,t)=>{if(e==null)return t;if(t!=null)return typeof e==`object`&&`key`in e?Object.hasOwn(t,e.key)?t[e.key]:i(t,e.path):typeof e==`function`?e(t):Array.isArray(e)?i(t,e):t[e]},o=t.map(e=>(Array.isArray(e)&&e.length===1&&(e=e[0]),e==null||typeof e==`function`||Array.isArray(e)||My(e)?e:{key:e,path:sh(e)}));return e.map(e=>({original:e,criteria:o.map(t=>a(t,e))})).slice().sort((e,t)=>{for(let r=0;r<o.length;r++){let i=ky(e.criteria[r],t.criteria[r],n[r]);if(i!==0)return i}return 0}).map(e=>e.original)}function Py(e,...t){let n=t.length;return n>1&&Dy(e,t[0],t[1])?t=[]:n>2&&Dy(t[0],t[1],t[2])&&(t=[t[0]]),Ny(e,Ey(t),[`asc`])}var Fy=e=>e.legend.settings,Iy=e=>e.legend.size,Ly=Q([e=>e.legend.payload,Fy],(e,t)=>{var n=t.itemSorter,r=e.flat(1);return n?Py(r,n):r});function Ry(){return Z(Ly)}function zy(e,t){return Wy(e)||Uy(e,t)||Vy(e,t)||By()}function By(){throw TypeError(`Invalid attempt to destructure non-iterable instance.