@emeryld/rrroutes-openapi 2.5.1 → 2.5.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -310,8 +310,8 @@ export default theme;`}function OT(e){return typeof e=="number"?`${(e*100).toFix
310
310
 
311
311
  `)}y.write("payload.value = newResult;"),y.write("return payload;");const $=y.compile();return(P,j)=>$(v,P,j)};let o;const a=Od,s=!ey.jitless,d=s&&EB.value,f=t.catchall;let p;e._zod.parse=(v,y)=>{p??(p=n.value);const b=v.value;return a(b)?s&&d&&(y==null?void 0:y.async)===!1&&y.jitless!==!0?(o||(o=i(t.shape)),v=o(v,y),f?D5([],b,v,y,p,e):v):r(v,y):(v.issues.push({expected:"object",code:"invalid_type",input:b,inst:e}),v)}});function B2(e,t,r,n){for(const o of e)if(o.issues.length===0)return t.value=o.value,t;const i=e.filter(o=>!hu(o));return i.length===1?(t.value=i[0].value,i[0]):(t.issues.push({code:"invalid_union",input:t.value,inst:r,errors:e.map(o=>o.issues.map(a=>Jo(a,n,ci())))}),t)}const _C=ae("$ZodUnion",(e,t)=>{bt.init(e,t),Ot(e._zod,"optin",()=>t.options.some(i=>i._zod.optin==="optional")?"optional":void 0),Ot(e._zod,"optout",()=>t.options.some(i=>i._zod.optout==="optional")?"optional":void 0),Ot(e._zod,"values",()=>{if(t.options.every(i=>i._zod.values))return new Set(t.options.flatMap(i=>Array.from(i._zod.values)))}),Ot(e._zod,"pattern",()=>{if(t.options.every(i=>i._zod.pattern)){const i=t.options.map(o=>o._zod.pattern);return new RegExp(`^(${i.map(o=>Kb(o.source)).join("|")})$`)}});const r=t.options.length===1,n=t.options[0]._zod.run;e._zod.parse=(i,o)=>{if(r)return n(i,o);let a=!1;const s=[];for(const u of t.options){const d=u._zod.run({value:i.value,issues:[]},o);if(d instanceof Promise)s.push(d),a=!0;else{if(d.issues.length===0)return d;s.push(d)}}return a?Promise.all(s).then(u=>B2(u,i,e,o)):B2(s,i,e,o)}}),L5=ae("$ZodDiscriminatedUnion",(e,t)=>{_C.init(e,t);const r=e._zod.parse;Ot(e._zod,"propValues",()=>{const i={};for(const o of t.options){const a=o._zod.propValues;if(!a||Object.keys(a).length===0)throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(o)}"`);for(const[s,u]of Object.entries(a)){i[s]||(i[s]=new Set);for(const d of u)i[s].add(d)}}return i});const n=Fh(()=>{var a;const i=t.options,o=new Map;for(const s of i){const u=(a=s._zod.propValues)==null?void 0:a[t.discriminator];if(!u||u.size===0)throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(s)}"`);for(const d of u){if(o.has(d))throw new Error(`Duplicate discriminator value "${String(d)}"`);o.set(d,s)}}return o});e._zod.parse=(i,o)=>{const a=i.value;if(!Od(a))return i.issues.push({code:"invalid_type",expected:"object",input:a,inst:e}),i;const s=n.value.get(a==null?void 0:a[t.discriminator]);return s?s._zod.run(i,o):t.unionFallback?r(i,o):(i.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:t.discriminator,input:a,path:[t.discriminator],inst:e}),i)}}),B5=ae("$ZodIntersection",(e,t)=>{bt.init(e,t),e._zod.parse=(r,n)=>{const i=r.value,o=t.left._zod.run({value:i,issues:[]},n),a=t.right._zod.run({value:i,issues:[]},n);return o instanceof Promise||a instanceof Promise?Promise.all([o,a]).then(([u,d])=>F2(r,u,d)):F2(r,o,a)}});function Fk(e,t){if(e===t)return{valid:!0,data:e};if(e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(Lu(e)&&Lu(t)){const r=Object.keys(t),n=Object.keys(e).filter(o=>r.indexOf(o)!==-1),i={...e,...t};for(const o of n){const a=Fk(e[o],t[o]);if(!a.valid)return{valid:!1,mergeErrorPath:[o,...a.mergeErrorPath]};i[o]=a.data}return{valid:!0,data:i}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};const r=[];for(let n=0;n<e.length;n++){const i=e[n],o=t[n],a=Fk(i,o);if(!a.valid)return{valid:!1,mergeErrorPath:[n,...a.mergeErrorPath]};r.push(a.data)}return{valid:!0,data:r}}return{valid:!1,mergeErrorPath:[]}}function F2(e,t,r){if(t.issues.length&&e.issues.push(...t.issues),r.issues.length&&e.issues.push(...r.issues),hu(e))return e;const n=Fk(t.value,r.value);if(!n.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(n.mergeErrorPath)}`);return e.value=n.data,e}const AC=ae("$ZodTuple",(e,t)=>{bt.init(e,t);const r=t.items;e._zod.parse=(n,i)=>{const o=n.value;if(!Array.isArray(o))return n.issues.push({input:o,inst:e,expected:"tuple",code:"invalid_type"}),n;n.value=[];const a=[],s=[...r].reverse().findIndex(f=>f._zod.optin!=="optional"),u=s===-1?0:r.length-s;if(!t.rest){const f=o.length>r.length,p=o.length<u-1;if(f||p)return n.issues.push({...f?{code:"too_big",maximum:r.length}:{code:"too_small",minimum:r.length},input:o,inst:e,origin:"array"}),n}let d=-1;for(const f of r){if(d++,d>=o.length&&d>=u)continue;const p=f._zod.run({value:o[d],issues:[]},i);p instanceof Promise?a.push(p.then(v=>Zg(v,n,d))):Zg(p,n,d)}if(t.rest){const f=o.slice(r.length);for(const p of f){d++;const v=t.rest._zod.run({value:p,issues:[]},i);v instanceof Promise?a.push(v.then(y=>Zg(y,n,d))):Zg(v,n,d)}}return a.length?Promise.all(a).then(()=>n):n}});function Zg(e,t,r){e.issues.length&&t.issues.push(...Vo(r,e.issues)),t.value[r]=e.value}const F5=ae("$ZodRecord",(e,t)=>{bt.init(e,t),e._zod.parse=(r,n)=>{const i=r.value;if(!Lu(i))return r.issues.push({expected:"record",code:"invalid_type",input:i,inst:e}),r;const o=[],a=t.keyType._zod.values;if(a){r.value={};const s=new Set;for(const d of a)if(typeof d=="string"||typeof d=="number"||typeof d=="symbol"){s.add(typeof d=="number"?d.toString():d);const f=t.valueType._zod.run({value:i[d],issues:[]},n);f instanceof Promise?o.push(f.then(p=>{p.issues.length&&r.issues.push(...Vo(d,p.issues)),r.value[d]=p.value})):(f.issues.length&&r.issues.push(...Vo(d,f.issues)),r.value[d]=f.value)}let u;for(const d in i)s.has(d)||(u=u??[],u.push(d));u&&u.length>0&&r.issues.push({code:"unrecognized_keys",input:i,inst:e,keys:u})}else{r.value={};for(const s of Reflect.ownKeys(i)){if(s==="__proto__")continue;const u=t.keyType._zod.run({value:s,issues:[]},n);if(u instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(u.issues.length){r.issues.push({code:"invalid_key",origin:"record",issues:u.issues.map(f=>Jo(f,n,ci())),input:s,path:[s],inst:e}),r.value[u.value]=u.value;continue}const d=t.valueType._zod.run({value:i[s],issues:[]},n);d instanceof Promise?o.push(d.then(f=>{f.issues.length&&r.issues.push(...Vo(s,f.issues)),r.value[u.value]=f.value})):(d.issues.length&&r.issues.push(...Vo(s,d.issues)),r.value[u.value]=d.value)}}return o.length?Promise.all(o).then(()=>r):r}}),U5=ae("$ZodMap",(e,t)=>{bt.init(e,t),e._zod.parse=(r,n)=>{const i=r.value;if(!(i instanceof Map))return r.issues.push({expected:"map",code:"invalid_type",input:i,inst:e}),r;const o=[];r.value=new Map;for(const[a,s]of i){const u=t.keyType._zod.run({value:a,issues:[]},n),d=t.valueType._zod.run({value:s,issues:[]},n);u instanceof Promise||d instanceof Promise?o.push(Promise.all([u,d]).then(([f,p])=>{U2(f,p,r,a,i,e,n)})):U2(u,d,r,a,i,e,n)}return o.length?Promise.all(o).then(()=>r):r}});function U2(e,t,r,n,i,o,a){e.issues.length&&(ry.has(typeof n)?r.issues.push(...Vo(n,e.issues)):r.issues.push({code:"invalid_key",origin:"map",input:i,inst:o,issues:e.issues.map(s=>Jo(s,a,ci()))})),t.issues.length&&(ry.has(typeof n)?r.issues.push(...Vo(n,t.issues)):r.issues.push({origin:"map",code:"invalid_element",input:i,inst:o,key:n,issues:t.issues.map(s=>Jo(s,a,ci()))})),r.value.set(e.value,t.value)}const W5=ae("$ZodSet",(e,t)=>{bt.init(e,t),e._zod.parse=(r,n)=>{const i=r.value;if(!(i instanceof Set))return r.issues.push({input:i,inst:e,expected:"set",code:"invalid_type"}),r;const o=[];r.value=new Set;for(const a of i){const s=t.valueType._zod.run({value:a,issues:[]},n);s instanceof Promise?o.push(s.then(u=>W2(u,r))):W2(s,r)}return o.length?Promise.all(o).then(()=>r):r}});function W2(e,t){e.issues.length&&t.issues.push(...e.issues),t.value.add(e.value)}const K5=ae("$ZodEnum",(e,t)=>{bt.init(e,t);const r=cC(t.entries),n=new Set(r);e._zod.values=n,e._zod.pattern=new RegExp(`^(${r.filter(i=>ry.has(typeof i)).map(i=>typeof i=="string"?ps(i):i.toString()).join("|")})$`),e._zod.parse=(i,o)=>{const a=i.value;return n.has(a)||i.issues.push({code:"invalid_value",values:r,input:a,inst:e}),i}}),H5=ae("$ZodLiteral",(e,t)=>{if(bt.init(e,t),t.values.length===0)throw new Error("Cannot create literal schema with no valid values");const r=new Set(t.values);e._zod.values=r,e._zod.pattern=new RegExp(`^(${t.values.map(n=>typeof n=="string"?ps(n):n?ps(n.toString()):String(n)).join("|")})$`),e._zod.parse=(n,i)=>{const o=n.value;return r.has(o)||n.issues.push({code:"invalid_value",values:t.values,input:o,inst:e}),n}}),V5=ae("$ZodFile",(e,t)=>{bt.init(e,t),e._zod.parse=(r,n)=>{const i=r.value;return i instanceof File||r.issues.push({expected:"file",code:"invalid_type",input:i,inst:e}),r}}),q5=ae("$ZodTransform",(e,t)=>{bt.init(e,t),e._zod.parse=(r,n)=>{if(n.direction==="backward")throw new Wb(e.constructor.name);const i=t.transform(r.value,r);if(n.async)return(i instanceof Promise?i:Promise.resolve(i)).then(a=>(r.value=a,r));if(i instanceof Promise)throw new Ou;return r.value=i,r}});function K2(e,t){return e.issues.length&&t===void 0?{issues:[],value:void 0}:e}const G5=ae("$ZodOptional",(e,t)=>{bt.init(e,t),e._zod.optin="optional",e._zod.optout="optional",Ot(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),Ot(e._zod,"pattern",()=>{const r=t.innerType._zod.pattern;return r?new RegExp(`^(${Kb(r.source)})?$`):void 0}),e._zod.parse=(r,n)=>{if(t.innerType._zod.optin==="optional"){const i=t.innerType._zod.run(r,n);return i instanceof Promise?i.then(o=>K2(o,r.value)):K2(i,r.value)}return r.value===void 0?r:t.innerType._zod.run(r,n)}}),Z5=ae("$ZodNullable",(e,t)=>{bt.init(e,t),Ot(e._zod,"optin",()=>t.innerType._zod.optin),Ot(e._zod,"optout",()=>t.innerType._zod.optout),Ot(e._zod,"pattern",()=>{const r=t.innerType._zod.pattern;return r?new RegExp(`^(${Kb(r.source)}|null)$`):void 0}),Ot(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(r,n)=>r.value===null?r:t.innerType._zod.run(r,n)}),X5=ae("$ZodDefault",(e,t)=>{bt.init(e,t),e._zod.optin="optional",Ot(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(r,n)=>{if(n.direction==="backward")return t.innerType._zod.run(r,n);if(r.value===void 0)return r.value=t.defaultValue,r;const i=t.innerType._zod.run(r,n);return i instanceof Promise?i.then(o=>H2(o,t)):H2(i,t)}});function H2(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}const Y5=ae("$ZodPrefault",(e,t)=>{bt.init(e,t),e._zod.optin="optional",Ot(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(r,n)=>(n.direction==="backward"||r.value===void 0&&(r.value=t.defaultValue),t.innerType._zod.run(r,n))}),Q5=ae("$ZodNonOptional",(e,t)=>{bt.init(e,t),Ot(e._zod,"values",()=>{const r=t.innerType._zod.values;return r?new Set([...r].filter(n=>n!==void 0)):void 0}),e._zod.parse=(r,n)=>{const i=t.innerType._zod.run(r,n);return i instanceof Promise?i.then(o=>V2(o,e)):V2(i,e)}});function V2(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:t}),e}const J5=ae("$ZodSuccess",(e,t)=>{bt.init(e,t),e._zod.parse=(r,n)=>{if(n.direction==="backward")throw new Wb("ZodSuccess");const i=t.innerType._zod.run(r,n);return i instanceof Promise?i.then(o=>(r.value=o.issues.length===0,r)):(r.value=i.issues.length===0,r)}}),eF=ae("$ZodCatch",(e,t)=>{bt.init(e,t),Ot(e._zod,"optin",()=>t.innerType._zod.optin),Ot(e._zod,"optout",()=>t.innerType._zod.optout),Ot(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(r,n)=>{if(n.direction==="backward")return t.innerType._zod.run(r,n);const i=t.innerType._zod.run(r,n);return i instanceof Promise?i.then(o=>(r.value=o.value,o.issues.length&&(r.value=t.catchValue({...r,error:{issues:o.issues.map(a=>Jo(a,n,ci()))},input:r.value}),r.issues=[]),r)):(r.value=i.value,i.issues.length&&(r.value=t.catchValue({...r,error:{issues:i.issues.map(o=>Jo(o,n,ci()))},input:r.value}),r.issues=[]),r)}}),tF=ae("$ZodNaN",(e,t)=>{bt.init(e,t),e._zod.parse=(r,n)=>((typeof r.value!="number"||!Number.isNaN(r.value))&&r.issues.push({input:r.value,inst:e,expected:"nan",code:"invalid_type"}),r)}),rF=ae("$ZodPipe",(e,t)=>{bt.init(e,t),Ot(e._zod,"values",()=>t.in._zod.values),Ot(e._zod,"optin",()=>t.in._zod.optin),Ot(e._zod,"optout",()=>t.out._zod.optout),Ot(e._zod,"propValues",()=>t.in._zod.propValues),e._zod.parse=(r,n)=>{if(n.direction==="backward"){const o=t.out._zod.run(r,n);return o instanceof Promise?o.then(a=>Xg(a,t.in,n)):Xg(o,t.in,n)}const i=t.in._zod.run(r,n);return i instanceof Promise?i.then(o=>Xg(o,t.out,n)):Xg(i,t.out,n)}});function Xg(e,t,r){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},r)}const TC=ae("$ZodCodec",(e,t)=>{bt.init(e,t),Ot(e._zod,"values",()=>t.in._zod.values),Ot(e._zod,"optin",()=>t.in._zod.optin),Ot(e._zod,"optout",()=>t.out._zod.optout),Ot(e._zod,"propValues",()=>t.in._zod.propValues),e._zod.parse=(r,n)=>{if((n.direction||"forward")==="forward"){const o=t.in._zod.run(r,n);return o instanceof Promise?o.then(a=>Yg(a,t,n)):Yg(o,t,n)}else{const o=t.out._zod.run(r,n);return o instanceof Promise?o.then(a=>Yg(a,t,n)):Yg(o,t,n)}}});function Yg(e,t,r){if(e.issues.length)return e.aborted=!0,e;if((r.direction||"forward")==="forward"){const i=t.transform(e.value,e);return i instanceof Promise?i.then(o=>Qg(e,o,t.out,r)):Qg(e,i,t.out,r)}else{const i=t.reverseTransform(e.value,e);return i instanceof Promise?i.then(o=>Qg(e,o,t.in,r)):Qg(e,i,t.in,r)}}function Qg(e,t,r,n){return e.issues.length?(e.aborted=!0,e):r._zod.run({value:t,issues:e.issues},n)}const nF=ae("$ZodReadonly",(e,t)=>{bt.init(e,t),Ot(e._zod,"propValues",()=>t.innerType._zod.propValues),Ot(e._zod,"values",()=>t.innerType._zod.values),Ot(e._zod,"optin",()=>{var r,n;return(n=(r=t.innerType)==null?void 0:r._zod)==null?void 0:n.optin}),Ot(e._zod,"optout",()=>{var r,n;return(n=(r=t.innerType)==null?void 0:r._zod)==null?void 0:n.optout}),e._zod.parse=(r,n)=>{if(n.direction==="backward")return t.innerType._zod.run(r,n);const i=t.innerType._zod.run(r,n);return i instanceof Promise?i.then(q2):q2(i)}});function q2(e){return e.value=Object.freeze(e.value),e}const iF=ae("$ZodTemplateLiteral",(e,t)=>{bt.init(e,t);const r=[];for(const n of t.parts)if(typeof n=="object"&&n!==null){if(!n._zod.pattern)throw new Error(`Invalid template literal part, no pattern found: ${[...n._zod.traits].shift()}`);const i=n._zod.pattern instanceof RegExp?n._zod.pattern.source:n._zod.pattern;if(!i)throw new Error(`Invalid template literal part: ${n._zod.traits}`);const o=i.startsWith("^")?1:0,a=i.endsWith("$")?i.length-1:i.length;r.push(i.slice(o,a))}else if(n===null||IB.has(typeof n))r.push(ps(`${n}`));else throw new Error(`Invalid template literal part: ${n}`);e._zod.pattern=new RegExp(`^${r.join("")}$`),e._zod.parse=(n,i)=>typeof n.value!="string"?(n.issues.push({input:n.value,inst:e,expected:"template_literal",code:"invalid_type"}),n):(e._zod.pattern.lastIndex=0,e._zod.pattern.test(n.value)||n.issues.push({input:n.value,inst:e,code:"invalid_format",format:t.format??"template_literal",pattern:e._zod.pattern.source}),n)}),oF=ae("$ZodFunction",(e,t)=>(bt.init(e,t),e._def=t,e._zod.def=t,e.implement=r=>{if(typeof r!="function")throw new Error("implement() must be called with a function");return function(...n){const i=e._def.input?Lk(e._def.input,n):n,o=Reflect.apply(r,this,i);return e._def.output?Lk(e._def.output,o):o}},e.implementAsync=r=>{if(typeof r!="function")throw new Error("implementAsync() must be called with a function");return async function(...n){const i=e._def.input?await Bk(e._def.input,n):n,o=await Reflect.apply(r,this,i);return e._def.output?await Bk(e._def.output,o):o}},e._zod.parse=(r,n)=>typeof r.value!="function"?(r.issues.push({code:"invalid_type",expected:"function",input:r.value,inst:e}),r):(e._def.output&&e._def.output._zod.def.type==="promise"?r.value=e.implementAsync(r.value):r.value=e.implement(r.value),r),e.input=(...r)=>{const n=e.constructor;return Array.isArray(r[0])?new n({type:"function",input:new AC({type:"tuple",items:r[0],rest:r[1]}),output:e._def.output}):new n({type:"function",input:r[0],output:e._def.output})},e.output=r=>{const n=e.constructor;return new n({type:"function",input:e._def.input,output:r})},e)),aF=ae("$ZodPromise",(e,t)=>{bt.init(e,t),e._zod.parse=(r,n)=>Promise.resolve(r.value).then(i=>t.innerType._zod.run({value:i,issues:[]},n))}),sF=ae("$ZodLazy",(e,t)=>{bt.init(e,t),Ot(e._zod,"innerType",()=>t.getter()),Ot(e._zod,"pattern",()=>{var r,n;return(n=(r=e._zod.innerType)==null?void 0:r._zod)==null?void 0:n.pattern}),Ot(e._zod,"propValues",()=>{var r,n;return(n=(r=e._zod.innerType)==null?void 0:r._zod)==null?void 0:n.propValues}),Ot(e._zod,"optin",()=>{var r,n;return((n=(r=e._zod.innerType)==null?void 0:r._zod)==null?void 0:n.optin)??void 0}),Ot(e._zod,"optout",()=>{var r,n;return((n=(r=e._zod.innerType)==null?void 0:r._zod)==null?void 0:n.optout)??void 0}),e._zod.parse=(r,n)=>e._zod.innerType._zod.run(r,n)}),lF=ae("$ZodCustom",(e,t)=>{jr.init(e,t),bt.init(e,t),e._zod.parse=(r,n)=>r,e._zod.check=r=>{const n=r.value,i=t.fn(n);if(i instanceof Promise)return i.then(o=>G2(o,r,n,e));G2(i,r,n,e)}});function G2(e,t,r,n){if(!e){const i={code:"custom",input:r,inst:n,path:[...n._zod.def.path??[]],continue:!n._zod.def.abort};n._zod.def.params&&(i.params=n._zod.def.params),t.issues.push(_d(i))}}const Ple=()=>{const e={string:{unit:"حرف",verb:"أن يحوي"},file:{unit:"بايت",verb:"أن يحوي"},array:{unit:"عنصر",verb:"أن يحوي"},set:{unit:"عنصر",verb:"أن يحوي"}};function t(i){return e[i]??null}const r=i=>{const o=typeof i;switch(o){case"number":return Number.isNaN(i)?"NaN":"number";case"object":{if(Array.isArray(i))return"array";if(i===null)return"null";if(Object.getPrototypeOf(i)!==Object.prototype&&i.constructor)return i.constructor.name}}return o},n={regex:"مدخل",email:"بريد إلكتروني",url:"رابط",emoji:"إيموجي",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"تاريخ ووقت بمعيار ISO",date:"تاريخ بمعيار ISO",time:"وقت بمعيار ISO",duration:"مدة بمعيار ISO",ipv4:"عنوان IPv4",ipv6:"عنوان IPv6",cidrv4:"مدى عناوين بصيغة IPv4",cidrv6:"مدى عناوين بصيغة IPv6",base64:"نَص بترميز base64-encoded",base64url:"نَص بترميز base64url-encoded",json_string:"نَص على هيئة JSON",e164:"رقم هاتف بمعيار E.164",jwt:"JWT",template_literal:"مدخل"};return i=>{switch(i.code){case"invalid_type":return`مدخلات غير مقبولة: يفترض إدخال ${i.expected}، ولكن تم إدخال ${r(i.input)}`;case"invalid_value":return i.values.length===1?`مدخلات غير مقبولة: يفترض إدخال ${pt(i.values[0])}`:`اختيار غير مقبول: يتوقع انتقاء أحد هذه الخيارات: ${Te(i.values,"|")}`;case"too_big":{const o=i.inclusive?"<=":"<",a=t(i.origin);return a?` أكبر من اللازم: يفترض أن تكون ${i.origin??"القيمة"} ${o} ${i.maximum.toString()} ${a.unit??"عنصر"}`:`أكبر من اللازم: يفترض أن تكون ${i.origin??"القيمة"} ${o} ${i.maximum.toString()}`}case"too_small":{const o=i.inclusive?">=":">",a=t(i.origin);return a?`أصغر من اللازم: يفترض لـ ${i.origin} أن يكون ${o} ${i.minimum.toString()} ${a.unit}`:`أصغر من اللازم: يفترض لـ ${i.origin} أن يكون ${o} ${i.minimum.toString()}`}case"invalid_format":{const o=i;return o.format==="starts_with"?`نَص غير مقبول: يجب أن يبدأ بـ "${i.prefix}"`:o.format==="ends_with"?`نَص غير مقبول: يجب أن ينتهي بـ "${o.suffix}"`:o.format==="includes"?`نَص غير مقبول: يجب أن يتضمَّن "${o.includes}"`:o.format==="regex"?`نَص غير مقبول: يجب أن يطابق النمط ${o.pattern}`:`${n[o.format]??i.format} غير مقبول`}case"not_multiple_of":return`رقم غير مقبول: يجب أن يكون من مضاعفات ${i.divisor}`;case"unrecognized_keys":return`معرف${i.keys.length>1?"ات":""} غريب${i.keys.length>1?"ة":""}: ${Te(i.keys,"، ")}`;case"invalid_key":return`معرف غير مقبول في ${i.origin}`;case"invalid_union":return"مدخل غير مقبول";case"invalid_element":return`مدخل غير مقبول في ${i.origin}`;default:return"مدخل غير مقبول"}}};function $le(){return{localeError:Ple()}}const Cle=()=>{const e={string:{unit:"simvol",verb:"olmalıdır"},file:{unit:"bayt",verb:"olmalıdır"},array:{unit:"element",verb:"olmalıdır"},set:{unit:"element",verb:"olmalıdır"}};function t(i){return e[i]??null}const r=i=>{const o=typeof i;switch(o){case"number":return Number.isNaN(i)?"NaN":"number";case"object":{if(Array.isArray(i))return"array";if(i===null)return"null";if(Object.getPrototypeOf(i)!==Object.prototype&&i.constructor)return i.constructor.name}}return o},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",cidrv4:"IPv4 range",cidrv6:"IPv6 range",base64:"base64-encoded string",base64url:"base64url-encoded string",json_string:"JSON string",e164:"E.164 number",jwt:"JWT",template_literal:"input"};return i=>{switch(i.code){case"invalid_type":return`Yanlış dəyər: gözlənilən ${i.expected}, daxil olan ${r(i.input)}`;case"invalid_value":return i.values.length===1?`Yanlış dəyər: gözlənilən ${pt(i.values[0])}`:`Yanlış seçim: aşağıdakılardan biri olmalıdır: ${Te(i.values,"|")}`;case"too_big":{const o=i.inclusive?"<=":"<",a=t(i.origin);return a?`Çox böyük: gözlənilən ${i.origin??"dəyər"} ${o}${i.maximum.toString()} ${a.unit??"element"}`:`Çox böyük: gözlənilən ${i.origin??"dəyər"} ${o}${i.maximum.toString()}`}case"too_small":{const o=i.inclusive?">=":">",a=t(i.origin);return a?`Çox kiçik: gözlənilən ${i.origin} ${o}${i.minimum.toString()} ${a.unit}`:`Çox kiçik: gözlənilən ${i.origin} ${o}${i.minimum.toString()}`}case"invalid_format":{const o=i;return o.format==="starts_with"?`Yanlış mətn: "${o.prefix}" ilə başlamalıdır`:o.format==="ends_with"?`Yanlış mətn: "${o.suffix}" ilə bitməlidir`:o.format==="includes"?`Yanlış mətn: "${o.includes}" daxil olmalıdır`:o.format==="regex"?`Yanlış mətn: ${o.pattern} şablonuna uyğun olmalıdır`:`Yanlış ${n[o.format]??i.format}`}case"not_multiple_of":return`Yanlış ədəd: ${i.divisor} ilə bölünə bilən olmalıdır`;case"unrecognized_keys":return`Tanınmayan açar${i.keys.length>1?"lar":""}: ${Te(i.keys,", ")}`;case"invalid_key":return`${i.origin} daxilində yanlış açar`;case"invalid_union":return"Yanlış dəyər";case"invalid_element":return`${i.origin} daxilində yanlış dəyər`;default:return"Yanlış dəyər"}}};function jle(){return{localeError:Cle()}}function Z2(e,t,r,n){const i=Math.abs(e),o=i%10,a=i%100;return a>=11&&a<=19?n:o===1?t:o>=2&&o<=4?r:n}const Ele=()=>{const e={string:{unit:{one:"сімвал",few:"сімвалы",many:"сімвалаў"},verb:"мець"},array:{unit:{one:"элемент",few:"элементы",many:"элементаў"},verb:"мець"},set:{unit:{one:"элемент",few:"элементы",many:"элементаў"},verb:"мець"},file:{unit:{one:"байт",few:"байты",many:"байтаў"},verb:"мець"}};function t(i){return e[i]??null}const r=i=>{const o=typeof i;switch(o){case"number":return Number.isNaN(i)?"NaN":"лік";case"object":{if(Array.isArray(i))return"масіў";if(i===null)return"null";if(Object.getPrototypeOf(i)!==Object.prototype&&i.constructor)return i.constructor.name}}return o},n={regex:"увод",email:"email адрас",url:"URL",emoji:"эмодзі",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO дата і час",date:"ISO дата",time:"ISO час",duration:"ISO працягласць",ipv4:"IPv4 адрас",ipv6:"IPv6 адрас",cidrv4:"IPv4 дыяпазон",cidrv6:"IPv6 дыяпазон",base64:"радок у фармаце base64",base64url:"радок у фармаце base64url",json_string:"JSON радок",e164:"нумар E.164",jwt:"JWT",template_literal:"увод"};return i=>{switch(i.code){case"invalid_type":return`Няправільны ўвод: чакаўся ${i.expected}, атрымана ${r(i.input)}`;case"invalid_value":return i.values.length===1?`Няправільны ўвод: чакалася ${pt(i.values[0])}`:`Няправільны варыянт: чакаўся адзін з ${Te(i.values,"|")}`;case"too_big":{const o=i.inclusive?"<=":"<",a=t(i.origin);if(a){const s=Number(i.maximum),u=Z2(s,a.unit.one,a.unit.few,a.unit.many);return`Занадта вялікі: чакалася, што ${i.origin??"значэнне"} павінна ${a.verb} ${o}${i.maximum.toString()} ${u}`}return`Занадта вялікі: чакалася, што ${i.origin??"значэнне"} павінна быць ${o}${i.maximum.toString()}`}case"too_small":{const o=i.inclusive?">=":">",a=t(i.origin);if(a){const s=Number(i.minimum),u=Z2(s,a.unit.one,a.unit.few,a.unit.many);return`Занадта малы: чакалася, што ${i.origin} павінна ${a.verb} ${o}${i.minimum.toString()} ${u}`}return`Занадта малы: чакалася, што ${i.origin} павінна быць ${o}${i.minimum.toString()}`}case"invalid_format":{const o=i;return o.format==="starts_with"?`Няправільны радок: павінен пачынацца з "${o.prefix}"`:o.format==="ends_with"?`Няправільны радок: павінен заканчвацца на "${o.suffix}"`:o.format==="includes"?`Няправільны радок: павінен змяшчаць "${o.includes}"`:o.format==="regex"?`Няправільны радок: павінен адпавядаць шаблону ${o.pattern}`:`Няправільны ${n[o.format]??i.format}`}case"not_multiple_of":return`Няправільны лік: павінен быць кратным ${i.divisor}`;case"unrecognized_keys":return`Нераспазнаны ${i.keys.length>1?"ключы":"ключ"}: ${Te(i.keys,", ")}`;case"invalid_key":return`Няправільны ключ у ${i.origin}`;case"invalid_union":return"Няправільны ўвод";case"invalid_element":return`Няправільнае значэнне ў ${i.origin}`;default:return"Няправільны ўвод"}}};function Ile(){return{localeError:Ele()}}const Ole=e=>{const t=typeof e;switch(t){case"number":return Number.isNaN(e)?"NaN":"число";case"object":{if(Array.isArray(e))return"масив";if(e===null)return"null";if(Object.getPrototypeOf(e)!==Object.prototype&&e.constructor)return e.constructor.name}}return t},_le=()=>{const e={string:{unit:"символа",verb:"да съдържа"},file:{unit:"байта",verb:"да съдържа"},array:{unit:"елемента",verb:"да съдържа"},set:{unit:"елемента",verb:"да съдържа"}};function t(n){return e[n]??null}const r={regex:"вход",email:"имейл адрес",url:"URL",emoji:"емоджи",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO време",date:"ISO дата",time:"ISO време",duration:"ISO продължителност",ipv4:"IPv4 адрес",ipv6:"IPv6 адрес",cidrv4:"IPv4 диапазон",cidrv6:"IPv6 диапазон",base64:"base64-кодиран низ",base64url:"base64url-кодиран низ",json_string:"JSON низ",e164:"E.164 номер",jwt:"JWT",template_literal:"вход"};return n=>{switch(n.code){case"invalid_type":return`Невалиден вход: очакван ${n.expected}, получен ${Ole(n.input)}`;case"invalid_value":return n.values.length===1?`Невалиден вход: очакван ${pt(n.values[0])}`:`Невалидна опция: очаквано едно от ${Te(n.values,"|")}`;case"too_big":{const i=n.inclusive?"<=":"<",o=t(n.origin);return o?`Твърде голямо: очаква се ${n.origin??"стойност"} да съдържа ${i}${n.maximum.toString()} ${o.unit??"елемента"}`:`Твърде голямо: очаква се ${n.origin??"стойност"} да бъде ${i}${n.maximum.toString()}`}case"too_small":{const i=n.inclusive?">=":">",o=t(n.origin);return o?`Твърде малко: очаква се ${n.origin} да съдържа ${i}${n.minimum.toString()} ${o.unit}`:`Твърде малко: очаква се ${n.origin} да бъде ${i}${n.minimum.toString()}`}case"invalid_format":{const i=n;if(i.format==="starts_with")return`Невалиден низ: трябва да започва с "${i.prefix}"`;if(i.format==="ends_with")return`Невалиден низ: трябва да завършва с "${i.suffix}"`;if(i.format==="includes")return`Невалиден низ: трябва да включва "${i.includes}"`;if(i.format==="regex")return`Невалиден низ: трябва да съвпада с ${i.pattern}`;let o="Невалиден";return i.format==="emoji"&&(o="Невалидно"),i.format==="datetime"&&(o="Невалидно"),i.format==="date"&&(o="Невалидна"),i.format==="time"&&(o="Невалидно"),i.format==="duration"&&(o="Невалидна"),`${o} ${r[i.format]??n.format}`}case"not_multiple_of":return`Невалидно число: трябва да бъде кратно на ${n.divisor}`;case"unrecognized_keys":return`Неразпознат${n.keys.length>1?"и":""} ключ${n.keys.length>1?"ове":""}: ${Te(n.keys,", ")}`;case"invalid_key":return`Невалиден ключ в ${n.origin}`;case"invalid_union":return"Невалиден вход";case"invalid_element":return`Невалидна стойност в ${n.origin}`;default:return"Невалиден вход"}}};function Ale(){return{localeError:_le()}}const Tle=()=>{const e={string:{unit:"caràcters",verb:"contenir"},file:{unit:"bytes",verb:"contenir"},array:{unit:"elements",verb:"contenir"},set:{unit:"elements",verb:"contenir"}};function t(i){return e[i]??null}const r=i=>{const o=typeof i;switch(o){case"number":return Number.isNaN(i)?"NaN":"number";case"object":{if(Array.isArray(i))return"array";if(i===null)return"null";if(Object.getPrototypeOf(i)!==Object.prototype&&i.constructor)return i.constructor.name}}return o},n={regex:"entrada",email:"adreça electrònica",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:"data i hora ISO",date:"data ISO",time:"hora ISO",duration:"durada ISO",ipv4:"adreça IPv4",ipv6:"adreça IPv6",cidrv4:"rang IPv4",cidrv6:"rang IPv6",base64:"cadena codificada en base64",base64url:"cadena codificada en base64url",json_string:"cadena JSON",e164:"número E.164",jwt:"JWT",template_literal:"entrada"};return i=>{switch(i.code){case"invalid_type":return`Tipus invàlid: s'esperava ${i.expected}, s'ha rebut ${r(i.input)}`;case"invalid_value":return i.values.length===1?`Valor invàlid: s'esperava ${pt(i.values[0])}`:`Opció invàlida: s'esperava una de ${Te(i.values," o ")}`;case"too_big":{const o=i.inclusive?"com a màxim":"menys de",a=t(i.origin);return a?`Massa gran: s'esperava que ${i.origin??"el valor"} contingués ${o} ${i.maximum.toString()} ${a.unit??"elements"}`:`Massa gran: s'esperava que ${i.origin??"el valor"} fos ${o} ${i.maximum.toString()}`}case"too_small":{const o=i.inclusive?"com a mínim":"més de",a=t(i.origin);return a?`Massa petit: s'esperava que ${i.origin} contingués ${o} ${i.minimum.toString()} ${a.unit}`:`Massa petit: s'esperava que ${i.origin} fos ${o} ${i.minimum.toString()}`}case"invalid_format":{const o=i;return o.format==="starts_with"?`Format invàlid: ha de començar amb "${o.prefix}"`:o.format==="ends_with"?`Format invàlid: ha d'acabar amb "${o.suffix}"`:o.format==="includes"?`Format invàlid: ha d'incloure "${o.includes}"`:o.format==="regex"?`Format invàlid: ha de coincidir amb el patró ${o.pattern}`:`Format invàlid per a ${n[o.format]??i.format}`}case"not_multiple_of":return`Número invàlid: ha de ser múltiple de ${i.divisor}`;case"unrecognized_keys":return`Clau${i.keys.length>1?"s":""} no reconeguda${i.keys.length>1?"s":""}: ${Te(i.keys,", ")}`;case"invalid_key":return`Clau invàlida a ${i.origin}`;case"invalid_union":return"Entrada invàlida";case"invalid_element":return`Element invàlid a ${i.origin}`;default:return"Entrada invàlida"}}};function Mle(){return{localeError:Tle()}}const Rle=()=>{const e={string:{unit:"znaků",verb:"mít"},file:{unit:"bajtů",verb:"mít"},array:{unit:"prvků",verb:"mít"},set:{unit:"prvků",verb:"mít"}};function t(i){return e[i]??null}const r=i=>{const o=typeof i;switch(o){case"number":return Number.isNaN(i)?"NaN":"číslo";case"string":return"řetězec";case"boolean":return"boolean";case"bigint":return"bigint";case"function":return"funkce";case"symbol":return"symbol";case"undefined":return"undefined";case"object":{if(Array.isArray(i))return"pole";if(i===null)return"null";if(Object.getPrototypeOf(i)!==Object.prototype&&i.constructor)return i.constructor.name}}return o},n={regex:"regulární výraz",email:"e-mailová adresa",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:"datum a čas ve formátu ISO",date:"datum ve formátu ISO",time:"čas ve formátu ISO",duration:"doba trvání ISO",ipv4:"IPv4 adresa",ipv6:"IPv6 adresa",cidrv4:"rozsah IPv4",cidrv6:"rozsah IPv6",base64:"řetězec zakódovaný ve formátu base64",base64url:"řetězec zakódovaný ve formátu base64url",json_string:"řetězec ve formátu JSON",e164:"číslo E.164",jwt:"JWT",template_literal:"vstup"};return i=>{switch(i.code){case"invalid_type":return`Neplatný vstup: očekáváno ${i.expected}, obdrženo ${r(i.input)}`;case"invalid_value":return i.values.length===1?`Neplatný vstup: očekáváno ${pt(i.values[0])}`:`Neplatná možnost: očekávána jedna z hodnot ${Te(i.values,"|")}`;case"too_big":{const o=i.inclusive?"<=":"<",a=t(i.origin);return a?`Hodnota je příliš velká: ${i.origin??"hodnota"} musí mít ${o}${i.maximum.toString()} ${a.unit??"prvků"}`:`Hodnota je příliš velká: ${i.origin??"hodnota"} musí být ${o}${i.maximum.toString()}`}case"too_small":{const o=i.inclusive?">=":">",a=t(i.origin);return a?`Hodnota je příliš malá: ${i.origin??"hodnota"} musí mít ${o}${i.minimum.toString()} ${a.unit??"prvků"}`:`Hodnota je příliš malá: ${i.origin??"hodnota"} musí být ${o}${i.minimum.toString()}`}case"invalid_format":{const o=i;return o.format==="starts_with"?`Neplatný řetězec: musí začínat na "${o.prefix}"`:o.format==="ends_with"?`Neplatný řetězec: musí končit na "${o.suffix}"`:o.format==="includes"?`Neplatný řetězec: musí obsahovat "${o.includes}"`:o.format==="regex"?`Neplatný řetězec: musí odpovídat vzoru ${o.pattern}`:`Neplatný formát ${n[o.format]??i.format}`}case"not_multiple_of":return`Neplatné číslo: musí být násobkem ${i.divisor}`;case"unrecognized_keys":return`Neznámé klíče: ${Te(i.keys,", ")}`;case"invalid_key":return`Neplatný klíč v ${i.origin}`;case"invalid_union":return"Neplatný vstup";case"invalid_element":return`Neplatná hodnota v ${i.origin}`;default:return"Neplatný vstup"}}};function Dle(){return{localeError:Rle()}}const zle=()=>{const e={string:{unit:"tegn",verb:"havde"},file:{unit:"bytes",verb:"havde"},array:{unit:"elementer",verb:"indeholdt"},set:{unit:"elementer",verb:"indeholdt"}},t={string:"streng",number:"tal",boolean:"boolean",array:"liste",object:"objekt",set:"sæt",file:"fil"};function r(a){return e[a]??null}function n(a){return t[a]??a}const i=a=>{const s=typeof a;switch(s){case"number":return Number.isNaN(a)?"NaN":"tal";case"object":return Array.isArray(a)?"liste":a===null?"null":Object.getPrototypeOf(a)!==Object.prototype&&a.constructor?a.constructor.name:"objekt"}return s},o={regex:"input",email:"e-mailadresse",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 dato- og klokkeslæt",date:"ISO-dato",time:"ISO-klokkeslæt",duration:"ISO-varighed",ipv4:"IPv4-område",ipv6:"IPv6-område",cidrv4:"IPv4-spektrum",cidrv6:"IPv6-spektrum",base64:"base64-kodet streng",base64url:"base64url-kodet streng",json_string:"JSON-streng",e164:"E.164-nummer",jwt:"JWT",template_literal:"input"};return a=>{switch(a.code){case"invalid_type":return`Ugyldigt input: forventede ${n(a.expected)}, fik ${n(i(a.input))}`;case"invalid_value":return a.values.length===1?`Ugyldig værdi: forventede ${pt(a.values[0])}`:`Ugyldigt valg: forventede en af følgende ${Te(a.values,"|")}`;case"too_big":{const s=a.inclusive?"<=":"<",u=r(a.origin),d=n(a.origin);return u?`For stor: forventede ${d??"value"} ${u.verb} ${s} ${a.maximum.toString()} ${u.unit??"elementer"}`:`For stor: forventede ${d??"value"} havde ${s} ${a.maximum.toString()}`}case"too_small":{const s=a.inclusive?">=":">",u=r(a.origin),d=n(a.origin);return u?`For lille: forventede ${d} ${u.verb} ${s} ${a.minimum.toString()} ${u.unit}`:`For lille: forventede ${d} havde ${s} ${a.minimum.toString()}`}case"invalid_format":{const s=a;return s.format==="starts_with"?`Ugyldig streng: skal starte med "${s.prefix}"`:s.format==="ends_with"?`Ugyldig streng: skal ende med "${s.suffix}"`:s.format==="includes"?`Ugyldig streng: skal indeholde "${s.includes}"`:s.format==="regex"?`Ugyldig streng: skal matche mønsteret ${s.pattern}`:`Ugyldig ${o[s.format]??a.format}`}case"not_multiple_of":return`Ugyldigt tal: skal være deleligt med ${a.divisor}`;case"unrecognized_keys":return`${a.keys.length>1?"Ukendte nøgler":"Ukendt nøgle"}: ${Te(a.keys,", ")}`;case"invalid_key":return`Ugyldig nøgle i ${a.origin}`;case"invalid_union":return"Ugyldigt input: matcher ingen af de tilladte typer";case"invalid_element":return`Ugyldig værdi i ${a.origin}`;default:return"Ugyldigt input"}}};function Nle(){return{localeError:zle()}}const Lle=()=>{const e={string:{unit:"Zeichen",verb:"zu haben"},file:{unit:"Bytes",verb:"zu haben"},array:{unit:"Elemente",verb:"zu haben"},set:{unit:"Elemente",verb:"zu haben"}};function t(i){return e[i]??null}const r=i=>{const o=typeof i;switch(o){case"number":return Number.isNaN(i)?"NaN":"Zahl";case"object":{if(Array.isArray(i))return"Array";if(i===null)return"null";if(Object.getPrototypeOf(i)!==Object.prototype&&i.constructor)return i.constructor.name}}return o},n={regex:"Eingabe",email:"E-Mail-Adresse",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-Datum und -Uhrzeit",date:"ISO-Datum",time:"ISO-Uhrzeit",duration:"ISO-Dauer",ipv4:"IPv4-Adresse",ipv6:"IPv6-Adresse",cidrv4:"IPv4-Bereich",cidrv6:"IPv6-Bereich",base64:"Base64-codierter String",base64url:"Base64-URL-codierter String",json_string:"JSON-String",e164:"E.164-Nummer",jwt:"JWT",template_literal:"Eingabe"};return i=>{switch(i.code){case"invalid_type":return`Ungültige Eingabe: erwartet ${i.expected}, erhalten ${r(i.input)}`;case"invalid_value":return i.values.length===1?`Ungültige Eingabe: erwartet ${pt(i.values[0])}`:`Ungültige Option: erwartet eine von ${Te(i.values,"|")}`;case"too_big":{const o=i.inclusive?"<=":"<",a=t(i.origin);return a?`Zu groß: erwartet, dass ${i.origin??"Wert"} ${o}${i.maximum.toString()} ${a.unit??"Elemente"} hat`:`Zu groß: erwartet, dass ${i.origin??"Wert"} ${o}${i.maximum.toString()} ist`}case"too_small":{const o=i.inclusive?">=":">",a=t(i.origin);return a?`Zu klein: erwartet, dass ${i.origin} ${o}${i.minimum.toString()} ${a.unit} hat`:`Zu klein: erwartet, dass ${i.origin} ${o}${i.minimum.toString()} ist`}case"invalid_format":{const o=i;return o.format==="starts_with"?`Ungültiger String: muss mit "${o.prefix}" beginnen`:o.format==="ends_with"?`Ungültiger String: muss mit "${o.suffix}" enden`:o.format==="includes"?`Ungültiger String: muss "${o.includes}" enthalten`:o.format==="regex"?`Ungültiger String: muss dem Muster ${o.pattern} entsprechen`:`Ungültig: ${n[o.format]??i.format}`}case"not_multiple_of":return`Ungültige Zahl: muss ein Vielfaches von ${i.divisor} sein`;case"unrecognized_keys":return`${i.keys.length>1?"Unbekannte Schlüssel":"Unbekannter Schlüssel"}: ${Te(i.keys,", ")}`;case"invalid_key":return`Ungültiger Schlüssel in ${i.origin}`;case"invalid_union":return"Ungültige Eingabe";case"invalid_element":return`Ungültiger Wert in ${i.origin}`;default:return"Ungültige Eingabe"}}};function Ble(){return{localeError:Lle()}}const Fle=e=>{const t=typeof e;switch(t){case"number":return Number.isNaN(e)?"NaN":"number";case"object":{if(Array.isArray(e))return"array";if(e===null)return"null";if(Object.getPrototypeOf(e)!==Object.prototype&&e.constructor)return e.constructor.name}}return t},Ule=()=>{const 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"}};function t(n){return e[n]??null}const r={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",jwt:"JWT",template_literal:"input"};return n=>{switch(n.code){case"invalid_type":return`Invalid input: expected ${n.expected}, received ${Fle(n.input)}`;case"invalid_value":return n.values.length===1?`Invalid input: expected ${pt(n.values[0])}`:`Invalid option: expected one of ${Te(n.values,"|")}`;case"too_big":{const i=n.inclusive?"<=":"<",o=t(n.origin);return o?`Too big: expected ${n.origin??"value"} to have ${i}${n.maximum.toString()} ${o.unit??"elements"}`:`Too big: expected ${n.origin??"value"} to be ${i}${n.maximum.toString()}`}case"too_small":{const i=n.inclusive?">=":">",o=t(n.origin);return o?`Too small: expected ${n.origin} to have ${i}${n.minimum.toString()} ${o.unit}`:`Too small: expected ${n.origin} to be ${i}${n.minimum.toString()}`}case"invalid_format":{const i=n;return i.format==="starts_with"?`Invalid string: must start with "${i.prefix}"`:i.format==="ends_with"?`Invalid string: must end with "${i.suffix}"`:i.format==="includes"?`Invalid string: must include "${i.includes}"`:i.format==="regex"?`Invalid string: must match pattern ${i.pattern}`:`Invalid ${r[i.format]??n.format}`}case"not_multiple_of":return`Invalid number: must be a multiple of ${n.divisor}`;case"unrecognized_keys":return`Unrecognized key${n.keys.length>1?"s":""}: ${Te(n.keys,", ")}`;case"invalid_key":return`Invalid key in ${n.origin}`;case"invalid_union":return"Invalid input";case"invalid_element":return`Invalid value in ${n.origin}`;default:return"Invalid input"}}};function uF(){return{localeError:Ule()}}const Wle=e=>{const t=typeof e;switch(t){case"number":return Number.isNaN(e)?"NaN":"nombro";case"object":{if(Array.isArray(e))return"tabelo";if(e===null)return"senvalora";if(Object.getPrototypeOf(e)!==Object.prototype&&e.constructor)return e.constructor.name}}return t},Kle=()=>{const e={string:{unit:"karaktrojn",verb:"havi"},file:{unit:"bajtojn",verb:"havi"},array:{unit:"elementojn",verb:"havi"},set:{unit:"elementojn",verb:"havi"}};function t(n){return e[n]??null}const r={regex:"enigo",email:"retadreso",url:"URL",emoji:"emoĝio",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO-datotempo",date:"ISO-dato",time:"ISO-tempo",duration:"ISO-daŭro",ipv4:"IPv4-adreso",ipv6:"IPv6-adreso",cidrv4:"IPv4-rango",cidrv6:"IPv6-rango",base64:"64-ume kodita karaktraro",base64url:"URL-64-ume kodita karaktraro",json_string:"JSON-karaktraro",e164:"E.164-nombro",jwt:"JWT",template_literal:"enigo"};return n=>{switch(n.code){case"invalid_type":return`Nevalida enigo: atendiĝis ${n.expected}, riceviĝis ${Wle(n.input)}`;case"invalid_value":return n.values.length===1?`Nevalida enigo: atendiĝis ${pt(n.values[0])}`:`Nevalida opcio: atendiĝis unu el ${Te(n.values,"|")}`;case"too_big":{const i=n.inclusive?"<=":"<",o=t(n.origin);return o?`Tro granda: atendiĝis ke ${n.origin??"valoro"} havu ${i}${n.maximum.toString()} ${o.unit??"elementojn"}`:`Tro granda: atendiĝis ke ${n.origin??"valoro"} havu ${i}${n.maximum.toString()}`}case"too_small":{const i=n.inclusive?">=":">",o=t(n.origin);return o?`Tro malgranda: atendiĝis ke ${n.origin} havu ${i}${n.minimum.toString()} ${o.unit}`:`Tro malgranda: atendiĝis ke ${n.origin} estu ${i}${n.minimum.toString()}`}case"invalid_format":{const i=n;return i.format==="starts_with"?`Nevalida karaktraro: devas komenciĝi per "${i.prefix}"`:i.format==="ends_with"?`Nevalida karaktraro: devas finiĝi per "${i.suffix}"`:i.format==="includes"?`Nevalida karaktraro: devas inkluzivi "${i.includes}"`:i.format==="regex"?`Nevalida karaktraro: devas kongrui kun la modelo ${i.pattern}`:`Nevalida ${r[i.format]??n.format}`}case"not_multiple_of":return`Nevalida nombro: devas esti oblo de ${n.divisor}`;case"unrecognized_keys":return`Nekonata${n.keys.length>1?"j":""} ŝlosilo${n.keys.length>1?"j":""}: ${Te(n.keys,", ")}`;case"invalid_key":return`Nevalida ŝlosilo en ${n.origin}`;case"invalid_union":return"Nevalida enigo";case"invalid_element":return`Nevalida valoro en ${n.origin}`;default:return"Nevalida enigo"}}};function Hle(){return{localeError:Kle()}}const Vle=()=>{const e={string:{unit:"caracteres",verb:"tener"},file:{unit:"bytes",verb:"tener"},array:{unit:"elementos",verb:"tener"},set:{unit:"elementos",verb:"tener"}},t={string:"texto",number:"número",boolean:"booleano",array:"arreglo",object:"objeto",set:"conjunto",file:"archivo",date:"fecha",bigint:"número grande",symbol:"símbolo",undefined:"indefinido",null:"nulo",function:"función",map:"mapa",record:"registro",tuple:"tupla",enum:"enumeración",union:"unión",literal:"literal",promise:"promesa",void:"vacío",never:"nunca",unknown:"desconocido",any:"cualquiera"};function r(a){return e[a]??null}function n(a){return t[a]??a}const i=a=>{const s=typeof a;switch(s){case"number":return Number.isNaN(a)?"NaN":"number";case"object":return Array.isArray(a)?"array":a===null?"null":Object.getPrototypeOf(a)!==Object.prototype?a.constructor.name:"object"}return s},o={regex:"entrada",email:"dirección de correo electrónico",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:"fecha y hora ISO",date:"fecha ISO",time:"hora ISO",duration:"duración ISO",ipv4:"dirección IPv4",ipv6:"dirección IPv6",cidrv4:"rango IPv4",cidrv6:"rango IPv6",base64:"cadena codificada en base64",base64url:"URL codificada en base64",json_string:"cadena JSON",e164:"número E.164",jwt:"JWT",template_literal:"entrada"};return a=>{switch(a.code){case"invalid_type":return`Entrada inválida: se esperaba ${n(a.expected)}, recibido ${n(i(a.input))}`;case"invalid_value":return a.values.length===1?`Entrada inválida: se esperaba ${pt(a.values[0])}`:`Opción inválida: se esperaba una de ${Te(a.values,"|")}`;case"too_big":{const s=a.inclusive?"<=":"<",u=r(a.origin),d=n(a.origin);return u?`Demasiado grande: se esperaba que ${d??"valor"} tuviera ${s}${a.maximum.toString()} ${u.unit??"elementos"}`:`Demasiado grande: se esperaba que ${d??"valor"} fuera ${s}${a.maximum.toString()}`}case"too_small":{const s=a.inclusive?">=":">",u=r(a.origin),d=n(a.origin);return u?`Demasiado pequeño: se esperaba que ${d} tuviera ${s}${a.minimum.toString()} ${u.unit}`:`Demasiado pequeño: se esperaba que ${d} fuera ${s}${a.minimum.toString()}`}case"invalid_format":{const s=a;return s.format==="starts_with"?`Cadena inválida: debe comenzar con "${s.prefix}"`:s.format==="ends_with"?`Cadena inválida: debe terminar en "${s.suffix}"`:s.format==="includes"?`Cadena inválida: debe incluir "${s.includes}"`:s.format==="regex"?`Cadena inválida: debe coincidir con el patrón ${s.pattern}`:`Inválido ${o[s.format]??a.format}`}case"not_multiple_of":return`Número inválido: debe ser múltiplo de ${a.divisor}`;case"unrecognized_keys":return`Llave${a.keys.length>1?"s":""} desconocida${a.keys.length>1?"s":""}: ${Te(a.keys,", ")}`;case"invalid_key":return`Llave inválida en ${n(a.origin)}`;case"invalid_union":return"Entrada inválida";case"invalid_element":return`Valor inválido en ${n(a.origin)}`;default:return"Entrada inválida"}}};function qle(){return{localeError:Vle()}}const Gle=()=>{const e={string:{unit:"کاراکتر",verb:"داشته باشد"},file:{unit:"بایت",verb:"داشته باشد"},array:{unit:"آیتم",verb:"داشته باشد"},set:{unit:"آیتم",verb:"داشته باشد"}};function t(i){return e[i]??null}const r=i=>{const o=typeof i;switch(o){case"number":return Number.isNaN(i)?"NaN":"عدد";case"object":{if(Array.isArray(i))return"آرایه";if(i===null)return"null";if(Object.getPrototypeOf(i)!==Object.prototype&&i.constructor)return i.constructor.name}}return o},n={regex:"ورودی",email:"آدرس ایمیل",url:"URL",emoji:"ایموجی",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"تاریخ و زمان ایزو",date:"تاریخ ایزو",time:"زمان ایزو",duration:"مدت زمان ایزو",ipv4:"IPv4 آدرس",ipv6:"IPv6 آدرس",cidrv4:"IPv4 دامنه",cidrv6:"IPv6 دامنه",base64:"base64-encoded رشته",base64url:"base64url-encoded رشته",json_string:"JSON رشته",e164:"E.164 عدد",jwt:"JWT",template_literal:"ورودی"};return i=>{switch(i.code){case"invalid_type":return`ورودی نامعتبر: می‌بایست ${i.expected} می‌بود، ${r(i.input)} دریافت شد`;case"invalid_value":return i.values.length===1?`ورودی نامعتبر: می‌بایست ${pt(i.values[0])} می‌بود`:`گزینه نامعتبر: می‌بایست یکی از ${Te(i.values,"|")} می‌بود`;case"too_big":{const o=i.inclusive?"<=":"<",a=t(i.origin);return a?`خیلی بزرگ: ${i.origin??"مقدار"} باید ${o}${i.maximum.toString()} ${a.unit??"عنصر"} باشد`:`خیلی بزرگ: ${i.origin??"مقدار"} باید ${o}${i.maximum.toString()} باشد`}case"too_small":{const o=i.inclusive?">=":">",a=t(i.origin);return a?`خیلی کوچک: ${i.origin} باید ${o}${i.minimum.toString()} ${a.unit} باشد`:`خیلی کوچک: ${i.origin} باید ${o}${i.minimum.toString()} باشد`}case"invalid_format":{const o=i;return o.format==="starts_with"?`رشته نامعتبر: باید با "${o.prefix}" شروع شود`:o.format==="ends_with"?`رشته نامعتبر: باید با "${o.suffix}" تمام شود`:o.format==="includes"?`رشته نامعتبر: باید شامل "${o.includes}" باشد`:o.format==="regex"?`رشته نامعتبر: باید با الگوی ${o.pattern} مطابقت داشته باشد`:`${n[o.format]??i.format} نامعتبر`}case"not_multiple_of":return`عدد نامعتبر: باید مضرب ${i.divisor} باشد`;case"unrecognized_keys":return`کلید${i.keys.length>1?"های":""} ناشناس: ${Te(i.keys,", ")}`;case"invalid_key":return`کلید ناشناس در ${i.origin}`;case"invalid_union":return"ورودی نامعتبر";case"invalid_element":return`مقدار نامعتبر در ${i.origin}`;default:return"ورودی نامعتبر"}}};function Zle(){return{localeError:Gle()}}const Xle=()=>{const e={string:{unit:"merkkiä",subject:"merkkijonon"},file:{unit:"tavua",subject:"tiedoston"},array:{unit:"alkiota",subject:"listan"},set:{unit:"alkiota",subject:"joukon"},number:{unit:"",subject:"luvun"},bigint:{unit:"",subject:"suuren kokonaisluvun"},int:{unit:"",subject:"kokonaisluvun"},date:{unit:"",subject:"päivämäärän"}};function t(i){return e[i]??null}const r=i=>{const o=typeof i;switch(o){case"number":return Number.isNaN(i)?"NaN":"number";case"object":{if(Array.isArray(i))return"array";if(i===null)return"null";if(Object.getPrototypeOf(i)!==Object.prototype&&i.constructor)return i.constructor.name}}return o},n={regex:"säännöllinen lauseke",email:"sähköpostiosoite",url:"URL-osoite",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO-aikaleima",date:"ISO-päivämäärä",time:"ISO-aika",duration:"ISO-kesto",ipv4:"IPv4-osoite",ipv6:"IPv6-osoite",cidrv4:"IPv4-alue",cidrv6:"IPv6-alue",base64:"base64-koodattu merkkijono",base64url:"base64url-koodattu merkkijono",json_string:"JSON-merkkijono",e164:"E.164-luku",jwt:"JWT",template_literal:"templaattimerkkijono"};return i=>{switch(i.code){case"invalid_type":return`Virheellinen tyyppi: odotettiin ${i.expected}, oli ${r(i.input)}`;case"invalid_value":return i.values.length===1?`Virheellinen syöte: täytyy olla ${pt(i.values[0])}`:`Virheellinen valinta: täytyy olla yksi seuraavista: ${Te(i.values,"|")}`;case"too_big":{const o=i.inclusive?"<=":"<",a=t(i.origin);return a?`Liian suuri: ${a.subject} täytyy olla ${o}${i.maximum.toString()} ${a.unit}`.trim():`Liian suuri: arvon täytyy olla ${o}${i.maximum.toString()}`}case"too_small":{const o=i.inclusive?">=":">",a=t(i.origin);return a?`Liian pieni: ${a.subject} täytyy olla ${o}${i.minimum.toString()} ${a.unit}`.trim():`Liian pieni: arvon täytyy olla ${o}${i.minimum.toString()}`}case"invalid_format":{const o=i;return o.format==="starts_with"?`Virheellinen syöte: täytyy alkaa "${o.prefix}"`:o.format==="ends_with"?`Virheellinen syöte: täytyy loppua "${o.suffix}"`:o.format==="includes"?`Virheellinen syöte: täytyy sisältää "${o.includes}"`:o.format==="regex"?`Virheellinen syöte: täytyy vastata säännöllistä lauseketta ${o.pattern}`:`Virheellinen ${n[o.format]??i.format}`}case"not_multiple_of":return`Virheellinen luku: täytyy olla luvun ${i.divisor} monikerta`;case"unrecognized_keys":return`${i.keys.length>1?"Tuntemattomat avaimet":"Tuntematon avain"}: ${Te(i.keys,", ")}`;case"invalid_key":return"Virheellinen avain tietueessa";case"invalid_union":return"Virheellinen unioni";case"invalid_element":return"Virheellinen arvo joukossa";default:return"Virheellinen syöte"}}};function Yle(){return{localeError:Xle()}}const Qle=()=>{const e={string:{unit:"caractères",verb:"avoir"},file:{unit:"octets",verb:"avoir"},array:{unit:"éléments",verb:"avoir"},set:{unit:"éléments",verb:"avoir"}};function t(i){return e[i]??null}const r=i=>{const o=typeof i;switch(o){case"number":return Number.isNaN(i)?"NaN":"nombre";case"object":{if(Array.isArray(i))return"tableau";if(i===null)return"null";if(Object.getPrototypeOf(i)!==Object.prototype&&i.constructor)return i.constructor.name}}return o},n={regex:"entrée",email:"adresse e-mail",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:"date et heure ISO",date:"date ISO",time:"heure ISO",duration:"durée ISO",ipv4:"adresse IPv4",ipv6:"adresse IPv6",cidrv4:"plage IPv4",cidrv6:"plage IPv6",base64:"chaîne encodée en base64",base64url:"chaîne encodée en base64url",json_string:"chaîne JSON",e164:"numéro E.164",jwt:"JWT",template_literal:"entrée"};return i=>{switch(i.code){case"invalid_type":return`Entrée invalide : ${i.expected} attendu, ${r(i.input)} reçu`;case"invalid_value":return i.values.length===1?`Entrée invalide : ${pt(i.values[0])} attendu`:`Option invalide : une valeur parmi ${Te(i.values,"|")} attendue`;case"too_big":{const o=i.inclusive?"<=":"<",a=t(i.origin);return a?`Trop grand : ${i.origin??"valeur"} doit ${a.verb} ${o}${i.maximum.toString()} ${a.unit??"élément(s)"}`:`Trop grand : ${i.origin??"valeur"} doit être ${o}${i.maximum.toString()}`}case"too_small":{const o=i.inclusive?">=":">",a=t(i.origin);return a?`Trop petit : ${i.origin} doit ${a.verb} ${o}${i.minimum.toString()} ${a.unit}`:`Trop petit : ${i.origin} doit être ${o}${i.minimum.toString()}`}case"invalid_format":{const o=i;return o.format==="starts_with"?`Chaîne invalide : doit commencer par "${o.prefix}"`:o.format==="ends_with"?`Chaîne invalide : doit se terminer par "${o.suffix}"`:o.format==="includes"?`Chaîne invalide : doit inclure "${o.includes}"`:o.format==="regex"?`Chaîne invalide : doit correspondre au modèle ${o.pattern}`:`${n[o.format]??i.format} invalide`}case"not_multiple_of":return`Nombre invalide : doit être un multiple de ${i.divisor}`;case"unrecognized_keys":return`Clé${i.keys.length>1?"s":""} non reconnue${i.keys.length>1?"s":""} : ${Te(i.keys,", ")}`;case"invalid_key":return`Clé invalide dans ${i.origin}`;case"invalid_union":return"Entrée invalide";case"invalid_element":return`Valeur invalide dans ${i.origin}`;default:return"Entrée invalide"}}};function Jle(){return{localeError:Qle()}}const eue=()=>{const e={string:{unit:"caractères",verb:"avoir"},file:{unit:"octets",verb:"avoir"},array:{unit:"éléments",verb:"avoir"},set:{unit:"éléments",verb:"avoir"}};function t(i){return e[i]??null}const r=i=>{const o=typeof i;switch(o){case"number":return Number.isNaN(i)?"NaN":"number";case"object":{if(Array.isArray(i))return"array";if(i===null)return"null";if(Object.getPrototypeOf(i)!==Object.prototype&&i.constructor)return i.constructor.name}}return o},n={regex:"entrée",email:"adresse courriel",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:"date-heure ISO",date:"date ISO",time:"heure ISO",duration:"durée ISO",ipv4:"adresse IPv4",ipv6:"adresse IPv6",cidrv4:"plage IPv4",cidrv6:"plage IPv6",base64:"chaîne encodée en base64",base64url:"chaîne encodée en base64url",json_string:"chaîne JSON",e164:"numéro E.164",jwt:"JWT",template_literal:"entrée"};return i=>{switch(i.code){case"invalid_type":return`Entrée invalide : attendu ${i.expected}, reçu ${r(i.input)}`;case"invalid_value":return i.values.length===1?`Entrée invalide : attendu ${pt(i.values[0])}`:`Option invalide : attendu l'une des valeurs suivantes ${Te(i.values,"|")}`;case"too_big":{const o=i.inclusive?"≤":"<",a=t(i.origin);return a?`Trop grand : attendu que ${i.origin??"la valeur"} ait ${o}${i.maximum.toString()} ${a.unit}`:`Trop grand : attendu que ${i.origin??"la valeur"} soit ${o}${i.maximum.toString()}`}case"too_small":{const o=i.inclusive?"≥":">",a=t(i.origin);return a?`Trop petit : attendu que ${i.origin} ait ${o}${i.minimum.toString()} ${a.unit}`:`Trop petit : attendu que ${i.origin} soit ${o}${i.minimum.toString()}`}case"invalid_format":{const o=i;return o.format==="starts_with"?`Chaîne invalide : doit commencer par "${o.prefix}"`:o.format==="ends_with"?`Chaîne invalide : doit se terminer par "${o.suffix}"`:o.format==="includes"?`Chaîne invalide : doit inclure "${o.includes}"`:o.format==="regex"?`Chaîne invalide : doit correspondre au motif ${o.pattern}`:`${n[o.format]??i.format} invalide`}case"not_multiple_of":return`Nombre invalide : doit être un multiple de ${i.divisor}`;case"unrecognized_keys":return`Clé${i.keys.length>1?"s":""} non reconnue${i.keys.length>1?"s":""} : ${Te(i.keys,", ")}`;case"invalid_key":return`Clé invalide dans ${i.origin}`;case"invalid_union":return"Entrée invalide";case"invalid_element":return`Valeur invalide dans ${i.origin}`;default:return"Entrée invalide"}}};function tue(){return{localeError:eue()}}const rue=()=>{const e={string:{label:"מחרוזת",gender:"f"},number:{label:"מספר",gender:"m"},boolean:{label:"ערך בוליאני",gender:"m"},bigint:{label:"BigInt",gender:"m"},date:{label:"תאריך",gender:"m"},array:{label:"מערך",gender:"m"},object:{label:"אובייקט",gender:"m"},null:{label:"ערך ריק (null)",gender:"m"},undefined:{label:"ערך לא מוגדר (undefined)",gender:"m"},symbol:{label:"סימבול (Symbol)",gender:"m"},function:{label:"פונקציה",gender:"f"},map:{label:"מפה (Map)",gender:"f"},set:{label:"קבוצה (Set)",gender:"f"},file:{label:"קובץ",gender:"m"},promise:{label:"Promise",gender:"m"},NaN:{label:"NaN",gender:"m"},unknown:{label:"ערך לא ידוע",gender:"m"},value:{label:"ערך",gender:"m"}},t={string:{unit:"תווים",shortLabel:"קצר",longLabel:"ארוך"},file:{unit:"בייטים",shortLabel:"קטן",longLabel:"גדול"},array:{unit:"פריטים",shortLabel:"קטן",longLabel:"גדול"},set:{unit:"פריטים",shortLabel:"קטן",longLabel:"גדול"},number:{unit:"",shortLabel:"קטן",longLabel:"גדול"}},r=d=>d?e[d]:void 0,n=d=>{const f=r(d);return f?f.label:d??e.unknown.label},i=d=>`ה${n(d)}`,o=d=>{const f=r(d);return((f==null?void 0:f.gender)??"m")==="f"?"צריכה להיות":"צריך להיות"},a=d=>d?t[d]??null:null,s=d=>{const f=typeof d;switch(f){case"number":return Number.isNaN(d)?"NaN":"number";case"object":return Array.isArray(d)?"array":d===null?"null":Object.getPrototypeOf(d)!==Object.prototype&&d.constructor?d.constructor.name:"object";default:return f}},u={regex:{label:"קלט",gender:"m"},email:{label:"כתובת אימייל",gender:"f"},url:{label:"כתובת רשת",gender:"f"},emoji:{label:"אימוג'י",gender:"m"},uuid:{label:"UUID",gender:"m"},nanoid:{label:"nanoid",gender:"m"},guid:{label:"GUID",gender:"m"},cuid:{label:"cuid",gender:"m"},cuid2:{label:"cuid2",gender:"m"},ulid:{label:"ULID",gender:"m"},xid:{label:"XID",gender:"m"},ksuid:{label:"KSUID",gender:"m"},datetime:{label:"תאריך וזמן ISO",gender:"m"},date:{label:"תאריך ISO",gender:"m"},time:{label:"זמן ISO",gender:"m"},duration:{label:"משך זמן ISO",gender:"m"},ipv4:{label:"כתובת IPv4",gender:"f"},ipv6:{label:"כתובת IPv6",gender:"f"},cidrv4:{label:"טווח IPv4",gender:"m"},cidrv6:{label:"טווח IPv6",gender:"m"},base64:{label:"מחרוזת בבסיס 64",gender:"f"},base64url:{label:"מחרוזת בבסיס 64 לכתובות רשת",gender:"f"},json_string:{label:"מחרוזת JSON",gender:"f"},e164:{label:"מספר E.164",gender:"m"},jwt:{label:"JWT",gender:"m"},ends_with:{label:"קלט",gender:"m"},includes:{label:"קלט",gender:"m"},lowercase:{label:"קלט",gender:"m"},starts_with:{label:"קלט",gender:"m"},uppercase:{label:"קלט",gender:"m"}};return d=>{var f;switch(d.code){case"invalid_type":{const p=d.expected,v=n(p),y=s(d.input),b=((f=e[y])==null?void 0:f.label)??y;return`קלט לא תקין: צריך להיות ${v}, התקבל ${b}`}case"invalid_value":{if(d.values.length===1)return`ערך לא תקין: הערך חייב להיות ${pt(d.values[0])}`;const p=d.values.map(b=>pt(b));if(d.values.length===2)return`ערך לא תקין: האפשרויות המתאימות הן ${p[0]} או ${p[1]}`;const v=p[p.length-1];return`ערך לא תקין: האפשרויות המתאימות הן ${p.slice(0,-1).join(", ")} או ${v}`}case"too_big":{const p=a(d.origin),v=i(d.origin??"value");if(d.origin==="string")return`${(p==null?void 0:p.longLabel)??"ארוך"} מדי: ${v} צריכה להכיל ${d.maximum.toString()} ${(p==null?void 0:p.unit)??""} ${d.inclusive?"או פחות":"לכל היותר"}`.trim();if(d.origin==="number"){const w=d.inclusive?`קטן או שווה ל-${d.maximum}`:`קטן מ-${d.maximum}`;return`גדול מדי: ${v} צריך להיות ${w}`}if(d.origin==="array"||d.origin==="set"){const w=d.origin==="set"?"צריכה":"צריך",x=d.inclusive?`${d.maximum} ${(p==null?void 0:p.unit)??""} או פחות`:`פחות מ-${d.maximum} ${(p==null?void 0:p.unit)??""}`;return`גדול מדי: ${v} ${w} להכיל ${x}`.trim()}const y=d.inclusive?"<=":"<",b=o(d.origin??"value");return p!=null&&p.unit?`${p.longLabel} מדי: ${v} ${b} ${y}${d.maximum.toString()} ${p.unit}`:`${(p==null?void 0:p.longLabel)??"גדול"} מדי: ${v} ${b} ${y}${d.maximum.toString()}`}case"too_small":{const p=a(d.origin),v=i(d.origin??"value");if(d.origin==="string")return`${(p==null?void 0:p.shortLabel)??"קצר"} מדי: ${v} צריכה להכיל ${d.minimum.toString()} ${(p==null?void 0:p.unit)??""} ${d.inclusive?"או יותר":"לפחות"}`.trim();if(d.origin==="number"){const w=d.inclusive?`גדול או שווה ל-${d.minimum}`:`גדול מ-${d.minimum}`;return`קטן מדי: ${v} צריך להיות ${w}`}if(d.origin==="array"||d.origin==="set"){const w=d.origin==="set"?"צריכה":"צריך";if(d.minimum===1&&d.inclusive){const k=(d.origin==="set","לפחות פריט אחד");return`קטן מדי: ${v} ${w} להכיל ${k}`}const x=d.inclusive?`${d.minimum} ${(p==null?void 0:p.unit)??""} או יותר`:`יותר מ-${d.minimum} ${(p==null?void 0:p.unit)??""}`;return`קטן מדי: ${v} ${w} להכיל ${x}`.trim()}const y=d.inclusive?">=":">",b=o(d.origin??"value");return p!=null&&p.unit?`${p.shortLabel} מדי: ${v} ${b} ${y}${d.minimum.toString()} ${p.unit}`:`${(p==null?void 0:p.shortLabel)??"קטן"} מדי: ${v} ${b} ${y}${d.minimum.toString()}`}case"invalid_format":{const p=d;if(p.format==="starts_with")return`המחרוזת חייבת להתחיל ב "${p.prefix}"`;if(p.format==="ends_with")return`המחרוזת חייבת להסתיים ב "${p.suffix}"`;if(p.format==="includes")return`המחרוזת חייבת לכלול "${p.includes}"`;if(p.format==="regex")return`המחרוזת חייבת להתאים לתבנית ${p.pattern}`;const v=u[p.format],y=(v==null?void 0:v.label)??p.format,w=((v==null?void 0:v.gender)??"m")==="f"?"תקינה":"תקין";return`${y} לא ${w}`}case"not_multiple_of":return`מספר לא תקין: חייב להיות מכפלה של ${d.divisor}`;case"unrecognized_keys":return`מפתח${d.keys.length>1?"ות":""} לא מזוה${d.keys.length>1?"ים":"ה"}: ${Te(d.keys,", ")}`;case"invalid_key":return"שדה לא תקין באובייקט";case"invalid_union":return"קלט לא תקין";case"invalid_element":return`ערך לא תקין ב${i(d.origin??"array")}`;default:return"קלט לא תקין"}}};function nue(){return{localeError:rue()}}const iue=()=>{const e={string:{unit:"karakter",verb:"legyen"},file:{unit:"byte",verb:"legyen"},array:{unit:"elem",verb:"legyen"},set:{unit:"elem",verb:"legyen"}};function t(i){return e[i]??null}const r=i=>{const o=typeof i;switch(o){case"number":return Number.isNaN(i)?"NaN":"szám";case"object":{if(Array.isArray(i))return"tömb";if(i===null)return"null";if(Object.getPrototypeOf(i)!==Object.prototype&&i.constructor)return i.constructor.name}}return o},n={regex:"bemenet",email:"email cím",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 időbélyeg",date:"ISO dátum",time:"ISO idő",duration:"ISO időintervallum",ipv4:"IPv4 cím",ipv6:"IPv6 cím",cidrv4:"IPv4 tartomány",cidrv6:"IPv6 tartomány",base64:"base64-kódolt string",base64url:"base64url-kódolt string",json_string:"JSON string",e164:"E.164 szám",jwt:"JWT",template_literal:"bemenet"};return i=>{switch(i.code){case"invalid_type":return`Érvénytelen bemenet: a várt érték ${i.expected}, a kapott érték ${r(i.input)}`;case"invalid_value":return i.values.length===1?`Érvénytelen bemenet: a várt érték ${pt(i.values[0])}`:`Érvénytelen opció: valamelyik érték várt ${Te(i.values,"|")}`;case"too_big":{const o=i.inclusive?"<=":"<",a=t(i.origin);return a?`Túl nagy: ${i.origin??"érték"} mérete túl nagy ${o}${i.maximum.toString()} ${a.unit??"elem"}`:`Túl nagy: a bemeneti érték ${i.origin??"érték"} túl nagy: ${o}${i.maximum.toString()}`}case"too_small":{const o=i.inclusive?">=":">",a=t(i.origin);return a?`Túl kicsi: a bemeneti érték ${i.origin} mérete túl kicsi ${o}${i.minimum.toString()} ${a.unit}`:`Túl kicsi: a bemeneti érték ${i.origin} túl kicsi ${o}${i.minimum.toString()}`}case"invalid_format":{const o=i;return o.format==="starts_with"?`Érvénytelen string: "${o.prefix}" értékkel kell kezdődnie`:o.format==="ends_with"?`Érvénytelen string: "${o.suffix}" értékkel kell végződnie`:o.format==="includes"?`Érvénytelen string: "${o.includes}" értéket kell tartalmaznia`:o.format==="regex"?`Érvénytelen string: ${o.pattern} mintának kell megfelelnie`:`Érvénytelen ${n[o.format]??i.format}`}case"not_multiple_of":return`Érvénytelen szám: ${i.divisor} többszörösének kell lennie`;case"unrecognized_keys":return`Ismeretlen kulcs${i.keys.length>1?"s":""}: ${Te(i.keys,", ")}`;case"invalid_key":return`Érvénytelen kulcs ${i.origin}`;case"invalid_union":return"Érvénytelen bemenet";case"invalid_element":return`Érvénytelen érték: ${i.origin}`;default:return"Érvénytelen bemenet"}}};function oue(){return{localeError:iue()}}const aue=()=>{const e={string:{unit:"karakter",verb:"memiliki"},file:{unit:"byte",verb:"memiliki"},array:{unit:"item",verb:"memiliki"},set:{unit:"item",verb:"memiliki"}};function t(i){return e[i]??null}const r=i=>{const o=typeof i;switch(o){case"number":return Number.isNaN(i)?"NaN":"number";case"object":{if(Array.isArray(i))return"array";if(i===null)return"null";if(Object.getPrototypeOf(i)!==Object.prototype&&i.constructor)return i.constructor.name}}return o},n={regex:"input",email:"alamat email",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:"tanggal dan waktu format ISO",date:"tanggal format ISO",time:"jam format ISO",duration:"durasi format ISO",ipv4:"alamat IPv4",ipv6:"alamat IPv6",cidrv4:"rentang alamat IPv4",cidrv6:"rentang alamat IPv6",base64:"string dengan enkode base64",base64url:"string dengan enkode base64url",json_string:"string JSON",e164:"angka E.164",jwt:"JWT",template_literal:"input"};return i=>{switch(i.code){case"invalid_type":return`Input tidak valid: diharapkan ${i.expected}, diterima ${r(i.input)}`;case"invalid_value":return i.values.length===1?`Input tidak valid: diharapkan ${pt(i.values[0])}`:`Pilihan tidak valid: diharapkan salah satu dari ${Te(i.values,"|")}`;case"too_big":{const o=i.inclusive?"<=":"<",a=t(i.origin);return a?`Terlalu besar: diharapkan ${i.origin??"value"} memiliki ${o}${i.maximum.toString()} ${a.unit??"elemen"}`:`Terlalu besar: diharapkan ${i.origin??"value"} menjadi ${o}${i.maximum.toString()}`}case"too_small":{const o=i.inclusive?">=":">",a=t(i.origin);return a?`Terlalu kecil: diharapkan ${i.origin} memiliki ${o}${i.minimum.toString()} ${a.unit}`:`Terlalu kecil: diharapkan ${i.origin} menjadi ${o}${i.minimum.toString()}`}case"invalid_format":{const o=i;return o.format==="starts_with"?`String tidak valid: harus dimulai dengan "${o.prefix}"`:o.format==="ends_with"?`String tidak valid: harus berakhir dengan "${o.suffix}"`:o.format==="includes"?`String tidak valid: harus menyertakan "${o.includes}"`:o.format==="regex"?`String tidak valid: harus sesuai pola ${o.pattern}`:`${n[o.format]??i.format} tidak valid`}case"not_multiple_of":return`Angka tidak valid: harus kelipatan dari ${i.divisor}`;case"unrecognized_keys":return`Kunci tidak dikenali ${i.keys.length>1?"s":""}: ${Te(i.keys,", ")}`;case"invalid_key":return`Kunci tidak valid di ${i.origin}`;case"invalid_union":return"Input tidak valid";case"invalid_element":return`Nilai tidak valid di ${i.origin}`;default:return"Input tidak valid"}}};function sue(){return{localeError:aue()}}const lue=e=>{const t=typeof e;switch(t){case"number":return Number.isNaN(e)?"NaN":"númer";case"object":{if(Array.isArray(e))return"fylki";if(e===null)return"null";if(Object.getPrototypeOf(e)!==Object.prototype&&e.constructor)return e.constructor.name}}return t},uue=()=>{const e={string:{unit:"stafi",verb:"að hafa"},file:{unit:"bæti",verb:"að hafa"},array:{unit:"hluti",verb:"að hafa"},set:{unit:"hluti",verb:"að hafa"}};function t(n){return e[n]??null}const r={regex:"gildi",email:"netfang",url:"vefslóð",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO dagsetning og tími",date:"ISO dagsetning",time:"ISO tími",duration:"ISO tímalengd",ipv4:"IPv4 address",ipv6:"IPv6 address",cidrv4:"IPv4 range",cidrv6:"IPv6 range",base64:"base64-encoded strengur",base64url:"base64url-encoded strengur",json_string:"JSON strengur",e164:"E.164 tölugildi",jwt:"JWT",template_literal:"gildi"};return n=>{switch(n.code){case"invalid_type":return`Rangt gildi: Þú slóst inn ${lue(n.input)} þar sem á að vera ${n.expected}`;case"invalid_value":return n.values.length===1?`Rangt gildi: gert ráð fyrir ${pt(n.values[0])}`:`Ógilt val: má vera eitt af eftirfarandi ${Te(n.values,"|")}`;case"too_big":{const i=n.inclusive?"<=":"<",o=t(n.origin);return o?`Of stórt: gert er ráð fyrir að ${n.origin??"gildi"} hafi ${i}${n.maximum.toString()} ${o.unit??"hluti"}`:`Of stórt: gert er ráð fyrir að ${n.origin??"gildi"} sé ${i}${n.maximum.toString()}`}case"too_small":{const i=n.inclusive?">=":">",o=t(n.origin);return o?`Of lítið: gert er ráð fyrir að ${n.origin} hafi ${i}${n.minimum.toString()} ${o.unit}`:`Of lítið: gert er ráð fyrir að ${n.origin} sé ${i}${n.minimum.toString()}`}case"invalid_format":{const i=n;return i.format==="starts_with"?`Ógildur strengur: verður að byrja á "${i.prefix}"`:i.format==="ends_with"?`Ógildur strengur: verður að enda á "${i.suffix}"`:i.format==="includes"?`Ógildur strengur: verður að innihalda "${i.includes}"`:i.format==="regex"?`Ógildur strengur: verður að fylgja mynstri ${i.pattern}`:`Rangt ${r[i.format]??n.format}`}case"not_multiple_of":return`Röng tala: verður að vera margfeldi af ${n.divisor}`;case"unrecognized_keys":return`Óþekkt ${n.keys.length>1?"ir lyklar":"ur lykill"}: ${Te(n.keys,", ")}`;case"invalid_key":return`Rangur lykill í ${n.origin}`;case"invalid_union":return"Rangt gildi";case"invalid_element":return`Rangt gildi í ${n.origin}`;default:return"Rangt gildi"}}};function cue(){return{localeError:uue()}}const due=()=>{const e={string:{unit:"caratteri",verb:"avere"},file:{unit:"byte",verb:"avere"},array:{unit:"elementi",verb:"avere"},set:{unit:"elementi",verb:"avere"}};function t(i){return e[i]??null}const r=i=>{const o=typeof i;switch(o){case"number":return Number.isNaN(i)?"NaN":"numero";case"object":{if(Array.isArray(i))return"vettore";if(i===null)return"null";if(Object.getPrototypeOf(i)!==Object.prototype&&i.constructor)return i.constructor.name}}return o},n={regex:"input",email:"indirizzo email",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:"data e ora ISO",date:"data ISO",time:"ora ISO",duration:"durata ISO",ipv4:"indirizzo IPv4",ipv6:"indirizzo IPv6",cidrv4:"intervallo IPv4",cidrv6:"intervallo IPv6",base64:"stringa codificata in base64",base64url:"URL codificata in base64",json_string:"stringa JSON",e164:"numero E.164",jwt:"JWT",template_literal:"input"};return i=>{switch(i.code){case"invalid_type":return`Input non valido: atteso ${i.expected}, ricevuto ${r(i.input)}`;case"invalid_value":return i.values.length===1?`Input non valido: atteso ${pt(i.values[0])}`:`Opzione non valida: atteso uno tra ${Te(i.values,"|")}`;case"too_big":{const o=i.inclusive?"<=":"<",a=t(i.origin);return a?`Troppo grande: ${i.origin??"valore"} deve avere ${o}${i.maximum.toString()} ${a.unit??"elementi"}`:`Troppo grande: ${i.origin??"valore"} deve essere ${o}${i.maximum.toString()}`}case"too_small":{const o=i.inclusive?">=":">",a=t(i.origin);return a?`Troppo piccolo: ${i.origin} deve avere ${o}${i.minimum.toString()} ${a.unit}`:`Troppo piccolo: ${i.origin} deve essere ${o}${i.minimum.toString()}`}case"invalid_format":{const o=i;return o.format==="starts_with"?`Stringa non valida: deve iniziare con "${o.prefix}"`:o.format==="ends_with"?`Stringa non valida: deve terminare con "${o.suffix}"`:o.format==="includes"?`Stringa non valida: deve includere "${o.includes}"`:o.format==="regex"?`Stringa non valida: deve corrispondere al pattern ${o.pattern}`:`Invalid ${n[o.format]??i.format}`}case"not_multiple_of":return`Numero non valido: deve essere un multiplo di ${i.divisor}`;case"unrecognized_keys":return`Chiav${i.keys.length>1?"i":"e"} non riconosciut${i.keys.length>1?"e":"a"}: ${Te(i.keys,", ")}`;case"invalid_key":return`Chiave non valida in ${i.origin}`;case"invalid_union":return"Input non valido";case"invalid_element":return`Valore non valido in ${i.origin}`;default:return"Input non valido"}}};function fue(){return{localeError:due()}}const pue=()=>{const e={string:{unit:"文字",verb:"である"},file:{unit:"バイト",verb:"である"},array:{unit:"要素",verb:"である"},set:{unit:"要素",verb:"である"}};function t(i){return e[i]??null}const r=i=>{const o=typeof i;switch(o){case"number":return Number.isNaN(i)?"NaN":"数値";case"object":{if(Array.isArray(i))return"配列";if(i===null)return"null";if(Object.getPrototypeOf(i)!==Object.prototype&&i.constructor)return i.constructor.name}}return o},n={regex:"入力値",email:"メールアドレス",url:"URL",emoji:"絵文字",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO日時",date:"ISO日付",time:"ISO時刻",duration:"ISO期間",ipv4:"IPv4アドレス",ipv6:"IPv6アドレス",cidrv4:"IPv4範囲",cidrv6:"IPv6範囲",base64:"base64エンコード文字列",base64url:"base64urlエンコード文字列",json_string:"JSON文字列",e164:"E.164番号",jwt:"JWT",template_literal:"入力値"};return i=>{switch(i.code){case"invalid_type":return`無効な入力: ${i.expected}が期待されましたが、${r(i.input)}が入力されました`;case"invalid_value":return i.values.length===1?`無効な入力: ${pt(i.values[0])}が期待されました`:`無効な選択: ${Te(i.values,"、")}のいずれかである必要があります`;case"too_big":{const o=i.inclusive?"以下である":"より小さい",a=t(i.origin);return a?`大きすぎる値: ${i.origin??"値"}は${i.maximum.toString()}${a.unit??"要素"}${o}必要があります`:`大きすぎる値: ${i.origin??"値"}は${i.maximum.toString()}${o}必要があります`}case"too_small":{const o=i.inclusive?"以上である":"より大きい",a=t(i.origin);return a?`小さすぎる値: ${i.origin}は${i.minimum.toString()}${a.unit}${o}必要があります`:`小さすぎる値: ${i.origin}は${i.minimum.toString()}${o}必要があります`}case"invalid_format":{const o=i;return o.format==="starts_with"?`無効な文字列: "${o.prefix}"で始まる必要があります`:o.format==="ends_with"?`無効な文字列: "${o.suffix}"で終わる必要があります`:o.format==="includes"?`無効な文字列: "${o.includes}"を含む必要があります`:o.format==="regex"?`無効な文字列: パターン${o.pattern}に一致する必要があります`:`無効な${n[o.format]??i.format}`}case"not_multiple_of":return`無効な数値: ${i.divisor}の倍数である必要があります`;case"unrecognized_keys":return`認識されていないキー${i.keys.length>1?"群":""}: ${Te(i.keys,"、")}`;case"invalid_key":return`${i.origin}内の無効なキー`;case"invalid_union":return"無効な入力";case"invalid_element":return`${i.origin}内の無効な値`;default:return"無効な入力"}}};function hue(){return{localeError:pue()}}const mue=e=>{const t=typeof e;switch(t){case"number":return Number.isNaN(e)?"NaN":"რიცხვი";case"object":{if(Array.isArray(e))return"მასივი";if(e===null)return"null";if(Object.getPrototypeOf(e)!==Object.prototype&&e.constructor)return e.constructor.name}}return{string:"სტრინგი",boolean:"ბულეანი",undefined:"undefined",bigint:"bigint",symbol:"symbol",function:"ფუნქცია"}[t]??t},gue=()=>{const e={string:{unit:"სიმბოლო",verb:"უნდა შეიცავდეს"},file:{unit:"ბაიტი",verb:"უნდა შეიცავდეს"},array:{unit:"ელემენტი",verb:"უნდა შეიცავდეს"},set:{unit:"ელემენტი",verb:"უნდა შეიცავდეს"}};function t(n){return e[n]??null}const r={regex:"შეყვანა",email:"ელ-ფოსტის მისამართი",url:"URL",emoji:"ემოჯი",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"თარიღი-დრო",date:"თარიღი",time:"დრო",duration:"ხანგრძლივობა",ipv4:"IPv4 მისამართი",ipv6:"IPv6 მისამართი",cidrv4:"IPv4 დიაპაზონი",cidrv6:"IPv6 დიაპაზონი",base64:"base64-კოდირებული სტრინგი",base64url:"base64url-კოდირებული სტრინგი",json_string:"JSON სტრინგი",e164:"E.164 ნომერი",jwt:"JWT",template_literal:"შეყვანა"};return n=>{switch(n.code){case"invalid_type":return`არასწორი შეყვანა: მოსალოდნელი ${n.expected}, მიღებული ${mue(n.input)}`;case"invalid_value":return n.values.length===1?`არასწორი შეყვანა: მოსალოდნელი ${pt(n.values[0])}`:`არასწორი ვარიანტი: მოსალოდნელია ერთ-ერთი ${Te(n.values,"|")}-დან`;case"too_big":{const i=n.inclusive?"<=":"<",o=t(n.origin);return o?`ზედმეტად დიდი: მოსალოდნელი ${n.origin??"მნიშვნელობა"} ${o.verb} ${i}${n.maximum.toString()} ${o.unit}`:`ზედმეტად დიდი: მოსალოდნელი ${n.origin??"მნიშვნელობა"} იყოს ${i}${n.maximum.toString()}`}case"too_small":{const i=n.inclusive?">=":">",o=t(n.origin);return o?`ზედმეტად პატარა: მოსალოდნელი ${n.origin} ${o.verb} ${i}${n.minimum.toString()} ${o.unit}`:`ზედმეტად პატარა: მოსალოდნელი ${n.origin} იყოს ${i}${n.minimum.toString()}`}case"invalid_format":{const i=n;return i.format==="starts_with"?`არასწორი სტრინგი: უნდა იწყებოდეს "${i.prefix}"-ით`:i.format==="ends_with"?`არასწორი სტრინგი: უნდა მთავრდებოდეს "${i.suffix}"-ით`:i.format==="includes"?`არასწორი სტრინგი: უნდა შეიცავდეს "${i.includes}"-ს`:i.format==="regex"?`არასწორი სტრინგი: უნდა შეესაბამებოდეს შაბლონს ${i.pattern}`:`არასწორი ${r[i.format]??n.format}`}case"not_multiple_of":return`არასწორი რიცხვი: უნდა იყოს ${n.divisor}-ის ჯერადი`;case"unrecognized_keys":return`უცნობი გასაღებ${n.keys.length>1?"ები":"ი"}: ${Te(n.keys,", ")}`;case"invalid_key":return`არასწორი გასაღები ${n.origin}-ში`;case"invalid_union":return"არასწორი შეყვანა";case"invalid_element":return`არასწორი მნიშვნელობა ${n.origin}-ში`;default:return"არასწორი შეყვანა"}}};function vue(){return{localeError:gue()}}const yue=()=>{const e={string:{unit:"តួអក្សរ",verb:"គួរមាន"},file:{unit:"បៃ",verb:"គួរមាន"},array:{unit:"ធាតុ",verb:"គួរមាន"},set:{unit:"ធាតុ",verb:"គួរមាន"}};function t(i){return e[i]??null}const r=i=>{const o=typeof i;switch(o){case"number":return Number.isNaN(i)?"មិនមែនជាលេខ (NaN)":"លេខ";case"object":{if(Array.isArray(i))return"អារេ (Array)";if(i===null)return"គ្មានតម្លៃ (null)";if(Object.getPrototypeOf(i)!==Object.prototype&&i.constructor)return i.constructor.name}}return o},n={regex:"ទិន្នន័យបញ្ចូល",email:"អាសយដ្ឋានអ៊ីមែល",url:"URL",emoji:"សញ្ញាអារម្មណ៍",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"កាលបរិច្ឆេទ និងម៉ោង ISO",date:"កាលបរិច្ឆេទ ISO",time:"ម៉ោង ISO",duration:"រយៈពេល ISO",ipv4:"អាសយដ្ឋាន IPv4",ipv6:"អាសយដ្ឋាន IPv6",cidrv4:"ដែនអាសយដ្ឋាន IPv4",cidrv6:"ដែនអាសយដ្ឋាន IPv6",base64:"ខ្សែអក្សរអ៊ិកូដ base64",base64url:"ខ្សែអក្សរអ៊ិកូដ base64url",json_string:"ខ្សែអក្សរ JSON",e164:"លេខ E.164",jwt:"JWT",template_literal:"ទិន្នន័យបញ្ចូល"};return i=>{switch(i.code){case"invalid_type":return`ទិន្នន័យបញ្ចូលមិនត្រឹមត្រូវ៖ ត្រូវការ ${i.expected} ប៉ុន្តែទទួលបាន ${r(i.input)}`;case"invalid_value":return i.values.length===1?`ទិន្នន័យបញ្ចូលមិនត្រឹមត្រូវ៖ ត្រូវការ ${pt(i.values[0])}`:`ជម្រើសមិនត្រឹមត្រូវ៖ ត្រូវជាមួយក្នុងចំណោម ${Te(i.values,"|")}`;case"too_big":{const o=i.inclusive?"<=":"<",a=t(i.origin);return a?`ធំពេក៖ ត្រូវការ ${i.origin??"តម្លៃ"} ${o} ${i.maximum.toString()} ${a.unit??"ធាតុ"}`:`ធំពេក៖ ត្រូវការ ${i.origin??"តម្លៃ"} ${o} ${i.maximum.toString()}`}case"too_small":{const o=i.inclusive?">=":">",a=t(i.origin);return a?`តូចពេក៖ ត្រូវការ ${i.origin} ${o} ${i.minimum.toString()} ${a.unit}`:`តូចពេក៖ ត្រូវការ ${i.origin} ${o} ${i.minimum.toString()}`}case"invalid_format":{const o=i;return o.format==="starts_with"?`ខ្សែអក្សរមិនត្រឹមត្រូវ៖ ត្រូវចាប់ផ្តើមដោយ "${o.prefix}"`:o.format==="ends_with"?`ខ្សែអក្សរមិនត្រឹមត្រូវ៖ ត្រូវបញ្ចប់ដោយ "${o.suffix}"`:o.format==="includes"?`ខ្សែអក្សរមិនត្រឹមត្រូវ៖ ត្រូវមាន "${o.includes}"`:o.format==="regex"?`ខ្សែអក្សរមិនត្រឹមត្រូវ៖ ត្រូវតែផ្គូផ្គងនឹងទម្រង់ដែលបានកំណត់ ${o.pattern}`:`មិនត្រឹមត្រូវ៖ ${n[o.format]??i.format}`}case"not_multiple_of":return`លេខមិនត្រឹមត្រូវ៖ ត្រូវតែជាពហុគុណនៃ ${i.divisor}`;case"unrecognized_keys":return`រកឃើញសោមិនស្គាល់៖ ${Te(i.keys,", ")}`;case"invalid_key":return`សោមិនត្រឹមត្រូវនៅក្នុង ${i.origin}`;case"invalid_union":return"ទិន្នន័យមិនត្រឹមត្រូវ";case"invalid_element":return`ទិន្នន័យមិនត្រឹមត្រូវនៅក្នុង ${i.origin}`;default:return"ទិន្នន័យមិនត្រឹមត្រូវ"}}};function cF(){return{localeError:yue()}}function bue(){return cF()}const xue=()=>{const e={string:{unit:"문자",verb:"to have"},file:{unit:"바이트",verb:"to have"},array:{unit:"개",verb:"to have"},set:{unit:"개",verb:"to have"}};function t(i){return e[i]??null}const r=i=>{const o=typeof i;switch(o){case"number":return Number.isNaN(i)?"NaN":"number";case"object":{if(Array.isArray(i))return"array";if(i===null)return"null";if(Object.getPrototypeOf(i)!==Object.prototype&&i.constructor)return i.constructor.name}}return o},n={regex:"입력",email:"이메일 주소",url:"URL",emoji:"이모지",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO 날짜시간",date:"ISO 날짜",time:"ISO 시간",duration:"ISO 기간",ipv4:"IPv4 주소",ipv6:"IPv6 주소",cidrv4:"IPv4 범위",cidrv6:"IPv6 범위",base64:"base64 인코딩 문자열",base64url:"base64url 인코딩 문자열",json_string:"JSON 문자열",e164:"E.164 번호",jwt:"JWT",template_literal:"입력"};return i=>{switch(i.code){case"invalid_type":return`잘못된 입력: 예상 타입은 ${i.expected}, 받은 타입은 ${r(i.input)}입니다`;case"invalid_value":return i.values.length===1?`잘못된 입력: 값은 ${pt(i.values[0])} 이어야 합니다`:`잘못된 옵션: ${Te(i.values,"또는 ")} 중 하나여야 합니다`;case"too_big":{const o=i.inclusive?"이하":"미만",a=o==="미만"?"이어야 합니다":"여야 합니다",s=t(i.origin),u=(s==null?void 0:s.unit)??"요소";return s?`${i.origin??"값"}이 너무 큽니다: ${i.maximum.toString()}${u} ${o}${a}`:`${i.origin??"값"}이 너무 큽니다: ${i.maximum.toString()} ${o}${a}`}case"too_small":{const o=i.inclusive?"이상":"초과",a=o==="이상"?"이어야 합니다":"여야 합니다",s=t(i.origin),u=(s==null?void 0:s.unit)??"요소";return s?`${i.origin??"값"}이 너무 작습니다: ${i.minimum.toString()}${u} ${o}${a}`:`${i.origin??"값"}이 너무 작습니다: ${i.minimum.toString()} ${o}${a}`}case"invalid_format":{const o=i;return o.format==="starts_with"?`잘못된 문자열: "${o.prefix}"(으)로 시작해야 합니다`:o.format==="ends_with"?`잘못된 문자열: "${o.suffix}"(으)로 끝나야 합니다`:o.format==="includes"?`잘못된 문자열: "${o.includes}"을(를) 포함해야 합니다`:o.format==="regex"?`잘못된 문자열: 정규식 ${o.pattern} 패턴과 일치해야 합니다`:`잘못된 ${n[o.format]??i.format}`}case"not_multiple_of":return`잘못된 숫자: ${i.divisor}의 배수여야 합니다`;case"unrecognized_keys":return`인식할 수 없는 키: ${Te(i.keys,", ")}`;case"invalid_key":return`잘못된 키: ${i.origin}`;case"invalid_union":return"잘못된 입력";case"invalid_element":return`잘못된 값: ${i.origin}`;default:return"잘못된 입력"}}};function wue(){return{localeError:xue()}}const Sue=e=>Rp(typeof e,e),Rp=(e,t=void 0)=>{switch(e){case"number":return Number.isNaN(t)?"NaN":"skaičius";case"bigint":return"sveikasis skaičius";case"string":return"eilutė";case"boolean":return"loginė reikšmė";case"undefined":case"void":return"neapibrėžta reikšmė";case"function":return"funkcija";case"symbol":return"simbolis";case"object":return t===void 0?"nežinomas objektas":t===null?"nulinė reikšmė":Array.isArray(t)?"masyvas":Object.getPrototypeOf(t)!==Object.prototype&&t.constructor?t.constructor.name:"objektas";case"null":return"nulinė reikšmė"}return e},yp=e=>e.charAt(0).toUpperCase()+e.slice(1);function X2(e){const t=Math.abs(e),r=t%10,n=t%100;return n>=11&&n<=19||r===0?"many":r===1?"one":"few"}const kue=()=>{const e={string:{unit:{one:"simbolis",few:"simboliai",many:"simbolių"},verb:{smaller:{inclusive:"turi būti ne ilgesnė kaip",notInclusive:"turi būti trumpesnė kaip"},bigger:{inclusive:"turi būti ne trumpesnė kaip",notInclusive:"turi būti ilgesnė kaip"}}},file:{unit:{one:"baitas",few:"baitai",many:"baitų"},verb:{smaller:{inclusive:"turi būti ne didesnis kaip",notInclusive:"turi būti mažesnis kaip"},bigger:{inclusive:"turi būti ne mažesnis kaip",notInclusive:"turi būti didesnis kaip"}}},array:{unit:{one:"elementą",few:"elementus",many:"elementų"},verb:{smaller:{inclusive:"turi turėti ne daugiau kaip",notInclusive:"turi turėti mažiau kaip"},bigger:{inclusive:"turi turėti ne mažiau kaip",notInclusive:"turi turėti daugiau kaip"}}},set:{unit:{one:"elementą",few:"elementus",many:"elementų"},verb:{smaller:{inclusive:"turi turėti ne daugiau kaip",notInclusive:"turi turėti mažiau kaip"},bigger:{inclusive:"turi turėti ne mažiau kaip",notInclusive:"turi turėti daugiau kaip"}}}};function t(n,i,o,a){const s=e[n]??null;return s===null?s:{unit:s.unit[i],verb:s.verb[a][o?"inclusive":"notInclusive"]}}const r={regex:"įvestis",email:"el. pašto adresas",url:"URL",emoji:"jaustukas",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO data ir laikas",date:"ISO data",time:"ISO laikas",duration:"ISO trukmė",ipv4:"IPv4 adresas",ipv6:"IPv6 adresas",cidrv4:"IPv4 tinklo prefiksas (CIDR)",cidrv6:"IPv6 tinklo prefiksas (CIDR)",base64:"base64 užkoduota eilutė",base64url:"base64url užkoduota eilutė",json_string:"JSON eilutė",e164:"E.164 numeris",jwt:"JWT",template_literal:"įvestis"};return n=>{switch(n.code){case"invalid_type":return`Gautas tipas ${Sue(n.input)}, o tikėtasi - ${Rp(n.expected)}`;case"invalid_value":return n.values.length===1?`Privalo būti ${pt(n.values[0])}`:`Privalo būti vienas iš ${Te(n.values,"|")} pasirinkimų`;case"too_big":{const i=Rp(n.origin),o=t(n.origin,X2(Number(n.maximum)),n.inclusive??!1,"smaller");if(o!=null&&o.verb)return`${yp(i??n.origin??"reikšmė")} ${o.verb} ${n.maximum.toString()} ${o.unit??"elementų"}`;const a=n.inclusive?"ne didesnis kaip":"mažesnis kaip";return`${yp(i??n.origin??"reikšmė")} turi būti ${a} ${n.maximum.toString()} ${o==null?void 0:o.unit}`}case"too_small":{const i=Rp(n.origin),o=t(n.origin,X2(Number(n.minimum)),n.inclusive??!1,"bigger");if(o!=null&&o.verb)return`${yp(i??n.origin??"reikšmė")} ${o.verb} ${n.minimum.toString()} ${o.unit??"elementų"}`;const a=n.inclusive?"ne mažesnis kaip":"didesnis kaip";return`${yp(i??n.origin??"reikšmė")} turi būti ${a} ${n.minimum.toString()} ${o==null?void 0:o.unit}`}case"invalid_format":{const i=n;return i.format==="starts_with"?`Eilutė privalo prasidėti "${i.prefix}"`:i.format==="ends_with"?`Eilutė privalo pasibaigti "${i.suffix}"`:i.format==="includes"?`Eilutė privalo įtraukti "${i.includes}"`:i.format==="regex"?`Eilutė privalo atitikti ${i.pattern}`:`Neteisingas ${r[i.format]??n.format}`}case"not_multiple_of":return`Skaičius privalo būti ${n.divisor} kartotinis.`;case"unrecognized_keys":return`Neatpažint${n.keys.length>1?"i":"as"} rakt${n.keys.length>1?"ai":"as"}: ${Te(n.keys,", ")}`;case"invalid_key":return"Rastas klaidingas raktas";case"invalid_union":return"Klaidinga įvestis";case"invalid_element":{const i=Rp(n.origin);return`${yp(i??n.origin??"reikšmė")} turi klaidingą įvestį`}default:return"Klaidinga įvestis"}}};function Pue(){return{localeError:kue()}}const $ue=()=>{const e={string:{unit:"знаци",verb:"да имаат"},file:{unit:"бајти",verb:"да имаат"},array:{unit:"ставки",verb:"да имаат"},set:{unit:"ставки",verb:"да имаат"}};function t(i){return e[i]??null}const r=i=>{const o=typeof i;switch(o){case"number":return Number.isNaN(i)?"NaN":"број";case"object":{if(Array.isArray(i))return"низа";if(i===null)return"null";if(Object.getPrototypeOf(i)!==Object.prototype&&i.constructor)return i.constructor.name}}return o},n={regex:"внес",email:"адреса на е-пошта",url:"URL",emoji:"емоџи",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO датум и време",date:"ISO датум",time:"ISO време",duration:"ISO времетраење",ipv4:"IPv4 адреса",ipv6:"IPv6 адреса",cidrv4:"IPv4 опсег",cidrv6:"IPv6 опсег",base64:"base64-енкодирана низа",base64url:"base64url-енкодирана низа",json_string:"JSON низа",e164:"E.164 број",jwt:"JWT",template_literal:"внес"};return i=>{switch(i.code){case"invalid_type":return`Грешен внес: се очекува ${i.expected}, примено ${r(i.input)}`;case"invalid_value":return i.values.length===1?`Invalid input: expected ${pt(i.values[0])}`:`Грешана опција: се очекува една ${Te(i.values,"|")}`;case"too_big":{const o=i.inclusive?"<=":"<",a=t(i.origin);return a?`Премногу голем: се очекува ${i.origin??"вредноста"} да има ${o}${i.maximum.toString()} ${a.unit??"елементи"}`:`Премногу голем: се очекува ${i.origin??"вредноста"} да биде ${o}${i.maximum.toString()}`}case"too_small":{const o=i.inclusive?">=":">",a=t(i.origin);return a?`Премногу мал: се очекува ${i.origin} да има ${o}${i.minimum.toString()} ${a.unit}`:`Премногу мал: се очекува ${i.origin} да биде ${o}${i.minimum.toString()}`}case"invalid_format":{const o=i;return o.format==="starts_with"?`Неважечка низа: мора да започнува со "${o.prefix}"`:o.format==="ends_with"?`Неважечка низа: мора да завршува со "${o.suffix}"`:o.format==="includes"?`Неважечка низа: мора да вклучува "${o.includes}"`:o.format==="regex"?`Неважечка низа: мора да одгоара на патернот ${o.pattern}`:`Invalid ${n[o.format]??i.format}`}case"not_multiple_of":return`Грешен број: мора да биде делив со ${i.divisor}`;case"unrecognized_keys":return`${i.keys.length>1?"Непрепознаени клучеви":"Непрепознаен клуч"}: ${Te(i.keys,", ")}`;case"invalid_key":return`Грешен клуч во ${i.origin}`;case"invalid_union":return"Грешен внес";case"invalid_element":return`Грешна вредност во ${i.origin}`;default:return"Грешен внес"}}};function Cue(){return{localeError:$ue()}}const jue=()=>{const e={string:{unit:"aksara",verb:"mempunyai"},file:{unit:"bait",verb:"mempunyai"},array:{unit:"elemen",verb:"mempunyai"},set:{unit:"elemen",verb:"mempunyai"}};function t(i){return e[i]??null}const r=i=>{const o=typeof i;switch(o){case"number":return Number.isNaN(i)?"NaN":"nombor";case"object":{if(Array.isArray(i))return"array";if(i===null)return"null";if(Object.getPrototypeOf(i)!==Object.prototype&&i.constructor)return i.constructor.name}}return o},n={regex:"input",email:"alamat e-mel",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:"tarikh masa ISO",date:"tarikh ISO",time:"masa ISO",duration:"tempoh ISO",ipv4:"alamat IPv4",ipv6:"alamat IPv6",cidrv4:"julat IPv4",cidrv6:"julat IPv6",base64:"string dikodkan base64",base64url:"string dikodkan base64url",json_string:"string JSON",e164:"nombor E.164",jwt:"JWT",template_literal:"input"};return i=>{switch(i.code){case"invalid_type":return`Input tidak sah: dijangka ${i.expected}, diterima ${r(i.input)}`;case"invalid_value":return i.values.length===1?`Input tidak sah: dijangka ${pt(i.values[0])}`:`Pilihan tidak sah: dijangka salah satu daripada ${Te(i.values,"|")}`;case"too_big":{const o=i.inclusive?"<=":"<",a=t(i.origin);return a?`Terlalu besar: dijangka ${i.origin??"nilai"} ${a.verb} ${o}${i.maximum.toString()} ${a.unit??"elemen"}`:`Terlalu besar: dijangka ${i.origin??"nilai"} adalah ${o}${i.maximum.toString()}`}case"too_small":{const o=i.inclusive?">=":">",a=t(i.origin);return a?`Terlalu kecil: dijangka ${i.origin} ${a.verb} ${o}${i.minimum.toString()} ${a.unit}`:`Terlalu kecil: dijangka ${i.origin} adalah ${o}${i.minimum.toString()}`}case"invalid_format":{const o=i;return o.format==="starts_with"?`String tidak sah: mesti bermula dengan "${o.prefix}"`:o.format==="ends_with"?`String tidak sah: mesti berakhir dengan "${o.suffix}"`:o.format==="includes"?`String tidak sah: mesti mengandungi "${o.includes}"`:o.format==="regex"?`String tidak sah: mesti sepadan dengan corak ${o.pattern}`:`${n[o.format]??i.format} tidak sah`}case"not_multiple_of":return`Nombor tidak sah: perlu gandaan ${i.divisor}`;case"unrecognized_keys":return`Kunci tidak dikenali: ${Te(i.keys,", ")}`;case"invalid_key":return`Kunci tidak sah dalam ${i.origin}`;case"invalid_union":return"Input tidak sah";case"invalid_element":return`Nilai tidak sah dalam ${i.origin}`;default:return"Input tidak sah"}}};function Eue(){return{localeError:jue()}}const Iue=()=>{const e={string:{unit:"tekens",verb:"te hebben"},file:{unit:"bytes",verb:"te hebben"},array:{unit:"elementen",verb:"te hebben"},set:{unit:"elementen",verb:"te hebben"}};function t(i){return e[i]??null}const r=i=>{const o=typeof i;switch(o){case"number":return Number.isNaN(i)?"NaN":"getal";case"object":{if(Array.isArray(i))return"array";if(i===null)return"null";if(Object.getPrototypeOf(i)!==Object.prototype&&i.constructor)return i.constructor.name}}return o},n={regex:"invoer",email:"emailadres",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 datum en tijd",date:"ISO datum",time:"ISO tijd",duration:"ISO duur",ipv4:"IPv4-adres",ipv6:"IPv6-adres",cidrv4:"IPv4-bereik",cidrv6:"IPv6-bereik",base64:"base64-gecodeerde tekst",base64url:"base64 URL-gecodeerde tekst",json_string:"JSON string",e164:"E.164-nummer",jwt:"JWT",template_literal:"invoer"};return i=>{switch(i.code){case"invalid_type":return`Ongeldige invoer: verwacht ${i.expected}, ontving ${r(i.input)}`;case"invalid_value":return i.values.length===1?`Ongeldige invoer: verwacht ${pt(i.values[0])}`:`Ongeldige optie: verwacht één van ${Te(i.values,"|")}`;case"too_big":{const o=i.inclusive?"<=":"<",a=t(i.origin);return a?`Te groot: verwacht dat ${i.origin??"waarde"} ${a.verb} ${o}${i.maximum.toString()} ${a.unit??"elementen"}`:`Te groot: verwacht dat ${i.origin??"waarde"} ${o}${i.maximum.toString()} is`}case"too_small":{const o=i.inclusive?">=":">",a=t(i.origin);return a?`Te klein: verwacht dat ${i.origin} ${a.verb} ${o}${i.minimum.toString()} ${a.unit}`:`Te klein: verwacht dat ${i.origin} ${o}${i.minimum.toString()} is`}case"invalid_format":{const o=i;return o.format==="starts_with"?`Ongeldige tekst: moet met "${o.prefix}" beginnen`:o.format==="ends_with"?`Ongeldige tekst: moet op "${o.suffix}" eindigen`:o.format==="includes"?`Ongeldige tekst: moet "${o.includes}" bevatten`:o.format==="regex"?`Ongeldige tekst: moet overeenkomen met patroon ${o.pattern}`:`Ongeldig: ${n[o.format]??i.format}`}case"not_multiple_of":return`Ongeldig getal: moet een veelvoud van ${i.divisor} zijn`;case"unrecognized_keys":return`Onbekende key${i.keys.length>1?"s":""}: ${Te(i.keys,", ")}`;case"invalid_key":return`Ongeldige key in ${i.origin}`;case"invalid_union":return"Ongeldige invoer";case"invalid_element":return`Ongeldige waarde in ${i.origin}`;default:return"Ongeldige invoer"}}};function Oue(){return{localeError:Iue()}}const _ue=()=>{const e={string:{unit:"tegn",verb:"å ha"},file:{unit:"bytes",verb:"å ha"},array:{unit:"elementer",verb:"å inneholde"},set:{unit:"elementer",verb:"å inneholde"}};function t(i){return e[i]??null}const r=i=>{const o=typeof i;switch(o){case"number":return Number.isNaN(i)?"NaN":"tall";case"object":{if(Array.isArray(i))return"liste";if(i===null)return"null";if(Object.getPrototypeOf(i)!==Object.prototype&&i.constructor)return i.constructor.name}}return o},n={regex:"input",email:"e-postadresse",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 dato- og klokkeslett",date:"ISO-dato",time:"ISO-klokkeslett",duration:"ISO-varighet",ipv4:"IPv4-område",ipv6:"IPv6-område",cidrv4:"IPv4-spekter",cidrv6:"IPv6-spekter",base64:"base64-enkodet streng",base64url:"base64url-enkodet streng",json_string:"JSON-streng",e164:"E.164-nummer",jwt:"JWT",template_literal:"input"};return i=>{switch(i.code){case"invalid_type":return`Ugyldig input: forventet ${i.expected}, fikk ${r(i.input)}`;case"invalid_value":return i.values.length===1?`Ugyldig verdi: forventet ${pt(i.values[0])}`:`Ugyldig valg: forventet en av ${Te(i.values,"|")}`;case"too_big":{const o=i.inclusive?"<=":"<",a=t(i.origin);return a?`For stor(t): forventet ${i.origin??"value"} til å ha ${o}${i.maximum.toString()} ${a.unit??"elementer"}`:`For stor(t): forventet ${i.origin??"value"} til å ha ${o}${i.maximum.toString()}`}case"too_small":{const o=i.inclusive?">=":">",a=t(i.origin);return a?`For lite(n): forventet ${i.origin} til å ha ${o}${i.minimum.toString()} ${a.unit}`:`For lite(n): forventet ${i.origin} til å ha ${o}${i.minimum.toString()}`}case"invalid_format":{const o=i;return o.format==="starts_with"?`Ugyldig streng: må starte med "${o.prefix}"`:o.format==="ends_with"?`Ugyldig streng: må ende med "${o.suffix}"`:o.format==="includes"?`Ugyldig streng: må inneholde "${o.includes}"`:o.format==="regex"?`Ugyldig streng: må matche mønsteret ${o.pattern}`:`Ugyldig ${n[o.format]??i.format}`}case"not_multiple_of":return`Ugyldig tall: må være et multiplum av ${i.divisor}`;case"unrecognized_keys":return`${i.keys.length>1?"Ukjente nøkler":"Ukjent nøkkel"}: ${Te(i.keys,", ")}`;case"invalid_key":return`Ugyldig nøkkel i ${i.origin}`;case"invalid_union":return"Ugyldig input";case"invalid_element":return`Ugyldig verdi i ${i.origin}`;default:return"Ugyldig input"}}};function Aue(){return{localeError:_ue()}}const Tue=()=>{const e={string:{unit:"harf",verb:"olmalıdır"},file:{unit:"bayt",verb:"olmalıdır"},array:{unit:"unsur",verb:"olmalıdır"},set:{unit:"unsur",verb:"olmalıdır"}};function t(i){return e[i]??null}const r=i=>{const o=typeof i;switch(o){case"number":return Number.isNaN(i)?"NaN":"numara";case"object":{if(Array.isArray(i))return"saf";if(i===null)return"gayb";if(Object.getPrototypeOf(i)!==Object.prototype&&i.constructor)return i.constructor.name}}return o},n={regex:"giren",email:"epostagâh",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 hengâmı",date:"ISO tarihi",time:"ISO zamanı",duration:"ISO müddeti",ipv4:"IPv4 nişânı",ipv6:"IPv6 nişânı",cidrv4:"IPv4 menzili",cidrv6:"IPv6 menzili",base64:"base64-şifreli metin",base64url:"base64url-şifreli metin",json_string:"JSON metin",e164:"E.164 sayısı",jwt:"JWT",template_literal:"giren"};return i=>{switch(i.code){case"invalid_type":return`Fâsit giren: umulan ${i.expected}, alınan ${r(i.input)}`;case"invalid_value":return i.values.length===1?`Fâsit giren: umulan ${pt(i.values[0])}`:`Fâsit tercih: mûteberler ${Te(i.values,"|")}`;case"too_big":{const o=i.inclusive?"<=":"<",a=t(i.origin);return a?`Fazla büyük: ${i.origin??"value"}, ${o}${i.maximum.toString()} ${a.unit??"elements"} sahip olmalıydı.`:`Fazla büyük: ${i.origin??"value"}, ${o}${i.maximum.toString()} olmalıydı.`}case"too_small":{const o=i.inclusive?">=":">",a=t(i.origin);return a?`Fazla küçük: ${i.origin}, ${o}${i.minimum.toString()} ${a.unit} sahip olmalıydı.`:`Fazla küçük: ${i.origin}, ${o}${i.minimum.toString()} olmalıydı.`}case"invalid_format":{const o=i;return o.format==="starts_with"?`Fâsit metin: "${o.prefix}" ile başlamalı.`:o.format==="ends_with"?`Fâsit metin: "${o.suffix}" ile bitmeli.`:o.format==="includes"?`Fâsit metin: "${o.includes}" ihtivâ etmeli.`:o.format==="regex"?`Fâsit metin: ${o.pattern} nakşına uymalı.`:`Fâsit ${n[o.format]??i.format}`}case"not_multiple_of":return`Fâsit sayı: ${i.divisor} katı olmalıydı.`;case"unrecognized_keys":return`Tanınmayan anahtar ${i.keys.length>1?"s":""}: ${Te(i.keys,", ")}`;case"invalid_key":return`${i.origin} için tanınmayan anahtar var.`;case"invalid_union":return"Giren tanınamadı.";case"invalid_element":return`${i.origin} için tanınmayan kıymet var.`;default:return"Kıymet tanınamadı."}}};function Mue(){return{localeError:Tue()}}const Rue=()=>{const e={string:{unit:"توکي",verb:"ولري"},file:{unit:"بایټس",verb:"ولري"},array:{unit:"توکي",verb:"ولري"},set:{unit:"توکي",verb:"ولري"}};function t(i){return e[i]??null}const r=i=>{const o=typeof i;switch(o){case"number":return Number.isNaN(i)?"NaN":"عدد";case"object":{if(Array.isArray(i))return"ارې";if(i===null)return"null";if(Object.getPrototypeOf(i)!==Object.prototype&&i.constructor)return i.constructor.name}}return o},n={regex:"ورودي",email:"بریښنالیک",url:"یو آر ال",emoji:"ایموجي",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"نیټه او وخت",date:"نېټه",time:"وخت",duration:"موده",ipv4:"د IPv4 پته",ipv6:"د IPv6 پته",cidrv4:"د IPv4 ساحه",cidrv6:"د IPv6 ساحه",base64:"base64-encoded متن",base64url:"base64url-encoded متن",json_string:"JSON متن",e164:"د E.164 شمېره",jwt:"JWT",template_literal:"ورودي"};return i=>{switch(i.code){case"invalid_type":return`ناسم ورودي: باید ${i.expected} وای, مګر ${r(i.input)} ترلاسه شو`;case"invalid_value":return i.values.length===1?`ناسم ورودي: باید ${pt(i.values[0])} وای`:`ناسم انتخاب: باید یو له ${Te(i.values,"|")} څخه وای`;case"too_big":{const o=i.inclusive?"<=":"<",a=t(i.origin);return a?`ډیر لوی: ${i.origin??"ارزښت"} باید ${o}${i.maximum.toString()} ${a.unit??"عنصرونه"} ولري`:`ډیر لوی: ${i.origin??"ارزښت"} باید ${o}${i.maximum.toString()} وي`}case"too_small":{const o=i.inclusive?">=":">",a=t(i.origin);return a?`ډیر کوچنی: ${i.origin} باید ${o}${i.minimum.toString()} ${a.unit} ولري`:`ډیر کوچنی: ${i.origin} باید ${o}${i.minimum.toString()} وي`}case"invalid_format":{const o=i;return o.format==="starts_with"?`ناسم متن: باید د "${o.prefix}" سره پیل شي`:o.format==="ends_with"?`ناسم متن: باید د "${o.suffix}" سره پای ته ورسيږي`:o.format==="includes"?`ناسم متن: باید "${o.includes}" ولري`:o.format==="regex"?`ناسم متن: باید د ${o.pattern} سره مطابقت ولري`:`${n[o.format]??i.format} ناسم دی`}case"not_multiple_of":return`ناسم عدد: باید د ${i.divisor} مضرب وي`;case"unrecognized_keys":return`ناسم ${i.keys.length>1?"کلیډونه":"کلیډ"}: ${Te(i.keys,", ")}`;case"invalid_key":return`ناسم کلیډ په ${i.origin} کې`;case"invalid_union":return"ناسمه ورودي";case"invalid_element":return`ناسم عنصر په ${i.origin} کې`;default:return"ناسمه ورودي"}}};function Due(){return{localeError:Rue()}}const zue=()=>{const e={string:{unit:"znaków",verb:"mieć"},file:{unit:"bajtów",verb:"mieć"},array:{unit:"elementów",verb:"mieć"},set:{unit:"elementów",verb:"mieć"}};function t(i){return e[i]??null}const r=i=>{const o=typeof i;switch(o){case"number":return Number.isNaN(i)?"NaN":"liczba";case"object":{if(Array.isArray(i))return"tablica";if(i===null)return"null";if(Object.getPrototypeOf(i)!==Object.prototype&&i.constructor)return i.constructor.name}}return o},n={regex:"wyrażenie",email:"adres email",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:"data i godzina w formacie ISO",date:"data w formacie ISO",time:"godzina w formacie ISO",duration:"czas trwania ISO",ipv4:"adres IPv4",ipv6:"adres IPv6",cidrv4:"zakres IPv4",cidrv6:"zakres IPv6",base64:"ciąg znaków zakodowany w formacie base64",base64url:"ciąg znaków zakodowany w formacie base64url",json_string:"ciąg znaków w formacie JSON",e164:"liczba E.164",jwt:"JWT",template_literal:"wejście"};return i=>{switch(i.code){case"invalid_type":return`Nieprawidłowe dane wejściowe: oczekiwano ${i.expected}, otrzymano ${r(i.input)}`;case"invalid_value":return i.values.length===1?`Nieprawidłowe dane wejściowe: oczekiwano ${pt(i.values[0])}`:`Nieprawidłowa opcja: oczekiwano jednej z wartości ${Te(i.values,"|")}`;case"too_big":{const o=i.inclusive?"<=":"<",a=t(i.origin);return a?`Za duża wartość: oczekiwano, że ${i.origin??"wartość"} będzie mieć ${o}${i.maximum.toString()} ${a.unit??"elementów"}`:`Zbyt duż(y/a/e): oczekiwano, że ${i.origin??"wartość"} będzie wynosić ${o}${i.maximum.toString()}`}case"too_small":{const o=i.inclusive?">=":">",a=t(i.origin);return a?`Za mała wartość: oczekiwano, że ${i.origin??"wartość"} będzie mieć ${o}${i.minimum.toString()} ${a.unit??"elementów"}`:`Zbyt mał(y/a/e): oczekiwano, że ${i.origin??"wartość"} będzie wynosić ${o}${i.minimum.toString()}`}case"invalid_format":{const o=i;return o.format==="starts_with"?`Nieprawidłowy ciąg znaków: musi zaczynać się od "${o.prefix}"`:o.format==="ends_with"?`Nieprawidłowy ciąg znaków: musi kończyć się na "${o.suffix}"`:o.format==="includes"?`Nieprawidłowy ciąg znaków: musi zawierać "${o.includes}"`:o.format==="regex"?`Nieprawidłowy ciąg znaków: musi odpowiadać wzorcowi ${o.pattern}`:`Nieprawidłow(y/a/e) ${n[o.format]??i.format}`}case"not_multiple_of":return`Nieprawidłowa liczba: musi być wielokrotnością ${i.divisor}`;case"unrecognized_keys":return`Nierozpoznane klucze${i.keys.length>1?"s":""}: ${Te(i.keys,", ")}`;case"invalid_key":return`Nieprawidłowy klucz w ${i.origin}`;case"invalid_union":return"Nieprawidłowe dane wejściowe";case"invalid_element":return`Nieprawidłowa wartość w ${i.origin}`;default:return"Nieprawidłowe dane wejściowe"}}};function Nue(){return{localeError:zue()}}const Lue=()=>{const e={string:{unit:"caracteres",verb:"ter"},file:{unit:"bytes",verb:"ter"},array:{unit:"itens",verb:"ter"},set:{unit:"itens",verb:"ter"}};function t(i){return e[i]??null}const r=i=>{const o=typeof i;switch(o){case"number":return Number.isNaN(i)?"NaN":"número";case"object":{if(Array.isArray(i))return"array";if(i===null)return"nulo";if(Object.getPrototypeOf(i)!==Object.prototype&&i.constructor)return i.constructor.name}}return o},n={regex:"padrão",email:"endereço de e-mail",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:"data e hora ISO",date:"data ISO",time:"hora ISO",duration:"duração ISO",ipv4:"endereço IPv4",ipv6:"endereço IPv6",cidrv4:"faixa de IPv4",cidrv6:"faixa de IPv6",base64:"texto codificado em base64",base64url:"URL codificada em base64",json_string:"texto JSON",e164:"número E.164",jwt:"JWT",template_literal:"entrada"};return i=>{switch(i.code){case"invalid_type":return`Tipo inválido: esperado ${i.expected}, recebido ${r(i.input)}`;case"invalid_value":return i.values.length===1?`Entrada inválida: esperado ${pt(i.values[0])}`:`Opção inválida: esperada uma das ${Te(i.values,"|")}`;case"too_big":{const o=i.inclusive?"<=":"<",a=t(i.origin);return a?`Muito grande: esperado que ${i.origin??"valor"} tivesse ${o}${i.maximum.toString()} ${a.unit??"elementos"}`:`Muito grande: esperado que ${i.origin??"valor"} fosse ${o}${i.maximum.toString()}`}case"too_small":{const o=i.inclusive?">=":">",a=t(i.origin);return a?`Muito pequeno: esperado que ${i.origin} tivesse ${o}${i.minimum.toString()} ${a.unit}`:`Muito pequeno: esperado que ${i.origin} fosse ${o}${i.minimum.toString()}`}case"invalid_format":{const o=i;return o.format==="starts_with"?`Texto inválido: deve começar com "${o.prefix}"`:o.format==="ends_with"?`Texto inválido: deve terminar com "${o.suffix}"`:o.format==="includes"?`Texto inválido: deve incluir "${o.includes}"`:o.format==="regex"?`Texto inválido: deve corresponder ao padrão ${o.pattern}`:`${n[o.format]??i.format} inválido`}case"not_multiple_of":return`Número inválido: deve ser múltiplo de ${i.divisor}`;case"unrecognized_keys":return`Chave${i.keys.length>1?"s":""} desconhecida${i.keys.length>1?"s":""}: ${Te(i.keys,", ")}`;case"invalid_key":return`Chave inválida em ${i.origin}`;case"invalid_union":return"Entrada inválida";case"invalid_element":return`Valor inválido em ${i.origin}`;default:return"Campo inválido"}}};function Bue(){return{localeError:Lue()}}function Y2(e,t,r,n){const i=Math.abs(e),o=i%10,a=i%100;return a>=11&&a<=19?n:o===1?t:o>=2&&o<=4?r:n}const Fue=()=>{const e={string:{unit:{one:"символ",few:"символа",many:"символов"},verb:"иметь"},file:{unit:{one:"байт",few:"байта",many:"байт"},verb:"иметь"},array:{unit:{one:"элемент",few:"элемента",many:"элементов"},verb:"иметь"},set:{unit:{one:"элемент",few:"элемента",many:"элементов"},verb:"иметь"}};function t(i){return e[i]??null}const r=i=>{const o=typeof i;switch(o){case"number":return Number.isNaN(i)?"NaN":"число";case"object":{if(Array.isArray(i))return"массив";if(i===null)return"null";if(Object.getPrototypeOf(i)!==Object.prototype&&i.constructor)return i.constructor.name}}return o},n={regex:"ввод",email:"email адрес",url:"URL",emoji:"эмодзи",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO дата и время",date:"ISO дата",time:"ISO время",duration:"ISO длительность",ipv4:"IPv4 адрес",ipv6:"IPv6 адрес",cidrv4:"IPv4 диапазон",cidrv6:"IPv6 диапазон",base64:"строка в формате base64",base64url:"строка в формате base64url",json_string:"JSON строка",e164:"номер E.164",jwt:"JWT",template_literal:"ввод"};return i=>{switch(i.code){case"invalid_type":return`Неверный ввод: ожидалось ${i.expected}, получено ${r(i.input)}`;case"invalid_value":return i.values.length===1?`Неверный ввод: ожидалось ${pt(i.values[0])}`:`Неверный вариант: ожидалось одно из ${Te(i.values,"|")}`;case"too_big":{const o=i.inclusive?"<=":"<",a=t(i.origin);if(a){const s=Number(i.maximum),u=Y2(s,a.unit.one,a.unit.few,a.unit.many);return`Слишком большое значение: ожидалось, что ${i.origin??"значение"} будет иметь ${o}${i.maximum.toString()} ${u}`}return`Слишком большое значение: ожидалось, что ${i.origin??"значение"} будет ${o}${i.maximum.toString()}`}case"too_small":{const o=i.inclusive?">=":">",a=t(i.origin);if(a){const s=Number(i.minimum),u=Y2(s,a.unit.one,a.unit.few,a.unit.many);return`Слишком маленькое значение: ожидалось, что ${i.origin} будет иметь ${o}${i.minimum.toString()} ${u}`}return`Слишком маленькое значение: ожидалось, что ${i.origin} будет ${o}${i.minimum.toString()}`}case"invalid_format":{const o=i;return o.format==="starts_with"?`Неверная строка: должна начинаться с "${o.prefix}"`:o.format==="ends_with"?`Неверная строка: должна заканчиваться на "${o.suffix}"`:o.format==="includes"?`Неверная строка: должна содержать "${o.includes}"`:o.format==="regex"?`Неверная строка: должна соответствовать шаблону ${o.pattern}`:`Неверный ${n[o.format]??i.format}`}case"not_multiple_of":return`Неверное число: должно быть кратным ${i.divisor}`;case"unrecognized_keys":return`Нераспознанн${i.keys.length>1?"ые":"ый"} ключ${i.keys.length>1?"и":""}: ${Te(i.keys,", ")}`;case"invalid_key":return`Неверный ключ в ${i.origin}`;case"invalid_union":return"Неверные входные данные";case"invalid_element":return`Неверное значение в ${i.origin}`;default:return"Неверные входные данные"}}};function Uue(){return{localeError:Fue()}}const Wue=()=>{const e={string:{unit:"znakov",verb:"imeti"},file:{unit:"bajtov",verb:"imeti"},array:{unit:"elementov",verb:"imeti"},set:{unit:"elementov",verb:"imeti"}};function t(i){return e[i]??null}const r=i=>{const o=typeof i;switch(o){case"number":return Number.isNaN(i)?"NaN":"število";case"object":{if(Array.isArray(i))return"tabela";if(i===null)return"null";if(Object.getPrototypeOf(i)!==Object.prototype&&i.constructor)return i.constructor.name}}return o},n={regex:"vnos",email:"e-poštni naslov",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 datum in čas",date:"ISO datum",time:"ISO čas",duration:"ISO trajanje",ipv4:"IPv4 naslov",ipv6:"IPv6 naslov",cidrv4:"obseg IPv4",cidrv6:"obseg IPv6",base64:"base64 kodiran niz",base64url:"base64url kodiran niz",json_string:"JSON niz",e164:"E.164 številka",jwt:"JWT",template_literal:"vnos"};return i=>{switch(i.code){case"invalid_type":return`Neveljaven vnos: pričakovano ${i.expected}, prejeto ${r(i.input)}`;case"invalid_value":return i.values.length===1?`Neveljaven vnos: pričakovano ${pt(i.values[0])}`:`Neveljavna možnost: pričakovano eno izmed ${Te(i.values,"|")}`;case"too_big":{const o=i.inclusive?"<=":"<",a=t(i.origin);return a?`Preveliko: pričakovano, da bo ${i.origin??"vrednost"} imelo ${o}${i.maximum.toString()} ${a.unit??"elementov"}`:`Preveliko: pričakovano, da bo ${i.origin??"vrednost"} ${o}${i.maximum.toString()}`}case"too_small":{const o=i.inclusive?">=":">",a=t(i.origin);return a?`Premajhno: pričakovano, da bo ${i.origin} imelo ${o}${i.minimum.toString()} ${a.unit}`:`Premajhno: pričakovano, da bo ${i.origin} ${o}${i.minimum.toString()}`}case"invalid_format":{const o=i;return o.format==="starts_with"?`Neveljaven niz: mora se začeti z "${o.prefix}"`:o.format==="ends_with"?`Neveljaven niz: mora se končati z "${o.suffix}"`:o.format==="includes"?`Neveljaven niz: mora vsebovati "${o.includes}"`:o.format==="regex"?`Neveljaven niz: mora ustrezati vzorcu ${o.pattern}`:`Neveljaven ${n[o.format]??i.format}`}case"not_multiple_of":return`Neveljavno število: mora biti večkratnik ${i.divisor}`;case"unrecognized_keys":return`Neprepoznan${i.keys.length>1?"i ključi":" ključ"}: ${Te(i.keys,", ")}`;case"invalid_key":return`Neveljaven ključ v ${i.origin}`;case"invalid_union":return"Neveljaven vnos";case"invalid_element":return`Neveljavna vrednost v ${i.origin}`;default:return"Neveljaven vnos"}}};function Kue(){return{localeError:Wue()}}const Hue=()=>{const e={string:{unit:"tecken",verb:"att ha"},file:{unit:"bytes",verb:"att ha"},array:{unit:"objekt",verb:"att innehålla"},set:{unit:"objekt",verb:"att innehålla"}};function t(i){return e[i]??null}const r=i=>{const o=typeof i;switch(o){case"number":return Number.isNaN(i)?"NaN":"antal";case"object":{if(Array.isArray(i))return"lista";if(i===null)return"null";if(Object.getPrototypeOf(i)!==Object.prototype&&i.constructor)return i.constructor.name}}return o},n={regex:"reguljärt uttryck",email:"e-postadress",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-datum och tid",date:"ISO-datum",time:"ISO-tid",duration:"ISO-varaktighet",ipv4:"IPv4-intervall",ipv6:"IPv6-intervall",cidrv4:"IPv4-spektrum",cidrv6:"IPv6-spektrum",base64:"base64-kodad sträng",base64url:"base64url-kodad sträng",json_string:"JSON-sträng",e164:"E.164-nummer",jwt:"JWT",template_literal:"mall-literal"};return i=>{switch(i.code){case"invalid_type":return`Ogiltig inmatning: förväntat ${i.expected}, fick ${r(i.input)}`;case"invalid_value":return i.values.length===1?`Ogiltig inmatning: förväntat ${pt(i.values[0])}`:`Ogiltigt val: förväntade en av ${Te(i.values,"|")}`;case"too_big":{const o=i.inclusive?"<=":"<",a=t(i.origin);return a?`För stor(t): förväntade ${i.origin??"värdet"} att ha ${o}${i.maximum.toString()} ${a.unit??"element"}`:`För stor(t): förväntat ${i.origin??"värdet"} att ha ${o}${i.maximum.toString()}`}case"too_small":{const o=i.inclusive?">=":">",a=t(i.origin);return a?`För lite(t): förväntade ${i.origin??"värdet"} att ha ${o}${i.minimum.toString()} ${a.unit}`:`För lite(t): förväntade ${i.origin??"värdet"} att ha ${o}${i.minimum.toString()}`}case"invalid_format":{const o=i;return o.format==="starts_with"?`Ogiltig sträng: måste börja med "${o.prefix}"`:o.format==="ends_with"?`Ogiltig sträng: måste sluta med "${o.suffix}"`:o.format==="includes"?`Ogiltig sträng: måste innehålla "${o.includes}"`:o.format==="regex"?`Ogiltig sträng: måste matcha mönstret "${o.pattern}"`:`Ogiltig(t) ${n[o.format]??i.format}`}case"not_multiple_of":return`Ogiltigt tal: måste vara en multipel av ${i.divisor}`;case"unrecognized_keys":return`${i.keys.length>1?"Okända nycklar":"Okänd nyckel"}: ${Te(i.keys,", ")}`;case"invalid_key":return`Ogiltig nyckel i ${i.origin??"värdet"}`;case"invalid_union":return"Ogiltig input";case"invalid_element":return`Ogiltigt värde i ${i.origin??"värdet"}`;default:return"Ogiltig input"}}};function Vue(){return{localeError:Hue()}}const que=()=>{const e={string:{unit:"எழுத்துக்கள்",verb:"கொண்டிருக்க வேண்டும்"},file:{unit:"பைட்டுகள்",verb:"கொண்டிருக்க வேண்டும்"},array:{unit:"உறுப்புகள்",verb:"கொண்டிருக்க வேண்டும்"},set:{unit:"உறுப்புகள்",verb:"கொண்டிருக்க வேண்டும்"}};function t(i){return e[i]??null}const r=i=>{const o=typeof i;switch(o){case"number":return Number.isNaN(i)?"எண் அல்லாதது":"எண்";case"object":{if(Array.isArray(i))return"அணி";if(i===null)return"வெறுமை";if(Object.getPrototypeOf(i)!==Object.prototype&&i.constructor)return i.constructor.name}}return o},n={regex:"உள்ளீடு",email:"மின்னஞ்சல் முகவரி",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 தேதி நேரம்",date:"ISO தேதி",time:"ISO நேரம்",duration:"ISO கால அளவு",ipv4:"IPv4 முகவரி",ipv6:"IPv6 முகவரி",cidrv4:"IPv4 வரம்பு",cidrv6:"IPv6 வரம்பு",base64:"base64-encoded சரம்",base64url:"base64url-encoded சரம்",json_string:"JSON சரம்",e164:"E.164 எண்",jwt:"JWT",template_literal:"input"};return i=>{switch(i.code){case"invalid_type":return`தவறான உள்ளீடு: எதிர்பார்க்கப்பட்டது ${i.expected}, பெறப்பட்டது ${r(i.input)}`;case"invalid_value":return i.values.length===1?`தவறான உள்ளீடு: எதிர்பார்க்கப்பட்டது ${pt(i.values[0])}`:`தவறான விருப்பம்: எதிர்பார்க்கப்பட்டது ${Te(i.values,"|")} இல் ஒன்று`;case"too_big":{const o=i.inclusive?"<=":"<",a=t(i.origin);return a?`மிக பெரியது: எதிர்பார்க்கப்பட்டது ${i.origin??"மதிப்பு"} ${o}${i.maximum.toString()} ${a.unit??"உறுப்புகள்"} ஆக இருக்க வேண்டும்`:`மிக பெரியது: எதிர்பார்க்கப்பட்டது ${i.origin??"மதிப்பு"} ${o}${i.maximum.toString()} ஆக இருக்க வேண்டும்`}case"too_small":{const o=i.inclusive?">=":">",a=t(i.origin);return a?`மிகச் சிறியது: எதிர்பார்க்கப்பட்டது ${i.origin} ${o}${i.minimum.toString()} ${a.unit} ஆக இருக்க வேண்டும்`:`மிகச் சிறியது: எதிர்பார்க்கப்பட்டது ${i.origin} ${o}${i.minimum.toString()} ஆக இருக்க வேண்டும்`}case"invalid_format":{const o=i;return o.format==="starts_with"?`தவறான சரம்: "${o.prefix}" இல் தொடங்க வேண்டும்`:o.format==="ends_with"?`தவறான சரம்: "${o.suffix}" இல் முடிவடைய வேண்டும்`:o.format==="includes"?`தவறான சரம்: "${o.includes}" ஐ உள்ளடக்க வேண்டும்`:o.format==="regex"?`தவறான சரம்: ${o.pattern} முறைபாட்டுடன் பொருந்த வேண்டும்`:`தவறான ${n[o.format]??i.format}`}case"not_multiple_of":return`தவறான எண்: ${i.divisor} இன் பலமாக இருக்க வேண்டும்`;case"unrecognized_keys":return`அடையாளம் தெரியாத விசை${i.keys.length>1?"கள்":""}: ${Te(i.keys,", ")}`;case"invalid_key":return`${i.origin} இல் தவறான விசை`;case"invalid_union":return"தவறான உள்ளீடு";case"invalid_element":return`${i.origin} இல் தவறான மதிப்பு`;default:return"தவறான உள்ளீடு"}}};function Gue(){return{localeError:que()}}const Zue=()=>{const e={string:{unit:"ตัวอักษร",verb:"ควรมี"},file:{unit:"ไบต์",verb:"ควรมี"},array:{unit:"รายการ",verb:"ควรมี"},set:{unit:"รายการ",verb:"ควรมี"}};function t(i){return e[i]??null}const r=i=>{const o=typeof i;switch(o){case"number":return Number.isNaN(i)?"ไม่ใช่ตัวเลข (NaN)":"ตัวเลข";case"object":{if(Array.isArray(i))return"อาร์เรย์ (Array)";if(i===null)return"ไม่มีค่า (null)";if(Object.getPrototypeOf(i)!==Object.prototype&&i.constructor)return i.constructor.name}}return o},n={regex:"ข้อมูลที่ป้อน",email:"ที่อยู่อีเมล",url:"URL",emoji:"อิโมจิ",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"วันที่เวลาแบบ ISO",date:"วันที่แบบ ISO",time:"เวลาแบบ ISO",duration:"ช่วงเวลาแบบ ISO",ipv4:"ที่อยู่ IPv4",ipv6:"ที่อยู่ IPv6",cidrv4:"ช่วง IP แบบ IPv4",cidrv6:"ช่วง IP แบบ IPv6",base64:"ข้อความแบบ Base64",base64url:"ข้อความแบบ Base64 สำหรับ URL",json_string:"ข้อความแบบ JSON",e164:"เบอร์โทรศัพท์ระหว่างประเทศ (E.164)",jwt:"โทเคน JWT",template_literal:"ข้อมูลที่ป้อน"};return i=>{switch(i.code){case"invalid_type":return`ประเภทข้อมูลไม่ถูกต้อง: ควรเป็น ${i.expected} แต่ได้รับ ${r(i.input)}`;case"invalid_value":return i.values.length===1?`ค่าไม่ถูกต้อง: ควรเป็น ${pt(i.values[0])}`:`ตัวเลือกไม่ถูกต้อง: ควรเป็นหนึ่งใน ${Te(i.values,"|")}`;case"too_big":{const o=i.inclusive?"ไม่เกิน":"น้อยกว่า",a=t(i.origin);return a?`เกินกำหนด: ${i.origin??"ค่า"} ควรมี${o} ${i.maximum.toString()} ${a.unit??"รายการ"}`:`เกินกำหนด: ${i.origin??"ค่า"} ควรมี${o} ${i.maximum.toString()}`}case"too_small":{const o=i.inclusive?"อย่างน้อย":"มากกว่า",a=t(i.origin);return a?`น้อยกว่ากำหนด: ${i.origin} ควรมี${o} ${i.minimum.toString()} ${a.unit}`:`น้อยกว่ากำหนด: ${i.origin} ควรมี${o} ${i.minimum.toString()}`}case"invalid_format":{const o=i;return o.format==="starts_with"?`รูปแบบไม่ถูกต้อง: ข้อความต้องขึ้นต้นด้วย "${o.prefix}"`:o.format==="ends_with"?`รูปแบบไม่ถูกต้อง: ข้อความต้องลงท้ายด้วย "${o.suffix}"`:o.format==="includes"?`รูปแบบไม่ถูกต้อง: ข้อความต้องมี "${o.includes}" อยู่ในข้อความ`:o.format==="regex"?`รูปแบบไม่ถูกต้อง: ต้องตรงกับรูปแบบที่กำหนด ${o.pattern}`:`รูปแบบไม่ถูกต้อง: ${n[o.format]??i.format}`}case"not_multiple_of":return`ตัวเลขไม่ถูกต้อง: ต้องเป็นจำนวนที่หารด้วย ${i.divisor} ได้ลงตัว`;case"unrecognized_keys":return`พบคีย์ที่ไม่รู้จัก: ${Te(i.keys,", ")}`;case"invalid_key":return`คีย์ไม่ถูกต้องใน ${i.origin}`;case"invalid_union":return"ข้อมูลไม่ถูกต้อง: ไม่ตรงกับรูปแบบยูเนียนที่กำหนดไว้";case"invalid_element":return`ข้อมูลไม่ถูกต้องใน ${i.origin}`;default:return"ข้อมูลไม่ถูกต้อง"}}};function Xue(){return{localeError:Zue()}}const Yue=e=>{const t=typeof e;switch(t){case"number":return Number.isNaN(e)?"NaN":"number";case"object":{if(Array.isArray(e))return"array";if(e===null)return"null";if(Object.getPrototypeOf(e)!==Object.prototype&&e.constructor)return e.constructor.name}}return t},Que=()=>{const e={string:{unit:"karakter",verb:"olmalı"},file:{unit:"bayt",verb:"olmalı"},array:{unit:"öğe",verb:"olmalı"},set:{unit:"öğe",verb:"olmalı"}};function t(n){return e[n]??null}const r={regex:"girdi",email:"e-posta adresi",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 tarih ve saat",date:"ISO tarih",time:"ISO saat",duration:"ISO süre",ipv4:"IPv4 adresi",ipv6:"IPv6 adresi",cidrv4:"IPv4 aralığı",cidrv6:"IPv6 aralığı",base64:"base64 ile şifrelenmiş metin",base64url:"base64url ile şifrelenmiş metin",json_string:"JSON dizesi",e164:"E.164 sayısı",jwt:"JWT",template_literal:"Şablon dizesi"};return n=>{switch(n.code){case"invalid_type":return`Geçersiz değer: beklenen ${n.expected}, alınan ${Yue(n.input)}`;case"invalid_value":return n.values.length===1?`Geçersiz değer: beklenen ${pt(n.values[0])}`:`Geçersiz seçenek: aşağıdakilerden biri olmalı: ${Te(n.values,"|")}`;case"too_big":{const i=n.inclusive?"<=":"<",o=t(n.origin);return o?`Çok büyük: beklenen ${n.origin??"değer"} ${i}${n.maximum.toString()} ${o.unit??"öğe"}`:`Çok büyük: beklenen ${n.origin??"değer"} ${i}${n.maximum.toString()}`}case"too_small":{const i=n.inclusive?">=":">",o=t(n.origin);return o?`Çok küçük: beklenen ${n.origin} ${i}${n.minimum.toString()} ${o.unit}`:`Çok küçük: beklenen ${n.origin} ${i}${n.minimum.toString()}`}case"invalid_format":{const i=n;return i.format==="starts_with"?`Geçersiz metin: "${i.prefix}" ile başlamalı`:i.format==="ends_with"?`Geçersiz metin: "${i.suffix}" ile bitmeli`:i.format==="includes"?`Geçersiz metin: "${i.includes}" içermeli`:i.format==="regex"?`Geçersiz metin: ${i.pattern} desenine uymalı`:`Geçersiz ${r[i.format]??n.format}`}case"not_multiple_of":return`Geçersiz sayı: ${n.divisor} ile tam bölünebilmeli`;case"unrecognized_keys":return`Tanınmayan anahtar${n.keys.length>1?"lar":""}: ${Te(n.keys,", ")}`;case"invalid_key":return`${n.origin} içinde geçersiz anahtar`;case"invalid_union":return"Geçersiz değer";case"invalid_element":return`${n.origin} içinde geçersiz değer`;default:return"Geçersiz değer"}}};function Jue(){return{localeError:Que()}}const ece=()=>{const e={string:{unit:"символів",verb:"матиме"},file:{unit:"байтів",verb:"матиме"},array:{unit:"елементів",verb:"матиме"},set:{unit:"елементів",verb:"матиме"}};function t(i){return e[i]??null}const r=i=>{const o=typeof i;switch(o){case"number":return Number.isNaN(i)?"NaN":"число";case"object":{if(Array.isArray(i))return"масив";if(i===null)return"null";if(Object.getPrototypeOf(i)!==Object.prototype&&i.constructor)return i.constructor.name}}return o},n={regex:"вхідні дані",email:"адреса електронної пошти",url:"URL",emoji:"емодзі",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"дата та час ISO",date:"дата ISO",time:"час ISO",duration:"тривалість ISO",ipv4:"адреса IPv4",ipv6:"адреса IPv6",cidrv4:"діапазон IPv4",cidrv6:"діапазон IPv6",base64:"рядок у кодуванні base64",base64url:"рядок у кодуванні base64url",json_string:"рядок JSON",e164:"номер E.164",jwt:"JWT",template_literal:"вхідні дані"};return i=>{switch(i.code){case"invalid_type":return`Неправильні вхідні дані: очікується ${i.expected}, отримано ${r(i.input)}`;case"invalid_value":return i.values.length===1?`Неправильні вхідні дані: очікується ${pt(i.values[0])}`:`Неправильна опція: очікується одне з ${Te(i.values,"|")}`;case"too_big":{const o=i.inclusive?"<=":"<",a=t(i.origin);return a?`Занадто велике: очікується, що ${i.origin??"значення"} ${a.verb} ${o}${i.maximum.toString()} ${a.unit??"елементів"}`:`Занадто велике: очікується, що ${i.origin??"значення"} буде ${o}${i.maximum.toString()}`}case"too_small":{const o=i.inclusive?">=":">",a=t(i.origin);return a?`Занадто мале: очікується, що ${i.origin} ${a.verb} ${o}${i.minimum.toString()} ${a.unit}`:`Занадто мале: очікується, що ${i.origin} буде ${o}${i.minimum.toString()}`}case"invalid_format":{const o=i;return o.format==="starts_with"?`Неправильний рядок: повинен починатися з "${o.prefix}"`:o.format==="ends_with"?`Неправильний рядок: повинен закінчуватися на "${o.suffix}"`:o.format==="includes"?`Неправильний рядок: повинен містити "${o.includes}"`:o.format==="regex"?`Неправильний рядок: повинен відповідати шаблону ${o.pattern}`:`Неправильний ${n[o.format]??i.format}`}case"not_multiple_of":return`Неправильне число: повинно бути кратним ${i.divisor}`;case"unrecognized_keys":return`Нерозпізнаний ключ${i.keys.length>1?"і":""}: ${Te(i.keys,", ")}`;case"invalid_key":return`Неправильний ключ у ${i.origin}`;case"invalid_union":return"Неправильні вхідні дані";case"invalid_element":return`Неправильне значення у ${i.origin}`;default:return"Неправильні вхідні дані"}}};function dF(){return{localeError:ece()}}function tce(){return dF()}const rce=()=>{const e={string:{unit:"حروف",verb:"ہونا"},file:{unit:"بائٹس",verb:"ہونا"},array:{unit:"آئٹمز",verb:"ہونا"},set:{unit:"آئٹمز",verb:"ہونا"}};function t(i){return e[i]??null}const r=i=>{const o=typeof i;switch(o){case"number":return Number.isNaN(i)?"NaN":"نمبر";case"object":{if(Array.isArray(i))return"آرے";if(i===null)return"نل";if(Object.getPrototypeOf(i)!==Object.prototype&&i.constructor)return i.constructor.name}}return o},n={regex:"ان پٹ",email:"ای میل ایڈریس",url:"یو آر ایل",emoji:"ایموجی",uuid:"یو یو آئی ڈی",uuidv4:"یو یو آئی ڈی وی 4",uuidv6:"یو یو آئی ڈی وی 6",nanoid:"نینو آئی ڈی",guid:"جی یو آئی ڈی",cuid:"سی یو آئی ڈی",cuid2:"سی یو آئی ڈی 2",ulid:"یو ایل آئی ڈی",xid:"ایکس آئی ڈی",ksuid:"کے ایس یو آئی ڈی",datetime:"آئی ایس او ڈیٹ ٹائم",date:"آئی ایس او تاریخ",time:"آئی ایس او وقت",duration:"آئی ایس او مدت",ipv4:"آئی پی وی 4 ایڈریس",ipv6:"آئی پی وی 6 ایڈریس",cidrv4:"آئی پی وی 4 رینج",cidrv6:"آئی پی وی 6 رینج",base64:"بیس 64 ان کوڈڈ سٹرنگ",base64url:"بیس 64 یو آر ایل ان کوڈڈ سٹرنگ",json_string:"جے ایس او این سٹرنگ",e164:"ای 164 نمبر",jwt:"جے ڈبلیو ٹی",template_literal:"ان پٹ"};return i=>{switch(i.code){case"invalid_type":return`غلط ان پٹ: ${i.expected} متوقع تھا، ${r(i.input)} موصول ہوا`;case"invalid_value":return i.values.length===1?`غلط ان پٹ: ${pt(i.values[0])} متوقع تھا`:`غلط آپشن: ${Te(i.values,"|")} میں سے ایک متوقع تھا`;case"too_big":{const o=i.inclusive?"<=":"<",a=t(i.origin);return a?`بہت بڑا: ${i.origin??"ویلیو"} کے ${o}${i.maximum.toString()} ${a.unit??"عناصر"} ہونے متوقع تھے`:`بہت بڑا: ${i.origin??"ویلیو"} کا ${o}${i.maximum.toString()} ہونا متوقع تھا`}case"too_small":{const o=i.inclusive?">=":">",a=t(i.origin);return a?`بہت چھوٹا: ${i.origin} کے ${o}${i.minimum.toString()} ${a.unit} ہونے متوقع تھے`:`بہت چھوٹا: ${i.origin} کا ${o}${i.minimum.toString()} ہونا متوقع تھا`}case"invalid_format":{const o=i;return o.format==="starts_with"?`غلط سٹرنگ: "${o.prefix}" سے شروع ہونا چاہیے`:o.format==="ends_with"?`غلط سٹرنگ: "${o.suffix}" پر ختم ہونا چاہیے`:o.format==="includes"?`غلط سٹرنگ: "${o.includes}" شامل ہونا چاہیے`:o.format==="regex"?`غلط سٹرنگ: پیٹرن ${o.pattern} سے میچ ہونا چاہیے`:`غلط ${n[o.format]??i.format}`}case"not_multiple_of":return`غلط نمبر: ${i.divisor} کا مضاعف ہونا چاہیے`;case"unrecognized_keys":return`غیر تسلیم شدہ کی${i.keys.length>1?"ز":""}: ${Te(i.keys,"، ")}`;case"invalid_key":return`${i.origin} میں غلط کی`;case"invalid_union":return"غلط ان پٹ";case"invalid_element":return`${i.origin} میں غلط ویلیو`;default:return"غلط ان پٹ"}}};function nce(){return{localeError:rce()}}const ice=()=>{const e={string:{unit:"ký tự",verb:"có"},file:{unit:"byte",verb:"có"},array:{unit:"phần tử",verb:"có"},set:{unit:"phần tử",verb:"có"}};function t(i){return e[i]??null}const r=i=>{const o=typeof i;switch(o){case"number":return Number.isNaN(i)?"NaN":"số";case"object":{if(Array.isArray(i))return"mảng";if(i===null)return"null";if(Object.getPrototypeOf(i)!==Object.prototype&&i.constructor)return i.constructor.name}}return o},n={regex:"đầu vào",email:"địa chỉ email",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:"ngày giờ ISO",date:"ngày ISO",time:"giờ ISO",duration:"khoảng thời gian ISO",ipv4:"địa chỉ IPv4",ipv6:"địa chỉ IPv6",cidrv4:"dải IPv4",cidrv6:"dải IPv6",base64:"chuỗi mã hóa base64",base64url:"chuỗi mã hóa base64url",json_string:"chuỗi JSON",e164:"số E.164",jwt:"JWT",template_literal:"đầu vào"};return i=>{switch(i.code){case"invalid_type":return`Đầu vào không hợp lệ: mong đợi ${i.expected}, nhận được ${r(i.input)}`;case"invalid_value":return i.values.length===1?`Đầu vào không hợp lệ: mong đợi ${pt(i.values[0])}`:`Tùy chọn không hợp lệ: mong đợi một trong các giá trị ${Te(i.values,"|")}`;case"too_big":{const o=i.inclusive?"<=":"<",a=t(i.origin);return a?`Quá lớn: mong đợi ${i.origin??"giá trị"} ${a.verb} ${o}${i.maximum.toString()} ${a.unit??"phần tử"}`:`Quá lớn: mong đợi ${i.origin??"giá trị"} ${o}${i.maximum.toString()}`}case"too_small":{const o=i.inclusive?">=":">",a=t(i.origin);return a?`Quá nhỏ: mong đợi ${i.origin} ${a.verb} ${o}${i.minimum.toString()} ${a.unit}`:`Quá nhỏ: mong đợi ${i.origin} ${o}${i.minimum.toString()}`}case"invalid_format":{const o=i;return o.format==="starts_with"?`Chuỗi không hợp lệ: phải bắt đầu bằng "${o.prefix}"`:o.format==="ends_with"?`Chuỗi không hợp lệ: phải kết thúc bằng "${o.suffix}"`:o.format==="includes"?`Chuỗi không hợp lệ: phải bao gồm "${o.includes}"`:o.format==="regex"?`Chuỗi không hợp lệ: phải khớp với mẫu ${o.pattern}`:`${n[o.format]??i.format} không hợp lệ`}case"not_multiple_of":return`Số không hợp lệ: phải là bội số của ${i.divisor}`;case"unrecognized_keys":return`Khóa không được nhận dạng: ${Te(i.keys,", ")}`;case"invalid_key":return`Khóa không hợp lệ trong ${i.origin}`;case"invalid_union":return"Đầu vào không hợp lệ";case"invalid_element":return`Giá trị không hợp lệ trong ${i.origin}`;default:return"Đầu vào không hợp lệ"}}};function oce(){return{localeError:ice()}}const ace=()=>{const e={string:{unit:"字符",verb:"包含"},file:{unit:"字节",verb:"包含"},array:{unit:"项",verb:"包含"},set:{unit:"项",verb:"包含"}};function t(i){return e[i]??null}const r=i=>{const o=typeof i;switch(o){case"number":return Number.isNaN(i)?"非数字(NaN)":"数字";case"object":{if(Array.isArray(i))return"数组";if(i===null)return"空值(null)";if(Object.getPrototypeOf(i)!==Object.prototype&&i.constructor)return i.constructor.name}}return o},n={regex:"输入",email:"电子邮件",url:"URL",emoji:"表情符号",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO日期时间",date:"ISO日期",time:"ISO时间",duration:"ISO时长",ipv4:"IPv4地址",ipv6:"IPv6地址",cidrv4:"IPv4网段",cidrv6:"IPv6网段",base64:"base64编码字符串",base64url:"base64url编码字符串",json_string:"JSON字符串",e164:"E.164号码",jwt:"JWT",template_literal:"输入"};return i=>{switch(i.code){case"invalid_type":return`无效输入:期望 ${i.expected},实际接收 ${r(i.input)}`;case"invalid_value":return i.values.length===1?`无效输入:期望 ${pt(i.values[0])}`:`无效选项:期望以下之一 ${Te(i.values,"|")}`;case"too_big":{const o=i.inclusive?"<=":"<",a=t(i.origin);return a?`数值过大:期望 ${i.origin??"值"} ${o}${i.maximum.toString()} ${a.unit??"个元素"}`:`数值过大:期望 ${i.origin??"值"} ${o}${i.maximum.toString()}`}case"too_small":{const o=i.inclusive?">=":">",a=t(i.origin);return a?`数值过小:期望 ${i.origin} ${o}${i.minimum.toString()} ${a.unit}`:`数值过小:期望 ${i.origin} ${o}${i.minimum.toString()}`}case"invalid_format":{const o=i;return o.format==="starts_with"?`无效字符串:必须以 "${o.prefix}" 开头`:o.format==="ends_with"?`无效字符串:必须以 "${o.suffix}" 结尾`:o.format==="includes"?`无效字符串:必须包含 "${o.includes}"`:o.format==="regex"?`无效字符串:必须满足正则表达式 ${o.pattern}`:`无效${n[o.format]??i.format}`}case"not_multiple_of":return`无效数字:必须是 ${i.divisor} 的倍数`;case"unrecognized_keys":return`出现未知的键(key): ${Te(i.keys,", ")}`;case"invalid_key":return`${i.origin} 中的键(key)无效`;case"invalid_union":return"无效输入";case"invalid_element":return`${i.origin} 中包含无效值(value)`;default:return"无效输入"}}};function sce(){return{localeError:ace()}}const lce=()=>{const e={string:{unit:"字元",verb:"擁有"},file:{unit:"位元組",verb:"擁有"},array:{unit:"項目",verb:"擁有"},set:{unit:"項目",verb:"擁有"}};function t(i){return e[i]??null}const r=i=>{const o=typeof i;switch(o){case"number":return Number.isNaN(i)?"NaN":"number";case"object":{if(Array.isArray(i))return"array";if(i===null)return"null";if(Object.getPrototypeOf(i)!==Object.prototype&&i.constructor)return i.constructor.name}}return o},n={regex:"輸入",email:"郵件地址",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 日期時間",date:"ISO 日期",time:"ISO 時間",duration:"ISO 期間",ipv4:"IPv4 位址",ipv6:"IPv6 位址",cidrv4:"IPv4 範圍",cidrv6:"IPv6 範圍",base64:"base64 編碼字串",base64url:"base64url 編碼字串",json_string:"JSON 字串",e164:"E.164 數值",jwt:"JWT",template_literal:"輸入"};return i=>{switch(i.code){case"invalid_type":return`無效的輸入值:預期為 ${i.expected},但收到 ${r(i.input)}`;case"invalid_value":return i.values.length===1?`無效的輸入值:預期為 ${pt(i.values[0])}`:`無效的選項:預期為以下其中之一 ${Te(i.values,"|")}`;case"too_big":{const o=i.inclusive?"<=":"<",a=t(i.origin);return a?`數值過大:預期 ${i.origin??"值"} 應為 ${o}${i.maximum.toString()} ${a.unit??"個元素"}`:`數值過大:預期 ${i.origin??"值"} 應為 ${o}${i.maximum.toString()}`}case"too_small":{const o=i.inclusive?">=":">",a=t(i.origin);return a?`數值過小:預期 ${i.origin} 應為 ${o}${i.minimum.toString()} ${a.unit}`:`數值過小:預期 ${i.origin} 應為 ${o}${i.minimum.toString()}`}case"invalid_format":{const o=i;return o.format==="starts_with"?`無效的字串:必須以 "${o.prefix}" 開頭`:o.format==="ends_with"?`無效的字串:必須以 "${o.suffix}" 結尾`:o.format==="includes"?`無效的字串:必須包含 "${o.includes}"`:o.format==="regex"?`無效的字串:必須符合格式 ${o.pattern}`:`無效的 ${n[o.format]??i.format}`}case"not_multiple_of":return`無效的數字:必須為 ${i.divisor} 的倍數`;case"unrecognized_keys":return`無法識別的鍵值${i.keys.length>1?"們":""}:${Te(i.keys,"、")}`;case"invalid_key":return`${i.origin} 中有無效的鍵值`;case"invalid_union":return"無效的輸入值";case"invalid_element":return`${i.origin} 中有無效的值`;default:return"無效的輸入值"}}};function uce(){return{localeError:lce()}}const cce=()=>{const e={string:{unit:"àmi",verb:"ní"},file:{unit:"bytes",verb:"ní"},array:{unit:"nkan",verb:"ní"},set:{unit:"nkan",verb:"ní"}};function t(i){return e[i]??null}const r=i=>{const o=typeof i;switch(o){case"number":return Number.isNaN(i)?"NaN":"nọ́mbà";case"object":{if(Array.isArray(i))return"akopọ";if(i===null)return"null";if(Object.getPrototypeOf(i)!==Object.prototype&&i.constructor)return i.constructor.name}}return o},n={regex:"ẹ̀rọ ìbáwọlé",email:"àdírẹ́sì ìmẹ́lì",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:"àkókò ISO",date:"ọjọ́ ISO",time:"àkókò ISO",duration:"àkókò tó pé ISO",ipv4:"àdírẹ́sì IPv4",ipv6:"àdírẹ́sì IPv6",cidrv4:"àgbègbè IPv4",cidrv6:"àgbègbè IPv6",base64:"ọ̀rọ̀ tí a kọ́ ní base64",base64url:"ọ̀rọ̀ base64url",json_string:"ọ̀rọ̀ JSON",e164:"nọ́mbà E.164",jwt:"JWT",template_literal:"ẹ̀rọ ìbáwọlé"};return i=>{switch(i.code){case"invalid_type":return`Ìbáwọlé aṣìṣe: a ní láti fi ${i.expected}, àmọ̀ a rí ${r(i.input)}`;case"invalid_value":return i.values.length===1?`Ìbáwọlé aṣìṣe: a ní láti fi ${pt(i.values[0])}`:`Àṣàyàn aṣìṣe: yan ọ̀kan lára ${Te(i.values,"|")}`;case"too_big":{const o=i.inclusive?"<=":"<",a=t(i.origin);return a?`Tó pọ̀ jù: a ní láti jẹ́ pé ${i.origin??"iye"} ${a.verb} ${o}${i.maximum} ${a.unit}`:`Tó pọ̀ jù: a ní láti jẹ́ ${o}${i.maximum}`}case"too_small":{const o=i.inclusive?">=":">",a=t(i.origin);return a?`Kéré ju: a ní láti jẹ́ pé ${i.origin} ${a.verb} ${o}${i.minimum} ${a.unit}`:`Kéré ju: a ní láti jẹ́ ${o}${i.minimum}`}case"invalid_format":{const o=i;return o.format==="starts_with"?`Ọ̀rọ̀ aṣìṣe: gbọ́dọ̀ bẹ̀rẹ̀ pẹ̀lú "${o.prefix}"`:o.format==="ends_with"?`Ọ̀rọ̀ aṣìṣe: gbọ́dọ̀ parí pẹ̀lú "${o.suffix}"`:o.format==="includes"?`Ọ̀rọ̀ aṣìṣe: gbọ́dọ̀ ní "${o.includes}"`:o.format==="regex"?`Ọ̀rọ̀ aṣìṣe: gbọ́dọ̀ bá àpẹẹrẹ mu ${o.pattern}`:`Aṣìṣe: ${n[o.format]??i.format}`}case"not_multiple_of":return`Nọ́mbà aṣìṣe: gbọ́dọ̀ jẹ́ èyà pípín ti ${i.divisor}`;case"unrecognized_keys":return`Bọtìnì àìmọ̀: ${Te(i.keys,", ")}`;case"invalid_key":return`Bọtìnì aṣìṣe nínú ${i.origin}`;case"invalid_union":return"Ìbáwọlé aṣìṣe";case"invalid_element":return`Iye aṣìṣe nínú ${i.origin}`;default:return"Ìbáwọlé aṣìṣe"}}};function dce(){return{localeError:cce()}}const fF=Object.freeze(Object.defineProperty({__proto__:null,ar:$le,az:jle,be:Ile,bg:Ale,ca:Mle,cs:Dle,da:Nle,de:Ble,en:uF,eo:Hle,es:qle,fa:Zle,fi:Yle,fr:Jle,frCA:tue,he:nue,hu:oue,id:sue,is:cue,it:fue,ja:hue,ka:vue,kh:bue,km:cF,ko:wue,lt:Pue,mk:Cue,ms:Eue,nl:Oue,no:Aue,ota:Mue,pl:Nue,ps:Due,pt:Bue,ru:Uue,sl:Kue,sv:Vue,ta:Gue,th:Xue,tr:Jue,ua:tce,uk:dF,ur:nce,vi:oce,yo:dce,zhCN:sce,zhTW:uce},Symbol.toStringTag,{value:"Module"}));var Q2;const pF=Symbol("ZodOutput"),hF=Symbol("ZodInput");class MC{constructor(){this._map=new WeakMap,this._idmap=new Map}add(t,...r){const n=r[0];if(this._map.set(t,n),n&&typeof n=="object"&&"id"in n){if(this._idmap.has(n.id))throw new Error(`ID ${n.id} already exists in the registry`);this._idmap.set(n.id,t)}return this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(t){const r=this._map.get(t);return r&&typeof r=="object"&&"id"in r&&this._idmap.delete(r.id),this._map.delete(t),this}get(t){const r=t._zod.parent;if(r){const n={...this.get(r)??{}};delete n.id;const i={...n,...this._map.get(t)};return Object.keys(i).length?i:void 0}return this._map.get(t)}has(t){return this._map.has(t)}}function RC(){return new MC}(Q2=globalThis).__zod_globalRegistry??(Q2.__zod_globalRegistry=RC());const qo=globalThis.__zod_globalRegistry;function mF(e,t){return new e({type:"string",...Ce(t)})}function gF(e,t){return new e({type:"string",coerce:!0,...Ce(t)})}function DC(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...Ce(t)})}function iy(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...Ce(t)})}function zC(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...Ce(t)})}function NC(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...Ce(t)})}function LC(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...Ce(t)})}function BC(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...Ce(t)})}function Gb(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...Ce(t)})}function FC(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...Ce(t)})}function UC(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...Ce(t)})}function WC(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...Ce(t)})}function KC(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...Ce(t)})}function HC(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...Ce(t)})}function VC(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...Ce(t)})}function qC(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...Ce(t)})}function GC(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...Ce(t)})}function ZC(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...Ce(t)})}function vF(e,t){return new e({type:"string",format:"mac",check:"string_format",abort:!1,...Ce(t)})}function XC(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...Ce(t)})}function YC(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...Ce(t)})}function QC(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...Ce(t)})}function JC(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...Ce(t)})}function ej(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...Ce(t)})}function tj(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...Ce(t)})}const yF={Any:null,Minute:-1,Second:0,Millisecond:3,Microsecond:6};function bF(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...Ce(t)})}function xF(e,t){return new e({type:"string",format:"date",check:"string_format",...Ce(t)})}function wF(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...Ce(t)})}function SF(e,t){return new e({type:"string",format:"duration",check:"string_format",...Ce(t)})}function kF(e,t){return new e({type:"number",checks:[],...Ce(t)})}function PF(e,t){return new e({type:"number",coerce:!0,checks:[],...Ce(t)})}function $F(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...Ce(t)})}function CF(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"float32",...Ce(t)})}function jF(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"float64",...Ce(t)})}function EF(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"int32",...Ce(t)})}function IF(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"uint32",...Ce(t)})}function OF(e,t){return new e({type:"boolean",...Ce(t)})}function _F(e,t){return new e({type:"boolean",coerce:!0,...Ce(t)})}function AF(e,t){return new e({type:"bigint",...Ce(t)})}function TF(e,t){return new e({type:"bigint",coerce:!0,...Ce(t)})}function MF(e,t){return new e({type:"bigint",check:"bigint_format",abort:!1,format:"int64",...Ce(t)})}function RF(e,t){return new e({type:"bigint",check:"bigint_format",abort:!1,format:"uint64",...Ce(t)})}function DF(e,t){return new e({type:"symbol",...Ce(t)})}function zF(e,t){return new e({type:"undefined",...Ce(t)})}function NF(e,t){return new e({type:"null",...Ce(t)})}function LF(e){return new e({type:"any"})}function BF(e){return new e({type:"unknown"})}function FF(e,t){return new e({type:"never",...Ce(t)})}function UF(e,t){return new e({type:"void",...Ce(t)})}function WF(e,t){return new e({type:"date",...Ce(t)})}function KF(e,t){return new e({type:"date",coerce:!0,...Ce(t)})}function HF(e,t){return new e({type:"nan",...Ce(t)})}function Bu(e,t){return new $C({check:"less_than",...Ce(t),value:e,inclusive:!1})}function Xo(e,t){return new $C({check:"less_than",...Ce(t),value:e,inclusive:!0})}function Fu(e,t){return new CC({check:"greater_than",...Ce(t),value:e,inclusive:!1})}function Ui(e,t){return new CC({check:"greater_than",...Ce(t),value:e,inclusive:!0})}function VF(e){return Fu(0,e)}function qF(e){return Bu(0,e)}function GF(e){return Xo(0,e)}function ZF(e){return Ui(0,e)}function th(e,t){return new _6({check:"multiple_of",...Ce(t),value:e})}function Zb(e,t){return new M6({check:"max_size",...Ce(t),maximum:e})}function rh(e,t){return new R6({check:"min_size",...Ce(t),minimum:e})}function rj(e,t){return new D6({check:"size_equals",...Ce(t),size:e})}function Xb(e,t){return new z6({check:"max_length",...Ce(t),maximum:e})}function Td(e,t){return new N6({check:"min_length",...Ce(t),minimum:e})}function Yb(e,t){return new L6({check:"length_equals",...Ce(t),length:e})}function nj(e,t){return new B6({check:"string_format",format:"regex",...Ce(t),pattern:e})}function ij(e){return new F6({check:"string_format",format:"lowercase",...Ce(e)})}function oj(e){return new U6({check:"string_format",format:"uppercase",...Ce(e)})}function aj(e,t){return new W6({check:"string_format",format:"includes",...Ce(t),includes:e})}function sj(e,t){return new K6({check:"string_format",format:"starts_with",...Ce(t),prefix:e})}function lj(e,t){return new H6({check:"string_format",format:"ends_with",...Ce(t),suffix:e})}function XF(e,t,r){return new V6({check:"property",property:e,schema:t,...Ce(r)})}function uj(e,t){return new q6({check:"mime_type",mime:e,...Ce(t)})}function zl(e){return new G6({check:"overwrite",tx:e})}function cj(e){return zl(t=>t.normalize(e))}function dj(){return zl(e=>e.trim())}function fj(){return zl(e=>e.toLowerCase())}function pj(){return zl(e=>e.toUpperCase())}function hj(){return zl(e=>jB(e))}function YF(e,t,r){return new e({type:"array",element:t,...Ce(r)})}function fce(e,t,r){return new e({type:"union",options:t,...Ce(r)})}function pce(e,t,r,n){return new e({type:"union",options:r,discriminator:t,...Ce(n)})}function hce(e,t,r){return new e({type:"intersection",left:t,right:r})}function mce(e,t,r,n){const i=r instanceof bt,o=i?n:r,a=i?r:null;return new e({type:"tuple",items:t,rest:a,...Ce(o)})}function gce(e,t,r,n){return new e({type:"record",keyType:t,valueType:r,...Ce(n)})}function vce(e,t,r,n){return new e({type:"map",keyType:t,valueType:r,...Ce(n)})}function yce(e,t,r){return new e({type:"set",valueType:t,...Ce(r)})}function bce(e,t,r){const n=Array.isArray(t)?Object.fromEntries(t.map(i=>[i,i])):t;return new e({type:"enum",entries:n,...Ce(r)})}function xce(e,t,r){return new e({type:"enum",entries:t,...Ce(r)})}function wce(e,t,r){return new e({type:"literal",values:Array.isArray(t)?t:[t],...Ce(r)})}function QF(e,t){return new e({type:"file",...Ce(t)})}function Sce(e,t){return new e({type:"transform",transform:t})}function kce(e,t){return new e({type:"optional",innerType:t})}function Pce(e,t){return new e({type:"nullable",innerType:t})}function $ce(e,t,r){return new e({type:"default",innerType:t,get defaultValue(){return typeof r=="function"?r():Hb(r)}})}function Cce(e,t,r){return new e({type:"nonoptional",innerType:t,...Ce(r)})}function jce(e,t){return new e({type:"success",innerType:t})}function Ece(e,t,r){return new e({type:"catch",innerType:t,catchValue:typeof r=="function"?r:()=>r})}function Ice(e,t,r){return new e({type:"pipe",in:t,out:r})}function Oce(e,t){return new e({type:"readonly",innerType:t})}function _ce(e,t,r){return new e({type:"template_literal",parts:t,...Ce(r)})}function Ace(e,t){return new e({type:"lazy",getter:t})}function Tce(e,t){return new e({type:"promise",innerType:t})}function JF(e,t,r){const n=Ce(r);return n.abort??(n.abort=!0),new e({type:"custom",check:"custom",fn:t,...n})}function eU(e,t,r){return new e({type:"custom",check:"custom",fn:t,...Ce(r)})}function tU(e){const t=rU(r=>(r.addIssue=n=>{if(typeof n=="string")r.issues.push(_d(n,r.value,t._zod.def));else{const i=n;i.fatal&&(i.continue=!1),i.code??(i.code="custom"),i.input??(i.input=r.value),i.inst??(i.inst=t),i.continue??(i.continue=!t._zod.def.abort),r.issues.push(_d(i))}},e(r.value,r)));return t}function rU(e,t){const r=new jr({check:"custom",...Ce(t)});return r._zod.check=e,r}function nU(e){const t=new jr({check:"describe"});return t._zod.onattach=[r=>{const n=qo.get(r)??{};qo.add(r,{...n,description:e})}],t._zod.check=()=>{},t}function iU(e){const t=new jr({check:"meta"});return t._zod.onattach=[r=>{const n=qo.get(r)??{};qo.add(r,{...n,...e})}],t._zod.check=()=>{},t}function oU(e,t){const r=Ce(t);let n=r.truthy??["true","1","yes","on","y","enabled"],i=r.falsy??["false","0","no","off","n","disabled"];r.case!=="sensitive"&&(n=n.map(y=>typeof y=="string"?y.toLowerCase():y),i=i.map(y=>typeof y=="string"?y.toLowerCase():y));const o=new Set(n),a=new Set(i),s=e.Codec??TC,u=e.Boolean??IC,d=e.String??Zh,f=new d({type:"string",error:r.error}),p=new u({type:"boolean",error:r.error}),v=new s({type:"pipe",in:f,out:p,transform:((y,b)=>{let w=y;return r.case!=="sensitive"&&(w=w.toLowerCase()),o.has(w)?!0:a.has(w)?!1:(b.issues.push({code:"invalid_value",expected:"stringbool",values:[...o,...a],input:b.value,inst:v,continue:!1}),{})}),reverseTransform:((y,b)=>y===!0?n[0]||"true":i[0]||"false"),error:r.error});return v}function Xh(e,t,r,n={}){const i=Ce(n),o={...Ce(n),check:"string_format",type:"string",format:t,fn:typeof r=="function"?r:s=>r.test(s),...i};return r instanceof RegExp&&(o.pattern=r),new e(o)}class Uk{constructor(t){this.counter=0,this.metadataRegistry=(t==null?void 0:t.metadata)??qo,this.target=(t==null?void 0:t.target)??"draft-2020-12",this.unrepresentable=(t==null?void 0:t.unrepresentable)??"throw",this.override=(t==null?void 0:t.override)??(()=>{}),this.io=(t==null?void 0:t.io)??"output",this.seen=new Map}process(t,r={path:[],schemaPath:[]}){var p,v,y;var n;const i=t._zod.def,o={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},a=this.seen.get(t);if(a)return a.count++,r.schemaPath.includes(t)&&(a.cycle=r.path),a.schema;const s={schema:{},count:1,cycle:void 0,path:r.path};this.seen.set(t,s);const u=(v=(p=t._zod).toJSONSchema)==null?void 0:v.call(p);if(u)s.schema=u;else{const b={...r,schemaPath:[...r.schemaPath,t],path:r.path},w=t._zod.parent;if(w)s.ref=w,this.process(w,b),this.seen.get(w).isParent=!0;else{const x=s.schema;switch(i.type){case"string":{const k=x;k.type="string";const{minimum:$,maximum:P,format:j,patterns:C,contentEncoding:I}=t._zod.bag;if(typeof $=="number"&&(k.minLength=$),typeof P=="number"&&(k.maxLength=P),j&&(k.format=o[j]??j,k.format===""&&delete k.format),I&&(k.contentEncoding=I),C&&C.size>0){const A=[...C];A.length===1?k.pattern=A[0].source:A.length>1&&(s.schema.allOf=[...A.map(T=>({...this.target==="draft-7"||this.target==="draft-4"||this.target==="openapi-3.0"?{type:"string"}:{},pattern:T.source}))])}break}case"number":{const k=x,{minimum:$,maximum:P,format:j,multipleOf:C,exclusiveMaximum:I,exclusiveMinimum:A}=t._zod.bag;typeof j=="string"&&j.includes("int")?k.type="integer":k.type="number",typeof A=="number"&&(this.target==="draft-4"||this.target==="openapi-3.0"?(k.minimum=A,k.exclusiveMinimum=!0):k.exclusiveMinimum=A),typeof $=="number"&&(k.minimum=$,typeof A=="number"&&this.target!=="draft-4"&&(A>=$?delete k.minimum:delete k.exclusiveMinimum)),typeof I=="number"&&(this.target==="draft-4"||this.target==="openapi-3.0"?(k.maximum=I,k.exclusiveMaximum=!0):k.exclusiveMaximum=I),typeof P=="number"&&(k.maximum=P,typeof I=="number"&&this.target!=="draft-4"&&(I<=P?delete k.maximum:delete k.exclusiveMaximum)),typeof C=="number"&&(k.multipleOf=C);break}case"boolean":{const k=x;k.type="boolean";break}case"bigint":{if(this.unrepresentable==="throw")throw new Error("BigInt cannot be represented in JSON Schema");break}case"symbol":{if(this.unrepresentable==="throw")throw new Error("Symbols cannot be represented in JSON Schema");break}case"null":{this.target==="openapi-3.0"?(x.type="string",x.nullable=!0,x.enum=[null]):x.type="null";break}case"any":break;case"unknown":break;case"undefined":{if(this.unrepresentable==="throw")throw new Error("Undefined cannot be represented in JSON Schema");break}case"void":{if(this.unrepresentable==="throw")throw new Error("Void cannot be represented in JSON Schema");break}case"never":{x.not={};break}case"date":{if(this.unrepresentable==="throw")throw new Error("Date cannot be represented in JSON Schema");break}case"array":{const k=x,{minimum:$,maximum:P}=t._zod.bag;typeof $=="number"&&(k.minItems=$),typeof P=="number"&&(k.maxItems=P),k.type="array",k.items=this.process(i.element,{...b,path:[...b.path,"items"]});break}case"object":{const k=x;k.type="object",k.properties={};const $=i.shape;for(const C in $)k.properties[C]=this.process($[C],{...b,path:[...b.path,"properties",C]});const P=new Set(Object.keys($)),j=new Set([...P].filter(C=>{const I=i.shape[C]._zod;return this.io==="input"?I.optin===void 0:I.optout===void 0}));j.size>0&&(k.required=Array.from(j)),((y=i.catchall)==null?void 0:y._zod.def.type)==="never"?k.additionalProperties=!1:i.catchall?i.catchall&&(k.additionalProperties=this.process(i.catchall,{...b,path:[...b.path,"additionalProperties"]})):this.io==="output"&&(k.additionalProperties=!1);break}case"union":{const k=x,$=i.discriminator!==void 0,P=i.options.map((j,C)=>this.process(j,{...b,path:[...b.path,$?"oneOf":"anyOf",C]}));$?k.oneOf=P:k.anyOf=P;break}case"intersection":{const k=x,$=this.process(i.left,{...b,path:[...b.path,"allOf",0]}),P=this.process(i.right,{...b,path:[...b.path,"allOf",1]}),j=I=>"allOf"in I&&Object.keys(I).length===1,C=[...j($)?$.allOf:[$],...j(P)?P.allOf:[P]];k.allOf=C;break}case"tuple":{const k=x;k.type="array";const $=this.target==="draft-2020-12"?"prefixItems":"items",P=this.target==="draft-2020-12"||this.target==="openapi-3.0"?"items":"additionalItems",j=i.items.map((T,M)=>this.process(T,{...b,path:[...b.path,$,M]})),C=i.rest?this.process(i.rest,{...b,path:[...b.path,P,...this.target==="openapi-3.0"?[i.items.length]:[]]}):null;this.target==="draft-2020-12"?(k.prefixItems=j,C&&(k.items=C)):this.target==="openapi-3.0"?(k.items={anyOf:j},C&&k.items.anyOf.push(C),k.minItems=j.length,C||(k.maxItems=j.length)):(k.items=j,C&&(k.additionalItems=C));const{minimum:I,maximum:A}=t._zod.bag;typeof I=="number"&&(k.minItems=I),typeof A=="number"&&(k.maxItems=A);break}case"record":{const k=x;k.type="object",(this.target==="draft-7"||this.target==="draft-2020-12")&&(k.propertyNames=this.process(i.keyType,{...b,path:[...b.path,"propertyNames"]})),k.additionalProperties=this.process(i.valueType,{...b,path:[...b.path,"additionalProperties"]});break}case"map":{if(this.unrepresentable==="throw")throw new Error("Map cannot be represented in JSON Schema");break}case"set":{if(this.unrepresentable==="throw")throw new Error("Set cannot be represented in JSON Schema");break}case"enum":{const k=x,$=cC(i.entries);$.every(P=>typeof P=="number")&&(k.type="number"),$.every(P=>typeof P=="string")&&(k.type="string"),k.enum=$;break}case"literal":{const k=x,$=[];for(const P of i.values)if(P===void 0){if(this.unrepresentable==="throw")throw new Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof P=="bigint"){if(this.unrepresentable==="throw")throw new Error("BigInt literals cannot be represented in JSON Schema");$.push(Number(P))}else $.push(P);if($.length!==0)if($.length===1){const P=$[0];k.type=P===null?"null":typeof P,this.target==="draft-4"||this.target==="openapi-3.0"?k.enum=[P]:k.const=P}else $.every(P=>typeof P=="number")&&(k.type="number"),$.every(P=>typeof P=="string")&&(k.type="string"),$.every(P=>typeof P=="boolean")&&(k.type="string"),$.every(P=>P===null)&&(k.type="null"),k.enum=$;break}case"file":{const k=x,$={type:"string",format:"binary",contentEncoding:"binary"},{minimum:P,maximum:j,mime:C}=t._zod.bag;P!==void 0&&($.minLength=P),j!==void 0&&($.maxLength=j),C?C.length===1?($.contentMediaType=C[0],Object.assign(k,$)):k.anyOf=C.map(I=>({...$,contentMediaType:I})):Object.assign(k,$);break}case"transform":{if(this.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema");break}case"nullable":{const k=this.process(i.innerType,b);this.target==="openapi-3.0"?(s.ref=i.innerType,x.nullable=!0):x.anyOf=[k,{type:"null"}];break}case"nonoptional":{this.process(i.innerType,b),s.ref=i.innerType;break}case"success":{const k=x;k.type="boolean";break}case"default":{this.process(i.innerType,b),s.ref=i.innerType,x.default=JSON.parse(JSON.stringify(i.defaultValue));break}case"prefault":{this.process(i.innerType,b),s.ref=i.innerType,this.io==="input"&&(x._prefault=JSON.parse(JSON.stringify(i.defaultValue)));break}case"catch":{this.process(i.innerType,b),s.ref=i.innerType;let k;try{k=i.catchValue(void 0)}catch{throw new Error("Dynamic catch values are not supported in JSON Schema")}x.default=k;break}case"nan":{if(this.unrepresentable==="throw")throw new Error("NaN cannot be represented in JSON Schema");break}case"template_literal":{const k=x,$=t._zod.pattern;if(!$)throw new Error("Pattern not found in template literal");k.type="string",k.pattern=$.source;break}case"pipe":{const k=this.io==="input"?i.in._zod.def.type==="transform"?i.out:i.in:i.out;this.process(k,b),s.ref=k;break}case"readonly":{this.process(i.innerType,b),s.ref=i.innerType,x.readOnly=!0;break}case"promise":{this.process(i.innerType,b),s.ref=i.innerType;break}case"optional":{this.process(i.innerType,b),s.ref=i.innerType;break}case"lazy":{const k=t._zod.innerType;this.process(k,b),s.ref=k;break}case"custom":{if(this.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema");break}case"function":{if(this.unrepresentable==="throw")throw new Error("Function types cannot be represented in JSON Schema");break}}}}const d=this.metadataRegistry.get(t);return d&&Object.assign(s.schema,d),this.io==="input"&&ri(t)&&(delete s.schema.examples,delete s.schema.default),this.io==="input"&&s.schema._prefault&&((n=s.schema).default??(n.default=s.schema._prefault)),delete s.schema._prefault,this.seen.get(t).schema}emit(t,r){var f,p,v,y,b,w;const n={cycles:(r==null?void 0:r.cycles)??"ref",reused:(r==null?void 0:r.reused)??"inline",external:(r==null?void 0:r.external)??void 0},i=this.seen.get(t);if(!i)throw new Error("Unprocessed schema. This is a bug in Zod.");const o=x=>{var C;const k=this.target==="draft-2020-12"?"$defs":"definitions";if(n.external){const I=(C=n.external.registry.get(x[0]))==null?void 0:C.id,A=n.external.uri??(M=>M);if(I)return{ref:A(I)};const T=x[1].defId??x[1].schema.id??`schema${this.counter++}`;return x[1].defId=T,{defId:T,ref:`${A("__shared")}#/${k}/${T}`}}if(x[1]===i)return{ref:"#"};const P=`#/${k}/`,j=x[1].schema.id??`__schema${this.counter++}`;return{defId:j,ref:P+j}},a=x=>{if(x[1].schema.$ref)return;const k=x[1],{ref:$,defId:P}=o(x);k.def={...k.schema},P&&(k.defId=P);const j=k.schema;for(const C in j)delete j[C];j.$ref=$};if(n.cycles==="throw")for(const x of this.seen.entries()){const k=x[1];if(k.cycle)throw new Error(`Cycle detected: #/${(f=k.cycle)==null?void 0:f.join("/")}/<root>
312
312
 
313
- Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(const x of this.seen.entries()){const k=x[1];if(t===x[0]){a(x);continue}if(n.external){const P=(p=n.external.registry.get(x[0]))==null?void 0:p.id;if(t!==x[0]&&P){a(x);continue}}if((v=this.metadataRegistry.get(x[0]))==null?void 0:v.id){a(x);continue}if(k.cycle){a(x);continue}if(k.count>1&&n.reused==="ref"){a(x);continue}}const s=(x,k)=>{const $=this.seen.get(x),P=$.def??$.schema,j={...P};if($.ref===null)return;const C=$.ref;if($.ref=null,C){s(C,k);const I=this.seen.get(C).schema;I.$ref&&(k.target==="draft-7"||k.target==="draft-4"||k.target==="openapi-3.0")?(P.allOf=P.allOf??[],P.allOf.push(I)):(Object.assign(P,I),Object.assign(P,j))}$.isParent||this.override({zodSchema:x,jsonSchema:P,path:$.path??[]})};for(const x of[...this.seen.entries()].reverse())s(x[0],{target:this.target});const u={};if(this.target==="draft-2020-12"?u.$schema="https://json-schema.org/draft/2020-12/schema":this.target==="draft-7"?u.$schema="http://json-schema.org/draft-07/schema#":this.target==="draft-4"?u.$schema="http://json-schema.org/draft-04/schema#":this.target==="openapi-3.0"||console.warn(`Invalid target: ${this.target}`),(y=n.external)!=null&&y.uri){const x=(b=n.external.registry.get(t))==null?void 0:b.id;if(!x)throw new Error("Schema is missing an `id` property");u.$id=n.external.uri(x)}Object.assign(u,i.def);const d=((w=n.external)==null?void 0:w.defs)??{};for(const x of this.seen.entries()){const k=x[1];k.def&&k.defId&&(d[k.defId]=k.def)}n.external||Object.keys(d).length>0&&(this.target==="draft-2020-12"?u.$defs=d:u.definitions=d);try{return JSON.parse(JSON.stringify(u))}catch{throw new Error("Error converting schema to JSON.")}}}function aU(e,t){if(e instanceof MC){const n=new Uk(t),i={};for(const s of e._idmap.entries()){const[u,d]=s;n.process(d)}const o={},a={registry:e,uri:t==null?void 0:t.uri,defs:i};for(const s of e._idmap.entries()){const[u,d]=s;o[u]=n.emit(d,{...t,external:a})}if(Object.keys(i).length>0){const s=n.target==="draft-2020-12"?"$defs":"definitions";o.__shared={[s]:i}}return{schemas:o}}const r=new Uk(t);return r.process(e),r.emit(e,t)}function ri(e,t){const r=t??{seen:new Set};if(r.seen.has(e))return!1;r.seen.add(e);const n=e._zod.def;if(n.type==="transform")return!0;if(n.type==="array")return ri(n.element,r);if(n.type==="set")return ri(n.valueType,r);if(n.type==="lazy")return ri(n.getter(),r);if(n.type==="promise"||n.type==="optional"||n.type==="nonoptional"||n.type==="nullable"||n.type==="readonly"||n.type==="default"||n.type==="prefault")return ri(n.innerType,r);if(n.type==="intersection")return ri(n.left,r)||ri(n.right,r);if(n.type==="record"||n.type==="map")return ri(n.keyType,r)||ri(n.valueType,r);if(n.type==="pipe")return ri(n.in,r)||ri(n.out,r);if(n.type==="object"){for(const i in n.shape)if(ri(n.shape[i],r))return!0;return!1}if(n.type==="union"){for(const i of n.options)if(ri(i,r))return!0;return!1}if(n.type==="tuple"){for(const i of n.items)if(ri(i,r))return!0;return!!(n.rest&&ri(n.rest,r))}return!1}const Mce=Object.freeze(Object.defineProperty({__proto__:null},Symbol.toStringTag,{value:"Module"})),Rce=Object.freeze(Object.defineProperty({__proto__:null,$ZodAny:I5,$ZodArray:M5,$ZodAsyncError:Ou,$ZodBase64:v5,$ZodBase64URL:b5,$ZodBigInt:OC,$ZodBigIntFormat:$5,$ZodBoolean:IC,$ZodCIDRv4:m5,$ZodCIDRv6:g5,$ZodCUID:n5,$ZodCUID2:i5,$ZodCatch:eF,$ZodCheck:jr,$ZodCheckBigIntFormat:T6,$ZodCheckEndsWith:H6,$ZodCheckGreaterThan:CC,$ZodCheckIncludes:W6,$ZodCheckLengthEquals:L6,$ZodCheckLessThan:$C,$ZodCheckLowerCase:F6,$ZodCheckMaxLength:z6,$ZodCheckMaxSize:M6,$ZodCheckMimeType:q6,$ZodCheckMinLength:N6,$ZodCheckMinSize:R6,$ZodCheckMultipleOf:_6,$ZodCheckNumberFormat:A6,$ZodCheckOverwrite:G6,$ZodCheckProperty:V6,$ZodCheckRegex:B6,$ZodCheckSizeEquals:D6,$ZodCheckStartsWith:K6,$ZodCheckStringFormat:Gh,$ZodCheckUpperCase:U6,$ZodCodec:TC,$ZodCustom:lF,$ZodCustomStringFormat:k5,$ZodDate:T5,$ZodDefault:X5,$ZodDiscriminatedUnion:L5,$ZodE164:x5,$ZodEmail:J6,$ZodEmoji:t5,$ZodEncodeError:Wb,$ZodEnum:K5,$ZodError:fC,$ZodFile:V5,$ZodFunction:oF,$ZodGUID:Y6,$ZodIPv4:f5,$ZodIPv6:p5,$ZodISODate:u5,$ZodISODateTime:l5,$ZodISODuration:d5,$ZodISOTime:c5,$ZodIntersection:B5,$ZodJWT:S5,$ZodKSUID:s5,$ZodLazy:sF,$ZodLiteral:H5,$ZodMAC:h5,$ZodMap:U5,$ZodNaN:tF,$ZodNanoID:r5,$ZodNever:_5,$ZodNonOptional:Q5,$ZodNull:E5,$ZodNullable:Z5,$ZodNumber:EC,$ZodNumberFormat:P5,$ZodObject:z5,$ZodObjectJIT:N5,$ZodOptional:G5,$ZodPipe:rF,$ZodPrefault:Y5,$ZodPromise:aF,$ZodReadonly:nF,$ZodRealError:Yi,$ZodRecord:F5,$ZodRegistry:MC,$ZodSet:W5,$ZodString:Zh,$ZodStringFormat:lr,$ZodSuccess:J5,$ZodSymbol:C5,$ZodTemplateLiteral:iF,$ZodTransform:q5,$ZodTuple:AC,$ZodType:bt,$ZodULID:o5,$ZodURL:e5,$ZodUUID:Q6,$ZodUndefined:j5,$ZodUnion:_C,$ZodUnknown:O5,$ZodVoid:A5,$ZodXID:a5,$brand:$B,$constructor:ae,$input:hF,$output:pF,Doc:Z6,JSONSchema:Mce,JSONSchemaGenerator:Uk,NEVER:PB,TimePrecision:yF,_any:LF,_array:YF,_base64:QC,_base64url:JC,_bigint:AF,_boolean:OF,_catch:Ece,_check:rU,_cidrv4:XC,_cidrv6:YC,_coercedBigint:TF,_coercedBoolean:_F,_coercedDate:KF,_coercedNumber:PF,_coercedString:gF,_cuid:WC,_cuid2:KC,_custom:JF,_date:WF,_decode:gC,_decodeAsync:yC,_default:$ce,_discriminatedUnion:pce,_e164:ej,_email:DC,_emoji:FC,_encode:mC,_encodeAsync:vC,_endsWith:lj,_enum:bce,_file:QF,_float32:CF,_float64:jF,_gt:Fu,_gte:Ui,_guid:iy,_includes:aj,_int:$F,_int32:EF,_int64:MF,_intersection:hce,_ipv4:GC,_ipv6:ZC,_isoDate:xF,_isoDateTime:bF,_isoDuration:SF,_isoTime:wF,_jwt:tj,_ksuid:qC,_lazy:Ace,_length:Yb,_literal:wce,_lowercase:ij,_lt:Bu,_lte:Xo,_mac:vF,_map:vce,_max:Xo,_maxLength:Xb,_maxSize:Zb,_mime:uj,_min:Ui,_minLength:Td,_minSize:rh,_multipleOf:th,_nan:HF,_nanoid:UC,_nativeEnum:xce,_negative:qF,_never:FF,_nonnegative:ZF,_nonoptional:Cce,_nonpositive:GF,_normalize:cj,_null:NF,_nullable:Pce,_number:kF,_optional:kce,_overwrite:zl,_parse:Uh,_parseAsync:Wh,_pipe:Ice,_positive:VF,_promise:Tce,_property:XF,_readonly:Oce,_record:gce,_refine:eU,_regex:nj,_safeDecode:xC,_safeDecodeAsync:SC,_safeEncode:bC,_safeEncodeAsync:wC,_safeParse:Kh,_safeParseAsync:Hh,_set:yce,_size:rj,_slugify:hj,_startsWith:sj,_string:mF,_stringFormat:Xh,_stringbool:oU,_success:jce,_superRefine:tU,_symbol:DF,_templateLiteral:_ce,_toLowerCase:fj,_toUpperCase:pj,_transform:Sce,_trim:dj,_tuple:mce,_uint32:IF,_uint64:RF,_ulid:HC,_undefined:zF,_union:fce,_unknown:BF,_uppercase:oj,_url:Gb,_uuid:zC,_uuidv4:NC,_uuidv6:LC,_uuidv7:BC,_void:UF,_xid:VC,clone:jo,config:ci,decode:qse,decodeAsync:Zse,describe:nU,encode:Vse,encodeAsync:Gse,flattenError:pC,formatError:hC,globalConfig:ey,globalRegistry:qo,isValidBase64:jC,isValidBase64URL:y5,isValidJWT:w5,locales:fF,meta:iU,parse:Lk,parseAsync:Bk,prettifyError:VB,regexes:PC,registry:RC,safeDecode:Yse,safeDecodeAsync:Jse,safeEncode:Xse,safeEncodeAsync:Qse,safeParse:qB,safeParseAsync:GB,toDotPath:HB,toJSONSchema:aU,treeifyError:KB,util:UB,version:X6},Symbol.toStringTag,{value:"Module"})),mj=ae("ZodISODateTime",(e,t)=>{l5.init(e,t),pr.init(e,t)});function sU(e){return bF(mj,e)}const gj=ae("ZodISODate",(e,t)=>{u5.init(e,t),pr.init(e,t)});function lU(e){return xF(gj,e)}const vj=ae("ZodISOTime",(e,t)=>{c5.init(e,t),pr.init(e,t)});function uU(e){return wF(vj,e)}const yj=ae("ZodISODuration",(e,t)=>{d5.init(e,t),pr.init(e,t)});function cU(e){return SF(yj,e)}const Dce=Object.freeze(Object.defineProperty({__proto__:null,ZodISODate:gj,ZodISODateTime:mj,ZodISODuration:yj,ZodISOTime:vj,date:lU,datetime:sU,duration:cU,time:uU},Symbol.toStringTag,{value:"Module"})),dU=(e,t)=>{fC.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:r=>hC(e,r)},flatten:{value:r=>pC(e,r)},addIssue:{value:r=>{e.issues.push(r),e.message=JSON.stringify(e.issues,ty,2)}},addIssues:{value:r=>{e.issues.push(...r),e.message=JSON.stringify(e.issues,ty,2)}},isEmpty:{get(){return e.issues.length===0}}})},zce=ae("ZodError",dU),Qi=ae("ZodError",dU,{Parent:Error}),fU=Uh(Qi),pU=Wh(Qi),hU=Kh(Qi),mU=Hh(Qi),gU=mC(Qi),vU=gC(Qi),yU=vC(Qi),bU=yC(Qi),xU=bC(Qi),wU=xC(Qi),SU=wC(Qi),kU=SC(Qi),Ct=ae("ZodType",(e,t)=>(bt.init(e,t),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.check=(...r)=>e.clone(ws(t,{checks:[...t.checks??[],...r.map(n=>typeof n=="function"?{_zod:{check:n,def:{check:"custom"},onattach:[]}}:n)]})),e.clone=(r,n)=>jo(e,r,n),e.brand=()=>e,e.register=((r,n)=>(r.add(e,n),e)),e.parse=(r,n)=>fU(e,r,n,{callee:e.parse}),e.safeParse=(r,n)=>hU(e,r,n),e.parseAsync=async(r,n)=>pU(e,r,n,{callee:e.parseAsync}),e.safeParseAsync=async(r,n)=>mU(e,r,n),e.spa=e.safeParseAsync,e.encode=(r,n)=>gU(e,r,n),e.decode=(r,n)=>vU(e,r,n),e.encodeAsync=async(r,n)=>yU(e,r,n),e.decodeAsync=async(r,n)=>bU(e,r,n),e.safeEncode=(r,n)=>xU(e,r,n),e.safeDecode=(r,n)=>wU(e,r,n),e.safeEncodeAsync=async(r,n)=>SU(e,r,n),e.safeDecodeAsync=async(r,n)=>kU(e,r,n),e.refine=(r,n)=>e.check(u3(r,n)),e.superRefine=r=>e.check(c3(r)),e.overwrite=r=>e.check(zl(r)),e.optional=()=>sy(e),e.nullable=()=>ly(e),e.nullish=()=>sy(ly(e)),e.nonoptional=r=>YU(e,r),e.array=()=>Qh(e),e.or=r=>nx([e,r]),e.and=r=>Bj(e,r),e.transform=r=>uy(e,Wj(r)),e.default=r=>GU(e,r),e.prefault=r=>XU(e,r),e.catch=r=>e3(e,r),e.pipe=r=>uy(e,r),e.readonly=()=>n3(e),e.describe=r=>{const n=e.clone();return qo.add(n,{description:r}),n},Object.defineProperty(e,"description",{get(){var r;return(r=qo.get(e))==null?void 0:r.description},configurable:!0}),e.meta=(...r)=>{if(r.length===0)return qo.get(e);const n=e.clone();return qo.add(n,r[0]),n},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e)),bj=ae("_ZodString",(e,t)=>{Zh.init(e,t),Ct.init(e,t);const r=e._zod.bag;e.format=r.format??null,e.minLength=r.minimum??null,e.maxLength=r.maximum??null,e.regex=(...n)=>e.check(nj(...n)),e.includes=(...n)=>e.check(aj(...n)),e.startsWith=(...n)=>e.check(sj(...n)),e.endsWith=(...n)=>e.check(lj(...n)),e.min=(...n)=>e.check(Td(...n)),e.max=(...n)=>e.check(Xb(...n)),e.length=(...n)=>e.check(Yb(...n)),e.nonempty=(...n)=>e.check(Td(1,...n)),e.lowercase=n=>e.check(ij(n)),e.uppercase=n=>e.check(oj(n)),e.trim=()=>e.check(dj()),e.normalize=(...n)=>e.check(cj(...n)),e.toLowerCase=()=>e.check(fj()),e.toUpperCase=()=>e.check(pj()),e.slugify=()=>e.check(hj())}),Qb=ae("ZodString",(e,t)=>{Zh.init(e,t),bj.init(e,t),e.email=r=>e.check(DC(xj,r)),e.url=r=>e.check(Gb(Jb,r)),e.jwt=r=>e.check(tj(Rj,r)),e.emoji=r=>e.check(FC(wj,r)),e.guid=r=>e.check(iy(oy,r)),e.uuid=r=>e.check(zC(rs,r)),e.uuidv4=r=>e.check(NC(rs,r)),e.uuidv6=r=>e.check(LC(rs,r)),e.uuidv7=r=>e.check(BC(rs,r)),e.nanoid=r=>e.check(UC(Sj,r)),e.guid=r=>e.check(iy(oy,r)),e.cuid=r=>e.check(WC(kj,r)),e.cuid2=r=>e.check(KC(Pj,r)),e.ulid=r=>e.check(HC($j,r)),e.base64=r=>e.check(QC(Aj,r)),e.base64url=r=>e.check(JC(Tj,r)),e.xid=r=>e.check(VC(Cj,r)),e.ksuid=r=>e.check(qC(jj,r)),e.ipv4=r=>e.check(GC(Ej,r)),e.ipv6=r=>e.check(ZC(Ij,r)),e.cidrv4=r=>e.check(XC(Oj,r)),e.cidrv6=r=>e.check(YC(_j,r)),e.e164=r=>e.check(ej(Mj,r)),e.datetime=r=>e.check(sU(r)),e.date=r=>e.check(lU(r)),e.time=r=>e.check(uU(r)),e.duration=r=>e.check(cU(r))});function Uu(e){return mF(Qb,e)}const pr=ae("ZodStringFormat",(e,t)=>{lr.init(e,t),bj.init(e,t)}),xj=ae("ZodEmail",(e,t)=>{J6.init(e,t),pr.init(e,t)});function Nce(e){return DC(xj,e)}const oy=ae("ZodGUID",(e,t)=>{Y6.init(e,t),pr.init(e,t)});function Lce(e){return iy(oy,e)}const rs=ae("ZodUUID",(e,t)=>{Q6.init(e,t),pr.init(e,t)});function Bce(e){return zC(rs,e)}function Fce(e){return NC(rs,e)}function Uce(e){return LC(rs,e)}function Wce(e){return BC(rs,e)}const Jb=ae("ZodURL",(e,t)=>{e5.init(e,t),pr.init(e,t)});function Kce(e){return Gb(Jb,e)}function Hce(e){return Gb(Jb,{protocol:/^https?$/,hostname:p6,...Ce(e)})}const wj=ae("ZodEmoji",(e,t)=>{t5.init(e,t),pr.init(e,t)});function Vce(e){return FC(wj,e)}const Sj=ae("ZodNanoID",(e,t)=>{r5.init(e,t),pr.init(e,t)});function qce(e){return UC(Sj,e)}const kj=ae("ZodCUID",(e,t)=>{n5.init(e,t),pr.init(e,t)});function Gce(e){return WC(kj,e)}const Pj=ae("ZodCUID2",(e,t)=>{i5.init(e,t),pr.init(e,t)});function Zce(e){return KC(Pj,e)}const $j=ae("ZodULID",(e,t)=>{o5.init(e,t),pr.init(e,t)});function Xce(e){return HC($j,e)}const Cj=ae("ZodXID",(e,t)=>{a5.init(e,t),pr.init(e,t)});function Yce(e){return VC(Cj,e)}const jj=ae("ZodKSUID",(e,t)=>{s5.init(e,t),pr.init(e,t)});function Qce(e){return qC(jj,e)}const Ej=ae("ZodIPv4",(e,t)=>{f5.init(e,t),pr.init(e,t)});function Jce(e){return GC(Ej,e)}const PU=ae("ZodMAC",(e,t)=>{h5.init(e,t),pr.init(e,t)});function ede(e){return vF(PU,e)}const Ij=ae("ZodIPv6",(e,t)=>{p5.init(e,t),pr.init(e,t)});function tde(e){return ZC(Ij,e)}const Oj=ae("ZodCIDRv4",(e,t)=>{m5.init(e,t),pr.init(e,t)});function rde(e){return XC(Oj,e)}const _j=ae("ZodCIDRv6",(e,t)=>{g5.init(e,t),pr.init(e,t)});function nde(e){return YC(_j,e)}const Aj=ae("ZodBase64",(e,t)=>{v5.init(e,t),pr.init(e,t)});function ide(e){return QC(Aj,e)}const Tj=ae("ZodBase64URL",(e,t)=>{b5.init(e,t),pr.init(e,t)});function ode(e){return JC(Tj,e)}const Mj=ae("ZodE164",(e,t)=>{x5.init(e,t),pr.init(e,t)});function ade(e){return ej(Mj,e)}const Rj=ae("ZodJWT",(e,t)=>{S5.init(e,t),pr.init(e,t)});function sde(e){return tj(Rj,e)}const Yh=ae("ZodCustomStringFormat",(e,t)=>{k5.init(e,t),pr.init(e,t)});function lde(e,t,r={}){return Xh(Yh,e,t,r)}function ude(e){return Xh(Yh,"hostname",f6,e)}function cde(e){return Xh(Yh,"hex",I6,e)}function dde(e,t){const r=(t==null?void 0:t.enc)??"hex",n=`${e}_${r}`,i=PC[n];if(!i)throw new Error(`Unrecognized hash format: ${n}`);return Xh(Yh,n,i,t)}const ex=ae("ZodNumber",(e,t)=>{EC.init(e,t),Ct.init(e,t),e.gt=(n,i)=>e.check(Fu(n,i)),e.gte=(n,i)=>e.check(Ui(n,i)),e.min=(n,i)=>e.check(Ui(n,i)),e.lt=(n,i)=>e.check(Bu(n,i)),e.lte=(n,i)=>e.check(Xo(n,i)),e.max=(n,i)=>e.check(Xo(n,i)),e.int=n=>e.check(Wk(n)),e.safe=n=>e.check(Wk(n)),e.positive=n=>e.check(Fu(0,n)),e.nonnegative=n=>e.check(Ui(0,n)),e.negative=n=>e.check(Bu(0,n)),e.nonpositive=n=>e.check(Xo(0,n)),e.multipleOf=(n,i)=>e.check(th(n,i)),e.step=(n,i)=>e.check(th(n,i)),e.finite=()=>e;const r=e._zod.bag;e.minValue=Math.max(r.minimum??Number.NEGATIVE_INFINITY,r.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,e.maxValue=Math.min(r.maximum??Number.POSITIVE_INFINITY,r.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,e.isInt=(r.format??"").includes("int")||Number.isSafeInteger(r.multipleOf??.5),e.isFinite=!0,e.format=r.format??null});function $U(e){return kF(ex,e)}const Jd=ae("ZodNumberFormat",(e,t)=>{P5.init(e,t),ex.init(e,t)});function Wk(e){return $F(Jd,e)}function fde(e){return CF(Jd,e)}function pde(e){return jF(Jd,e)}function hde(e){return EF(Jd,e)}function mde(e){return IF(Jd,e)}const tx=ae("ZodBoolean",(e,t)=>{IC.init(e,t),Ct.init(e,t)});function CU(e){return OF(tx,e)}const rx=ae("ZodBigInt",(e,t)=>{OC.init(e,t),Ct.init(e,t),e.gte=(n,i)=>e.check(Ui(n,i)),e.min=(n,i)=>e.check(Ui(n,i)),e.gt=(n,i)=>e.check(Fu(n,i)),e.gte=(n,i)=>e.check(Ui(n,i)),e.min=(n,i)=>e.check(Ui(n,i)),e.lt=(n,i)=>e.check(Bu(n,i)),e.lte=(n,i)=>e.check(Xo(n,i)),e.max=(n,i)=>e.check(Xo(n,i)),e.positive=n=>e.check(Fu(BigInt(0),n)),e.negative=n=>e.check(Bu(BigInt(0),n)),e.nonpositive=n=>e.check(Xo(BigInt(0),n)),e.nonnegative=n=>e.check(Ui(BigInt(0),n)),e.multipleOf=(n,i)=>e.check(th(n,i));const r=e._zod.bag;e.minValue=r.minimum??null,e.maxValue=r.maximum??null,e.format=r.format??null});function gde(e){return AF(rx,e)}const Dj=ae("ZodBigIntFormat",(e,t)=>{$5.init(e,t),rx.init(e,t)});function vde(e){return MF(Dj,e)}function yde(e){return RF(Dj,e)}const jU=ae("ZodSymbol",(e,t)=>{C5.init(e,t),Ct.init(e,t)});function bde(e){return DF(jU,e)}const EU=ae("ZodUndefined",(e,t)=>{j5.init(e,t),Ct.init(e,t)});function xde(e){return zF(EU,e)}const IU=ae("ZodNull",(e,t)=>{E5.init(e,t),Ct.init(e,t)});function OU(e){return NF(IU,e)}const _U=ae("ZodAny",(e,t)=>{I5.init(e,t),Ct.init(e,t)});function wde(){return LF(_U)}const AU=ae("ZodUnknown",(e,t)=>{O5.init(e,t),Ct.init(e,t)});function Md(){return BF(AU)}const TU=ae("ZodNever",(e,t)=>{_5.init(e,t),Ct.init(e,t)});function zj(e){return FF(TU,e)}const MU=ae("ZodVoid",(e,t)=>{A5.init(e,t),Ct.init(e,t)});function Sde(e){return UF(MU,e)}const Nj=ae("ZodDate",(e,t)=>{T5.init(e,t),Ct.init(e,t),e.min=(n,i)=>e.check(Ui(n,i)),e.max=(n,i)=>e.check(Xo(n,i));const r=e._zod.bag;e.minDate=r.minimum?new Date(r.minimum):null,e.maxDate=r.maximum?new Date(r.maximum):null});function kde(e){return WF(Nj,e)}const RU=ae("ZodArray",(e,t)=>{M5.init(e,t),Ct.init(e,t),e.element=t.element,e.min=(r,n)=>e.check(Td(r,n)),e.nonempty=r=>e.check(Td(1,r)),e.max=(r,n)=>e.check(Xb(r,n)),e.length=(r,n)=>e.check(Yb(r,n)),e.unwrap=()=>e.element});function Qh(e,t){return YF(RU,e,t)}function Pde(e){const t=e._zod.def.shape;return Uj(Object.keys(t))}const ef=ae("ZodObject",(e,t)=>{N5.init(e,t),Ct.init(e,t),Ot(e,"shape",()=>t.shape),e.keyof=()=>Uj(Object.keys(e._zod.def.shape)),e.catchall=r=>e.clone({...e._zod.def,catchall:r}),e.passthrough=()=>e.clone({...e._zod.def,catchall:Md()}),e.loose=()=>e.clone({...e._zod.def,catchall:Md()}),e.strict=()=>e.clone({...e._zod.def,catchall:zj()}),e.strip=()=>e.clone({...e._zod.def,catchall:void 0}),e.extend=r=>RB(e,r),e.safeExtend=r=>DB(e,r),e.merge=r=>zB(e,r),e.pick=r=>TB(e,r),e.omit=r=>MB(e,r),e.partial=(...r)=>NB(Kj,e,r[0]),e.required=(...r)=>LB(Hj,e,r[0])});function ay(e,t){const r={type:"object",shape:e??{},...Ce(t)};return new ef(r)}function $de(e,t){return new ef({type:"object",shape:e,catchall:zj(),...Ce(t)})}function Cde(e,t){return new ef({type:"object",shape:e,catchall:Md(),...Ce(t)})}const Lj=ae("ZodUnion",(e,t)=>{_C.init(e,t),Ct.init(e,t),e.options=t.options});function nx(e,t){return new Lj({type:"union",options:e,...Ce(t)})}const DU=ae("ZodDiscriminatedUnion",(e,t)=>{Lj.init(e,t),L5.init(e,t)});function jde(e,t,r){return new DU({type:"union",options:t,discriminator:e,...Ce(r)})}const zU=ae("ZodIntersection",(e,t)=>{B5.init(e,t),Ct.init(e,t)});function Bj(e,t){return new zU({type:"intersection",left:e,right:t})}const NU=ae("ZodTuple",(e,t)=>{AC.init(e,t),Ct.init(e,t),e.rest=r=>e.clone({...e._zod.def,rest:r})});function LU(e,t,r){const n=t instanceof bt,i=n?r:t,o=n?t:null;return new NU({type:"tuple",items:e,rest:o,...Ce(i)})}const Fj=ae("ZodRecord",(e,t)=>{F5.init(e,t),Ct.init(e,t),e.keyType=t.keyType,e.valueType=t.valueType});function BU(e,t,r){return new Fj({type:"record",keyType:e,valueType:t,...Ce(r)})}function Ede(e,t,r){const n=jo(e);return n._zod.values=void 0,new Fj({type:"record",keyType:n,valueType:t,...Ce(r)})}const FU=ae("ZodMap",(e,t)=>{U5.init(e,t),Ct.init(e,t),e.keyType=t.keyType,e.valueType=t.valueType});function Ide(e,t,r){return new FU({type:"map",keyType:e,valueType:t,...Ce(r)})}const UU=ae("ZodSet",(e,t)=>{W5.init(e,t),Ct.init(e,t),e.min=(...r)=>e.check(rh(...r)),e.nonempty=r=>e.check(rh(1,r)),e.max=(...r)=>e.check(Zb(...r)),e.size=(...r)=>e.check(rj(...r))});function Ode(e,t){return new UU({type:"set",valueType:e,...Ce(t)})}const nh=ae("ZodEnum",(e,t)=>{K5.init(e,t),Ct.init(e,t),e.enum=t.entries,e.options=Object.values(t.entries);const r=new Set(Object.keys(t.entries));e.extract=(n,i)=>{const o={};for(const a of n)if(r.has(a))o[a]=t.entries[a];else throw new Error(`Key ${a} not found in enum`);return new nh({...t,checks:[],...Ce(i),entries:o})},e.exclude=(n,i)=>{const o={...t.entries};for(const a of n)if(r.has(a))delete o[a];else throw new Error(`Key ${a} not found in enum`);return new nh({...t,checks:[],...Ce(i),entries:o})}});function Uj(e,t){const r=Array.isArray(e)?Object.fromEntries(e.map(n=>[n,n])):e;return new nh({type:"enum",entries:r,...Ce(t)})}function _de(e,t){return new nh({type:"enum",entries:e,...Ce(t)})}const WU=ae("ZodLiteral",(e,t)=>{H5.init(e,t),Ct.init(e,t),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function Ade(e,t){return new WU({type:"literal",values:Array.isArray(e)?e:[e],...Ce(t)})}const KU=ae("ZodFile",(e,t)=>{V5.init(e,t),Ct.init(e,t),e.min=(r,n)=>e.check(rh(r,n)),e.max=(r,n)=>e.check(Zb(r,n)),e.mime=(r,n)=>e.check(uj(Array.isArray(r)?r:[r],n))});function Tde(e){return QF(KU,e)}const HU=ae("ZodTransform",(e,t)=>{q5.init(e,t),Ct.init(e,t),e._zod.parse=(r,n)=>{if(n.direction==="backward")throw new Wb(e.constructor.name);r.addIssue=o=>{if(typeof o=="string")r.issues.push(_d(o,r.value,t));else{const a=o;a.fatal&&(a.continue=!1),a.code??(a.code="custom"),a.input??(a.input=r.value),a.inst??(a.inst=e),r.issues.push(_d(a))}};const i=t.transform(r.value,r);return i instanceof Promise?i.then(o=>(r.value=o,r)):(r.value=i,r)}});function Wj(e){return new HU({type:"transform",transform:e})}const Kj=ae("ZodOptional",(e,t)=>{G5.init(e,t),Ct.init(e,t),e.unwrap=()=>e._zod.def.innerType});function sy(e){return new Kj({type:"optional",innerType:e})}const VU=ae("ZodNullable",(e,t)=>{Z5.init(e,t),Ct.init(e,t),e.unwrap=()=>e._zod.def.innerType});function ly(e){return new VU({type:"nullable",innerType:e})}function Mde(e){return sy(ly(e))}const qU=ae("ZodDefault",(e,t)=>{X5.init(e,t),Ct.init(e,t),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function GU(e,t){return new qU({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():Hb(t)}})}const ZU=ae("ZodPrefault",(e,t)=>{Y5.init(e,t),Ct.init(e,t),e.unwrap=()=>e._zod.def.innerType});function XU(e,t){return new ZU({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():Hb(t)}})}const Hj=ae("ZodNonOptional",(e,t)=>{Q5.init(e,t),Ct.init(e,t),e.unwrap=()=>e._zod.def.innerType});function YU(e,t){return new Hj({type:"nonoptional",innerType:e,...Ce(t)})}const QU=ae("ZodSuccess",(e,t)=>{J5.init(e,t),Ct.init(e,t),e.unwrap=()=>e._zod.def.innerType});function Rde(e){return new QU({type:"success",innerType:e})}const JU=ae("ZodCatch",(e,t)=>{eF.init(e,t),Ct.init(e,t),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function e3(e,t){return new JU({type:"catch",innerType:e,catchValue:typeof t=="function"?t:()=>t})}const t3=ae("ZodNaN",(e,t)=>{tF.init(e,t),Ct.init(e,t)});function Dde(e){return HF(t3,e)}const Vj=ae("ZodPipe",(e,t)=>{rF.init(e,t),Ct.init(e,t),e.in=t.in,e.out=t.out});function uy(e,t){return new Vj({type:"pipe",in:e,out:t})}const qj=ae("ZodCodec",(e,t)=>{Vj.init(e,t),TC.init(e,t)});function zde(e,t,r){return new qj({type:"pipe",in:e,out:t,transform:r.decode,reverseTransform:r.encode})}const r3=ae("ZodReadonly",(e,t)=>{nF.init(e,t),Ct.init(e,t),e.unwrap=()=>e._zod.def.innerType});function n3(e){return new r3({type:"readonly",innerType:e})}const i3=ae("ZodTemplateLiteral",(e,t)=>{iF.init(e,t),Ct.init(e,t)});function Nde(e,t){return new i3({type:"template_literal",parts:e,...Ce(t)})}const o3=ae("ZodLazy",(e,t)=>{sF.init(e,t),Ct.init(e,t),e.unwrap=()=>e._zod.def.getter()});function a3(e){return new o3({type:"lazy",getter:e})}const s3=ae("ZodPromise",(e,t)=>{aF.init(e,t),Ct.init(e,t),e.unwrap=()=>e._zod.def.innerType});function Lde(e){return new s3({type:"promise",innerType:e})}const l3=ae("ZodFunction",(e,t)=>{oF.init(e,t),Ct.init(e,t)});function J2(e){return new l3({type:"function",input:Array.isArray(e==null?void 0:e.input)?LU(e==null?void 0:e.input):(e==null?void 0:e.input)??Qh(Md()),output:(e==null?void 0:e.output)??Md()})}const ix=ae("ZodCustom",(e,t)=>{lF.init(e,t),Ct.init(e,t)});function Bde(e){const t=new jr({check:"custom"});return t._zod.check=e,t}function Fde(e,t){return JF(ix,e??(()=>!0),t)}function u3(e,t={}){return eU(ix,e,t)}function c3(e){return tU(e)}const Ude=nU,Wde=iU;function Kde(e,t={error:`Input not instance of ${e.name}`}){const r=new ix({type:"custom",check:"custom",fn:n=>n instanceof e,abort:!0,...Ce(t)});return r._zod.bag.Class=e,r}const Hde=(...e)=>oU({Codec:qj,Boolean:tx,String:Qb},...e);function Vde(e){const t=a3(()=>nx([Uu(e),$U(),CU(),OU(),Qh(t),BU(Uu(),t)]));return t}function qde(e,t){return uy(Wj(e),t)}const Gde={invalid_type:"invalid_type",too_big:"too_big",too_small:"too_small",invalid_format:"invalid_format",not_multiple_of:"not_multiple_of",unrecognized_keys:"unrecognized_keys",invalid_union:"invalid_union",invalid_key:"invalid_key",invalid_element:"invalid_element",invalid_value:"invalid_value",custom:"custom"};function Zde(e){ci({customError:e})}function Xde(){return ci().customError}var Kk;Kk||(Kk={});function Yde(e){return gF(Qb,e)}function Qde(e){return PF(ex,e)}function Jde(e){return _F(tx,e)}function efe(e){return TF(rx,e)}function tfe(e){return KF(Nj,e)}const rfe=Object.freeze(Object.defineProperty({__proto__:null,bigint:efe,boolean:Jde,date:tfe,number:Qde,string:Yde},Symbol.toStringTag,{value:"Module"}));ci(uF());const ie=Object.freeze(Object.defineProperty({__proto__:null,$brand:$B,$input:hF,$output:pF,NEVER:PB,TimePrecision:yF,ZodAny:_U,ZodArray:RU,ZodBase64:Aj,ZodBase64URL:Tj,ZodBigInt:rx,ZodBigIntFormat:Dj,ZodBoolean:tx,ZodCIDRv4:Oj,ZodCIDRv6:_j,ZodCUID:kj,ZodCUID2:Pj,ZodCatch:JU,ZodCodec:qj,ZodCustom:ix,ZodCustomStringFormat:Yh,ZodDate:Nj,ZodDefault:qU,ZodDiscriminatedUnion:DU,ZodE164:Mj,ZodEmail:xj,ZodEmoji:wj,ZodEnum:nh,ZodError:zce,ZodFile:KU,get ZodFirstPartyTypeKind(){return Kk},ZodFunction:l3,ZodGUID:oy,ZodIPv4:Ej,ZodIPv6:Ij,ZodISODate:gj,ZodISODateTime:mj,ZodISODuration:yj,ZodISOTime:vj,ZodIntersection:zU,ZodIssueCode:Gde,ZodJWT:Rj,ZodKSUID:jj,ZodLazy:o3,ZodLiteral:WU,ZodMAC:PU,ZodMap:FU,ZodNaN:t3,ZodNanoID:Sj,ZodNever:TU,ZodNonOptional:Hj,ZodNull:IU,ZodNullable:VU,ZodNumber:ex,ZodNumberFormat:Jd,ZodObject:ef,ZodOptional:Kj,ZodPipe:Vj,ZodPrefault:ZU,ZodPromise:s3,ZodReadonly:r3,ZodRealError:Qi,ZodRecord:Fj,ZodSet:UU,ZodString:Qb,ZodStringFormat:pr,ZodSuccess:QU,ZodSymbol:jU,ZodTemplateLiteral:i3,ZodTransform:HU,ZodTuple:NU,ZodType:Ct,ZodULID:$j,ZodURL:Jb,ZodUUID:rs,ZodUndefined:EU,ZodUnion:Lj,ZodUnknown:AU,ZodVoid:MU,ZodXID:Cj,_ZodString:bj,_default:GU,_function:J2,any:wde,array:Qh,base64:ide,base64url:ode,bigint:gde,boolean:CU,catch:e3,check:Bde,cidrv4:rde,cidrv6:nde,clone:jo,codec:zde,coerce:rfe,config:ci,core:Rce,cuid:Gce,cuid2:Zce,custom:Fde,date:kde,decode:vU,decodeAsync:bU,describe:Ude,discriminatedUnion:jde,e164:ade,email:Nce,emoji:Vce,encode:gU,encodeAsync:yU,endsWith:lj,enum:Uj,file:Tde,flattenError:pC,float32:fde,float64:pde,formatError:hC,function:J2,getErrorMap:Xde,globalRegistry:qo,gt:Fu,gte:Ui,guid:Lce,hash:dde,hex:cde,hostname:ude,httpUrl:Hce,includes:aj,instanceof:Kde,int:Wk,int32:hde,int64:vde,intersection:Bj,ipv4:Jce,ipv6:tde,iso:Dce,json:Vde,jwt:sde,keyof:Pde,ksuid:Qce,lazy:a3,length:Yb,literal:Ade,locales:fF,looseObject:Cde,lowercase:ij,lt:Bu,lte:Xo,mac:ede,map:Ide,maxLength:Xb,maxSize:Zb,meta:Wde,mime:uj,minLength:Td,minSize:rh,multipleOf:th,nan:Dde,nanoid:qce,nativeEnum:_de,negative:qF,never:zj,nonnegative:ZF,nonoptional:YU,nonpositive:GF,normalize:cj,null:OU,nullable:ly,nullish:Mde,number:$U,object:ay,optional:sy,overwrite:zl,parse:fU,parseAsync:pU,partialRecord:Ede,pipe:uy,positive:VF,prefault:XU,preprocess:qde,prettifyError:VB,promise:Lde,property:XF,readonly:n3,record:BU,refine:u3,regex:nj,regexes:PC,registry:RC,safeDecode:wU,safeDecodeAsync:kU,safeEncode:xU,safeEncodeAsync:SU,safeParse:hU,safeParseAsync:mU,set:Ode,setErrorMap:Zde,size:rj,slugify:hj,startsWith:sj,strictObject:$de,string:Uu,stringFormat:lde,stringbool:Hde,success:Rde,superRefine:c3,symbol:bde,templateLiteral:Nde,toJSONSchema:aU,toLowerCase:fj,toUpperCase:pj,transform:Wj,treeifyError:KB,trim:dj,tuple:LU,uint32:mde,uint64:yde,ulid:Xce,undefined:xde,union:nx,unknown:Md,uppercase:oj,url:Kce,util:UB,uuid:Bce,uuidv4:Fce,uuidv6:Uce,uuidv7:Wce,void:Sde,xid:Yce},Symbol.toStringTag,{value:"Module"}));var kl=(e,t)=>e.parse(t);function d3(e,t){return e&&t?e===t?e:Bj(e,t):e??t}function f3(e){var r,n;const t=e.shape?e.shape:(n=(r=e._def)==null?void 0:r.shape)==null?void 0:n.call(r);return t?typeof t=="function"?t.call(e):t:{}}function p3(e,t=[]){if(!e)return[];const r=[];for(const[n,i]of Object.entries(e))if(i instanceof ef){const o=f3(i),a=p3(o,[...t,n]);r.push(...a.length?a:[[...t,n].join("_")])}else t.length>0&&r.push([...t,n].join("_"));return r}function h3(e,t){return t?e.replace(/:([A-Za-z0-9_]+)/g,(r,n)=>{const i=t[n];if(i==null)throw new Error(`Missing param :${n}`);return String(i)}):e}function Gj(e){const t=e.leaf.path.split("/").filter(Boolean),r=[e.leaf.method];for(const n of t){if(n.startsWith(":")){const i=n.slice(1),o=e.params&&i in e.params?e.params[i]:void 0;r.push([o]);continue}r.push(n)}return r.push(e.query??{}),r}function nfe(e){const r={...e.node??{},...e.cfg},n=r.feed===!0?d3(r.querySchema,r.queryExtensionSchema):r.querySchema,i=r.outputSchema?ay({out:r.outputSchema,meta:r.outputMetaSchema??Uu().optional()}):ay({meta:r.outputMetaSchema??Uu().optional()});if(r.feed===!0&&n instanceof ef){const o=f3(n),a=p3(o);a.length>0&&console.warn(`[routesV3.builder] Warning: feed query schema for ${e.method.toUpperCase()} ${e.path} contains nested objects. Consider using flat keys instead: ${a.join(", ")}`)}return{method:e.method,path:e.path,cfg:{...r,bodySchema:r.bodySchema,querySchema:n,paramsSchema:r.paramsSchema,outputSchema:i,outputMetaSchema:r.outputMetaSchema,queryExtensionSchema:r.queryExtensionSchema}}}var Rd=(e,t,r)=>{const n=`${e.toUpperCase()} ${t}`;return r?encodeURIComponent(n):n};function yo(e,t,r){const n=e??"",i=ife(n,!!r),o={},a=ofe(n,r);function s(u,d,f){const p=[],v=u,y=d;let b=f;function w(k,$){const P=$.paramsSchema??b,j=P?{...$,paramsSchema:P}:{...$},C=nfe({method:k,path:v,node:y,cfg:j});return p.push(C),x}const x={sub(...k){if(k.length===0)throw new Error("sub() expects at least one resource");for(const $ of k)for(const P of $){const j=P,C=j.cfg,I=C.paramsSchema,A=d3(b,I),T={...y,...C};A?T.paramsSchema=A:"paramsSchema"in T&&delete T.paramsSchema;const M={method:j.method,path:afe(v,j.path),cfg:T};p.push(M)}return x},get(k){return w("get",k)},post(k){return w("post",{...k,feed:!1})},put(k){return w("put",{...k,feed:!1})},patch(k){return w("patch",{...k,feed:!1})},delete(k){return w("delete",{...k,feed:!1})},done(){return p}};return x}return s(i,o,a)}function ife(e,t){const r=e??"";if(!t)return r;if(!r)throw new Error("resource() requires a segment name when defining an id schema");if(r.includes("/")){const n=r.split("/").filter(Boolean);if(n.length===0)throw new Error("resource() received an invalid segment for param injection");const i=n.length-1,o=n[i];return n[i]=o.startsWith(":")?o:`:${o}`,`${r.startsWith("/")?"/":""}${n.join("/")}`}return r.startsWith(":")?r:`:${r}`}function ofe(e,t){if(!t)return;const r=e.split("/").filter(Boolean),n=r.length>0?r[r.length-1]:e,i=n.startsWith(":")?n.slice(1):n;if(!i)throw new Error("resource() requires a non-empty name for id schema");return ay({[i]:t})}function afe(e,t){if(!e)return t;if(!t)return e;const r=e.endsWith("/")?e.replace(/\/+$/,""):e,n=t.startsWith("/")?t.replace(/^\/+/,""):t;return n?`${r}/${n}`:r}function sfe(e){const t=Object.fromEntries(e.map(n=>[`${n.method.toUpperCase()} ${n.path}`,n]));return{all:e,byKey:t,log:n=>{n.system("Finalized routes:"),Object.keys(t).forEach(i=>{t[i],n.system(`- ${i}`)})}}}var tf=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(){}},lfe={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},rl,g$,bL,ufe=(bL=class{constructor(){at(this,rl,lfe);at(this,g$,!1)}setTimeoutProvider(e){Fe(this,rl,e)}setTimeout(e,t){return Q(this,rl).setTimeout(e,t)}clearTimeout(e){Q(this,rl).clearTimeout(e)}setInterval(e,t){return Q(this,rl).setInterval(e,t)}clearInterval(e){Q(this,rl).clearInterval(e)}},rl=new WeakMap,g$=new WeakMap,bL),mu=new ufe;function cfe(e){setTimeout(e,0)}var Wu=typeof window>"u"||"Deno"in globalThis;function oi(){}function dfe(e,t){return typeof e=="function"?e(t):e}function Hk(e){return typeof e=="number"&&e>=0&&e!==1/0}function m3(e,t){return Math.max(e+(t||0)-Date.now(),0)}function gl(e,t){return typeof e=="function"?e(t):e}function ho(e,t){return typeof e=="function"?e(t):e}function eM(e,t){const{type:r="all",exact:n,fetchStatus:i,predicate:o,queryKey:a,stale:s}=e;if(a){if(n){if(t.queryHash!==Zj(a,t.options))return!1}else if(!ih(t.queryKey,a))return!1}if(r!=="all"){const u=t.isActive();if(r==="active"&&!u||r==="inactive"&&u)return!1}return!(typeof s=="boolean"&&t.isStale()!==s||i&&i!==t.state.fetchStatus||o&&!o(t))}function tM(e,t){const{exact:r,status:n,predicate:i,mutationKey:o}=e;if(o){if(!t.options.mutationKey)return!1;if(r){if(Ku(t.options.mutationKey)!==Ku(o))return!1}else if(!ih(t.options.mutationKey,o))return!1}return!(n&&t.state.status!==n||i&&!i(t))}function Zj(e,t){return((t==null?void 0:t.queryKeyHashFn)||Ku)(e)}function Ku(e){return JSON.stringify(e,(t,r)=>Vk(r)?Object.keys(r).sort().reduce((n,i)=>(n[i]=r[i],n),{}):r)}function ih(e,t){return e===t?!0:typeof e!=typeof t?!1:e&&t&&typeof e=="object"&&typeof t=="object"?Object.keys(t).every(r=>ih(e[r],t[r])):!1}var ffe=Object.prototype.hasOwnProperty;function g3(e,t){if(e===t)return e;const r=rM(e)&&rM(t);if(!r&&!(Vk(e)&&Vk(t)))return t;const i=(r?e:Object.keys(e)).length,o=r?t:Object.keys(t),a=o.length,s=r?new Array(a):{};let u=0;for(let d=0;d<a;d++){const f=r?d:o[d],p=e[f],v=t[f];if(p===v){s[f]=p,(r?d<i:ffe.call(e,f))&&u++;continue}if(p===null||v===null||typeof p!="object"||typeof v!="object"){s[f]=v;continue}const y=g3(p,v);s[f]=y,y===p&&u++}return i===a&&u===i?e:s}function cy(e,t){if(!t||Object.keys(e).length!==Object.keys(t).length)return!1;for(const r in e)if(e[r]!==t[r])return!1;return!0}function rM(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function Vk(e){if(!nM(e))return!1;const t=e.constructor;if(t===void 0)return!0;const r=t.prototype;return!(!nM(r)||!r.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(e)!==Object.prototype)}function nM(e){return Object.prototype.toString.call(e)==="[object Object]"}function pfe(e){return new Promise(t=>{mu.setTimeout(t,e)})}function qk(e,t,r){return typeof r.structuralSharing=="function"?r.structuralSharing(e,t):r.structuralSharing!==!1?g3(e,t):t}function v3(e){return e}function hfe(e,t,r=0){const n=[...e,t];return r&&n.length>r?n.slice(1):n}function mfe(e,t,r=0){const n=[t,...e];return r&&n.length>r?n.slice(0,-1):n}var Xj=Symbol();function y3(e,t){return!e.queryFn&&(t!=null&&t.initialPromise)?()=>t.initialPromise:!e.queryFn||e.queryFn===Xj?()=>Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function b3(e,t){return typeof e=="function"?e(...t):!!e}var xu,nl,dd,xL,gfe=(xL=class extends tf{constructor(){super();at(this,xu);at(this,nl);at(this,dd);Fe(this,dd,t=>{if(!Wu&&window.addEventListener){const r=()=>t();return window.addEventListener("visibilitychange",r,!1),()=>{window.removeEventListener("visibilitychange",r)}}})}onSubscribe(){Q(this,nl)||this.setEventListener(Q(this,dd))}onUnsubscribe(){var t;this.hasListeners()||((t=Q(this,nl))==null||t.call(this),Fe(this,nl,void 0))}setEventListener(t){var r;Fe(this,dd,t),(r=Q(this,nl))==null||r.call(this),Fe(this,nl,t(n=>{typeof n=="boolean"?this.setFocused(n):this.onFocus()}))}setFocused(t){Q(this,xu)!==t&&(Fe(this,xu,t),this.onFocus())}onFocus(){const t=this.isFocused();this.listeners.forEach(r=>{r(t)})}isFocused(){var t;return typeof Q(this,xu)=="boolean"?Q(this,xu):((t=globalThis.document)==null?void 0:t.visibilityState)!=="hidden"}},xu=new WeakMap,nl=new WeakMap,dd=new WeakMap,xL),Yj=new gfe;function Gk(){let e,t;const r=new Promise((i,o)=>{e=i,t=o});r.status="pending",r.catch(()=>{});function n(i){Object.assign(r,i),delete r.resolve,delete r.reject}return r.resolve=i=>{n({status:"fulfilled",value:i}),e(i)},r.reject=i=>{n({status:"rejected",reason:i}),t(i)},r}var vfe=cfe;function yfe(){let e=[],t=0,r=s=>{s()},n=s=>{s()},i=vfe;const o=s=>{t?e.push(s):i(()=>{r(s)})},a=()=>{const s=e;e=[],s.length&&i(()=>{n(()=>{s.forEach(u=>{r(u)})})})};return{batch:s=>{let u;t++;try{u=s()}finally{t--,t||a()}return u},batchCalls:s=>(...u)=>{o(()=>{s(...u)})},schedule:o,setNotifyFunction:s=>{r=s},setBatchNotifyFunction:s=>{n=s},setScheduler:s=>{i=s}}}var dn=yfe(),fd,il,pd,wL,bfe=(wL=class extends tf{constructor(){super();at(this,fd,!0);at(this,il);at(this,pd);Fe(this,pd,t=>{if(!Wu&&window.addEventListener){const r=()=>t(!0),n=()=>t(!1);return window.addEventListener("online",r,!1),window.addEventListener("offline",n,!1),()=>{window.removeEventListener("online",r),window.removeEventListener("offline",n)}}})}onSubscribe(){Q(this,il)||this.setEventListener(Q(this,pd))}onUnsubscribe(){var t;this.hasListeners()||((t=Q(this,il))==null||t.call(this),Fe(this,il,void 0))}setEventListener(t){var r;Fe(this,pd,t),(r=Q(this,il))==null||r.call(this),Fe(this,il,t(this.setOnline.bind(this)))}setOnline(t){Q(this,fd)!==t&&(Fe(this,fd,t),this.listeners.forEach(n=>{n(t)}))}isOnline(){return Q(this,fd)}},fd=new WeakMap,il=new WeakMap,pd=new WeakMap,wL),dy=new bfe;function xfe(e){return Math.min(1e3*2**e,3e4)}function x3(e){return(e??"online")==="online"?dy.isOnline():!0}var Zk=class extends Error{constructor(e){super("CancelledError"),this.revert=e==null?void 0:e.revert,this.silent=e==null?void 0:e.silent}};function w3(e){let t=!1,r=0,n;const i=Gk(),o=()=>i.status!=="pending",a=w=>{var x;if(!o()){const k=new Zk(w);v(k),(x=e.onCancel)==null||x.call(e,k)}},s=()=>{t=!0},u=()=>{t=!1},d=()=>Yj.isFocused()&&(e.networkMode==="always"||dy.isOnline())&&e.canRun(),f=()=>x3(e.networkMode)&&e.canRun(),p=w=>{o()||(n==null||n(),i.resolve(w))},v=w=>{o()||(n==null||n(),i.reject(w))},y=()=>new Promise(w=>{var x;n=k=>{(o()||d())&&w(k)},(x=e.onPause)==null||x.call(e)}).then(()=>{var w;n=void 0,o()||(w=e.onContinue)==null||w.call(e)}),b=()=>{if(o())return;let w;const x=r===0?e.initialPromise:void 0;try{w=x??e.fn()}catch(k){w=Promise.reject(k)}Promise.resolve(w).then(p).catch(k=>{var I;if(o())return;const $=e.retry??(Wu?0:3),P=e.retryDelay??xfe,j=typeof P=="function"?P(r,k):P,C=$===!0||typeof $=="number"&&r<$||typeof $=="function"&&$(r,k);if(t||!C){v(k);return}r++,(I=e.onFail)==null||I.call(e,r,k),pfe(j).then(()=>d()?void 0:y()).then(()=>{t?v(k):b()})})};return{promise:i,status:()=>i.status,cancel:a,continue:()=>(n==null||n(),i),cancelRetry:s,continueRetry:u,canStart:f,start:()=>(f()?b():y().then(b),i)}}var wu,SL,S3=(SL=class{constructor(){at(this,wu)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),Hk(this.gcTime)&&Fe(this,wu,mu.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(Wu?1/0:300*1e3))}clearGcTimeout(){Q(this,wu)&&(mu.clearTimeout(Q(this,wu)),Fe(this,wu,void 0))}},wu=new WeakMap,SL),Su,hd,fo,ku,kn,Sh,Pu,Fo,qa,kL,wfe=(kL=class extends S3{constructor(t){super();at(this,Fo);at(this,Su);at(this,hd);at(this,fo);at(this,ku);at(this,kn);at(this,Sh);at(this,Pu);Fe(this,Pu,!1),Fe(this,Sh,t.defaultOptions),this.setOptions(t.options),this.observers=[],Fe(this,ku,t.client),Fe(this,fo,Q(this,ku).getQueryCache()),this.queryKey=t.queryKey,this.queryHash=t.queryHash,Fe(this,Su,oM(this.options)),this.state=t.state??Q(this,Su),this.scheduleGc()}get meta(){return this.options.meta}get promise(){var t;return(t=Q(this,kn))==null?void 0:t.promise}setOptions(t){if(this.options={...Q(this,Sh),...t},this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){const r=oM(this.options);r.data!==void 0&&(this.setState(iM(r.data,r.dataUpdatedAt)),Fe(this,Su,r))}}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&Q(this,fo).remove(this)}setData(t,r){const n=qk(this.state.data,t,this.options);return Pt(this,Fo,qa).call(this,{data:n,type:"success",dataUpdatedAt:r==null?void 0:r.updatedAt,manual:r==null?void 0:r.manual}),n}setState(t,r){Pt(this,Fo,qa).call(this,{type:"setState",state:t,setStateOptions:r})}cancel(t){var n,i;const r=(n=Q(this,kn))==null?void 0:n.promise;return(i=Q(this,kn))==null||i.cancel(t),r?r.then(oi).catch(oi):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(Q(this,Su))}isActive(){return this.observers.some(t=>ho(t.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===Xj||this.state.dataUpdateCount+this.state.errorUpdateCount===0}isStatic(){return this.getObserversCount()>0?this.observers.some(t=>gl(t.options.staleTime,this)==="static"):!1}isStale(){return this.getObserversCount()>0?this.observers.some(t=>t.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(t=0){return this.state.data===void 0?!0:t==="static"?!1:this.state.isInvalidated?!0:!m3(this.state.dataUpdatedAt,t)}onFocus(){var r;const t=this.observers.find(n=>n.shouldFetchOnWindowFocus());t==null||t.refetch({cancelRefetch:!1}),(r=Q(this,kn))==null||r.continue()}onOnline(){var r;const t=this.observers.find(n=>n.shouldFetchOnReconnect());t==null||t.refetch({cancelRefetch:!1}),(r=Q(this,kn))==null||r.continue()}addObserver(t){this.observers.includes(t)||(this.observers.push(t),this.clearGcTimeout(),Q(this,fo).notify({type:"observerAdded",query:this,observer:t}))}removeObserver(t){this.observers.includes(t)&&(this.observers=this.observers.filter(r=>r!==t),this.observers.length||(Q(this,kn)&&(Q(this,Pu)?Q(this,kn).cancel({revert:!0}):Q(this,kn).cancelRetry()),this.scheduleGc()),Q(this,fo).notify({type:"observerRemoved",query:this,observer:t}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||Pt(this,Fo,qa).call(this,{type:"invalidate"})}async fetch(t,r){var u,d,f,p,v,y,b,w,x,k,$,P;if(this.state.fetchStatus!=="idle"&&((u=Q(this,kn))==null?void 0:u.status())!=="rejected"){if(this.state.data!==void 0&&(r!=null&&r.cancelRefetch))this.cancel({silent:!0});else if(Q(this,kn))return Q(this,kn).continueRetry(),Q(this,kn).promise}if(t&&this.setOptions(t),!this.options.queryFn){const j=this.observers.find(C=>C.options.queryFn);j&&this.setOptions(j.options)}const n=new AbortController,i=j=>{Object.defineProperty(j,"signal",{enumerable:!0,get:()=>(Fe(this,Pu,!0),n.signal)})},o=()=>{const j=y3(this.options,r),I=(()=>{const A={client:Q(this,ku),queryKey:this.queryKey,meta:this.meta};return i(A),A})();return Fe(this,Pu,!1),this.options.persister?this.options.persister(j,I,this):j(I)},s=(()=>{const j={fetchOptions:r,options:this.options,queryKey:this.queryKey,client:Q(this,ku),state:this.state,fetchFn:o};return i(j),j})();(d=this.options.behavior)==null||d.onFetch(s,this),Fe(this,hd,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((f=s.fetchOptions)==null?void 0:f.meta))&&Pt(this,Fo,qa).call(this,{type:"fetch",meta:(p=s.fetchOptions)==null?void 0:p.meta}),Fe(this,kn,w3({initialPromise:r==null?void 0:r.initialPromise,fn:s.fetchFn,onCancel:j=>{j instanceof Zk&&j.revert&&this.setState({...Q(this,hd),fetchStatus:"idle"}),n.abort()},onFail:(j,C)=>{Pt(this,Fo,qa).call(this,{type:"failed",failureCount:j,error:C})},onPause:()=>{Pt(this,Fo,qa).call(this,{type:"pause"})},onContinue:()=>{Pt(this,Fo,qa).call(this,{type:"continue"})},retry:s.options.retry,retryDelay:s.options.retryDelay,networkMode:s.options.networkMode,canRun:()=>!0}));try{const j=await Q(this,kn).start();if(j===void 0)throw new Error(`${this.queryHash} data is undefined`);return this.setData(j),(y=(v=Q(this,fo).config).onSuccess)==null||y.call(v,j,this),(w=(b=Q(this,fo).config).onSettled)==null||w.call(b,j,this.state.error,this),j}catch(j){if(j instanceof Zk){if(j.silent)return Q(this,kn).promise;if(j.revert){if(this.state.data===void 0)throw j;return this.state.data}}throw Pt(this,Fo,qa).call(this,{type:"error",error:j}),(k=(x=Q(this,fo).config).onError)==null||k.call(x,j,this),(P=($=Q(this,fo).config).onSettled)==null||P.call($,this.state.data,j,this),j}finally{this.scheduleGc()}}},Su=new WeakMap,hd=new WeakMap,fo=new WeakMap,ku=new WeakMap,kn=new WeakMap,Sh=new WeakMap,Pu=new WeakMap,Fo=new WeakSet,qa=function(t){const r=n=>{switch(t.type){case"failed":return{...n,fetchFailureCount:t.failureCount,fetchFailureReason:t.error};case"pause":return{...n,fetchStatus:"paused"};case"continue":return{...n,fetchStatus:"fetching"};case"fetch":return{...n,...k3(n.data,this.options),fetchMeta:t.meta??null};case"success":const i={...n,...iM(t.data,t.dataUpdatedAt),dataUpdateCount:n.dataUpdateCount+1,...!t.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return Fe(this,hd,t.manual?i:void 0),i;case"error":const o=t.error;return{...n,error:o,errorUpdateCount:n.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:n.fetchFailureCount+1,fetchFailureReason:o,fetchStatus:"idle",status:"error"};case"invalidate":return{...n,isInvalidated:!0};case"setState":return{...n,...t.state}}};this.state=r(this.state),dn.batch(()=>{this.observers.forEach(n=>{n.onQueryUpdate()}),Q(this,fo).notify({query:this,type:"updated",action:t})})},kL);function k3(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:x3(t.networkMode)?"fetching":"paused",...e===void 0&&{error:null,status:"pending"}}}function iM(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:"success"}}function oM(e){const t=typeof e.initialData=="function"?e.initialData():e.initialData,r=t!==void 0,n=r?typeof e.initialDataUpdatedAt=="function"?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:r?n??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:r?"success":"pending",fetchStatus:"idle"}}var bi,Dt,kh,ni,$u,md,Xa,ol,Ph,gd,vd,Cu,ju,al,yd,Yt,Dp,Xk,Yk,Qk,Jk,eP,tP,rP,$3,PL,P3=(PL=class extends tf{constructor(t,r){super();at(this,Yt);at(this,bi);at(this,Dt);at(this,kh);at(this,ni);at(this,$u);at(this,md);at(this,Xa);at(this,ol);at(this,Ph);at(this,gd);at(this,vd);at(this,Cu);at(this,ju);at(this,al);at(this,yd,new Set);this.options=r,Fe(this,bi,t),Fe(this,ol,null),Fe(this,Xa,Gk()),this.bindMethods(),this.setOptions(r)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(Q(this,Dt).addObserver(this),aM(Q(this,Dt),this.options)?Pt(this,Yt,Dp).call(this):this.updateResult(),Pt(this,Yt,Jk).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return nP(Q(this,Dt),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return nP(Q(this,Dt),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,Pt(this,Yt,eP).call(this),Pt(this,Yt,tP).call(this),Q(this,Dt).removeObserver(this)}setOptions(t){const r=this.options,n=Q(this,Dt);if(this.options=Q(this,bi).defaultQueryOptions(t),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof ho(this.options.enabled,Q(this,Dt))!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");Pt(this,Yt,rP).call(this),Q(this,Dt).setOptions(this.options),r._defaulted&&!cy(this.options,r)&&Q(this,bi).getQueryCache().notify({type:"observerOptionsUpdated",query:Q(this,Dt),observer:this});const i=this.hasListeners();i&&sM(Q(this,Dt),n,this.options,r)&&Pt(this,Yt,Dp).call(this),this.updateResult(),i&&(Q(this,Dt)!==n||ho(this.options.enabled,Q(this,Dt))!==ho(r.enabled,Q(this,Dt))||gl(this.options.staleTime,Q(this,Dt))!==gl(r.staleTime,Q(this,Dt)))&&Pt(this,Yt,Xk).call(this);const o=Pt(this,Yt,Yk).call(this);i&&(Q(this,Dt)!==n||ho(this.options.enabled,Q(this,Dt))!==ho(r.enabled,Q(this,Dt))||o!==Q(this,al))&&Pt(this,Yt,Qk).call(this,o)}getOptimisticResult(t){const r=Q(this,bi).getQueryCache().build(Q(this,bi),t),n=this.createResult(r,t);return kfe(this,n)&&(Fe(this,ni,n),Fe(this,md,this.options),Fe(this,$u,Q(this,Dt).state)),n}getCurrentResult(){return Q(this,ni)}trackResult(t,r){return new Proxy(t,{get:(n,i)=>(this.trackProp(i),r==null||r(i),i==="promise"&&(this.trackProp("data"),!this.options.experimental_prefetchInRender&&Q(this,Xa).status==="pending"&&Q(this,Xa).reject(new Error("experimental_prefetchInRender feature flag is not enabled"))),Reflect.get(n,i))})}trackProp(t){Q(this,yd).add(t)}getCurrentQuery(){return Q(this,Dt)}refetch({...t}={}){return this.fetch({...t})}fetchOptimistic(t){const r=Q(this,bi).defaultQueryOptions(t),n=Q(this,bi).getQueryCache().build(Q(this,bi),r);return n.fetch().then(()=>this.createResult(n,r))}fetch(t){return Pt(this,Yt,Dp).call(this,{...t,cancelRefetch:t.cancelRefetch??!0}).then(()=>(this.updateResult(),Q(this,ni)))}createResult(t,r){var M;const n=Q(this,Dt),i=this.options,o=Q(this,ni),a=Q(this,$u),s=Q(this,md),d=t!==n?t.state:Q(this,kh),{state:f}=t;let p={...f},v=!1,y;if(r._optimisticResults){const R=this.hasListeners(),D=!R&&aM(t,r),O=R&&sM(t,n,r,i);(D||O)&&(p={...p,...k3(f.data,t.options)}),r._optimisticResults==="isRestoring"&&(p.fetchStatus="idle")}let{error:b,errorUpdatedAt:w,status:x}=p;y=p.data;let k=!1;if(r.placeholderData!==void 0&&y===void 0&&x==="pending"){let R;o!=null&&o.isPlaceholderData&&r.placeholderData===(s==null?void 0:s.placeholderData)?(R=o.data,k=!0):R=typeof r.placeholderData=="function"?r.placeholderData((M=Q(this,vd))==null?void 0:M.state.data,Q(this,vd)):r.placeholderData,R!==void 0&&(x="success",y=qk(o==null?void 0:o.data,R,r),v=!0)}if(r.select&&y!==void 0&&!k)if(o&&y===(a==null?void 0:a.data)&&r.select===Q(this,Ph))y=Q(this,gd);else try{Fe(this,Ph,r.select),y=r.select(y),y=qk(o==null?void 0:o.data,y,r),Fe(this,gd,y),Fe(this,ol,null)}catch(R){Fe(this,ol,R)}Q(this,ol)&&(b=Q(this,ol),y=Q(this,gd),w=Date.now(),x="error");const $=p.fetchStatus==="fetching",P=x==="pending",j=x==="error",C=P&&$,I=y!==void 0,T={status:x,fetchStatus:p.fetchStatus,isPending:P,isSuccess:x==="success",isError:j,isInitialLoading:C,isLoading:C,data:y,dataUpdatedAt:p.dataUpdatedAt,error:b,errorUpdatedAt:w,failureCount:p.fetchFailureCount,failureReason:p.fetchFailureReason,errorUpdateCount:p.errorUpdateCount,isFetched:p.dataUpdateCount>0||p.errorUpdateCount>0,isFetchedAfterMount:p.dataUpdateCount>d.dataUpdateCount||p.errorUpdateCount>d.errorUpdateCount,isFetching:$,isRefetching:$&&!P,isLoadingError:j&&!I,isPaused:p.fetchStatus==="paused",isPlaceholderData:v,isRefetchError:j&&I,isStale:Qj(t,r),refetch:this.refetch,promise:Q(this,Xa),isEnabled:ho(r.enabled,t)!==!1};if(this.options.experimental_prefetchInRender){const R=L=>{T.status==="error"?L.reject(T.error):T.data!==void 0&&L.resolve(T.data)},D=()=>{const L=Fe(this,Xa,T.promise=Gk());R(L)},O=Q(this,Xa);switch(O.status){case"pending":t.queryHash===n.queryHash&&R(O);break;case"fulfilled":(T.status==="error"||T.data!==O.value)&&D();break;case"rejected":(T.status!=="error"||T.error!==O.reason)&&D();break}}return T}updateResult(){const t=Q(this,ni),r=this.createResult(Q(this,Dt),this.options);if(Fe(this,$u,Q(this,Dt).state),Fe(this,md,this.options),Q(this,$u).data!==void 0&&Fe(this,vd,Q(this,Dt)),cy(r,t))return;Fe(this,ni,r);const n=()=>{if(!t)return!0;const{notifyOnChangeProps:i}=this.options,o=typeof i=="function"?i():i;if(o==="all"||!o&&!Q(this,yd).size)return!0;const a=new Set(o??Q(this,yd));return this.options.throwOnError&&a.add("error"),Object.keys(Q(this,ni)).some(s=>{const u=s;return Q(this,ni)[u]!==t[u]&&a.has(u)})};Pt(this,Yt,$3).call(this,{listeners:n()})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&Pt(this,Yt,Jk).call(this)}},bi=new WeakMap,Dt=new WeakMap,kh=new WeakMap,ni=new WeakMap,$u=new WeakMap,md=new WeakMap,Xa=new WeakMap,ol=new WeakMap,Ph=new WeakMap,gd=new WeakMap,vd=new WeakMap,Cu=new WeakMap,ju=new WeakMap,al=new WeakMap,yd=new WeakMap,Yt=new WeakSet,Dp=function(t){Pt(this,Yt,rP).call(this);let r=Q(this,Dt).fetch(this.options,t);return t!=null&&t.throwOnError||(r=r.catch(oi)),r},Xk=function(){Pt(this,Yt,eP).call(this);const t=gl(this.options.staleTime,Q(this,Dt));if(Wu||Q(this,ni).isStale||!Hk(t))return;const n=m3(Q(this,ni).dataUpdatedAt,t)+1;Fe(this,Cu,mu.setTimeout(()=>{Q(this,ni).isStale||this.updateResult()},n))},Yk=function(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(Q(this,Dt)):this.options.refetchInterval)??!1},Qk=function(t){Pt(this,Yt,tP).call(this),Fe(this,al,t),!(Wu||ho(this.options.enabled,Q(this,Dt))===!1||!Hk(Q(this,al))||Q(this,al)===0)&&Fe(this,ju,mu.setInterval(()=>{(this.options.refetchIntervalInBackground||Yj.isFocused())&&Pt(this,Yt,Dp).call(this)},Q(this,al)))},Jk=function(){Pt(this,Yt,Xk).call(this),Pt(this,Yt,Qk).call(this,Pt(this,Yt,Yk).call(this))},eP=function(){Q(this,Cu)&&(mu.clearTimeout(Q(this,Cu)),Fe(this,Cu,void 0))},tP=function(){Q(this,ju)&&(mu.clearInterval(Q(this,ju)),Fe(this,ju,void 0))},rP=function(){const t=Q(this,bi).getQueryCache().build(Q(this,bi),this.options);if(t===Q(this,Dt))return;const r=Q(this,Dt);Fe(this,Dt,t),Fe(this,kh,t.state),this.hasListeners()&&(r==null||r.removeObserver(this),t.addObserver(this))},$3=function(t){dn.batch(()=>{t.listeners&&this.listeners.forEach(r=>{r(Q(this,ni))}),Q(this,bi).getQueryCache().notify({query:Q(this,Dt),type:"observerResultsUpdated"})})},PL);function Sfe(e,t){return ho(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status==="error"&&t.retryOnMount===!1)}function aM(e,t){return Sfe(e,t)||e.state.data!==void 0&&nP(e,t,t.refetchOnMount)}function nP(e,t,r){if(ho(t.enabled,e)!==!1&&gl(t.staleTime,e)!=="static"){const n=typeof r=="function"?r(e):r;return n==="always"||n!==!1&&Qj(e,t)}return!1}function sM(e,t,r,n){return(e!==t||ho(n.enabled,e)===!1)&&(!r.suspense||e.state.status!=="error")&&Qj(e,r)}function Qj(e,t){return ho(t.enabled,e)!==!1&&e.isStaleByTime(gl(t.staleTime,e))}function kfe(e,t){return!cy(e.getCurrentResult(),t)}function fy(e){return{onFetch:(t,r)=>{var f,p,v,y,b;const n=t.options,i=(v=(p=(f=t.fetchOptions)==null?void 0:f.meta)==null?void 0:p.fetchMore)==null?void 0:v.direction,o=((y=t.state.data)==null?void 0:y.pages)||[],a=((b=t.state.data)==null?void 0:b.pageParams)||[];let s={pages:[],pageParams:[]},u=0;const d=async()=>{let w=!1;const x=P=>{Object.defineProperty(P,"signal",{enumerable:!0,get:()=>(t.signal.aborted?w=!0:t.signal.addEventListener("abort",()=>{w=!0}),t.signal)})},k=y3(t.options,t.fetchOptions),$=async(P,j,C)=>{if(w)return Promise.reject();if(j==null&&P.pages.length)return Promise.resolve(P);const A=(()=>{const D={client:t.client,queryKey:t.queryKey,pageParam:j,direction:C?"backward":"forward",meta:t.options.meta};return x(D),D})(),T=await k(A),{maxPages:M}=t.options,R=C?mfe:hfe;return{pages:R(P.pages,T,M),pageParams:R(P.pageParams,j,M)}};if(i&&o.length){const P=i==="backward",j=P?C3:iP,C={pages:o,pageParams:a},I=j(n,C);s=await $(C,I,P)}else{const P=e??o.length;do{const j=u===0?a[0]??n.initialPageParam:iP(n,s);if(u>0&&j==null)break;s=await $(s,j),u++}while(u<P)}return s};t.options.persister?t.fetchFn=()=>{var w,x;return(x=(w=t.options).persister)==null?void 0:x.call(w,d,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},r)}:t.fetchFn=d}}}function iP(e,{pages:t,pageParams:r}){const n=t.length-1;return t.length>0?e.getNextPageParam(t[n],t,r[n],r):void 0}function C3(e,{pages:t,pageParams:r}){var n;return t.length>0?(n=e.getPreviousPageParam)==null?void 0:n.call(e,t[0],t,r[0],r):void 0}function Pfe(e,t){return t?iP(e,t)!=null:!1}function $fe(e,t){return!t||!e.getPreviousPageParam?!1:C3(e,t)!=null}var Cfe=class extends P3{constructor(e,t){super(e,t)}bindMethods(){super.bindMethods(),this.fetchNextPage=this.fetchNextPage.bind(this),this.fetchPreviousPage=this.fetchPreviousPage.bind(this)}setOptions(e){super.setOptions({...e,behavior:fy()})}getOptimisticResult(e){return e.behavior=fy(),super.getOptimisticResult(e)}fetchNextPage(e){return this.fetch({...e,meta:{fetchMore:{direction:"forward"}}})}fetchPreviousPage(e){return this.fetch({...e,meta:{fetchMore:{direction:"backward"}}})}createResult(e,t){var b,w;const{state:r}=e,n=super.createResult(e,t),{isFetching:i,isRefetching:o,isError:a,isRefetchError:s}=n,u=(w=(b=r.fetchMeta)==null?void 0:b.fetchMore)==null?void 0:w.direction,d=a&&u==="forward",f=i&&u==="forward",p=a&&u==="backward",v=i&&u==="backward";return{...n,fetchNextPage:this.fetchNextPage,fetchPreviousPage:this.fetchPreviousPage,hasNextPage:Pfe(t,r.data),hasPreviousPage:$fe(t,r.data),isFetchNextPageError:d,isFetchingNextPage:f,isFetchPreviousPageError:p,isFetchingPreviousPage:v,isRefetchError:s&&!d&&!p,isRefetching:o&&!f&&!v}}},$h,fa,ii,Eu,pa,Xs,$L,jfe=($L=class extends S3{constructor(t){super();at(this,pa);at(this,$h);at(this,fa);at(this,ii);at(this,Eu);Fe(this,$h,t.client),this.mutationId=t.mutationId,Fe(this,ii,t.mutationCache),Fe(this,fa,[]),this.state=t.state||j3(),this.setOptions(t.options),this.scheduleGc()}setOptions(t){this.options=t,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(t){Q(this,fa).includes(t)||(Q(this,fa).push(t),this.clearGcTimeout(),Q(this,ii).notify({type:"observerAdded",mutation:this,observer:t}))}removeObserver(t){Fe(this,fa,Q(this,fa).filter(r=>r!==t)),this.scheduleGc(),Q(this,ii).notify({type:"observerRemoved",mutation:this,observer:t})}optionalRemove(){Q(this,fa).length||(this.state.status==="pending"?this.scheduleGc():Q(this,ii).remove(this))}continue(){var t;return((t=Q(this,Eu))==null?void 0:t.continue())??this.execute(this.state.variables)}async execute(t){var a,s,u,d,f,p,v,y,b,w,x,k,$,P,j,C,I,A,T,M;const r=()=>{Pt(this,pa,Xs).call(this,{type:"continue"})},n={client:Q(this,$h),meta:this.options.meta,mutationKey:this.options.mutationKey};Fe(this,Eu,w3({fn:()=>this.options.mutationFn?this.options.mutationFn(t,n):Promise.reject(new Error("No mutationFn found")),onFail:(R,D)=>{Pt(this,pa,Xs).call(this,{type:"failed",failureCount:R,error:D})},onPause:()=>{Pt(this,pa,Xs).call(this,{type:"pause"})},onContinue:r,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>Q(this,ii).canRun(this)}));const i=this.state.status==="pending",o=!Q(this,Eu).canStart();try{if(i)r();else{Pt(this,pa,Xs).call(this,{type:"pending",variables:t,isPaused:o}),await((s=(a=Q(this,ii).config).onMutate)==null?void 0:s.call(a,t,this,n));const D=await((d=(u=this.options).onMutate)==null?void 0:d.call(u,t,n));D!==this.state.context&&Pt(this,pa,Xs).call(this,{type:"pending",context:D,variables:t,isPaused:o})}const R=await Q(this,Eu).start();return await((p=(f=Q(this,ii).config).onSuccess)==null?void 0:p.call(f,R,t,this.state.context,this,n)),await((y=(v=this.options).onSuccess)==null?void 0:y.call(v,R,t,this.state.context,n)),await((w=(b=Q(this,ii).config).onSettled)==null?void 0:w.call(b,R,null,this.state.variables,this.state.context,this,n)),await((k=(x=this.options).onSettled)==null?void 0:k.call(x,R,null,t,this.state.context,n)),Pt(this,pa,Xs).call(this,{type:"success",data:R}),R}catch(R){try{throw await((P=($=Q(this,ii).config).onError)==null?void 0:P.call($,R,t,this.state.context,this,n)),await((C=(j=this.options).onError)==null?void 0:C.call(j,R,t,this.state.context,n)),await((A=(I=Q(this,ii).config).onSettled)==null?void 0:A.call(I,void 0,R,this.state.variables,this.state.context,this,n)),await((M=(T=this.options).onSettled)==null?void 0:M.call(T,void 0,R,t,this.state.context,n)),R}finally{Pt(this,pa,Xs).call(this,{type:"error",error:R})}}finally{Q(this,ii).runNext(this)}}},$h=new WeakMap,fa=new WeakMap,ii=new WeakMap,Eu=new WeakMap,pa=new WeakSet,Xs=function(t){const r=n=>{switch(t.type){case"failed":return{...n,failureCount:t.failureCount,failureReason:t.error};case"pause":return{...n,isPaused:!0};case"continue":return{...n,isPaused:!1};case"pending":return{...n,context:t.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:t.isPaused,status:"pending",variables:t.variables,submittedAt:Date.now()};case"success":return{...n,data:t.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...n,data:void 0,error:t.error,failureCount:n.failureCount+1,failureReason:t.error,isPaused:!1,status:"error"}}};this.state=r(this.state),dn.batch(()=>{Q(this,fa).forEach(n=>{n.onMutationUpdate(t)}),Q(this,ii).notify({mutation:this,type:"updated",action:t})})},$L);function j3(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var Ya,Uo,Ch,CL,Efe=(CL=class extends tf{constructor(t={}){super();at(this,Ya);at(this,Uo);at(this,Ch);this.config=t,Fe(this,Ya,new Set),Fe(this,Uo,new Map),Fe(this,Ch,0)}build(t,r,n){const i=new jfe({client:t,mutationCache:this,mutationId:++Ag(this,Ch)._,options:t.defaultMutationOptions(r),state:n});return this.add(i),i}add(t){Q(this,Ya).add(t);const r=Jg(t);if(typeof r=="string"){const n=Q(this,Uo).get(r);n?n.push(t):Q(this,Uo).set(r,[t])}this.notify({type:"added",mutation:t})}remove(t){if(Q(this,Ya).delete(t)){const r=Jg(t);if(typeof r=="string"){const n=Q(this,Uo).get(r);if(n)if(n.length>1){const i=n.indexOf(t);i!==-1&&n.splice(i,1)}else n[0]===t&&Q(this,Uo).delete(r)}}this.notify({type:"removed",mutation:t})}canRun(t){const r=Jg(t);if(typeof r=="string"){const n=Q(this,Uo).get(r),i=n==null?void 0:n.find(o=>o.state.status==="pending");return!i||i===t}else return!0}runNext(t){var n;const r=Jg(t);if(typeof r=="string"){const i=(n=Q(this,Uo).get(r))==null?void 0:n.find(o=>o!==t&&o.state.isPaused);return(i==null?void 0:i.continue())??Promise.resolve()}else return Promise.resolve()}clear(){dn.batch(()=>{Q(this,Ya).forEach(t=>{this.notify({type:"removed",mutation:t})}),Q(this,Ya).clear(),Q(this,Uo).clear()})}getAll(){return Array.from(Q(this,Ya))}find(t){const r={exact:!0,...t};return this.getAll().find(n=>tM(r,n))}findAll(t={}){return this.getAll().filter(r=>tM(t,r))}notify(t){dn.batch(()=>{this.listeners.forEach(r=>{r(t)})})}resumePausedMutations(){const t=this.getAll().filter(r=>r.state.isPaused);return dn.batch(()=>Promise.all(t.map(r=>r.continue().catch(oi))))}},Ya=new WeakMap,Uo=new WeakMap,Ch=new WeakMap,CL);function Jg(e){var t;return(t=e.options.scope)==null?void 0:t.id}var Qa,sl,xi,Ja,us,Tv,oP,jL,Ife=(jL=class extends tf{constructor(r,n){super();at(this,us);at(this,Qa);at(this,sl);at(this,xi);at(this,Ja);Fe(this,Qa,r),this.setOptions(n),this.bindMethods(),Pt(this,us,Tv).call(this)}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(r){var i;const n=this.options;this.options=Q(this,Qa).defaultMutationOptions(r),cy(this.options,n)||Q(this,Qa).getMutationCache().notify({type:"observerOptionsUpdated",mutation:Q(this,xi),observer:this}),n!=null&&n.mutationKey&&this.options.mutationKey&&Ku(n.mutationKey)!==Ku(this.options.mutationKey)?this.reset():((i=Q(this,xi))==null?void 0:i.state.status)==="pending"&&Q(this,xi).setOptions(this.options)}onUnsubscribe(){var r;this.hasListeners()||(r=Q(this,xi))==null||r.removeObserver(this)}onMutationUpdate(r){Pt(this,us,Tv).call(this),Pt(this,us,oP).call(this,r)}getCurrentResult(){return Q(this,sl)}reset(){var r;(r=Q(this,xi))==null||r.removeObserver(this),Fe(this,xi,void 0),Pt(this,us,Tv).call(this),Pt(this,us,oP).call(this)}mutate(r,n){var i;return Fe(this,Ja,n),(i=Q(this,xi))==null||i.removeObserver(this),Fe(this,xi,Q(this,Qa).getMutationCache().build(Q(this,Qa),this.options)),Q(this,xi).addObserver(this),Q(this,xi).execute(r)}},Qa=new WeakMap,sl=new WeakMap,xi=new WeakMap,Ja=new WeakMap,us=new WeakSet,Tv=function(){var n;const r=((n=Q(this,xi))==null?void 0:n.state)??j3();Fe(this,sl,{...r,isPending:r.status==="pending",isSuccess:r.status==="success",isError:r.status==="error",isIdle:r.status==="idle",mutate:this.mutate,reset:this.reset})},oP=function(r){dn.batch(()=>{var n,i,o,a,s,u,d,f;if(Q(this,Ja)&&this.hasListeners()){const p=Q(this,sl).variables,v=Q(this,sl).context,y={client:Q(this,Qa),meta:this.options.meta,mutationKey:this.options.mutationKey};(r==null?void 0:r.type)==="success"?((i=(n=Q(this,Ja)).onSuccess)==null||i.call(n,r.data,p,v,y),(a=(o=Q(this,Ja)).onSettled)==null||a.call(o,r.data,null,p,v,y)):(r==null?void 0:r.type)==="error"&&((u=(s=Q(this,Ja)).onError)==null||u.call(s,r.error,p,v,y),(f=(d=Q(this,Ja)).onSettled)==null||f.call(d,void 0,r.error,p,v,y))}this.listeners.forEach(p=>{p(Q(this,sl))})})},jL),ha,EL,Ofe=(EL=class extends tf{constructor(t={}){super();at(this,ha);this.config=t,Fe(this,ha,new Map)}build(t,r,n){const i=r.queryKey,o=r.queryHash??Zj(i,r);let a=this.get(o);return a||(a=new wfe({client:t,queryKey:i,queryHash:o,options:t.defaultQueryOptions(r),state:n,defaultOptions:t.getQueryDefaults(i)}),this.add(a)),a}add(t){Q(this,ha).has(t.queryHash)||(Q(this,ha).set(t.queryHash,t),this.notify({type:"added",query:t}))}remove(t){const r=Q(this,ha).get(t.queryHash);r&&(t.destroy(),r===t&&Q(this,ha).delete(t.queryHash),this.notify({type:"removed",query:t}))}clear(){dn.batch(()=>{this.getAll().forEach(t=>{this.remove(t)})})}get(t){return Q(this,ha).get(t)}getAll(){return[...Q(this,ha).values()]}find(t){const r={exact:!0,...t};return this.getAll().find(n=>eM(r,n))}findAll(t={}){const r=this.getAll();return Object.keys(t).length>0?r.filter(n=>eM(t,n)):r}notify(t){dn.batch(()=>{this.listeners.forEach(r=>{r(t)})})}onFocus(){dn.batch(()=>{this.getAll().forEach(t=>{t.onFocus()})})}onOnline(){dn.batch(()=>{this.getAll().forEach(t=>{t.onOnline()})})}},ha=new WeakMap,EL),Br,ll,ul,bd,xd,cl,wd,Sd,IL,_fe=(IL=class{constructor(e={}){at(this,Br);at(this,ll);at(this,ul);at(this,bd);at(this,xd);at(this,cl);at(this,wd);at(this,Sd);Fe(this,Br,e.queryCache||new Ofe),Fe(this,ll,e.mutationCache||new Efe),Fe(this,ul,e.defaultOptions||{}),Fe(this,bd,new Map),Fe(this,xd,new Map),Fe(this,cl,0)}mount(){Ag(this,cl)._++,Q(this,cl)===1&&(Fe(this,wd,Yj.subscribe(async e=>{e&&(await this.resumePausedMutations(),Q(this,Br).onFocus())})),Fe(this,Sd,dy.subscribe(async e=>{e&&(await this.resumePausedMutations(),Q(this,Br).onOnline())})))}unmount(){var e,t;Ag(this,cl)._--,Q(this,cl)===0&&((e=Q(this,wd))==null||e.call(this),Fe(this,wd,void 0),(t=Q(this,Sd))==null||t.call(this),Fe(this,Sd,void 0))}isFetching(e){return Q(this,Br).findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return Q(this,ll).findAll({...e,status:"pending"}).length}getQueryData(e){var r;const t=this.defaultQueryOptions({queryKey:e});return(r=Q(this,Br).get(t.queryHash))==null?void 0:r.state.data}ensureQueryData(e){const t=this.defaultQueryOptions(e),r=Q(this,Br).build(this,t),n=r.state.data;return n===void 0?this.fetchQuery(e):(e.revalidateIfStale&&r.isStaleByTime(gl(t.staleTime,r))&&this.prefetchQuery(t),Promise.resolve(n))}getQueriesData(e){return Q(this,Br).findAll(e).map(({queryKey:t,state:r})=>{const n=r.data;return[t,n]})}setQueryData(e,t,r){const n=this.defaultQueryOptions({queryKey:e}),i=Q(this,Br).get(n.queryHash),o=i==null?void 0:i.state.data,a=dfe(t,o);if(a!==void 0)return Q(this,Br).build(this,n).setData(a,{...r,manual:!0})}setQueriesData(e,t,r){return dn.batch(()=>Q(this,Br).findAll(e).map(({queryKey:n})=>[n,this.setQueryData(n,t,r)]))}getQueryState(e){var r;const t=this.defaultQueryOptions({queryKey:e});return(r=Q(this,Br).get(t.queryHash))==null?void 0:r.state}removeQueries(e){const t=Q(this,Br);dn.batch(()=>{t.findAll(e).forEach(r=>{t.remove(r)})})}resetQueries(e,t){const r=Q(this,Br);return dn.batch(()=>(r.findAll(e).forEach(n=>{n.reset()}),this.refetchQueries({type:"active",...e},t)))}cancelQueries(e,t={}){const r={revert:!0,...t},n=dn.batch(()=>Q(this,Br).findAll(e).map(i=>i.cancel(r)));return Promise.all(n).then(oi).catch(oi)}invalidateQueries(e,t={}){return dn.batch(()=>(Q(this,Br).findAll(e).forEach(r=>{r.invalidate()}),(e==null?void 0:e.refetchType)==="none"?Promise.resolve():this.refetchQueries({...e,type:(e==null?void 0:e.refetchType)??(e==null?void 0:e.type)??"active"},t)))}refetchQueries(e,t={}){const r={...t,cancelRefetch:t.cancelRefetch??!0},n=dn.batch(()=>Q(this,Br).findAll(e).filter(i=>!i.isDisabled()&&!i.isStatic()).map(i=>{let o=i.fetch(void 0,r);return r.throwOnError||(o=o.catch(oi)),i.state.fetchStatus==="paused"?Promise.resolve():o}));return Promise.all(n).then(oi)}fetchQuery(e){const t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);const r=Q(this,Br).build(this,t);return r.isStaleByTime(gl(t.staleTime,r))?r.fetch(t):Promise.resolve(r.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(oi).catch(oi)}fetchInfiniteQuery(e){return e.behavior=fy(e.pages),this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(oi).catch(oi)}ensureInfiniteQueryData(e){return e.behavior=fy(e.pages),this.ensureQueryData(e)}resumePausedMutations(){return dy.isOnline()?Q(this,ll).resumePausedMutations():Promise.resolve()}getQueryCache(){return Q(this,Br)}getMutationCache(){return Q(this,ll)}getDefaultOptions(){return Q(this,ul)}setDefaultOptions(e){Fe(this,ul,e)}setQueryDefaults(e,t){Q(this,bd).set(Ku(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){const t=[...Q(this,bd).values()],r={};return t.forEach(n=>{ih(e,n.queryKey)&&Object.assign(r,n.defaultOptions)}),r}setMutationDefaults(e,t){Q(this,xd).set(Ku(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){const t=[...Q(this,xd).values()],r={};return t.forEach(n=>{ih(e,n.mutationKey)&&Object.assign(r,n.defaultOptions)}),r}defaultQueryOptions(e){if(e._defaulted)return e;const t={...Q(this,ul).queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||(t.queryHash=Zj(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===Xj&&(t.enabled=!1),t}defaultMutationOptions(e){return e!=null&&e._defaulted?e:{...Q(this,ul).mutations,...(e==null?void 0:e.mutationKey)&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){Q(this,Br).clear(),Q(this,ll).clear()}},Br=new WeakMap,ll=new WeakMap,ul=new WeakMap,bd=new WeakMap,xd=new WeakMap,cl=new WeakMap,wd=new WeakMap,Sd=new WeakMap,IL),Afe=m.createContext(void 0),E3=e=>{const t=m.useContext(Afe);if(e)return e;if(!t)throw new Error("No QueryClient set, use QueryClientProvider to set one");return t},I3=m.createContext(!1),Tfe=()=>m.useContext(I3);I3.Provider;function Mfe(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var Rfe=m.createContext(Mfe()),Dfe=()=>m.useContext(Rfe),zfe=(e,t)=>{(e.suspense||e.throwOnError||e.experimental_prefetchInRender)&&(t.isReset()||(e.retryOnMount=!1))},Nfe=e=>{m.useEffect(()=>{e.clearReset()},[e])},Lfe=({result:e,errorResetBoundary:t,throwOnError:r,query:n,suspense:i})=>e.isError&&!t.isReset()&&!e.isFetching&&n&&(i&&e.data===void 0||b3(r,[e.error,n])),Bfe=e=>{if(e.suspense){const r=i=>i==="static"?i:Math.max(i??1e3,1e3),n=e.staleTime;e.staleTime=typeof n=="function"?(...i)=>r(n(...i)):r(n),typeof e.gcTime=="number"&&(e.gcTime=Math.max(e.gcTime,1e3))}},Ffe=(e,t)=>e.isLoading&&e.isFetching&&!t,Ufe=(e,t)=>(e==null?void 0:e.suspense)&&t.isPending,lM=(e,t,r)=>t.fetchOptimistic(e).catch(()=>{r.clearReset()});function O3(e,t,r){var p,v,y,b,w;const n=Tfe(),i=Dfe(),o=E3(r),a=o.defaultQueryOptions(e);(v=(p=o.getDefaultOptions().queries)==null?void 0:p._experimental_beforeQuery)==null||v.call(p,a),a._optimisticResults=n?"isRestoring":"optimistic",Bfe(a),zfe(a,i),Nfe(i);const s=!o.getQueryCache().get(a.queryHash),[u]=m.useState(()=>new t(o,a)),d=u.getOptimisticResult(a),f=!n&&e.subscribed!==!1;if(m.useSyncExternalStore(m.useCallback(x=>{const k=f?u.subscribe(dn.batchCalls(x)):oi;return u.updateResult(),k},[u,f]),()=>u.getCurrentResult(),()=>u.getCurrentResult()),m.useEffect(()=>{u.setOptions(a)},[a,u]),Ufe(a,d))throw lM(a,u,i);if(Lfe({result:d,errorResetBoundary:i,throwOnError:a.throwOnError,query:o.getQueryCache().get(a.queryHash),suspense:a.suspense}))throw d.error;if((b=(y=o.getDefaultOptions().queries)==null?void 0:y._experimental_afterQuery)==null||b.call(y,a,d),a.experimental_prefetchInRender&&!Wu&&Ffe(d,n)){const x=s?lM(a,u,i):(w=o.getQueryCache().get(a.queryHash))==null?void 0:w.promise;x==null||x.catch(oi).finally(()=>{u.updateResult()})}return a.notifyOnChangeProps?d:u.trackResult(d)}function Wfe(e,t){return O3(e,P3,t)}function Kfe(e,t){const r=E3(t),[n]=m.useState(()=>new Ife(r,e));m.useEffect(()=>{n.setOptions(e)},[n,e]);const i=m.useSyncExternalStore(m.useCallback(a=>n.subscribe(dn.batchCalls(a)),[n]),()=>n.getCurrentResult(),()=>n.getCurrentResult()),o=m.useCallback((a,s)=>{n.mutate(a,s).catch(oi)},[n]);if(i.error&&b3(n.options.throwOnError,[i.error]))throw i.error;return{...i,mutate:o,mutateAsync:i.mutate}}function Hfe(e,t){return O3(e,Cfe,t)}var Jj=class extends Error{constructor({res:e,url:t,body:{message:r}}){super(`[${e.status}] ${e.statusText}${r?` - ${r}`:""}`),this.name="HttpError",this.status=e.status,this.statusText=e.statusText,this.url=t,this.body={message:r},this.headers=e.headers?Object.fromEntries(e.headers.entries()):{}}},_3=async e=>{const t={...e.headers??{}},r=typeof FormData<"u"&&e.body instanceof FormData;r||(t["Content-Type"]||(t["Content-Type"]="application/json"),t.Accept||(t.Accept="application/json"));const n=await fetch(e.url,{method:e.method,headers:t,body:r?e.body:e.body==null?void 0:JSON.stringify(e.body)}),i=await n.json();if(!n.ok)throw new Jj({res:n,url:e.url,body:i});try{return{data:i,headers:n.headers?Object.fromEntries(n.headers.entries()):{},status:n.status}}catch{return{data:i,headers:n.headers?Object.fromEntries(n.headers.entries()):{},status:n.status}}},ox=e=>e.toUpperCase();function A3(e){if(!e)return"";const t=new URLSearchParams;for(const[n,i]of Object.entries(e))if(i!=null){if(typeof i=="string"){t.append(n,i);continue}if(typeof i=="number"||typeof i=="boolean"){t.append(n,String(i));continue}t.append(n,JSON.stringify(i))}const r=t.toString();return r?`?${r}`:""}function Vfe(e,t){if(!e)return e;const{[t]:r,...n}=e;return n}var qfe=e=>{if(!e||typeof e!="object")return;const t=e;if("nextCursor"in t)return t.nextCursor;if("meta"in t){const r=t.meta;if(r&&typeof r=="object"&&"nextCursor"in r)return r.nextCursor}};function Dd(e){return e[0]}function eE(e){return typeof e>"u"?[]:[e]}function py(e,t,r,n){const i=e.cfg.paramsSchema?kl(e.cfg.paramsSchema,r):{},o=e.cfg.querySchema?kl(e.cfg.querySchema,n):{},a=h3(e.path,i??{});return{url:`${t??""}${a}${A3(o)}`,normalizedQuery:o,normalizedParams:i}}function tE(e){const t=new FormData;for(const[r,n]of Object.entries(e??{}))n!=null&&(Array.isArray(n)?n.forEach((i,o)=>t.append(`${r}[${o}]`,i)):t.append(r,n));return t}function Gfe(e){const t=new Set,r=/:([A-Za-z0-9_]+)/g;let n;for(;(n=r.exec(e))!==null;)t.add(n[1]);return t}function Zfe(e){if(e==null)return;if(typeof e!="object"||Array.isArray(e))throw new Error("Query must be a plain object (Record<string, string>).");const t={};for(const[r,n]of Object.entries(e))if(n!=null){if(typeof n!="string")throw new Error(`Query param "${r}" must be a string; received type "${typeof n}".`);t[r]=n}return Object.keys(t).length>0?t:void 0}function Xfe(e,t){const r=Gfe(e);if(!t||typeof t!="object"||Array.isArray(t)){if(r.size>0)throw new Error(`Missing path parameters for "${e}": ${[...r].join(", ")}`);return e}const n=t,i=new Set(Object.keys(n));for(const o of i){if(!r.has(o))throw new Error(`Unexpected path parameter "${o}" for template "${e}".`);const a=n[o];if(a!=null&&(typeof a=="object"||Array.isArray(a)))throw new Error(`Path parameter "${o}" must be a primitive; received "${typeof a}".`)}for(const o of r)if(!i.has(o))throw new Error(`Missing value for path parameter "${o}" in template "${e}".`);return r.size===0?e:h3(e,n)}function Yfe(e,t,r){const n=e.cfg,i=ox(e.method),o=!!(n.paramsSchema||n.querySchema),{baseUrl:a,validateResponses:s,fetcher:u,queryClient:d,emit:f,decorateDebugEvent:p,isVerboseDebug:v,leafLabel:y}=r;f({type:"build",leaf:y});const b=(...C)=>{const I=Dd(C),A=I==null?void 0:I.params,T=I==null?void 0:I.query;return Gj({leaf:e,params:A,query:T})},w=async(...C)=>{const I=b(...C);await d.invalidateQueries({queryKey:I,exact:!0}),f({type:"invalidate",key:I,exact:!0})},x=(...C)=>{const[I,...A]=C,T=b(...A),M=d.setQueryData(T,R=>typeof I=="function"?I(R):I);return f({type:"setData",key:T}),M},k=(t==null?void 0:t.onReceive)??void 0,$=async(C,I)=>{var V;const A=Dd(C),T=A==null?void 0:A.params,M={...(A==null?void 0:A.query)??{},...(I==null?void 0:I.queryOverride)??{}},{url:R,normalizedQuery:D,normalizedParams:O}=py({...e,cfg:n},a,T,M);let L;const z=!!n.bodySchema,F=(I==null?void 0:I.requireBody)??!!z;if(typeof(I==null?void 0:I.body)<"u"){const K=n.bodySchema?kl(n.bodySchema,I.body):void 0;Array.isArray(n.bodyFiles)&&n.bodyFiles.length>0&&K&&typeof K=="object"?L=tE(K):L=K}else if(F&&z)throw new Error("Body is required when invoking a mutation fetch.");const B=Date.now(),U=v?{params:T,normalizedParams:O,query:M,normalizedQuery:D,baseUrl:a}:void 0;f(p({type:"fetch",stage:"start",method:i,url:R,leaf:y,...L!==void 0?{body:L}:{}},U));try{const K=await u(L===void 0?{url:R,method:i}:{url:R,method:i,body:L});if(f(p({type:"fetch",stage:"fetched",method:i,url:R,leaf:y,durationMs:Date.now()-B},v?{params:O,query:D,output:K}:void 0)),s){if(!n.outputSchema)throw new Error(`No output schema defined for leaf ${y}, cannot validate response.`);K.data=kl(n.outputSchema,K.data),f(p({type:"fetch",stage:"parsed",method:i,url:R,leaf:y,durationMs:Date.now()-B},v?{params:O,query:D,output:K}:void 0))}return(V=I==null?void 0:I.onReceive)==null||V.call(I,K.data),K.data}catch(K){throw f(p({type:"fetch",stage:"error",method:i,url:R,leaf:y,durationMs:Date.now()-B,...L!==void 0?{body:L}:{},error:K},U)),K}};return{getQueryKeys:b,invalidate:w,setData:x,useEndpoint:(...C)=>{const I=C[0],A=eE(I),T=b(...A);f({type:"useEndpoint",leaf:y,variant:"get",keys:T});const M=t??{},R=m.useRef(new Set),D=m.useCallback(z=>{var F;(F=M==null?void 0:M.onReceive)==null||F.call(M,z),R.current.forEach(B=>B(z))},[]),O=m.useCallback(z=>(R.current.add(z),()=>{R.current.delete(z)}),[]);return{...Wfe({...M,queryKey:b(...A),placeholderData:v3,queryFn:()=>$(A,{onReceive:D})},d),onReceive:O}},fetch:(...C)=>{const I=!!n.bodySchema,A=C.length,M=I&&A>(o?1:0),R=M?C[A-1]:void 0,D=M?C.slice(0,A-1):C;return $(D,{body:R,onReceive:k,requireBody:!1})}}}function T3(e,t){if(e==null)return t;if(t==null)return e;if(Array.isArray(e)&&Array.isArray(t))return[...e,...t];if(typeof e!="object"||typeof t!="object")return t;const r={...e};for(const n of Object.keys(t)){const i=e[n],o=t[n];if(Array.isArray(i)&&Array.isArray(o)){r[n]=[...i,...o];continue}if(i&&typeof i=="object"&&!Array.isArray(i)&&o&&typeof o=="object"&&!Array.isArray(o)){n==="meta"?r[n]=T3(i,o):r[n]=o;continue}r[n]=o}return r}function Qfe(e,t,r){const n=e.cfg,i=ox(e.method),o=!!(n.paramsSchema||n.querySchema),{baseUrl:a,validateResponses:s,fetcher:u,queryClient:d,emit:f,decorateDebugEvent:p,isVerboseDebug:v,leafLabel:y}=r;f({type:"build",leaf:y});const b=t??{},{cursorParam:w,getNextPageParam:x,initialPageParam:k,splitPageSize:$,splitPageSizeParam:P,...j}=b,C=w??"pagination_cursor",I=x??(K=>qfe(K)),A=K=>I(K),T=typeof k>"u"?void 0:k,M=j,R=typeof $=="number"&&$>0?$:void 0,D=P??"pageSize",O=(...K)=>{const Z=Dd(K),W=Z==null?void 0:Z.params,q=Z==null?void 0:Z.query,oe=Vfe(q,C);return Gj({leaf:e,params:W,query:oe})},L=async(...K)=>{const Z=O(...K);await d.invalidateQueries({queryKey:Z,exact:!0}),f({type:"invalidate",key:Z,exact:!0})},z=(...K)=>{const[Z,...W]=K,q=O(...W),oe=d.setQueryData(q,Y=>typeof Z=="function"?Z(Y):Z);return f({type:"setData",key:q}),oe},F=(t==null?void 0:t.onReceive)??void 0,B=async(K,Z)=>{var se;const W=Dd(K),q=W==null?void 0:W.params,oe={...(W==null?void 0:W.query)??{},...(Z==null?void 0:Z.queryOverride)??{}},{url:Y,normalizedQuery:H,normalizedParams:X}=py({...e,cfg:n},a,q,oe);let re;const he=!!n.bodySchema,J=(Z==null?void 0:Z.requireBody)??!!he;if(typeof(Z==null?void 0:Z.body)<"u"){const Pe=n.bodySchema?kl(n.bodySchema,Z.body):void 0;Array.isArray(n.bodyFiles)&&n.bodyFiles.length>0&&Pe&&typeof Pe=="object"?re=tE(Pe):re=Pe}else if(J&&he)throw new Error("Body is required when invoking a mutation fetch.");const ge=Date.now(),Se=v?{params:q,normalizedParams:X,query:oe,normalizedQuery:H,baseUrl:a}:void 0;f(p({type:"fetch",stage:"start",method:i,url:Y,leaf:y,...re!==void 0?{body:re}:{}},Se));try{const Pe=await u(re===void 0?{url:Y,method:i}:{url:Y,method:i,body:re});if(f(p({type:"fetch",stage:"fetched",method:i,url:Y,leaf:y,durationMs:Date.now()-ge},v?{params:X,query:H,output:Pe}:void 0)),s){if(!n.outputSchema)throw new Error(`No output schema defined for leaf ${y}, cannot validate response.`);Pe.data=kl(n.outputSchema,Pe.data),f(p({type:"fetch",stage:"parsed",method:i,url:Y,leaf:y,durationMs:Date.now()-ge},v?{params:X,query:H,output:Pe}:void 0))}return(se=Z==null?void 0:Z.onReceive)==null||se.call(Z,Pe.data),Pe.data}catch(Pe){throw f(p({type:"fetch",stage:"error",method:i,url:Y,leaf:y,durationMs:Date.now()-ge,...re!==void 0?{body:re}:{},error:Pe},Se)),Pe}};return{getQueryKeys:O,invalidate:L,setData:z,useEndpoint:(...K)=>{const Z=K[0],W=eE(Z),q=O(...W);f({type:"useEndpoint",leaf:y,variant:"infiniteGet",keys:q});const oe=Z==null?void 0:Z.params,Y=Z==null?void 0:Z.query,H=M??{},X=m.useRef(new Set),re=m.useCallback(Se=>{var se;(se=H==null?void 0:H.onReceive)==null||se.call(H,Se),X.current.forEach(Pe=>Pe(Se))},[]),he=m.useCallback(Se=>(X.current.add(Se),()=>{X.current.delete(Se)}),[]),{normalizedQuery:J}=py({...e,cfg:n},a,oe,Y);return{...Hfe({...H,placeholderData:H.placeholderData??v3,initialPageParam:T,getNextPageParam:Se=>A(Se),queryKey:q,queryFn:({pageParam:Se})=>{if(!R){const ze={...J,...Se?{[C]:Se}:{}};return B(W,{queryOverride:ze,onReceive:re})}const se=J==null?void 0:J[D],Pe=typeof se=="number"?se:se!=null?Number(se):void 0;if(!Pe||!Number.isFinite(Pe)||Pe<=R){const ze={...J,...Se?{[C]:Se}:{}};return B(W,{queryOverride:ze,onReceive:re})}const ke=Pe,$e=Se;return(async()=>{let ze=ke,je=Se,it;for(;ze>0;){const qe=Math.min(ze,R),ot={...J,...je?{[C]:je}:{},[D]:qe},Re=await B(W,{queryOverride:ot,onReceive:re});it=it?T3(it,Re):Re,ze-=qe;const Qt=A(Re);je=Qt;const xt=q;if(d.setQueryData(xt,Tt=>{if(!it)return Tt;if(!Tt)return{pages:[it],pageParams:[$e]};const Lt=Tt.pageParams.findIndex(Bt=>Bt===$e||Bt==null&&$e==null);if(Lt===-1)return{pages:[...Tt.pages,it],pageParams:[...Tt.pageParams,$e]};const Jt=[...Tt.pages];return Jt[Lt]=it,{...Tt,pages:Jt}}),!Qt)break}return it})()}},d),onReceive:he}},fetch:(...K)=>{const Z=!!n.bodySchema,W=K.length,oe=Z&&W>(o?1:0),Y=oe?K[W-1]:void 0,H=oe?K.slice(0,W-1):K;return B(H,{body:Y,onReceive:F,requireBody:!1})}}}function Jfe(e,t,r){const n=e.cfg,i=ox(e.method);n.paramsSchema||n.querySchema;const{baseUrl:o,validateResponses:a,fetcher:s,queryClient:u,emit:d,decorateDebugEvent:f,isVerboseDebug:p,leafLabel:v}=r;d({type:"build",leaf:v});const y=(...j)=>{const C=Dd(j),I=C==null?void 0:C.params,A=C==null?void 0:C.query;return Gj({leaf:e,params:I,query:A})},b=async(...j)=>{const C=y(...j);await u.invalidateQueries({queryKey:C,exact:!0}),d({type:"invalidate",key:C,exact:!0})},w=(...j)=>{const[C,...I]=j,A=y(...I),T=u.setQueryData(A,M=>typeof C=="function"?C(M):C);return d({type:"setData",key:A}),T},x=t??{},k=async(j,C)=>{var B;const I=Dd(j),A=I==null?void 0:I.params,T={...(I==null?void 0:I.query)??{},...(C==null?void 0:C.queryOverride)??{}},{url:M,normalizedQuery:R,normalizedParams:D}=py({...e,cfg:n},o,A,T);let O;const L=!!n.bodySchema;if(typeof(C==null?void 0:C.body)<"u"){const U=n.bodySchema?kl(n.bodySchema,C.body):void 0;Array.isArray(n.bodyFiles)&&n.bodyFiles.length>0&&U&&typeof U=="object"?O=tE(U):O=U}else if(L)throw new Error("Body is required when invoking a mutation fetch.");const z=Date.now(),F=p?{params:A,normalizedParams:D,query:T,normalizedQuery:R,baseUrl:o}:void 0;d(f({type:"fetch",stage:"start",method:i,url:M,leaf:v,...O!==void 0?{body:O}:{}},F));try{const U=await s(O===void 0?{url:M,method:i}:{url:M,method:i,body:O});if(d(f({type:"fetch",stage:"fetched",method:i,url:M,leaf:v,durationMs:Date.now()-z},p?{params:D,query:R,output:U}:void 0)),a){if(!n.outputSchema)throw new Error(`No output schema defined for leaf ${v}, cannot validate response.`);U.data=kl(n.outputSchema,U.data),d(f({type:"fetch",stage:"parsed",method:i,url:M,leaf:v,durationMs:Date.now()-z},p?{params:D,query:R,output:U}:void 0))}return(B=C==null?void 0:C.onReceive)==null||B.call(C,U.data),U.data}catch(U){throw d(f({type:"fetch",stage:"error",method:i,url:M,leaf:v,durationMs:Date.now()-z,...O!==void 0?{body:O}:{},error:U},F)),U}},$=async(...j)=>{if(j.length===0)throw new Error("Body is required when invoking a mutation fetch.");const C=j.length-1,I=j.slice(0,C),A=j[C];return await k(I,{body:A,onReceive:M=>{var R;return(R=x==null?void 0:x.onReceive)==null?void 0:R.call(x,M)},requireBody:!0})};return{getQueryKeys:y,invalidate:b,setData:w,useEndpoint:(...j)=>{const C=j[0],I=eE(C),A=y(...I);d({type:"useEndpoint",leaf:v,variant:"mutation",keys:A});const T=m.useRef(new Set),M=m.useCallback(O=>{T.current.forEach(L=>L(O))},[]),R=m.useCallback(O=>(T.current.add(O),()=>{T.current.delete(O)}),[]);return{...Kfe({...x??{},mutationKey:A,mutationFn:async O=>{const L=await $(...I,O);return M(L),L}},u),onReceive:R}},fetch:$}}var cS=e=>{if(typeof console>"u")return;const t=console.debug??console.log;t==null||t.call(console,"[rrroutes-client]",e)},epe=["fetch","invalidate","setData","build","useEndpoint"],uM=()=>{};function tpe(e,t){const r={emit:uM,mode:"minimal"};if(t&&t.toLowerCase()==="production"||!e)return r;if(e===!0||e==="minimal")return{emit:(n,i)=>cS(i?{...n,name:i}:n),mode:"minimal"};if(e==="complete")return{emit:(n,i)=>cS(i?{...n,name:i}:n),mode:"complete"};if(typeof e=="function")return{emit:(n,i)=>e(i?{...n,name:i}:n),mode:"minimal"};if(typeof e=="object"){const n=e,i=!!n.verbose,o=epe.filter(f=>n[f]);if(o.length===0)return{emit:uM,mode:i?"complete":"minimal"};const a=new Set(o),s=n.only&&n.only.length>0?new Set(n.only):void 0,u=n.logger??cS;return{emit:(f,p)=>{a.has(f.type)&&(s&&(!p||!s.has(p))||u(p?{...f,name:p}:f))},mode:i?"complete":"minimal"}}return r}function rpe(e){const t=e.queryClient,r=e.fetcher??_3,n=e.baseUrl,i=e.environment??void 0,{emit:o,mode:a}=tpe(e.debug,i),s=a==="complete",u=(v,y)=>!s||!y?v:{...v,...y};async function d(v,y=!1){const b=v;await t.invalidateQueries({queryKey:b,exact:y}),o({type:"invalidate",key:b,exact:y})}function f(v,y,b){const w=`${v.method.toUpperCase()} ${String(v.path)}`,x=b==null?void 0:b.name,k=I=>o(I,x),$=v.method==="get",P=!!v.cfg.feed,j=e.validateResponses,C={baseUrl:n,validateResponses:j,fetcher:r,queryClient:t,emit:k,decorateDebugEvent:u,isVerboseDebug:s,leafLabel:w};return $&&P?Qfe(v,y,C):$?Yfe(v,y,C):Jfe(v,y,C)}return{queryClient:t,invalidate:d,fetch:async v=>{const{path:y,method:b,query:w,body:x,params:k}=v;if(!y||typeof y!="string")throw new Error("fetch(path, ...) requires a non-empty string path.");if(!b)throw new Error("fetch(path, method, ...) requires an HTTP method.");const $=String(b).toLowerCase(),P=ox($),j=Zfe(w),C=A3(j),I=Xfe(y,k),A=`${n??""}${I}${C}`,T=`${P} ${y}`,M=Date.now(),R=s?{params:k,flatQuery:j,query:w,baseUrl:n}:void 0;o(u({type:"fetch",stage:"start",method:P,url:A,leaf:T,...x!==void 0?{body:x}:{}},R));try{const D=await r(x===void 0?{url:A,method:P}:{url:A,method:P,body:x});return o(u({type:"fetch",stage:"fetched",method:P,url:A,leaf:T,durationMs:Date.now()-M},s?{params:k,query:j,output:D}:void 0)),D}catch(D){throw o(u({type:"fetch",stage:"error",method:P,url:A,leaf:T,durationMs:Date.now()-M,...x!==void 0?{body:x}:{},error:D},R)),D}},build:f}}nx([Qh(Uu()),Uu()]);m.createContext(null);const M3=m.createContext(null),cM="rrroutes.docs.baseUrl";function npe({children:e,initialBaseUrl:t}){const[r,n]=m.useState([]),i=typeof window<"u"?window.localStorage.getItem(cM):null,[o,a]=m.useState(i||t);m.useEffect(()=>{typeof window<"u"&&window.localStorage.setItem(cM,o)},[o]);const s=m.useMemo(()=>new _fe({defaultOptions:{queries:{retry:!1}}}),[]),u=m.useMemo(()=>rpe({baseUrl:o,queryClient:s,fetcher:async v=>_3(v),validateResponses:!0}),[o,s]),d=m.useMemo(()=>({id:v,method:y,path:b})=>{console.log(v);const w=r.filter(x=>(console.log(x.id),x.log.method===y&&x.log.path===b&&(v?x.id===v:!0)));if(w.length>0)return w[w.length-1]},[r]),f=m.useMemo(()=>async(v,y,b,w)=>{const x=Date.now();let k,$,P=-1,j={};try{const A=await u.fetch({method:v,path:y,body:b.body&&b.body.trim().length>0?JSON.parse(b.body):void 0,query:b.query.reduce((T,M)=>(M.key.trim().length>0&&M.value&&M.enabled&&(T[M.key]=M.value),T),{}),params:b.params.reduce((T,M)=>(M.key.trim().length>0&&M.value&&M.enabled&&(T[M.key]=M.value),T),{})});k=A.data,P=A.status,j=A.headers}catch(A){A instanceof Jj?(P=A.status,j=A.headers,$={message:A.body.message,stack:A.stack,name:A.name}):A instanceof Error?$={message:JSON.stringify(A.message),stack:A.stack,name:A.name}:$={message:"An unknown error occurred"}}const C=Date.now(),I={id:w,error:$,log:{durationMs:C-x,method:v,path:y,status:P,name:`${v.toUpperCase()} ${y}`,updatedAt:C,createdAt:x,id:`local-${Math.random().toString(36).substring(2,9)}`,body:b.body?JSON.parse(b.body):void 0,params:b.params.reduce((A,T)=>(T.key.trim().length>0&&T.value&&T.enabled&&(A[T.key]=T.value),A),{}),query:b.query.reduce((A,T)=>(T.key.trim().length>0&&T.value&&T.enabled&&(A[T.key]=T.value),A),{}),headers:j,error:$==null?void 0:$.message,output:k,groupId:void 0,tags:[],fullUrl:""}};return n(A=>[...A,I]),I},[]),p=m.useMemo(()=>({client:u,queryClient:s,baseUrl:o,headers:{},setBaseUrl:a,runs:r,getLastRun:d,fetch:f}),[o,f,d,r,u]);return h.jsx(M3.Provider,{value:p,children:e})}function rf(){const e=m.useContext(M3);if(!e)throw new Error("useHistoryStore must be used within HistoryProvider");return e}const ax=["get","post","put","patch","delete"],Hu=ie.enum(ax),nf=ie.object({id:ie.string(),name:ie.string(),description:ie.string().optional(),groupId:ie.string().optional(),tags:ie.string().array().optional(),createdAt:ie.number(),updatedAt:ie.number()}),lc=ie.object({beforeDate:ie.string().optional(),afterDate:ie.string().optional(),orderBy:ie.enum(["timestamp","duration","level","path"]).optional(),orderDirection:ie.enum(["asc","desc"]).optional(),searchQuery:ie.string().optional(),groupsInclude:ie.string().array().optional(),groupsExclude:ie.string().array().optional(),tagsInclude:ie.string().array().optional(),tagsExclude:ie.string().array().optional()}),of=ie.object({cursor:ie.string().optional(),pageSize:ie.coerce.number().optional()}),af=ie.object({totalCount:ie.number().optional(),nextCursor:ie.string().optional()}),R3=["hit","miss","set","delete"],aP=ie.enum(R3),D3=nf.extend({operation:aP,value:ie.any().nullable(),size:ie.number().optional(),durationMs:ie.number().optional()}),dM=lc.extend({operationsInclude:aP.array().optional(),operationsExclude:aP.array().optional(),keys:ie.array(ie.string()).optional(),keySearch:ie.string().optional()});ie.object({key:ie.string(),lastSetAt:ie.number().nullable(),lastHitAt:ie.number().nullable(),lastMissAt:ie.number().nullable(),totalHits:ie.number(),totalMisses:ie.number(),totalSets:ie.number(),sizeBytes:ie.number().optional()});const ipe=ie.object({key:ie.string(),currentSizeBytes:ie.number().nullable(),lastSetAt:ie.number().nullable(),lastDeleteAt:ie.number().nullable(),lastHitAt:ie.number().nullable(),lastMissAt:ie.number().nullable(),lastActivityAt:ie.number().nullable(),totalHits:ie.number(),totalMisses:ie.number(),totalSets:ie.number(),totalDeletes:ie.number(),hitsSinceLastSet:ie.number(),missesSinceLastSet:ie.number(),deletesSinceLastSet:ie.number(),avgTimeBetweenSetsMs:ie.number().nullable(),avgHitsBetweenSets:ie.number().nullable(),avgMissesBetweenSets:ie.number().nullable(),hitRate:ie.number(),missRate:ie.number()}),ope=ie.object({tag:ie.string(),approxCurrentSizeBytes:ie.number().nullable(),totalHits:ie.number(),totalMisses:ie.number(),totalSets:ie.number(),totalDeletes:ie.number(),avgTimeBetweenSetsMs:ie.number().nullable(),avgHitsBetweenSets:ie.number().nullable(),avgMissesBetweenSets:ie.number().nullable(),hitRate:ie.number(),missRate:ie.number()}),ape=ie.object({computedAt:ie.number(),windowStart:ie.number().nullable(),windowEnd:ie.number().nullable(),groupBy:ie.enum(["key","tag","both"]),keys:ipe.array().optional(),tags:ope.array().optional()}),spe=lc.extend({keys:ie.array(ie.string()).optional(),groupBy:ie.enum(["key","tag","both"]).default("both")}),lpe=yo("cache").get({feed:!0,outputSchema:D3.array(),querySchema:dM,outputMetaSchema:af,queryExtensionSchema:of}).sub(yo("insights").get({outputSchema:ape,querySchema:spe}).done(),yo("clear").post({outputSchema:ie.object({success:ie.boolean()}),querySchema:dM}).done()).done(),z3=["info","warning","error","debug","trace"],sP=ie.enum(z3),N3=nf.extend({level:sP,meta:ie.any().optional()}),upe=lc.extend({levelsInclude:sP.array().optional(),levelsExclude:sP.array().optional()}),cpe=yo("logs").get({feed:!0,outputSchema:N3.array(),querySchema:upe,outputMetaSchema:af,queryExtensionSchema:of}).done(),hy=nf.extend({status:ie.number(),body:ie.any().optional(),fullUrl:ie.string(),path:ie.string(),method:Hu,query:ie.record(ie.string(),ie.any()).optional(),params:ie.record(ie.string(),ie.any()).optional(),output:ie.any().optional(),headers:ie.record(ie.string(),ie.any()).optional(),error:ie.string().optional(),durationMs:ie.number(),ip:ie.string().optional(),userAgent:ie.string().optional()}),dpe=lc.extend({methodsInclude:Hu.array().optional(),methodsExclude:Hu.array().optional(),statusesInclude:ie.coerce.number().array().optional(),statusesExclude:ie.coerce.number().array().optional(),path:ie.string().optional(),endpointKeysInclude:ie.string().array().optional(),endpointKeysExclude:ie.string().array().optional()}),fpe=yo("requests").get({feed:!0,outputSchema:hy.array(),querySchema:dpe,outputMetaSchema:af,queryExtensionSchema:of}).sub(yo(":requestId",void 0,ie.string()).get({outputSchema:hy.extend({logs:ie.array(N3),caches:ie.array(D3)})}).done()).done(),ppe=["object","string","number","boolean","bigint","date","array","enum","literal","union","record","tuple","unknown","any"],gu=ie.lazy(()=>ie.object({kind:ie.enum(ppe),optional:ie.boolean().optional(),nullable:ie.boolean().optional(),description:ie.string().optional(),properties:ie.record(ie.string(),gu).optional(),element:gu.optional(),union:ie.array(gu).optional(),literal:ie.unknown().optional(),enumValues:ie.array(ie.string()).optional()})),hpe=["experimental","beta","stable","deprecated","unknown"],lP=ie.enum(hpe),L3=nf.extend({method:Hu,path:ie.string(),contract:ie.object({body:gu.optional(),query:gu.optional(),output:gu.optional(),params:gu.optional(),bodyFiles:ie.array(ie.object({name:ie.string(),maxCount:ie.number()})).optional()}),feed:ie.boolean().optional(),summary:ie.string().optional(),stability:lP,hidden:ie.boolean().optional(),meta:ie.record(ie.string(),ie.string()),implemented:ie.boolean().optional()}),mpe=lc.extend({methodsInclude:Hu.array().optional(),methodsExclude:Hu.array().optional(),path:ie.string().optional(),stabilityInclude:lP.array().optional(),stabilityExclude:lP.array().optional()}),gpe=L3.extend({requests:ie.array(hy),volumeTS:ie.array(ie.object({timestamp:ie.number(),count:ie.number()})),averageDurationMs:ie.number(),successRate:ie.number(),latestErrors:ie.array(hy).optional()}),vpe=yo("endpoints").get({feed:!0,querySchema:mpe,outputSchema:L3.array(),outputMetaSchema:af,queryExtensionSchema:of}).sub(yo(":endpointId",void 0,ie.string()).get({outputSchema:gpe}).done()).done(),bp=nf.extend({operations:ie.array(ie.object({name:ie.string(),description:ie.string().optional(),stepNumber:ie.number(),endpointId:ie.string().optional(),method:Hu,path:ie.string(),body:ie.json().optional(),extraHeaders:ie.record(ie.string(),ie.any()).optional(),query:ie.record(ie.string(),ie.any()).optional()}))}),ype=lc.extend({nameInclude:ie.string().optional(),nameExclude:ie.string().optional()}),bpe=yo("presets").get({feed:!0,querySchema:ype,outputMetaSchema:af,outputSchema:bp.array(),queryExtensionSchema:of}).post({bodySchema:bp,outputSchema:bp}).put({bodySchema:bp,outputSchema:bp}).done(),xpe=nf.extend({eventName:ie.string(),message:ie.any().optional(),toRoomId:ie.array(ie.string()).nullable()}),wpe=lc.extend({eventName:ie.string().optional(),roomsInclude:ie.array(ie.string()).optional(),roomsExclude:ie.array(ie.string()).optional()}),Spe=ie.object({eventName:ie.string(),message:ie.json().optional(),toRoomId:ie.array(ie.string()).nullable()}),kpe=ie.object({success:ie.boolean(),eventId:ie.string().optional()}),Ppe=yo("sockets").get({feed:!0,outputSchema:xpe.array(),querySchema:wpe,outputMetaSchema:af,queryExtensionSchema:of}).post({bodySchema:Spe,outputSchema:kpe}).done(),$pe=yo().sub(yo("/__rrroutes").sub(vpe,fpe,cpe,lpe,bpe,Ppe).done()).done(),rE=sfe($pe);function rn(e,t){const{client:r}=rf();return m.useMemo(()=>r.build(rE.byKey[e],t),[r,e,t])}const B3=m.createContext(null);function Cpe({children:e}){const[t,r]=m.useState([]),[n,i]=m.useState(null),o=f=>{r(p=>[...p,f])},a=({id:f,method:p,path:v})=>t.filter(y=>y.method!==p||y.path!==v?!1:f?y.id===f:!0).slice(-1)[0],s=m.useCallback(f=>{i(f)},[]),u=m.useCallback(f=>!n||f&&(f.method&&n.method!==f.method||f.path&&n.path!==f.path||f.leafKey&&n.leafKey!==f.leafKey)?null:(i(null),n),[n]),d=m.useMemo(()=>({runs:t,addRun:o,getLastRun:a,queuePrefill:s,consumePrefill:u}),[t,s,u]);return h.jsx(B3.Provider,{value:d,children:e})}function sx(){const e=m.useContext(B3);if(!e)throw new Error("usePlaygroundRuns must be used within PlaygroundRunsProvider");return e}const uP="tab",cP="layout",jpe=["request","response","meta","metrics","playground"];function fM(e){return e&&jpe.includes(e)?e:"request"}function F3(e){return e==="request"?null:e}function pM(e){return e==="detailsMax"?"details":e==="playgroundMax"?"playground":"split"}function U3(e){return e==="details"?"detailsMax":e==="playground"?"playgroundMax":null}function ad(e,t){if(!e||!t)return{displayId:"",encodedId:""};try{const r=e.toUpperCase();return{displayId:Rd(r,t,!1),encodedId:Rd(r,t,!0)}}catch{const r=`${e.toUpperCase()} ${t}`;return{displayId:r,encodedId:encodeURIComponent(r)}}}function W3(e){const t=Rd(e.method.toUpperCase(),e.path,!1);return{value:t,display:t,method:e.method,path:e.path}}function K3(e){if(!e)return;const t=e.trim();if(!t)return;const[r,...n]=t.split(" ");if(!r||n.length===0)return;const i=r.toLowerCase();if(!ax.includes(i))return;const o=n.join(" ").trim();if(!o)return;const a=Rd(r.toUpperCase(),o,!1);return{value:a,display:a,method:i,path:o}}function Epe(e){if(!e)return"";const t=K3(e);return t?Rd(t.method.toUpperCase(),t.path,!0):encodeURIComponent(e)}function oh(e,t){const r=encodeURIComponent(e),n=new URLSearchParams,i=t!=null&&t.tab?F3(t.tab):null;i&&n.set(uP,i);const o=t!=null&&t.layout?U3(t.layout):null;o&&n.set(cP,o),Object.entries((t==null?void 0:t.extraParams)??{}).forEach(([s,u])=>{u!=null&&n.set(s,u)});const a=n.toString();return a?`/routes/${r}?${a}`:`/routes/${r}`}function ji({title:e,description:t,action:r}){return h.jsx(Be,{sx:{py:8,px:2,textAlign:"center",color:"text.secondary"},children:h.jsxs(ue,{spacing:2,alignItems:"center",children:[h.jsx(ne,{variant:"h5",color:"text.primary",children:e}),t&&h.jsx(ne,{variant:"body1",color:"text.secondary",maxWidth:480,children:t}),r]})})}const Ipe=Et(h.jsx("path",{d:"M11 15h2v2h-2zm0-8h2v6h-2zm.99-5C6.47 2 2 6.48 2 12s4.47 10 9.99 10C17.52 22 22 17.52 22 12S17.52 2 11.99 2M12 20c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8"})),ea=Et(h.jsx("path",{d:"M16.59 8.59 12 13.17 7.41 8.59 6 10l6 6 6-6z"}));function ia({message:e="Something went wrong.",onRetry:t,details:r}){const[n,i]=m.useState(!1);return h.jsx(Yn,{elevation:0,sx:{p:4,borderRadius:2,border:"1px solid",borderColor:"divider",bgcolor:"background.default"},children:h.jsxs(ue,{spacing:2,alignItems:"flex-start",children:[h.jsxs(ue,{direction:"row",spacing:2,alignItems:"center",children:[h.jsx(Ipe,{color:"error",fontSize:"large"}),h.jsxs(Be,{children:[h.jsx(ne,{variant:"h6",children:"We hit a snag"}),h.jsx(ne,{color:"text.secondary",children:e})]})]}),t&&h.jsx(zt,{variant:"contained",color:"primary",onClick:t,children:"Retry"}),r&&h.jsxs(Be,{sx:{width:"100%"},children:[h.jsx(zt,{size:"small",startIcon:h.jsx(ea,{sx:{transform:n?"rotate(180deg)":"rotate(0deg)",transition:"transform 150ms ease"}}),onClick:()=>i(o=>!o),children:n?"Hide details":"Show details"}),h.jsx(Yp,{in:n,children:h.jsx(Be,{component:"pre",sx:{mt:1,p:2,borderRadius:1,bgcolor:"background.paper",overflowX:"auto",typography:"body2"},children:r})})]})]})})}function Ma({variant:e="inline"}){return e==="table"?h.jsx(ue,{spacing:1.5,children:Array.from({length:5}).map((t,r)=>h.jsx(sS,{variant:"rectangular",height:40,sx:{borderRadius:1}},r))}):e==="full"?h.jsxs(Be,{sx:{display:"flex",alignItems:"center",justifyContent:"center",flexDirection:"column",py:8,gap:2},children:[h.jsx(q$,{size:32}),h.jsx(ne,{color:"text.secondary",children:"Loading data..."})]}):h.jsxs(ue,{spacing:1,children:[h.jsx(sS,{variant:"text",width:"60%"}),h.jsx(sS,{variant:"text",width:"40%"})]})}const Ope=Et(h.jsx("path",{d:"M20 11H7.83l5.59-5.59L12 4l-8 8 8 8 1.41-1.41L7.83 13H20z"})),_pe=Et(h.jsx("path",{d:"m12 4-1.41 1.41L16.17 11H4v2h12.17l-5.58 5.59L12 20l8-8z"})),Ape=Et(h.jsx("path",{d:"M19 6.41 17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"}));function sf({open:e,onClose:t,title:r,children:n,onPrev:i,onNext:o,scroll:a="paper"}){const s=Kr();Pse(s.breakpoints.down("sm"));const u=typeof r=="string"?h.jsx(ne,{variant:"h6",component:"h2",sx:{flex:1,minWidth:0},children:r}):h.jsx(Be,{sx:{flex:1,minWidth:0},children:r});return h.jsxs(zne,{open:e,onClose:t,fullWidth:!0,maxWidth:"lg",fullScreen:!1,sx:{flex:1},children:[h.jsxs(ue,{direction:"row",alignItems:"center",justifyContent:"space-between",sx:{px:{xs:2,sm:3},py:2,borderBottom:"1px solid",borderColor:"divider",gap:1},children:[h.jsxs(ue,{direction:"row",spacing:1,alignItems:"center",sx:{minWidth:0},children:[h.jsx(qn,{"aria-label":"Previous item",size:"small",onClick:i,disabled:!i,children:h.jsx(Ope,{fontSize:"small"})}),u,h.jsx(qn,{"aria-label":"Next item",size:"small",onClick:o,disabled:!o,children:h.jsx(_pe,{fontSize:"small"})})]}),h.jsx(qn,{"aria-label":"Close detail dialog",onClick:t,children:h.jsx(Ape,{})})]}),h.jsx(Une,{sx:{flexDirection:"column"},children:n})]})}const Tpe=Et(h.jsx("path",{d:"M12 5V1L7 6l5 5V7c3.31 0 6 2.69 6 6s-2.69 6-6 6-6-2.69-6-6H4c0 4.42 3.58 8 8 8s8-3.58 8-8-3.58-8-8-8"})),Mpe=Et(h.jsx("path",{d:"M16 1H4c-1.1 0-2 .9-2 2v14h2V3h12zm3 4H8c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h11c1.1 0 2-.9 2-2V7c0-1.1-.9-2-2-2m0 16H8V7h11z"}));function ai({value:e,collapsedLines:t=20,title:r}){const[n,i]=m.useState(!1),o=m.useMemo(()=>{try{return JSON.stringify(e??null,null,2)}catch{return"<< Unable to render JSON >>"}},[e]),a=async()=>{if(!(typeof navigator>"u"||!navigator.clipboard))try{await navigator.clipboard.writeText(o),i(!0),setTimeout(()=>i(!1),1500)}catch(u){console.error("Failed to copy JSON",u)}},s=o.replace(/\\n/g,`
314
- `).replace(/\\t/g," ").replace(/\\"/g,'"');return h.jsxs(ue,{spacing:1,children:[h.jsxs(ue,{direction:"row",alignItems:"center",justifyContent:"space-between",children:[h.jsx(ne,{variant:"subtitle2",color:"text.secondary",children:r||"Output"}),h.jsx(Bh,{title:n?"Copied!":"Copy JSON",placement:"top",children:h.jsx(qn,{size:"small",onClick:a,children:h.jsx(Mpe,{fontSize:"inherit"})})})]}),h.jsx(Be,{component:"pre",sx:{m:0,p:2,borderRadius:2,bgcolor:"background.default",border:"1px solid",borderColor:"divider",fontFamily:"monospace",fontSize:"0.85rem",lineHeight:1.6,maxHeight:`${t*1.6}rem`,overflow:"auto"},children:s})]})}function H3({open:e,event:t,onClose:r,onOpenGroup:n}){var a;const i=t?`Socket event · ${t.eventName}`:"Socket event details",o=t?Dpe(t.createdAt):"";return h.jsx(sf,{open:e,onClose:r,title:i,children:t?h.jsxs(ue,{spacing:3,children:[h.jsxs(ue,{spacing:.5,children:[h.jsx(ne,{variant:"body2",color:"text.secondary",children:o}),h.jsxs(ne,{variant:"body2",sx:{fontFamily:"monospace"},color:"text.secondary",children:["ID: ",t.id]})]}),h.jsxs(Be,{sx:{display:"grid",gridTemplateColumns:{xs:"repeat(2, minmax(0, 1fr))",sm:"repeat(3, minmax(0, 1fr))"},gap:2},children:[h.jsx(dS,{label:"Event name",value:t.eventName}),h.jsx(dS,{label:"Group ID",children:t.groupId?h.jsx(dr,{label:t.groupId,size:"small",variant:"outlined",sx:{fontFamily:"monospace"},onClick:()=>t.groupId&&(n==null?void 0:n(t.groupId))}):h.jsx(ne,{variant:"body2",color:"text.secondary",children:"—"})}),h.jsx(dS,{label:"Tags",children:(a=t.tags)!=null&&a.length?h.jsx(ue,{direction:"row",spacing:.5,flexWrap:"wrap",useFlexGap:!0,children:t.tags.map(s=>h.jsx(dr,{label:s,size:"small"},s))}):h.jsx(ne,{variant:"body2",color:"text.secondary",children:"—"})})]}),h.jsxs(ue,{spacing:1,children:[h.jsx(ne,{variant:"subtitle2",color:"text.secondary",children:"Rooms"}),Rpe(t.toRoomId)]}),h.jsxs(ue,{spacing:1,children:[h.jsx(ne,{variant:"subtitle2",color:"text.secondary",children:"Message"}),h.jsx(ai,{value:t.message,collapsedLines:16})]})]}):h.jsx(ne,{color:"text.secondary",children:"Select a socket event to see details."})})}function dS({label:e,value:t,children:r}){const n=r!==void 0;return h.jsxs(ue,{spacing:.5,children:[h.jsx(ne,{variant:"caption",color:"text.secondary",children:e}),n?r:h.jsx(ne,{variant:"body2",children:t??"—"})]})}function Rpe(e){return!e||!e.length?h.jsx(ne,{variant:"body2",color:"text.secondary",children:"—"}):h.jsx(ue,{direction:"row",spacing:.5,flexWrap:"wrap",useFlexGap:!0,children:e.map(t=>h.jsx(dr,{label:t,size:"small",sx:{fontFamily:"monospace"}},t))})}function Dpe(e){if(!e)return"";try{return new Date(e).toLocaleString()}catch{return""}}function _t({title:e,actions:t,children:r,flex:n}){const i=!!(e||t);return h.jsx(cB,{sx:{bgcolor:"background.paper",flex:n},children:h.jsxs(Wre,{children:[i&&h.jsxs(ue,{direction:{xs:"column",sm:"row"},alignItems:{xs:"flex-start",sm:"center"},justifyContent:"space-between",spacing:2,mb:2,children:[e&&h.jsx(ne,{variant:"h6",component:"h2",children:e}),t&&h.jsx(Be,{children:t})]}),h.jsx(Be,{children:r})]})})}var zpe=["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"];function nE(e){if(typeof e!="string")return!1;var t=zpe;return t.includes(e)}var Npe=["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"],Lpe=new Set(Npe);function V3(e){return typeof e!="string"?!1:Lpe.has(e)}function q3(e){return typeof e=="string"&&e.startsWith("data-")}function Zn(e){if(typeof e!="object"||e===null)return{};var t={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(V3(r)||q3(r))&&(t[r]=e[r]);return t}function Vu(e){if(e==null)return null;if(m.isValidElement(e)&&typeof e.props=="object"&&e.props!==null){var t=e.props;return Zn(t)}return typeof e=="object"&&!Array.isArray(e)?Zn(e):null}function Rn(e){var t={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(V3(r)||q3(r)||nE(r))&&(t[r]=e[r]);return t}function Bpe(e){return e==null?null:m.isValidElement(e)?Rn(e.props):typeof e=="object"&&!Array.isArray(e)?Rn(e):null}var Fpe=["children","width","height","viewBox","className","style","title","desc"];function dP(){return dP=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},dP.apply(null,arguments)}function Upe(e,t){if(e==null)return{};var r,n,i=Wpe(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n<o.length;n++)r=o[n],t.indexOf(r)===-1&&{}.propertyIsEnumerable.call(e,r)&&(i[r]=e[r])}return i}function Wpe(e,t){if(e==null)return{};var r={};for(var n in e)if({}.hasOwnProperty.call(e,n)){if(t.indexOf(n)!==-1)continue;r[n]=e[n]}return r}var iE=m.forwardRef((e,t)=>{var{children:r,width:n,height:i,viewBox:o,className:a,style:s,title:u,desc:d}=e,f=Upe(e,Fpe),p=o||{width:n,height:i,x:0,y:0},v=ve("recharts-surface",a);return m.createElement("svg",dP({},Rn(f),{className:v,width:n,height:i,style:s,viewBox:"".concat(p.x," ").concat(p.y," ").concat(p.width," ").concat(p.height),ref:t}),m.createElement("title",null,u),m.createElement("desc",null,d),r)}),Kpe=["children","className"];function fP(){return fP=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},fP.apply(null,arguments)}function Hpe(e,t){if(e==null)return{};var r,n,i=Vpe(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n<o.length;n++)r=o[n],t.indexOf(r)===-1&&{}.propertyIsEnumerable.call(e,r)&&(i[r]=e[r])}return i}function Vpe(e,t){if(e==null)return{};var r={};for(var n in e)if({}.hasOwnProperty.call(e,n)){if(t.indexOf(n)!==-1)continue;r[n]=e[n]}return r}var fr=m.forwardRef((e,t)=>{var{children:r,className:n}=e,i=Hpe(e,Kpe),o=ve("recharts-layer",n);return m.createElement("g",fP({className:o},Rn(i),{ref:t}),r)}),G3=m.createContext(null),qpe=()=>m.useContext(G3);function cr(e){return function(){return e}}const Z3=Math.cos,my=Math.sin,oa=Math.sqrt,gy=Math.PI,lx=2*gy,pP=Math.PI,hP=2*pP,au=1e-6,Gpe=hP-au;function X3(e){this._+=e[0];for(let t=1,r=e.length;t<r;++t)this._+=arguments[t]+e[t]}function Zpe(e){let t=Math.floor(e);if(!(t>=0))throw new Error(`invalid digits: ${e}`);if(t>15)return X3;const r=10**t;return function(n){this._+=n[0];for(let i=1,o=n.length;i<o;++i)this._+=Math.round(arguments[i]*r)/r+n[i]}}class Xpe{constructor(t){this._x0=this._y0=this._x1=this._y1=null,this._="",this._append=t==null?X3:Zpe(t)}moveTo(t,r){this._append`M${this._x0=this._x1=+t},${this._y0=this._y1=+r}`}closePath(){this._x1!==null&&(this._x1=this._x0,this._y1=this._y0,this._append`Z`)}lineTo(t,r){this._append`L${this._x1=+t},${this._y1=+r}`}quadraticCurveTo(t,r,n,i){this._append`Q${+t},${+r},${this._x1=+n},${this._y1=+i}`}bezierCurveTo(t,r,n,i,o,a){this._append`C${+t},${+r},${+n},${+i},${this._x1=+o},${this._y1=+a}`}arcTo(t,r,n,i,o){if(t=+t,r=+r,n=+n,i=+i,o=+o,o<0)throw new Error(`negative radius: ${o}`);let a=this._x1,s=this._y1,u=n-t,d=i-r,f=a-t,p=s-r,v=f*f+p*p;if(this._x1===null)this._append`M${this._x1=t},${this._y1=r}`;else if(v>au)if(!(Math.abs(p*u-d*f)>au)||!o)this._append`L${this._x1=t},${this._y1=r}`;else{let y=n-a,b=i-s,w=u*u+d*d,x=y*y+b*b,k=Math.sqrt(w),$=Math.sqrt(v),P=o*Math.tan((pP-Math.acos((w+v-x)/(2*k*$)))/2),j=P/$,C=P/k;Math.abs(j-1)>au&&this._append`L${t+j*f},${r+j*p}`,this._append`A${o},${o},0,0,${+(p*y>f*b)},${this._x1=t+C*u},${this._y1=r+C*d}`}}arc(t,r,n,i,o,a){if(t=+t,r=+r,n=+n,a=!!a,n<0)throw new Error(`negative radius: ${n}`);let s=n*Math.cos(i),u=n*Math.sin(i),d=t+s,f=r+u,p=1^a,v=a?i-o:o-i;this._x1===null?this._append`M${d},${f}`:(Math.abs(this._x1-d)>au||Math.abs(this._y1-f)>au)&&this._append`L${d},${f}`,n&&(v<0&&(v=v%hP+hP),v>Gpe?this._append`A${n},${n},0,1,${p},${t-s},${r-u}A${n},${n},0,1,${p},${this._x1=d},${this._y1=f}`:v>au&&this._append`A${n},${n},0,${+(v>=pP)},${p},${this._x1=t+n*Math.cos(o)},${this._y1=r+n*Math.sin(o)}`)}rect(t,r,n,i){this._append`M${this._x0=this._x1=+t},${this._y0=this._y1=+r}h${n=+n}v${+i}h${-n}Z`}toString(){return this._}}function oE(e){let t=3;return e.digits=function(r){if(!arguments.length)return t;if(r==null)t=null;else{const n=Math.floor(r);if(!(n>=0))throw new RangeError(`invalid digits: ${r}`);t=n}return e},()=>new Xpe(t)}function aE(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function Y3(e){this._context=e}Y3.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);break}}};function ux(e){return new Y3(e)}function Q3(e){return e[0]}function J3(e){return e[1]}function eW(e,t){var r=cr(!0),n=null,i=ux,o=null,a=oE(s);e=typeof e=="function"?e:e===void 0?Q3:cr(e),t=typeof t=="function"?t:t===void 0?J3:cr(t);function s(u){var d,f=(u=aE(u)).length,p,v=!1,y;for(n==null&&(o=i(y=a())),d=0;d<=f;++d)!(d<f&&r(p=u[d],d,u))===v&&((v=!v)?o.lineStart():o.lineEnd()),v&&o.point(+e(p,d,u),+t(p,d,u));if(y)return o=null,y+""||null}return s.x=function(u){return arguments.length?(e=typeof u=="function"?u:cr(+u),s):e},s.y=function(u){return arguments.length?(t=typeof u=="function"?u:cr(+u),s):t},s.defined=function(u){return arguments.length?(r=typeof u=="function"?u:cr(!!u),s):r},s.curve=function(u){return arguments.length?(i=u,n!=null&&(o=i(n)),s):i},s.context=function(u){return arguments.length?(u==null?n=o=null:o=i(n=u),s):n},s}function ev(e,t,r){var n=null,i=cr(!0),o=null,a=ux,s=null,u=oE(d);e=typeof e=="function"?e:e===void 0?Q3:cr(+e),t=typeof t=="function"?t:cr(t===void 0?0:+t),r=typeof r=="function"?r:r===void 0?J3:cr(+r);function d(p){var v,y,b,w=(p=aE(p)).length,x,k=!1,$,P=new Array(w),j=new Array(w);for(o==null&&(s=a($=u())),v=0;v<=w;++v){if(!(v<w&&i(x=p[v],v,p))===k)if(k=!k)y=v,s.areaStart(),s.lineStart();else{for(s.lineEnd(),s.lineStart(),b=v-1;b>=y;--b)s.point(P[b],j[b]);s.lineEnd(),s.areaEnd()}k&&(P[v]=+e(x,v,p),j[v]=+t(x,v,p),s.point(n?+n(x,v,p):P[v],r?+r(x,v,p):j[v]))}if($)return s=null,$+""||null}function f(){return eW().defined(i).curve(a).context(o)}return d.x=function(p){return arguments.length?(e=typeof p=="function"?p:cr(+p),n=null,d):e},d.x0=function(p){return arguments.length?(e=typeof p=="function"?p:cr(+p),d):e},d.x1=function(p){return arguments.length?(n=p==null?null:typeof p=="function"?p:cr(+p),d):n},d.y=function(p){return arguments.length?(t=typeof p=="function"?p:cr(+p),r=null,d):t},d.y0=function(p){return arguments.length?(t=typeof p=="function"?p:cr(+p),d):t},d.y1=function(p){return arguments.length?(r=p==null?null:typeof p=="function"?p:cr(+p),d):r},d.lineX0=d.lineY0=function(){return f().x(e).y(t)},d.lineY1=function(){return f().x(e).y(r)},d.lineX1=function(){return f().x(n).y(t)},d.defined=function(p){return arguments.length?(i=typeof p=="function"?p:cr(!!p),d):i},d.curve=function(p){return arguments.length?(a=p,o!=null&&(s=a(o)),d):a},d.context=function(p){return arguments.length?(p==null?o=s=null:s=a(o=p),d):o},d}class tW{constructor(t,r){this._context=t,this._x=r}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(t,r){switch(t=+t,r=+r,this._point){case 0:{this._point=1,this._line?this._context.lineTo(t,r):this._context.moveTo(t,r);break}case 1:this._point=2;default:{this._x?this._context.bezierCurveTo(this._x0=(this._x0+t)/2,this._y0,this._x0,r,t,r):this._context.bezierCurveTo(this._x0,this._y0=(this._y0+r)/2,t,this._y0,t,r);break}}this._x0=t,this._y0=r}}function Ype(e){return new tW(e,!0)}function Qpe(e){return new tW(e,!1)}const sE={draw(e,t){const r=oa(t/gy);e.moveTo(r,0),e.arc(0,0,r,0,lx)}},Jpe={draw(e,t){const r=oa(t/5)/2;e.moveTo(-3*r,-r),e.lineTo(-r,-r),e.lineTo(-r,-3*r),e.lineTo(r,-3*r),e.lineTo(r,-r),e.lineTo(3*r,-r),e.lineTo(3*r,r),e.lineTo(r,r),e.lineTo(r,3*r),e.lineTo(-r,3*r),e.lineTo(-r,r),e.lineTo(-3*r,r),e.closePath()}},rW=oa(1/3),ehe=rW*2,the={draw(e,t){const r=oa(t/ehe),n=r*rW;e.moveTo(0,-r),e.lineTo(n,0),e.lineTo(0,r),e.lineTo(-n,0),e.closePath()}},rhe={draw(e,t){const r=oa(t),n=-r/2;e.rect(n,n,r,r)}},nhe=.8908130915292852,nW=my(gy/10)/my(7*gy/10),ihe=my(lx/10)*nW,ohe=-Z3(lx/10)*nW,ahe={draw(e,t){const r=oa(t*nhe),n=ihe*r,i=ohe*r;e.moveTo(0,-r),e.lineTo(n,i);for(let o=1;o<5;++o){const a=lx*o/5,s=Z3(a),u=my(a);e.lineTo(u*r,-s*r),e.lineTo(s*n-u*i,u*n+s*i)}e.closePath()}},fS=oa(3),she={draw(e,t){const r=-oa(t/(fS*3));e.moveTo(0,r*2),e.lineTo(-fS*r,-r),e.lineTo(fS*r,-r),e.closePath()}},ao=-.5,so=oa(3)/2,mP=1/oa(12),lhe=(mP/2+1)*3,uhe={draw(e,t){const r=oa(t/lhe),n=r/2,i=r*mP,o=n,a=r*mP+r,s=-o,u=a;e.moveTo(n,i),e.lineTo(o,a),e.lineTo(s,u),e.lineTo(ao*n-so*i,so*n+ao*i),e.lineTo(ao*o-so*a,so*o+ao*a),e.lineTo(ao*s-so*u,so*s+ao*u),e.lineTo(ao*n+so*i,ao*i-so*n),e.lineTo(ao*o+so*a,ao*a-so*o),e.lineTo(ao*s+so*u,ao*u-so*s),e.closePath()}};function che(e,t){let r=null,n=oE(i);e=typeof e=="function"?e:cr(e||sE),t=typeof t=="function"?t:cr(t===void 0?64:+t);function i(){let o;if(r||(r=o=n()),e.apply(this,arguments).draw(r,+t.apply(this,arguments)),o)return r=null,o+""||null}return i.type=function(o){return arguments.length?(e=typeof o=="function"?o:cr(o),i):e},i.size=function(o){return arguments.length?(t=typeof o=="function"?o:cr(+o),i):t},i.context=function(o){return arguments.length?(r=o??null,i):r},i}function vy(){}function yy(e,t,r){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+r)/6)}function iW(e){this._context=e}iW.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:yy(this,this._x1,this._y1);case 2:this._context.lineTo(this._x1,this._y1);break}(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:yy(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function dhe(e){return new iW(e)}function oW(e){this._context=e}oW.prototype={areaStart:vy,areaEnd:vy,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);break}}},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:yy(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function fhe(e){return new oW(e)}function aW(e){this._context=e}aW.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 r=(this._x0+4*this._x1+e)/6,n=(this._y0+4*this._y1+t)/6;this._line?this._context.lineTo(r,n):this._context.moveTo(r,n);break;case 3:this._point=4;default:yy(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function phe(e){return new aW(e)}function sW(e){this._context=e}sW.prototype={areaStart:vy,areaEnd:vy,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 hhe(e){return new sW(e)}function hM(e){return e<0?-1:1}function mM(e,t,r){var n=e._x1-e._x0,i=t-e._x1,o=(e._y1-e._y0)/(n||i<0&&-0),a=(r-e._y1)/(i||n<0&&-0),s=(o*i+a*n)/(n+i);return(hM(o)+hM(a))*Math.min(Math.abs(o),Math.abs(a),.5*Math.abs(s))||0}function gM(e,t){var r=e._x1-e._x0;return r?(3*(e._y1-e._y0)/r-t)/2:t}function pS(e,t,r){var n=e._x0,i=e._y0,o=e._x1,a=e._y1,s=(o-n)/3;e._context.bezierCurveTo(n+s,i+s*t,o-s,a-s*r,o,a)}function by(e){this._context=e}by.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:pS(this,this._t0,gM(this,this._t0));break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){var r=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,pS(this,gM(this,r=mM(this,e,t)),r);break;default:pS(this,this._t0,r=mM(this,e,t));break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t,this._t0=r}}};function lW(e){this._context=new uW(e)}(lW.prototype=Object.create(by.prototype)).point=function(e,t){by.prototype.point.call(this,t,e)};function uW(e){this._context=e}uW.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,r,n,i,o){this._context.bezierCurveTo(t,e,n,r,o,i)}};function mhe(e){return new by(e)}function ghe(e){return new lW(e)}function cW(e){this._context=e}cW.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,r=e.length;if(r)if(this._line?this._context.lineTo(e[0],t[0]):this._context.moveTo(e[0],t[0]),r===2)this._context.lineTo(e[1],t[1]);else for(var n=vM(e),i=vM(t),o=0,a=1;a<r;++o,++a)this._context.bezierCurveTo(n[0][o],i[0][o],n[1][o],i[1][o],e[a],t[a]);(this._line||this._line!==0&&r===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 vM(e){var t,r=e.length-1,n,i=new Array(r),o=new Array(r),a=new Array(r);for(i[0]=0,o[0]=2,a[0]=e[0]+2*e[1],t=1;t<r-1;++t)i[t]=1,o[t]=4,a[t]=4*e[t]+2*e[t+1];for(i[r-1]=2,o[r-1]=7,a[r-1]=8*e[r-1]+e[r],t=1;t<r;++t)n=i[t]/o[t-1],o[t]-=n,a[t]-=n*a[t-1];for(i[r-1]=a[r-1]/o[r-1],t=r-2;t>=0;--t)i[t]=(a[t]-i[t+1])/o[t];for(o[r-1]=(e[r]+i[r-1])/2,t=0;t<r-1;++t)o[t]=2*e[t+1]-i[t+1];return[i,o]}function vhe(e){return new cW(e)}function cx(e,t){this._context=e,this._t=t}cx.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 r=this._x*(1-this._t)+e*this._t;this._context.lineTo(r,this._y),this._context.lineTo(r,t)}break}}this._x=e,this._y=t}};function yhe(e){return new cx(e,.5)}function bhe(e){return new cx(e,0)}function xhe(e){return new cx(e,1)}function zd(e,t){if((a=e.length)>1)for(var r=1,n,i,o=e[t[0]],a,s=o.length;r<a;++r)for(i=o,o=e[t[r]],n=0;n<s;++n)o[n][1]+=o[n][0]=isNaN(i[n][1])?i[n][0]:i[n][1]}function gP(e){for(var t=e.length,r=new Array(t);--t>=0;)r[t]=t;return r}function whe(e,t){return e[t]}function She(e){const t=[];return t.key=e,t}function khe(){var e=cr([]),t=gP,r=zd,n=whe;function i(o){var a=Array.from(e.apply(this,arguments),She),s,u=a.length,d=-1,f;for(const p of o)for(s=0,++d;s<u;++s)(a[s][d]=[0,+n(p,a[s].key,d,o)]).data=p;for(s=0,f=aE(t(a));s<u;++s)a[f[s]].index=s;return r(a,f),a}return i.keys=function(o){return arguments.length?(e=typeof o=="function"?o:cr(Array.from(o)),i):e},i.value=function(o){return arguments.length?(n=typeof o=="function"?o:cr(+o),i):n},i.order=function(o){return arguments.length?(t=o==null?gP:typeof o=="function"?o:cr(Array.from(o)),i):t},i.offset=function(o){return arguments.length?(r=o??zd,i):r},i}function Phe(e,t){if((n=e.length)>0){for(var r,n,i=0,o=e[0].length,a;i<o;++i){for(a=r=0;r<n;++r)a+=e[r][i][1]||0;if(a)for(r=0;r<n;++r)e[r][i][1]/=a}zd(e,t)}}function $he(e,t){if((i=e.length)>0){for(var r=0,n=e[t[0]],i,o=n.length;r<o;++r){for(var a=0,s=0;a<i;++a)s+=e[a][r][1]||0;n[r][1]+=n[r][0]=-s/2}zd(e,t)}}function Che(e,t){if(!(!((a=e.length)>0)||!((o=(i=e[t[0]]).length)>0))){for(var r=0,n=1,i,o,a;n<o;++n){for(var s=0,u=0,d=0;s<a;++s){for(var f=e[t[s]],p=f[n][1]||0,v=f[n-1][1]||0,y=(p-v)/2,b=0;b<s;++b){var w=e[t[b]],x=w[n][1]||0,k=w[n-1][1]||0;y+=x-k}u+=p,d+=y*p}i[n-1][1]+=i[n-1][0]=r,u&&(r-=d/u)}i[n-1][1]+=i[n-1][0]=r,zd(e,t)}}var hS={},mS={},yM;function jhe(){return yM||(yM=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function t(r){return r==="__proto__"}e.isUnsafeProperty=t})(mS)),mS}var gS={},bM;function dW(){return bM||(bM=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function t(r){switch(typeof r){case"number":case"symbol":return!1;case"string":return r.includes(".")||r.includes("[")||r.includes("]")}}e.isDeepKey=t})(gS)),gS}var vS={},xM;function lE(){return xM||(xM=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function t(r){var n;return typeof r=="string"||typeof r=="symbol"?r:Object.is((n=r==null?void 0:r.valueOf)==null?void 0:n.call(r),-0)?"-0":String(r)}e.toKey=t})(vS)),vS}var yS={},bS={},wM;function Ehe(){return wM||(wM=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function t(r){if(r==null)return"";if(typeof r=="string")return r;if(Array.isArray(r))return r.map(t).join(",");const n=String(r);return n==="0"&&Object.is(Number(r),-0)?"-0":n}e.toString=t})(bS)),bS}var SM;function uE(){return SM||(SM=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=Ehe(),r=lE();function n(i){if(Array.isArray(i))return i.map(r.toKey);if(typeof i=="symbol")return[i];i=t.toString(i);const o=[],a=i.length;if(a===0)return o;let s=0,u="",d="",f=!1;for(i.charCodeAt(0)===46&&(o.push(""),s++);s<a;){const p=i[s];d?p==="\\"&&s+1<a?(s++,u+=i[s]):p===d?d="":u+=p:f?p==='"'||p==="'"?d=p:p==="]"?(f=!1,o.push(u),u=""):u+=p:p==="["?(f=!0,u&&(o.push(u),u="")):p==="."?u&&(o.push(u),u=""):u+=p,s++}return u&&o.push(u),o}e.toPath=n})(yS)),yS}var kM;function cE(){return kM||(kM=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=jhe(),r=dW(),n=lE(),i=uE();function o(s,u,d){if(s==null)return d;switch(typeof u){case"string":{if(t.isUnsafeProperty(u))return d;const f=s[u];return f===void 0?r.isDeepKey(u)?o(s,i.toPath(u),d):d:f}case"number":case"symbol":{typeof u=="number"&&(u=n.toKey(u));const f=s[u];return f===void 0?d:f}default:{if(Array.isArray(u))return a(s,u,d);if(Object.is(u==null?void 0:u.valueOf(),-0)?u="-0":u=String(u),t.isUnsafeProperty(u))return d;const f=s[u];return f===void 0?d:f}}}function a(s,u,d){if(u.length===0)return d;let f=s;for(let p=0;p<u.length;p++){if(f==null||t.isUnsafeProperty(u[p]))return d;f=f[u[p]]}return f===void 0?d:f}e.get=o})(hS)),hS}var xS,PM;function Ihe(){return PM||(PM=1,xS=cE().get),xS}var Ohe=Ihe();const qu=Oa(Ohe);var $n=e=>e===0?0:e>0?1:-1,wo=e=>typeof e=="number"&&e!=+e,hs=e=>typeof e=="string"&&e.indexOf("%")===e.length-1,Ue=e=>(typeof e=="number"||e instanceof Number)&&!wo(e),Si=e=>Ue(e)||typeof e=="string",_he=0,ah=e=>{var t=++_he;return"".concat(e||"").concat(t)},Gn=function(t,r){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1;if(!Ue(t)&&typeof t!="string")return n;var o;if(hs(t)){if(r==null)return n;var a=t.indexOf("%");o=r*parseFloat(t.slice(0,a))/100}else o=+t;return wo(o)&&(o=n),i&&r!=null&&o>r&&(o=r),o},fW=e=>{if(!Array.isArray(e))return!1;for(var t=e.length,r={},n=0;n<t;n++)if(!r[e[n]])r[e[n]]=!0;else return!0;return!1};function Zt(e,t,r){return Ue(e)&&Ue(t)?e+r*(t-e):t}function pW(e,t,r){if(!(!e||!e.length))return e.find(n=>n&&(typeof t=="function"?t(n):qu(n,t))===r)}var xr=e=>e===null||typeof e>"u",Jh=e=>xr(e)?e:"".concat(e.charAt(0).toUpperCase()).concat(e.slice(1));function hW(e){return e!=null}function em(){}var Ahe=["type","size","sizeType"];function vP(){return vP=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},vP.apply(null,arguments)}function $M(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function CM(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?$M(Object(r),!0).forEach(function(n){The(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):$M(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function The(e,t,r){return(t=Mhe(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Mhe(e){var t=Rhe(e,"string");return typeof t=="symbol"?t:t+""}function Rhe(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Dhe(e,t){if(e==null)return{};var r,n,i=zhe(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n<o.length;n++)r=o[n],t.indexOf(r)===-1&&{}.propertyIsEnumerable.call(e,r)&&(i[r]=e[r])}return i}function zhe(e,t){if(e==null)return{};var r={};for(var n in e)if({}.hasOwnProperty.call(e,n)){if(t.indexOf(n)!==-1)continue;r[n]=e[n]}return r}var mW={symbolCircle:sE,symbolCross:Jpe,symbolDiamond:the,symbolSquare:rhe,symbolStar:ahe,symbolTriangle:she,symbolWye:uhe},Nhe=Math.PI/180,Lhe=e=>{var t="symbol".concat(Jh(e));return mW[t]||sE},Bhe=(e,t,r)=>{if(t==="area")return e;switch(r){case"cross":return 5*e*e/9;case"diamond":return .5*e*e/Math.sqrt(3);case"square":return e*e;case"star":{var n=18*Nhe;return 1.25*e*e*(Math.tan(n)-Math.tan(n*2)*Math.tan(n)**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}},Fhe=(e,t)=>{mW["symbol".concat(Jh(e))]=t},dE=e=>{var{type:t="circle",size:r=64,sizeType:n="area"}=e,i=Dhe(e,Ahe),o=CM(CM({},i),{},{type:t,size:r,sizeType:n}),a="circle";typeof t=="string"&&(a=t);var s=()=>{var v=Lhe(a),y=che().type(v).size(Bhe(r,n,a)),b=y();if(b!==null)return b},{className:u,cx:d,cy:f}=o,p=Rn(o);return Ue(d)&&Ue(f)&&Ue(r)?m.createElement("path",vP({},p,{className:ve("recharts-symbols",u),transform:"translate(".concat(d,", ").concat(f,")"),d:s()})):null};dE.registerSymbol=Fhe;var gW=e=>"radius"in e&&"startAngle"in e&&"endAngle"in e,fE=(e,t)=>{if(!e||typeof e=="function"||typeof e=="boolean")return null;var r=e;if(m.isValidElement(e)&&(r=e.props),typeof r!="object"&&typeof r!="function")return null;var n={};return Object.keys(r).forEach(i=>{nE(i)&&(n[i]=(o=>r[i](r,o)))}),n},Uhe=(e,t,r)=>n=>(e(t,r,n),null),tm=(e,t,r)=>{if(e===null||typeof e!="object"&&typeof e!="function")return null;var n=null;return Object.keys(e).forEach(i=>{var o=e[i];nE(i)&&typeof o=="function"&&(n||(n={}),n[i]=Uhe(o,t,r))}),n};function jM(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function Whe(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?jM(Object(r),!0).forEach(function(n){Khe(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):jM(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function Khe(e,t,r){return(t=Hhe(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Hhe(e){var t=Vhe(e,"string");return typeof t=="symbol"?t:t+""}function Vhe(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Er(e,t){var r=Whe({},e),n=t,i=Object.keys(t),o=i.reduce((a,s)=>(a[s]===void 0&&n[s]!==void 0&&(a[s]=n[s]),a),r);return o}function xy(){return xy=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},xy.apply(null,arguments)}function EM(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function qhe(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?EM(Object(r),!0).forEach(function(n){Ghe(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):EM(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function Ghe(e,t,r){return(t=Zhe(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Zhe(e){var t=Xhe(e,"string");return typeof t=="symbol"?t:t+""}function Xhe(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var co=32,Yhe={align:"center",iconSize:14,inactiveColor:"#ccc",layout:"horizontal",verticalAlign:"middle"};function Qhe(e){var{data:t,iconType:r,inactiveColor:n}=e,i=co/2,o=co/6,a=co/3,s=t.inactive?n:t.color,u=r??t.type;if(u==="none")return null;if(u==="plainline"){var d;return m.createElement("line",{strokeWidth:4,fill:"none",stroke:s,strokeDasharray:(d=t.payload)===null||d===void 0?void 0:d.strokeDasharray,x1:0,y1:i,x2:co,y2:i,className:"recharts-legend-icon"})}if(u==="line")return m.createElement("path",{strokeWidth:4,fill:"none",stroke:s,d:"M0,".concat(i,"h").concat(a,`
313
+ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(const x of this.seen.entries()){const k=x[1];if(t===x[0]){a(x);continue}if(n.external){const P=(p=n.external.registry.get(x[0]))==null?void 0:p.id;if(t!==x[0]&&P){a(x);continue}}if((v=this.metadataRegistry.get(x[0]))==null?void 0:v.id){a(x);continue}if(k.cycle){a(x);continue}if(k.count>1&&n.reused==="ref"){a(x);continue}}const s=(x,k)=>{const $=this.seen.get(x),P=$.def??$.schema,j={...P};if($.ref===null)return;const C=$.ref;if($.ref=null,C){s(C,k);const I=this.seen.get(C).schema;I.$ref&&(k.target==="draft-7"||k.target==="draft-4"||k.target==="openapi-3.0")?(P.allOf=P.allOf??[],P.allOf.push(I)):(Object.assign(P,I),Object.assign(P,j))}$.isParent||this.override({zodSchema:x,jsonSchema:P,path:$.path??[]})};for(const x of[...this.seen.entries()].reverse())s(x[0],{target:this.target});const u={};if(this.target==="draft-2020-12"?u.$schema="https://json-schema.org/draft/2020-12/schema":this.target==="draft-7"?u.$schema="http://json-schema.org/draft-07/schema#":this.target==="draft-4"?u.$schema="http://json-schema.org/draft-04/schema#":this.target==="openapi-3.0"||console.warn(`Invalid target: ${this.target}`),(y=n.external)!=null&&y.uri){const x=(b=n.external.registry.get(t))==null?void 0:b.id;if(!x)throw new Error("Schema is missing an `id` property");u.$id=n.external.uri(x)}Object.assign(u,i.def);const d=((w=n.external)==null?void 0:w.defs)??{};for(const x of this.seen.entries()){const k=x[1];k.def&&k.defId&&(d[k.defId]=k.def)}n.external||Object.keys(d).length>0&&(this.target==="draft-2020-12"?u.$defs=d:u.definitions=d);try{return JSON.parse(JSON.stringify(u))}catch{throw new Error("Error converting schema to JSON.")}}}function aU(e,t){if(e instanceof MC){const n=new Uk(t),i={};for(const s of e._idmap.entries()){const[u,d]=s;n.process(d)}const o={},a={registry:e,uri:t==null?void 0:t.uri,defs:i};for(const s of e._idmap.entries()){const[u,d]=s;o[u]=n.emit(d,{...t,external:a})}if(Object.keys(i).length>0){const s=n.target==="draft-2020-12"?"$defs":"definitions";o.__shared={[s]:i}}return{schemas:o}}const r=new Uk(t);return r.process(e),r.emit(e,t)}function ri(e,t){const r=t??{seen:new Set};if(r.seen.has(e))return!1;r.seen.add(e);const n=e._zod.def;if(n.type==="transform")return!0;if(n.type==="array")return ri(n.element,r);if(n.type==="set")return ri(n.valueType,r);if(n.type==="lazy")return ri(n.getter(),r);if(n.type==="promise"||n.type==="optional"||n.type==="nonoptional"||n.type==="nullable"||n.type==="readonly"||n.type==="default"||n.type==="prefault")return ri(n.innerType,r);if(n.type==="intersection")return ri(n.left,r)||ri(n.right,r);if(n.type==="record"||n.type==="map")return ri(n.keyType,r)||ri(n.valueType,r);if(n.type==="pipe")return ri(n.in,r)||ri(n.out,r);if(n.type==="object"){for(const i in n.shape)if(ri(n.shape[i],r))return!0;return!1}if(n.type==="union"){for(const i of n.options)if(ri(i,r))return!0;return!1}if(n.type==="tuple"){for(const i of n.items)if(ri(i,r))return!0;return!!(n.rest&&ri(n.rest,r))}return!1}const Mce=Object.freeze(Object.defineProperty({__proto__:null},Symbol.toStringTag,{value:"Module"})),Rce=Object.freeze(Object.defineProperty({__proto__:null,$ZodAny:I5,$ZodArray:M5,$ZodAsyncError:Ou,$ZodBase64:v5,$ZodBase64URL:b5,$ZodBigInt:OC,$ZodBigIntFormat:$5,$ZodBoolean:IC,$ZodCIDRv4:m5,$ZodCIDRv6:g5,$ZodCUID:n5,$ZodCUID2:i5,$ZodCatch:eF,$ZodCheck:jr,$ZodCheckBigIntFormat:T6,$ZodCheckEndsWith:H6,$ZodCheckGreaterThan:CC,$ZodCheckIncludes:W6,$ZodCheckLengthEquals:L6,$ZodCheckLessThan:$C,$ZodCheckLowerCase:F6,$ZodCheckMaxLength:z6,$ZodCheckMaxSize:M6,$ZodCheckMimeType:q6,$ZodCheckMinLength:N6,$ZodCheckMinSize:R6,$ZodCheckMultipleOf:_6,$ZodCheckNumberFormat:A6,$ZodCheckOverwrite:G6,$ZodCheckProperty:V6,$ZodCheckRegex:B6,$ZodCheckSizeEquals:D6,$ZodCheckStartsWith:K6,$ZodCheckStringFormat:Gh,$ZodCheckUpperCase:U6,$ZodCodec:TC,$ZodCustom:lF,$ZodCustomStringFormat:k5,$ZodDate:T5,$ZodDefault:X5,$ZodDiscriminatedUnion:L5,$ZodE164:x5,$ZodEmail:J6,$ZodEmoji:t5,$ZodEncodeError:Wb,$ZodEnum:K5,$ZodError:fC,$ZodFile:V5,$ZodFunction:oF,$ZodGUID:Y6,$ZodIPv4:f5,$ZodIPv6:p5,$ZodISODate:u5,$ZodISODateTime:l5,$ZodISODuration:d5,$ZodISOTime:c5,$ZodIntersection:B5,$ZodJWT:S5,$ZodKSUID:s5,$ZodLazy:sF,$ZodLiteral:H5,$ZodMAC:h5,$ZodMap:U5,$ZodNaN:tF,$ZodNanoID:r5,$ZodNever:_5,$ZodNonOptional:Q5,$ZodNull:E5,$ZodNullable:Z5,$ZodNumber:EC,$ZodNumberFormat:P5,$ZodObject:z5,$ZodObjectJIT:N5,$ZodOptional:G5,$ZodPipe:rF,$ZodPrefault:Y5,$ZodPromise:aF,$ZodReadonly:nF,$ZodRealError:Yi,$ZodRecord:F5,$ZodRegistry:MC,$ZodSet:W5,$ZodString:Zh,$ZodStringFormat:lr,$ZodSuccess:J5,$ZodSymbol:C5,$ZodTemplateLiteral:iF,$ZodTransform:q5,$ZodTuple:AC,$ZodType:bt,$ZodULID:o5,$ZodURL:e5,$ZodUUID:Q6,$ZodUndefined:j5,$ZodUnion:_C,$ZodUnknown:O5,$ZodVoid:A5,$ZodXID:a5,$brand:$B,$constructor:ae,$input:hF,$output:pF,Doc:Z6,JSONSchema:Mce,JSONSchemaGenerator:Uk,NEVER:PB,TimePrecision:yF,_any:LF,_array:YF,_base64:QC,_base64url:JC,_bigint:AF,_boolean:OF,_catch:Ece,_check:rU,_cidrv4:XC,_cidrv6:YC,_coercedBigint:TF,_coercedBoolean:_F,_coercedDate:KF,_coercedNumber:PF,_coercedString:gF,_cuid:WC,_cuid2:KC,_custom:JF,_date:WF,_decode:gC,_decodeAsync:yC,_default:$ce,_discriminatedUnion:pce,_e164:ej,_email:DC,_emoji:FC,_encode:mC,_encodeAsync:vC,_endsWith:lj,_enum:bce,_file:QF,_float32:CF,_float64:jF,_gt:Fu,_gte:Ui,_guid:iy,_includes:aj,_int:$F,_int32:EF,_int64:MF,_intersection:hce,_ipv4:GC,_ipv6:ZC,_isoDate:xF,_isoDateTime:bF,_isoDuration:SF,_isoTime:wF,_jwt:tj,_ksuid:qC,_lazy:Ace,_length:Yb,_literal:wce,_lowercase:ij,_lt:Bu,_lte:Xo,_mac:vF,_map:vce,_max:Xo,_maxLength:Xb,_maxSize:Zb,_mime:uj,_min:Ui,_minLength:Td,_minSize:rh,_multipleOf:th,_nan:HF,_nanoid:UC,_nativeEnum:xce,_negative:qF,_never:FF,_nonnegative:ZF,_nonoptional:Cce,_nonpositive:GF,_normalize:cj,_null:NF,_nullable:Pce,_number:kF,_optional:kce,_overwrite:zl,_parse:Uh,_parseAsync:Wh,_pipe:Ice,_positive:VF,_promise:Tce,_property:XF,_readonly:Oce,_record:gce,_refine:eU,_regex:nj,_safeDecode:xC,_safeDecodeAsync:SC,_safeEncode:bC,_safeEncodeAsync:wC,_safeParse:Kh,_safeParseAsync:Hh,_set:yce,_size:rj,_slugify:hj,_startsWith:sj,_string:mF,_stringFormat:Xh,_stringbool:oU,_success:jce,_superRefine:tU,_symbol:DF,_templateLiteral:_ce,_toLowerCase:fj,_toUpperCase:pj,_transform:Sce,_trim:dj,_tuple:mce,_uint32:IF,_uint64:RF,_ulid:HC,_undefined:zF,_union:fce,_unknown:BF,_uppercase:oj,_url:Gb,_uuid:zC,_uuidv4:NC,_uuidv6:LC,_uuidv7:BC,_void:UF,_xid:VC,clone:jo,config:ci,decode:qse,decodeAsync:Zse,describe:nU,encode:Vse,encodeAsync:Gse,flattenError:pC,formatError:hC,globalConfig:ey,globalRegistry:qo,isValidBase64:jC,isValidBase64URL:y5,isValidJWT:w5,locales:fF,meta:iU,parse:Lk,parseAsync:Bk,prettifyError:VB,regexes:PC,registry:RC,safeDecode:Yse,safeDecodeAsync:Jse,safeEncode:Xse,safeEncodeAsync:Qse,safeParse:qB,safeParseAsync:GB,toDotPath:HB,toJSONSchema:aU,treeifyError:KB,util:UB,version:X6},Symbol.toStringTag,{value:"Module"})),mj=ae("ZodISODateTime",(e,t)=>{l5.init(e,t),pr.init(e,t)});function sU(e){return bF(mj,e)}const gj=ae("ZodISODate",(e,t)=>{u5.init(e,t),pr.init(e,t)});function lU(e){return xF(gj,e)}const vj=ae("ZodISOTime",(e,t)=>{c5.init(e,t),pr.init(e,t)});function uU(e){return wF(vj,e)}const yj=ae("ZodISODuration",(e,t)=>{d5.init(e,t),pr.init(e,t)});function cU(e){return SF(yj,e)}const Dce=Object.freeze(Object.defineProperty({__proto__:null,ZodISODate:gj,ZodISODateTime:mj,ZodISODuration:yj,ZodISOTime:vj,date:lU,datetime:sU,duration:cU,time:uU},Symbol.toStringTag,{value:"Module"})),dU=(e,t)=>{fC.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:r=>hC(e,r)},flatten:{value:r=>pC(e,r)},addIssue:{value:r=>{e.issues.push(r),e.message=JSON.stringify(e.issues,ty,2)}},addIssues:{value:r=>{e.issues.push(...r),e.message=JSON.stringify(e.issues,ty,2)}},isEmpty:{get(){return e.issues.length===0}}})},zce=ae("ZodError",dU),Qi=ae("ZodError",dU,{Parent:Error}),fU=Uh(Qi),pU=Wh(Qi),hU=Kh(Qi),mU=Hh(Qi),gU=mC(Qi),vU=gC(Qi),yU=vC(Qi),bU=yC(Qi),xU=bC(Qi),wU=xC(Qi),SU=wC(Qi),kU=SC(Qi),Ct=ae("ZodType",(e,t)=>(bt.init(e,t),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.check=(...r)=>e.clone(ws(t,{checks:[...t.checks??[],...r.map(n=>typeof n=="function"?{_zod:{check:n,def:{check:"custom"},onattach:[]}}:n)]})),e.clone=(r,n)=>jo(e,r,n),e.brand=()=>e,e.register=((r,n)=>(r.add(e,n),e)),e.parse=(r,n)=>fU(e,r,n,{callee:e.parse}),e.safeParse=(r,n)=>hU(e,r,n),e.parseAsync=async(r,n)=>pU(e,r,n,{callee:e.parseAsync}),e.safeParseAsync=async(r,n)=>mU(e,r,n),e.spa=e.safeParseAsync,e.encode=(r,n)=>gU(e,r,n),e.decode=(r,n)=>vU(e,r,n),e.encodeAsync=async(r,n)=>yU(e,r,n),e.decodeAsync=async(r,n)=>bU(e,r,n),e.safeEncode=(r,n)=>xU(e,r,n),e.safeDecode=(r,n)=>wU(e,r,n),e.safeEncodeAsync=async(r,n)=>SU(e,r,n),e.safeDecodeAsync=async(r,n)=>kU(e,r,n),e.refine=(r,n)=>e.check(u3(r,n)),e.superRefine=r=>e.check(c3(r)),e.overwrite=r=>e.check(zl(r)),e.optional=()=>sy(e),e.nullable=()=>ly(e),e.nullish=()=>sy(ly(e)),e.nonoptional=r=>YU(e,r),e.array=()=>Qh(e),e.or=r=>nx([e,r]),e.and=r=>Bj(e,r),e.transform=r=>uy(e,Wj(r)),e.default=r=>GU(e,r),e.prefault=r=>XU(e,r),e.catch=r=>e3(e,r),e.pipe=r=>uy(e,r),e.readonly=()=>n3(e),e.describe=r=>{const n=e.clone();return qo.add(n,{description:r}),n},Object.defineProperty(e,"description",{get(){var r;return(r=qo.get(e))==null?void 0:r.description},configurable:!0}),e.meta=(...r)=>{if(r.length===0)return qo.get(e);const n=e.clone();return qo.add(n,r[0]),n},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e)),bj=ae("_ZodString",(e,t)=>{Zh.init(e,t),Ct.init(e,t);const r=e._zod.bag;e.format=r.format??null,e.minLength=r.minimum??null,e.maxLength=r.maximum??null,e.regex=(...n)=>e.check(nj(...n)),e.includes=(...n)=>e.check(aj(...n)),e.startsWith=(...n)=>e.check(sj(...n)),e.endsWith=(...n)=>e.check(lj(...n)),e.min=(...n)=>e.check(Td(...n)),e.max=(...n)=>e.check(Xb(...n)),e.length=(...n)=>e.check(Yb(...n)),e.nonempty=(...n)=>e.check(Td(1,...n)),e.lowercase=n=>e.check(ij(n)),e.uppercase=n=>e.check(oj(n)),e.trim=()=>e.check(dj()),e.normalize=(...n)=>e.check(cj(...n)),e.toLowerCase=()=>e.check(fj()),e.toUpperCase=()=>e.check(pj()),e.slugify=()=>e.check(hj())}),Qb=ae("ZodString",(e,t)=>{Zh.init(e,t),bj.init(e,t),e.email=r=>e.check(DC(xj,r)),e.url=r=>e.check(Gb(Jb,r)),e.jwt=r=>e.check(tj(Rj,r)),e.emoji=r=>e.check(FC(wj,r)),e.guid=r=>e.check(iy(oy,r)),e.uuid=r=>e.check(zC(rs,r)),e.uuidv4=r=>e.check(NC(rs,r)),e.uuidv6=r=>e.check(LC(rs,r)),e.uuidv7=r=>e.check(BC(rs,r)),e.nanoid=r=>e.check(UC(Sj,r)),e.guid=r=>e.check(iy(oy,r)),e.cuid=r=>e.check(WC(kj,r)),e.cuid2=r=>e.check(KC(Pj,r)),e.ulid=r=>e.check(HC($j,r)),e.base64=r=>e.check(QC(Aj,r)),e.base64url=r=>e.check(JC(Tj,r)),e.xid=r=>e.check(VC(Cj,r)),e.ksuid=r=>e.check(qC(jj,r)),e.ipv4=r=>e.check(GC(Ej,r)),e.ipv6=r=>e.check(ZC(Ij,r)),e.cidrv4=r=>e.check(XC(Oj,r)),e.cidrv6=r=>e.check(YC(_j,r)),e.e164=r=>e.check(ej(Mj,r)),e.datetime=r=>e.check(sU(r)),e.date=r=>e.check(lU(r)),e.time=r=>e.check(uU(r)),e.duration=r=>e.check(cU(r))});function Uu(e){return mF(Qb,e)}const pr=ae("ZodStringFormat",(e,t)=>{lr.init(e,t),bj.init(e,t)}),xj=ae("ZodEmail",(e,t)=>{J6.init(e,t),pr.init(e,t)});function Nce(e){return DC(xj,e)}const oy=ae("ZodGUID",(e,t)=>{Y6.init(e,t),pr.init(e,t)});function Lce(e){return iy(oy,e)}const rs=ae("ZodUUID",(e,t)=>{Q6.init(e,t),pr.init(e,t)});function Bce(e){return zC(rs,e)}function Fce(e){return NC(rs,e)}function Uce(e){return LC(rs,e)}function Wce(e){return BC(rs,e)}const Jb=ae("ZodURL",(e,t)=>{e5.init(e,t),pr.init(e,t)});function Kce(e){return Gb(Jb,e)}function Hce(e){return Gb(Jb,{protocol:/^https?$/,hostname:p6,...Ce(e)})}const wj=ae("ZodEmoji",(e,t)=>{t5.init(e,t),pr.init(e,t)});function Vce(e){return FC(wj,e)}const Sj=ae("ZodNanoID",(e,t)=>{r5.init(e,t),pr.init(e,t)});function qce(e){return UC(Sj,e)}const kj=ae("ZodCUID",(e,t)=>{n5.init(e,t),pr.init(e,t)});function Gce(e){return WC(kj,e)}const Pj=ae("ZodCUID2",(e,t)=>{i5.init(e,t),pr.init(e,t)});function Zce(e){return KC(Pj,e)}const $j=ae("ZodULID",(e,t)=>{o5.init(e,t),pr.init(e,t)});function Xce(e){return HC($j,e)}const Cj=ae("ZodXID",(e,t)=>{a5.init(e,t),pr.init(e,t)});function Yce(e){return VC(Cj,e)}const jj=ae("ZodKSUID",(e,t)=>{s5.init(e,t),pr.init(e,t)});function Qce(e){return qC(jj,e)}const Ej=ae("ZodIPv4",(e,t)=>{f5.init(e,t),pr.init(e,t)});function Jce(e){return GC(Ej,e)}const PU=ae("ZodMAC",(e,t)=>{h5.init(e,t),pr.init(e,t)});function ede(e){return vF(PU,e)}const Ij=ae("ZodIPv6",(e,t)=>{p5.init(e,t),pr.init(e,t)});function tde(e){return ZC(Ij,e)}const Oj=ae("ZodCIDRv4",(e,t)=>{m5.init(e,t),pr.init(e,t)});function rde(e){return XC(Oj,e)}const _j=ae("ZodCIDRv6",(e,t)=>{g5.init(e,t),pr.init(e,t)});function nde(e){return YC(_j,e)}const Aj=ae("ZodBase64",(e,t)=>{v5.init(e,t),pr.init(e,t)});function ide(e){return QC(Aj,e)}const Tj=ae("ZodBase64URL",(e,t)=>{b5.init(e,t),pr.init(e,t)});function ode(e){return JC(Tj,e)}const Mj=ae("ZodE164",(e,t)=>{x5.init(e,t),pr.init(e,t)});function ade(e){return ej(Mj,e)}const Rj=ae("ZodJWT",(e,t)=>{S5.init(e,t),pr.init(e,t)});function sde(e){return tj(Rj,e)}const Yh=ae("ZodCustomStringFormat",(e,t)=>{k5.init(e,t),pr.init(e,t)});function lde(e,t,r={}){return Xh(Yh,e,t,r)}function ude(e){return Xh(Yh,"hostname",f6,e)}function cde(e){return Xh(Yh,"hex",I6,e)}function dde(e,t){const r=(t==null?void 0:t.enc)??"hex",n=`${e}_${r}`,i=PC[n];if(!i)throw new Error(`Unrecognized hash format: ${n}`);return Xh(Yh,n,i,t)}const ex=ae("ZodNumber",(e,t)=>{EC.init(e,t),Ct.init(e,t),e.gt=(n,i)=>e.check(Fu(n,i)),e.gte=(n,i)=>e.check(Ui(n,i)),e.min=(n,i)=>e.check(Ui(n,i)),e.lt=(n,i)=>e.check(Bu(n,i)),e.lte=(n,i)=>e.check(Xo(n,i)),e.max=(n,i)=>e.check(Xo(n,i)),e.int=n=>e.check(Wk(n)),e.safe=n=>e.check(Wk(n)),e.positive=n=>e.check(Fu(0,n)),e.nonnegative=n=>e.check(Ui(0,n)),e.negative=n=>e.check(Bu(0,n)),e.nonpositive=n=>e.check(Xo(0,n)),e.multipleOf=(n,i)=>e.check(th(n,i)),e.step=(n,i)=>e.check(th(n,i)),e.finite=()=>e;const r=e._zod.bag;e.minValue=Math.max(r.minimum??Number.NEGATIVE_INFINITY,r.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,e.maxValue=Math.min(r.maximum??Number.POSITIVE_INFINITY,r.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,e.isInt=(r.format??"").includes("int")||Number.isSafeInteger(r.multipleOf??.5),e.isFinite=!0,e.format=r.format??null});function $U(e){return kF(ex,e)}const Jd=ae("ZodNumberFormat",(e,t)=>{P5.init(e,t),ex.init(e,t)});function Wk(e){return $F(Jd,e)}function fde(e){return CF(Jd,e)}function pde(e){return jF(Jd,e)}function hde(e){return EF(Jd,e)}function mde(e){return IF(Jd,e)}const tx=ae("ZodBoolean",(e,t)=>{IC.init(e,t),Ct.init(e,t)});function CU(e){return OF(tx,e)}const rx=ae("ZodBigInt",(e,t)=>{OC.init(e,t),Ct.init(e,t),e.gte=(n,i)=>e.check(Ui(n,i)),e.min=(n,i)=>e.check(Ui(n,i)),e.gt=(n,i)=>e.check(Fu(n,i)),e.gte=(n,i)=>e.check(Ui(n,i)),e.min=(n,i)=>e.check(Ui(n,i)),e.lt=(n,i)=>e.check(Bu(n,i)),e.lte=(n,i)=>e.check(Xo(n,i)),e.max=(n,i)=>e.check(Xo(n,i)),e.positive=n=>e.check(Fu(BigInt(0),n)),e.negative=n=>e.check(Bu(BigInt(0),n)),e.nonpositive=n=>e.check(Xo(BigInt(0),n)),e.nonnegative=n=>e.check(Ui(BigInt(0),n)),e.multipleOf=(n,i)=>e.check(th(n,i));const r=e._zod.bag;e.minValue=r.minimum??null,e.maxValue=r.maximum??null,e.format=r.format??null});function gde(e){return AF(rx,e)}const Dj=ae("ZodBigIntFormat",(e,t)=>{$5.init(e,t),rx.init(e,t)});function vde(e){return MF(Dj,e)}function yde(e){return RF(Dj,e)}const jU=ae("ZodSymbol",(e,t)=>{C5.init(e,t),Ct.init(e,t)});function bde(e){return DF(jU,e)}const EU=ae("ZodUndefined",(e,t)=>{j5.init(e,t),Ct.init(e,t)});function xde(e){return zF(EU,e)}const IU=ae("ZodNull",(e,t)=>{E5.init(e,t),Ct.init(e,t)});function OU(e){return NF(IU,e)}const _U=ae("ZodAny",(e,t)=>{I5.init(e,t),Ct.init(e,t)});function wde(){return LF(_U)}const AU=ae("ZodUnknown",(e,t)=>{O5.init(e,t),Ct.init(e,t)});function Md(){return BF(AU)}const TU=ae("ZodNever",(e,t)=>{_5.init(e,t),Ct.init(e,t)});function zj(e){return FF(TU,e)}const MU=ae("ZodVoid",(e,t)=>{A5.init(e,t),Ct.init(e,t)});function Sde(e){return UF(MU,e)}const Nj=ae("ZodDate",(e,t)=>{T5.init(e,t),Ct.init(e,t),e.min=(n,i)=>e.check(Ui(n,i)),e.max=(n,i)=>e.check(Xo(n,i));const r=e._zod.bag;e.minDate=r.minimum?new Date(r.minimum):null,e.maxDate=r.maximum?new Date(r.maximum):null});function kde(e){return WF(Nj,e)}const RU=ae("ZodArray",(e,t)=>{M5.init(e,t),Ct.init(e,t),e.element=t.element,e.min=(r,n)=>e.check(Td(r,n)),e.nonempty=r=>e.check(Td(1,r)),e.max=(r,n)=>e.check(Xb(r,n)),e.length=(r,n)=>e.check(Yb(r,n)),e.unwrap=()=>e.element});function Qh(e,t){return YF(RU,e,t)}function Pde(e){const t=e._zod.def.shape;return Uj(Object.keys(t))}const ef=ae("ZodObject",(e,t)=>{N5.init(e,t),Ct.init(e,t),Ot(e,"shape",()=>t.shape),e.keyof=()=>Uj(Object.keys(e._zod.def.shape)),e.catchall=r=>e.clone({...e._zod.def,catchall:r}),e.passthrough=()=>e.clone({...e._zod.def,catchall:Md()}),e.loose=()=>e.clone({...e._zod.def,catchall:Md()}),e.strict=()=>e.clone({...e._zod.def,catchall:zj()}),e.strip=()=>e.clone({...e._zod.def,catchall:void 0}),e.extend=r=>RB(e,r),e.safeExtend=r=>DB(e,r),e.merge=r=>zB(e,r),e.pick=r=>TB(e,r),e.omit=r=>MB(e,r),e.partial=(...r)=>NB(Kj,e,r[0]),e.required=(...r)=>LB(Hj,e,r[0])});function ay(e,t){const r={type:"object",shape:e??{},...Ce(t)};return new ef(r)}function $de(e,t){return new ef({type:"object",shape:e,catchall:zj(),...Ce(t)})}function Cde(e,t){return new ef({type:"object",shape:e,catchall:Md(),...Ce(t)})}const Lj=ae("ZodUnion",(e,t)=>{_C.init(e,t),Ct.init(e,t),e.options=t.options});function nx(e,t){return new Lj({type:"union",options:e,...Ce(t)})}const DU=ae("ZodDiscriminatedUnion",(e,t)=>{Lj.init(e,t),L5.init(e,t)});function jde(e,t,r){return new DU({type:"union",options:t,discriminator:e,...Ce(r)})}const zU=ae("ZodIntersection",(e,t)=>{B5.init(e,t),Ct.init(e,t)});function Bj(e,t){return new zU({type:"intersection",left:e,right:t})}const NU=ae("ZodTuple",(e,t)=>{AC.init(e,t),Ct.init(e,t),e.rest=r=>e.clone({...e._zod.def,rest:r})});function LU(e,t,r){const n=t instanceof bt,i=n?r:t,o=n?t:null;return new NU({type:"tuple",items:e,rest:o,...Ce(i)})}const Fj=ae("ZodRecord",(e,t)=>{F5.init(e,t),Ct.init(e,t),e.keyType=t.keyType,e.valueType=t.valueType});function BU(e,t,r){return new Fj({type:"record",keyType:e,valueType:t,...Ce(r)})}function Ede(e,t,r){const n=jo(e);return n._zod.values=void 0,new Fj({type:"record",keyType:n,valueType:t,...Ce(r)})}const FU=ae("ZodMap",(e,t)=>{U5.init(e,t),Ct.init(e,t),e.keyType=t.keyType,e.valueType=t.valueType});function Ide(e,t,r){return new FU({type:"map",keyType:e,valueType:t,...Ce(r)})}const UU=ae("ZodSet",(e,t)=>{W5.init(e,t),Ct.init(e,t),e.min=(...r)=>e.check(rh(...r)),e.nonempty=r=>e.check(rh(1,r)),e.max=(...r)=>e.check(Zb(...r)),e.size=(...r)=>e.check(rj(...r))});function Ode(e,t){return new UU({type:"set",valueType:e,...Ce(t)})}const nh=ae("ZodEnum",(e,t)=>{K5.init(e,t),Ct.init(e,t),e.enum=t.entries,e.options=Object.values(t.entries);const r=new Set(Object.keys(t.entries));e.extract=(n,i)=>{const o={};for(const a of n)if(r.has(a))o[a]=t.entries[a];else throw new Error(`Key ${a} not found in enum`);return new nh({...t,checks:[],...Ce(i),entries:o})},e.exclude=(n,i)=>{const o={...t.entries};for(const a of n)if(r.has(a))delete o[a];else throw new Error(`Key ${a} not found in enum`);return new nh({...t,checks:[],...Ce(i),entries:o})}});function Uj(e,t){const r=Array.isArray(e)?Object.fromEntries(e.map(n=>[n,n])):e;return new nh({type:"enum",entries:r,...Ce(t)})}function _de(e,t){return new nh({type:"enum",entries:e,...Ce(t)})}const WU=ae("ZodLiteral",(e,t)=>{H5.init(e,t),Ct.init(e,t),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function Ade(e,t){return new WU({type:"literal",values:Array.isArray(e)?e:[e],...Ce(t)})}const KU=ae("ZodFile",(e,t)=>{V5.init(e,t),Ct.init(e,t),e.min=(r,n)=>e.check(rh(r,n)),e.max=(r,n)=>e.check(Zb(r,n)),e.mime=(r,n)=>e.check(uj(Array.isArray(r)?r:[r],n))});function Tde(e){return QF(KU,e)}const HU=ae("ZodTransform",(e,t)=>{q5.init(e,t),Ct.init(e,t),e._zod.parse=(r,n)=>{if(n.direction==="backward")throw new Wb(e.constructor.name);r.addIssue=o=>{if(typeof o=="string")r.issues.push(_d(o,r.value,t));else{const a=o;a.fatal&&(a.continue=!1),a.code??(a.code="custom"),a.input??(a.input=r.value),a.inst??(a.inst=e),r.issues.push(_d(a))}};const i=t.transform(r.value,r);return i instanceof Promise?i.then(o=>(r.value=o,r)):(r.value=i,r)}});function Wj(e){return new HU({type:"transform",transform:e})}const Kj=ae("ZodOptional",(e,t)=>{G5.init(e,t),Ct.init(e,t),e.unwrap=()=>e._zod.def.innerType});function sy(e){return new Kj({type:"optional",innerType:e})}const VU=ae("ZodNullable",(e,t)=>{Z5.init(e,t),Ct.init(e,t),e.unwrap=()=>e._zod.def.innerType});function ly(e){return new VU({type:"nullable",innerType:e})}function Mde(e){return sy(ly(e))}const qU=ae("ZodDefault",(e,t)=>{X5.init(e,t),Ct.init(e,t),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function GU(e,t){return new qU({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():Hb(t)}})}const ZU=ae("ZodPrefault",(e,t)=>{Y5.init(e,t),Ct.init(e,t),e.unwrap=()=>e._zod.def.innerType});function XU(e,t){return new ZU({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():Hb(t)}})}const Hj=ae("ZodNonOptional",(e,t)=>{Q5.init(e,t),Ct.init(e,t),e.unwrap=()=>e._zod.def.innerType});function YU(e,t){return new Hj({type:"nonoptional",innerType:e,...Ce(t)})}const QU=ae("ZodSuccess",(e,t)=>{J5.init(e,t),Ct.init(e,t),e.unwrap=()=>e._zod.def.innerType});function Rde(e){return new QU({type:"success",innerType:e})}const JU=ae("ZodCatch",(e,t)=>{eF.init(e,t),Ct.init(e,t),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function e3(e,t){return new JU({type:"catch",innerType:e,catchValue:typeof t=="function"?t:()=>t})}const t3=ae("ZodNaN",(e,t)=>{tF.init(e,t),Ct.init(e,t)});function Dde(e){return HF(t3,e)}const Vj=ae("ZodPipe",(e,t)=>{rF.init(e,t),Ct.init(e,t),e.in=t.in,e.out=t.out});function uy(e,t){return new Vj({type:"pipe",in:e,out:t})}const qj=ae("ZodCodec",(e,t)=>{Vj.init(e,t),TC.init(e,t)});function zde(e,t,r){return new qj({type:"pipe",in:e,out:t,transform:r.decode,reverseTransform:r.encode})}const r3=ae("ZodReadonly",(e,t)=>{nF.init(e,t),Ct.init(e,t),e.unwrap=()=>e._zod.def.innerType});function n3(e){return new r3({type:"readonly",innerType:e})}const i3=ae("ZodTemplateLiteral",(e,t)=>{iF.init(e,t),Ct.init(e,t)});function Nde(e,t){return new i3({type:"template_literal",parts:e,...Ce(t)})}const o3=ae("ZodLazy",(e,t)=>{sF.init(e,t),Ct.init(e,t),e.unwrap=()=>e._zod.def.getter()});function a3(e){return new o3({type:"lazy",getter:e})}const s3=ae("ZodPromise",(e,t)=>{aF.init(e,t),Ct.init(e,t),e.unwrap=()=>e._zod.def.innerType});function Lde(e){return new s3({type:"promise",innerType:e})}const l3=ae("ZodFunction",(e,t)=>{oF.init(e,t),Ct.init(e,t)});function J2(e){return new l3({type:"function",input:Array.isArray(e==null?void 0:e.input)?LU(e==null?void 0:e.input):(e==null?void 0:e.input)??Qh(Md()),output:(e==null?void 0:e.output)??Md()})}const ix=ae("ZodCustom",(e,t)=>{lF.init(e,t),Ct.init(e,t)});function Bde(e){const t=new jr({check:"custom"});return t._zod.check=e,t}function Fde(e,t){return JF(ix,e??(()=>!0),t)}function u3(e,t={}){return eU(ix,e,t)}function c3(e){return tU(e)}const Ude=nU,Wde=iU;function Kde(e,t={error:`Input not instance of ${e.name}`}){const r=new ix({type:"custom",check:"custom",fn:n=>n instanceof e,abort:!0,...Ce(t)});return r._zod.bag.Class=e,r}const Hde=(...e)=>oU({Codec:qj,Boolean:tx,String:Qb},...e);function Vde(e){const t=a3(()=>nx([Uu(e),$U(),CU(),OU(),Qh(t),BU(Uu(),t)]));return t}function qde(e,t){return uy(Wj(e),t)}const Gde={invalid_type:"invalid_type",too_big:"too_big",too_small:"too_small",invalid_format:"invalid_format",not_multiple_of:"not_multiple_of",unrecognized_keys:"unrecognized_keys",invalid_union:"invalid_union",invalid_key:"invalid_key",invalid_element:"invalid_element",invalid_value:"invalid_value",custom:"custom"};function Zde(e){ci({customError:e})}function Xde(){return ci().customError}var Kk;Kk||(Kk={});function Yde(e){return gF(Qb,e)}function Qde(e){return PF(ex,e)}function Jde(e){return _F(tx,e)}function efe(e){return TF(rx,e)}function tfe(e){return KF(Nj,e)}const rfe=Object.freeze(Object.defineProperty({__proto__:null,bigint:efe,boolean:Jde,date:tfe,number:Qde,string:Yde},Symbol.toStringTag,{value:"Module"}));ci(uF());const ie=Object.freeze(Object.defineProperty({__proto__:null,$brand:$B,$input:hF,$output:pF,NEVER:PB,TimePrecision:yF,ZodAny:_U,ZodArray:RU,ZodBase64:Aj,ZodBase64URL:Tj,ZodBigInt:rx,ZodBigIntFormat:Dj,ZodBoolean:tx,ZodCIDRv4:Oj,ZodCIDRv6:_j,ZodCUID:kj,ZodCUID2:Pj,ZodCatch:JU,ZodCodec:qj,ZodCustom:ix,ZodCustomStringFormat:Yh,ZodDate:Nj,ZodDefault:qU,ZodDiscriminatedUnion:DU,ZodE164:Mj,ZodEmail:xj,ZodEmoji:wj,ZodEnum:nh,ZodError:zce,ZodFile:KU,get ZodFirstPartyTypeKind(){return Kk},ZodFunction:l3,ZodGUID:oy,ZodIPv4:Ej,ZodIPv6:Ij,ZodISODate:gj,ZodISODateTime:mj,ZodISODuration:yj,ZodISOTime:vj,ZodIntersection:zU,ZodIssueCode:Gde,ZodJWT:Rj,ZodKSUID:jj,ZodLazy:o3,ZodLiteral:WU,ZodMAC:PU,ZodMap:FU,ZodNaN:t3,ZodNanoID:Sj,ZodNever:TU,ZodNonOptional:Hj,ZodNull:IU,ZodNullable:VU,ZodNumber:ex,ZodNumberFormat:Jd,ZodObject:ef,ZodOptional:Kj,ZodPipe:Vj,ZodPrefault:ZU,ZodPromise:s3,ZodReadonly:r3,ZodRealError:Qi,ZodRecord:Fj,ZodSet:UU,ZodString:Qb,ZodStringFormat:pr,ZodSuccess:QU,ZodSymbol:jU,ZodTemplateLiteral:i3,ZodTransform:HU,ZodTuple:NU,ZodType:Ct,ZodULID:$j,ZodURL:Jb,ZodUUID:rs,ZodUndefined:EU,ZodUnion:Lj,ZodUnknown:AU,ZodVoid:MU,ZodXID:Cj,_ZodString:bj,_default:GU,_function:J2,any:wde,array:Qh,base64:ide,base64url:ode,bigint:gde,boolean:CU,catch:e3,check:Bde,cidrv4:rde,cidrv6:nde,clone:jo,codec:zde,coerce:rfe,config:ci,core:Rce,cuid:Gce,cuid2:Zce,custom:Fde,date:kde,decode:vU,decodeAsync:bU,describe:Ude,discriminatedUnion:jde,e164:ade,email:Nce,emoji:Vce,encode:gU,encodeAsync:yU,endsWith:lj,enum:Uj,file:Tde,flattenError:pC,float32:fde,float64:pde,formatError:hC,function:J2,getErrorMap:Xde,globalRegistry:qo,gt:Fu,gte:Ui,guid:Lce,hash:dde,hex:cde,hostname:ude,httpUrl:Hce,includes:aj,instanceof:Kde,int:Wk,int32:hde,int64:vde,intersection:Bj,ipv4:Jce,ipv6:tde,iso:Dce,json:Vde,jwt:sde,keyof:Pde,ksuid:Qce,lazy:a3,length:Yb,literal:Ade,locales:fF,looseObject:Cde,lowercase:ij,lt:Bu,lte:Xo,mac:ede,map:Ide,maxLength:Xb,maxSize:Zb,meta:Wde,mime:uj,minLength:Td,minSize:rh,multipleOf:th,nan:Dde,nanoid:qce,nativeEnum:_de,negative:qF,never:zj,nonnegative:ZF,nonoptional:YU,nonpositive:GF,normalize:cj,null:OU,nullable:ly,nullish:Mde,number:$U,object:ay,optional:sy,overwrite:zl,parse:fU,parseAsync:pU,partialRecord:Ede,pipe:uy,positive:VF,prefault:XU,preprocess:qde,prettifyError:VB,promise:Lde,property:XF,readonly:n3,record:BU,refine:u3,regex:nj,regexes:PC,registry:RC,safeDecode:wU,safeDecodeAsync:kU,safeEncode:xU,safeEncodeAsync:SU,safeParse:hU,safeParseAsync:mU,set:Ode,setErrorMap:Zde,size:rj,slugify:hj,startsWith:sj,strictObject:$de,string:Uu,stringFormat:lde,stringbool:Hde,success:Rde,superRefine:c3,symbol:bde,templateLiteral:Nde,toJSONSchema:aU,toLowerCase:fj,toUpperCase:pj,transform:Wj,treeifyError:KB,trim:dj,tuple:LU,uint32:mde,uint64:yde,ulid:Xce,undefined:xde,union:nx,unknown:Md,uppercase:oj,url:Kce,util:UB,uuid:Bce,uuidv4:Fce,uuidv6:Uce,uuidv7:Wce,void:Sde,xid:Yce},Symbol.toStringTag,{value:"Module"}));var kl=(e,t)=>e.parse(t);function d3(e,t){return e&&t?e===t?e:Bj(e,t):e??t}function f3(e){var r,n;const t=e.shape?e.shape:(n=(r=e._def)==null?void 0:r.shape)==null?void 0:n.call(r);return t?typeof t=="function"?t.call(e):t:{}}function p3(e,t=[]){if(!e)return[];const r=[];for(const[n,i]of Object.entries(e))if(i instanceof ef){const o=f3(i),a=p3(o,[...t,n]);r.push(...a.length?a:[[...t,n].join("_")])}else t.length>0&&r.push([...t,n].join("_"));return r}function h3(e,t){return t?e.replace(/:([A-Za-z0-9_]+)/g,(r,n)=>{const i=t[n];if(i==null)throw new Error(`Missing param :${n}`);return String(i)}):e}function Gj(e){const t=e.leaf.path.split("/").filter(Boolean),r=[e.leaf.method];for(const n of t){if(n.startsWith(":")){const i=n.slice(1),o=e.params&&i in e.params?e.params[i]:void 0;r.push([o]);continue}r.push(n)}return r.push(e.query??{}),r}function nfe(e){const r={...e.node??{},...e.cfg},n=r.feed===!0?d3(r.querySchema,r.queryExtensionSchema):r.querySchema,i=r.outputSchema?ay({out:r.outputSchema,meta:r.outputMetaSchema??Uu().optional()}):ay({meta:r.outputMetaSchema??Uu().optional()});if(r.feed===!0&&n instanceof ef){const o=f3(n),a=p3(o);a.length>0&&console.warn(`[routesV3.builder] Warning: feed query schema for ${e.method.toUpperCase()} ${e.path} contains nested objects. Consider using flat keys instead: ${a.join(", ")}`)}return{method:e.method,path:e.path,cfg:{...r,bodySchema:r.bodySchema,querySchema:n,paramsSchema:r.paramsSchema,outputSchema:i,outputMetaSchema:r.outputMetaSchema,queryExtensionSchema:r.queryExtensionSchema}}}var Rd=(e,t,r)=>{const n=`${e.toUpperCase()} ${t}`;return r?encodeURIComponent(n):n};function yo(e,t,r){const n=e??"",i=ife(n,!!r),o={},a=ofe(n,r);function s(u,d,f){const p=[],v=u,y=d;let b=f;function w(k,$){const P=$.paramsSchema??b,j=P?{...$,paramsSchema:P}:{...$},C=nfe({method:k,path:v,node:y,cfg:j});return p.push(C),x}const x={sub(...k){if(k.length===0)throw new Error("sub() expects at least one resource");for(const $ of k)for(const P of $){const j=P,C=j.cfg,I=C.paramsSchema,A=d3(b,I),T={...y,...C};A?T.paramsSchema=A:"paramsSchema"in T&&delete T.paramsSchema;const M={method:j.method,path:afe(v,j.path),cfg:T};p.push(M)}return x},get(k){return w("get",k)},post(k){return w("post",{...k,feed:!1})},put(k){return w("put",{...k,feed:!1})},patch(k){return w("patch",{...k,feed:!1})},delete(k){return w("delete",{...k,feed:!1})},done(){return p}};return x}return s(i,o,a)}function ife(e,t){const r=e??"";if(!t)return r;if(!r)throw new Error("resource() requires a segment name when defining an id schema");if(r.includes("/")){const n=r.split("/").filter(Boolean);if(n.length===0)throw new Error("resource() received an invalid segment for param injection");const i=n.length-1,o=n[i];return n[i]=o.startsWith(":")?o:`:${o}`,`${r.startsWith("/")?"/":""}${n.join("/")}`}return r.startsWith(":")?r:`:${r}`}function ofe(e,t){if(!t)return;const r=e.split("/").filter(Boolean),n=r.length>0?r[r.length-1]:e,i=n.startsWith(":")?n.slice(1):n;if(!i)throw new Error("resource() requires a non-empty name for id schema");return ay({[i]:t})}function afe(e,t){if(!e)return t;if(!t)return e;const r=e.endsWith("/")?e.replace(/\/+$/,""):e,n=t.startsWith("/")?t.replace(/^\/+/,""):t;return n?`${r}/${n}`:r}function sfe(e){const t=Object.fromEntries(e.map(n=>[`${n.method.toUpperCase()} ${n.path}`,n]));return{all:e,byKey:t,log:n=>{n.system("Finalized routes:"),Object.keys(t).forEach(i=>{t[i],n.system(`- ${i}`)})}}}var tf=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(){}},lfe={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},rl,g$,bL,ufe=(bL=class{constructor(){at(this,rl,lfe);at(this,g$,!1)}setTimeoutProvider(e){Fe(this,rl,e)}setTimeout(e,t){return Q(this,rl).setTimeout(e,t)}clearTimeout(e){Q(this,rl).clearTimeout(e)}setInterval(e,t){return Q(this,rl).setInterval(e,t)}clearInterval(e){Q(this,rl).clearInterval(e)}},rl=new WeakMap,g$=new WeakMap,bL),mu=new ufe;function cfe(e){setTimeout(e,0)}var Wu=typeof window>"u"||"Deno"in globalThis;function oi(){}function dfe(e,t){return typeof e=="function"?e(t):e}function Hk(e){return typeof e=="number"&&e>=0&&e!==1/0}function m3(e,t){return Math.max(e+(t||0)-Date.now(),0)}function gl(e,t){return typeof e=="function"?e(t):e}function ho(e,t){return typeof e=="function"?e(t):e}function eM(e,t){const{type:r="all",exact:n,fetchStatus:i,predicate:o,queryKey:a,stale:s}=e;if(a){if(n){if(t.queryHash!==Zj(a,t.options))return!1}else if(!ih(t.queryKey,a))return!1}if(r!=="all"){const u=t.isActive();if(r==="active"&&!u||r==="inactive"&&u)return!1}return!(typeof s=="boolean"&&t.isStale()!==s||i&&i!==t.state.fetchStatus||o&&!o(t))}function tM(e,t){const{exact:r,status:n,predicate:i,mutationKey:o}=e;if(o){if(!t.options.mutationKey)return!1;if(r){if(Ku(t.options.mutationKey)!==Ku(o))return!1}else if(!ih(t.options.mutationKey,o))return!1}return!(n&&t.state.status!==n||i&&!i(t))}function Zj(e,t){return((t==null?void 0:t.queryKeyHashFn)||Ku)(e)}function Ku(e){return JSON.stringify(e,(t,r)=>Vk(r)?Object.keys(r).sort().reduce((n,i)=>(n[i]=r[i],n),{}):r)}function ih(e,t){return e===t?!0:typeof e!=typeof t?!1:e&&t&&typeof e=="object"&&typeof t=="object"?Object.keys(t).every(r=>ih(e[r],t[r])):!1}var ffe=Object.prototype.hasOwnProperty;function g3(e,t){if(e===t)return e;const r=rM(e)&&rM(t);if(!r&&!(Vk(e)&&Vk(t)))return t;const i=(r?e:Object.keys(e)).length,o=r?t:Object.keys(t),a=o.length,s=r?new Array(a):{};let u=0;for(let d=0;d<a;d++){const f=r?d:o[d],p=e[f],v=t[f];if(p===v){s[f]=p,(r?d<i:ffe.call(e,f))&&u++;continue}if(p===null||v===null||typeof p!="object"||typeof v!="object"){s[f]=v;continue}const y=g3(p,v);s[f]=y,y===p&&u++}return i===a&&u===i?e:s}function cy(e,t){if(!t||Object.keys(e).length!==Object.keys(t).length)return!1;for(const r in e)if(e[r]!==t[r])return!1;return!0}function rM(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function Vk(e){if(!nM(e))return!1;const t=e.constructor;if(t===void 0)return!0;const r=t.prototype;return!(!nM(r)||!r.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(e)!==Object.prototype)}function nM(e){return Object.prototype.toString.call(e)==="[object Object]"}function pfe(e){return new Promise(t=>{mu.setTimeout(t,e)})}function qk(e,t,r){return typeof r.structuralSharing=="function"?r.structuralSharing(e,t):r.structuralSharing!==!1?g3(e,t):t}function v3(e){return e}function hfe(e,t,r=0){const n=[...e,t];return r&&n.length>r?n.slice(1):n}function mfe(e,t,r=0){const n=[t,...e];return r&&n.length>r?n.slice(0,-1):n}var Xj=Symbol();function y3(e,t){return!e.queryFn&&(t!=null&&t.initialPromise)?()=>t.initialPromise:!e.queryFn||e.queryFn===Xj?()=>Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function b3(e,t){return typeof e=="function"?e(...t):!!e}var xu,nl,dd,xL,gfe=(xL=class extends tf{constructor(){super();at(this,xu);at(this,nl);at(this,dd);Fe(this,dd,t=>{if(!Wu&&window.addEventListener){const r=()=>t();return window.addEventListener("visibilitychange",r,!1),()=>{window.removeEventListener("visibilitychange",r)}}})}onSubscribe(){Q(this,nl)||this.setEventListener(Q(this,dd))}onUnsubscribe(){var t;this.hasListeners()||((t=Q(this,nl))==null||t.call(this),Fe(this,nl,void 0))}setEventListener(t){var r;Fe(this,dd,t),(r=Q(this,nl))==null||r.call(this),Fe(this,nl,t(n=>{typeof n=="boolean"?this.setFocused(n):this.onFocus()}))}setFocused(t){Q(this,xu)!==t&&(Fe(this,xu,t),this.onFocus())}onFocus(){const t=this.isFocused();this.listeners.forEach(r=>{r(t)})}isFocused(){var t;return typeof Q(this,xu)=="boolean"?Q(this,xu):((t=globalThis.document)==null?void 0:t.visibilityState)!=="hidden"}},xu=new WeakMap,nl=new WeakMap,dd=new WeakMap,xL),Yj=new gfe;function Gk(){let e,t;const r=new Promise((i,o)=>{e=i,t=o});r.status="pending",r.catch(()=>{});function n(i){Object.assign(r,i),delete r.resolve,delete r.reject}return r.resolve=i=>{n({status:"fulfilled",value:i}),e(i)},r.reject=i=>{n({status:"rejected",reason:i}),t(i)},r}var vfe=cfe;function yfe(){let e=[],t=0,r=s=>{s()},n=s=>{s()},i=vfe;const o=s=>{t?e.push(s):i(()=>{r(s)})},a=()=>{const s=e;e=[],s.length&&i(()=>{n(()=>{s.forEach(u=>{r(u)})})})};return{batch:s=>{let u;t++;try{u=s()}finally{t--,t||a()}return u},batchCalls:s=>(...u)=>{o(()=>{s(...u)})},schedule:o,setNotifyFunction:s=>{r=s},setBatchNotifyFunction:s=>{n=s},setScheduler:s=>{i=s}}}var dn=yfe(),fd,il,pd,wL,bfe=(wL=class extends tf{constructor(){super();at(this,fd,!0);at(this,il);at(this,pd);Fe(this,pd,t=>{if(!Wu&&window.addEventListener){const r=()=>t(!0),n=()=>t(!1);return window.addEventListener("online",r,!1),window.addEventListener("offline",n,!1),()=>{window.removeEventListener("online",r),window.removeEventListener("offline",n)}}})}onSubscribe(){Q(this,il)||this.setEventListener(Q(this,pd))}onUnsubscribe(){var t;this.hasListeners()||((t=Q(this,il))==null||t.call(this),Fe(this,il,void 0))}setEventListener(t){var r;Fe(this,pd,t),(r=Q(this,il))==null||r.call(this),Fe(this,il,t(this.setOnline.bind(this)))}setOnline(t){Q(this,fd)!==t&&(Fe(this,fd,t),this.listeners.forEach(n=>{n(t)}))}isOnline(){return Q(this,fd)}},fd=new WeakMap,il=new WeakMap,pd=new WeakMap,wL),dy=new bfe;function xfe(e){return Math.min(1e3*2**e,3e4)}function x3(e){return(e??"online")==="online"?dy.isOnline():!0}var Zk=class extends Error{constructor(e){super("CancelledError"),this.revert=e==null?void 0:e.revert,this.silent=e==null?void 0:e.silent}};function w3(e){let t=!1,r=0,n;const i=Gk(),o=()=>i.status!=="pending",a=w=>{var x;if(!o()){const k=new Zk(w);v(k),(x=e.onCancel)==null||x.call(e,k)}},s=()=>{t=!0},u=()=>{t=!1},d=()=>Yj.isFocused()&&(e.networkMode==="always"||dy.isOnline())&&e.canRun(),f=()=>x3(e.networkMode)&&e.canRun(),p=w=>{o()||(n==null||n(),i.resolve(w))},v=w=>{o()||(n==null||n(),i.reject(w))},y=()=>new Promise(w=>{var x;n=k=>{(o()||d())&&w(k)},(x=e.onPause)==null||x.call(e)}).then(()=>{var w;n=void 0,o()||(w=e.onContinue)==null||w.call(e)}),b=()=>{if(o())return;let w;const x=r===0?e.initialPromise:void 0;try{w=x??e.fn()}catch(k){w=Promise.reject(k)}Promise.resolve(w).then(p).catch(k=>{var I;if(o())return;const $=e.retry??(Wu?0:3),P=e.retryDelay??xfe,j=typeof P=="function"?P(r,k):P,C=$===!0||typeof $=="number"&&r<$||typeof $=="function"&&$(r,k);if(t||!C){v(k);return}r++,(I=e.onFail)==null||I.call(e,r,k),pfe(j).then(()=>d()?void 0:y()).then(()=>{t?v(k):b()})})};return{promise:i,status:()=>i.status,cancel:a,continue:()=>(n==null||n(),i),cancelRetry:s,continueRetry:u,canStart:f,start:()=>(f()?b():y().then(b),i)}}var wu,SL,S3=(SL=class{constructor(){at(this,wu)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),Hk(this.gcTime)&&Fe(this,wu,mu.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(Wu?1/0:300*1e3))}clearGcTimeout(){Q(this,wu)&&(mu.clearTimeout(Q(this,wu)),Fe(this,wu,void 0))}},wu=new WeakMap,SL),Su,hd,fo,ku,kn,Sh,Pu,Fo,qa,kL,wfe=(kL=class extends S3{constructor(t){super();at(this,Fo);at(this,Su);at(this,hd);at(this,fo);at(this,ku);at(this,kn);at(this,Sh);at(this,Pu);Fe(this,Pu,!1),Fe(this,Sh,t.defaultOptions),this.setOptions(t.options),this.observers=[],Fe(this,ku,t.client),Fe(this,fo,Q(this,ku).getQueryCache()),this.queryKey=t.queryKey,this.queryHash=t.queryHash,Fe(this,Su,oM(this.options)),this.state=t.state??Q(this,Su),this.scheduleGc()}get meta(){return this.options.meta}get promise(){var t;return(t=Q(this,kn))==null?void 0:t.promise}setOptions(t){if(this.options={...Q(this,Sh),...t},this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){const r=oM(this.options);r.data!==void 0&&(this.setState(iM(r.data,r.dataUpdatedAt)),Fe(this,Su,r))}}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&Q(this,fo).remove(this)}setData(t,r){const n=qk(this.state.data,t,this.options);return Pt(this,Fo,qa).call(this,{data:n,type:"success",dataUpdatedAt:r==null?void 0:r.updatedAt,manual:r==null?void 0:r.manual}),n}setState(t,r){Pt(this,Fo,qa).call(this,{type:"setState",state:t,setStateOptions:r})}cancel(t){var n,i;const r=(n=Q(this,kn))==null?void 0:n.promise;return(i=Q(this,kn))==null||i.cancel(t),r?r.then(oi).catch(oi):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(Q(this,Su))}isActive(){return this.observers.some(t=>ho(t.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===Xj||this.state.dataUpdateCount+this.state.errorUpdateCount===0}isStatic(){return this.getObserversCount()>0?this.observers.some(t=>gl(t.options.staleTime,this)==="static"):!1}isStale(){return this.getObserversCount()>0?this.observers.some(t=>t.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(t=0){return this.state.data===void 0?!0:t==="static"?!1:this.state.isInvalidated?!0:!m3(this.state.dataUpdatedAt,t)}onFocus(){var r;const t=this.observers.find(n=>n.shouldFetchOnWindowFocus());t==null||t.refetch({cancelRefetch:!1}),(r=Q(this,kn))==null||r.continue()}onOnline(){var r;const t=this.observers.find(n=>n.shouldFetchOnReconnect());t==null||t.refetch({cancelRefetch:!1}),(r=Q(this,kn))==null||r.continue()}addObserver(t){this.observers.includes(t)||(this.observers.push(t),this.clearGcTimeout(),Q(this,fo).notify({type:"observerAdded",query:this,observer:t}))}removeObserver(t){this.observers.includes(t)&&(this.observers=this.observers.filter(r=>r!==t),this.observers.length||(Q(this,kn)&&(Q(this,Pu)?Q(this,kn).cancel({revert:!0}):Q(this,kn).cancelRetry()),this.scheduleGc()),Q(this,fo).notify({type:"observerRemoved",query:this,observer:t}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||Pt(this,Fo,qa).call(this,{type:"invalidate"})}async fetch(t,r){var u,d,f,p,v,y,b,w,x,k,$,P;if(this.state.fetchStatus!=="idle"&&((u=Q(this,kn))==null?void 0:u.status())!=="rejected"){if(this.state.data!==void 0&&(r!=null&&r.cancelRefetch))this.cancel({silent:!0});else if(Q(this,kn))return Q(this,kn).continueRetry(),Q(this,kn).promise}if(t&&this.setOptions(t),!this.options.queryFn){const j=this.observers.find(C=>C.options.queryFn);j&&this.setOptions(j.options)}const n=new AbortController,i=j=>{Object.defineProperty(j,"signal",{enumerable:!0,get:()=>(Fe(this,Pu,!0),n.signal)})},o=()=>{const j=y3(this.options,r),I=(()=>{const A={client:Q(this,ku),queryKey:this.queryKey,meta:this.meta};return i(A),A})();return Fe(this,Pu,!1),this.options.persister?this.options.persister(j,I,this):j(I)},s=(()=>{const j={fetchOptions:r,options:this.options,queryKey:this.queryKey,client:Q(this,ku),state:this.state,fetchFn:o};return i(j),j})();(d=this.options.behavior)==null||d.onFetch(s,this),Fe(this,hd,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((f=s.fetchOptions)==null?void 0:f.meta))&&Pt(this,Fo,qa).call(this,{type:"fetch",meta:(p=s.fetchOptions)==null?void 0:p.meta}),Fe(this,kn,w3({initialPromise:r==null?void 0:r.initialPromise,fn:s.fetchFn,onCancel:j=>{j instanceof Zk&&j.revert&&this.setState({...Q(this,hd),fetchStatus:"idle"}),n.abort()},onFail:(j,C)=>{Pt(this,Fo,qa).call(this,{type:"failed",failureCount:j,error:C})},onPause:()=>{Pt(this,Fo,qa).call(this,{type:"pause"})},onContinue:()=>{Pt(this,Fo,qa).call(this,{type:"continue"})},retry:s.options.retry,retryDelay:s.options.retryDelay,networkMode:s.options.networkMode,canRun:()=>!0}));try{const j=await Q(this,kn).start();if(j===void 0)throw new Error(`${this.queryHash} data is undefined`);return this.setData(j),(y=(v=Q(this,fo).config).onSuccess)==null||y.call(v,j,this),(w=(b=Q(this,fo).config).onSettled)==null||w.call(b,j,this.state.error,this),j}catch(j){if(j instanceof Zk){if(j.silent)return Q(this,kn).promise;if(j.revert){if(this.state.data===void 0)throw j;return this.state.data}}throw Pt(this,Fo,qa).call(this,{type:"error",error:j}),(k=(x=Q(this,fo).config).onError)==null||k.call(x,j,this),(P=($=Q(this,fo).config).onSettled)==null||P.call($,this.state.data,j,this),j}finally{this.scheduleGc()}}},Su=new WeakMap,hd=new WeakMap,fo=new WeakMap,ku=new WeakMap,kn=new WeakMap,Sh=new WeakMap,Pu=new WeakMap,Fo=new WeakSet,qa=function(t){const r=n=>{switch(t.type){case"failed":return{...n,fetchFailureCount:t.failureCount,fetchFailureReason:t.error};case"pause":return{...n,fetchStatus:"paused"};case"continue":return{...n,fetchStatus:"fetching"};case"fetch":return{...n,...k3(n.data,this.options),fetchMeta:t.meta??null};case"success":const i={...n,...iM(t.data,t.dataUpdatedAt),dataUpdateCount:n.dataUpdateCount+1,...!t.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return Fe(this,hd,t.manual?i:void 0),i;case"error":const o=t.error;return{...n,error:o,errorUpdateCount:n.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:n.fetchFailureCount+1,fetchFailureReason:o,fetchStatus:"idle",status:"error"};case"invalidate":return{...n,isInvalidated:!0};case"setState":return{...n,...t.state}}};this.state=r(this.state),dn.batch(()=>{this.observers.forEach(n=>{n.onQueryUpdate()}),Q(this,fo).notify({query:this,type:"updated",action:t})})},kL);function k3(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:x3(t.networkMode)?"fetching":"paused",...e===void 0&&{error:null,status:"pending"}}}function iM(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:"success"}}function oM(e){const t=typeof e.initialData=="function"?e.initialData():e.initialData,r=t!==void 0,n=r?typeof e.initialDataUpdatedAt=="function"?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:r?n??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:r?"success":"pending",fetchStatus:"idle"}}var bi,Dt,kh,ni,$u,md,Xa,ol,Ph,gd,vd,Cu,ju,al,yd,Yt,Dp,Xk,Yk,Qk,Jk,eP,tP,rP,$3,PL,P3=(PL=class extends tf{constructor(t,r){super();at(this,Yt);at(this,bi);at(this,Dt);at(this,kh);at(this,ni);at(this,$u);at(this,md);at(this,Xa);at(this,ol);at(this,Ph);at(this,gd);at(this,vd);at(this,Cu);at(this,ju);at(this,al);at(this,yd,new Set);this.options=r,Fe(this,bi,t),Fe(this,ol,null),Fe(this,Xa,Gk()),this.bindMethods(),this.setOptions(r)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(Q(this,Dt).addObserver(this),aM(Q(this,Dt),this.options)?Pt(this,Yt,Dp).call(this):this.updateResult(),Pt(this,Yt,Jk).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return nP(Q(this,Dt),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return nP(Q(this,Dt),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,Pt(this,Yt,eP).call(this),Pt(this,Yt,tP).call(this),Q(this,Dt).removeObserver(this)}setOptions(t){const r=this.options,n=Q(this,Dt);if(this.options=Q(this,bi).defaultQueryOptions(t),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof ho(this.options.enabled,Q(this,Dt))!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");Pt(this,Yt,rP).call(this),Q(this,Dt).setOptions(this.options),r._defaulted&&!cy(this.options,r)&&Q(this,bi).getQueryCache().notify({type:"observerOptionsUpdated",query:Q(this,Dt),observer:this});const i=this.hasListeners();i&&sM(Q(this,Dt),n,this.options,r)&&Pt(this,Yt,Dp).call(this),this.updateResult(),i&&(Q(this,Dt)!==n||ho(this.options.enabled,Q(this,Dt))!==ho(r.enabled,Q(this,Dt))||gl(this.options.staleTime,Q(this,Dt))!==gl(r.staleTime,Q(this,Dt)))&&Pt(this,Yt,Xk).call(this);const o=Pt(this,Yt,Yk).call(this);i&&(Q(this,Dt)!==n||ho(this.options.enabled,Q(this,Dt))!==ho(r.enabled,Q(this,Dt))||o!==Q(this,al))&&Pt(this,Yt,Qk).call(this,o)}getOptimisticResult(t){const r=Q(this,bi).getQueryCache().build(Q(this,bi),t),n=this.createResult(r,t);return kfe(this,n)&&(Fe(this,ni,n),Fe(this,md,this.options),Fe(this,$u,Q(this,Dt).state)),n}getCurrentResult(){return Q(this,ni)}trackResult(t,r){return new Proxy(t,{get:(n,i)=>(this.trackProp(i),r==null||r(i),i==="promise"&&(this.trackProp("data"),!this.options.experimental_prefetchInRender&&Q(this,Xa).status==="pending"&&Q(this,Xa).reject(new Error("experimental_prefetchInRender feature flag is not enabled"))),Reflect.get(n,i))})}trackProp(t){Q(this,yd).add(t)}getCurrentQuery(){return Q(this,Dt)}refetch({...t}={}){return this.fetch({...t})}fetchOptimistic(t){const r=Q(this,bi).defaultQueryOptions(t),n=Q(this,bi).getQueryCache().build(Q(this,bi),r);return n.fetch().then(()=>this.createResult(n,r))}fetch(t){return Pt(this,Yt,Dp).call(this,{...t,cancelRefetch:t.cancelRefetch??!0}).then(()=>(this.updateResult(),Q(this,ni)))}createResult(t,r){var M;const n=Q(this,Dt),i=this.options,o=Q(this,ni),a=Q(this,$u),s=Q(this,md),d=t!==n?t.state:Q(this,kh),{state:f}=t;let p={...f},v=!1,y;if(r._optimisticResults){const R=this.hasListeners(),D=!R&&aM(t,r),O=R&&sM(t,n,r,i);(D||O)&&(p={...p,...k3(f.data,t.options)}),r._optimisticResults==="isRestoring"&&(p.fetchStatus="idle")}let{error:b,errorUpdatedAt:w,status:x}=p;y=p.data;let k=!1;if(r.placeholderData!==void 0&&y===void 0&&x==="pending"){let R;o!=null&&o.isPlaceholderData&&r.placeholderData===(s==null?void 0:s.placeholderData)?(R=o.data,k=!0):R=typeof r.placeholderData=="function"?r.placeholderData((M=Q(this,vd))==null?void 0:M.state.data,Q(this,vd)):r.placeholderData,R!==void 0&&(x="success",y=qk(o==null?void 0:o.data,R,r),v=!0)}if(r.select&&y!==void 0&&!k)if(o&&y===(a==null?void 0:a.data)&&r.select===Q(this,Ph))y=Q(this,gd);else try{Fe(this,Ph,r.select),y=r.select(y),y=qk(o==null?void 0:o.data,y,r),Fe(this,gd,y),Fe(this,ol,null)}catch(R){Fe(this,ol,R)}Q(this,ol)&&(b=Q(this,ol),y=Q(this,gd),w=Date.now(),x="error");const $=p.fetchStatus==="fetching",P=x==="pending",j=x==="error",C=P&&$,I=y!==void 0,T={status:x,fetchStatus:p.fetchStatus,isPending:P,isSuccess:x==="success",isError:j,isInitialLoading:C,isLoading:C,data:y,dataUpdatedAt:p.dataUpdatedAt,error:b,errorUpdatedAt:w,failureCount:p.fetchFailureCount,failureReason:p.fetchFailureReason,errorUpdateCount:p.errorUpdateCount,isFetched:p.dataUpdateCount>0||p.errorUpdateCount>0,isFetchedAfterMount:p.dataUpdateCount>d.dataUpdateCount||p.errorUpdateCount>d.errorUpdateCount,isFetching:$,isRefetching:$&&!P,isLoadingError:j&&!I,isPaused:p.fetchStatus==="paused",isPlaceholderData:v,isRefetchError:j&&I,isStale:Qj(t,r),refetch:this.refetch,promise:Q(this,Xa),isEnabled:ho(r.enabled,t)!==!1};if(this.options.experimental_prefetchInRender){const R=L=>{T.status==="error"?L.reject(T.error):T.data!==void 0&&L.resolve(T.data)},D=()=>{const L=Fe(this,Xa,T.promise=Gk());R(L)},O=Q(this,Xa);switch(O.status){case"pending":t.queryHash===n.queryHash&&R(O);break;case"fulfilled":(T.status==="error"||T.data!==O.value)&&D();break;case"rejected":(T.status!=="error"||T.error!==O.reason)&&D();break}}return T}updateResult(){const t=Q(this,ni),r=this.createResult(Q(this,Dt),this.options);if(Fe(this,$u,Q(this,Dt).state),Fe(this,md,this.options),Q(this,$u).data!==void 0&&Fe(this,vd,Q(this,Dt)),cy(r,t))return;Fe(this,ni,r);const n=()=>{if(!t)return!0;const{notifyOnChangeProps:i}=this.options,o=typeof i=="function"?i():i;if(o==="all"||!o&&!Q(this,yd).size)return!0;const a=new Set(o??Q(this,yd));return this.options.throwOnError&&a.add("error"),Object.keys(Q(this,ni)).some(s=>{const u=s;return Q(this,ni)[u]!==t[u]&&a.has(u)})};Pt(this,Yt,$3).call(this,{listeners:n()})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&Pt(this,Yt,Jk).call(this)}},bi=new WeakMap,Dt=new WeakMap,kh=new WeakMap,ni=new WeakMap,$u=new WeakMap,md=new WeakMap,Xa=new WeakMap,ol=new WeakMap,Ph=new WeakMap,gd=new WeakMap,vd=new WeakMap,Cu=new WeakMap,ju=new WeakMap,al=new WeakMap,yd=new WeakMap,Yt=new WeakSet,Dp=function(t){Pt(this,Yt,rP).call(this);let r=Q(this,Dt).fetch(this.options,t);return t!=null&&t.throwOnError||(r=r.catch(oi)),r},Xk=function(){Pt(this,Yt,eP).call(this);const t=gl(this.options.staleTime,Q(this,Dt));if(Wu||Q(this,ni).isStale||!Hk(t))return;const n=m3(Q(this,ni).dataUpdatedAt,t)+1;Fe(this,Cu,mu.setTimeout(()=>{Q(this,ni).isStale||this.updateResult()},n))},Yk=function(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(Q(this,Dt)):this.options.refetchInterval)??!1},Qk=function(t){Pt(this,Yt,tP).call(this),Fe(this,al,t),!(Wu||ho(this.options.enabled,Q(this,Dt))===!1||!Hk(Q(this,al))||Q(this,al)===0)&&Fe(this,ju,mu.setInterval(()=>{(this.options.refetchIntervalInBackground||Yj.isFocused())&&Pt(this,Yt,Dp).call(this)},Q(this,al)))},Jk=function(){Pt(this,Yt,Xk).call(this),Pt(this,Yt,Qk).call(this,Pt(this,Yt,Yk).call(this))},eP=function(){Q(this,Cu)&&(mu.clearTimeout(Q(this,Cu)),Fe(this,Cu,void 0))},tP=function(){Q(this,ju)&&(mu.clearInterval(Q(this,ju)),Fe(this,ju,void 0))},rP=function(){const t=Q(this,bi).getQueryCache().build(Q(this,bi),this.options);if(t===Q(this,Dt))return;const r=Q(this,Dt);Fe(this,Dt,t),Fe(this,kh,t.state),this.hasListeners()&&(r==null||r.removeObserver(this),t.addObserver(this))},$3=function(t){dn.batch(()=>{t.listeners&&this.listeners.forEach(r=>{r(Q(this,ni))}),Q(this,bi).getQueryCache().notify({query:Q(this,Dt),type:"observerResultsUpdated"})})},PL);function Sfe(e,t){return ho(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status==="error"&&t.retryOnMount===!1)}function aM(e,t){return Sfe(e,t)||e.state.data!==void 0&&nP(e,t,t.refetchOnMount)}function nP(e,t,r){if(ho(t.enabled,e)!==!1&&gl(t.staleTime,e)!=="static"){const n=typeof r=="function"?r(e):r;return n==="always"||n!==!1&&Qj(e,t)}return!1}function sM(e,t,r,n){return(e!==t||ho(n.enabled,e)===!1)&&(!r.suspense||e.state.status!=="error")&&Qj(e,r)}function Qj(e,t){return ho(t.enabled,e)!==!1&&e.isStaleByTime(gl(t.staleTime,e))}function kfe(e,t){return!cy(e.getCurrentResult(),t)}function fy(e){return{onFetch:(t,r)=>{var f,p,v,y,b;const n=t.options,i=(v=(p=(f=t.fetchOptions)==null?void 0:f.meta)==null?void 0:p.fetchMore)==null?void 0:v.direction,o=((y=t.state.data)==null?void 0:y.pages)||[],a=((b=t.state.data)==null?void 0:b.pageParams)||[];let s={pages:[],pageParams:[]},u=0;const d=async()=>{let w=!1;const x=P=>{Object.defineProperty(P,"signal",{enumerable:!0,get:()=>(t.signal.aborted?w=!0:t.signal.addEventListener("abort",()=>{w=!0}),t.signal)})},k=y3(t.options,t.fetchOptions),$=async(P,j,C)=>{if(w)return Promise.reject();if(j==null&&P.pages.length)return Promise.resolve(P);const A=(()=>{const D={client:t.client,queryKey:t.queryKey,pageParam:j,direction:C?"backward":"forward",meta:t.options.meta};return x(D),D})(),T=await k(A),{maxPages:M}=t.options,R=C?mfe:hfe;return{pages:R(P.pages,T,M),pageParams:R(P.pageParams,j,M)}};if(i&&o.length){const P=i==="backward",j=P?C3:iP,C={pages:o,pageParams:a},I=j(n,C);s=await $(C,I,P)}else{const P=e??o.length;do{const j=u===0?a[0]??n.initialPageParam:iP(n,s);if(u>0&&j==null)break;s=await $(s,j),u++}while(u<P)}return s};t.options.persister?t.fetchFn=()=>{var w,x;return(x=(w=t.options).persister)==null?void 0:x.call(w,d,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},r)}:t.fetchFn=d}}}function iP(e,{pages:t,pageParams:r}){const n=t.length-1;return t.length>0?e.getNextPageParam(t[n],t,r[n],r):void 0}function C3(e,{pages:t,pageParams:r}){var n;return t.length>0?(n=e.getPreviousPageParam)==null?void 0:n.call(e,t[0],t,r[0],r):void 0}function Pfe(e,t){return t?iP(e,t)!=null:!1}function $fe(e,t){return!t||!e.getPreviousPageParam?!1:C3(e,t)!=null}var Cfe=class extends P3{constructor(e,t){super(e,t)}bindMethods(){super.bindMethods(),this.fetchNextPage=this.fetchNextPage.bind(this),this.fetchPreviousPage=this.fetchPreviousPage.bind(this)}setOptions(e){super.setOptions({...e,behavior:fy()})}getOptimisticResult(e){return e.behavior=fy(),super.getOptimisticResult(e)}fetchNextPage(e){return this.fetch({...e,meta:{fetchMore:{direction:"forward"}}})}fetchPreviousPage(e){return this.fetch({...e,meta:{fetchMore:{direction:"backward"}}})}createResult(e,t){var b,w;const{state:r}=e,n=super.createResult(e,t),{isFetching:i,isRefetching:o,isError:a,isRefetchError:s}=n,u=(w=(b=r.fetchMeta)==null?void 0:b.fetchMore)==null?void 0:w.direction,d=a&&u==="forward",f=i&&u==="forward",p=a&&u==="backward",v=i&&u==="backward";return{...n,fetchNextPage:this.fetchNextPage,fetchPreviousPage:this.fetchPreviousPage,hasNextPage:Pfe(t,r.data),hasPreviousPage:$fe(t,r.data),isFetchNextPageError:d,isFetchingNextPage:f,isFetchPreviousPageError:p,isFetchingPreviousPage:v,isRefetchError:s&&!d&&!p,isRefetching:o&&!f&&!v}}},$h,fa,ii,Eu,pa,Xs,$L,jfe=($L=class extends S3{constructor(t){super();at(this,pa);at(this,$h);at(this,fa);at(this,ii);at(this,Eu);Fe(this,$h,t.client),this.mutationId=t.mutationId,Fe(this,ii,t.mutationCache),Fe(this,fa,[]),this.state=t.state||j3(),this.setOptions(t.options),this.scheduleGc()}setOptions(t){this.options=t,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(t){Q(this,fa).includes(t)||(Q(this,fa).push(t),this.clearGcTimeout(),Q(this,ii).notify({type:"observerAdded",mutation:this,observer:t}))}removeObserver(t){Fe(this,fa,Q(this,fa).filter(r=>r!==t)),this.scheduleGc(),Q(this,ii).notify({type:"observerRemoved",mutation:this,observer:t})}optionalRemove(){Q(this,fa).length||(this.state.status==="pending"?this.scheduleGc():Q(this,ii).remove(this))}continue(){var t;return((t=Q(this,Eu))==null?void 0:t.continue())??this.execute(this.state.variables)}async execute(t){var a,s,u,d,f,p,v,y,b,w,x,k,$,P,j,C,I,A,T,M;const r=()=>{Pt(this,pa,Xs).call(this,{type:"continue"})},n={client:Q(this,$h),meta:this.options.meta,mutationKey:this.options.mutationKey};Fe(this,Eu,w3({fn:()=>this.options.mutationFn?this.options.mutationFn(t,n):Promise.reject(new Error("No mutationFn found")),onFail:(R,D)=>{Pt(this,pa,Xs).call(this,{type:"failed",failureCount:R,error:D})},onPause:()=>{Pt(this,pa,Xs).call(this,{type:"pause"})},onContinue:r,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>Q(this,ii).canRun(this)}));const i=this.state.status==="pending",o=!Q(this,Eu).canStart();try{if(i)r();else{Pt(this,pa,Xs).call(this,{type:"pending",variables:t,isPaused:o}),await((s=(a=Q(this,ii).config).onMutate)==null?void 0:s.call(a,t,this,n));const D=await((d=(u=this.options).onMutate)==null?void 0:d.call(u,t,n));D!==this.state.context&&Pt(this,pa,Xs).call(this,{type:"pending",context:D,variables:t,isPaused:o})}const R=await Q(this,Eu).start();return await((p=(f=Q(this,ii).config).onSuccess)==null?void 0:p.call(f,R,t,this.state.context,this,n)),await((y=(v=this.options).onSuccess)==null?void 0:y.call(v,R,t,this.state.context,n)),await((w=(b=Q(this,ii).config).onSettled)==null?void 0:w.call(b,R,null,this.state.variables,this.state.context,this,n)),await((k=(x=this.options).onSettled)==null?void 0:k.call(x,R,null,t,this.state.context,n)),Pt(this,pa,Xs).call(this,{type:"success",data:R}),R}catch(R){try{throw await((P=($=Q(this,ii).config).onError)==null?void 0:P.call($,R,t,this.state.context,this,n)),await((C=(j=this.options).onError)==null?void 0:C.call(j,R,t,this.state.context,n)),await((A=(I=Q(this,ii).config).onSettled)==null?void 0:A.call(I,void 0,R,this.state.variables,this.state.context,this,n)),await((M=(T=this.options).onSettled)==null?void 0:M.call(T,void 0,R,t,this.state.context,n)),R}finally{Pt(this,pa,Xs).call(this,{type:"error",error:R})}}finally{Q(this,ii).runNext(this)}}},$h=new WeakMap,fa=new WeakMap,ii=new WeakMap,Eu=new WeakMap,pa=new WeakSet,Xs=function(t){const r=n=>{switch(t.type){case"failed":return{...n,failureCount:t.failureCount,failureReason:t.error};case"pause":return{...n,isPaused:!0};case"continue":return{...n,isPaused:!1};case"pending":return{...n,context:t.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:t.isPaused,status:"pending",variables:t.variables,submittedAt:Date.now()};case"success":return{...n,data:t.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...n,data:void 0,error:t.error,failureCount:n.failureCount+1,failureReason:t.error,isPaused:!1,status:"error"}}};this.state=r(this.state),dn.batch(()=>{Q(this,fa).forEach(n=>{n.onMutationUpdate(t)}),Q(this,ii).notify({mutation:this,type:"updated",action:t})})},$L);function j3(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var Ya,Uo,Ch,CL,Efe=(CL=class extends tf{constructor(t={}){super();at(this,Ya);at(this,Uo);at(this,Ch);this.config=t,Fe(this,Ya,new Set),Fe(this,Uo,new Map),Fe(this,Ch,0)}build(t,r,n){const i=new jfe({client:t,mutationCache:this,mutationId:++Ag(this,Ch)._,options:t.defaultMutationOptions(r),state:n});return this.add(i),i}add(t){Q(this,Ya).add(t);const r=Jg(t);if(typeof r=="string"){const n=Q(this,Uo).get(r);n?n.push(t):Q(this,Uo).set(r,[t])}this.notify({type:"added",mutation:t})}remove(t){if(Q(this,Ya).delete(t)){const r=Jg(t);if(typeof r=="string"){const n=Q(this,Uo).get(r);if(n)if(n.length>1){const i=n.indexOf(t);i!==-1&&n.splice(i,1)}else n[0]===t&&Q(this,Uo).delete(r)}}this.notify({type:"removed",mutation:t})}canRun(t){const r=Jg(t);if(typeof r=="string"){const n=Q(this,Uo).get(r),i=n==null?void 0:n.find(o=>o.state.status==="pending");return!i||i===t}else return!0}runNext(t){var n;const r=Jg(t);if(typeof r=="string"){const i=(n=Q(this,Uo).get(r))==null?void 0:n.find(o=>o!==t&&o.state.isPaused);return(i==null?void 0:i.continue())??Promise.resolve()}else return Promise.resolve()}clear(){dn.batch(()=>{Q(this,Ya).forEach(t=>{this.notify({type:"removed",mutation:t})}),Q(this,Ya).clear(),Q(this,Uo).clear()})}getAll(){return Array.from(Q(this,Ya))}find(t){const r={exact:!0,...t};return this.getAll().find(n=>tM(r,n))}findAll(t={}){return this.getAll().filter(r=>tM(t,r))}notify(t){dn.batch(()=>{this.listeners.forEach(r=>{r(t)})})}resumePausedMutations(){const t=this.getAll().filter(r=>r.state.isPaused);return dn.batch(()=>Promise.all(t.map(r=>r.continue().catch(oi))))}},Ya=new WeakMap,Uo=new WeakMap,Ch=new WeakMap,CL);function Jg(e){var t;return(t=e.options.scope)==null?void 0:t.id}var Qa,sl,xi,Ja,us,Tv,oP,jL,Ife=(jL=class extends tf{constructor(r,n){super();at(this,us);at(this,Qa);at(this,sl);at(this,xi);at(this,Ja);Fe(this,Qa,r),this.setOptions(n),this.bindMethods(),Pt(this,us,Tv).call(this)}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(r){var i;const n=this.options;this.options=Q(this,Qa).defaultMutationOptions(r),cy(this.options,n)||Q(this,Qa).getMutationCache().notify({type:"observerOptionsUpdated",mutation:Q(this,xi),observer:this}),n!=null&&n.mutationKey&&this.options.mutationKey&&Ku(n.mutationKey)!==Ku(this.options.mutationKey)?this.reset():((i=Q(this,xi))==null?void 0:i.state.status)==="pending"&&Q(this,xi).setOptions(this.options)}onUnsubscribe(){var r;this.hasListeners()||(r=Q(this,xi))==null||r.removeObserver(this)}onMutationUpdate(r){Pt(this,us,Tv).call(this),Pt(this,us,oP).call(this,r)}getCurrentResult(){return Q(this,sl)}reset(){var r;(r=Q(this,xi))==null||r.removeObserver(this),Fe(this,xi,void 0),Pt(this,us,Tv).call(this),Pt(this,us,oP).call(this)}mutate(r,n){var i;return Fe(this,Ja,n),(i=Q(this,xi))==null||i.removeObserver(this),Fe(this,xi,Q(this,Qa).getMutationCache().build(Q(this,Qa),this.options)),Q(this,xi).addObserver(this),Q(this,xi).execute(r)}},Qa=new WeakMap,sl=new WeakMap,xi=new WeakMap,Ja=new WeakMap,us=new WeakSet,Tv=function(){var n;const r=((n=Q(this,xi))==null?void 0:n.state)??j3();Fe(this,sl,{...r,isPending:r.status==="pending",isSuccess:r.status==="success",isError:r.status==="error",isIdle:r.status==="idle",mutate:this.mutate,reset:this.reset})},oP=function(r){dn.batch(()=>{var n,i,o,a,s,u,d,f;if(Q(this,Ja)&&this.hasListeners()){const p=Q(this,sl).variables,v=Q(this,sl).context,y={client:Q(this,Qa),meta:this.options.meta,mutationKey:this.options.mutationKey};(r==null?void 0:r.type)==="success"?((i=(n=Q(this,Ja)).onSuccess)==null||i.call(n,r.data,p,v,y),(a=(o=Q(this,Ja)).onSettled)==null||a.call(o,r.data,null,p,v,y)):(r==null?void 0:r.type)==="error"&&((u=(s=Q(this,Ja)).onError)==null||u.call(s,r.error,p,v,y),(f=(d=Q(this,Ja)).onSettled)==null||f.call(d,void 0,r.error,p,v,y))}this.listeners.forEach(p=>{p(Q(this,sl))})})},jL),ha,EL,Ofe=(EL=class extends tf{constructor(t={}){super();at(this,ha);this.config=t,Fe(this,ha,new Map)}build(t,r,n){const i=r.queryKey,o=r.queryHash??Zj(i,r);let a=this.get(o);return a||(a=new wfe({client:t,queryKey:i,queryHash:o,options:t.defaultQueryOptions(r),state:n,defaultOptions:t.getQueryDefaults(i)}),this.add(a)),a}add(t){Q(this,ha).has(t.queryHash)||(Q(this,ha).set(t.queryHash,t),this.notify({type:"added",query:t}))}remove(t){const r=Q(this,ha).get(t.queryHash);r&&(t.destroy(),r===t&&Q(this,ha).delete(t.queryHash),this.notify({type:"removed",query:t}))}clear(){dn.batch(()=>{this.getAll().forEach(t=>{this.remove(t)})})}get(t){return Q(this,ha).get(t)}getAll(){return[...Q(this,ha).values()]}find(t){const r={exact:!0,...t};return this.getAll().find(n=>eM(r,n))}findAll(t={}){const r=this.getAll();return Object.keys(t).length>0?r.filter(n=>eM(t,n)):r}notify(t){dn.batch(()=>{this.listeners.forEach(r=>{r(t)})})}onFocus(){dn.batch(()=>{this.getAll().forEach(t=>{t.onFocus()})})}onOnline(){dn.batch(()=>{this.getAll().forEach(t=>{t.onOnline()})})}},ha=new WeakMap,EL),Br,ll,ul,bd,xd,cl,wd,Sd,IL,_fe=(IL=class{constructor(e={}){at(this,Br);at(this,ll);at(this,ul);at(this,bd);at(this,xd);at(this,cl);at(this,wd);at(this,Sd);Fe(this,Br,e.queryCache||new Ofe),Fe(this,ll,e.mutationCache||new Efe),Fe(this,ul,e.defaultOptions||{}),Fe(this,bd,new Map),Fe(this,xd,new Map),Fe(this,cl,0)}mount(){Ag(this,cl)._++,Q(this,cl)===1&&(Fe(this,wd,Yj.subscribe(async e=>{e&&(await this.resumePausedMutations(),Q(this,Br).onFocus())})),Fe(this,Sd,dy.subscribe(async e=>{e&&(await this.resumePausedMutations(),Q(this,Br).onOnline())})))}unmount(){var e,t;Ag(this,cl)._--,Q(this,cl)===0&&((e=Q(this,wd))==null||e.call(this),Fe(this,wd,void 0),(t=Q(this,Sd))==null||t.call(this),Fe(this,Sd,void 0))}isFetching(e){return Q(this,Br).findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return Q(this,ll).findAll({...e,status:"pending"}).length}getQueryData(e){var r;const t=this.defaultQueryOptions({queryKey:e});return(r=Q(this,Br).get(t.queryHash))==null?void 0:r.state.data}ensureQueryData(e){const t=this.defaultQueryOptions(e),r=Q(this,Br).build(this,t),n=r.state.data;return n===void 0?this.fetchQuery(e):(e.revalidateIfStale&&r.isStaleByTime(gl(t.staleTime,r))&&this.prefetchQuery(t),Promise.resolve(n))}getQueriesData(e){return Q(this,Br).findAll(e).map(({queryKey:t,state:r})=>{const n=r.data;return[t,n]})}setQueryData(e,t,r){const n=this.defaultQueryOptions({queryKey:e}),i=Q(this,Br).get(n.queryHash),o=i==null?void 0:i.state.data,a=dfe(t,o);if(a!==void 0)return Q(this,Br).build(this,n).setData(a,{...r,manual:!0})}setQueriesData(e,t,r){return dn.batch(()=>Q(this,Br).findAll(e).map(({queryKey:n})=>[n,this.setQueryData(n,t,r)]))}getQueryState(e){var r;const t=this.defaultQueryOptions({queryKey:e});return(r=Q(this,Br).get(t.queryHash))==null?void 0:r.state}removeQueries(e){const t=Q(this,Br);dn.batch(()=>{t.findAll(e).forEach(r=>{t.remove(r)})})}resetQueries(e,t){const r=Q(this,Br);return dn.batch(()=>(r.findAll(e).forEach(n=>{n.reset()}),this.refetchQueries({type:"active",...e},t)))}cancelQueries(e,t={}){const r={revert:!0,...t},n=dn.batch(()=>Q(this,Br).findAll(e).map(i=>i.cancel(r)));return Promise.all(n).then(oi).catch(oi)}invalidateQueries(e,t={}){return dn.batch(()=>(Q(this,Br).findAll(e).forEach(r=>{r.invalidate()}),(e==null?void 0:e.refetchType)==="none"?Promise.resolve():this.refetchQueries({...e,type:(e==null?void 0:e.refetchType)??(e==null?void 0:e.type)??"active"},t)))}refetchQueries(e,t={}){const r={...t,cancelRefetch:t.cancelRefetch??!0},n=dn.batch(()=>Q(this,Br).findAll(e).filter(i=>!i.isDisabled()&&!i.isStatic()).map(i=>{let o=i.fetch(void 0,r);return r.throwOnError||(o=o.catch(oi)),i.state.fetchStatus==="paused"?Promise.resolve():o}));return Promise.all(n).then(oi)}fetchQuery(e){const t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);const r=Q(this,Br).build(this,t);return r.isStaleByTime(gl(t.staleTime,r))?r.fetch(t):Promise.resolve(r.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(oi).catch(oi)}fetchInfiniteQuery(e){return e.behavior=fy(e.pages),this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(oi).catch(oi)}ensureInfiniteQueryData(e){return e.behavior=fy(e.pages),this.ensureQueryData(e)}resumePausedMutations(){return dy.isOnline()?Q(this,ll).resumePausedMutations():Promise.resolve()}getQueryCache(){return Q(this,Br)}getMutationCache(){return Q(this,ll)}getDefaultOptions(){return Q(this,ul)}setDefaultOptions(e){Fe(this,ul,e)}setQueryDefaults(e,t){Q(this,bd).set(Ku(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){const t=[...Q(this,bd).values()],r={};return t.forEach(n=>{ih(e,n.queryKey)&&Object.assign(r,n.defaultOptions)}),r}setMutationDefaults(e,t){Q(this,xd).set(Ku(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){const t=[...Q(this,xd).values()],r={};return t.forEach(n=>{ih(e,n.mutationKey)&&Object.assign(r,n.defaultOptions)}),r}defaultQueryOptions(e){if(e._defaulted)return e;const t={...Q(this,ul).queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||(t.queryHash=Zj(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===Xj&&(t.enabled=!1),t}defaultMutationOptions(e){return e!=null&&e._defaulted?e:{...Q(this,ul).mutations,...(e==null?void 0:e.mutationKey)&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){Q(this,Br).clear(),Q(this,ll).clear()}},Br=new WeakMap,ll=new WeakMap,ul=new WeakMap,bd=new WeakMap,xd=new WeakMap,cl=new WeakMap,wd=new WeakMap,Sd=new WeakMap,IL),Afe=m.createContext(void 0),E3=e=>{const t=m.useContext(Afe);if(e)return e;if(!t)throw new Error("No QueryClient set, use QueryClientProvider to set one");return t},I3=m.createContext(!1),Tfe=()=>m.useContext(I3);I3.Provider;function Mfe(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var Rfe=m.createContext(Mfe()),Dfe=()=>m.useContext(Rfe),zfe=(e,t)=>{(e.suspense||e.throwOnError||e.experimental_prefetchInRender)&&(t.isReset()||(e.retryOnMount=!1))},Nfe=e=>{m.useEffect(()=>{e.clearReset()},[e])},Lfe=({result:e,errorResetBoundary:t,throwOnError:r,query:n,suspense:i})=>e.isError&&!t.isReset()&&!e.isFetching&&n&&(i&&e.data===void 0||b3(r,[e.error,n])),Bfe=e=>{if(e.suspense){const r=i=>i==="static"?i:Math.max(i??1e3,1e3),n=e.staleTime;e.staleTime=typeof n=="function"?(...i)=>r(n(...i)):r(n),typeof e.gcTime=="number"&&(e.gcTime=Math.max(e.gcTime,1e3))}},Ffe=(e,t)=>e.isLoading&&e.isFetching&&!t,Ufe=(e,t)=>(e==null?void 0:e.suspense)&&t.isPending,lM=(e,t,r)=>t.fetchOptimistic(e).catch(()=>{r.clearReset()});function O3(e,t,r){var p,v,y,b,w;const n=Tfe(),i=Dfe(),o=E3(r),a=o.defaultQueryOptions(e);(v=(p=o.getDefaultOptions().queries)==null?void 0:p._experimental_beforeQuery)==null||v.call(p,a),a._optimisticResults=n?"isRestoring":"optimistic",Bfe(a),zfe(a,i),Nfe(i);const s=!o.getQueryCache().get(a.queryHash),[u]=m.useState(()=>new t(o,a)),d=u.getOptimisticResult(a),f=!n&&e.subscribed!==!1;if(m.useSyncExternalStore(m.useCallback(x=>{const k=f?u.subscribe(dn.batchCalls(x)):oi;return u.updateResult(),k},[u,f]),()=>u.getCurrentResult(),()=>u.getCurrentResult()),m.useEffect(()=>{u.setOptions(a)},[a,u]),Ufe(a,d))throw lM(a,u,i);if(Lfe({result:d,errorResetBoundary:i,throwOnError:a.throwOnError,query:o.getQueryCache().get(a.queryHash),suspense:a.suspense}))throw d.error;if((b=(y=o.getDefaultOptions().queries)==null?void 0:y._experimental_afterQuery)==null||b.call(y,a,d),a.experimental_prefetchInRender&&!Wu&&Ffe(d,n)){const x=s?lM(a,u,i):(w=o.getQueryCache().get(a.queryHash))==null?void 0:w.promise;x==null||x.catch(oi).finally(()=>{u.updateResult()})}return a.notifyOnChangeProps?d:u.trackResult(d)}function Wfe(e,t){return O3(e,P3,t)}function Kfe(e,t){const r=E3(t),[n]=m.useState(()=>new Ife(r,e));m.useEffect(()=>{n.setOptions(e)},[n,e]);const i=m.useSyncExternalStore(m.useCallback(a=>n.subscribe(dn.batchCalls(a)),[n]),()=>n.getCurrentResult(),()=>n.getCurrentResult()),o=m.useCallback((a,s)=>{n.mutate(a,s).catch(oi)},[n]);if(i.error&&b3(n.options.throwOnError,[i.error]))throw i.error;return{...i,mutate:o,mutateAsync:i.mutate}}function Hfe(e,t){return O3(e,Cfe,t)}var Jj=class extends Error{constructor({res:e,url:t,body:{message:r}}){super(`[${e.status}] ${e.statusText}${r?` - ${r}`:""}`),this.name="HttpError",this.status=e.status,this.statusText=e.statusText,this.url=t,this.body={message:r},this.headers=e.headers?Object.fromEntries(e.headers.entries()):{}}},_3=async e=>{const t={...e.headers??{}},r=typeof FormData<"u"&&e.body instanceof FormData;r||(t["Content-Type"]||(t["Content-Type"]="application/json"),t.Accept||(t.Accept="application/json"));const n=await fetch(e.url,{method:e.method,headers:t,body:r?e.body:e.body==null?void 0:JSON.stringify(e.body)}),i=await n.json();if(!n.ok)throw new Jj({res:n,url:e.url,body:i});try{return{data:i,headers:n.headers?Object.fromEntries(n.headers.entries()):{},status:n.status}}catch{return{data:i,headers:n.headers?Object.fromEntries(n.headers.entries()):{},status:n.status}}},ox=e=>e.toUpperCase();function A3(e){if(!e)return"";const t=new URLSearchParams;for(const[n,i]of Object.entries(e))if(i!=null){if(typeof i=="string"){t.append(n,i);continue}if(typeof i=="number"||typeof i=="boolean"){t.append(n,String(i));continue}t.append(n,JSON.stringify(i))}const r=t.toString();return r?`?${r}`:""}function Vfe(e,t){if(!e)return e;const{[t]:r,...n}=e;return n}var qfe=e=>{if(!e||typeof e!="object")return;const t=e;if("nextCursor"in t)return t.nextCursor;if("meta"in t){const r=t.meta;if(r&&typeof r=="object"&&"nextCursor"in r)return r.nextCursor}};function Dd(e){return e[0]}function eE(e){return typeof e>"u"?[]:[e]}function py(e,t,r,n){const i=e.cfg.paramsSchema?kl(e.cfg.paramsSchema,r):{},o=e.cfg.querySchema?kl(e.cfg.querySchema,n):{},a=h3(e.path,i??{});return{url:`${t??""}${a}${A3(o)}`,normalizedQuery:o,normalizedParams:i}}function tE(e){const t=new FormData;for(const[r,n]of Object.entries(e??{}))n!=null&&(Array.isArray(n)?n.forEach((i,o)=>t.append(`${r}[${o}]`,i)):t.append(r,n));return t}function Gfe(e){const t=new Set,r=/:([A-Za-z0-9_]+)/g;let n;for(;(n=r.exec(e))!==null;)t.add(n[1]);return t}function Zfe(e){if(e==null)return;if(typeof e!="object"||Array.isArray(e))throw new Error("Query must be a plain object (Record<string, string>).");const t={};for(const[r,n]of Object.entries(e))if(n!=null){if(typeof n!="string")throw new Error(`Query param "${r}" must be a string; received type "${typeof n}".`);t[r]=n}return Object.keys(t).length>0?t:void 0}function Xfe(e,t){const r=Gfe(e);if(!t||typeof t!="object"||Array.isArray(t)){if(r.size>0)throw new Error(`Missing path parameters for "${e}": ${[...r].join(", ")}`);return e}const n=t,i=new Set(Object.keys(n));for(const o of i){if(!r.has(o))throw new Error(`Unexpected path parameter "${o}" for template "${e}".`);const a=n[o];if(a!=null&&(typeof a=="object"||Array.isArray(a)))throw new Error(`Path parameter "${o}" must be a primitive; received "${typeof a}".`)}for(const o of r)if(!i.has(o))throw new Error(`Missing value for path parameter "${o}" in template "${e}".`);return r.size===0?e:h3(e,n)}function Yfe(e,t,r){const n=e.cfg,i=ox(e.method),o=!!(n.paramsSchema||n.querySchema),{baseUrl:a,validateResponses:s,fetcher:u,queryClient:d,emit:f,decorateDebugEvent:p,isVerboseDebug:v,leafLabel:y}=r;f({type:"build",leaf:y});const b=(...C)=>{const I=Dd(C),A=I==null?void 0:I.params,T=I==null?void 0:I.query;return Gj({leaf:e,params:A,query:T})},w=async(...C)=>{const I=b(...C);await d.invalidateQueries({queryKey:I,exact:!0}),f({type:"invalidate",key:I,exact:!0})},x=(...C)=>{const[I,...A]=C,T=b(...A),M=d.setQueryData(T,R=>typeof I=="function"?I(R):I);return f({type:"setData",key:T}),M},k=(t==null?void 0:t.onReceive)??void 0,$=async(C,I)=>{var V;const A=Dd(C),T=A==null?void 0:A.params,M={...(A==null?void 0:A.query)??{},...(I==null?void 0:I.queryOverride)??{}},{url:R,normalizedQuery:D,normalizedParams:O}=py({...e,cfg:n},a,T,M);let L;const z=!!n.bodySchema,F=(I==null?void 0:I.requireBody)??!!z;if(typeof(I==null?void 0:I.body)<"u"){const K=n.bodySchema?kl(n.bodySchema,I.body):void 0;Array.isArray(n.bodyFiles)&&n.bodyFiles.length>0&&K&&typeof K=="object"?L=tE(K):L=K}else if(F&&z)throw new Error("Body is required when invoking a mutation fetch.");const B=Date.now(),U=v?{params:T,normalizedParams:O,query:M,normalizedQuery:D,baseUrl:a}:void 0;f(p({type:"fetch",stage:"start",method:i,url:R,leaf:y,...L!==void 0?{body:L}:{}},U));try{const K=await u(L===void 0?{url:R,method:i}:{url:R,method:i,body:L});if(f(p({type:"fetch",stage:"fetched",method:i,url:R,leaf:y,durationMs:Date.now()-B},v?{params:O,query:D,output:K}:void 0)),s){if(!n.outputSchema)throw new Error(`No output schema defined for leaf ${y}, cannot validate response.`);K.data=kl(n.outputSchema,K.data),f(p({type:"fetch",stage:"parsed",method:i,url:R,leaf:y,durationMs:Date.now()-B},v?{params:O,query:D,output:K}:void 0))}return(V=I==null?void 0:I.onReceive)==null||V.call(I,K.data),K.data}catch(K){throw f(p({type:"fetch",stage:"error",method:i,url:R,leaf:y,durationMs:Date.now()-B,...L!==void 0?{body:L}:{},error:K},U)),K}};return{getQueryKeys:b,invalidate:w,setData:x,useEndpoint:(...C)=>{const I=C[0],A=eE(I),T=b(...A);f({type:"useEndpoint",leaf:y,variant:"get",keys:T});const M=t??{},R=m.useRef(new Set),D=m.useCallback(z=>{var F;(F=M==null?void 0:M.onReceive)==null||F.call(M,z),R.current.forEach(B=>B(z))},[]),O=m.useCallback(z=>(R.current.add(z),()=>{R.current.delete(z)}),[]);return{...Wfe({...M,queryKey:b(...A),placeholderData:v3,queryFn:()=>$(A,{onReceive:D})},d),onReceive:O}},fetch:(...C)=>{const I=!!n.bodySchema,A=C.length,M=I&&A>(o?1:0),R=M?C[A-1]:void 0,D=M?C.slice(0,A-1):C;return $(D,{body:R,onReceive:k,requireBody:!1})}}}function T3(e,t){if(e==null)return t;if(t==null)return e;if(Array.isArray(e)&&Array.isArray(t))return[...e,...t];if(typeof e!="object"||typeof t!="object")return t;const r={...e};for(const n of Object.keys(t)){const i=e[n],o=t[n];if(Array.isArray(i)&&Array.isArray(o)){r[n]=[...i,...o];continue}if(i&&typeof i=="object"&&!Array.isArray(i)&&o&&typeof o=="object"&&!Array.isArray(o)){n==="meta"?r[n]=T3(i,o):r[n]=o;continue}r[n]=o}return r}function Qfe(e,t,r){const n=e.cfg,i=ox(e.method),o=!!(n.paramsSchema||n.querySchema),{baseUrl:a,validateResponses:s,fetcher:u,queryClient:d,emit:f,decorateDebugEvent:p,isVerboseDebug:v,leafLabel:y}=r;f({type:"build",leaf:y});const b=t??{},{cursorParam:w,getNextPageParam:x,initialPageParam:k,splitPageSize:$,splitPageSizeParam:P,...j}=b,C=w??"pagination_cursor",I=x??(K=>qfe(K)),A=K=>I(K),T=typeof k>"u"?void 0:k,M=j,R=typeof $=="number"&&$>0?$:void 0,D=P??"pageSize",O=(...K)=>{const Z=Dd(K),W=Z==null?void 0:Z.params,q=Z==null?void 0:Z.query,oe=Vfe(q,C);return Gj({leaf:e,params:W,query:oe})},L=async(...K)=>{const Z=O(...K);await d.invalidateQueries({queryKey:Z,exact:!0}),f({type:"invalidate",key:Z,exact:!0})},z=(...K)=>{const[Z,...W]=K,q=O(...W),oe=d.setQueryData(q,Y=>typeof Z=="function"?Z(Y):Z);return f({type:"setData",key:q}),oe},F=(t==null?void 0:t.onReceive)??void 0,B=async(K,Z)=>{var se;const W=Dd(K),q=W==null?void 0:W.params,oe={...(W==null?void 0:W.query)??{},...(Z==null?void 0:Z.queryOverride)??{}},{url:Y,normalizedQuery:H,normalizedParams:X}=py({...e,cfg:n},a,q,oe);let re;const he=!!n.bodySchema,J=(Z==null?void 0:Z.requireBody)??!!he;if(typeof(Z==null?void 0:Z.body)<"u"){const Pe=n.bodySchema?kl(n.bodySchema,Z.body):void 0;Array.isArray(n.bodyFiles)&&n.bodyFiles.length>0&&Pe&&typeof Pe=="object"?re=tE(Pe):re=Pe}else if(J&&he)throw new Error("Body is required when invoking a mutation fetch.");const ge=Date.now(),Se=v?{params:q,normalizedParams:X,query:oe,normalizedQuery:H,baseUrl:a}:void 0;f(p({type:"fetch",stage:"start",method:i,url:Y,leaf:y,...re!==void 0?{body:re}:{}},Se));try{const Pe=await u(re===void 0?{url:Y,method:i}:{url:Y,method:i,body:re});if(f(p({type:"fetch",stage:"fetched",method:i,url:Y,leaf:y,durationMs:Date.now()-ge},v?{params:X,query:H,output:Pe}:void 0)),s){if(!n.outputSchema)throw new Error(`No output schema defined for leaf ${y}, cannot validate response.`);Pe.data=kl(n.outputSchema,Pe.data),f(p({type:"fetch",stage:"parsed",method:i,url:Y,leaf:y,durationMs:Date.now()-ge},v?{params:X,query:H,output:Pe}:void 0))}return(se=Z==null?void 0:Z.onReceive)==null||se.call(Z,Pe.data),Pe.data}catch(Pe){throw f(p({type:"fetch",stage:"error",method:i,url:Y,leaf:y,durationMs:Date.now()-ge,...re!==void 0?{body:re}:{},error:Pe},Se)),Pe}};return{getQueryKeys:O,invalidate:L,setData:z,useEndpoint:(...K)=>{const Z=K[0],W=eE(Z),q=O(...W);f({type:"useEndpoint",leaf:y,variant:"infiniteGet",keys:q});const oe=Z==null?void 0:Z.params,Y=Z==null?void 0:Z.query,H=M??{},X=m.useRef(new Set),re=m.useCallback(Se=>{var se;(se=H==null?void 0:H.onReceive)==null||se.call(H,Se),X.current.forEach(Pe=>Pe(Se))},[]),he=m.useCallback(Se=>(X.current.add(Se),()=>{X.current.delete(Se)}),[]),{normalizedQuery:J}=py({...e,cfg:n},a,oe,Y);return{...Hfe({...H,placeholderData:H.placeholderData??v3,initialPageParam:T,getNextPageParam:Se=>A(Se),queryKey:q,queryFn:({pageParam:Se})=>{if(!R){const ze={...J,...Se?{[C]:Se}:{}};return B(W,{queryOverride:ze,onReceive:re})}const se=J==null?void 0:J[D],Pe=typeof se=="number"?se:se!=null?Number(se):void 0;if(!Pe||!Number.isFinite(Pe)||Pe<=R){const ze={...J,...Se?{[C]:Se}:{}};return B(W,{queryOverride:ze,onReceive:re})}const ke=Pe,$e=Se;return(async()=>{let ze=ke,je=Se,it;for(;ze>0;){const qe=Math.min(ze,R),ot={...J,...je?{[C]:je}:{},[D]:qe},Re=await B(W,{queryOverride:ot,onReceive:re});it=it?T3(it,Re):Re,ze-=qe;const Qt=A(Re);je=Qt;const xt=q;if(d.setQueryData(xt,Tt=>{if(!it)return Tt;if(!Tt)return{pages:[it],pageParams:[$e]};const Lt=Tt.pageParams.findIndex(Bt=>Bt===$e||Bt==null&&$e==null);if(Lt===-1)return{pages:[...Tt.pages,it],pageParams:[...Tt.pageParams,$e]};const Jt=[...Tt.pages];return Jt[Lt]=it,{...Tt,pages:Jt}}),!Qt)break}return it})()}},d),onReceive:he}},fetch:(...K)=>{const Z=!!n.bodySchema,W=K.length,oe=Z&&W>(o?1:0),Y=oe?K[W-1]:void 0,H=oe?K.slice(0,W-1):K;return B(H,{body:Y,onReceive:F,requireBody:!1})}}}function Jfe(e,t,r){const n=e.cfg,i=ox(e.method);n.paramsSchema||n.querySchema;const{baseUrl:o,validateResponses:a,fetcher:s,queryClient:u,emit:d,decorateDebugEvent:f,isVerboseDebug:p,leafLabel:v}=r;d({type:"build",leaf:v});const y=(...j)=>{const C=Dd(j),I=C==null?void 0:C.params,A=C==null?void 0:C.query;return Gj({leaf:e,params:I,query:A})},b=async(...j)=>{const C=y(...j);await u.invalidateQueries({queryKey:C,exact:!0}),d({type:"invalidate",key:C,exact:!0})},w=(...j)=>{const[C,...I]=j,A=y(...I),T=u.setQueryData(A,M=>typeof C=="function"?C(M):C);return d({type:"setData",key:A}),T},x=t??{},k=async(j,C)=>{var B;const I=Dd(j),A=I==null?void 0:I.params,T={...(I==null?void 0:I.query)??{},...(C==null?void 0:C.queryOverride)??{}},{url:M,normalizedQuery:R,normalizedParams:D}=py({...e,cfg:n},o,A,T);let O;const L=!!n.bodySchema;if(typeof(C==null?void 0:C.body)<"u"){const U=n.bodySchema?kl(n.bodySchema,C.body):void 0;Array.isArray(n.bodyFiles)&&n.bodyFiles.length>0&&U&&typeof U=="object"?O=tE(U):O=U}else if(L)throw new Error("Body is required when invoking a mutation fetch.");const z=Date.now(),F=p?{params:A,normalizedParams:D,query:T,normalizedQuery:R,baseUrl:o}:void 0;d(f({type:"fetch",stage:"start",method:i,url:M,leaf:v,...O!==void 0?{body:O}:{}},F));try{const U=await s(O===void 0?{url:M,method:i}:{url:M,method:i,body:O});if(d(f({type:"fetch",stage:"fetched",method:i,url:M,leaf:v,durationMs:Date.now()-z},p?{params:D,query:R,output:U}:void 0)),a){if(!n.outputSchema)throw new Error(`No output schema defined for leaf ${v}, cannot validate response.`);U.data=kl(n.outputSchema,U.data),d(f({type:"fetch",stage:"parsed",method:i,url:M,leaf:v,durationMs:Date.now()-z},p?{params:D,query:R,output:U}:void 0))}return(B=C==null?void 0:C.onReceive)==null||B.call(C,U.data),U.data}catch(U){throw d(f({type:"fetch",stage:"error",method:i,url:M,leaf:v,durationMs:Date.now()-z,...O!==void 0?{body:O}:{},error:U},F)),U}},$=async(...j)=>{if(j.length===0)throw new Error("Body is required when invoking a mutation fetch.");const C=j.length-1,I=j.slice(0,C),A=j[C];return await k(I,{body:A,onReceive:M=>{var R;return(R=x==null?void 0:x.onReceive)==null?void 0:R.call(x,M)},requireBody:!0})};return{getQueryKeys:y,invalidate:b,setData:w,useEndpoint:(...j)=>{const C=j[0],I=eE(C),A=y(...I);d({type:"useEndpoint",leaf:v,variant:"mutation",keys:A});const T=m.useRef(new Set),M=m.useCallback(O=>{T.current.forEach(L=>L(O))},[]),R=m.useCallback(O=>(T.current.add(O),()=>{T.current.delete(O)}),[]);return{...Kfe({...x??{},mutationKey:A,mutationFn:async O=>{const L=await $(...I,O);return M(L),L}},u),onReceive:R}},fetch:$}}var cS=e=>{if(typeof console>"u")return;const t=console.debug??console.log;t==null||t.call(console,"[rrroutes-client]",e)},epe=["fetch","invalidate","setData","build","useEndpoint"],uM=()=>{};function tpe(e,t){const r={emit:uM,mode:"minimal"};if(t&&t.toLowerCase()==="production"||!e)return r;if(e===!0||e==="minimal")return{emit:(n,i)=>cS(i?{...n,name:i}:n),mode:"minimal"};if(e==="complete")return{emit:(n,i)=>cS(i?{...n,name:i}:n),mode:"complete"};if(typeof e=="function")return{emit:(n,i)=>e(i?{...n,name:i}:n),mode:"minimal"};if(typeof e=="object"){const n=e,i=!!n.verbose,o=epe.filter(f=>n[f]);if(o.length===0)return{emit:uM,mode:i?"complete":"minimal"};const a=new Set(o),s=n.only&&n.only.length>0?new Set(n.only):void 0,u=n.logger??cS;return{emit:(f,p)=>{a.has(f.type)&&(s&&(!p||!s.has(p))||u(p?{...f,name:p}:f))},mode:i?"complete":"minimal"}}return r}function rpe(e){const t=e.queryClient,r=e.fetcher??_3,n=e.baseUrl,i=e.environment??void 0,{emit:o,mode:a}=tpe(e.debug,i),s=a==="complete",u=(v,y)=>!s||!y?v:{...v,...y};async function d(v,y=!1){const b=v;await t.invalidateQueries({queryKey:b,exact:y}),o({type:"invalidate",key:b,exact:y})}function f(v,y,b){const w=`${v.method.toUpperCase()} ${String(v.path)}`,x=b==null?void 0:b.name,k=I=>o(I,x),$=v.method==="get",P=!!v.cfg.feed,j=e.validateResponses,C={baseUrl:n,validateResponses:j,fetcher:r,queryClient:t,emit:k,decorateDebugEvent:u,isVerboseDebug:s,leafLabel:w};return $&&P?Qfe(v,y,C):$?Yfe(v,y,C):Jfe(v,y,C)}return{queryClient:t,invalidate:d,fetch:async v=>{const{path:y,method:b,query:w,body:x,params:k}=v;if(!y||typeof y!="string")throw new Error("fetch(path, ...) requires a non-empty string path.");if(!b)throw new Error("fetch(path, method, ...) requires an HTTP method.");const $=String(b).toLowerCase(),P=ox($),j=Zfe(w),C=A3(j),I=Xfe(y,k),A=`${n??""}${I}${C}`,T=`${P} ${y}`,M=Date.now(),R=s?{params:k,flatQuery:j,query:w,baseUrl:n}:void 0;o(u({type:"fetch",stage:"start",method:P,url:A,leaf:T,...x!==void 0?{body:x}:{}},R));try{const D=await r(x===void 0?{url:A,method:P}:{url:A,method:P,body:x});return o(u({type:"fetch",stage:"fetched",method:P,url:A,leaf:T,durationMs:Date.now()-M},s?{params:k,query:j,output:D}:void 0)),D}catch(D){throw o(u({type:"fetch",stage:"error",method:P,url:A,leaf:T,durationMs:Date.now()-M,...x!==void 0?{body:x}:{},error:D},R)),D}},build:f}}nx([Qh(Uu()),Uu()]);m.createContext(null);const M3=m.createContext(null),cM="rrroutes.docs.baseUrl";function npe({children:e,initialBaseUrl:t}){const[r,n]=m.useState([]),i=typeof window<"u"?window.localStorage.getItem(cM):null,[o,a]=m.useState(i||t);m.useEffect(()=>{typeof window<"u"&&window.localStorage.setItem(cM,o)},[o]);const s=m.useMemo(()=>new _fe({defaultOptions:{queries:{retry:!1}}}),[]),u=m.useMemo(()=>rpe({baseUrl:o,queryClient:s,fetcher:async v=>_3(v),validateResponses:!0}),[o,s]),d=m.useMemo(()=>({id:v,method:y,path:b})=>{console.log(v);const w=r.filter(x=>(console.log(x.id),x.log.method===y&&x.log.path===b&&(v?x.id===v:!0)));if(w.length>0)return w[w.length-1]},[r]),f=m.useMemo(()=>async(v,y,b,w)=>{const x=Date.now();let k,$,P=-1,j={};try{const A=await u.fetch({method:v,path:y,body:b.body&&b.body.trim().length>0?JSON.parse(b.body):void 0,query:b.query.reduce((T,M)=>(M.key.trim().length>0&&M.value&&M.enabled&&(T[M.key]=M.value),T),{}),params:b.params.reduce((T,M)=>(M.key.trim().length>0&&M.value&&M.enabled&&(T[M.key]=M.value),T),{})});k=A.data,P=A.status,j=A.headers}catch(A){A instanceof Jj?(P=A.status,j=A.headers,$={message:A.body.message,stack:A.stack,name:A.name}):A instanceof Error?$={message:JSON.stringify(A.message),stack:A.stack,name:A.name}:$={message:"An unknown error occurred"}}const C=Date.now(),I={id:w,error:$,log:{durationMs:C-x,method:v,path:y,status:P,name:`${v.toUpperCase()} ${y}`,updatedAt:C,createdAt:x,id:`local-${Math.random().toString(36).substring(2,9)}`,body:b.body?JSON.parse(b.body):void 0,params:b.params.reduce((A,T)=>(T.key.trim().length>0&&T.value&&T.enabled&&(A[T.key]=T.value),A),{}),query:b.query.reduce((A,T)=>(T.key.trim().length>0&&T.value&&T.enabled&&(A[T.key]=T.value),A),{}),headers:j,error:$==null?void 0:$.message,output:k,groupId:void 0,tags:[],fullUrl:""}};return n(A=>[...A,I]),I},[]),p=m.useMemo(()=>({client:u,queryClient:s,baseUrl:o,headers:{},setBaseUrl:a,runs:r,getLastRun:d,fetch:f}),[o,f,d,r,u]);return h.jsx(M3.Provider,{value:p,children:e})}function rf(){const e=m.useContext(M3);if(!e)throw new Error("useHistoryStore must be used within HistoryProvider");return e}const ax=["get","post","put","patch","delete"],Hu=ie.enum(ax),nf=ie.object({id:ie.string(),name:ie.string(),description:ie.string().optional(),groupId:ie.string().optional(),tags:ie.string().array().optional(),createdAt:ie.number(),updatedAt:ie.number()}),lc=ie.object({beforeDate:ie.string().optional(),afterDate:ie.string().optional(),orderBy:ie.enum(["timestamp","duration","level","path"]).optional(),orderDirection:ie.enum(["asc","desc"]).optional(),searchQuery:ie.string().optional(),groupsInclude:ie.string().array().optional(),groupsExclude:ie.string().array().optional(),tagsInclude:ie.string().array().optional(),tagsExclude:ie.string().array().optional()}),of=ie.object({cursor:ie.string().optional(),pageSize:ie.coerce.number().optional()}),af=ie.object({totalCount:ie.number().optional(),nextCursor:ie.string().optional()}),R3=["hit","miss","set","delete"],aP=ie.enum(R3),D3=nf.extend({operation:aP,value:ie.any().nullable(),size:ie.number().optional(),durationMs:ie.number().optional()}),dM=lc.extend({operationsInclude:aP.array().optional(),operationsExclude:aP.array().optional(),keys:ie.array(ie.string()).optional(),keySearch:ie.string().optional()});ie.object({key:ie.string(),lastSetAt:ie.number().nullable(),lastHitAt:ie.number().nullable(),lastMissAt:ie.number().nullable(),totalHits:ie.number(),totalMisses:ie.number(),totalSets:ie.number(),sizeBytes:ie.number().optional()});const ipe=ie.object({key:ie.string(),currentSizeBytes:ie.number().nullable(),lastSetAt:ie.number().nullable(),lastDeleteAt:ie.number().nullable(),lastHitAt:ie.number().nullable(),lastMissAt:ie.number().nullable(),lastActivityAt:ie.number().nullable(),totalHits:ie.number(),totalMisses:ie.number(),totalSets:ie.number(),totalDeletes:ie.number(),hitsSinceLastSet:ie.number(),missesSinceLastSet:ie.number(),deletesSinceLastSet:ie.number(),avgTimeBetweenSetsMs:ie.number().nullable(),avgHitsBetweenSets:ie.number().nullable(),avgMissesBetweenSets:ie.number().nullable(),hitRate:ie.number(),missRate:ie.number()}),ope=ie.object({tag:ie.string(),approxCurrentSizeBytes:ie.number().nullable(),totalHits:ie.number(),totalMisses:ie.number(),totalSets:ie.number(),totalDeletes:ie.number(),avgTimeBetweenSetsMs:ie.number().nullable(),avgHitsBetweenSets:ie.number().nullable(),avgMissesBetweenSets:ie.number().nullable(),hitRate:ie.number(),missRate:ie.number()}),ape=ie.object({computedAt:ie.number(),windowStart:ie.number().nullable(),windowEnd:ie.number().nullable(),groupBy:ie.enum(["key","tag","both"]),keys:ipe.array().optional(),tags:ope.array().optional()}),spe=lc.extend({keys:ie.array(ie.string()).optional(),groupBy:ie.enum(["key","tag","both"]).default("both")}),lpe=yo("cache").get({feed:!0,outputSchema:D3.array(),querySchema:dM,outputMetaSchema:af,queryExtensionSchema:of}).sub(yo("insights").get({outputSchema:ape,querySchema:spe}).done(),yo("clear").post({outputSchema:ie.object({success:ie.boolean()}),querySchema:dM}).done()).done(),z3=["info","warning","error","debug","trace"],sP=ie.enum(z3),N3=nf.extend({level:sP,meta:ie.any().optional()}),upe=lc.extend({levelsInclude:sP.array().optional(),levelsExclude:sP.array().optional()}),cpe=yo("logs").get({feed:!0,outputSchema:N3.array(),querySchema:upe,outputMetaSchema:af,queryExtensionSchema:of}).done(),hy=nf.extend({status:ie.number(),body:ie.any().optional(),fullUrl:ie.string(),path:ie.string(),method:Hu,query:ie.record(ie.string(),ie.any()).optional(),params:ie.record(ie.string(),ie.any()).optional(),output:ie.any().optional(),headers:ie.record(ie.string(),ie.any()).optional(),error:ie.string().optional(),durationMs:ie.number(),ip:ie.string().optional(),userAgent:ie.string().optional()}),dpe=lc.extend({methodsInclude:Hu.array().optional(),methodsExclude:Hu.array().optional(),statusesInclude:ie.coerce.number().array().optional(),statusesExclude:ie.coerce.number().array().optional(),path:ie.string().optional(),endpointKeysInclude:ie.string().array().optional(),endpointKeysExclude:ie.string().array().optional()}),fpe=yo("requests").get({feed:!0,outputSchema:hy.array(),querySchema:dpe,outputMetaSchema:af,queryExtensionSchema:of}).sub(yo(":requestId",void 0,ie.string()).get({outputSchema:hy.extend({logs:ie.array(N3),caches:ie.array(D3)})}).done()).done(),ppe=["object","string","number","boolean","bigint","date","array","enum","literal","union","record","tuple","unknown","any"],gu=ie.lazy(()=>ie.object({kind:ie.enum(ppe),optional:ie.boolean().optional(),nullable:ie.boolean().optional(),description:ie.string().optional(),properties:ie.record(ie.string(),gu).optional(),element:gu.optional(),union:ie.array(gu).optional(),literal:ie.unknown().optional(),enumValues:ie.array(ie.string()).optional()})),hpe=["experimental","beta","stable","deprecated","unknown"],lP=ie.enum(hpe),L3=nf.extend({method:Hu,path:ie.string(),contract:ie.object({body:gu.optional(),query:gu.optional(),output:gu.optional(),params:gu.optional(),bodyFiles:ie.array(ie.object({name:ie.string(),maxCount:ie.number()})).optional()}),feed:ie.boolean().optional(),summary:ie.string().optional(),stability:lP,hidden:ie.boolean().optional(),meta:ie.record(ie.string(),ie.string()),implemented:ie.boolean().optional()}),mpe=lc.extend({methodsInclude:Hu.array().optional(),methodsExclude:Hu.array().optional(),path:ie.string().optional(),stabilityInclude:lP.array().optional(),stabilityExclude:lP.array().optional()}),gpe=L3.extend({requests:ie.array(hy),volumeTS:ie.array(ie.object({timestamp:ie.number(),count:ie.number()})),averageDurationMs:ie.number(),successRate:ie.number(),latestErrors:ie.array(hy).optional()}),vpe=yo("endpoints").get({feed:!0,querySchema:mpe,outputSchema:L3.array(),outputMetaSchema:af,queryExtensionSchema:of}).sub(yo(":endpointId",void 0,ie.string()).get({outputSchema:gpe}).done()).done(),bp=nf.extend({operations:ie.array(ie.object({name:ie.string(),description:ie.string().optional(),stepNumber:ie.number(),endpointId:ie.string().optional(),method:Hu,path:ie.string(),body:ie.json().optional(),extraHeaders:ie.record(ie.string(),ie.any()).optional(),query:ie.record(ie.string(),ie.any()).optional()}))}),ype=lc.extend({nameInclude:ie.string().optional(),nameExclude:ie.string().optional()}),bpe=yo("presets").get({feed:!0,querySchema:ype,outputMetaSchema:af,outputSchema:bp.array(),queryExtensionSchema:of}).post({bodySchema:bp,outputSchema:bp}).put({bodySchema:bp,outputSchema:bp}).done(),xpe=nf.extend({message:ie.any().optional(),toRoomId:ie.array(ie.string()).nullable()}),wpe=lc.extend({eventName:ie.string().optional(),roomsInclude:ie.array(ie.string()).optional(),roomsExclude:ie.array(ie.string()).optional()}),Spe=ie.object({eventName:ie.string(),message:ie.json().optional(),toRoomId:ie.array(ie.string()).nullable()}),kpe=ie.object({success:ie.boolean(),eventId:ie.string().optional()}),Ppe=yo("sockets").get({feed:!0,outputSchema:xpe.array(),querySchema:wpe,outputMetaSchema:af,queryExtensionSchema:of}).post({bodySchema:Spe,outputSchema:kpe}).done(),$pe=yo().sub(yo("/__rrroutes").sub(vpe,fpe,cpe,lpe,bpe,Ppe).done()).done(),rE=sfe($pe);function rn(e,t){const{client:r}=rf();return m.useMemo(()=>r.build(rE.byKey[e],t),[r,e,t])}const B3=m.createContext(null);function Cpe({children:e}){const[t,r]=m.useState([]),[n,i]=m.useState(null),o=f=>{r(p=>[...p,f])},a=({id:f,method:p,path:v})=>t.filter(y=>y.method!==p||y.path!==v?!1:f?y.id===f:!0).slice(-1)[0],s=m.useCallback(f=>{i(f)},[]),u=m.useCallback(f=>!n||f&&(f.method&&n.method!==f.method||f.path&&n.path!==f.path||f.leafKey&&n.leafKey!==f.leafKey)?null:(i(null),n),[n]),d=m.useMemo(()=>({runs:t,addRun:o,getLastRun:a,queuePrefill:s,consumePrefill:u}),[t,s,u]);return h.jsx(B3.Provider,{value:d,children:e})}function sx(){const e=m.useContext(B3);if(!e)throw new Error("usePlaygroundRuns must be used within PlaygroundRunsProvider");return e}const uP="tab",cP="layout",jpe=["request","response","meta","metrics","playground"];function fM(e){return e&&jpe.includes(e)?e:"request"}function F3(e){return e==="request"?null:e}function pM(e){return e==="detailsMax"?"details":e==="playgroundMax"?"playground":"split"}function U3(e){return e==="details"?"detailsMax":e==="playground"?"playgroundMax":null}function ad(e,t){if(!e||!t)return{displayId:"",encodedId:""};try{const r=e.toUpperCase();return{displayId:Rd(r,t,!1),encodedId:Rd(r,t,!0)}}catch{const r=`${e.toUpperCase()} ${t}`;return{displayId:r,encodedId:encodeURIComponent(r)}}}function W3(e){const t=Rd(e.method.toUpperCase(),e.path,!1);return{value:t,display:t,method:e.method,path:e.path}}function K3(e){if(!e)return;const t=e.trim();if(!t)return;const[r,...n]=t.split(" ");if(!r||n.length===0)return;const i=r.toLowerCase();if(!ax.includes(i))return;const o=n.join(" ").trim();if(!o)return;const a=Rd(r.toUpperCase(),o,!1);return{value:a,display:a,method:i,path:o}}function Epe(e){if(!e)return"";const t=K3(e);return t?Rd(t.method.toUpperCase(),t.path,!0):encodeURIComponent(e)}function oh(e,t){const r=encodeURIComponent(e),n=new URLSearchParams,i=t!=null&&t.tab?F3(t.tab):null;i&&n.set(uP,i);const o=t!=null&&t.layout?U3(t.layout):null;o&&n.set(cP,o),Object.entries((t==null?void 0:t.extraParams)??{}).forEach(([s,u])=>{u!=null&&n.set(s,u)});const a=n.toString();return a?`/routes/${r}?${a}`:`/routes/${r}`}function ji({title:e,description:t,action:r}){return h.jsx(Be,{sx:{py:8,px:2,textAlign:"center",color:"text.secondary"},children:h.jsxs(ue,{spacing:2,alignItems:"center",children:[h.jsx(ne,{variant:"h5",color:"text.primary",children:e}),t&&h.jsx(ne,{variant:"body1",color:"text.secondary",maxWidth:480,children:t}),r]})})}const Ipe=Et(h.jsx("path",{d:"M11 15h2v2h-2zm0-8h2v6h-2zm.99-5C6.47 2 2 6.48 2 12s4.47 10 9.99 10C17.52 22 22 17.52 22 12S17.52 2 11.99 2M12 20c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8"})),ea=Et(h.jsx("path",{d:"M16.59 8.59 12 13.17 7.41 8.59 6 10l6 6 6-6z"}));function ia({message:e="Something went wrong.",onRetry:t,details:r}){const[n,i]=m.useState(!1);return h.jsx(Yn,{elevation:0,sx:{p:4,borderRadius:2,border:"1px solid",borderColor:"divider",bgcolor:"background.default"},children:h.jsxs(ue,{spacing:2,alignItems:"flex-start",children:[h.jsxs(ue,{direction:"row",spacing:2,alignItems:"center",children:[h.jsx(Ipe,{color:"error",fontSize:"large"}),h.jsxs(Be,{children:[h.jsx(ne,{variant:"h6",children:"We hit a snag"}),h.jsx(ne,{color:"text.secondary",children:e})]})]}),t&&h.jsx(zt,{variant:"contained",color:"primary",onClick:t,children:"Retry"}),r&&h.jsxs(Be,{sx:{width:"100%"},children:[h.jsx(zt,{size:"small",startIcon:h.jsx(ea,{sx:{transform:n?"rotate(180deg)":"rotate(0deg)",transition:"transform 150ms ease"}}),onClick:()=>i(o=>!o),children:n?"Hide details":"Show details"}),h.jsx(Yp,{in:n,children:h.jsx(Be,{component:"pre",sx:{mt:1,p:2,borderRadius:1,bgcolor:"background.paper",overflowX:"auto",typography:"body2"},children:r})})]})]})})}function Ma({variant:e="inline"}){return e==="table"?h.jsx(ue,{spacing:1.5,children:Array.from({length:5}).map((t,r)=>h.jsx(sS,{variant:"rectangular",height:40,sx:{borderRadius:1}},r))}):e==="full"?h.jsxs(Be,{sx:{display:"flex",alignItems:"center",justifyContent:"center",flexDirection:"column",py:8,gap:2},children:[h.jsx(q$,{size:32}),h.jsx(ne,{color:"text.secondary",children:"Loading data..."})]}):h.jsxs(ue,{spacing:1,children:[h.jsx(sS,{variant:"text",width:"60%"}),h.jsx(sS,{variant:"text",width:"40%"})]})}const Ope=Et(h.jsx("path",{d:"M20 11H7.83l5.59-5.59L12 4l-8 8 8 8 1.41-1.41L7.83 13H20z"})),_pe=Et(h.jsx("path",{d:"m12 4-1.41 1.41L16.17 11H4v2h12.17l-5.58 5.59L12 20l8-8z"})),Ape=Et(h.jsx("path",{d:"M19 6.41 17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"}));function sf({open:e,onClose:t,title:r,children:n,onPrev:i,onNext:o,scroll:a="paper"}){const s=Kr();Pse(s.breakpoints.down("sm"));const u=typeof r=="string"?h.jsx(ne,{variant:"h6",component:"h2",sx:{flex:1,minWidth:0},children:r}):h.jsx(Be,{sx:{flex:1,minWidth:0},children:r});return h.jsxs(zne,{open:e,onClose:t,fullWidth:!0,maxWidth:"lg",fullScreen:!1,sx:{flex:1},children:[h.jsxs(ue,{direction:"row",alignItems:"center",justifyContent:"space-between",sx:{px:{xs:2,sm:3},py:2,borderBottom:"1px solid",borderColor:"divider",gap:1},children:[h.jsxs(ue,{direction:"row",spacing:1,alignItems:"center",sx:{minWidth:0},children:[h.jsx(qn,{"aria-label":"Previous item",size:"small",onClick:i,disabled:!i,children:h.jsx(Ope,{fontSize:"small"})}),u,h.jsx(qn,{"aria-label":"Next item",size:"small",onClick:o,disabled:!o,children:h.jsx(_pe,{fontSize:"small"})})]}),h.jsx(qn,{"aria-label":"Close detail dialog",onClick:t,children:h.jsx(Ape,{})})]}),h.jsx(Une,{sx:{flexDirection:"column"},children:n})]})}const Tpe=Et(h.jsx("path",{d:"M12 5V1L7 6l5 5V7c3.31 0 6 2.69 6 6s-2.69 6-6 6-6-2.69-6-6H4c0 4.42 3.58 8 8 8s8-3.58 8-8-3.58-8-8-8"})),Mpe=Et(h.jsx("path",{d:"M16 1H4c-1.1 0-2 .9-2 2v14h2V3h12zm3 4H8c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h11c1.1 0 2-.9 2-2V7c0-1.1-.9-2-2-2m0 16H8V7h11z"}));function ai({value:e,collapsedLines:t=20,title:r}){const[n,i]=m.useState(!1),o=m.useMemo(()=>{try{return JSON.stringify(e??null,null,2)}catch{return"<< Unable to render JSON >>"}},[e]),a=async()=>{if(!(typeof navigator>"u"||!navigator.clipboard))try{await navigator.clipboard.writeText(o),i(!0),setTimeout(()=>i(!1),1500)}catch(u){console.error("Failed to copy JSON",u)}},s=o.replace(/\\n/g,`
314
+ `).replace(/\\t/g," ").replace(/\\"/g,'"');return h.jsxs(ue,{spacing:1,children:[h.jsxs(ue,{direction:"row",alignItems:"center",justifyContent:"space-between",children:[h.jsx(ne,{variant:"subtitle2",color:"text.secondary",children:r||"Output"}),h.jsx(Bh,{title:n?"Copied!":"Copy JSON",placement:"top",children:h.jsx(qn,{size:"small",onClick:a,children:h.jsx(Mpe,{fontSize:"inherit"})})})]}),h.jsx(Be,{component:"pre",sx:{m:0,p:2,borderRadius:2,bgcolor:"background.default",border:"1px solid",borderColor:"divider",fontFamily:"monospace",fontSize:"0.85rem",lineHeight:1.6,maxHeight:`${t*1.6}rem`,overflow:"auto"},children:s})]})}function H3({open:e,event:t,onClose:r,onOpenGroup:n}){var a;const i=t?`Socket event · ${t.name}`:"Socket event details",o=t?Dpe(t.createdAt):"";return h.jsx(sf,{open:e,onClose:r,title:i,children:t?h.jsxs(ue,{spacing:3,children:[h.jsxs(ue,{spacing:.5,children:[h.jsx(ne,{variant:"body2",color:"text.secondary",children:o}),h.jsxs(ne,{variant:"body2",sx:{fontFamily:"monospace"},color:"text.secondary",children:["ID: ",t.id]})]}),h.jsxs(Be,{sx:{display:"grid",gridTemplateColumns:{xs:"repeat(2, minmax(0, 1fr))",sm:"repeat(3, minmax(0, 1fr))"},gap:2},children:[h.jsx(dS,{label:"Event name",value:t.name}),h.jsx(dS,{label:"Group ID",children:t.groupId?h.jsx(dr,{label:t.groupId,size:"small",variant:"outlined",sx:{fontFamily:"monospace"},onClick:()=>t.groupId&&(n==null?void 0:n(t.groupId))}):h.jsx(ne,{variant:"body2",color:"text.secondary",children:"—"})}),h.jsx(dS,{label:"Tags",children:(a=t.tags)!=null&&a.length?h.jsx(ue,{direction:"row",spacing:.5,flexWrap:"wrap",useFlexGap:!0,children:t.tags.map(s=>h.jsx(dr,{label:s,size:"small"},s))}):h.jsx(ne,{variant:"body2",color:"text.secondary",children:"—"})})]}),h.jsxs(ue,{spacing:1,children:[h.jsx(ne,{variant:"subtitle2",color:"text.secondary",children:"Rooms"}),Rpe(t.toRoomId)]}),h.jsxs(ue,{spacing:1,children:[h.jsx(ne,{variant:"subtitle2",color:"text.secondary",children:"Message"}),h.jsx(ai,{value:t.message,collapsedLines:16})]})]}):h.jsx(ne,{color:"text.secondary",children:"Select a socket event to see details."})})}function dS({label:e,value:t,children:r}){const n=r!==void 0;return h.jsxs(ue,{spacing:.5,children:[h.jsx(ne,{variant:"caption",color:"text.secondary",children:e}),n?r:h.jsx(ne,{variant:"body2",children:t??"—"})]})}function Rpe(e){return!e||!e.length?h.jsx(ne,{variant:"body2",color:"text.secondary",children:"—"}):h.jsx(ue,{direction:"row",spacing:.5,flexWrap:"wrap",useFlexGap:!0,children:e.map(t=>h.jsx(dr,{label:t,size:"small",sx:{fontFamily:"monospace"}},t))})}function Dpe(e){if(!e)return"";try{return new Date(e).toLocaleString()}catch{return""}}function _t({title:e,actions:t,children:r,flex:n}){const i=!!(e||t);return h.jsx(cB,{sx:{bgcolor:"background.paper",flex:n},children:h.jsxs(Wre,{children:[i&&h.jsxs(ue,{direction:{xs:"column",sm:"row"},alignItems:{xs:"flex-start",sm:"center"},justifyContent:"space-between",spacing:2,mb:2,children:[e&&h.jsx(ne,{variant:"h6",component:"h2",children:e}),t&&h.jsx(Be,{children:t})]}),h.jsx(Be,{children:r})]})})}var zpe=["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"];function nE(e){if(typeof e!="string")return!1;var t=zpe;return t.includes(e)}var Npe=["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"],Lpe=new Set(Npe);function V3(e){return typeof e!="string"?!1:Lpe.has(e)}function q3(e){return typeof e=="string"&&e.startsWith("data-")}function Zn(e){if(typeof e!="object"||e===null)return{};var t={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(V3(r)||q3(r))&&(t[r]=e[r]);return t}function Vu(e){if(e==null)return null;if(m.isValidElement(e)&&typeof e.props=="object"&&e.props!==null){var t=e.props;return Zn(t)}return typeof e=="object"&&!Array.isArray(e)?Zn(e):null}function Rn(e){var t={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(V3(r)||q3(r)||nE(r))&&(t[r]=e[r]);return t}function Bpe(e){return e==null?null:m.isValidElement(e)?Rn(e.props):typeof e=="object"&&!Array.isArray(e)?Rn(e):null}var Fpe=["children","width","height","viewBox","className","style","title","desc"];function dP(){return dP=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},dP.apply(null,arguments)}function Upe(e,t){if(e==null)return{};var r,n,i=Wpe(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n<o.length;n++)r=o[n],t.indexOf(r)===-1&&{}.propertyIsEnumerable.call(e,r)&&(i[r]=e[r])}return i}function Wpe(e,t){if(e==null)return{};var r={};for(var n in e)if({}.hasOwnProperty.call(e,n)){if(t.indexOf(n)!==-1)continue;r[n]=e[n]}return r}var iE=m.forwardRef((e,t)=>{var{children:r,width:n,height:i,viewBox:o,className:a,style:s,title:u,desc:d}=e,f=Upe(e,Fpe),p=o||{width:n,height:i,x:0,y:0},v=ve("recharts-surface",a);return m.createElement("svg",dP({},Rn(f),{className:v,width:n,height:i,style:s,viewBox:"".concat(p.x," ").concat(p.y," ").concat(p.width," ").concat(p.height),ref:t}),m.createElement("title",null,u),m.createElement("desc",null,d),r)}),Kpe=["children","className"];function fP(){return fP=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},fP.apply(null,arguments)}function Hpe(e,t){if(e==null)return{};var r,n,i=Vpe(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n<o.length;n++)r=o[n],t.indexOf(r)===-1&&{}.propertyIsEnumerable.call(e,r)&&(i[r]=e[r])}return i}function Vpe(e,t){if(e==null)return{};var r={};for(var n in e)if({}.hasOwnProperty.call(e,n)){if(t.indexOf(n)!==-1)continue;r[n]=e[n]}return r}var fr=m.forwardRef((e,t)=>{var{children:r,className:n}=e,i=Hpe(e,Kpe),o=ve("recharts-layer",n);return m.createElement("g",fP({className:o},Rn(i),{ref:t}),r)}),G3=m.createContext(null),qpe=()=>m.useContext(G3);function cr(e){return function(){return e}}const Z3=Math.cos,my=Math.sin,oa=Math.sqrt,gy=Math.PI,lx=2*gy,pP=Math.PI,hP=2*pP,au=1e-6,Gpe=hP-au;function X3(e){this._+=e[0];for(let t=1,r=e.length;t<r;++t)this._+=arguments[t]+e[t]}function Zpe(e){let t=Math.floor(e);if(!(t>=0))throw new Error(`invalid digits: ${e}`);if(t>15)return X3;const r=10**t;return function(n){this._+=n[0];for(let i=1,o=n.length;i<o;++i)this._+=Math.round(arguments[i]*r)/r+n[i]}}class Xpe{constructor(t){this._x0=this._y0=this._x1=this._y1=null,this._="",this._append=t==null?X3:Zpe(t)}moveTo(t,r){this._append`M${this._x0=this._x1=+t},${this._y0=this._y1=+r}`}closePath(){this._x1!==null&&(this._x1=this._x0,this._y1=this._y0,this._append`Z`)}lineTo(t,r){this._append`L${this._x1=+t},${this._y1=+r}`}quadraticCurveTo(t,r,n,i){this._append`Q${+t},${+r},${this._x1=+n},${this._y1=+i}`}bezierCurveTo(t,r,n,i,o,a){this._append`C${+t},${+r},${+n},${+i},${this._x1=+o},${this._y1=+a}`}arcTo(t,r,n,i,o){if(t=+t,r=+r,n=+n,i=+i,o=+o,o<0)throw new Error(`negative radius: ${o}`);let a=this._x1,s=this._y1,u=n-t,d=i-r,f=a-t,p=s-r,v=f*f+p*p;if(this._x1===null)this._append`M${this._x1=t},${this._y1=r}`;else if(v>au)if(!(Math.abs(p*u-d*f)>au)||!o)this._append`L${this._x1=t},${this._y1=r}`;else{let y=n-a,b=i-s,w=u*u+d*d,x=y*y+b*b,k=Math.sqrt(w),$=Math.sqrt(v),P=o*Math.tan((pP-Math.acos((w+v-x)/(2*k*$)))/2),j=P/$,C=P/k;Math.abs(j-1)>au&&this._append`L${t+j*f},${r+j*p}`,this._append`A${o},${o},0,0,${+(p*y>f*b)},${this._x1=t+C*u},${this._y1=r+C*d}`}}arc(t,r,n,i,o,a){if(t=+t,r=+r,n=+n,a=!!a,n<0)throw new Error(`negative radius: ${n}`);let s=n*Math.cos(i),u=n*Math.sin(i),d=t+s,f=r+u,p=1^a,v=a?i-o:o-i;this._x1===null?this._append`M${d},${f}`:(Math.abs(this._x1-d)>au||Math.abs(this._y1-f)>au)&&this._append`L${d},${f}`,n&&(v<0&&(v=v%hP+hP),v>Gpe?this._append`A${n},${n},0,1,${p},${t-s},${r-u}A${n},${n},0,1,${p},${this._x1=d},${this._y1=f}`:v>au&&this._append`A${n},${n},0,${+(v>=pP)},${p},${this._x1=t+n*Math.cos(o)},${this._y1=r+n*Math.sin(o)}`)}rect(t,r,n,i){this._append`M${this._x0=this._x1=+t},${this._y0=this._y1=+r}h${n=+n}v${+i}h${-n}Z`}toString(){return this._}}function oE(e){let t=3;return e.digits=function(r){if(!arguments.length)return t;if(r==null)t=null;else{const n=Math.floor(r);if(!(n>=0))throw new RangeError(`invalid digits: ${r}`);t=n}return e},()=>new Xpe(t)}function aE(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function Y3(e){this._context=e}Y3.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);break}}};function ux(e){return new Y3(e)}function Q3(e){return e[0]}function J3(e){return e[1]}function eW(e,t){var r=cr(!0),n=null,i=ux,o=null,a=oE(s);e=typeof e=="function"?e:e===void 0?Q3:cr(e),t=typeof t=="function"?t:t===void 0?J3:cr(t);function s(u){var d,f=(u=aE(u)).length,p,v=!1,y;for(n==null&&(o=i(y=a())),d=0;d<=f;++d)!(d<f&&r(p=u[d],d,u))===v&&((v=!v)?o.lineStart():o.lineEnd()),v&&o.point(+e(p,d,u),+t(p,d,u));if(y)return o=null,y+""||null}return s.x=function(u){return arguments.length?(e=typeof u=="function"?u:cr(+u),s):e},s.y=function(u){return arguments.length?(t=typeof u=="function"?u:cr(+u),s):t},s.defined=function(u){return arguments.length?(r=typeof u=="function"?u:cr(!!u),s):r},s.curve=function(u){return arguments.length?(i=u,n!=null&&(o=i(n)),s):i},s.context=function(u){return arguments.length?(u==null?n=o=null:o=i(n=u),s):n},s}function ev(e,t,r){var n=null,i=cr(!0),o=null,a=ux,s=null,u=oE(d);e=typeof e=="function"?e:e===void 0?Q3:cr(+e),t=typeof t=="function"?t:cr(t===void 0?0:+t),r=typeof r=="function"?r:r===void 0?J3:cr(+r);function d(p){var v,y,b,w=(p=aE(p)).length,x,k=!1,$,P=new Array(w),j=new Array(w);for(o==null&&(s=a($=u())),v=0;v<=w;++v){if(!(v<w&&i(x=p[v],v,p))===k)if(k=!k)y=v,s.areaStart(),s.lineStart();else{for(s.lineEnd(),s.lineStart(),b=v-1;b>=y;--b)s.point(P[b],j[b]);s.lineEnd(),s.areaEnd()}k&&(P[v]=+e(x,v,p),j[v]=+t(x,v,p),s.point(n?+n(x,v,p):P[v],r?+r(x,v,p):j[v]))}if($)return s=null,$+""||null}function f(){return eW().defined(i).curve(a).context(o)}return d.x=function(p){return arguments.length?(e=typeof p=="function"?p:cr(+p),n=null,d):e},d.x0=function(p){return arguments.length?(e=typeof p=="function"?p:cr(+p),d):e},d.x1=function(p){return arguments.length?(n=p==null?null:typeof p=="function"?p:cr(+p),d):n},d.y=function(p){return arguments.length?(t=typeof p=="function"?p:cr(+p),r=null,d):t},d.y0=function(p){return arguments.length?(t=typeof p=="function"?p:cr(+p),d):t},d.y1=function(p){return arguments.length?(r=p==null?null:typeof p=="function"?p:cr(+p),d):r},d.lineX0=d.lineY0=function(){return f().x(e).y(t)},d.lineY1=function(){return f().x(e).y(r)},d.lineX1=function(){return f().x(n).y(t)},d.defined=function(p){return arguments.length?(i=typeof p=="function"?p:cr(!!p),d):i},d.curve=function(p){return arguments.length?(a=p,o!=null&&(s=a(o)),d):a},d.context=function(p){return arguments.length?(p==null?o=s=null:s=a(o=p),d):o},d}class tW{constructor(t,r){this._context=t,this._x=r}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(t,r){switch(t=+t,r=+r,this._point){case 0:{this._point=1,this._line?this._context.lineTo(t,r):this._context.moveTo(t,r);break}case 1:this._point=2;default:{this._x?this._context.bezierCurveTo(this._x0=(this._x0+t)/2,this._y0,this._x0,r,t,r):this._context.bezierCurveTo(this._x0,this._y0=(this._y0+r)/2,t,this._y0,t,r);break}}this._x0=t,this._y0=r}}function Ype(e){return new tW(e,!0)}function Qpe(e){return new tW(e,!1)}const sE={draw(e,t){const r=oa(t/gy);e.moveTo(r,0),e.arc(0,0,r,0,lx)}},Jpe={draw(e,t){const r=oa(t/5)/2;e.moveTo(-3*r,-r),e.lineTo(-r,-r),e.lineTo(-r,-3*r),e.lineTo(r,-3*r),e.lineTo(r,-r),e.lineTo(3*r,-r),e.lineTo(3*r,r),e.lineTo(r,r),e.lineTo(r,3*r),e.lineTo(-r,3*r),e.lineTo(-r,r),e.lineTo(-3*r,r),e.closePath()}},rW=oa(1/3),ehe=rW*2,the={draw(e,t){const r=oa(t/ehe),n=r*rW;e.moveTo(0,-r),e.lineTo(n,0),e.lineTo(0,r),e.lineTo(-n,0),e.closePath()}},rhe={draw(e,t){const r=oa(t),n=-r/2;e.rect(n,n,r,r)}},nhe=.8908130915292852,nW=my(gy/10)/my(7*gy/10),ihe=my(lx/10)*nW,ohe=-Z3(lx/10)*nW,ahe={draw(e,t){const r=oa(t*nhe),n=ihe*r,i=ohe*r;e.moveTo(0,-r),e.lineTo(n,i);for(let o=1;o<5;++o){const a=lx*o/5,s=Z3(a),u=my(a);e.lineTo(u*r,-s*r),e.lineTo(s*n-u*i,u*n+s*i)}e.closePath()}},fS=oa(3),she={draw(e,t){const r=-oa(t/(fS*3));e.moveTo(0,r*2),e.lineTo(-fS*r,-r),e.lineTo(fS*r,-r),e.closePath()}},ao=-.5,so=oa(3)/2,mP=1/oa(12),lhe=(mP/2+1)*3,uhe={draw(e,t){const r=oa(t/lhe),n=r/2,i=r*mP,o=n,a=r*mP+r,s=-o,u=a;e.moveTo(n,i),e.lineTo(o,a),e.lineTo(s,u),e.lineTo(ao*n-so*i,so*n+ao*i),e.lineTo(ao*o-so*a,so*o+ao*a),e.lineTo(ao*s-so*u,so*s+ao*u),e.lineTo(ao*n+so*i,ao*i-so*n),e.lineTo(ao*o+so*a,ao*a-so*o),e.lineTo(ao*s+so*u,ao*u-so*s),e.closePath()}};function che(e,t){let r=null,n=oE(i);e=typeof e=="function"?e:cr(e||sE),t=typeof t=="function"?t:cr(t===void 0?64:+t);function i(){let o;if(r||(r=o=n()),e.apply(this,arguments).draw(r,+t.apply(this,arguments)),o)return r=null,o+""||null}return i.type=function(o){return arguments.length?(e=typeof o=="function"?o:cr(o),i):e},i.size=function(o){return arguments.length?(t=typeof o=="function"?o:cr(+o),i):t},i.context=function(o){return arguments.length?(r=o??null,i):r},i}function vy(){}function yy(e,t,r){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+r)/6)}function iW(e){this._context=e}iW.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:yy(this,this._x1,this._y1);case 2:this._context.lineTo(this._x1,this._y1);break}(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:yy(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function dhe(e){return new iW(e)}function oW(e){this._context=e}oW.prototype={areaStart:vy,areaEnd:vy,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);break}}},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:yy(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function fhe(e){return new oW(e)}function aW(e){this._context=e}aW.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 r=(this._x0+4*this._x1+e)/6,n=(this._y0+4*this._y1+t)/6;this._line?this._context.lineTo(r,n):this._context.moveTo(r,n);break;case 3:this._point=4;default:yy(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function phe(e){return new aW(e)}function sW(e){this._context=e}sW.prototype={areaStart:vy,areaEnd:vy,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 hhe(e){return new sW(e)}function hM(e){return e<0?-1:1}function mM(e,t,r){var n=e._x1-e._x0,i=t-e._x1,o=(e._y1-e._y0)/(n||i<0&&-0),a=(r-e._y1)/(i||n<0&&-0),s=(o*i+a*n)/(n+i);return(hM(o)+hM(a))*Math.min(Math.abs(o),Math.abs(a),.5*Math.abs(s))||0}function gM(e,t){var r=e._x1-e._x0;return r?(3*(e._y1-e._y0)/r-t)/2:t}function pS(e,t,r){var n=e._x0,i=e._y0,o=e._x1,a=e._y1,s=(o-n)/3;e._context.bezierCurveTo(n+s,i+s*t,o-s,a-s*r,o,a)}function by(e){this._context=e}by.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:pS(this,this._t0,gM(this,this._t0));break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){var r=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,pS(this,gM(this,r=mM(this,e,t)),r);break;default:pS(this,this._t0,r=mM(this,e,t));break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t,this._t0=r}}};function lW(e){this._context=new uW(e)}(lW.prototype=Object.create(by.prototype)).point=function(e,t){by.prototype.point.call(this,t,e)};function uW(e){this._context=e}uW.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,r,n,i,o){this._context.bezierCurveTo(t,e,n,r,o,i)}};function mhe(e){return new by(e)}function ghe(e){return new lW(e)}function cW(e){this._context=e}cW.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,r=e.length;if(r)if(this._line?this._context.lineTo(e[0],t[0]):this._context.moveTo(e[0],t[0]),r===2)this._context.lineTo(e[1],t[1]);else for(var n=vM(e),i=vM(t),o=0,a=1;a<r;++o,++a)this._context.bezierCurveTo(n[0][o],i[0][o],n[1][o],i[1][o],e[a],t[a]);(this._line||this._line!==0&&r===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 vM(e){var t,r=e.length-1,n,i=new Array(r),o=new Array(r),a=new Array(r);for(i[0]=0,o[0]=2,a[0]=e[0]+2*e[1],t=1;t<r-1;++t)i[t]=1,o[t]=4,a[t]=4*e[t]+2*e[t+1];for(i[r-1]=2,o[r-1]=7,a[r-1]=8*e[r-1]+e[r],t=1;t<r;++t)n=i[t]/o[t-1],o[t]-=n,a[t]-=n*a[t-1];for(i[r-1]=a[r-1]/o[r-1],t=r-2;t>=0;--t)i[t]=(a[t]-i[t+1])/o[t];for(o[r-1]=(e[r]+i[r-1])/2,t=0;t<r-1;++t)o[t]=2*e[t+1]-i[t+1];return[i,o]}function vhe(e){return new cW(e)}function cx(e,t){this._context=e,this._t=t}cx.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 r=this._x*(1-this._t)+e*this._t;this._context.lineTo(r,this._y),this._context.lineTo(r,t)}break}}this._x=e,this._y=t}};function yhe(e){return new cx(e,.5)}function bhe(e){return new cx(e,0)}function xhe(e){return new cx(e,1)}function zd(e,t){if((a=e.length)>1)for(var r=1,n,i,o=e[t[0]],a,s=o.length;r<a;++r)for(i=o,o=e[t[r]],n=0;n<s;++n)o[n][1]+=o[n][0]=isNaN(i[n][1])?i[n][0]:i[n][1]}function gP(e){for(var t=e.length,r=new Array(t);--t>=0;)r[t]=t;return r}function whe(e,t){return e[t]}function She(e){const t=[];return t.key=e,t}function khe(){var e=cr([]),t=gP,r=zd,n=whe;function i(o){var a=Array.from(e.apply(this,arguments),She),s,u=a.length,d=-1,f;for(const p of o)for(s=0,++d;s<u;++s)(a[s][d]=[0,+n(p,a[s].key,d,o)]).data=p;for(s=0,f=aE(t(a));s<u;++s)a[f[s]].index=s;return r(a,f),a}return i.keys=function(o){return arguments.length?(e=typeof o=="function"?o:cr(Array.from(o)),i):e},i.value=function(o){return arguments.length?(n=typeof o=="function"?o:cr(+o),i):n},i.order=function(o){return arguments.length?(t=o==null?gP:typeof o=="function"?o:cr(Array.from(o)),i):t},i.offset=function(o){return arguments.length?(r=o??zd,i):r},i}function Phe(e,t){if((n=e.length)>0){for(var r,n,i=0,o=e[0].length,a;i<o;++i){for(a=r=0;r<n;++r)a+=e[r][i][1]||0;if(a)for(r=0;r<n;++r)e[r][i][1]/=a}zd(e,t)}}function $he(e,t){if((i=e.length)>0){for(var r=0,n=e[t[0]],i,o=n.length;r<o;++r){for(var a=0,s=0;a<i;++a)s+=e[a][r][1]||0;n[r][1]+=n[r][0]=-s/2}zd(e,t)}}function Che(e,t){if(!(!((a=e.length)>0)||!((o=(i=e[t[0]]).length)>0))){for(var r=0,n=1,i,o,a;n<o;++n){for(var s=0,u=0,d=0;s<a;++s){for(var f=e[t[s]],p=f[n][1]||0,v=f[n-1][1]||0,y=(p-v)/2,b=0;b<s;++b){var w=e[t[b]],x=w[n][1]||0,k=w[n-1][1]||0;y+=x-k}u+=p,d+=y*p}i[n-1][1]+=i[n-1][0]=r,u&&(r-=d/u)}i[n-1][1]+=i[n-1][0]=r,zd(e,t)}}var hS={},mS={},yM;function jhe(){return yM||(yM=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function t(r){return r==="__proto__"}e.isUnsafeProperty=t})(mS)),mS}var gS={},bM;function dW(){return bM||(bM=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function t(r){switch(typeof r){case"number":case"symbol":return!1;case"string":return r.includes(".")||r.includes("[")||r.includes("]")}}e.isDeepKey=t})(gS)),gS}var vS={},xM;function lE(){return xM||(xM=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function t(r){var n;return typeof r=="string"||typeof r=="symbol"?r:Object.is((n=r==null?void 0:r.valueOf)==null?void 0:n.call(r),-0)?"-0":String(r)}e.toKey=t})(vS)),vS}var yS={},bS={},wM;function Ehe(){return wM||(wM=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function t(r){if(r==null)return"";if(typeof r=="string")return r;if(Array.isArray(r))return r.map(t).join(",");const n=String(r);return n==="0"&&Object.is(Number(r),-0)?"-0":n}e.toString=t})(bS)),bS}var SM;function uE(){return SM||(SM=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=Ehe(),r=lE();function n(i){if(Array.isArray(i))return i.map(r.toKey);if(typeof i=="symbol")return[i];i=t.toString(i);const o=[],a=i.length;if(a===0)return o;let s=0,u="",d="",f=!1;for(i.charCodeAt(0)===46&&(o.push(""),s++);s<a;){const p=i[s];d?p==="\\"&&s+1<a?(s++,u+=i[s]):p===d?d="":u+=p:f?p==='"'||p==="'"?d=p:p==="]"?(f=!1,o.push(u),u=""):u+=p:p==="["?(f=!0,u&&(o.push(u),u="")):p==="."?u&&(o.push(u),u=""):u+=p,s++}return u&&o.push(u),o}e.toPath=n})(yS)),yS}var kM;function cE(){return kM||(kM=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=jhe(),r=dW(),n=lE(),i=uE();function o(s,u,d){if(s==null)return d;switch(typeof u){case"string":{if(t.isUnsafeProperty(u))return d;const f=s[u];return f===void 0?r.isDeepKey(u)?o(s,i.toPath(u),d):d:f}case"number":case"symbol":{typeof u=="number"&&(u=n.toKey(u));const f=s[u];return f===void 0?d:f}default:{if(Array.isArray(u))return a(s,u,d);if(Object.is(u==null?void 0:u.valueOf(),-0)?u="-0":u=String(u),t.isUnsafeProperty(u))return d;const f=s[u];return f===void 0?d:f}}}function a(s,u,d){if(u.length===0)return d;let f=s;for(let p=0;p<u.length;p++){if(f==null||t.isUnsafeProperty(u[p]))return d;f=f[u[p]]}return f===void 0?d:f}e.get=o})(hS)),hS}var xS,PM;function Ihe(){return PM||(PM=1,xS=cE().get),xS}var Ohe=Ihe();const qu=Oa(Ohe);var $n=e=>e===0?0:e>0?1:-1,wo=e=>typeof e=="number"&&e!=+e,hs=e=>typeof e=="string"&&e.indexOf("%")===e.length-1,Ue=e=>(typeof e=="number"||e instanceof Number)&&!wo(e),Si=e=>Ue(e)||typeof e=="string",_he=0,ah=e=>{var t=++_he;return"".concat(e||"").concat(t)},Gn=function(t,r){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1;if(!Ue(t)&&typeof t!="string")return n;var o;if(hs(t)){if(r==null)return n;var a=t.indexOf("%");o=r*parseFloat(t.slice(0,a))/100}else o=+t;return wo(o)&&(o=n),i&&r!=null&&o>r&&(o=r),o},fW=e=>{if(!Array.isArray(e))return!1;for(var t=e.length,r={},n=0;n<t;n++)if(!r[e[n]])r[e[n]]=!0;else return!0;return!1};function Zt(e,t,r){return Ue(e)&&Ue(t)?e+r*(t-e):t}function pW(e,t,r){if(!(!e||!e.length))return e.find(n=>n&&(typeof t=="function"?t(n):qu(n,t))===r)}var xr=e=>e===null||typeof e>"u",Jh=e=>xr(e)?e:"".concat(e.charAt(0).toUpperCase()).concat(e.slice(1));function hW(e){return e!=null}function em(){}var Ahe=["type","size","sizeType"];function vP(){return vP=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},vP.apply(null,arguments)}function $M(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function CM(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?$M(Object(r),!0).forEach(function(n){The(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):$M(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function The(e,t,r){return(t=Mhe(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Mhe(e){var t=Rhe(e,"string");return typeof t=="symbol"?t:t+""}function Rhe(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Dhe(e,t){if(e==null)return{};var r,n,i=zhe(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n<o.length;n++)r=o[n],t.indexOf(r)===-1&&{}.propertyIsEnumerable.call(e,r)&&(i[r]=e[r])}return i}function zhe(e,t){if(e==null)return{};var r={};for(var n in e)if({}.hasOwnProperty.call(e,n)){if(t.indexOf(n)!==-1)continue;r[n]=e[n]}return r}var mW={symbolCircle:sE,symbolCross:Jpe,symbolDiamond:the,symbolSquare:rhe,symbolStar:ahe,symbolTriangle:she,symbolWye:uhe},Nhe=Math.PI/180,Lhe=e=>{var t="symbol".concat(Jh(e));return mW[t]||sE},Bhe=(e,t,r)=>{if(t==="area")return e;switch(r){case"cross":return 5*e*e/9;case"diamond":return .5*e*e/Math.sqrt(3);case"square":return e*e;case"star":{var n=18*Nhe;return 1.25*e*e*(Math.tan(n)-Math.tan(n*2)*Math.tan(n)**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}},Fhe=(e,t)=>{mW["symbol".concat(Jh(e))]=t},dE=e=>{var{type:t="circle",size:r=64,sizeType:n="area"}=e,i=Dhe(e,Ahe),o=CM(CM({},i),{},{type:t,size:r,sizeType:n}),a="circle";typeof t=="string"&&(a=t);var s=()=>{var v=Lhe(a),y=che().type(v).size(Bhe(r,n,a)),b=y();if(b!==null)return b},{className:u,cx:d,cy:f}=o,p=Rn(o);return Ue(d)&&Ue(f)&&Ue(r)?m.createElement("path",vP({},p,{className:ve("recharts-symbols",u),transform:"translate(".concat(d,", ").concat(f,")"),d:s()})):null};dE.registerSymbol=Fhe;var gW=e=>"radius"in e&&"startAngle"in e&&"endAngle"in e,fE=(e,t)=>{if(!e||typeof e=="function"||typeof e=="boolean")return null;var r=e;if(m.isValidElement(e)&&(r=e.props),typeof r!="object"&&typeof r!="function")return null;var n={};return Object.keys(r).forEach(i=>{nE(i)&&(n[i]=(o=>r[i](r,o)))}),n},Uhe=(e,t,r)=>n=>(e(t,r,n),null),tm=(e,t,r)=>{if(e===null||typeof e!="object"&&typeof e!="function")return null;var n=null;return Object.keys(e).forEach(i=>{var o=e[i];nE(i)&&typeof o=="function"&&(n||(n={}),n[i]=Uhe(o,t,r))}),n};function jM(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function Whe(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?jM(Object(r),!0).forEach(function(n){Khe(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):jM(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function Khe(e,t,r){return(t=Hhe(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Hhe(e){var t=Vhe(e,"string");return typeof t=="symbol"?t:t+""}function Vhe(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Er(e,t){var r=Whe({},e),n=t,i=Object.keys(t),o=i.reduce((a,s)=>(a[s]===void 0&&n[s]!==void 0&&(a[s]=n[s]),a),r);return o}function xy(){return xy=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},xy.apply(null,arguments)}function EM(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function qhe(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?EM(Object(r),!0).forEach(function(n){Ghe(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):EM(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function Ghe(e,t,r){return(t=Zhe(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Zhe(e){var t=Xhe(e,"string");return typeof t=="symbol"?t:t+""}function Xhe(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var co=32,Yhe={align:"center",iconSize:14,inactiveColor:"#ccc",layout:"horizontal",verticalAlign:"middle"};function Qhe(e){var{data:t,iconType:r,inactiveColor:n}=e,i=co/2,o=co/6,a=co/3,s=t.inactive?n:t.color,u=r??t.type;if(u==="none")return null;if(u==="plainline"){var d;return m.createElement("line",{strokeWidth:4,fill:"none",stroke:s,strokeDasharray:(d=t.payload)===null||d===void 0?void 0:d.strokeDasharray,x1:0,y1:i,x2:co,y2:i,className:"recharts-legend-icon"})}if(u==="line")return m.createElement("path",{strokeWidth:4,fill:"none",stroke:s,d:"M0,".concat(i,"h").concat(a,`
315
315
  A`).concat(o,",").concat(o,",0,1,1,").concat(2*a,",").concat(i,`
316
316
  H`).concat(co,"M").concat(2*a,",").concat(i,`
317
317
  A`).concat(o,",").concat(o,",0,1,1,").concat(a,",").concat(i),className:"recharts-legend-icon"});if(u==="rect")return m.createElement("path",{stroke:"none",fill:s,d:"M0,".concat(co/8,"h").concat(co,"v").concat(co*3/4,"h").concat(-co,"z"),className:"recharts-legend-icon"});if(m.isValidElement(t.legendIcon)){var f=qhe({},t);return delete f.legendIcon,m.cloneElement(t.legendIcon,f)}return m.createElement(dE,{fill:s,cx:i,cy:i,size:co,sizeType:"diameter",type:u})}function Jhe(e){var{payload:t,iconSize:r,layout:n,formatter:i,inactiveColor:o,iconType:a}=e,s={x:0,y:0,width:co,height:co},u={display:n==="horizontal"?"inline-block":"block",marginRight:10},d={display:"inline-block",verticalAlign:"middle",marginRight:4};return t.map((f,p)=>{var v=f.formatter||i,y=ve({"recharts-legend-item":!0,["legend-item-".concat(p)]:!0,inactive:f.inactive});if(f.type==="none")return null;var b=f.inactive?o:f.color,w=v?v(f.value,f,p):f.value;return m.createElement("li",xy({className:y,style:u,key:"legend-item-".concat(p)},tm(e,f,p)),m.createElement(iE,{width:r,height:r,viewBox:s,style:d,"aria-label":"".concat(w," legend icon")},m.createElement(Qhe,{data:f,iconType:a,inactiveColor:o})),m.createElement("span",{className:"recharts-legend-item-text",style:{color:b}},w))})}var eme=e=>{var t=Er(e,Yhe),{payload:r,layout:n,align:i}=t;if(!r||!r.length)return null;var o={padding:0,margin:0,textAlign:n==="horizontal"?i:"left"};return m.createElement("ul",{className:"recharts-default-legend",style:o},m.createElement(Jhe,xy({},t,{payload:r})))},wS={},SS={},IM;function tme(){return IM||(IM=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function t(r,n){const i=new Map;for(let o=0;o<r.length;o++){const a=r[o],s=n(a);i.has(s)||i.set(s,a)}return Array.from(i.values())}e.uniqBy=t})(SS)),SS}var kS={},OM;function vW(){return OM||(OM=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function t(r){return r}e.identity=t})(kS)),kS}var PS={},$S={},CS={},_M;function rme(){return _M||(_M=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function t(r){return Number.isSafeInteger(r)&&r>=0}e.isLength=t})(CS)),CS}var AM;function pE(){return AM||(AM=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=rme();function r(n){return n!=null&&typeof n!="function"&&t.isLength(n.length)}e.isArrayLike=r})($S)),$S}var jS={},TM;function nme(){return TM||(TM=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function t(r){return typeof r=="object"&&r!==null}e.isObjectLike=t})(jS)),jS}var MM;function ime(){return MM||(MM=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=pE(),r=nme();function n(i){return r.isObjectLike(i)&&t.isArrayLike(i)}e.isArrayLikeObject=n})(PS)),PS}var ES={},IS={},RM;function ome(){return RM||(RM=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=cE();function r(n){return function(i){return t.get(i,n)}}e.property=r})(IS)),IS}var OS={},_S={},AS={},TS={},DM;function yW(){return DM||(DM=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function t(r){return r!==null&&(typeof r=="object"||typeof r=="function")}e.isObject=t})(TS)),TS}var MS={},zM;function bW(){return zM||(zM=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function t(r){return r==null||typeof r!="object"&&typeof r!="function"}e.isPrimitive=t})(MS)),MS}var RS={},NM;function xW(){return NM||(NM=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function t(r,n){return r===n||Number.isNaN(r)&&Number.isNaN(n)}e.eq=t})(RS)),RS}var LM;function ame(){return LM||(LM=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=yW(),r=bW(),n=xW();function i(f,p,v){return typeof v!="function"?i(f,p,()=>{}):o(f,p,function y(b,w,x,k,$,P){const j=v(b,w,x,k,$,P);return j!==void 0?!!j:o(b,w,y,P)},new Map)}function o(f,p,v,y){if(p===f)return!0;switch(typeof p){case"object":return a(f,p,v,y);case"function":return Object.keys(p).length>0?o(f,{...p},v,y):n.eq(f,p);default:return t.isObject(f)?typeof p=="string"?p==="":!0:n.eq(f,p)}}function a(f,p,v,y){if(p==null)return!0;if(Array.isArray(p))return u(f,p,v,y);if(p instanceof Map)return s(f,p,v,y);if(p instanceof Set)return d(f,p,v,y);const b=Object.keys(p);if(f==null)return b.length===0;if(b.length===0)return!0;if(y!=null&&y.has(p))return y.get(p)===f;y==null||y.set(p,f);try{for(let w=0;w<b.length;w++){const x=b[w];if(!r.isPrimitive(f)&&!(x in f)||p[x]===void 0&&f[x]!==void 0||p[x]===null&&f[x]!==null||!v(f[x],p[x],x,f,p,y))return!1}return!0}finally{y==null||y.delete(p)}}function s(f,p,v,y){if(p.size===0)return!0;if(!(f instanceof Map))return!1;for(const[b,w]of p.entries()){const x=f.get(b);if(v(x,w,b,f,p,y)===!1)return!1}return!0}function u(f,p,v,y){if(p.length===0)return!0;if(!Array.isArray(f))return!1;const b=new Set;for(let w=0;w<p.length;w++){const x=p[w];let k=!1;for(let $=0;$<f.length;$++){if(b.has($))continue;const P=f[$];let j=!1;if(v(P,x,w,f,p,y)&&(j=!0),j){b.add($),k=!0;break}}if(!k)return!1}return!0}function d(f,p,v,y){return p.size===0?!0:f instanceof Set?u([...f],[...p],v,y):!1}e.isMatchWith=i,e.isSetMatch=d})(AS)),AS}var BM;function wW(){return BM||(BM=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=ame();function r(n,i){return t.isMatchWith(n,i,()=>{})}e.isMatch=r})(_S)),_S}var DS={},zS={},NS={},FM;function sme(){return FM||(FM=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function t(r){return Object.getOwnPropertySymbols(r).filter(n=>Object.prototype.propertyIsEnumerable.call(r,n))}e.getSymbols=t})(NS)),NS}var LS={},UM;function SW(){return UM||(UM=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function t(r){return r==null?r===void 0?"[object Undefined]":"[object Null]":Object.prototype.toString.call(r)}e.getTag=t})(LS)),LS}var BS={},WM;function kW(){return WM||(WM=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t="[object RegExp]",r="[object String]",n="[object Number]",i="[object Boolean]",o="[object Arguments]",a="[object Symbol]",s="[object Date]",u="[object Map]",d="[object Set]",f="[object Array]",p="[object Function]",v="[object ArrayBuffer]",y="[object Object]",b="[object Error]",w="[object DataView]",x="[object Uint8Array]",k="[object Uint8ClampedArray]",$="[object Uint16Array]",P="[object Uint32Array]",j="[object BigUint64Array]",C="[object Int8Array]",I="[object Int16Array]",A="[object Int32Array]",T="[object BigInt64Array]",M="[object Float32Array]",R="[object Float64Array]";e.argumentsTag=o,e.arrayBufferTag=v,e.arrayTag=f,e.bigInt64ArrayTag=T,e.bigUint64ArrayTag=j,e.booleanTag=i,e.dataViewTag=w,e.dateTag=s,e.errorTag=b,e.float32ArrayTag=M,e.float64ArrayTag=R,e.functionTag=p,e.int16ArrayTag=I,e.int32ArrayTag=A,e.int8ArrayTag=C,e.mapTag=u,e.numberTag=n,e.objectTag=y,e.regexpTag=t,e.setTag=d,e.stringTag=r,e.symbolTag=a,e.uint16ArrayTag=$,e.uint32ArrayTag=P,e.uint8ArrayTag=x,e.uint8ClampedArrayTag=k})(BS)),BS}var FS={},KM;function lme(){return KM||(KM=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function t(r){return ArrayBuffer.isView(r)&&!(r instanceof DataView)}e.isTypedArray=t})(FS)),FS}var HM;function PW(){return HM||(HM=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=sme(),r=SW(),n=kW(),i=bW(),o=lme();function a(f,p){return s(f,void 0,f,new Map,p)}function s(f,p,v,y=new Map,b=void 0){const w=b==null?void 0:b(f,p,v,y);if(w!==void 0)return w;if(i.isPrimitive(f))return f;if(y.has(f))return y.get(f);if(Array.isArray(f)){const x=new Array(f.length);y.set(f,x);for(let k=0;k<f.length;k++)x[k]=s(f[k],k,v,y,b);return Object.hasOwn(f,"index")&&(x.index=f.index),Object.hasOwn(f,"input")&&(x.input=f.input),x}if(f instanceof Date)return new Date(f.getTime());if(f instanceof RegExp){const x=new RegExp(f.source,f.flags);return x.lastIndex=f.lastIndex,x}if(f instanceof Map){const x=new Map;y.set(f,x);for(const[k,$]of f)x.set(k,s($,k,v,y,b));return x}if(f instanceof Set){const x=new Set;y.set(f,x);for(const k of f)x.add(s(k,void 0,v,y,b));return x}if(typeof Buffer<"u"&&Buffer.isBuffer(f))return f.subarray();if(o.isTypedArray(f)){const x=new(Object.getPrototypeOf(f)).constructor(f.length);y.set(f,x);for(let k=0;k<f.length;k++)x[k]=s(f[k],k,v,y,b);return x}if(f instanceof ArrayBuffer||typeof SharedArrayBuffer<"u"&&f instanceof SharedArrayBuffer)return f.slice(0);if(f instanceof DataView){const x=new DataView(f.buffer.slice(0),f.byteOffset,f.byteLength);return y.set(f,x),u(x,f,v,y,b),x}if(typeof File<"u"&&f instanceof File){const x=new File([f],f.name,{type:f.type});return y.set(f,x),u(x,f,v,y,b),x}if(typeof Blob<"u"&&f instanceof Blob){const x=new Blob([f],{type:f.type});return y.set(f,x),u(x,f,v,y,b),x}if(f instanceof Error){const x=new f.constructor;return y.set(f,x),x.message=f.message,x.name=f.name,x.stack=f.stack,x.cause=f.cause,u(x,f,v,y,b),x}if(f instanceof Boolean){const x=new Boolean(f.valueOf());return y.set(f,x),u(x,f,v,y,b),x}if(f instanceof Number){const x=new Number(f.valueOf());return y.set(f,x),u(x,f,v,y,b),x}if(f instanceof String){const x=new String(f.valueOf());return y.set(f,x),u(x,f,v,y,b),x}if(typeof f=="object"&&d(f)){const x=Object.create(Object.getPrototypeOf(f));return y.set(f,x),u(x,f,v,y,b),x}return f}function u(f,p,v=f,y,b){const w=[...Object.keys(p),...t.getSymbols(p)];for(let x=0;x<w.length;x++){const k=w[x],$=Object.getOwnPropertyDescriptor(f,k);($==null||$.writable)&&(f[k]=s(p[k],k,v,y,b))}}function d(f){switch(r.getTag(f)){case n.argumentsTag:case n.arrayTag:case n.arrayBufferTag:case n.dataViewTag:case n.booleanTag:case n.dateTag:case n.float32ArrayTag:case n.float64ArrayTag:case n.int8ArrayTag:case n.int16ArrayTag:case n.int32ArrayTag:case n.mapTag:case n.numberTag:case n.objectTag:case n.regexpTag:case n.setTag:case n.stringTag:case n.symbolTag:case n.uint8ArrayTag:case n.uint8ClampedArrayTag:case n.uint16ArrayTag:case n.uint32ArrayTag:return!0;default:return!1}}e.cloneDeepWith=a,e.cloneDeepWithImpl=s,e.copyProperties=u})(zS)),zS}var VM;function ume(){return VM||(VM=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=PW();function r(n){return t.cloneDeepWithImpl(n,void 0,n,new Map,void 0)}e.cloneDeep=r})(DS)),DS}var qM;function cme(){return qM||(qM=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=wW(),r=ume();function n(i){return i=r.cloneDeep(i),o=>t.isMatch(o,i)}e.matches=n})(OS)),OS}var US={},WS={},KS={},GM;function dme(){return GM||(GM=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=PW(),r=kW();function n(i,o){return t.cloneDeepWith(i,(a,s,u,d)=>{const f=o==null?void 0:o(a,s,u,d);if(f!==void 0)return f;if(typeof i=="object")switch(Object.prototype.toString.call(i)){case r.numberTag:case r.stringTag:case r.booleanTag:{const p=new i.constructor(i==null?void 0:i.valueOf());return t.copyProperties(p,i),p}case r.argumentsTag:{const p={};return t.copyProperties(p,i),p.length=i.length,p[Symbol.iterator]=i[Symbol.iterator],p}default:return}})}e.cloneDeepWith=n})(KS)),KS}var ZM;function fme(){return ZM||(ZM=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=dme();function r(n){return t.cloneDeepWith(n)}e.cloneDeep=r})(WS)),WS}var HS={},VS={},XM;function $W(){return XM||(XM=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=/^(?:0|[1-9]\d*)$/;function r(n,i=Number.MAX_SAFE_INTEGER){switch(typeof n){case"number":return Number.isInteger(n)&&n>=0&&n<i;case"symbol":return!1;case"string":return t.test(n)}}e.isIndex=r})(VS)),VS}var qS={},YM;function pme(){return YM||(YM=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=SW();function r(n){return n!==null&&typeof n=="object"&&t.getTag(n)==="[object Arguments]"}e.isArguments=r})(qS)),qS}var QM;function hme(){return QM||(QM=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=dW(),r=$W(),n=pme(),i=uE();function o(a,s){let u;if(Array.isArray(s)?u=s:typeof s=="string"&&t.isDeepKey(s)&&(a==null?void 0:a[s])==null?u=i.toPath(s):u=[s],u.length===0)return!1;let d=a;for(let f=0;f<u.length;f++){const p=u[f];if((d==null||!Object.hasOwn(d,p))&&!((Array.isArray(d)||n.isArguments(d))&&r.isIndex(p)&&p<d.length))return!1;d=d[p]}return!0}e.has=o})(HS)),HS}var JM;function mme(){return JM||(JM=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=wW(),r=lE(),n=fme(),i=cE(),o=hme();function a(s,u){switch(typeof s){case"object":{Object.is(s==null?void 0:s.valueOf(),-0)&&(s="-0");break}case"number":{s=r.toKey(s);break}}return u=n.cloneDeep(u),function(d){const f=i.get(d,s);return f===void 0?o.has(d,s):u===void 0?f===void 0:t.isMatch(f,u)}}e.matchesProperty=a})(US)),US}var eR;function gme(){return eR||(eR=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=vW(),r=ome(),n=cme(),i=mme();function o(a){if(a==null)return t.identity;switch(typeof a){case"function":return a;case"object":return Array.isArray(a)&&a.length===2?i.matchesProperty(a[0],a[1]):n.matches(a);case"string":case"symbol":case"number":return r.property(a)}}e.iteratee=o})(ES)),ES}var tR;function vme(){return tR||(tR=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=tme(),r=vW(),n=ime(),i=gme();function o(a,s=r.identity){return n.isArrayLikeObject(a)?t.uniqBy(Array.from(a),i.iteratee(s)):[]}e.uniqBy=o})(wS)),wS}var GS,rR;function yme(){return rR||(rR=1,GS=vme().uniqBy),GS}var bme=yme();const nR=Oa(bme);function CW(e,t,r){return t===!0?nR(e,r):typeof t=="function"?nR(e,t):e}var ZS={exports:{}},XS={},YS={exports:{}},QS={};/**
@@ -370,5 +370,5 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
370
370
  *
371
371
  * This source code is licensed under the MIT license found in the
372
372
  * LICENSE file in the root directory of this source tree.
373
- */var uN;function HCe(){if(uN)return W1;uN=1;var e=qd();function t(u,d){return u===d&&(u!==0||1/u===1/d)||u!==u&&d!==d}var r=typeof Object.is=="function"?Object.is:t,n=e.useSyncExternalStore,i=e.useRef,o=e.useEffect,a=e.useMemo,s=e.useDebugValue;return W1.useSyncExternalStoreWithSelector=function(u,d,f,p,v){var y=i(null);if(y.current===null){var b={hasValue:!1,value:null};y.current=b}else b=y.current;y=a(function(){function x(C){if(!k){if(k=!0,$=C,C=p(C),v!==void 0&&b.hasValue){var I=b.value;if(v(I,C))return P=I}return P=C}if(I=P,r($,C))return I;var A=p(C);return v!==void 0&&v(I,A)?($=C,I):($=C,P=A)}var k=!1,$,P,j=f===void 0?null:f;return[function(){return x(d())},j===null?void 0:function(){return x(j())}]},[d,f,p,v]);var w=n(u,y[0],y[1]);return o(function(){b.hasValue=!0,b.value=w},[w]),s(w),w},W1}var cN;function VCe(){return cN||(cN=1,U1.exports=HCe()),U1.exports}VCe();function qCe(e){e()}function GCe(){let e=null,t=null;return{clear(){e=null,t=null},notify(){qCe(()=>{let r=e;for(;r;)r.callback(),r=r.next})},get(){const r=[];let n=e;for(;n;)r.push(n),n=n.next;return r},subscribe(r){let n=!0;const i=t={callback:r,next:null,prev:t};return i.prev?i.prev.next=i:e=i,function(){!n||e===null||(n=!1,i.next?i.next.prev=i.prev:t=i.prev,i.prev?i.prev.next=i.next:e=i.next)}}}}var dN={notify(){},get:()=>[]};function ZCe(e,t){let r,n=dN,i=0,o=!1;function a(w){f();const x=n.subscribe(w);let k=!1;return()=>{k||(k=!0,x(),p())}}function s(){n.notify()}function u(){b.onStateChange&&b.onStateChange()}function d(){return o}function f(){i++,r||(r=e.subscribe(u),n=GCe())}function p(){i--,r&&i===0&&(r(),r=void 0,n.clear(),n=dN)}function v(){o||(o=!0,f())}function y(){o&&(o=!1,p())}const b={addNestedSub:a,notifyNestedSubs:s,handleChangeWrapper:u,isSubscribed:d,trySubscribe:v,tryUnsubscribe:y,getListeners:()=>n};return b}var XCe=()=>typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",YCe=XCe(),QCe=()=>typeof navigator<"u"&&navigator.product==="ReactNative",JCe=QCe(),eje=()=>YCe||JCe?m.useLayoutEffect:m.useEffect,tje=eje();function fN(e,t){return e===t?e!==0||t!==0||1/e===1/t:e!==e&&t!==t}function rje(e,t){if(fN(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;const r=Object.keys(e),n=Object.keys(t);if(r.length!==n.length)return!1;for(let i=0;i<r.length;i++)if(!Object.prototype.hasOwnProperty.call(t,r[i])||!fN(e[r[i]],t[r[i]]))return!1;return!0}var K1=Symbol.for("react-redux-context"),H1=typeof globalThis<"u"?globalThis:{};function nje(){if(!m.createContext)return{};const e=H1[K1]??(H1[K1]=new Map);let t=e.get(m.createContext);return t||(t=m.createContext(null),e.set(m.createContext,t)),t}var ije=nje();function oje(e){const{children:t,context:r,serverState:n,store:i}=e,o=m.useMemo(()=>{const u=ZCe(i);return{store:i,subscription:u,getServerState:n?()=>n:void 0}},[i,n]),a=m.useMemo(()=>i.getState(),[i]);tje(()=>{const{subscription:u}=o;return u.onStateChange=u.notifyNestedSubs,u.trySubscribe(),a!==i.getState()&&u.notifyNestedSubs(),()=>{u.tryUnsubscribe(),u.onStateChange=void 0}},[o,a]);const s=r||ije;return m.createElement(s.Provider,{value:o},t)}var aje=oje,sje=new Set(["axisLine","tickLine","activeBar","activeDot","activeLabel","activeShape","allowEscapeViewBox","background","cursor","dot","label","line","margin","padding","position","shape","style","tick","wrapperStyle"]);function lje(e,t){return e==null&&t==null?!0:typeof e=="number"&&typeof t=="number"?e===t||e!==e&&t!==t:e===t}function Pm(e,t){var r=new Set([...Object.keys(e),...Object.keys(t)]);for(var n of r)if(sje.has(n)){if(e[n]==null&&t[n]==null)continue;if(!rje(e[n],t[n]))return!1}else if(!lje(e[n],t[n]))return!1;return!0}var uje=["onMouseEnter","onMouseLeave","onClick"],cje=["value","background","tooltipPosition"],dje=["id"],fje=["onMouseEnter","onClick","onMouseLeave"];function xs(){return xs=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},xs.apply(null,arguments)}function pN(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function si(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?pN(Object(r),!0).forEach(function(n){pje(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):pN(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function pje(e,t,r){return(t=hje(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function hje(e){var t=mje(e,"string");return typeof t=="symbol"?t:t+""}function mje(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function nb(e,t){if(e==null)return{};var r,n,i=gje(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n<o.length;n++)r=o[n],t.indexOf(r)===-1&&{}.propertyIsEnumerable.call(e,r)&&(i[r]=e[r])}return i}function gje(e,t){if(e==null)return{};var r={};for(var n in e)if({}.hasOwnProperty.call(e,n)){if(t.indexOf(n)!==-1)continue;r[n]=e[n]}return r}var vje=e=>{var{dataKey:t,name:r,fill:n,legendType:i,hide:o}=e;return[{inactive:o,dataKey:t,type:i,color:n,value:Nl(r,t),payload:e}]},yje=m.memo(e=>{var{dataKey:t,stroke:r,strokeWidth:n,fill:i,name:o,hide:a,unit:s,tooltipType:u}=e,d={dataDefinedOnItem:void 0,positions:void 0,settings:{stroke:r,strokeWidth:n,fill:i,dataKey:t,nameKey:void 0,name:Nl(o,t),hide:a,type:u,color:i,unit:s}};return m.createElement(Yx,{tooltipEntrySettings:d})});function bje(e){var t=Le(jl),{data:r,dataKey:n,background:i,allOtherBarProps:o}=e,{onMouseEnter:a,onMouseLeave:s,onClick:u}=o,d=nb(o,uje),f=VI(a,n),p=qI(s),v=GI(u,n);if(!i||r==null)return null;var y=Vu(i);return m.createElement(Qn,{zIndex:KCe(i,Wr.barBackground)},r.map((b,w)=>{var{value:x,background:k,tooltipPosition:$}=b,P=nb(b,cje);if(!k)return null;var j=f(b,w),C=p(b,w),I=v(b,w),A=si(si(si(si(si({option:i,isActive:String(w)===t},P),{},{fill:"#eee"},k),y),tm(d,b,w)),{},{onMouseEnter:j,onMouseLeave:C,onClick:I,dataKey:n,index:w,className:"recharts-bar-background-rectangle"});return m.createElement(rb,xs({key:"background-bar-".concat(w)},A))}))}function xje(e){var{showLabels:t,children:r,rects:n}=e,i=n==null?void 0:n.map(o=>{var a={x:o.x,y:o.y,width:o.width,lowerWidth:o.width,upperWidth:o.width,height:o.height};return si(si({},a),{},{value:o.value,payload:o.payload,parentViewBox:o.parentViewBox,viewBox:a,fill:o.fill})});return m.createElement(BI,{value:t?i:void 0},r)}function wje(e){var{shape:t,activeBar:r,baseProps:n,entry:i,index:o,dataKey:a}=e,s=Le(jl),u=Le(MI),d=r&&String(o)===s&&(u==null||a===u),f=d?r:t;return d?m.createElement(Qn,{zIndex:Wr.activeBar},m.createElement(rb,xs({},n,{name:String(n.name)},i,{isActive:d,option:f,index:o,dataKey:a}))):m.createElement(rb,xs({},n,{name:String(n.name)},i,{isActive:d,option:f,index:o,dataKey:a}))}function Sje(e){var{shape:t,baseProps:r,entry:n,index:i,dataKey:o}=e;return m.createElement(rb,xs({},r,{name:String(r.name)},n,{isActive:!1,option:t,index:i,dataKey:o}))}function kje(e){var t,{data:r,props:n}=e,i=(t=Zn(n))!==null&&t!==void 0?t:{},{id:o}=i,a=nb(i,dje),{shape:s,dataKey:u,activeBar:d}=n,{onMouseEnter:f,onClick:p,onMouseLeave:v}=n,y=nb(n,fje),b=VI(f,u),w=qI(v),x=GI(p,u);return r?m.createElement(m.Fragment,null,r.map((k,$)=>m.createElement(fr,xs({key:"rectangle-".concat(k==null?void 0:k.x,"-").concat(k==null?void 0:k.y,"-").concat(k==null?void 0:k.value,"-").concat($),className:"recharts-bar-rectangle"},tm(y,k,$),{onMouseEnter:b(k,$),onMouseLeave:w(k,$),onClick:x(k,$)}),d?m.createElement(wje,{shape:s,activeBar:d,baseProps:a,entry:k,index:$,dataKey:u}):m.createElement(Sje,{shape:s,baseProps:a,entry:k,index:$,dataKey:u})))):null}function Pje(e){var{props:t,previousRectanglesRef:r}=e,{data:n,layout:i,isAnimationActive:o,animationBegin:a,animationDuration:s,animationEasing:u,onAnimationEnd:d,onAnimationStart:f}=t,p=r.current,v=cf(t,"recharts-bar-"),[y,b]=m.useState(!1),w=!y,x=m.useCallback(()=>{typeof d=="function"&&d(),b(!1)},[d]),k=m.useCallback(()=>{typeof f=="function"&&f(),b(!0)},[f]);return m.createElement(xje,{showLabels:w,rects:n},m.createElement(uf,{animationId:v,begin:a,duration:s,isActive:o,easing:u,onAnimationEnd:x,onAnimationStart:k,key:v},$=>{var P=$===1?n:n==null?void 0:n.map((j,C)=>{var I=p&&p[C];if(I)return si(si({},j),{},{x:Zt(I.x,j.x,$),y:Zt(I.y,j.y,$),width:Zt(I.width,j.width,$),height:Zt(I.height,j.height,$)});if(i==="horizontal"){var A=Zt(0,j.height,$),T=Zt(j.stackedBarStart,j.y,$);return si(si({},j),{},{y:T,height:A})}var M=Zt(0,j.width,$),R=Zt(j.stackedBarStart,j.x,$);return si(si({},j),{},{width:M,x:R})});return $>0&&(r.current=P??null),P==null?null:m.createElement(fr,null,m.createElement(kje,{props:t,data:P}))}),m.createElement(Gx,{label:t.label}),t.children)}function $je(e){var t=m.useRef(null);return m.createElement(Pje,{previousRectanglesRef:t,props:e})}var gH=0,Cje=(e,t)=>{var r=Array.isArray(e.value)?e.value[1]:e.value;return{x:e.x,y:e.y,value:r,errorVal:Xt(e,t)}};class jje extends m.PureComponent{render(){var{hide:t,data:r,dataKey:n,className:i,xAxisId:o,yAxisId:a,needClip:s,background:u,id:d}=this.props;if(t||r==null)return null;var f=ve("recharts-bar",i),p=d;return m.createElement(fr,{className:f,id:d},s&&m.createElement("defs",null,m.createElement(YI,{clipPathId:p,xAxisId:o,yAxisId:a})),m.createElement(fr,{className:"recharts-bar-rectangles",clipPath:s?"url(#clipPath-".concat(p,")"):void 0},m.createElement(bje,{data:r,dataKey:n,background:u,allOtherBarProps:this.props}),m.createElement($je,this.props)))}}var Eje={activeBar:!1,animationBegin:0,animationDuration:400,animationEasing:"ease",background:!1,hide:!1,isAnimationActive:"auto",label:!1,legendType:"rect",minPointSize:gH,xAxisId:0,yAxisId:0,zIndex:Wr.bar};function Ije(e){var{xAxisId:t,yAxisId:r,hide:n,legendType:i,minPointSize:o,activeBar:a,animationBegin:s,animationDuration:u,animationEasing:d,isAnimationActive:f}=e,{needClip:p}=t0(t,r),v=uc(),y=hn(),b=WI(e.children,qx),w=Le($=>nEe($,t,r,y,e.id,b));if(v!=="vertical"&&v!=="horizontal")return null;var x,k=w==null?void 0:w[0];return k==null||k.height==null||k.width==null?x=0:x=v==="vertical"?k.height/2:k.width/2,m.createElement(mH,{xAxisId:t,yAxisId:r,data:w,dataPointFormatter:Cje,errorBarOffset:x},m.createElement(jje,xs({},e,{layout:v,needClip:p,data:w,xAxisId:t,yAxisId:r,hide:n,legendType:i,minPointSize:o,activeBar:a,animationBegin:s,animationDuration:u,animationEasing:d,isAnimationActive:f})))}function Oje(e){var{layout:t,barSettings:{dataKey:r,minPointSize:n},pos:i,bandSize:o,xAxis:a,yAxis:s,xAxisTicks:u,yAxisTicks:d,stackedData:f,displayedData:p,offset:v,cells:y,parentViewBox:b,dataStartIndex:w}=e,x=t==="horizontal"?s:a,k=f?x.scale.domain():null,$=ove({numericAxis:x}),P=x.scale($);return p.map((j,C)=>{var I,A,T,M,R,D;f?I=eve(f[C+w],k):(I=Xt(j,r),Array.isArray(I)||(I=[$,I]));var O=DCe(n,gH)(I[1],C);if(t==="horizontal"){var L,[z,F]=[s.scale(I[0]),s.scale(I[1])];A=TR({axis:a,ticks:u,bandSize:o,offset:i.offset,entry:j,index:C}),T=(L=F??z)!==null&&L!==void 0?L:void 0,M=i.size;var B=z-F;if(R=wo(B)?0:B,D={x:A,y:v.top,width:M,height:v.height},Math.abs(O)>0&&Math.abs(R)<Math.abs(O)){var U=$n(R||O)*(Math.abs(O)-Math.abs(R));T-=U,R+=U}}else{var[V,K]=[a.scale(I[0]),a.scale(I[1])];if(A=V,T=TR({axis:s,ticks:d,bandSize:o,offset:i.offset,entry:j,index:C}),M=K-V,R=i.size,D={x:v.left,y:T,width:v.width,height:R},Math.abs(O)>0&&Math.abs(M)<Math.abs(O)){var Z=$n(M||O)*(Math.abs(O)-Math.abs(M));M+=Z}}if(A==null||T==null||M==null||R==null)return null;var W=si(si({},j),{},{stackedBarStart:P,x:A,y:T,width:M,height:R,value:f?I:I[1],payload:j,background:D,tooltipPosition:{x:A+M/2,y:T+R/2},parentViewBox:b},y&&y[C]&&y[C].props);return W}).filter(Boolean)}function _je(e){var t=Er(e,Eje),r=hn();return m.createElement(Qx,{id:t.id,type:"bar"},n=>m.createElement(m.Fragment,null,m.createElement(ZI,{legendPayload:vje(t)}),m.createElement(yje,{dataKey:t.dataKey,stroke:t.stroke,strokeWidth:t.strokeWidth,fill:t.fill,name:t.name,hide:t.hide,unit:t.unit,tooltipType:t.tooltipType}),m.createElement(XI,{type:"bar",id:n,data:void 0,xAxisId:t.xAxisId,yAxisId:t.yAxisId,zAxisId:0,dataKey:t.dataKey,stackId:c8(t.stackId),hide:t.hide,barSize:t.barSize,minPointSize:t.minPointSize,maxBarSize:t.maxBarSize,isPanorama:r}),m.createElement(Qn,{zIndex:t.zIndex},m.createElement(Ije,xs({},t,{id:n})))))}var r0=m.memo(_je,Pm);r0.displayName="Bar";function hN(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function mv(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?hN(Object(r),!0).forEach(function(n){Aje(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):hN(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function Aje(e,t,r){return(t=Tje(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Tje(e){var t=Mje(e,"string");return typeof t=="symbol"?t:t+""}function Mje(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var Rje=(e,t)=>t,Dje=(e,t,r)=>r,zje=(e,t,r,n)=>n,Nje=(e,t,r,n,i)=>i,$m=ce([gm,Nje],(e,t)=>e.filter(r=>r.type==="bar").find(r=>r.id===t)),Lje=ce([$m],e=>e==null?void 0:e.maxBarSize),Bje=(e,t,r,n,i,o)=>o,mN=(e,t,r)=>{var n=r??e;if(!xr(n))return Gn(n,t,0)},Fje=ce([At,gm,Rje,Dje,zje],(e,t,r,n,i)=>t.filter(o=>e==="horizontal"?o.xAxisId===r:o.yAxisId===n).filter(o=>o.isPanorama===i).filter(o=>o.hide===!1).filter(o=>o.type==="bar")),Uje=(e,t,r,n)=>{var i=At(e);return i==="horizontal"?bh(e,"yAxis",r,n):bh(e,"xAxis",t,n)},Wje=(e,t,r)=>{var n=At(e);return n==="horizontal"?fz(e,"xAxis",t):fz(e,"yAxis",r)},Kje=(e,t,r)=>{var n={},i=e.filter(Lx),o=e.filter(d=>d.stackId==null),a=i.reduce((d,f)=>(d[f.stackId]||(d[f.stackId]=[]),d[f.stackId].push(f),d),n),s=Object.entries(a).map(d=>{var[f,p]=d,v=p.map(b=>b.dataKey),y=mN(t,r,p[0].barSize);return{stackId:f,dataKeys:v,barSize:y}}),u=o.map(d=>{var f=[d.dataKey].filter(v=>v!=null),p=mN(t,r,d.barSize);return{stackId:void 0,dataKeys:f,barSize:p}});return[...s,...u]},Hje=ce([Fje,wwe,Wje],Kje),Vje=(e,t,r,n,i)=>{var o,a,s=$m(e,t,r,n,i);if(s!=null){var u=At(e),d=M9(e),{maxBarSize:f}=s,p=xr(f)?d:f,v,y;return u==="horizontal"?(v=Ia(e,"xAxis",t,n),y=Ea(e,"xAxis",t,n)):(v=Ia(e,"yAxis",r,n),y=Ea(e,"yAxis",r,n)),(o=(a=Pl(v,y,!0))!==null&&a!==void 0?a:p)!==null&&o!==void 0?o:0}},vH=(e,t,r,n)=>{var i=At(e),o,a;return i==="horizontal"?(o=Ia(e,"xAxis",t,n),a=Ea(e,"xAxis",t,n)):(o=Ia(e,"yAxis",r,n),a=Ea(e,"yAxis",r,n)),Pl(o,a)};function qje(e,t,r,n,i){var o=n.length;if(!(o<1)){var a=Gn(e,r,0,!0),s,u=[];if(wr(n[0].barSize)){var d=!1,f=r/o,p=n.reduce((k,$)=>k+($.barSize||0),0);p+=(o-1)*a,p>=r&&(p-=(o-1)*a,a=0),p>=r&&f>0&&(d=!0,f*=.9,p=o*f);var v=(r-p)/2>>0,y={offset:v-a,size:0};s=n.reduce((k,$)=>{var P,j={stackId:$.stackId,dataKeys:$.dataKeys,position:{offset:y.offset+y.size+a,size:d?f:(P=$.barSize)!==null&&P!==void 0?P:0}},C=[...k,j];return y=C[C.length-1].position,C},u)}else{var b=Gn(t,r,0,!0);r-2*b-(o-1)*a<=0&&(a=0);var w=(r-2*b-(o-1)*a)/o;w>1&&(w>>=0);var x=wr(i)?Math.min(w,i):w;s=n.reduce((k,$,P)=>[...k,{stackId:$.stackId,dataKeys:$.dataKeys,position:{offset:b+(w+a)*P+(w-x)/2,size:x}}],u)}return s}}var Gje=(e,t,r,n,i,o,a)=>{var s=xr(a)?t:a,u=qje(r,n,i!==o?i:o,e,s);return i!==o&&u!=null&&(u=u.map(d=>mv(mv({},d),{},{position:mv(mv({},d.position),{},{offset:d.position.offset-i/2})}))),u},Zje=ce([Hje,M9,xwe,R9,Vje,vH,Lje],Gje),Xje=(e,t,r,n)=>Ia(e,"xAxis",t,n),Yje=(e,t,r,n)=>Ia(e,"yAxis",r,n),Qje=(e,t,r,n)=>Ea(e,"xAxis",t,n),Jje=(e,t,r,n)=>Ea(e,"yAxis",r,n),eEe=ce([Zje,$m],(e,t)=>{if(!(e==null||t==null)){var r=e.find(n=>n.stackId===t.stackId&&t.dataKey!=null&&n.dataKeys.includes(t.dataKey));if(r!=null)return r.position}}),tEe=(e,t)=>{var r=Nx(t);if(!(!e||r==null||t==null)){var{stackId:n}=t;if(n!=null){var i=e[n];if(i){var{stackedData:o}=i;if(o)return o.find(a=>a.key===r)}}}},rEe=ce([Uje,$m],tEe),nEe=ce([pn,kE,Xje,Yje,Qje,Jje,eEe,At,fm,vH,rEe,$m,Bje],(e,t,r,n,i,o,a,s,u,d,f,p,v)=>{var{chartData:y,dataStartIndex:b,dataEndIndex:w}=u;if(!(p==null||a==null||t==null||s!=="horizontal"&&s!=="vertical"||r==null||n==null||i==null||o==null||d==null)){var{data:x}=p,k;if(x!=null&&x.length>0?k=x:k=y==null?void 0:y.slice(b,w+1),k!=null)return Oje({layout:s,barSettings:p,pos:a,parentViewBox:t,bandSize:d,xAxis:r,yAxis:n,xAxisTicks:i,yAxisTicks:o,stackedData:f,displayedData:k,offset:e,cells:v,dataStartIndex:b})}});function gN(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function vN(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?gN(Object(r),!0).forEach(function(n){iEe(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):gN(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function iEe(e,t,r){return(t=oEe(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function oEe(e){var t=aEe(e,"string");return typeof t=="symbol"?t:t+""}function aEe(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var sEe=["Webkit","Moz","O","ms"],lEe=(e,t)=>{var r=e.replace(/(\w)/,i=>i.toUpperCase()),n=sEe.reduce((i,o)=>vN(vN({},i),{},{[o+r]:t}),{});return n[e]=t,n},yH=e=>{var{chartData:t}=e,r=ir(),n=hn();return m.useEffect(()=>n?()=>{}:(r(Pz(t)),()=>{r(Pz(void 0))}),[t,r,n]),null},uEe=e=>e.chartData.chartData,cEe=()=>Le(uEe),dEe=e=>{var{dataStartIndex:t,dataEndIndex:r}=e.chartData;return{startIndex:t,endIndex:r}},fEe=()=>Le(dEe),pEe=m.createContext(()=>{}),yN={x:0,y:0,width:0,height:0,padding:{top:0,right:0,bottom:0,left:0}},bH=Oi({name:"brush",initialState:yN,reducers:{setBrushSettings(e,t){return t.payload==null?yN:t.payload}}}),{setBrushSettings:bN}=bH.actions,hEe=bH.reducer;function xh(){return xh=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},xh.apply(null,arguments)}function xN(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function uu(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?xN(Object(r),!0).forEach(function(n){Ga(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):xN(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function Ga(e,t,r){return(t=mEe(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function mEe(e){var t=gEe(e,"string");return typeof t=="symbol"?t:t+""}function gEe(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function vEe(e){var{x:t,y:r,width:n,height:i,stroke:o}=e,a=Math.floor(r+i/2)-1;return m.createElement(m.Fragment,null,m.createElement("rect",{x:t,y:r,width:n,height:i,fill:o,stroke:"none"}),m.createElement("line",{x1:t+1,y1:a,x2:t+n-1,y2:a,fill:"none",stroke:"#fff"}),m.createElement("line",{x1:t+1,y1:a+2,x2:t+n-1,y2:a+2,fill:"none",stroke:"#fff"}))}function yEe(e){var{travellerProps:t,travellerType:r}=e;return m.isValidElement(r)?m.cloneElement(r,t):typeof r=="function"?r(t):m.createElement(vEe,t)}function wN(e){var t,r,{otherProps:n,travellerX:i,id:o,onMouseEnter:a,onMouseLeave:s,onMouseDown:u,onTouchStart:d,onTravellerMoveKeyboard:f,onFocus:p,onBlur:v}=e,{y,x:b,travellerWidth:w,height:x,traveller:k,ariaLabel:$,data:P,startIndex:j,endIndex:C}=n,I=Math.max(i,b),A=uu(uu({},Zn(n)),{},{x:I,y,width:w,height:x}),T=$||"Min value: ".concat((t=P[j])===null||t===void 0?void 0:t.name,", Max value: ").concat((r=P[C])===null||r===void 0?void 0:r.name);return m.createElement(fr,{tabIndex:0,role:"slider","aria-label":T,"aria-valuenow":i,className:"recharts-brush-traveller",onMouseEnter:a,onMouseLeave:s,onMouseDown:u,onTouchStart:d,onKeyDown:M=>{["ArrowLeft","ArrowRight"].includes(M.key)&&(M.preventDefault(),M.stopPropagation(),f(M.key==="ArrowRight"?1:-1,o))},onFocus:p,onBlur:v,style:{cursor:"col-resize"}},m.createElement(yEe,{travellerType:k,travellerProps:A}))}function SN(e){var{index:t,data:r,tickFormatter:n,dataKey:i}=e,o=Xt(r[t],i,t);return typeof n=="function"?n(o,t):o}function kN(e,t){for(var r=e.length,n=0,i=r-1;i-n>1;){var o=Math.floor((n+i)/2);e[o]>t?i=o:n=o}return t>=e[i]?i:n}function V1(e){var{startX:t,endX:r,scaleValues:n,gap:i,data:o}=e,a=o.length-1,s=Math.min(t,r),u=Math.max(t,r),d=kN(n,s),f=kN(n,u);return{startIndex:d-d%i,endIndex:f===a?a:f-f%i}}function bEe(e){var{x:t,y:r,width:n,height:i,fill:o,stroke:a}=e;return m.createElement("rect",{stroke:a,fill:o,x:t,y:r,width:n,height:i})}function xEe(e){var{startIndex:t,endIndex:r,y:n,height:i,travellerWidth:o,stroke:a,tickFormatter:s,dataKey:u,data:d,startX:f,endX:p}=e,v=5,y={pointerEvents:"none",fill:a};return m.createElement(fr,{className:"recharts-brush-texts"},m.createElement(Vd,xh({textAnchor:"end",verticalAnchor:"middle",x:Math.min(f,p)-v,y:n+i/2},y),SN({index:t,tickFormatter:s,dataKey:u,data:d})),m.createElement(Vd,xh({textAnchor:"start",verticalAnchor:"middle",x:Math.max(f,p)+o+v,y:n+i/2},y),SN({index:r,tickFormatter:s,dataKey:u,data:d})))}function wEe(e){var{y:t,height:r,stroke:n,travellerWidth:i,startX:o,endX:a,onMouseEnter:s,onMouseLeave:u,onMouseDown:d,onTouchStart:f}=e,p=Math.min(o,a)+i,v=Math.max(Math.abs(a-o)-i,0);return m.createElement("rect",{className:"recharts-brush-slide",onMouseEnter:s,onMouseLeave:u,onMouseDown:d,onTouchStart:f,style:{cursor:"move"},stroke:"none",fill:n,fillOpacity:.2,x:p,y:t,width:v,height:r})}function SEe(e){var{x:t,y:r,width:n,height:i,data:o,children:a,padding:s}=e,u=m.Children.count(a)===1;if(!u)return null;var d=m.Children.only(a);return d?m.cloneElement(d,{x:t,y:r,width:n,height:i,margin:s,compact:!0,data:o}):null}var kEe=e=>{var{data:t,startIndex:r,endIndex:n,x:i,width:o,travellerWidth:a}=e;if(!t||!t.length)return{};var s=t.length,u=W8().domain(_E(0,s)).range([i,i+o-a]),d=u.domain().map(f=>u(f)).filter(hW);return{isTextActive:!1,isSlideMoving:!1,isTravellerMoving:!1,isTravellerFocused:!1,startX:u(r),endX:u(n),scale:u,scaleValues:d}},PN=e=>e.changedTouches&&!!e.changedTouches.length;class PEe extends m.PureComponent{constructor(t){super(t),Ga(this,"handleDrag",r=>{this.leaveTimer&&(clearTimeout(this.leaveTimer),this.leaveTimer=null),this.state.isTravellerMoving?this.handleTravellerMove(r):this.state.isSlideMoving&&this.handleSlideDrag(r)}),Ga(this,"handleTouchMove",r=>{r.changedTouches!=null&&r.changedTouches.length>0&&this.handleDrag(r.changedTouches[0])}),Ga(this,"handleDragEnd",()=>{this.setState({isTravellerMoving:!1,isSlideMoving:!1},()=>{var{endIndex:r,onDragEnd:n,startIndex:i}=this.props;n==null||n({endIndex:r,startIndex:i})}),this.detachDragEndListener()}),Ga(this,"handleLeaveWrapper",()=>{(this.state.isTravellerMoving||this.state.isSlideMoving)&&(this.leaveTimer=window.setTimeout(this.handleDragEnd,this.props.leaveTimeOut))}),Ga(this,"handleEnterSlideOrTraveller",()=>{this.setState({isTextActive:!0})}),Ga(this,"handleLeaveSlideOrTraveller",()=>{this.setState({isTextActive:!1})}),Ga(this,"handleSlideDragStart",r=>{var n=PN(r)?r.changedTouches[0]:r;this.setState({isTravellerMoving:!1,isSlideMoving:!0,slideMoveStartX:n.pageX}),this.attachDragEndListener()}),Ga(this,"handleTravellerMoveKeyboard",(r,n)=>{var{data:i,gap:o,startIndex:a,endIndex:s}=this.props,{scaleValues:u,startX:d,endX:f}=this.state;if(u!=null){var p=-1;if(n==="startX"?p=a:n==="endX"&&(p=s),!(p<0||p>=i.length)){var v=p+r;if(!(v===-1||v>=u.length)){var y=u[v];n==="startX"&&y>=f||n==="endX"&&y<=d||this.setState({[n]:y},()=>{this.props.onChange(V1({startX:this.state.startX,endX:this.state.endX,data:i,gap:o,scaleValues:u}))})}}}}),this.travellerDragStartHandlers={startX:this.handleTravellerDragStart.bind(this,"startX"),endX:this.handleTravellerDragStart.bind(this,"endX")},this.state={brushMoveStartX:0,movingTravellerId:void 0,endX:0,startX:0,slideMoveStartX:0}}static getDerivedStateFromProps(t,r){var{data:n,width:i,x:o,travellerWidth:a,startIndex:s,endIndex:u,startIndexControlledFromProps:d,endIndexControlledFromProps:f}=t;if(n!==r.prevData)return uu({prevData:n,prevTravellerWidth:a,prevX:o,prevWidth:i},n&&n.length?kEe({data:n,width:i,x:o,travellerWidth:a,startIndex:s,endIndex:u}):{scale:void 0,scaleValues:void 0});var p=r.scale;if(p&&(i!==r.prevWidth||o!==r.prevX||a!==r.prevTravellerWidth)){p.range([o,o+i-a]);var v=p.domain().map(y=>p(y)).filter(y=>y!=null);return{prevData:n,prevTravellerWidth:a,prevX:o,prevWidth:i,startX:p(t.startIndex),endX:p(t.endIndex),scaleValues:v}}if(r.scale&&!r.isSlideMoving&&!r.isTravellerMoving&&!r.isTravellerFocused&&!r.isTextActive){if(d!=null&&r.prevStartIndexControlledFromProps!==d)return{startX:r.scale(d),prevStartIndexControlledFromProps:d};if(f!=null&&r.prevEndIndexControlledFromProps!==f)return{endX:r.scale(f),prevEndIndexControlledFromProps:f}}return null}componentWillUnmount(){this.leaveTimer&&(clearTimeout(this.leaveTimer),this.leaveTimer=null),this.detachDragEndListener()}attachDragEndListener(){window.addEventListener("mouseup",this.handleDragEnd,!0),window.addEventListener("touchend",this.handleDragEnd,!0),window.addEventListener("mousemove",this.handleDrag,!0)}detachDragEndListener(){window.removeEventListener("mouseup",this.handleDragEnd,!0),window.removeEventListener("touchend",this.handleDragEnd,!0),window.removeEventListener("mousemove",this.handleDrag,!0)}handleSlideDrag(t){var{slideMoveStartX:r,startX:n,endX:i,scaleValues:o}=this.state;if(o!=null){var{x:a,width:s,travellerWidth:u,startIndex:d,endIndex:f,onChange:p,data:v,gap:y}=this.props,b=t.pageX-r;b>0?b=Math.min(b,a+s-u-i,a+s-u-n):b<0&&(b=Math.max(b,a-n,a-i));var w=V1({startX:n+b,endX:i+b,data:v,gap:y,scaleValues:o});(w.startIndex!==d||w.endIndex!==f)&&p&&p(w),this.setState({startX:n+b,endX:i+b,slideMoveStartX:t.pageX})}}handleTravellerDragStart(t,r){var n=PN(r)?r.changedTouches[0]:r;this.setState({isSlideMoving:!1,isTravellerMoving:!0,movingTravellerId:t,brushMoveStartX:n.pageX}),this.attachDragEndListener()}handleTravellerMove(t){var{brushMoveStartX:r,movingTravellerId:n,endX:i,startX:o,scaleValues:a}=this.state;if(!(n==null||a==null)){var s=this.state[n],{x:u,width:d,travellerWidth:f,onChange:p,gap:v,data:y}=this.props,b={startX:this.state.startX,endX:this.state.endX,data:y,gap:v,scaleValues:a},w=t.pageX-r;w>0?w=Math.min(w,u+d-f-s):w<0&&(w=Math.max(w,u-s)),b[n]=s+w;var x=V1(b),{startIndex:k,endIndex:$}=x,P=()=>{var j=y.length-1;return n==="startX"&&(i>o?k%v===0:$%v===0)||i<o&&$===j||n==="endX"&&(i>o?$%v===0:k%v===0)||i>o&&$===j};this.setState({[n]:s+w,brushMoveStartX:t.pageX},()=>{p&&P()&&p(x)})}}render(){var{data:t,className:r,children:n,x:i,y:o,dy:a,width:s,height:u,alwaysShowText:d,fill:f,stroke:p,startIndex:v,endIndex:y,travellerWidth:b,tickFormatter:w,dataKey:x,padding:k}=this.props,{startX:$,endX:P,isTextActive:j,isSlideMoving:C,isTravellerMoving:I,isTravellerFocused:A}=this.state;if(!t||!t.length||!Ue(i)||!Ue(o)||!Ue(s)||!Ue(u)||s<=0||u<=0)return null;var T=ve("recharts-brush",r),M=lEe("userSelect","none"),R=o+(a??0);return m.createElement(fr,{className:T,onMouseLeave:this.handleLeaveWrapper,onTouchMove:this.handleTouchMove,style:M},m.createElement(bEe,{x:i,y:R,width:s,height:u,fill:f,stroke:p}),m.createElement(wve,null,m.createElement(SEe,{x:i,y:R,width:s,height:u,data:t,padding:k},n)),m.createElement(wEe,{y:R,height:u,stroke:p,travellerWidth:b,startX:$,endX:P,onMouseEnter:this.handleEnterSlideOrTraveller,onMouseLeave:this.handleLeaveSlideOrTraveller,onMouseDown:this.handleSlideDragStart,onTouchStart:this.handleSlideDragStart}),m.createElement(wN,{travellerX:$,id:"startX",otherProps:uu(uu({},this.props),{},{y:R}),onMouseEnter:this.handleEnterSlideOrTraveller,onMouseLeave:this.handleLeaveSlideOrTraveller,onMouseDown:this.travellerDragStartHandlers.startX,onTouchStart:this.travellerDragStartHandlers.startX,onTravellerMoveKeyboard:this.handleTravellerMoveKeyboard,onFocus:()=>{this.setState({isTravellerFocused:!0})},onBlur:()=>{this.setState({isTravellerFocused:!1})}}),m.createElement(wN,{travellerX:P,id:"endX",otherProps:uu(uu({},this.props),{},{y:R}),onMouseEnter:this.handleEnterSlideOrTraveller,onMouseLeave:this.handleLeaveSlideOrTraveller,onMouseDown:this.travellerDragStartHandlers.endX,onTouchStart:this.travellerDragStartHandlers.endX,onTravellerMoveKeyboard:this.handleTravellerMoveKeyboard,onFocus:()=>{this.setState({isTravellerFocused:!0})},onBlur:()=>{this.setState({isTravellerFocused:!1})}}),(j||C||I||A||d)&&m.createElement(xEe,{startIndex:v,endIndex:y,y:R,height:u,travellerWidth:b,stroke:p,tickFormatter:w,dataKey:x,data:t,startX:$,endX:P}))}}function $Ee(e){var t=ir(),r=cEe(),n=fEe(),i=m.useContext(pEe),o=e.onChange,{startIndex:a,endIndex:s}=e;m.useEffect(()=>{t(n$({startIndex:a,endIndex:s}))},[t,s,a]),Oke();var u=m.useCallback(x=>{if(n!=null){var{startIndex:k,endIndex:$}=n;(x.startIndex!==k||x.endIndex!==$)&&(i==null||i(x),o==null||o(x),t(n$(x)))}},[o,i,t,n]),d=Le(am);if(d==null||n==null||r==null||!r.length)return null;var{startIndex:f,endIndex:p}=n,{x:v,y,width:b}=d,w={data:r,x:v,y,width:b,startIndex:f,endIndex:p,onChange:u};return m.createElement(PEe,xh({},e,w,{startIndexControlledFromProps:a??void 0,endIndexControlledFromProps:s??void 0}))}function CEe(e){var t=ir();return m.useEffect(()=>(t(bN(e)),()=>{t(bN(null))}),[t,e]),null}var jEe={height:40,travellerWidth:5,gap:1,fill:"#fff",stroke:"#666",padding:{top:1,right:1,bottom:1,left:1},leaveTimeOut:1e3,alwaysShowText:!1};function xH(e){var t=Er(e,jEe);return m.createElement(m.Fragment,null,m.createElement(CEe,{height:t.height,x:t.x,y:t.y,width:t.width,padding:t.padding}),m.createElement($Ee,t))}xH.displayName="Brush";function $N(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function gv(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?$N(Object(r),!0).forEach(function(n){wH(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):$N(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function wH(e,t,r){return(t=EEe(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function EEe(e){var t=IEe(e,"string");return typeof t=="symbol"?t:t+""}function IEe(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var OEe=(e,t)=>{var{x:r,y:n}=e,{x:i,y:o}=t;return{x:Math.min(r,i),y:Math.min(n,o),width:Math.abs(i-r),height:Math.abs(o-n)}};class n0{static create(t){return new n0(t)}constructor(t){this.scale=t}get domain(){return this.scale.domain}get range(){return this.scale.range}get rangeMin(){return this.range()[0]}get rangeMax(){return this.range()[1]}get bandwidth(){return this.scale.bandwidth}apply(t){var{bandAware:r,position:n}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(t!==void 0){if(n)switch(n){case"start":return this.scale(t);case"middle":{var i=this.bandwidth?this.bandwidth()/2:0;return this.scale(t)+i}case"end":{var o=this.bandwidth?this.bandwidth():0;return this.scale(t)+o}default:return this.scale(t)}if(r){var a=this.bandwidth?this.bandwidth()/2:0;return this.scale(t)+a}return this.scale(t)}}isInRange(t){var r=this.range(),n=r[0],i=r[r.length-1];return n<=i?t>=n&&t<=i:t>=i&&t<=n}}wH(n0,"EPS",1e-4);var _Ee=e=>{var t=Object.keys(e).reduce((r,n)=>gv(gv({},r),{},{[n]:n0.create(e[n])}),{});return gv(gv({},t),{},{apply(r){var{bandAware:n,position:i}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return Object.fromEntries(Object.entries(r).map(o=>{var[a,s]=o;return[a,t[a].apply(s,{bandAware:n,position:i})]}))},isInRange(r){return Object.keys(r).every(n=>t[n].isInRange(r[n]))}})};function AEe(e){return(e%180+180)%180}var TEe=function(t){var{width:r,height:n}=t,i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,o=AEe(i),a=o*Math.PI/180,s=Math.atan(n/r),u=a>s&&a<Math.PI-s?n/Math.sin(a):r/Math.cos(a);return Math.abs(u)},MEe={dots:[],areas:[],lines:[]},SH=Oi({name:"referenceElements",initialState:MEe,reducers:{addDot:(e,t)=>{e.dots.push(t.payload)},removeDot:(e,t)=>{var r=Yo(e).dots.findIndex(n=>n===t.payload);r!==-1&&e.dots.splice(r,1)},addArea:(e,t)=>{e.areas.push(t.payload)},removeArea:(e,t)=>{var r=Yo(e).areas.findIndex(n=>n===t.payload);r!==-1&&e.areas.splice(r,1)},addLine:(e,t)=>{e.lines.push(t.payload)},removeLine:(e,t)=>{var r=Yo(e).lines.findIndex(n=>n===t.payload);r!==-1&&e.lines.splice(r,1)}}}),{addDot:S2e,removeDot:k2e,addArea:REe,removeArea:DEe,addLine:P2e,removeLine:$2e}=SH.actions,zEe=SH.reducer,kH=m.createContext(void 0),NEe=e=>{var{children:t}=e,[r]=m.useState("".concat(ah("recharts"),"-clip")),n=e0();if(n==null)return null;var{x:i,y:o,width:a,height:s}=n;return m.createElement(kH.Provider,{value:r},m.createElement("defs",null,m.createElement("clipPath",{id:r},m.createElement("rect",{x:i,y:o,height:s,width:a}))),t)},LEe=()=>m.useContext(kH);function CN(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function jN(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?CN(Object(r),!0).forEach(function(n){BEe(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):CN(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function BEe(e,t,r){return(t=FEe(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function FEe(e){var t=UEe(e,"string");return typeof t=="symbol"?t:t+""}function UEe(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function ib(){return ib=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},ib.apply(null,arguments)}var WEe=(e,t,r,n,i,o,a)=>{var{x1:s,x2:u,y1:d,y2:f}=a;if(i==null||o==null)return null;var p=_Ee({x:i,y:o}),v={x:e?p.x.apply(s,{position:"start"}):p.x.rangeMin,y:r?p.y.apply(d,{position:"start"}):p.y.rangeMin},y={x:t?p.x.apply(u,{position:"end"}):p.x.rangeMax,y:n?p.y.apply(f,{position:"end"}):p.y.rangeMax};return a.ifOverflow==="discard"&&(!p.isInRange(v)||!p.isInRange(y))?null:OEe(v,y)},KEe=(e,t)=>{var r;return m.isValidElement(e)?r=m.cloneElement(e,t):typeof e=="function"?r=e(t):r=m.createElement(OE,ib({},t,{className:"recharts-reference-area-rect"})),r};function HEe(e){var t=ir();return m.useEffect(()=>(t(REe(e)),()=>{t(DEe(e))})),null}function VEe(e){var{x1:t,x2:r,y1:n,y2:i,className:o,shape:a,xAxisId:s,yAxisId:u}=e,d=LEe(),f=hn(),p=Le(j=>Cl(j,"xAxis",s,f)),v=Le(j=>Cl(j,"yAxis",u,f));if(p==null||v==null)return null;var y=Si(t),b=Si(r),w=Si(n),x=Si(i);if(!y&&!b&&!w&&!x&&!a)return null;var k=WEe(y,b,w,x,p,v,e);if(!k&&!a)return null;var $=e.ifOverflow==="hidden",P=$?"url(#".concat(d,")"):void 0;return m.createElement(Qn,{zIndex:e.zIndex},m.createElement(fr,{className:ve("recharts-reference-area",o)},KEe(a,jN(jN({clipPath:P},Rn(e)),k)),k!=null&&m.createElement(QK,ib({},k,{lowerWidth:k.width,upperWidth:k.width}),m.createElement(eH,{label:e.label}),e.children)))}var qEe={ifOverflow:"discard",xAxisId:0,yAxisId:0,radius:0,fill:"#ccc",fillOpacity:.5,stroke:"none",strokeWidth:1,zIndex:Wr.area};function PH(e){var t=Er(e,qEe);return m.createElement(m.Fragment,null,m.createElement(HEe,{yAxisId:t.yAxisId,xAxisId:t.xAxisId,ifOverflow:t.ifOverflow,x1:t.x1,x2:t.x2,y1:t.y1,y2:t.y2}),m.createElement(VEe,t))}PH.displayName="ReferenceArea";function $H(e,t){if(t<1)return[];if(t===1)return e;for(var r=[],n=0;n<e.length;n+=t)r.push(e[n]);return r}function GEe(e,t,r){var n={width:e.width+t.width,height:e.height+t.height};return TEe(n,r)}function ZEe(e,t,r){var n=r==="width",{x:i,y:o,width:a,height:s}=e;return t===1?{start:n?i:o,end:n?i+a:o+s}:{start:n?i+a:o+s,end:n?i:o}}function ob(e,t,r,n,i){if(e*t<e*n||e*t>e*i)return!1;var o=r();return e*(t-e*o/2-n)>=0&&e*(t+e*o/2-i)<=0}function XEe(e,t){return $H(e,t+1)}function YEe(e,t,r,n,i){for(var o=(n||[]).slice(),{start:a,end:s}=t,u=0,d=1,f=a,p=function(){var b=n==null?void 0:n[u];if(b===void 0)return{v:$H(n,d)};var w=u,x,k=()=>(x===void 0&&(x=r(b,w)),x),$=b.coordinate,P=u===0||ob(e,$,k,f,s);P||(u=0,f=a,d+=1),P&&(f=$+e*(k()/2+i),u+=d)},v;d<=o.length;)if(v=p(),v)return v.v;return[]}function EN(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function Hn(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?EN(Object(r),!0).forEach(function(n){QEe(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):EN(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function QEe(e,t,r){return(t=JEe(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function JEe(e){var t=eIe(e,"string");return typeof t=="symbol"?t:t+""}function eIe(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function tIe(e,t,r,n,i){for(var o=(n||[]).slice(),a=o.length,{start:s}=t,{end:u}=t,d=function(v){var y=o[v],b,w=()=>(b===void 0&&(b=r(y,v)),b);if(v===a-1){var x=e*(y.coordinate+e*w()/2-u);o[v]=y=Hn(Hn({},y),{},{tickCoord:x>0?y.coordinate-x*e:y.coordinate})}else o[v]=y=Hn(Hn({},y),{},{tickCoord:y.coordinate});if(y.tickCoord!=null){var k=ob(e,y.tickCoord,w,s,u);k&&(u=y.tickCoord-e*(w()/2+i),o[v]=Hn(Hn({},y),{},{isShow:!0}))}},f=a-1;f>=0;f--)d(f);return o}function rIe(e,t,r,n,i,o){var a=(n||[]).slice(),s=a.length,{start:u,end:d}=t;if(o){var f=n[s-1],p=r(f,s-1),v=e*(f.coordinate+e*p/2-d);if(a[s-1]=f=Hn(Hn({},f),{},{tickCoord:v>0?f.coordinate-v*e:f.coordinate}),f.tickCoord!=null){var y=ob(e,f.tickCoord,()=>p,u,d);y&&(d=f.tickCoord-e*(p/2+i),a[s-1]=Hn(Hn({},f),{},{isShow:!0}))}}for(var b=o?s-1:s,w=function($){var P=a[$],j,C=()=>(j===void 0&&(j=r(P,$)),j);if($===0){var I=e*(P.coordinate-e*C()/2-u);a[$]=P=Hn(Hn({},P),{},{tickCoord:I<0?P.coordinate-I*e:P.coordinate})}else a[$]=P=Hn(Hn({},P),{},{tickCoord:P.coordinate});if(P.tickCoord!=null){var A=ob(e,P.tickCoord,C,u,d);A&&(u=P.tickCoord+e*(C()/2+i),a[$]=Hn(Hn({},P),{},{isShow:!0}))}},x=0;x<b;x++)w(x);return a}function QI(e,t,r){var{tick:n,ticks:i,viewBox:o,minTickGap:a,orientation:s,interval:u,tickFormatter:d,unit:f,angle:p}=e;if(!i||!i.length||!n)return[];if(Ue(u)||lf.isSsr){var v;return(v=XEe(i,Ue(u)?u:0))!==null&&v!==void 0?v:[]}var y=[],b=s==="top"||s==="bottom"?"width":"height",w=f&&b==="width"?Kp(f,{fontSize:t,letterSpacing:r}):{width:0,height:0},x=(P,j)=>{var C=typeof d=="function"?d(P.value,j):P.value;return b==="width"?GEe(Kp(C,{fontSize:t,letterSpacing:r}),w,p):Kp(C,{fontSize:t,letterSpacing:r})[b]},k=i.length>=2?$n(i[1].coordinate-i[0].coordinate):1,$=ZEe(o,k,b);return u==="equidistantPreserveStart"?YEe(k,$,x,i,a):(u==="preserveStart"||u==="preserveStartEnd"?y=rIe(k,$,x,i,a,u==="preserveStartEnd"):y=tIe(k,$,x,i,a),y.filter(P=>P.isShow))}var nIe=e=>{var{ticks:t,label:r,labelGapWithTick:n=5,tickSize:i=0,tickMargin:o=0}=e,a=0;if(t){Array.from(t).forEach(f=>{if(f){var p=f.getBoundingClientRect();p.width>a&&(a=p.width)}});var s=r?r.getBoundingClientRect().width:0,u=i+o,d=a+u+s+(r?n:0);return Math.round(d)}return 0},iIe=["axisLine","width","height","className","hide","ticks","axisType"];function oIe(e,t){if(e==null)return{};var r,n,i=aIe(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n<o.length;n++)r=o[n],t.indexOf(r)===-1&&{}.propertyIsEnumerable.call(e,r)&&(i[r]=e[r])}return i}function aIe(e,t){if(e==null)return{};var r={};for(var n in e)if({}.hasOwnProperty.call(e,n)){if(t.indexOf(n)!==-1)continue;r[n]=e[n]}return r}function Yu(){return Yu=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},Yu.apply(null,arguments)}function IN(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function Jr(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?IN(Object(r),!0).forEach(function(n){sIe(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):IN(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function sIe(e,t,r){return(t=lIe(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function lIe(e){var t=uIe(e,"string");return typeof t=="symbol"?t:t+""}function uIe(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var ss={x:0,y:0,width:0,height:0,viewBox:{x:0,y:0,width:0,height:0},orientation:"bottom",ticks:[],stroke:"#666",tickLine:!0,axisLine:!0,tick:!0,mirror:!1,minTickGap:5,tickSize:6,tickMargin:2,interval:"preserveEnd",zIndex:Wr.axis};function cIe(e){var{x:t,y:r,width:n,height:i,orientation:o,mirror:a,axisLine:s,otherSvgProps:u}=e;if(!s)return null;var d=Jr(Jr(Jr({},u),Zn(s)),{},{fill:"none"});if(o==="top"||o==="bottom"){var f=+(o==="top"&&!a||o==="bottom"&&a);d=Jr(Jr({},d),{},{x1:t,y1:r+f*i,x2:t+n,y2:r+f*i})}else{var p=+(o==="left"&&!a||o==="right"&&a);d=Jr(Jr({},d),{},{x1:t+p*n,y1:r,x2:t+p*n,y2:r+i})}return m.createElement("line",Yu({},d,{className:ve("recharts-cartesian-axis-line",qu(s,"className"))}))}function dIe(e,t,r,n,i,o,a,s,u){var d,f,p,v,y,b,w=s?-1:1,x=e.tickSize||a,k=Ue(e.tickCoord)?e.tickCoord:e.coordinate;switch(o){case"top":d=f=e.coordinate,v=r+ +!s*i,p=v-w*x,b=p-w*u,y=k;break;case"left":p=v=e.coordinate,f=t+ +!s*n,d=f-w*x,y=d-w*u,b=k;break;case"right":p=v=e.coordinate,f=t+ +s*n,d=f+w*x,y=d+w*u,b=k;break;default:d=f=e.coordinate,v=r+ +s*i,p=v+w*x,b=p+w*u,y=k;break}return{line:{x1:d,y1:p,x2:f,y2:v},tick:{x:y,y:b}}}function fIe(e,t){switch(e){case"left":return t?"start":"end";case"right":return t?"end":"start";default:return"middle"}}function pIe(e,t){switch(e){case"left":case"right":return"middle";case"top":return t?"start":"end";default:return t?"end":"start"}}function hIe(e){var{option:t,tickProps:r,value:n}=e,i,o=ve(r.className,"recharts-cartesian-axis-tick-value");if(m.isValidElement(t))i=m.cloneElement(t,Jr(Jr({},r),{},{className:o}));else if(typeof t=="function")i=t(Jr(Jr({},r),{},{className:o}));else{var a="recharts-cartesian-axis-tick-value";typeof t!="boolean"&&(a=ve(a,t==null?void 0:t.className)),i=m.createElement(Vd,Yu({},r,{className:a}),n)}return i}var mIe=m.forwardRef((e,t)=>{var{ticks:r=[],tick:n,tickLine:i,stroke:o,tickFormatter:a,unit:s,padding:u,tickTextProps:d,orientation:f,mirror:p,x:v,y,width:b,height:w,tickSize:x,tickMargin:k,fontSize:$,letterSpacing:P,getTicksConfig:j,events:C,axisType:I}=e,A=QI(Jr(Jr({},j),{},{ticks:r}),$,P),T=fIe(f,p),M=pIe(f,p),R=Zn(j),D=Vu(n),O={};typeof i=="object"&&(O=i);var L=Jr(Jr({},R),{},{fill:"none"},O),z=A.map(U=>Jr({entry:U},dIe(U,v,y,b,w,f,x,p,k))),F=z.map(U=>{var{entry:V,line:K}=U;return m.createElement(fr,{className:"recharts-cartesian-axis-tick",key:"tick-".concat(V.value,"-").concat(V.coordinate,"-").concat(V.tickCoord)},i&&m.createElement("line",Yu({},L,K,{className:ve("recharts-cartesian-axis-tick-line",qu(i,"className"))})))}),B=z.map((U,V)=>{var{entry:K,tick:Z}=U,W=Jr(Jr(Jr(Jr({textAnchor:T,verticalAnchor:M},R),{},{stroke:"none",fill:o},D),Z),{},{index:V,payload:K,visibleTicksCount:A.length,tickFormatter:a,padding:u},d);return m.createElement(fr,Yu({className:"recharts-cartesian-axis-tick-label",key:"tick-label-".concat(K.value,"-").concat(K.coordinate,"-").concat(K.tickCoord)},tm(C,K,V)),n&&m.createElement(hIe,{option:n,tickProps:W,value:"".concat(typeof a=="function"?a(K.value,V):K.value).concat(s||"")}))});return m.createElement("g",{className:"recharts-cartesian-axis-ticks recharts-".concat(I,"-ticks")},B.length>0&&m.createElement(Qn,{zIndex:Wr.label},m.createElement("g",{className:"recharts-cartesian-axis-tick-labels recharts-".concat(I,"-tick-labels"),ref:t},B)),F.length>0&&m.createElement("g",{className:"recharts-cartesian-axis-tick-lines recharts-".concat(I,"-tick-lines")},F))}),gIe=m.forwardRef((e,t)=>{var{axisLine:r,width:n,height:i,className:o,hide:a,ticks:s,axisType:u}=e,d=oIe(e,iIe),[f,p]=m.useState(""),[v,y]=m.useState(""),b=m.useRef(null);m.useImperativeHandle(t,()=>({getCalculatedWidth:()=>{var x;return nIe({ticks:b.current,label:(x=e.labelRef)===null||x===void 0?void 0:x.current,labelGapWithTick:5,tickSize:e.tickSize,tickMargin:e.tickMargin})}}));var w=m.useCallback(x=>{if(x){var k=x.getElementsByClassName("recharts-cartesian-axis-tick-value");b.current=k;var $=k[0];if($){var P=window.getComputedStyle($),j=P.fontSize,C=P.letterSpacing;(j!==f||C!==v)&&(p(j),y(C))}}},[f,v]);return a||n!=null&&n<=0||i!=null&&i<=0?null:m.createElement(Qn,{zIndex:e.zIndex},m.createElement(fr,{className:ve("recharts-cartesian-axis",o)},m.createElement(cIe,{x:e.x,y:e.y,width:n,height:i,orientation:e.orientation,mirror:e.mirror,axisLine:r,otherSvgProps:Zn(e)}),m.createElement(mIe,{ref:w,axisType:u,events:d,fontSize:f,getTicksConfig:e,height:e.height,letterSpacing:v,mirror:e.mirror,orientation:e.orientation,padding:e.padding,stroke:e.stroke,tick:e.tick,tickFormatter:e.tickFormatter,tickLine:e.tickLine,tickMargin:e.tickMargin,tickSize:e.tickSize,tickTextProps:e.tickTextProps,ticks:s,unit:e.unit,width:e.width,x:e.x,y:e.y}),m.createElement(QK,{x:e.x,y:e.y,width:e.width,height:e.height,lowerWidth:e.width,upperWidth:e.width},m.createElement(eH,{label:e.label,labelRef:e.labelRef}),e.children)))}),JI=m.forwardRef((e,t)=>{var r=Er(e,ss);return m.createElement(gIe,Yu({},r,{ref:t}))});JI.displayName="CartesianAxis";var vIe=["x1","y1","x2","y2","key"],yIe=["offset"],bIe=["xAxisId","yAxisId"],xIe=["xAxisId","yAxisId"];function ON(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function Vn(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?ON(Object(r),!0).forEach(function(n){wIe(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):ON(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function wIe(e,t,r){return(t=SIe(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function SIe(e){var t=kIe(e,"string");return typeof t=="symbol"?t:t+""}function kIe(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function bu(){return bu=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},bu.apply(null,arguments)}function ab(e,t){if(e==null)return{};var r,n,i=PIe(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n<o.length;n++)r=o[n],t.indexOf(r)===-1&&{}.propertyIsEnumerable.call(e,r)&&(i[r]=e[r])}return i}function PIe(e,t){if(e==null)return{};var r={};for(var n in e)if({}.hasOwnProperty.call(e,n)){if(t.indexOf(n)!==-1)continue;r[n]=e[n]}return r}var $Ie=e=>{var{fill:t}=e;if(!t||t==="none")return null;var{fillOpacity:r,x:n,y:i,width:o,height:a,ry:s}=e;return m.createElement("rect",{x:n,y:i,ry:s,width:o,height:a,stroke:"none",fill:t,fillOpacity:r,className:"recharts-cartesian-grid-bg"})};function CH(e){var{option:t,lineItemProps:r}=e,n;if(m.isValidElement(t))n=m.cloneElement(t,r);else if(typeof t=="function")n=t(r);else{var i,{x1:o,y1:a,x2:s,y2:u,key:d}=r,f=ab(r,vIe),p=(i=Zn(f))!==null&&i!==void 0?i:{},{offset:v}=p,y=ab(p,yIe);n=m.createElement("line",bu({},y,{x1:o,y1:a,x2:s,y2:u,fill:"none",key:d}))}return n}function CIe(e){var{x:t,width:r,horizontal:n=!0,horizontalPoints:i}=e;if(!n||!i||!i.length)return null;var{xAxisId:o,yAxisId:a}=e,s=ab(e,bIe),u=i.map((d,f)=>{var p=Vn(Vn({},s),{},{x1:t,y1:d,x2:t+r,y2:d,key:"line-".concat(f),index:f});return m.createElement(CH,{key:"line-".concat(f),option:n,lineItemProps:p})});return m.createElement("g",{className:"recharts-cartesian-grid-horizontal"},u)}function jIe(e){var{y:t,height:r,vertical:n=!0,verticalPoints:i}=e;if(!n||!i||!i.length)return null;var{xAxisId:o,yAxisId:a}=e,s=ab(e,xIe),u=i.map((d,f)=>{var p=Vn(Vn({},s),{},{x1:d,y1:t,x2:d,y2:t+r,key:"line-".concat(f),index:f});return m.createElement(CH,{option:n,lineItemProps:p,key:"line-".concat(f)})});return m.createElement("g",{className:"recharts-cartesian-grid-vertical"},u)}function EIe(e){var{horizontalFill:t,fillOpacity:r,x:n,y:i,width:o,height:a,horizontalPoints:s,horizontal:u=!0}=e;if(!u||!t||!t.length||s==null)return null;var d=s.map(p=>Math.round(p+i-i)).sort((p,v)=>p-v);i!==d[0]&&d.unshift(0);var f=d.map((p,v)=>{var y=!d[v+1],b=y?i+a-p:d[v+1]-p;if(b<=0)return null;var w=v%t.length;return m.createElement("rect",{key:"react-".concat(v),y:p,x:n,height:b,width:o,stroke:"none",fill:t[w],fillOpacity:r,className:"recharts-cartesian-grid-bg"})});return m.createElement("g",{className:"recharts-cartesian-gridstripes-horizontal"},f)}function IIe(e){var{vertical:t=!0,verticalFill:r,fillOpacity:n,x:i,y:o,width:a,height:s,verticalPoints:u}=e;if(!t||!r||!r.length)return null;var d=u.map(p=>Math.round(p+i-i)).sort((p,v)=>p-v);i!==d[0]&&d.unshift(0);var f=d.map((p,v)=>{var y=!d[v+1],b=y?i+a-p:d[v+1]-p;if(b<=0)return null;var w=v%r.length;return m.createElement("rect",{key:"react-".concat(v),x:p,y:o,width:b,height:s,stroke:"none",fill:r[w],fillOpacity:n,className:"recharts-cartesian-grid-bg"})});return m.createElement("g",{className:"recharts-cartesian-gridstripes-vertical"},f)}var OIe=(e,t)=>{var{xAxis:r,width:n,height:i,offset:o}=e;return l8(QI(Vn(Vn(Vn({},ss),r),{},{ticks:u8(r),viewBox:{x:0,y:0,width:n,height:i}})),o.left,o.left+o.width,t)},_Ie=(e,t)=>{var{yAxis:r,width:n,height:i,offset:o}=e;return l8(QI(Vn(Vn(Vn({},ss),r),{},{ticks:u8(r),viewBox:{x:0,y:0,width:n,height:i}})),o.top,o.top+o.height,t)},AIe={horizontal:!0,vertical:!0,horizontalPoints:[],verticalPoints:[],stroke:"#ccc",fill:"none",verticalFill:[],horizontalFill:[],xAxisId:0,yAxisId:0,syncWithTicks:!1,zIndex:Wr.grid};function Il(e){var t=$E(),r=CE(),n=b8(),i=Vn(Vn({},Er(e,AIe)),{},{x:Ue(e.x)?e.x:n.left,y:Ue(e.y)?e.y:n.top,width:Ue(e.width)?e.width:n.width,height:Ue(e.height)?e.height:n.height}),{xAxisId:o,yAxisId:a,x:s,y:u,width:d,height:f,syncWithTicks:p,horizontalValues:v,verticalValues:y}=i,b=hn(),w=Le(M=>pz(M,"xAxis",o,b)),x=Le(M=>pz(M,"yAxis",a,b));if(!Ca(d)||!Ca(f)||!Ue(s)||!Ue(u))return null;var k=i.verticalCoordinatesGenerator||OIe,$=i.horizontalCoordinatesGenerator||_Ie,{horizontalPoints:P,verticalPoints:j}=i;if((!P||!P.length)&&typeof $=="function"){var C=v&&v.length,I=$({yAxis:x?Vn(Vn({},x),{},{ticks:C?v:x.ticks}):void 0,width:t??d,height:r??f,offset:n},C?!0:p);Oy(Array.isArray(I),"horizontalCoordinatesGenerator should return Array but instead it returned [".concat(typeof I,"]")),Array.isArray(I)&&(P=I)}if((!j||!j.length)&&typeof k=="function"){var A=y&&y.length,T=k({xAxis:w?Vn(Vn({},w),{},{ticks:A?y:w.ticks}):void 0,width:t??d,height:r??f,offset:n},A?!0:p);Oy(Array.isArray(T),"verticalCoordinatesGenerator should return Array but instead it returned [".concat(typeof T,"]")),Array.isArray(T)&&(j=T)}return m.createElement(Qn,{zIndex:i.zIndex},m.createElement("g",{className:"recharts-cartesian-grid"},m.createElement($Ie,{fill:i.fill,fillOpacity:i.fillOpacity,x:i.x,y:i.y,width:i.width,height:i.height,ry:i.ry}),m.createElement(EIe,bu({},i,{horizontalPoints:P})),m.createElement(IIe,bu({},i,{verticalPoints:j})),m.createElement(CIe,bu({},i,{offset:n,horizontalPoints:P,xAxis:w,yAxis:x})),m.createElement(jIe,bu({},i,{offset:n,verticalPoints:j,xAxis:w,yAxis:x}))))}Il.displayName="CartesianGrid";var jH=(e,t,r,n)=>Ia(e,"xAxis",t,n),EH=(e,t,r,n)=>Ea(e,"xAxis",t,n),IH=(e,t,r,n)=>Ia(e,"yAxis",r,n),OH=(e,t,r,n)=>Ea(e,"yAxis",r,n),TIe=ce([At,jH,IH,EH,OH],(e,t,r,n,i)=>Ra(e,"xAxis")?Pl(t,n,!1):Pl(r,i,!1)),MIe=(e,t,r,n,i)=>i;function RIe(e){return e.type==="line"}var DIe=ce([gm,MIe],(e,t)=>e.filter(RIe).find(r=>r.id===t)),zIe=ce([At,jH,IH,EH,OH,DIe,TIe,fm],(e,t,r,n,i,o,a,s)=>{var{chartData:u,dataStartIndex:d,dataEndIndex:f}=s;if(!(o==null||t==null||r==null||n==null||i==null||n.length===0||i.length===0||a==null||e!=="horizontal"&&e!=="vertical")){var{dataKey:p,data:v}=o,y;if(v!=null&&v.length>0?y=v:y=u==null?void 0:u.slice(d,f+1),y!=null)return nOe({layout:e,xAxis:t,yAxis:r,xAxisTicks:n,yAxisTicks:i,dataKey:p,bandSize:a,displayedData:y})}});function _H(e){var t=Vu(e),r=3,n=2;if(t!=null){var{r:i,strokeWidth:o}=t,a=Number(i),s=Number(o);return(Number.isNaN(a)||a<0)&&(a=r),(Number.isNaN(s)||s<0)&&(s=n),{r:a,strokeWidth:s}}return{r,strokeWidth:n}}var NIe=["id"],LIe=["type","layout","connectNulls","needClip","shape"],BIe=["activeDot","animateNewValues","animationBegin","animationDuration","animationEasing","connectNulls","dot","hide","isAnimationActive","label","legendType","xAxisId","yAxisId","id"];function wh(){return wh=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},wh.apply(null,arguments)}function _N(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function va(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?_N(Object(r),!0).forEach(function(n){FIe(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):_N(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function FIe(e,t,r){return(t=UIe(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function UIe(e){var t=WIe(e,"string");return typeof t=="symbol"?t:t+""}function WIe(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function eO(e,t){if(e==null)return{};var r,n,i=KIe(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n<o.length;n++)r=o[n],t.indexOf(r)===-1&&{}.propertyIsEnumerable.call(e,r)&&(i[r]=e[r])}return i}function KIe(e,t){if(e==null)return{};var r={};for(var n in e)if({}.hasOwnProperty.call(e,n)){if(t.indexOf(n)!==-1)continue;r[n]=e[n]}return r}var HIe=e=>{var{dataKey:t,name:r,stroke:n,legendType:i,hide:o}=e;return[{inactive:o,dataKey:t,type:i,color:n,value:Nl(r,t),payload:e}]},VIe=m.memo(e=>{var{dataKey:t,data:r,stroke:n,strokeWidth:i,fill:o,name:a,hide:s,unit:u,tooltipType:d}=e,f={dataDefinedOnItem:r,positions:void 0,settings:{stroke:n,strokeWidth:i,fill:o,dataKey:t,nameKey:void 0,name:Nl(a,t),hide:s,type:d,color:n,unit:u}};return m.createElement(Yx,{tooltipEntrySettings:f})}),AH=(e,t)=>"".concat(t,"px ").concat(e-t,"px");function qIe(e,t){for(var r=e.length%2!==0?[...e,0]:e,n=[],i=0;i<t;++i)n=[...n,...r];return n}var GIe=(e,t,r)=>{var n=r.reduce((p,v)=>p+v);if(!n)return AH(t,e);for(var i=Math.floor(e/n),o=e%n,a=t-e,s=[],u=0,d=0;u<r.length;d+=r[u],++u)if(d+r[u]>o){s=[...r.slice(0,u),o-d];break}var f=s.length%2===0?[0,a]:[a];return[...qIe(r,i),...s,...f].map(p=>"".concat(p,"px")).join(", ")};function ZIe(e){var{clipPathId:t,points:r,props:n}=e,{dot:i,dataKey:o,needClip:a}=n,{id:s}=n,u=eO(n,NIe),d=Zn(u);return m.createElement(fH,{points:r,dot:i,className:"recharts-line-dots",dotClassName:"recharts-line-dot",dataKey:o,baseProps:d,needClip:a,clipPathId:t})}function XIe(e){var{showLabels:t,children:r,points:n}=e,i=m.useMemo(()=>n==null?void 0:n.map(o=>{var a,s,u={x:(a=o.x)!==null&&a!==void 0?a:0,y:(s=o.y)!==null&&s!==void 0?s:0,width:0,lowerWidth:0,upperWidth:0,height:0};return va(va({},u),{},{value:o.value,payload:o.payload,viewBox:u,parentViewBox:void 0,fill:void 0})}),[n]);return m.createElement(BI,{value:t?i:void 0},r)}function AN(e){var{clipPathId:t,pathRef:r,points:n,strokeDasharray:i,props:o}=e,{type:a,layout:s,connectNulls:u,needClip:d,shape:f}=o,p=eO(o,LIe),v=va(va({},Rn(p)),{},{fill:"none",className:"recharts-line-curve",clipPath:d?"url(#clipPath-".concat(t,")"):void 0,points:n,type:a,layout:s,connectNulls:u,strokeDasharray:i??o.strokeDasharray});return m.createElement(m.Fragment,null,(n==null?void 0:n.length)>1&&m.createElement(HI,wh({shapeType:"curve",option:f},v,{pathRef:r})),m.createElement(ZIe,{points:n,clipPathId:t,props:o}))}function YIe(e){try{return e&&e.getTotalLength&&e.getTotalLength()||0}catch{return 0}}function QIe(e){var{clipPathId:t,props:r,pathRef:n,previousPointsRef:i,longestAnimatedLengthRef:o}=e,{points:a,strokeDasharray:s,isAnimationActive:u,animationBegin:d,animationDuration:f,animationEasing:p,animateNewValues:v,width:y,height:b,onAnimationEnd:w,onAnimationStart:x}=r,k=i.current,$=cf(a,"recharts-line-"),P=m.useRef($),[j,C]=m.useState(!1),I=!j,A=m.useCallback(()=>{typeof w=="function"&&w(),C(!1)},[w]),T=m.useCallback(()=>{typeof x=="function"&&x(),C(!0)},[x]),M=YIe(n.current),R=m.useRef(0);P.current!==$&&(R.current=o.current,P.current=$);var D=R.current;return m.createElement(XIe,{points:a,showLabels:I},r.children,m.createElement(uf,{animationId:$,begin:d,duration:f,isActive:u,easing:p,onAnimationEnd:A,onAnimationStart:T,key:$},O=>{var L=Zt(D,M+D,O),z=Math.min(L,M),F;if(u)if(s){var B="".concat(s).split(/[,\s]+/gim).map(K=>parseFloat(K));F=GIe(z,M,B)}else F=AH(M,z);else F=s==null?void 0:String(s);if(O>0&&M>0&&(i.current=a,o.current=Math.max(o.current,z)),k){var U=k.length/a.length,V=O===1?a:a.map((K,Z)=>{var W=Math.floor(Z*U);if(k[W]){var q=k[W];return va(va({},K),{},{x:Zt(q.x,K.x,O),y:Zt(q.y,K.y,O)})}return v?va(va({},K),{},{x:Zt(y*2,K.x,O),y:Zt(b/2,K.y,O)}):va(va({},K),{},{x:K.x,y:K.y})});return i.current=V,m.createElement(AN,{props:r,points:V,clipPathId:t,pathRef:n,strokeDasharray:F})}return m.createElement(AN,{props:r,points:a,clipPathId:t,pathRef:n,strokeDasharray:F})}),m.createElement(Gx,{label:r.label}))}function JIe(e){var{clipPathId:t,props:r}=e,n=m.useRef(null),i=m.useRef(0),o=m.useRef(null);return m.createElement(QIe,{props:r,clipPathId:t,previousPointsRef:n,longestAnimatedLengthRef:i,pathRef:o})}var eOe=(e,t)=>{var r,n;return{x:(r=e.x)!==null&&r!==void 0?r:void 0,y:(n=e.y)!==null&&n!==void 0?n:void 0,value:e.value,errorVal:Xt(e.payload,t)}};class tOe extends m.Component{render(){var{hide:t,dot:r,points:n,className:i,xAxisId:o,yAxisId:a,top:s,left:u,width:d,height:f,id:p,needClip:v,zIndex:y}=this.props;if(t)return null;var b=ve("recharts-line",i),w=p,{r:x,strokeWidth:k}=_H(r),$=KI(r),P=x*2+k,j=v?"url(#clipPath-".concat($?"":"dots-").concat(w,")"):void 0;return m.createElement(Qn,{zIndex:y},m.createElement(fr,{className:b},v&&m.createElement("defs",null,m.createElement(YI,{clipPathId:w,xAxisId:o,yAxisId:a}),!$&&m.createElement("clipPath",{id:"clipPath-dots-".concat(w)},m.createElement("rect",{x:u-P/2,y:s-P/2,width:d+P,height:f+P}))),m.createElement(mH,{xAxisId:o,yAxisId:a,data:n,dataPointFormatter:eOe,errorBarOffset:0},m.createElement(JIe,{props:this.props,clipPathId:w}))),m.createElement(s$,{activeDot:this.props.activeDot,points:n,mainColor:this.props.stroke,itemDataKey:this.props.dataKey,clipPath:j}))}}var TH={activeDot:!0,animateNewValues:!0,animationBegin:0,animationDuration:1500,animationEasing:"ease",connectNulls:!1,dot:!0,fill:"#fff",hide:!1,isAnimationActive:"auto",label:!1,legendType:"line",stroke:"#3182bd",strokeWidth:1,xAxisId:0,yAxisId:0,zIndex:Wr.line,type:"linear"};function rOe(e){var t=Er(e,TH),{activeDot:r,animateNewValues:n,animationBegin:i,animationDuration:o,animationEasing:a,connectNulls:s,dot:u,hide:d,isAnimationActive:f,label:p,legendType:v,xAxisId:y,yAxisId:b,id:w}=t,x=eO(t,BIe),{needClip:k}=t0(y,b),$=e0(),P=uc(),j=hn(),C=Le(R=>zIe(R,y,b,j,w));if(P!=="horizontal"&&P!=="vertical"||C==null||$==null)return null;var{height:I,width:A,x:T,y:M}=$;return m.createElement(tOe,wh({},x,{id:w,connectNulls:s,dot:u,activeDot:r,animateNewValues:n,animationBegin:i,animationDuration:o,animationEasing:a,isAnimationActive:f,hide:d,label:p,legendType:v,xAxisId:y,yAxisId:b,points:C,layout:P,height:I,width:A,left:T,top:M,needClip:k}))}function nOe(e){var{layout:t,xAxis:r,yAxis:n,xAxisTicks:i,yAxisTicks:o,dataKey:a,bandSize:s,displayedData:u}=e;return u.map((d,f)=>{var p=Xt(d,a);if(t==="horizontal"){var v=Iy({axis:r,ticks:i,bandSize:s,entry:d,index:f}),y=xr(p)?null:n.scale(p);return{x:v,y,value:p,payload:d}}var b=xr(p)?null:r.scale(p),w=Iy({axis:n,ticks:o,bandSize:s,entry:d,index:f});return b==null||w==null?null:{x:b,y:w,value:p,payload:d}}).filter(Boolean)}function iOe(e){var t=Er(e,TH),r=hn();return m.createElement(Qx,{id:t.id,type:"line"},n=>m.createElement(m.Fragment,null,m.createElement(ZI,{legendPayload:HIe(t)}),m.createElement(VIe,{dataKey:t.dataKey,data:t.data,stroke:t.stroke,strokeWidth:t.strokeWidth,fill:t.fill,name:t.name,hide:t.hide,unit:t.unit,tooltipType:t.tooltipType}),m.createElement(XI,{type:"line",id:n,data:t.data,xAxisId:t.xAxisId,yAxisId:t.yAxisId,zAxisId:0,dataKey:t.dataKey,hide:t.hide,isPanorama:r}),m.createElement(rOe,wh({},t,{id:n}))))}var Lv=m.memo(iOe,Pm);Lv.displayName="Line";var MH=(e,t,r,n)=>Ia(e,"xAxis",t,n),RH=(e,t,r,n)=>Ea(e,"xAxis",t,n),DH=(e,t,r,n)=>Ia(e,"yAxis",r,n),zH=(e,t,r,n)=>Ea(e,"yAxis",r,n),oOe=ce([At,MH,DH,RH,zH],(e,t,r,n,i)=>Ra(e,"xAxis")?Pl(t,n,!1):Pl(r,i,!1)),aOe=(e,t,r,n,i)=>i,NH=ce([gm,aOe],(e,t)=>e.filter(r=>r.type==="area").find(r=>r.id===t)),sOe=(e,t,r,n,i)=>{var o,a=NH(e,t,r,n,i);if(a!=null){var s=At(e),u=Ra(s,"xAxis"),d;if(u?d=bh(e,"yAxis",r,n):d=bh(e,"xAxis",t,n),d!=null){var{stackId:f}=a,p=Nx(a);if(!(f==null||p==null)){var v=(o=d[f])===null||o===void 0?void 0:o.stackedData;return v==null?void 0:v.find(y=>y.key===p)}}}},lOe=ce([At,MH,DH,RH,zH,sOe,fm,oOe,NH,Swe],(e,t,r,n,i,o,a,s,u,d)=>{var{chartData:f,dataStartIndex:p,dataEndIndex:v}=a;if(!(u==null||e!=="horizontal"&&e!=="vertical"||t==null||r==null||n==null||i==null||n.length===0||i.length===0||s==null)){var{data:y}=u,b;if(y&&y.length>0?b=y:b=f==null?void 0:f.slice(p,v+1),b!=null)return jOe({layout:e,xAxis:t,yAxis:r,xAxisTicks:n,yAxisTicks:i,dataStartIndex:p,areaSettings:u,stackedData:o,displayedData:b,chartBaseValue:d,bandSize:s})}}),uOe=["id"],cOe=["activeDot","animationBegin","animationDuration","animationEasing","connectNulls","dot","fill","fillOpacity","hide","isAnimationActive","legendType","stroke","xAxisId","yAxisId"];function Mu(){return Mu=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},Mu.apply(null,arguments)}function LH(e,t){if(e==null)return{};var r,n,i=dOe(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n<o.length;n++)r=o[n],t.indexOf(r)===-1&&{}.propertyIsEnumerable.call(e,r)&&(i[r]=e[r])}return i}function dOe(e,t){if(e==null)return{};var r={};for(var n in e)if({}.hasOwnProperty.call(e,n)){if(t.indexOf(n)!==-1)continue;r[n]=e[n]}return r}function TN(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function rd(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?TN(Object(r),!0).forEach(function(n){fOe(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):TN(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function fOe(e,t,r){return(t=pOe(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function pOe(e){var t=hOe(e,"string");return typeof t=="symbol"?t:t+""}function hOe(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function sb(e,t){return e&&e!=="none"?e:t}var mOe=e=>{var{dataKey:t,name:r,stroke:n,fill:i,legendType:o,hide:a}=e;return[{inactive:a,dataKey:t,type:o,color:sb(n,i),value:Nl(r,t),payload:e}]},gOe=m.memo(e=>{var{dataKey:t,data:r,stroke:n,strokeWidth:i,fill:o,name:a,hide:s,unit:u,tooltipType:d}=e,f={dataDefinedOnItem:r,positions:void 0,settings:{stroke:n,strokeWidth:i,fill:o,dataKey:t,nameKey:void 0,name:Nl(a,t),hide:s,type:d,color:sb(n,o),unit:u}};return m.createElement(Yx,{tooltipEntrySettings:f})});function vOe(e){var{clipPathId:t,points:r,props:n}=e,{needClip:i,dot:o,dataKey:a}=n,s=Zn(n);return m.createElement(fH,{points:r,dot:o,className:"recharts-area-dots",dotClassName:"recharts-area-dot",dataKey:a,baseProps:s,needClip:i,clipPathId:t})}function yOe(e){var{showLabels:t,children:r,points:n}=e,i=n.map(o=>{var a,s,u={x:(a=o.x)!==null&&a!==void 0?a:0,y:(s=o.y)!==null&&s!==void 0?s:0,width:0,lowerWidth:0,upperWidth:0,height:0};return rd(rd({},u),{},{value:o.value,payload:o.payload,parentViewBox:void 0,viewBox:u,fill:void 0})});return m.createElement(BI,{value:t?i:void 0},r)}function MN(e){var{points:t,baseLine:r,needClip:n,clipPathId:i,props:o}=e,{layout:a,type:s,stroke:u,connectNulls:d,isRange:f}=o,{id:p}=o,v=LH(o,uOe),y=Zn(v),b=Rn(v);return m.createElement(m.Fragment,null,(t==null?void 0:t.length)>1&&m.createElement(fr,{clipPath:n?"url(#clipPath-".concat(i,")"):void 0},m.createElement(ld,Mu({},b,{id:p,points:t,connectNulls:d,type:s,baseLine:r,layout:a,stroke:"none",className:"recharts-area-area"})),u!=="none"&&m.createElement(ld,Mu({},y,{className:"recharts-area-curve",layout:a,type:s,connectNulls:d,fill:"none",points:t})),u!=="none"&&f&&m.createElement(ld,Mu({},y,{className:"recharts-area-curve",layout:a,type:s,connectNulls:d,fill:"none",points:r}))),m.createElement(vOe,{points:t,props:v,clipPathId:i}))}function bOe(e){var{alpha:t,baseLine:r,points:n,strokeWidth:i}=e,o=n[0].y,a=n[n.length-1].y;if(!wr(o)||!wr(a))return null;var s=t*Math.abs(o-a),u=Math.max(...n.map(d=>d.x||0));return Ue(r)?u=Math.max(r,u):r&&Array.isArray(r)&&r.length&&(u=Math.max(...r.map(d=>d.x||0),u)),Ue(u)?m.createElement("rect",{x:0,y:o<a?o:o-s,width:u+(i?parseInt("".concat(i),10):1),height:Math.floor(s)}):null}function xOe(e){var{alpha:t,baseLine:r,points:n,strokeWidth:i}=e,o=n[0].x,a=n[n.length-1].x;if(!wr(o)||!wr(a))return null;var s=t*Math.abs(o-a),u=Math.max(...n.map(d=>d.y||0));return Ue(r)?u=Math.max(r,u):r&&Array.isArray(r)&&r.length&&(u=Math.max(...r.map(d=>d.y||0),u)),Ue(u)?m.createElement("rect",{x:o<a?o:o-s,y:0,width:s,height:Math.floor(u+(i?parseInt("".concat(i),10):1))}):null}function wOe(e){var{alpha:t,layout:r,points:n,baseLine:i,strokeWidth:o}=e;return r==="vertical"?m.createElement(bOe,{alpha:t,points:n,baseLine:i,strokeWidth:o}):m.createElement(xOe,{alpha:t,points:n,baseLine:i,strokeWidth:o})}function SOe(e){var{needClip:t,clipPathId:r,props:n,previousPointsRef:i,previousBaselineRef:o}=e,{points:a,baseLine:s,isAnimationActive:u,animationBegin:d,animationDuration:f,animationEasing:p,onAnimationStart:v,onAnimationEnd:y}=n,b=m.useMemo(()=>({points:a,baseLine:s}),[a,s]),w=cf(b,"recharts-area-"),x=Fve(),[k,$]=m.useState(!1),P=!k,j=m.useCallback(()=>{typeof y=="function"&&y(),$(!1)},[y]),C=m.useCallback(()=>{typeof v=="function"&&v(),$(!0)},[v]);if(x==null)return null;var I=i.current,A=o.current;return m.createElement(yOe,{showLabels:P,points:a},n.children,m.createElement(uf,{animationId:w,begin:d,duration:f,isActive:u,easing:p,onAnimationEnd:j,onAnimationStart:C,key:w},T=>{if(I){var M=I.length/a.length,R=T===1?a:a.map((O,L)=>{var z=Math.floor(L*M);if(I[z]){var F=I[z];return rd(rd({},O),{},{x:Zt(F.x,O.x,T),y:Zt(F.y,O.y,T)})}return O}),D;return Ue(s)?D=Zt(A,s,T):xr(s)||wo(s)?D=Zt(A,0,T):D=s.map((O,L)=>{var z=Math.floor(L*M);if(Array.isArray(A)&&A[z]){var F=A[z];return rd(rd({},O),{},{x:Zt(F.x,O.x,T),y:Zt(F.y,O.y,T)})}return O}),T>0&&(i.current=R,o.current=D),m.createElement(MN,{points:R,baseLine:D,needClip:t,clipPathId:r,props:n})}return T>0&&(i.current=a,o.current=s),m.createElement(fr,null,u&&m.createElement("defs",null,m.createElement("clipPath",{id:"animationClipPath-".concat(r)},m.createElement(wOe,{alpha:T,points:a,baseLine:s,layout:x,strokeWidth:n.strokeWidth}))),m.createElement(fr,{clipPath:"url(#animationClipPath-".concat(r,")")},m.createElement(MN,{points:a,baseLine:s,needClip:t,clipPathId:r,props:n})))}),m.createElement(Gx,{label:n.label}))}function kOe(e){var{needClip:t,clipPathId:r,props:n}=e,i=m.useRef(null),o=m.useRef();return m.createElement(SOe,{needClip:t,clipPathId:r,props:n,previousPointsRef:i,previousBaselineRef:o})}class POe extends m.PureComponent{render(){var{hide:t,dot:r,points:n,className:i,top:o,left:a,needClip:s,xAxisId:u,yAxisId:d,width:f,height:p,id:v,baseLine:y,zIndex:b}=this.props;if(t)return null;var w=ve("recharts-area",i),x=v,{r:k,strokeWidth:$}=_H(r),P=KI(r),j=k*2+$,C=s?"url(#clipPath-".concat(P?"":"dots-").concat(x,")"):void 0;return m.createElement(Qn,{zIndex:b},m.createElement(fr,{className:w},s&&m.createElement("defs",null,m.createElement(YI,{clipPathId:x,xAxisId:u,yAxisId:d}),!P&&m.createElement("clipPath",{id:"clipPath-dots-".concat(x)},m.createElement("rect",{x:a-j/2,y:o-j/2,width:f+j,height:p+j}))),m.createElement(kOe,{needClip:s,clipPathId:x,props:this.props})),m.createElement(s$,{points:n,mainColor:sb(this.props.stroke,this.props.fill),itemDataKey:this.props.dataKey,activeDot:this.props.activeDot,clipPath:C}),this.props.isRange&&Array.isArray(y)&&m.createElement(s$,{points:y,mainColor:sb(this.props.stroke,this.props.fill),itemDataKey:this.props.dataKey,activeDot:this.props.activeDot,clipPath:C}))}}var BH={activeDot:!0,animationBegin:0,animationDuration:1500,animationEasing:"ease",connectNulls:!1,dot:!1,fill:"#3182bd",fillOpacity:.6,hide:!1,isAnimationActive:"auto",legendType:"line",stroke:"#3182bd",strokeWidth:1,type:"linear",label:!1,xAxisId:0,yAxisId:0,zIndex:Wr.area};function $Oe(e){var t,r=Er(e,BH),{activeDot:n,animationBegin:i,animationDuration:o,animationEasing:a,connectNulls:s,dot:u,fill:d,fillOpacity:f,hide:p,isAnimationActive:v,legendType:y,stroke:b,xAxisId:w,yAxisId:x}=r,k=LH(r,cOe),$=uc(),P=RK(),{needClip:j}=t0(w,x),C=hn(),{points:I,isRange:A,baseLine:T}=(t=Le(z=>lOe(z,w,x,C,e.id)))!==null&&t!==void 0?t:{},M=e0();if($!=="horizontal"&&$!=="vertical"||M==null||P!=="AreaChart"&&P!=="ComposedChart")return null;var{height:R,width:D,x:O,y:L}=M;return!I||!I.length?null:m.createElement(POe,Mu({},k,{activeDot:n,animationBegin:i,animationDuration:o,animationEasing:a,baseLine:T,connectNulls:s,dot:u,fill:d,fillOpacity:f,height:R,hide:p,layout:$,isAnimationActive:v==="auto"?!lf.isSsr:v,isRange:A,legendType:y,needClip:j,points:I,stroke:b,width:D,left:O,top:L,xAxisId:w,yAxisId:x}))}var COe=(e,t,r,n,i)=>{var o=r??t;if(Ue(o))return o;var a=e==="horizontal"?i:n,s=a.scale.domain();if(a.type==="number"){var u=Math.max(s[0],s[1]),d=Math.min(s[0],s[1]);return o==="dataMin"?d:o==="dataMax"||u<0?u:Math.max(Math.min(s[0],s[1]),0)}return o==="dataMin"?s[0]:o==="dataMax"?s[1]:s[0]};function jOe(e){var{areaSettings:{connectNulls:t,baseValue:r,dataKey:n},stackedData:i,layout:o,chartBaseValue:a,xAxis:s,yAxis:u,displayedData:d,dataStartIndex:f,xAxisTicks:p,yAxisTicks:v,bandSize:y}=e,b=i&&i.length,w=COe(o,a,r,s,u),x=o==="horizontal",k=!1,$=d.map((j,C)=>{var I;b?I=i[f+C]:(I=Xt(j,n),Array.isArray(I)?k=!0:I=[w,I]);var A=I[1]==null||b&&!t&&Xt(j,n)==null;return x?{x:Iy({axis:s,ticks:p,bandSize:y,entry:j,index:C}),y:A?null:u.scale(I[1]),value:I,payload:j}:{x:A?null:s.scale(I[1]),y:Iy({axis:u,ticks:v,bandSize:y,entry:j,index:C}),value:I,payload:j}}),P;return b||k?P=$.map(j=>{var C=Array.isArray(j.value)?j.value[0]:null;return x?{x:j.x,y:C!=null&&j.y!=null?u.scale(C):null,payload:j.payload}:{x:C!=null?s.scale(C):null,y:j.y,payload:j.payload}}):P=x?u.scale(w):s.scale(w),{points:$,baseLine:P,isRange:k}}function EOe(e){var t=Er(e,BH),r=hn();return m.createElement(Qx,{id:t.id,type:"area"},n=>m.createElement(m.Fragment,null,m.createElement(ZI,{legendPayload:mOe(t)}),m.createElement(gOe,{dataKey:t.dataKey,data:t.data,stroke:t.stroke,strokeWidth:t.strokeWidth,fill:t.fill,name:t.name,hide:t.hide,unit:t.unit,tooltipType:t.tooltipType}),m.createElement(XI,{type:"area",id:n,data:t.data,dataKey:t.dataKey,xAxisId:t.xAxisId,yAxisId:t.yAxisId,zAxisId:0,stackId:c8(t.stackId),hide:t.hide,barSize:void 0,baseValue:t.baseValue,isPanorama:r,connectNulls:t.connectNulls}),m.createElement($Oe,Mu({},t,{id:n}))))}var cd=m.memo(EOe,Pm);cd.displayName="Area";var IOe=["domain","range"],OOe=["domain","range"];function RN(e,t){if(e==null)return{};var r,n,i=_Oe(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n<o.length;n++)r=o[n],t.indexOf(r)===-1&&{}.propertyIsEnumerable.call(e,r)&&(i[r]=e[r])}return i}function _Oe(e,t){if(e==null)return{};var r={};for(var n in e)if({}.hasOwnProperty.call(e,n)){if(t.indexOf(n)!==-1)continue;r[n]=e[n]}return r}function DN(e,t){return e===t?!0:Array.isArray(e)&&e.length===2&&Array.isArray(t)&&t.length===2?e[0]===t[0]&&e[1]===t[1]:!1}function FH(e,t){if(e===t)return!0;var{domain:r,range:n}=e,i=RN(e,IOe),{domain:o,range:a}=t,s=RN(t,OOe);return!DN(r,o)||!DN(n,a)?!1:Pm(i,s)}var AOe=["dangerouslySetInnerHTML","ticks"],TOe=["id"];function u$(){return u$=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},u$.apply(null,arguments)}function zN(e,t){if(e==null)return{};var r,n,i=MOe(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n<o.length;n++)r=o[n],t.indexOf(r)===-1&&{}.propertyIsEnumerable.call(e,r)&&(i[r]=e[r])}return i}function MOe(e,t){if(e==null)return{};var r={};for(var n in e)if({}.hasOwnProperty.call(e,n)){if(t.indexOf(n)!==-1)continue;r[n]=e[n]}return r}function ROe(e){var t=ir(),r=m.useRef(null);return m.useLayoutEffect(()=>{r.current===null?t(fCe(e)):r.current!==e&&t(pCe({prev:r.current,next:e})),r.current=e},[e,t]),m.useLayoutEffect(()=>()=>{r.current&&(t(hCe(r.current)),r.current=null)},[t]),null}var DOe=e=>{var{xAxisId:t,className:r}=e,n=Le(kE),i=hn(),o="xAxis",a=Le(x=>Cl(x,o,t,i)),s=Le(x=>pK(x,o,t,i)),u=Le(x=>uK(x,t)),d=Le(x=>bSe(x,t)),f=Le(x=>K9(x,t));if(u==null||d==null||f==null)return null;var{dangerouslySetInnerHTML:p,ticks:v}=e,y=zN(e,AOe),{id:b}=f,w=zN(f,TOe);return m.createElement(JI,u$({},y,w,{scale:a,x:d.x,y:d.y,width:u.width,height:u.height,className:ve("recharts-".concat(o," ").concat(o),r),viewBox:n,ticks:s,axisType:o}))},zOe={allowDataOverflow:wn.allowDataOverflow,allowDecimals:wn.allowDecimals,allowDuplicatedCategory:wn.allowDuplicatedCategory,angle:wn.angle,axisLine:ss.axisLine,height:wn.height,hide:!1,includeHidden:wn.includeHidden,interval:wn.interval,minTickGap:wn.minTickGap,mirror:wn.mirror,orientation:wn.orientation,padding:wn.padding,reversed:wn.reversed,scale:wn.scale,tick:wn.tick,tickCount:wn.tickCount,tickLine:ss.tickLine,tickSize:ss.tickSize,type:wn.type,xAxisId:0},NOe=e=>{var t=Er(e,zOe);return m.createElement(m.Fragment,null,m.createElement(ROe,{allowDataOverflow:t.allowDataOverflow,allowDecimals:t.allowDecimals,allowDuplicatedCategory:t.allowDuplicatedCategory,angle:t.angle,dataKey:t.dataKey,domain:t.domain,height:t.height,hide:t.hide,id:t.xAxisId,includeHidden:t.includeHidden,interval:t.interval,minTickGap:t.minTickGap,mirror:t.mirror,name:t.name,orientation:t.orientation,padding:t.padding,reversed:t.reversed,scale:t.scale,tick:t.tick,tickCount:t.tickCount,tickFormatter:t.tickFormatter,ticks:t.ticks,type:t.type,unit:t.unit}),m.createElement(DOe,t))},Ol=m.memo(NOe,FH);Ol.displayName="XAxis";var LOe=["dangerouslySetInnerHTML","ticks"],BOe=["id"];function c$(){return c$=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},c$.apply(null,arguments)}function NN(e,t){if(e==null)return{};var r,n,i=FOe(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n<o.length;n++)r=o[n],t.indexOf(r)===-1&&{}.propertyIsEnumerable.call(e,r)&&(i[r]=e[r])}return i}function FOe(e,t){if(e==null)return{};var r={};for(var n in e)if({}.hasOwnProperty.call(e,n)){if(t.indexOf(n)!==-1)continue;r[n]=e[n]}return r}function UOe(e){var t=ir(),r=m.useRef(null);return m.useLayoutEffect(()=>{r.current===null?t(mCe(e)):r.current!==e&&t(gCe({prev:r.current,next:e})),r.current=e},[e,t]),m.useLayoutEffect(()=>()=>{r.current&&(t(vCe(r.current)),r.current=null)},[t]),null}var WOe=e=>{var{yAxisId:t,className:r,width:n,label:i}=e,o=m.useRef(null),a=m.useRef(null),s=Le(kE),u=hn(),d=ir(),f="yAxis",p=Le(C=>Cl(C,f,t,u)),v=Le(C=>cK(C,t)),y=Le(C=>wSe(C,t)),b=Le(C=>pK(C,f,t,u)),w=Le(C=>H9(C,t));if(m.useLayoutEffect(()=>{if(!(n!=="auto"||!v||LI(i)||m.isValidElement(i)||w==null)){var C=o.current;if(C){var I=C.getCalculatedWidth();Math.round(v.width)!==Math.round(I)&&d(yCe({id:t,width:I}))}}},[b,v,d,i,t,n,w]),v==null||y==null||w==null)return null;var{dangerouslySetInnerHTML:x,ticks:k}=e,$=NN(e,LOe),{id:P}=w,j=NN(w,BOe);return m.createElement(JI,c$({},$,j,{ref:o,labelRef:a,scale:p,x:y.x,y:y.y,tickTextProps:n==="auto"?{width:void 0}:{width:n},width:v.width,height:v.height,className:ve("recharts-".concat(f," ").concat(f),r),viewBox:s,ticks:b,axisType:f}))},KOe={allowDataOverflow:Sn.allowDataOverflow,allowDecimals:Sn.allowDecimals,allowDuplicatedCategory:Sn.allowDuplicatedCategory,angle:Sn.angle,axisLine:ss.axisLine,hide:!1,includeHidden:Sn.includeHidden,interval:Sn.interval,minTickGap:Sn.minTickGap,mirror:Sn.mirror,orientation:Sn.orientation,padding:Sn.padding,reversed:Sn.reversed,scale:Sn.scale,tick:Sn.tick,tickCount:Sn.tickCount,tickLine:ss.tickLine,tickSize:ss.tickSize,type:Sn.type,width:Sn.width,yAxisId:0},HOe=e=>{var t=Er(e,KOe);return m.createElement(m.Fragment,null,m.createElement(UOe,{interval:t.interval,id:t.yAxisId,scale:t.scale,type:t.type,domain:t.domain,allowDataOverflow:t.allowDataOverflow,dataKey:t.dataKey,allowDuplicatedCategory:t.allowDuplicatedCategory,allowDecimals:t.allowDecimals,tickCount:t.tickCount,padding:t.padding,includeHidden:t.includeHidden,reversed:t.reversed,ticks:t.ticks,width:t.width,orientation:t.orientation,mirror:t.mirror,hide:t.hide,unit:t.unit,name:t.name,angle:t.angle,minTickGap:t.minTickGap,tick:t.tick,tickFormatter:t.tickFormatter}),m.createElement(WOe,t))},ls=m.memo(HOe,FH);ls.displayName="YAxis";var VOe=(e,t)=>t,tO=ce([VOe,At,U9,gn,IK,js,D1e,pn],W1e),rO=e=>{var t=e.currentTarget.getBoundingClientRect(),r=t.width/e.currentTarget.offsetWidth,n=t.height/e.currentTarget.offsetHeight;return{chartX:Math.round((e.clientX-t.left)/r),chartY:Math.round((e.clientY-t.top)/n)}},UH=So("mouseClick"),WH=im();WH.startListening({actionCreator:UH,effect:(e,t)=>{var r=e.payload,n=tO(t.getState(),rO(r));(n==null?void 0:n.activeIndex)!=null&&t.dispatch(RSe({activeIndex:n.activeIndex,activeDataKey:void 0,activeCoordinate:n.activeCoordinate}))}});var d$=So("mouseMove"),KH=im(),vv=null;KH.startListening({actionCreator:d$,effect:(e,t)=>{var r=e.payload;vv!==null&&cancelAnimationFrame(vv);var n=rO(r);vv=requestAnimationFrame(()=>{var i=t.getState(),o=EI(i,i.tooltip.settings.shared);if(o==="axis"){var a=tO(i,n);(a==null?void 0:a.activeIndex)!=null?t.dispatch(wK({activeIndex:a.activeIndex,activeDataKey:void 0,activeCoordinate:a.activeCoordinate})):t.dispatch(xK())}vv=null})}});var LN={accessibilityLayer:!0,barCategoryGap:"10%",barGap:4,barSize:void 0,className:void 0,maxBarSize:void 0,stackOffset:"none",syncId:void 0,syncMethod:"index",baseValue:void 0,reverseStackOrder:!1},HH=Oi({name:"rootProps",initialState:LN,reducers:{updateOptions:(e,t)=>{var r;e.accessibilityLayer=t.payload.accessibilityLayer,e.barCategoryGap=t.payload.barCategoryGap,e.barGap=(r=t.payload.barGap)!==null&&r!==void 0?r:LN.barGap,e.barSize=t.payload.barSize,e.maxBarSize=t.payload.maxBarSize,e.stackOffset=t.payload.stackOffset,e.syncId=t.payload.syncId,e.syncMethod=t.payload.syncMethod,e.className=t.payload.className,e.baseValue=t.payload.baseValue,e.reverseStackOrder=t.payload.reverseStackOrder}}}),qOe=HH.reducer,{updateOptions:GOe}=HH.actions,VH=Oi({name:"polarOptions",initialState:null,reducers:{updatePolarOptions:(e,t)=>t.payload}}),{updatePolarOptions:ZOe}=VH.actions,XOe=VH.reducer,qH=So("keyDown"),GH=So("focus"),nO=im();nO.startListening({actionCreator:qH,effect:(e,t)=>{var r=t.getState(),n=r.rootProps.accessibilityLayer!==!1;if(n){var{keyboardInteraction:i}=r.tooltip,o=e.payload;if(!(o!=="ArrowRight"&&o!=="ArrowLeft"&&o!=="Enter")){var a=II(i,yf(r),ym(r),Sm(r)),s=a==null?-1:Number(a);if(!(!Number.isFinite(s)||s<0)){var u=js(r);if(o==="Enter"){var d=Yy(r,"axis","hover",String(i.index));t.dispatch(JP({active:!i.active,activeIndex:i.index,activeDataKey:i.dataKey,activeCoordinate:d}));return}var f=$Se(r),p=f==="left-to-right"?1:-1,v=o==="ArrowRight"?1:-1,y=s+v*p;if(!(u==null||y>=u.length||y<0)){var b=Yy(r,"axis","hover",String(y));t.dispatch(JP({active:!0,activeIndex:y.toString(),activeDataKey:void 0,activeCoordinate:b}))}}}}}});nO.startListening({actionCreator:GH,effect:(e,t)=>{var r=t.getState(),n=r.rootProps.accessibilityLayer!==!1;if(n){var{keyboardInteraction:i}=r.tooltip;if(!i.active&&i.index==null){var o="0",a=Yy(r,"axis","hover",String(o));t.dispatch(JP({activeDataKey:void 0,active:!0,activeIndex:o,activeCoordinate:a}))}}}});var lo=So("externalEvent"),ZH=im(),q1=new Map;ZH.startListening({actionCreator:lo,effect:(e,t)=>{var{handler:r,reactEvent:n}=e.payload;if(r!=null){n.persist();var i=n.type,o=q1.get(i);o!==void 0&&cancelAnimationFrame(o);var a=requestAnimationFrame(()=>{try{var s=t.getState(),u={activeCoordinate:w1e(s),activeDataKey:MI(s),activeIndex:jl(s),activeLabel:AK(s),activeTooltipIndex:jl(s),isTooltipActive:S1e(s)};r(u,n)}finally{q1.delete(i)}});q1.set(i,a)}}});var YOe=ce([vf],e=>e.tooltipItemPayloads),QOe=ce([YOe,xm,(e,t,r)=>t,(e,t,r)=>r],(e,t,r,n)=>{var i=e.find(s=>s.settings.dataKey===n);if(i!=null){var{positions:o}=i;if(o!=null){var a=t(o,r);return a}}}),XH=So("touchMove"),YH=im();YH.startListening({actionCreator:XH,effect:(e,t)=>{var r=e.payload;if(!(r.touches==null||r.touches.length===0)){var n=t.getState(),i=EI(n,n.tooltip.settings.shared);if(i==="axis"){var o=tO(n,rO({clientX:r.touches[0].clientX,clientY:r.touches[0].clientY,currentTarget:r.currentTarget}));(o==null?void 0:o.activeIndex)!=null&&t.dispatch(wK({activeIndex:o.activeIndex,activeDataKey:void 0,activeCoordinate:o.activeCoordinate}))}else if(i==="item"){var a,s=r.touches[0];if(document.elementFromPoint==null)return;var u=document.elementFromPoint(s.clientX,s.clientY);if(!u||!u.getAttribute)return;var d=u.getAttribute(f8),f=(a=u.getAttribute(p8))!==null&&a!==void 0?a:void 0,p=QOe(t.getState(),d,f);t.dispatch(bK({activeDataKey:f,activeIndex:d,activeCoordinate:p}))}}}});var JOe=TW({brush:hEe,cartesianAxis:bCe,chartData:bke,errorBars:NCe,graphicalItems:C$e,layout:Gge,legend:rye,options:mke,polarAxis:KPe,polarOptions:XOe,referenceElements:zEe,rootProps:qOe,tooltip:DSe,zIndex:nke}),e_e=function(t){return bge({reducer:JOe,preloadedState:t,middleware:r=>{var n;return r({serializableCheck:!1,immutableCheck:!["commonjs","es6","production"].includes((n="es6")!==null&&n!==void 0?n:"")}).concat([WH.middleware,KH.middleware,nO.middleware,ZH.middleware,YH.middleware])},enhancers:r=>{var n=r;return typeof r=="function"&&(n=r()),n.concat(GW({type:"raf"}))},devTools:lf.devToolsEnabled})};function QH(e){var{preloadedState:t,children:r,reduxStoreName:n}=e,i=hn(),o=m.useRef(null);if(i)return r;o.current==null&&(o.current=e_e(t));var a=hE;return m.createElement(aje,{context:a,store:o.current},r)}function t_e(e){var{layout:t,margin:r}=e,n=ir(),i=hn();return m.useEffect(()=>{i||(n(Hge(t)),n(Kge(r)))},[n,i,t,r]),null}var JH=m.memo(t_e,Pm);function eV(e){var t=ir();return m.useEffect(()=>{t(GOe(e))},[t,e]),null}function BN(e){var{zIndex:t,isPanorama:r}=e,n=r?"recharts-zindex-panorama-":"recharts-zindex-",i=uH("".concat(n).concat(t)),o=ir();return m.useLayoutEffect(()=>(o(tke({zIndex:t,elementId:i,isPanorama:r})),()=>{o(rke({zIndex:t,isPanorama:r}))}),[o,t,i,r]),m.createElement("g",{tabIndex:-1,id:i})}function FN(e){var{children:t,isPanorama:r}=e,n=Le(H1e);if(!n||n.length===0)return t;var i=n.filter(a=>a<0),o=n.filter(a=>a>0);return m.createElement(m.Fragment,null,i.map(a=>m.createElement(BN,{key:a,zIndex:a,isPanorama:r})),t,o.map(a=>m.createElement(BN,{key:a,zIndex:a,isPanorama:r})))}var r_e=["children"];function n_e(e,t){if(e==null)return{};var r,n,i=i_e(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n<o.length;n++)r=o[n],t.indexOf(r)===-1&&{}.propertyIsEnumerable.call(e,r)&&(i[r]=e[r])}return i}function i_e(e,t){if(e==null)return{};var r={};for(var n in e)if({}.hasOwnProperty.call(e,n)){if(t.indexOf(n)!==-1)continue;r[n]=e[n]}return r}function lb(){return lb=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},lb.apply(null,arguments)}var o_e={width:"100%",height:"100%",display:"block"},a_e=m.forwardRef((e,t)=>{var r=$E(),n=CE(),i=O8();if(!Ca(r)||!Ca(n))return null;var{children:o,otherAttributes:a,title:s,desc:u}=e,d,f;return a!=null&&(typeof a.tabIndex=="number"?d=a.tabIndex:d=i?0:void 0,typeof a.role=="string"?f=a.role:f=i?"application":void 0),m.createElement(iE,lb({},a,{title:s,desc:u,role:f,tabIndex:d,width:r,height:n,style:o_e,ref:t}),o)}),s_e=e=>{var{children:t}=e,r=Le(am);if(!r)return null;var{width:n,height:i,y:o,x:a}=r;return m.createElement(iE,{width:n,height:i,x:a,y:o},t)},UN=m.forwardRef((e,t)=>{var{children:r}=e,n=n_e(e,r_e),i=hn();return i?m.createElement(s_e,null,m.createElement(FN,{isPanorama:!0},r)):m.createElement(a_e,lb({ref:t},n),m.createElement(FN,{isPanorama:!1},r))});function l_e(){var e=ir(),[t,r]=m.useState(null),n=Le(dve);return m.useEffect(()=>{if(t!=null){var i=t.getBoundingClientRect(),o=i.width/t.offsetWidth;wr(o)&&o!==n&&e(qge(o))}},[t,e,n]),r}function WN(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function u_e(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?WN(Object(r),!0).forEach(function(n){c_e(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):WN(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function c_e(e,t,r){return(t=d_e(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function d_e(e){var t=f_e(e,"string");return typeof t=="symbol"?t:t+""}function f_e(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Qu(){return Qu=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},Qu.apply(null,arguments)}var p_e=()=>(Eke(),null);function ub(e){if(typeof e=="number")return e;if(typeof e=="string"){var t=parseFloat(e);if(!Number.isNaN(t))return t}return 0}var h_e=m.forwardRef((e,t)=>{var r,n,i=m.useRef(null),[o,a]=m.useState({containerWidth:ub((r=e.style)===null||r===void 0?void 0:r.width),containerHeight:ub((n=e.style)===null||n===void 0?void 0:n.height)}),s=m.useCallback((d,f)=>{a(p=>{var v=Math.round(d),y=Math.round(f);return p.containerWidth===v&&p.containerHeight===y?p:{containerWidth:v,containerHeight:y}})},[]),u=m.useCallback(d=>{if(typeof t=="function"&&t(d),d!=null&&typeof ResizeObserver<"u"){var{width:f,height:p}=d.getBoundingClientRect();s(f,p);var v=b=>{var{width:w,height:x}=b[0].contentRect;s(w,x)},y=new ResizeObserver(v);y.observe(d),i.current=y}},[t,s]);return m.useEffect(()=>()=>{var d=i.current;d!=null&&d.disconnect()},[s]),m.createElement(m.Fragment,null,m.createElement(Px,{width:o.containerWidth,height:o.containerHeight}),m.createElement("div",Qu({ref:u},e)))}),m_e=m.forwardRef((e,t)=>{var{width:r,height:n}=e,[i,o]=m.useState({containerWidth:ub(r),containerHeight:ub(n)}),a=m.useCallback((u,d)=>{o(f=>{var p=Math.round(u),v=Math.round(d);return f.containerWidth===p&&f.containerHeight===v?f:{containerWidth:p,containerHeight:v}})},[]),s=m.useCallback(u=>{if(typeof t=="function"&&t(u),u!=null){var{width:d,height:f}=u.getBoundingClientRect();a(d,f)}},[t,a]);return m.createElement(m.Fragment,null,m.createElement(Px,{width:i.containerWidth,height:i.containerHeight}),m.createElement("div",Qu({ref:s},e)))}),g_e=m.forwardRef((e,t)=>{var{width:r,height:n}=e;return m.createElement(m.Fragment,null,m.createElement(Px,{width:r,height:n}),m.createElement("div",Qu({ref:t},e)))}),v_e=m.forwardRef((e,t)=>{var{width:r,height:n}=e;return hs(r)||hs(n)?m.createElement(m_e,Qu({},e,{ref:t})):m.createElement(g_e,Qu({},e,{ref:t}))});function y_e(e){return e===!0?h_e:v_e}var b_e=m.forwardRef((e,t)=>{var{children:r,className:n,height:i,onClick:o,onContextMenu:a,onDoubleClick:s,onMouseDown:u,onMouseEnter:d,onMouseLeave:f,onMouseMove:p,onMouseUp:v,onTouchEnd:y,onTouchMove:b,onTouchStart:w,style:x,width:k,responsive:$,dispatchTouchEvents:P=!0}=e,j=m.useRef(null),C=ir(),[I,A]=m.useState(null),[T,M]=m.useState(null),R=l_e(),D=PE(),O=(D==null?void 0:D.width)>0?D.width:k,L=(D==null?void 0:D.height)>0?D.height:i,z=m.useCallback(J=>{R(J),typeof t=="function"&&t(J),A(J),M(J),J!=null&&(j.current=J)},[R,t,A,M]),F=m.useCallback(J=>{C(UH(J)),C(lo({handler:o,reactEvent:J}))},[C,o]),B=m.useCallback(J=>{C(d$(J)),C(lo({handler:d,reactEvent:J}))},[C,d]),U=m.useCallback(J=>{C(xK()),C(lo({handler:f,reactEvent:J}))},[C,f]),V=m.useCallback(J=>{C(d$(J)),C(lo({handler:p,reactEvent:J}))},[C,p]),K=m.useCallback(()=>{C(GH())},[C]),Z=m.useCallback(J=>{C(qH(J.key))},[C]),W=m.useCallback(J=>{C(lo({handler:a,reactEvent:J}))},[C,a]),q=m.useCallback(J=>{C(lo({handler:s,reactEvent:J}))},[C,s]),oe=m.useCallback(J=>{C(lo({handler:u,reactEvent:J}))},[C,u]),Y=m.useCallback(J=>{C(lo({handler:v,reactEvent:J}))},[C,v]),H=m.useCallback(J=>{C(lo({handler:w,reactEvent:J}))},[C,w]),X=m.useCallback(J=>{P&&C(XH(J)),C(lo({handler:b,reactEvent:J}))},[C,P,b]),re=m.useCallback(J=>{C(lo({handler:y,reactEvent:J}))},[C,y]),he=y_e($);return m.createElement(BK.Provider,{value:I},m.createElement(G3.Provider,{value:T},m.createElement(he,{width:O??(x==null?void 0:x.width),height:L??(x==null?void 0:x.height),className:ve("recharts-wrapper",n),style:u_e({position:"relative",cursor:"default",width:O,height:L},x),onClick:F,onContextMenu:W,onDoubleClick:q,onFocus:K,onKeyDown:Z,onMouseDown:oe,onMouseEnter:B,onMouseLeave:U,onMouseMove:V,onMouseUp:Y,onTouchEnd:re,onTouchMove:X,onTouchStart:H,ref:z},m.createElement(p_e,null),r)))}),x_e=["width","height","responsive","children","className","style","compact","title","desc"];function w_e(e,t){if(e==null)return{};var r,n,i=S_e(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n<o.length;n++)r=o[n],t.indexOf(r)===-1&&{}.propertyIsEnumerable.call(e,r)&&(i[r]=e[r])}return i}function S_e(e,t){if(e==null)return{};var r={};for(var n in e)if({}.hasOwnProperty.call(e,n)){if(t.indexOf(n)!==-1)continue;r[n]=e[n]}return r}var tV=m.forwardRef((e,t)=>{var{width:r,height:n,responsive:i,children:o,className:a,style:s,compact:u,title:d,desc:f}=e,p=w_e(e,x_e),v=Zn(p);return u?m.createElement(m.Fragment,null,m.createElement(Px,{width:r,height:n}),m.createElement(UN,{otherAttributes:v,title:d,desc:f},o)):m.createElement(b_e,{className:a,style:s,width:r,height:n,responsive:i??!1,onClick:e.onClick,onMouseLeave:e.onMouseLeave,onMouseEnter:e.onMouseEnter,onMouseMove:e.onMouseMove,onMouseDown:e.onMouseDown,onMouseUp:e.onMouseUp,onContextMenu:e.onContextMenu,onDoubleClick:e.onDoubleClick,onTouchStart:e.onTouchStart,onTouchMove:e.onTouchMove,onTouchEnd:e.onTouchEnd},m.createElement(UN,{otherAttributes:v,title:d,desc:f,ref:t},m.createElement(NEe,null,o)))});function f$(){return f$=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},f$.apply(null,arguments)}var k_e={top:5,right:5,bottom:5,left:5},P_e={accessibilityLayer:!0,barCategoryGap:"10%",barGap:4,layout:"horizontal",margin:k_e,responsive:!1,reverseStackOrder:!1,stackOffset:"none",syncMethod:"index"},iO=m.forwardRef(function(t,r){var n,i=Er(t.categoricalChartProps,P_e),{chartName:o,defaultTooltipEventType:a,validateTooltipEventTypes:s,tooltipPayloadSearcher:u,categoricalChartProps:d}=t,f={chartName:o,defaultTooltipEventType:a,validateTooltipEventTypes:s,tooltipPayloadSearcher:u,eventEmitter:void 0};return m.createElement(QH,{preloadedState:{options:f},reduxStoreName:(n=d.id)!==null&&n!==void 0?n:o},m.createElement(yH,{chartData:d.data}),m.createElement(JH,{layout:i.layout,margin:i.margin}),m.createElement(eV,{baseValue:i.baseValue,accessibilityLayer:i.accessibilityLayer,barCategoryGap:i.barCategoryGap,maxBarSize:i.maxBarSize,stackOffset:i.stackOffset,barGap:i.barGap,barSize:i.barSize,syncId:i.syncId,syncMethod:i.syncMethod,className:i.className,reverseStackOrder:i.reverseStackOrder}),m.createElement(tV,f$({},i,{ref:r})))}),$_e=["axis"],C_e=m.forwardRef((e,t)=>m.createElement(iO,{chartName:"LineChart",defaultTooltipEventType:"axis",validateTooltipEventTypes:$_e,tooltipPayloadSearcher:Vx,categoricalChartProps:e,ref:t})),j_e=["axis","item"],oO=m.forwardRef((e,t)=>m.createElement(iO,{chartName:"BarChart",defaultTooltipEventType:"axis",validateTooltipEventTypes:j_e,tooltipPayloadSearcher:Vx,categoricalChartProps:e,ref:t}));function E_e(e){var t=ir();return m.useEffect(()=>{t(ZOe(e))},[t,e]),null}var I_e=["layout"];function p$(){return p$=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},p$.apply(null,arguments)}function O_e(e,t){if(e==null)return{};var r,n,i=__e(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n<o.length;n++)r=o[n],t.indexOf(r)===-1&&{}.propertyIsEnumerable.call(e,r)&&(i[r]=e[r])}return i}function __e(e,t){if(e==null)return{};var r={};for(var n in e)if({}.hasOwnProperty.call(e,n)){if(t.indexOf(n)!==-1)continue;r[n]=e[n]}return r}var A_e={top:5,right:5,bottom:5,left:5},rV={accessibilityLayer:!0,stackOffset:"none",barCategoryGap:"10%",barGap:4,margin:A_e,reverseStackOrder:!1,syncMethod:"index",layout:"radial",responsive:!1,cx:"50%",cy:"50%",innerRadius:0,outerRadius:"80%"},T_e=m.forwardRef(function(t,r){var n,i=Er(t.categoricalChartProps,rV),{layout:o}=i,a=O_e(i,I_e),{chartName:s,defaultTooltipEventType:u,validateTooltipEventTypes:d,tooltipPayloadSearcher:f}=t,p={chartName:s,defaultTooltipEventType:u,validateTooltipEventTypes:d,tooltipPayloadSearcher:f,eventEmitter:void 0};return m.createElement(QH,{preloadedState:{options:p},reduxStoreName:(n=i.id)!==null&&n!==void 0?n:s},m.createElement(yH,{chartData:i.data}),m.createElement(JH,{layout:o,margin:i.margin}),m.createElement(eV,{baseValue:void 0,accessibilityLayer:i.accessibilityLayer,barCategoryGap:i.barCategoryGap,maxBarSize:i.maxBarSize,stackOffset:i.stackOffset,barGap:i.barGap,barSize:i.barSize,syncId:i.syncId,syncMethod:i.syncMethod,className:i.className,reverseStackOrder:i.reverseStackOrder}),m.createElement(E_e,{cx:i.cx,cy:i.cy,startAngle:i.startAngle,endAngle:i.endAngle,innerRadius:i.innerRadius,outerRadius:i.outerRadius}),m.createElement(tV,p$({},a,{ref:r})))});function KN(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function HN(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?KN(Object(r),!0).forEach(function(n){M_e(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):KN(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function M_e(e,t,r){return(t=R_e(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function R_e(e){var t=D_e(e,"string");return typeof t=="symbol"?t:t+""}function D_e(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var z_e=["item"],N_e=HN(HN({},rV),{},{layout:"centric",startAngle:0,endAngle:360}),L_e=m.forwardRef((e,t)=>{var r=Er(e,N_e);return m.createElement(T_e,{chartName:"PieChart",defaultTooltipEventType:"item",validateTooltipEventTypes:z_e,tooltipPayloadSearcher:Vx,categoricalChartProps:r,ref:t})}),B_e=["axis"],aO=m.forwardRef((e,t)=>m.createElement(iO,{chartName:"AreaChart",defaultTooltipEventType:"axis",validateTooltipEventTypes:B_e,tooltipPayloadSearcher:Vx,categoricalChartProps:e,ref:t}));const F_e=200,U_e=6e4;function nV({open:e,cacheKey:t,summary:r,baseQuery:n,onClose:i,onPrev:o,onNext:a,onCleared:s}){const u=t??"",d=Kr(),f=m.useMemo(()=>({enabled:e&&!!u}),[e,u]),p=rn("GET /__rrroutes/cache",f),v=rn("POST /__rrroutes/cache/clear"),y=m.useMemo(()=>{if(!u)return;const we={...n,keys:[u],cursor:void 0,pageSize:F_e,orderBy:"timestamp",orderDirection:"asc"};return VN(we)},[n,u]),b=m.useMemo(()=>{if(!u)return;const we={...n,keys:[u],cursor:void 0};return VN(we)},[n,u]),{data:w,isLoading:x,error:k,refetch:$}=p.useEndpoint(y?{query:y}:{query:{}}),P=m.useMemo(()=>W_e(w),[w]),[j,C]=m.useState(U_e),[I,A]=m.useState(!0),[T,M]=m.useState(!0),[R,D]=m.useState(!0),[O,L]=m.useState(!1),[z,F]=m.useState(!1),B=m.useMemo(()=>K_e(P,j),[P,j]),U=m.useMemo(()=>H_e(P),[P]),V=m.useMemo(()=>V_e(P),[P]),K=m.useMemo(()=>q_e(P),[P]),Z=m.useMemo(()=>({totalHits:(r==null?void 0:r.totalHits)??V.totalHits,totalMisses:(r==null?void 0:r.totalMisses)??V.totalMisses,totalSets:(r==null?void 0:r.totalSets)??V.totalSets,lastHitAt:(r==null?void 0:r.lastHitAt)??V.lastHitAt,lastMissAt:(r==null?void 0:r.lastMissAt)??V.lastMissAt,lastSetAt:(r==null?void 0:r.lastSetAt)??V.lastSetAt}),[r,V]),W=r==null?void 0:r.sizeBytes,[q,oe]=m.useState(!1),[Y,H]=m.useState(!1),[X,re]=m.useState(null),[he,J]=m.useState(!1);m.useEffect(()=>{oe(!1),H(!1),re(null),J(!1)},[u]);const ge=()=>oe(!1),Se=async()=>{if(!(!u||!b)){H(!0),re(null);try{await v.fetch({query:b},""),J(!0),s==null||s(u),$()}catch(we){const ze=we instanceof Error?we.message:"Failed to clear cache.";re(ze)}finally{H(!1),oe(!1)}}},se={hits:d.palette.success.main,misses:d.palette.error.main,sets:d.palette.info.main},Pe=O||z,ke=we=>O&&!z?`${we.toFixed(0)}%`:!O&&z?`${we.toFixed(0)} ms`:O&&z?we.toFixed(0):"",$e=[{label:"10s",value:1e4},{label:"30s",value:3e4},{label:"1m",value:6e4},{label:"5m",value:5*6e4},{label:"15m",value:15*6e4},{label:"1h",value:60*6e4}];return h.jsx(sf,{open:e,onClose:i,onPrev:o,onNext:a,title:u?`Cache key: ${u}`:"Cache key details",children:u?h.jsxs(ue,{spacing:3,children:[x&&h.jsx(Bb,{}),k?h.jsx(xa,{severity:"error",action:h.jsx(zt,{color:"inherit",size:"small",onClick:()=>$(),children:"Retry"}),children:"Failed to load cache activity for this key."}):null,h.jsxs(ue,{spacing:1,children:[h.jsx(ne,{variant:"subtitle2",children:"Summary"}),h.jsxs(Be,{sx:{display:"grid",gridTemplateColumns:{xs:"repeat(2, minmax(0, 1fr))",sm:"repeat(3, minmax(0, 1fr))"},gap:2},children:[h.jsx(zi,{label:"Total hits",value:Z.totalHits}),h.jsx(zi,{label:"Total misses",value:Z.totalMisses}),h.jsx(zi,{label:"Total sets",value:Z.totalSets}),h.jsx(zi,{label:"Last hit",value:G1(Z.lastHitAt)}),h.jsx(zi,{label:"Last miss",value:G1(Z.lastMissAt)}),h.jsx(zi,{label:"Last set",value:G1(Z.lastSetAt)}),h.jsx(zi,{label:"Approx. size",value:W!=null?Z1(W):"Unknown"}),h.jsx(zi,{label:"Hit latency avg (ms)",value:Vc(K.hits.avgDurationMs)}),h.jsx(zi,{label:"Hit latency p50 (ms)",value:Vc(K.hits.p50DurationMs)}),h.jsx(zi,{label:"Hit latency p95 (ms)",value:Vc(K.hits.p95DurationMs)}),h.jsx(zi,{label:"Miss latency avg (ms)",value:Vc(K.misses.avgDurationMs)}),h.jsx(zi,{label:"Miss latency p50 (ms)",value:Vc(K.misses.p50DurationMs)}),h.jsx(zi,{label:"Miss latency p95 (ms)",value:Vc(K.misses.p95DurationMs)})]})]}),h.jsxs(ue,{spacing:1,children:[h.jsxs(Be,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center",flexWrap:"wrap",gap:1.5},children:[h.jsx(ne,{variant:"subtitle2",children:"Timeline"}),h.jsxs(ue,{direction:"row",spacing:1.5,alignItems:"center",children:[h.jsx(ne,{variant:"caption",color:"text.secondary",children:"Bucket size"}),h.jsx(uC,{exclusive:!0,size:"small",value:j,onChange:(we,ze)=>{typeof ze=="number"&&C(ze)},children:$e.map(we=>h.jsx(pu,{value:we.value,sx:{px:1},children:we.label},we.value))})]})]}),h.jsxs(gie,{row:!0,sx:{gap:1,flexWrap:"wrap"},children:[h.jsx(fp,{control:h.jsx(Zc,{size:"small",checked:I,onChange:we=>A(we.target.checked)}),label:"Hits"}),h.jsx(fp,{control:h.jsx(Zc,{size:"small",checked:T,onChange:we=>M(we.target.checked)}),label:"Misses"}),h.jsx(fp,{control:h.jsx(Zc,{size:"small",checked:R,onChange:we=>D(we.target.checked)}),label:"Sets"}),h.jsx(fp,{control:h.jsx(Zc,{size:"small",checked:O,onChange:we=>L(we.target.checked)}),label:"Hit rate"}),h.jsx(fp,{control:h.jsx(Zc,{size:"small",checked:z,onChange:we=>F(we.target.checked)}),label:"Latency (avg)"})]}),h.jsx(Be,{sx:{height:320},children:B.length?h.jsx(vl,{width:"100%",height:"100%",children:h.jsxs(aO,{data:B,margin:{left:0,right:16,top:8,bottom:8},children:[h.jsx(Il,{stroke:"rgba(255,255,255,0.08)"}),h.jsx(Ol,{dataKey:"timestamp",type:"number",tickFormatter:we=>Ep(we),tick:{fill:"rgba(255,255,255,0.7)",fontSize:12},tickLine:!1,axisLine:!1,domain:["dataMin","dataMax"]}),h.jsx(ls,{yAxisId:"left",allowDecimals:!1,tick:{fill:"rgba(255,255,255,0.7)",fontSize:12},tickLine:!1,axisLine:!1}),Pe&&h.jsx(ls,{yAxisId:"right",orientation:"right",tick:{fill:"rgba(255,255,255,0.7)",fontSize:12},tickLine:!1,axisLine:!1,tickFormatter:ke}),h.jsx(bl,{contentStyle:{backgroundColor:"#1e1b23",borderColor:"rgba(255,255,255,0.12)"},labelFormatter:we=>Ep(we)}),R&&h.jsx(cd,{type:"monotone",dataKey:"sets",yAxisId:"left",stackId:"1",stroke:se.sets,fill:se.sets,fillOpacity:.35,name:"Sets"}),I&&h.jsx(cd,{type:"monotone",dataKey:"hits",yAxisId:"left",stackId:"1",stroke:se.hits,fill:se.hits,fillOpacity:.5,name:"Hits"}),T&&h.jsx(cd,{type:"monotone",dataKey:"misses",yAxisId:"left",stackId:"1",stroke:se.misses,fill:se.misses,fillOpacity:.4,name:"Misses"}),O&&h.jsx(Lv,{type:"monotone",dataKey:"hitRate",yAxisId:"right",stroke:d.palette.warning.main,dot:!1,name:"Hit rate (%)",strokeWidth:1.5}),z&&h.jsx(Lv,{type:"monotone",dataKey:"avgDurationMs",yAxisId:"right",stroke:d.palette.secondary.main,dot:!1,name:"Avg latency (ms)",strokeWidth:1.5}),h.jsx(xH,{dataKey:"timestamp",height:24,travellerWidth:10,stroke:d.palette.primary.main,tickFormatter:we=>Ep(we)})]})}):h.jsx(Be,{sx:{height:"100%",border:"1px dashed",borderColor:"divider",borderRadius:2,display:"flex",alignItems:"center",justifyContent:"center",color:"text.secondary",textAlign:"center",px:2},children:"No cache activity recorded for this key within the selected filters."})})]}),U.length>0&&h.jsxs(ue,{spacing:1,children:[h.jsx(ne,{variant:"subtitle2",children:"Size over time"}),h.jsx(Be,{sx:{height:200},children:h.jsx(vl,{width:"100%",height:"100%",children:h.jsxs(C_e,{data:U,margin:{left:0,right:16,top:8,bottom:8},children:[h.jsx(Il,{stroke:"rgba(255,255,255,0.08)"}),h.jsx(Ol,{dataKey:"timestamp",type:"number",tickFormatter:we=>Ep(we),tick:{fill:"rgba(255,255,255,0.7)",fontSize:12},tickLine:!1,axisLine:!1,domain:["dataMin","dataMax"]}),h.jsx(ls,{tick:{fill:"rgba(255,255,255,0.7)",fontSize:12},tickLine:!1,axisLine:!1,tickFormatter:we=>Z1(we)}),h.jsx(bl,{contentStyle:{backgroundColor:"#1e1b23",borderColor:"rgba(255,255,255,0.12)"},labelFormatter:we=>Ep(we),formatter:we=>[Z1(we),"Size"]}),h.jsx(Lv,{type:"monotone",dataKey:"sizeBytes",stroke:d.palette.info.main,dot:!1,name:"Size"})]})})})]}),h.jsxs(ue,{spacing:1,children:[h.jsx(ne,{variant:"subtitle2",children:"Actions"}),he?h.jsx(xa,{severity:"success",children:"Cache cleared for this key."}):null,X?h.jsx(xa,{severity:"error",children:X}):null,q?h.jsxs(ue,{spacing:1,children:[h.jsxs(xa,{severity:"warning",children:["This will remove cached data for"," ",h.jsx(ne,{component:"span",fontWeight:600,children:u}),". This action cannot be undone."]}),h.jsxs(ue,{direction:{xs:"column",sm:"row"},spacing:1,alignItems:"flex-start",children:[h.jsx(zt,{variant:"contained",color:"error",onClick:Se,disabled:Y,children:Y?"Clearing...":"Confirm clear"}),h.jsx(zt,{onClick:ge,disabled:Y,children:"Cancel"})]})]}):h.jsx(zt,{variant:"outlined",color:"error",onClick:()=>oe(!0),children:"Clear cache for this key"})]})]}):h.jsx(ne,{color:"text.secondary",children:"Select a cache entry to inspect its history."})})}function VN(e){const t={};return Object.entries(e).forEach(([r,n])=>{n!=null&&(t[r]=n)}),t}function W_e(e){return e?Array.isArray(e.pages)?e.pages.flatMap(t=>Array.isArray(t==null?void 0:t.out)?t.out:[]):Array.isArray(e.out)?e.out:[]:[]}function K_e(e,t){if(!e.length||t<=0)return[];const r=[...e].sort((i,o)=>i.createdAt-o.createdAt),n=new Map;for(const i of r){const o=Math.floor(i.createdAt/t)*t;let a=n.get(o);a||(a={timestamp:o,hits:0,misses:0,sets:0,durationSumMs:0,durationCount:0},n.set(o,a)),i.operation==="hit"&&(a.hits+=1),i.operation==="miss"&&(a.misses+=1),i.operation==="set"&&(a.sets+=1),typeof i.durationMs=="number"&&Number.isFinite(i.durationMs)&&(a.durationSumMs+=i.durationMs,a.durationCount+=1)}return Array.from(n.values()).sort((i,o)=>i.timestamp-o.timestamp).map(i=>{const o=i.hits+i.misses,a=o?i.hits/o*100:0,s=i.durationCount>0?i.durationSumMs/i.durationCount:null;return{timestamp:i.timestamp,hits:i.hits,misses:i.misses,sets:i.sets,totalRequests:o,hitRate:a,avgDurationMs:s}})}function H_e(e){const t=[];for(const r of e)r.operation==="set"&&typeof r.size=="number"&&t.push({timestamp:r.createdAt,sizeBytes:r.size});return t.sort((r,n)=>r.timestamp-n.timestamp),t}function V_e(e){return e.reduce((t,r)=>(r.operation==="hit"?(t.totalHits+=1,t.lastHitAt=Math.max(t.lastHitAt??0,r.createdAt)):r.operation==="miss"?(t.totalMisses+=1,t.lastMissAt=Math.max(t.lastMissAt??0,r.createdAt)):r.operation==="set"&&(t.totalSets+=1,t.lastSetAt=Math.max(t.lastSetAt??0,r.createdAt)),t),{totalHits:0,totalMisses:0,totalSets:0,lastHitAt:null,lastMissAt:null,lastSetAt:null})}function q_e(e){const t=[],r=[];for(const n of e)typeof n.durationMs!="number"||!Number.isFinite(n.durationMs)||(n.operation==="hit"?t.push(n.durationMs):n.operation==="miss"&&r.push(n.durationMs));return{hits:qN(t),misses:qN(r)}}function qN(e){if(!e.length)return{avgDurationMs:null,p50DurationMs:null,p95DurationMs:null};const t=[...e].sort((o,a)=>o-a),r=e.reduce((o,a)=>o+a,0)/e.length,n=GN(t,.5),i=GN(t,.95);return{avgDurationMs:r,p50DurationMs:n,p95DurationMs:i}}function GN(e,t){if(!e.length)return null;if(t<=0)return e[0];if(t>=1)return e[e.length-1];const r=Math.floor((e.length-1)*t);return e[r]}function G1(e){if(!e)return"—";try{return new Date(e).toLocaleString()}catch{return"—"}}function Ep(e){const t=typeof e=="number"?e:Number(e);if(!Number.isFinite(t))return"";try{return new Date(t).toLocaleString()}catch{return""}}function Z1(e){if(!e||!Number.isFinite(e))return"—";const t=["B","KB","MB","GB","TB"],r=Math.min(Math.floor(Math.log(e)/Math.log(1024)),t.length-1);return`${(e/1024**r).toFixed(r===0?0:2)} ${t[r]}`}function Vc(e){return e==null||!Number.isFinite(e)?"—":e<1||e<10?e.toFixed(2):e.toFixed(1)}function zi({label:e,value:t}){return h.jsxs(Be,{sx:{border:"1px solid",borderColor:"divider",borderRadius:2,p:1.5},children:[h.jsx(ne,{variant:"caption",color:"text.secondary",children:e}),h.jsx(ne,{variant:"body1",sx:{mt:.5,fontFamily:"monospace"},children:typeof t=="number"?t.toLocaleString():t})]})}function iV({log:e,onClose:t}){const[r,n]=m.useState(!1),[i,o]=m.useState(!1),a=new Date(e.createdAt).toLocaleString(),s=new Date(e.updatedAt).toLocaleString();return h.jsxs(h.Fragment,{children:[h.jsx(sf,{open:!0,onClose:t,title:`Cache log: ${e.name} · ${e.operation.toUpperCase()} · ${a} `,children:h.jsxs(ue,{spacing:3,children:[h.jsx(Be,{children:h.jsx(zt,{variant:"outlined",size:"small",onClick:()=>n(!0),children:"View key history"})}),h.jsxs(ue,{spacing:1,children:[h.jsx(ne,{variant:"subtitle2",children:"Log details"}),h.jsxs(Be,{sx:{display:"grid",gridTemplateColumns:{xs:"repeat(1, minmax(0, 1fr))",sm:"repeat(2, minmax(0, 1fr))"},gap:2},children:[h.jsx(Zs,{label:"Key",children:h.jsx(ne,{component:"span",sx:{fontFamily:"monospace",fontSize:"0.9rem"},children:e.name})}),h.jsx(Zs,{label:"Operation",children:h.jsx(ne,{component:"span",sx:{textTransform:"uppercase"},children:e.operation})}),h.jsx(Zs,{label:"Size",children:h.jsx(ne,{component:"span",sx:{fontFamily:"monospace",fontSize:"0.9rem"},children:G_e(e.size)})}),h.jsx(Zs,{label:"Log ID",children:h.jsx(ne,{component:"span",sx:{fontFamily:"monospace",fontSize:"0.8rem"},children:e.id})}),h.jsx(Zs,{label:"Group ID",children:e.groupId?h.jsx(ne,{component:"span",sx:{fontFamily:"monospace",fontSize:"0.8rem"},children:e.groupId}):h.jsx(ZN,{children:"None"})}),h.jsx(Zs,{label:"Tags",children:e.tags&&e.tags.length>0?h.jsx(ue,{direction:"row",spacing:.5,flexWrap:"wrap",useFlexGap:!0,children:e.tags.map(u=>h.jsx(dr,{label:u,size:"small",variant:"outlined"},u))}):h.jsx(ZN,{children:"None"})}),h.jsx(Zs,{label:"Created at",children:h.jsx(ne,{component:"span",children:a})}),h.jsx(Zs,{label:"Updated at",children:h.jsx(ne,{component:"span",children:s})})]}),e.description?h.jsxs(Be,{sx:{mt:1},children:[h.jsx(ne,{variant:"caption",color:"text.secondary",children:"Description"}),h.jsx(ne,{variant:"body2",sx:{mt:.5},children:e.description})]}):null]}),h.jsx(zu,{}),h.jsxs(ue,{spacing:1,children:[h.jsx(ne,{variant:"subtitle2",children:"Cached value"}),h.jsxs(ne,{variant:"body2",color:"text.secondary",children:["This is the value associated with"," ",h.jsx(ne,{component:"span",sx:{fontFamily:"monospace",fontSize:"0.9rem"},children:e.name})," ","for this log entry."]}),h.jsx(ai,{value:e.value,title:"Value"})]}),h.jsx(zu,{}),h.jsxs(ec,{expanded:i,onChange:()=>o(u=>!u),disableGutters:!0,sx:{border:"1px solid",borderColor:i?"primary.main":"divider",borderRadius:2,bgcolor:"background.default","&::before":{display:"none"}},children:[h.jsx(rc,{expandIcon:h.jsx(ea,{}),children:h.jsx(ne,{variant:"subtitle2",children:"Raw log paylod"})}),h.jsx(tc,{children:i?h.jsx(ai,{value:e,collapsedLines:16}):null})]})]})}),r&&h.jsx(nV,{open:r,cacheKey:e.name,summary:void 0,baseQuery:{},onClose:()=>n(!1)})]})}function Zs({label:e,children:t}){return h.jsxs(Be,{children:[h.jsx(ne,{variant:"caption",color:"text.secondary",children:e}),h.jsx(Be,{sx:{mt:.25},children:t})]})}function ZN({children:e}){return h.jsx(ne,{variant:"body2",color:"text.disabled",component:"span",children:e})}function G_e(e){if(!e||!Number.isFinite(e))return"—";const t=["B","KB","MB","GB","TB"],r=Math.min(Math.floor(Math.log(e)/Math.log(1024)),t.length-1);return`${(e/1024**r).toFixed(r===0?0:2)} ${t[r]}`}const Z_e={info:"#42a5f5",warning:"#ffa726",error:"#ef5350",debug:"#ab47bc",trace:"#26a69a"};function Cm({level:e,state:t,selected:r,onClick:n}){const i=Kr(),o=Z_e[e],a=t??(r?"include":"display"),s=a==="exclude",u=a==="none",d=s?i.palette.error.main:o,f=s?Pi(d,.3):u?void 0:Pi(o,.2);return h.jsx(dr,{label:e.toUpperCase(),size:"small",variant:"outlined",clickable:!!n,onClick:n,sx:{borderColor:d,color:d,bgcolor:f,fontWeight:600,opacity:u?.7:1}})}const X_e=200;function oV({open:e,groupId:t,baseQuery:r,triggerLog:n,onClose:i,onPrev:o,onNext:a}){const[s,u]=m.useState(!1),[d,f]=m.useState(null);m.useEffect(()=>{e||(u(!1),f(null))},[e]),m.useEffect(()=>{u(!1)},[t]);const p=m.useMemo(()=>{if(t)return{...r,groupsInclude:[t],cursor:void 0,pageSize:X_e,orderBy:"timestamp",orderDirection:"asc"}},[r,t]),v=m.useMemo(()=>e&&!!t,[e,t]),y=rn("GET /__rrroutes/logs",{enabled:v,cursorParam:"cursor",getNextPageParam:()=>{}}),{data:b,isLoading:w,error:x,refetch:k}=y.useEndpoint(p?{query:p}:{query:r}),$=m.useMemo(()=>!v||!b?[]:b==null?void 0:b.pages.flatMap(O=>O.out),[b,v]),P=m.useMemo(()=>n!=null&&n.groupId?n.groupId:(XN(n==null?void 0:n.meta)||$.map(L=>XN(L.meta)).find(L=>!!L))??void 0,[$,n]),j=rn("GET /__rrroutes/requests",m.useMemo(()=>({enabled:e&&!!t&&!P,cursorParam:"cursor",getNextPageParam:()=>{}}),[e,t,P])),C=m.useMemo(()=>{if(!(!t||P))return J_e({...r,groups:[t],cursor:void 0,pageSize:1})},[r,t,P]),{data:I}=j.useEndpoint(C?{query:C}:{query:r}),A=m.useMemo(()=>{const O=eAe(I);return O.length?O[0].id:void 0},[I]),T=P??A;m.useEffect(()=>{if(!e)return;const O=(n==null?void 0:n.id)??null,L=!!O&&$.some(F=>F.id===O);if(!(d&&$.some(F=>F.id===d))){if(L&&O){f(O);return}if($.length){f($[0].id);return}f(null)}},[e,n==null?void 0:n.id,$,d]);const M=m.useMemo(()=>d?$.find(O=>O.id===d)||((n==null?void 0:n.id)===d?n:null):n??$[0]??null,[d,$,n]),R=t?h.jsxs(ue,{direction:"row",spacing:1,alignItems:"center",children:[h.jsx(ne,{variant:"subtitle2",color:"text.secondary",children:"Log group"}),T?h.jsx(zt,{size:"small",color:"primary",onClick:()=>u(!0),sx:{textTransform:"none",fontFamily:"monospace",px:1},children:t}):h.jsx(ne,{sx:{fontFamily:"monospace"},children:t})]}):"Log group details",D=()=>{const O=$.length>1;return h.jsxs(Be,{sx:{display:"flex",flexDirection:{xs:"column",md:"row"},gap:2,minHeight:360,maxHeight:{xs:"80vh",md:"70vh"},overflow:"hidden"},children:[O&&h.jsx(Be,{sx:{maxHeight:"100%"},children:h.jsx(Y_e,{logs:$,activeId:d,onSelect:f})}),h.jsx(Be,{sx:{flex:1,display:"flex",flexDirection:"column",minHeight:0,overflow:"hidden"},children:h.jsx(Be,{sx:{flex:1,overflowY:"auto",p:2,bgcolor:"background.paper",display:"flex",flexDirection:"column",gap:2},children:h.jsxs(h.Fragment,{children:[x&&h.jsx(ia,{onRetry:k}),M&&h.jsx(Q_e,{log:M})]})})})]})};return h.jsxs(h.Fragment,{children:[h.jsx(sf,{scroll:"none",open:e,onClose:i,onPrev:o,onNext:a,title:R,children:D()}),h.jsx(Em,{open:s&&!!T,request:null,requestId:T,onClose:()=>u(!1)})]})}function Y_e({logs:e,activeId:t,onSelect:r}){const n=m.useRef(null),i=m.useRef(!1);return m.useEffect(()=>{i.current=!1,n.current=null},[e]),m.useEffect(()=>{!t||i.current||!e.some(a=>a.id===t)||n.current&&(i.current=!0,n.current.scrollIntoView({block:"nearest",inline:"nearest",behavior:"smooth"}))},[t,e]),h.jsxs(ue,{spacing:1.5,sx:{width:{xs:"100%",md:280},flexShrink:0,border:"1px solid",borderColor:"divider",borderRadius:2,p:1.5,maxHeight:{xs:"100%"},overflowY:"auto",bgcolor:"background.default"},children:[h.jsxs(ue,{direction:"row",spacing:1,alignItems:"center",children:[h.jsx(ne,{variant:"subtitle2",children:"Related logs"}),h.jsx(dr,{size:"small",label:e.length})]}),h.jsx(ne,{variant:"caption",color:"text.secondary",children:"Ordered by timestamp"}),h.jsx(ue,{spacing:1,children:e.map(o=>{const a=o.id===t;return h.jsx(Mn,{ref:a?n:void 0,onClick:()=>r(o.id),sx:{width:"100%",textAlign:"left",borderRadius:2,border:"1px solid",borderColor:a?"primary.main":"divider",bgcolor:a?"action.selected":"background.paper",p:1.5,display:"block",alignSelf:"stretch"},children:h.jsxs(ue,{spacing:.5,children:[h.jsxs(ue,{direction:"row",spacing:1,alignItems:"center",children:[h.jsx(Cm,{level:o.level}),h.jsx(ne,{variant:"caption",color:"text.secondary",children:tAe(o.createdAt)})]}),h.jsx(ne,{variant:"body2",noWrap:!0,sx:{fontFamily:"monospace"},children:o.name||"Untitled log"}),h.jsx(ne,{variant:"caption",color:"text.secondary",noWrap:!0,children:sO(o)})]})},o.id)})})]})}function Q_e({log:e}){var i,o;const[t,r]=m.useState(!1),n=sO(e);return h.jsxs(ue,{spacing:2,children:[h.jsxs(ue,{spacing:1,children:[h.jsxs(ue,{direction:{xs:"column",sm:"row"},spacing:1,justifyContent:"space-between",alignItems:{xs:"flex-start",sm:"center"},children:[h.jsxs(ue,{direction:"row",spacing:1,alignItems:"center",children:[h.jsx(Cm,{level:e.level}),h.jsx(ne,{variant:"h6",sx:{fontFamily:"monospace"},children:e.name||"Untitled log"})]}),h.jsx(ne,{variant:"body2",color:"text.secondary",children:new Date(e.createdAt).toLocaleString()})]}),h.jsxs(Be,{sx:{borderRadius:2,border:"1px solid",borderColor:"divider",bgcolor:"background.paper",p:2},children:[h.jsx(ne,{variant:"caption",color:"text.secondary",children:"Message"}),h.jsx(ne,{variant:"body2",sx:{mt:.5,whiteSpace:"pre-wrap"},children:n})]})]}),(i=e.tags)!=null&&i.length?h.jsxs(ue,{spacing:.5,children:[h.jsx(ne,{variant:"caption",color:"text.secondary",children:"Tags"}),h.jsx(ue,{direction:"row",spacing:.5,flexWrap:"wrap",useFlexGap:!0,children:e.tags.map(a=>h.jsx(dr,{label:a,size:"small"},a))})]}):null,h.jsxs(Be,{sx:{display:"grid",gridTemplateColumns:{xs:"repeat(2, minmax(0, 1fr))",sm:"repeat(3, minmax(0, 1fr))"},gap:2},children:[h.jsx(qc,{label:"Log ID",value:e.id,monospace:!0}),h.jsx(qc,{label:"Level",value:e.level.toUpperCase()}),h.jsx(qc,{label:"Timestamp",value:new Date(e.createdAt).toLocaleString()}),h.jsx(qc,{label:"Group ID",value:e.groupId??"—",monospace:!0}),h.jsx(qc,{label:"Name",value:e.name??"—",monospace:!0}),h.jsx(qc,{label:"Tags count",value:(o=e.tags)!=null&&o.length?String(e.tags.length):"0"})]}),e.meta!==void 0?h.jsx(ai,{title:"Metadata",value:e.meta,collapsedLines:16}):null,h.jsxs(ec,{expanded:t,onChange:()=>r(a=>!a),disableGutters:!0,sx:{border:"1px solid",borderColor:t?"primary.main":"divider",borderRadius:2,bgcolor:"background.default","&::before":{display:"none"}},children:[h.jsx(rc,{expandIcon:h.jsx(ea,{}),children:h.jsx(ne,{variant:"subtitle2",children:"Raw log paylod"})}),h.jsx(tc,{children:t?h.jsx(ai,{value:e,collapsedLines:16}):null})]})]})}function qc({label:e,value:t,monospace:r}){return h.jsxs(ue,{spacing:.5,children:[h.jsx(ne,{variant:"caption",color:"text.secondary",children:e}),h.jsx(ne,{variant:"body2",sx:{fontFamily:r?"monospace":void 0},children:t??"—"})]})}function sO(e){if(e.description)return e.description;if(typeof e.meta=="string")return e.meta;if(e.meta&&typeof e.meta=="object"){const t=e.meta,{message:r}=t;if(typeof r=="string")return r;if(r)try{return JSON.stringify(r)}catch{return String(r)}}return"—"}function XN(e){if(!e||typeof e!="object")return;const t=e;if(typeof t.requestId=="string")return t.requestId;if(t.request&&typeof t.request=="object"&&t.request!==null&&typeof t.request.id=="string")return t.request.id}function J_e(e){const t={};return Object.entries(e).forEach(([r,n])=>{n!=null&&(t[r]=n)}),t}function eAe(e){return e?Array.isArray(e.pages)?e.pages.flatMap(t=>Array.isArray(t==null?void 0:t.out)?t.out:[]):Array.isArray(e.out)?e.out:[]:[]}function tAe(e){try{return new Date(e).toLocaleTimeString()}catch{return"—"}}function rAe(e){const t=Kr(),r=e.toLowerCase();return t.palette.http[r]||t.palette.text.primary}function bf({method:e,state:t,selected:r=!1,onClick:n}){const i=Kr(),o=rAe(e),a=t??(r?"include":"display"),s=a==="exclude",u=a==="none",d=s?i.palette.error.main:o,f=s?Pi(d,.3):u?Pi(o,.08):Pi(o,.35);return h.jsx(dr,{label:e.toUpperCase(),size:"small",variant:"outlined",clickable:!!n,onClick:n,sx:{borderColor:d,color:d,bgcolor:f,fontWeight:600,opacity:u?.7:1},"aria-pressed":a==="include"})}function nAe(e){const t=Kr();return e<0?t.palette.text.secondary:e>=500?t.palette.status.error:e>=400?t.palette.status.warning:e>=300?t.palette.text.secondary:e>=200?t.palette.status.success:t.palette.text.secondary}function jm({status:e,state:t="display",onClick:r}){const n=Kr(),i=nAe(e),o=t==="exclude",a=t==="none",s=o?n.palette.error.main:i;return h.jsx(dr,{label:e>0?e:"—",size:"small",variant:"outlined",onClick:r,sx:{borderColor:a?"divider":s,color:a?"text.secondary":s,bgcolor:t==="display"||t==="include"?Pi(i,.15):o?Pi(s,.25):"transparent",fontWeight:600,cursor:r?"pointer":"default",opacity:a?.75:1}})}const iAe={hit:"#66bb6a",miss:"#ffa726",set:"#42a5f5",delete:"#ef5350"};function lO({operation:e,state:t="display",onClick:r}){const n=Kr(),i=iAe[e],o=t==="exclude",a=t==="none",s=o?n.palette.error.main:i,u=o?Pi(s,.3):t==="display"||t==="include"?Pi(i,.2):"transparent";return h.jsx(dr,{label:e.toUpperCase(),size:"small",onClick:r,variant:"outlined",sx:{borderColor:a?"divider":s,color:a?"text.secondary":s,bgcolor:u,fontWeight:600,opacity:a?.75:1,cursor:r?"pointer":"default"}})}function oAe({events:e,onSelectCache:t,onSelectLog:r,onSelectSocket:n}){if(!e.length)return h.jsx(aAe,{text:"No cache, log, or socket events for this request."});const i=[];for(let u=1;u<e.length;u+=1){const d=e[u].createdAt-e[u-1].createdAt;d>0&&Number.isFinite(d)&&i.push(d)}let o=null,a=null;if(i.length){const u=[...i].sort((v,y)=>v-y),d=u.length-1,f=Math.floor(d/3),p=Math.floor(2*d/3);o=u[f],a=u[p]}const s=u=>!o||!a?null:u<=o?"small":u<=a?"medium":"large";return h.jsx(ue,{spacing:1,children:e.map((u,d)=>{const f=d>0?e[d-1]:void 0,p=f&&isFinite(f.createdAt)&&isFinite(u.createdAt)?u.createdAt-f.createdAt:null,v=p&&p>0?s(p):null;return h.jsx(Be,{sx:{display:"flex",alignItems:"flex-start"},children:h.jsx(Be,{sx:{flex:1,minWidth:0},children:h.jsx(sAe,{event:u,deltaMs:p,deltaSeverity:v,onSelectCache:t,onSelectLog:r,onSelectSocket:n})})},u.id)})})}function aAe({text:e}){return h.jsx(ne,{variant:"body2",color:"text.secondary",children:e})}function sAe({event:e,deltaMs:t,deltaSeverity:r,onSelectCache:n,onSelectLog:i,onSelectSocket:o}){const a=()=>{e.kind==="cache"&&n?n(e.cache):e.kind==="log"&&i?i(e.log):e.kind==="socket"&&o&&o(e.socket)};if(e.kind==="cache"){const{cache:f}=e;return h.jsxs(ue,{direction:"row",sx:{alignItems:"center"},children:[h.jsx(X1,{createdAt:e.createdAt}),h.jsx(Mn,{onClick:a,sx:{textAlign:"left",borderRadius:1.5,border:"1px solid",borderColor:"divider",bgcolor:"background.default",px:1,py:.75,width:"100%"},children:h.jsxs(ue,{spacing:.5,sx:{width:"100%"},children:[h.jsxs(ue,{direction:"row",spacing:.75,children:[h.jsx(lO,{operation:f.operation}),f.name&&h.jsx(ne,{variant:"body2",sx:{fontFamily:"monospace"},noWrap:!0,children:f.name})]}),typeof f.size=="number"&&h.jsxs(ne,{variant:"caption",color:"text.secondary",children:["Size: ",f.size," bytes"]})]})})]})}const s=lAe(t);if(e.kind==="log"){const{log:f}=e,p=uAe(f);return h.jsxs(ue,{direction:"row",sx:{alignItems:"center",gap:1},children:[h.jsx(X1,{createdAt:e.createdAt}),h.jsx(Mn,{onClick:a,sx:{textAlign:"left",borderRadius:1.5,border:"1px solid",borderColor:"divider",bgcolor:"background.default",px:1,py:.75,display:"flex",flex:1},children:h.jsxs(ue,{spacing:.25,sx:{width:"100%"},children:[h.jsxs(ue,{direction:"row",spacing:.75,children:[h.jsxs(ue,{direction:"row",spacing:.75,alignItems:"center",children:[h.jsx(Cm,{level:f.level}),f.name&&h.jsx(ne,{variant:"caption",sx:{fontFamily:"monospace"},noWrap:!0,children:f.name})]}),s&&h.jsx(Be,{component:"span",sx:{ml:.5,px:.75,py:.25,alignContent:"center",borderRadius:999,fontSize:"0.7rem",lineHeight:1.2,bgcolor:YN(r),color:r==="large"?"common.white":"text.primary"},children:s})]}),p&&h.jsx(ne,{variant:"caption",color:"text.secondary",noWrap:!0,sx:{mt:.25},children:p})]})})]})}const{socket:u}=e,d=cAe(u);return h.jsxs(ue,{direction:"row",sx:{alignItems:"center",gap:1},children:[h.jsx(X1,{createdAt:e.createdAt}),h.jsx(Mn,{onClick:a,sx:{textAlign:"left",borderRadius:1.5,border:"1px solid",borderColor:"divider",bgcolor:"background.default",px:1,py:.75,display:"flex",flex:1},children:h.jsxs(ue,{spacing:.25,sx:{width:"100%"},children:[h.jsxs(ue,{direction:"row",spacing:.75,alignItems:"center",children:[h.jsx(ne,{variant:"caption",color:"text.secondary",children:"SOCKET"}),h.jsx(ne,{variant:"caption",sx:{fontFamily:"monospace"},noWrap:!0,children:u.eventName}),s&&h.jsx(Be,{component:"span",sx:{ml:.5,px:.75,py:.25,alignContent:"center",borderRadius:999,fontSize:"0.7rem",lineHeight:1.2,bgcolor:YN(r),color:r==="large"?"common.white":"text.primary"},children:s})]}),d&&h.jsx(ne,{variant:"caption",color:"text.secondary",noWrap:!0,sx:{mt:.25},children:d})]})})]})}function X1({createdAt:e}){return h.jsx(ne,{variant:"caption",color:"text.secondary",children:new Date(e).toLocaleTimeString()})}function lAe(e){if(e==null||!isFinite(e)||e<=0)return null;if(e<1)return"+<1 ms";if(e<1e3)return`+${Math.round(e)} ms`;const t=e/1e3;if(t<60)return`+${t.toFixed(1)} s`;const r=Math.floor(t/60),n=t-r*60;if(r<60)return`+${r}m ${n.toFixed(1)}s`;const i=Math.floor(r/60),o=r-i*60;return`+${i}h ${o}m`}function YN(e){return e?e==="small"?"success.light":e==="medium"?"warning.light":"error.main":"action.hover"}function uAe(e){if(e.description)return e.description;if(typeof e.meta=="string")return e.meta;if(e.meta&&typeof e.meta=="object"){const r=e.meta.message;if(typeof r=="string")return r;if(r)try{return JSON.stringify(r)}catch{return String(r)}}if(e.meta==null)return"";try{return JSON.stringify(e.meta)}catch{return String(e.meta)}}function cAe(e){const t=e.toRoomId&&e.toRoomId.length?`rooms: ${e.toRoomId.join(", ")}`:"";let r="";if(e.message==null)r="";else if(typeof e.message=="string")r=e.message;else try{r=JSON.stringify(e.message)}catch{r=String(e.message)}const i=[t,r].filter(o=>o&&o.trim().length).join(" · ");return i.length<=140?i:`${i.slice(0,139)}…`}function dAe({request:e,caches:t=[],logs:r=[],sockets:n=[],onReplay:i}){const[o,a]=m.useState(null),[s,u]=m.useState(null),[d,f]=m.useState(null),p=m.useMemo(()=>{const v=(t??[]).map(w=>({kind:"cache",id:w.id,createdAt:new Date(w.createdAt).getTime(),cache:w})),y=(r??[]).map(w=>({kind:"log",id:w.id,createdAt:new Date(w.createdAt).getTime(),log:w})),b=(n??[]).map(w=>({kind:"socket",id:w.id,createdAt:new Date(w.createdAt).getTime(),socket:w}));return[...v,...y,...b].sort((w,x)=>w.createdAt-x.createdAt)},[t,r,n]);return h.jsxs(h.Fragment,{children:[h.jsxs(ue,{spacing:3,children:[h.jsxs(ue,{spacing:1,children:[h.jsxs(ue,{direction:"row",spacing:1,alignItems:"center",children:[h.jsx(bf,{method:e.method}),h.jsx(ne,{sx:{fontFamily:"monospace"},children:e.path})]}),h.jsxs(ue,{direction:{xs:"column",sm:"row"},spacing:1,children:[h.jsxs(ue,{direction:"row",spacing:1,alignItems:"center",children:[h.jsx(jm,{status:e.status}),h.jsxs(ne,{variant:"body2",color:"text.secondary",children:[e.durationMs," ms"]})]}),h.jsx(ne,{variant:"body2",color:"text.secondary",children:new Date(e.createdAt).toLocaleString()})]})]}),h.jsx(zu,{}),h.jsxs(_t,{title:"Request",children:[h.jsx(ai,{title:"Params",value:e.params}),h.jsx(ai,{title:"Query",value:e.query}),h.jsx(ai,{title:"Headers",value:e.headers}),h.jsx(ai,{title:"Body",value:e.body})]}),h.jsxs(_t,{title:"Response",children:[h.jsx(ai,{title:"Output",value:e.output}),e.error&&h.jsx(ai,{title:"Error",value:e.error})]}),h.jsx(_t,{title:"Execution timeline",children:h.jsx(oAe,{events:p,onSelectCache:a,onSelectLog:u,onSelectSocket:f})}),i&&h.jsx(_t,{title:"Actions",children:h.jsx(zt,{variant:"contained",startIcon:h.jsx(Tpe,{}),onClick:()=>i(e),children:"Replay in Playground"})})]}),o&&h.jsx(iV,{log:o,onClose:()=>a(null)}),s&&h.jsx(oV,{open:!0,groupId:s.groupId??void 0,baseQuery:{},triggerLog:s,onClose:()=>u(null)}),h.jsx(H3,{open:!!d,event:d,onClose:()=>f(null)})]})}function Em({open:e,request:t,requestId:r,onClose:n,onReplay:i,onPrev:o,onNext:a}){const s=(t==null?void 0:t.id)??r??"",u=m.useMemo(()=>({enabled:e&&!!s}),[e,s]),d=rn("GET /__rrroutes/requests/:requestId",u),{data:f,isLoading:p,error:v,refetch:y}=d.useEndpoint({params:{requestId:s}}),b=(f==null?void 0:f.out)??t??null,w=m.useMemo(()=>({enabled:e&&!!s,cursorParam:"cursor",getNextPageParam:()=>{}}),[e,s]),x=rn("GET /__rrroutes/sockets",w),{data:k}=x.useEndpoint(s?{query:{groupsInclude:[s],cursor:void 0,pageSize:200,orderBy:"timestamp",orderDirection:"asc"}}:{query:{}}),$=m.useMemo(()=>k?Array.isArray(k.pages)?k.pages.flatMap(P=>Array.isArray(P==null?void 0:P.out)?P.out:[]):[]:[],[k]);return h.jsx(sf,{open:e,onClose:n,title:b?`Request ${b.id}`:"Request details",onPrev:o,onNext:a,children:h.jsxs(ue,{spacing:2,children:[p&&h.jsx(Bb,{}),b?h.jsx(dAe,{request:b,caches:f==null?void 0:f.out.caches,logs:f==null?void 0:f.out.logs,sockets:$,onReplay:i}):h.jsx(ne,{color:"text.secondary",children:"Select a request to see details."}),v?h.jsx(xa,{severity:"error",action:h.jsx(zt,{color:"inherit",size:"small",onClick:()=>y(),children:"Retry"}),children:"Failed to load cache and log details."}):null]})})}const fAe=Et(h.jsx("path",{d:"m12 8-6 6 1.41 1.41L12 10.83l4.59 4.58L18 14z"}));function Bv({schema:e,title:t}){return e?h.jsxs(ue,{spacing:1,children:[t&&h.jsx(ne,{variant:"subtitle2",color:"text.primary",children:t}),h.jsx(pAe,{schema:e})]}):h.jsxs(ue,{spacing:.5,children:[t&&h.jsx(ne,{variant:"subtitle2",color:"text.primary",children:t}),h.jsx(ne,{variant:"body2",color:"text.secondary",children:"No schema provided."})]})}function pAe({schema:e}){const[t,r]=m.useReducer((i,o)=>{switch(o.type){case"toggle":return{...i,[o.path]:o.value!==void 0?o.value:!i[o.path]};case"setAll":{const a={},s=(u,d)=>{lV(u)&&(a[d]=o.value),sV(u,d).forEach(({schema:f,path:p})=>s(f,p))};return s(e,"root"),a}default:return i}},{}),n=(i,o)=>{r({type:"toggle",path:i,value:o})};return h.jsxs(ue,{spacing:1,children:[h.jsxs(uB,{size:"small",children:[h.jsx(zt,{onClick:()=>r({type:"setAll",value:!1}),children:"Expand all"}),h.jsx(zt,{onClick:()=>r({type:"setAll",value:!0}),children:"Collapse all"})]}),h.jsx(aV,{schema:e,path:"root",depth:0,collapsed:t,toggle:n})]})}function aV({schema:e,path:t,depth:r,collapsed:n,toggle:i,propertyName:o}){const a=uV(e),s=e.optional||e.nullable,u=m.useMemo(()=>sV(e,t),[e,t]),d=lV(e),f=n[t];return h.jsx(Be,{sx:{borderLeft:r?"1px solid":"none",borderColor:"rgba(255,255,255,0.08)",pl:r?2:0,ml:r?1:0,py:.75},children:h.jsxs(ue,{spacing:.25,children:[h.jsxs(ue,{direction:"row",spacing:1,alignItems:"center",flexWrap:"wrap",children:[d&&h.jsx(qn,{size:"small",onClick:()=>i(t),sx:{p:.25},children:f?h.jsx(ea,{fontSize:"small"}):h.jsx(fAe,{fontSize:"small"})}),o&&h.jsx(ne,{variant:"body2",sx:{fontFamily:"monospace",color:"text.primary"},children:o}),h.jsx(ne,{variant:"body2",color:"text.secondary",children:a}),s&&h.jsxs(ue,{direction:"row",spacing:.5,useFlexGap:!0,flexWrap:"wrap",children:[e.optional&&h.jsx(QN,{label:"optional"}),e.nullable&&h.jsx(QN,{label:"nullable"})]})]}),e.description&&h.jsx(ne,{variant:"caption",color:"text.secondary",children:e.description}),!f&&u.map(({schema:p,propertyName:v,path:y})=>h.jsx(aV,{schema:p,propertyName:v,path:y,depth:r+1,collapsed:n,toggle:i},y))]})})}function sV(e,t){var r;switch(e.kind){case"object":return e.properties?Object.entries(e.properties).map(([n,i])=>({schema:i,propertyName:n,path:`${t}.${n}`})):[];case"array":return e.element?[{schema:e.element,propertyName:"items",path:`${t}.items`}]:[];case"union":return((r=e.union)==null?void 0:r.map((n,i)=>({schema:n,propertyName:`option ${i+1}`,path:`${t}.option${i+1}`})))??[];default:return[]}}function lV(e){return["object","array","union"].includes(e.kind)}function uV(e){switch(e.kind){case"object":return"object";case"array":return`array<${e.element?uV(e.element):"unknown"}>`;case"enum":return"enum";case"union":return"union";case"literal":return"literal";default:return e.kind}}function QN({label:e}){return h.jsx(Be,{component:"span",sx:{border:"1px solid",borderColor:"divider",borderRadius:1,px:.75,py:.25,fontSize:"0.7rem",textTransform:"uppercase",letterSpacing:.5,color:"text.secondary"},children:e})}const cV=Et(h.jsx("path",{d:"M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6z"})),cb=Et(h.jsx("path",{d:"M8 5v14l11-7z"})),dV=Et(h.jsx("path",{d:"M6 19c0 1.1.9 2 2 2h8c1.1 0 2-.9 2-2V7H6zM8 9h8v10H8zm7.5-5-1-1h-5l-1 1H5v2h14V4z"}));function fV({method:e,path:t,contract:r,summary:n,onOpenStandalone:i}){const{fetch:o}=rf(),{addRun:a,getLastRun:s,consumePrefill:u}=sx(),[d,f]=m.useState(null),[p,v]=m.useState(!1),[y,b]=m.useState(null),w=()=>({params:yv(r==null?void 0:r.params),query:yv(r==null?void 0:r.query),body:r!=null&&r.body?JSON.stringify({},null,2):""}),[x,k]=m.useState(w);m.useEffect(()=>{const C=u({method:e,path:t});k(C?{params:eL(yv(r==null?void 0:r.params),C.params),query:eL(yv(r==null?void 0:r.query),C.query),body:hAe(C.body,!!(r!=null&&r.body))}:w()),f(null),b(null)},[u,e,t]);const $=m.useMemo(()=>s({method:e,path:t,id:d}),[d,e,t,s]),P=async()=>{var A;let C;if(x.body)try{C=JSON.parse(x.body),b(null)}catch{b("Invalid JSON body");return}const I=`run-${Date.now()}`;f(I),v(!0);try{const T=await o(e,t,x,I),M=tL(x.params),R=tL(x.query);a({id:T.id,method:T.log.method,path:T.log.path,createdAt:T.log.createdAt,durationMs:T.log.durationMs,status:T.log.status,response:T.log.output,errorMessage:(A=T.error)==null?void 0:A.message,headers:T.log.headers,request:{params:M,query:R,body:C,headers:{}}})}catch(T){console.error("Playground run failed",T)}finally{v(!1)}},j=()=>{i==null||i(x)};return h.jsxs(ue,{spacing:3,children:[h.jsxs(ue,{spacing:.5,children:[h.jsxs(ne,{variant:"h6",children:[e.toUpperCase()," ",t]}),n?h.jsx(ne,{variant:"body2",color:"text.secondary",children:n}):null]}),h.jsx(ne,{variant:"body1",color:"text.secondary",children:"Execute this endpoint directly and inspect the response. Use the contract as a guide when filling params, query, and body."}),h.jsxs(ue,{spacing:2,children:[h.jsx(JN,{title:"Path parameters",rows:x.params,onChange:C=>k(I=>({...I,params:C}))}),h.jsx(JN,{title:"Query parameters",rows:x.query,onChange:C=>k(I=>({...I,query:C}))}),h.jsxs(ec,{defaultExpanded:!0,children:[h.jsx(rc,{expandIcon:h.jsx(ea,{}),children:h.jsx(ne,{variant:"subtitle1",children:"Body"})}),h.jsx(tc,{children:h.jsx(Vt,{placeholder:"JSON body",multiline:!0,minRows:8,fullWidth:!0,value:x.body,onChange:C=>k(I=>({...I,body:C.target.value})),error:!!y,helperText:y||"Leave empty for no body"})})]})]}),h.jsxs(ue,{direction:"row",spacing:1,justifyContent:"flex-end",children:[i?h.jsx(zt,{variant:"outlined",onClick:j,children:"Open playground screen"}):null,h.jsx(zt,{variant:"contained",onClick:P,disabled:p,startIcon:h.jsx(cb,{}),children:p?"Running...":"Run"})]}),h.jsx(zu,{}),h.jsxs(ue,{spacing:2,children:[h.jsx(ne,{variant:"h6",children:"Last run"}),$?h.jsxs(ue,{spacing:2,children:[h.jsxs(ue,{direction:"row",spacing:2,alignItems:"center",children:[h.jsx(jm,{status:$.status}),h.jsxs(ne,{variant:"body2",color:"text.secondary",children:["Duration: ",$.durationMs," ms"]}),h.jsxs(ne,{variant:"body2",color:"text.secondary",children:["Ran at ",new Date($.createdAt).toLocaleTimeString()]})]}),$.errorMessage&&h.jsxs(ne,{color:"error",children:["Error: ",$.errorMessage]}),h.jsx(ai,{value:$.response,title:"Response body"})]}):h.jsx(ne,{color:"text.secondary",children:"Run the endpoint to see output."})]})]})}function JN({title:e,rows:t,onChange:r}){const n=(a,s)=>{const u=t.map((d,f)=>f===a?{...d,...s}:d);r(u)},i=a=>{const s=t.filter((u,d)=>d!==a);r(s)},o=()=>{r([...t,{key:"",value:"",enabled:!0}])};return h.jsxs(ec,{defaultExpanded:!0,children:[h.jsx(rc,{expandIcon:h.jsx(ea,{}),children:h.jsx(ne,{variant:"subtitle1",children:e})}),h.jsx(tc,{children:h.jsxs(ue,{spacing:1.5,children:[t.length===0&&h.jsx(ne,{variant:"body2",color:"text.secondary",children:'No fields defined. Use "Add" to create one.'}),t.map((a,s)=>h.jsxs(ue,{direction:{xs:"column",sm:"row"},spacing:1,alignItems:"center",children:[h.jsx(Zc,{checked:a.enabled,onChange:u=>n(s,{enabled:u.target.checked})}),h.jsx(Vt,{label:"Key",value:a.key,onChange:u=>n(s,{key:u.target.value}),sx:{flexGrow:1}}),h.jsx(Vt,{label:"Value",value:a.value,onChange:u=>n(s,{value:u.target.value}),sx:{flexGrow:2}}),h.jsx(qn,{onClick:()=>i(s),children:h.jsx(dV,{})})]},`${a.key}-${s}`)),h.jsx(zt,{size:"small",variant:"outlined",startIcon:h.jsx(cV,{}),onClick:o,sx:{alignSelf:"flex-start"},children:"Add field"})]})})]})}function eL(e,t){if(!t)return e;const r=e.map(o=>{const a=t[o.key];return a==null?o:{...o,value:String(a),enabled:!0}}),n=new Set(e.map(o=>o.key)),i=Object.entries(t).filter(([o])=>!n.has(o)).map(([o,a])=>({key:o,value:a==null?"":String(a),enabled:!0}));return[...r,...i]}function yv(e){return e?e.kind==="object"&&e.properties?Object.keys(e.properties).map(t=>({key:t,value:"",enabled:!0})):[]:[]}function tL(e){return e.reduce((t,r)=>(r.enabled&&r.key.trim()&&(t[r.key.trim()]=r.value),t),{})}function hAe(e,t){if(e==null)return t?JSON.stringify({},null,2):"";if(typeof e=="string")return e;try{return JSON.stringify(e,null,2)}catch{return t?JSON.stringify({},null,2):""}}function pV({requests:e,onSelect:t}){return h.jsx(oc,{component:Yn,variant:"outlined",children:h.jsxs(nc,{size:"small",children:[h.jsx(ac,{children:h.jsxs(Ii,{children:[h.jsx(Oe,{children:"Timestamp"}),h.jsx(Oe,{children:"Method"}),h.jsx(Oe,{children:"Path"}),h.jsx(Oe,{children:"Status"}),h.jsx(Oe,{align:"right",children:"Duration"})]})}),h.jsx(ic,{children:e.map((r,n)=>h.jsxs(Ii,{hover:!0,sx:{cursor:"pointer"},onClick:()=>t(r,n),children:[h.jsx(Oe,{children:new Date(r.createdAt).toLocaleString()}),h.jsx(Oe,{children:h.jsx(bf,{method:r.method})}),h.jsx(Oe,{sx:{fontFamily:"monospace"},children:r.path}),h.jsx(Oe,{children:h.jsx(jm,{status:r.status})}),h.jsxs(Oe,{align:"right",children:[r.durationMs," ms"]})]},r.id))})]})})}const mAe=30,rL=10;function gAe({method:e,path:t,onSelectRequest:r,onRequestsChange:n}){const[i,o]=m.useState(!1),a=rn("GET /__rrroutes/requests",{cursorParam:"cursor",getNextPageParam(k){var $;return($=k.meta)==null?void 0:$.nextCursor},enabled:!!(e&&t)}),{data:s,isLoading:u,error:d,refetch:f,fetchNextPage:p,hasNextPage:v,isFetchingNextPage:y}=a.useEndpoint({query:{endpointKeysInclude:t&&e?[`${e} ${t}`]:[],pageSize:mAe}});m.useEffect(()=>{o(!1)},[e]);const b=m.useMemo(()=>s?(Array.isArray(s.pages)?s.pages:[]).flatMap($=>Array.isArray($==null?void 0:$.out)?$.out:[]).sort(($,P)=>P.createdAt-$.createdAt):[],[s]);m.useEffect(()=>{n==null||n(b)},[b,n]);const w=i?b:b.slice(0,rL),x=(k,$)=>{const P=i?$:b.findIndex(j=>j.id===k.id);r(k,P>=0?P:$)};return h.jsx(_t,{title:"Requests feed",actions:b.length>rL?h.jsx(zt,{size:"small",onClick:()=>o(k=>!k),startIcon:h.jsx(ea,{}),children:i?"Collapse":"Show more"}):null,children:h.jsxs(ue,{spacing:2,children:[(u||y)&&h.jsx(Bb,{}),d?h.jsxs(ec,{defaultExpanded:!0,children:[h.jsx(rc,{expandIcon:h.jsx(ea,{}),children:h.jsx(ne,{color:"error",children:"Failed to load requests"})}),h.jsx(tc,{children:h.jsxs(ue,{spacing:1,children:[h.jsx(ne,{variant:"body2",color:"text.secondary",children:d instanceof Error?d.message:"Unable to fetch request feed."}),h.jsx(zt,{size:"small",onClick:()=>f(),children:"Retry"})]})})]}):null,t&&e?b.length===0&&!u?h.jsx(Be,{sx:{py:3},children:h.jsx(ne,{variant:"body2",color:"text.secondary",align:"center",children:"No recent requests for this endpoint."})}):h.jsx(pV,{requests:w,onSelect:x}):h.jsx(ne,{variant:"body2",color:"text.secondary",children:"Endpoint identifier missing."}),i&&v?h.jsx(zt,{size:"small",onClick:()=>p(),disabled:y,children:y?"Loading…":"Load more"}):null]})})}function vAe({endpoint:e}){return h.jsxs(ue,{spacing:1,children:[h.jsxs(ue,{direction:"row",spacing:1.5,alignItems:"center",flexWrap:"wrap",useFlexGap:!0,children:[h.jsx(bf,{method:e.method}),h.jsx(ne,{variant:"h6",sx:{fontFamily:"monospace",color:"text.primary"},children:e.path}),h.jsx(dr,{label:e.stability,size:"small",color:"secondary",sx:{textTransform:"capitalize"}})]}),e.summary&&h.jsx(ne,{variant:"body2",color:"text.secondary",children:e.summary})]})}function yAe({data:e}){const t=Kr(),r=e.map(n=>({...n,date:new Date(n.timestamp)}));return r.length?h.jsx(Be,{sx:{height:260},children:h.jsx(vl,{width:"100%",height:"100%",children:h.jsxs(aO,{data:r,children:[h.jsx(Il,{stroke:"rgba(255,255,255,0.1)",strokeDasharray:"3 3"}),h.jsx(Ol,{dataKey:"date",tickFormatter:n=>new Date(n).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"}),tick:{fill:t.palette.text.secondary,fontSize:12},axisLine:!1,tickLine:!1}),h.jsx(ls,{tick:{fill:t.palette.text.secondary,fontSize:12},axisLine:!1,tickLine:!1,allowDecimals:!1}),h.jsx(bl,{labelFormatter:n=>new Date(n).toLocaleString(),formatter:n=>[`${n} requests`,"Volume"],contentStyle:{backgroundColor:t.palette.background.paper,borderColor:t.palette.divider}}),h.jsx(cd,{type:"monotone",dataKey:"count",stroke:t.palette.primary.main,fill:t.palette.primary.main,fillOpacity:.22,strokeWidth:2})]})})}):h.jsx(Be,{sx:{py:4,textAlign:"center",color:"text.secondary"},children:"No volume data available."})}const nL=[{key:"request",label:"Request"},{key:"response",label:"Response"},{key:"meta",label:"Meta"},{key:"metrics",label:"Metrics"},{key:"playground",label:"Details & Playground"}];function hV({endpointId:e,onOpenStandalone:t,hidePlaygroundTab:r=!1,activeTab:n,onTabChange:i}){const o=na(),{queuePrefill:a}=sx(),[s,u]=m.useState("request"),[d,f]=m.useState([]),[p,v]=m.useState(null),y=n??s,b=m.useMemo(()=>({enabled:!!e}),[e]),w=rn("GET /__rrroutes/endpoints/:endpointId",b),x=r?nL.filter(z=>z.key!=="playground"):nL;m.useEffect(()=>{r&&y==="playground"&&(i==null||i("request"),n===void 0&&u("request"))},[r,y,i,n]);const k=m.useMemo(()=>{if(e==null)return"";const[z,F]=e.split(" ");return Rd(z,F,!0)},[e]),{data:$,isLoading:P,error:j,refetch:C}=w.useEndpoint({params:{endpointId:k}});m.useEffect(()=>{p&&!d.some(z=>z.id===p)&&v(null)},[d,p]);const I=p?d.findIndex(z=>z.id===p):-1,A=I>=0?d[I]:null,T=I>0,M=I>=0&&I<d.length-1,R=()=>{T&&v(d[I-1].id)},D=()=>{M&&v(d[I+1].id)},O=z=>{a({method:z.method,path:z.path,params:z.params||{},query:z.query||{},body:z.body});const{displayId:F}=ad(z.method,z.path);if(!F)return;const B=oh(F,{tab:"playground",layout:"playground"});o(B)};if(!e)return h.jsx(_t,{title:"Endpoint details",children:h.jsx(ji,{title:"Select an endpoint",description:"Choose an endpoint from the list to inspect its contract and metrics."})});if(P)return h.jsx(_t,{title:"Endpoint details",children:h.jsx(Ma,{variant:"full"})});if(j){const z=j instanceof Error?j.message:"Unable to load endpoint.",F=j instanceof Error?j.stack:j?String(j):void 0;return h.jsx(_t,{title:"Endpoint details",children:h.jsx(ia,{message:z,details:F,onRetry:()=>C()})})}if(!$)return h.jsx(_t,{title:"Endpoint details",children:h.jsx(ji,{title:"Endpoint not found",description:"This endpoint may have been removed."})});const L=$.out;return h.jsxs(_t,{title:"Endpoint details",children:[h.jsxs(ue,{spacing:3,children:[h.jsxs(Be,{sx:{position:"sticky",top:0,zIndex:1,bgcolor:"background.paper",pb:1},children:[h.jsx(vAe,{endpoint:L}),h.jsx(Ub,{value:y,onChange:(z,F)=>{const B=F;if(B==="playground"){o(oh(e,{tab:"metrics",layout:"details"}));return}i==null||i(B),n===void 0&&u(B)},variant:"scrollable",allowScrollButtonsMobile:!0,sx:{borderBottom:"1px solid",borderColor:"divider"},children:x.map(z=>h.jsx(ml,{label:z.label,value:z.key},z.key))})]}),y==="request"&&h.jsx(bAe,{endpoint:L}),y==="response"&&h.jsx(xAe,{endpoint:L}),y==="meta"&&h.jsx(wAe,{endpoint:L}),y==="metrics"&&h.jsx(SAe,{endpoint:L,onSelectRequest:z=>v(z.id),onRequestsChange:f}),!r&&y==="playground"&&h.jsx(fV,{method:L.method,path:L.path,contract:L.contract,summary:L.summary,onOpenStandalone:t?z=>t(L,z):void 0})]}),h.jsx(Em,{open:!!A,request:A,onClose:()=>v(null),onPrev:T?R:void 0,onNext:M?D:void 0,onReplay:A?O:void 0})]})}function bAe({endpoint:e}){return h.jsxs(ue,{spacing:2.5,children:[h.jsx(Bv,{title:"Body",schema:e.contract.body}),h.jsx(Bv,{title:"Params",schema:e.contract.params}),h.jsx(Bv,{title:"Query",schema:e.contract.query})]})}function xAe({endpoint:e}){return h.jsx(Bv,{title:"Response",schema:e.contract.output})}function wAe({endpoint:e}){const t=Object.entries(e.meta||{});return h.jsxs(ue,{spacing:2,children:[h.jsx(bv,{label:"Feed",value:e.feed?"Yes":"No"}),h.jsx(bv,{label:"Implemented",value:e.implemented?"Yes":"No"}),h.jsx(bv,{label:"Hidden",value:e.hidden?"Yes":"No"}),t.length>0&&h.jsxs(Be,{children:[h.jsx(ne,{variant:"subtitle2",gutterBottom:!0,children:"Metadata"}),h.jsx(ue,{spacing:1,children:t.map(([r,n])=>h.jsx(bv,{label:r,value:n},r))})]})]})}function SAe({endpoint:e,onSelectRequest:t,onRequestsChange:r}){var o;const n=typeof e.successRate=="number"?`${Math.round(e.successRate*100)}%`:"—",i=e.averageDurationMs?`${Math.round(e.averageDurationMs)} ms`:"—";return h.jsxs(ue,{spacing:3,children:[h.jsxs(Be,{sx:{display:"grid",gridTemplateColumns:{xs:"1fr",sm:"repeat(2, minmax(0, 1fr))"},gap:2},children:[h.jsx(iL,{label:"Avg duration",value:i}),h.jsx(iL,{label:"Success rate",value:n})]}),h.jsx(_t,{title:"Request volume",children:h.jsx(yAe,{data:e.volumeTS})}),(o=e.latestErrors)!=null&&o.length?h.jsx(_t,{title:"Latest error request IDs",children:h.jsx(ue,{spacing:.5,children:e.latestErrors.map(a=>h.jsx(ne,{variant:"body2",sx:{fontFamily:"monospace"},children:a.id},a.id))})}):null,h.jsx(gAe,{method:e.method,path:e.path,onSelectRequest:t,onRequestsChange:r})]})}function bv({label:e,value:t}){return h.jsxs(ue,{direction:"row",spacing:1,justifyContent:"space-between",children:[h.jsx(ne,{variant:"body2",color:"text.secondary",children:e}),h.jsx(ne,{variant:"body2",sx:{fontFamily:"monospace",color:"text.primary"},children:t})]})}function iL({label:e,value:t}){return h.jsxs(Be,{sx:{borderRadius:2,border:"1px solid",borderColor:"divider",p:2,bgcolor:"background.default"},children:[h.jsx(ne,{variant:"body2",color:"text.secondary",children:e}),h.jsx(ne,{variant:"h5",sx:{mt:.5},children:t})]})}function Go({title:e,subtitle:t,actions:r,children:n}){const i=!!(e||t||r);return h.jsx(Be,{sx:{width:"100%",mx:"auto"},children:h.jsxs(ue,{spacing:4,children:[i&&h.jsxs(ue,{direction:{xs:"column",sm:"row"},alignItems:{xs:"flex-start",sm:"center"},justifyContent:"space-between",spacing:2,children:[h.jsxs(Be,{children:[e&&h.jsx(ne,{variant:"h4",component:"h1",gutterBottom:!0,children:e}),t&&h.jsx(ne,{variant:"body1",color:"text.secondary",children:t})]}),r&&h.jsx(Be,{sx:{alignSelf:{xs:"stretch",sm:"center"}},children:r})]}),h.jsx(Be,{children:n})]})})}function kAe(e){const{client:t}=rf(),[r,n]=m.useState({isLoading:!1}),i=m.useMemo(()=>Epe(e),[e]);return m.useEffect(()=>{let o=!1;if(!e||!i){n({data:void 0,isLoading:!1,error:void 0});return}return n(a=>({...a,isLoading:!0,error:void 0})),t.fetch({method:"GET",path:"/__rrroutes/endpoints/:endpointId",params:{endpointId:i}}).then(a=>{var s;o||n({isLoading:!1,data:(s=a.data)==null?void 0:s.out,error:void 0})}).catch(a=>{o||n({isLoading:!1,data:void 0,error:a instanceof Error?a:new Error(String(a))})}),()=>{o=!0}},[t,e,i]),r}function PAe(e){const{client:t}=rf(),[r,n]=m.useState([]),[i,o]=m.useState(!1);return m.useEffect(()=>{let a=!1;return o(!0),n([]),t.fetch({method:"GET",path:"/__rrroutes/endpoints",query:{...e?{searchQuery:e}:{},pageSize:"50"}}).then(s=>{if(a)return;const u=s.data,d=Array.isArray(u==null?void 0:u.out)?u.out:Array.isArray(u)?u:[];n(d.map(f=>W3(f)))}).catch(s=>{a||(console.error("Failed to load endpoints",s),n([]))}).finally(()=>{a||o(!1)}),()=>{a=!0}},[t,e]),{options:r,isLoading:i}}function $Ae(){const e=na(),{endpointId:t}=QL(),r=t?decodeURIComponent(t):"",[n,i]=_$(),o=n.get(cP),a=n.get(uP),[s,u]=m.useState(()=>pM(o)),[d,f]=m.useState(()=>fM(a));m.useEffect(()=>{const B=pM(o);u(U=>U===B?U:B)},[o]),m.useEffect(()=>{const B=fM(a);f(U=>U===B?U:B)},[a]);const[p,v]=m.useState(r);m.useEffect(()=>{v(r)},[r]);const[y,b]=m.useState(""),{options:w,isLoading:x}=PAe(y),k=m.useMemo(()=>K3(r),[r]),$=(k==null?void 0:k.display)??r??"",{data:P,isLoading:j,error:C}=kAe($),I=m.useMemo(()=>{const B=[...w],U=V=>{V&&(B.some(K=>K.value===V.value)||B.push(V))};return U(k),U(P?W3(P):void 0),B},[w,k,P]),A=(k==null?void 0:k.method)??(P==null?void 0:P.method),T=(k==null?void 0:k.path)??(P==null?void 0:P.path),M=s!=="playground",R=s!=="details",D=(()=>{if(!A||!T)return h.jsx(ji,{title:"Select an endpoint",description:"Choose an endpoint above to start using the playground."});if($&&j)return h.jsx(Ma,{variant:"full"});if(C){const B=C instanceof Error?C.message:"Failed to load endpoint.",U=C instanceof Error?C.stack:C?String(C):void 0;return h.jsx(ia,{message:B,details:U})}return h.jsx(fV,{method:A,path:T,contract:P==null?void 0:P.contract,summary:P==null?void 0:P.summary})})(),O=(B,U)=>{if(!U)return;const V=I.find(W=>W.value===U);if(!V)return;const K=n.toString(),Z=`/routes/${encodeURIComponent(V.value)}`;e(K?`${Z}?${K}`:Z)},L=B=>{i(U=>{const V=new URLSearchParams(U);return Object.entries(B).forEach(([K,Z])=>{Z==null?V.delete(K):V.set(K,Z)}),V})},z=B=>{u(B),L({[cP]:U3(B)})},F=B=>{f(B),L({[uP]:F3(B)})};return h.jsx(Go,{title:"Endpoint playground",subtitle:"Experiment with any endpoint and inspect its request/response details side-by-side.",children:h.jsxs(ue,{spacing:3,children:[h.jsx(_t,{title:"Endpoint",actions:h.jsx(CAe,{value:s,onChange:z}),children:h.jsx(ue,{spacing:2,children:h.jsx(hl,{freeSolo:!0,options:I.map(B=>B.value),value:$,inputValue:p,loading:x,onChange:O,onInputChange:(B,U,V)=>{v(U),V==="input"&&b(U),(V==="clear"||V==="reset"&&U==="")&&b("")},getOptionLabel:B=>{const U=I.find(V=>V.value===B);return U?U.display:B},renderInput:B=>h.jsx(Vt,{...B,label:"Switch endpoint",placeholder:"GET /v1/example",helperText:"Search by method and path"})})})}),h.jsxs(Be,{sx:{display:"flex",flexDirection:{xs:"column",lg:"row"},gap:3},children:[M&&h.jsx(Be,{sx:{flex:R?"1 1 50%":"1 1 100%"},children:h.jsx(hV,{endpointId:r||null,hidePlaygroundTab:!0,activeTab:d,onTabChange:F})}),R&&h.jsx(Be,{sx:{flex:M?"1 1 50%":"1 1 100%"},children:h.jsx(_t,{title:"Playground",children:D})})]})]})})}function CAe({value:e,onChange:t}){return h.jsxs(uB,{size:"small",children:[h.jsx(zt,{variant:e==="split"?"contained":"outlined",onClick:()=>t("split"),children:"Split"}),h.jsx(zt,{variant:e==="details"?"contained":"outlined",onClick:()=>t("details"),children:"Details only"}),h.jsx(zt,{variant:e==="playground"?"contained":"outlined",onClick:()=>t("playground"),children:"Playground only"})]})}function xf({data:e,items:t,fetchNextPage:r,hasNextPage:n,isFetchingNextPage:i,pageSize:o,isLoading:a,extractItems:s=jAe,children:u}){const d=m.useMemo(()=>{var v;return t||(!e||!((v=e.pages)!=null&&v.length)?[]:e.pages.slice().reverse().flatMap(y=>s(y)))},[e,s,t]),f=m.useCallback(()=>{!n||i||r()},[r,n,i]),p=v=>n===void 0?null:n?h.jsx(zt,{size:"small",onClick:f,disabled:i,sx:{mt:1.5},children:a?"Loading...":`Load more${o?` (${o})`:""}`}):v==="top"?null:h.jsx(ne,{variant:"caption",color:"text.secondary",sx:{mt:1.5},children:"End of results"});return h.jsxs(Be,{children:[h.jsxs(ue,{sx:{alignItems:"flex-start"},children:[h.jsx(ne,{variant:"body1",color:"text.secondary",sx:{mt:1.5},children:`${d.length} items loaded`}),p("top")]}),u(d),i&&h.jsx(Bb,{sx:{mt:1.5}}),p("bottom")]})}function jAe(e){const t=e==null?void 0:e.out;return Array.isArray(t)?t:t?[t]:[]}const EAe=Et(h.jsx("path",{d:"M4.25 5.61C6.27 8.2 10 13 10 13v6c0 .55.45 1 1 1h2c.55 0 1-.45 1-1v-6s3.72-4.8 5.74-7.39c.51-.66.04-1.61-.79-1.61H5.04c-.83 0-1.3.95-.79 1.61"})),IAe=Et(h.jsx("path",{d:"M19.79 5.61C20.3 4.95 19.83 4 19 4H6.83l7.97 7.97zM2.81 2.81 1.39 4.22 10 13v6c0 .55.45 1 1 1h2c.55 0 1-.45 1-1v-2.17l5.78 5.78 1.41-1.41z"})),OAe=Et(h.jsx("path",{d:"M17.65 6.35C16.2 4.9 14.21 4 12 4c-4.42 0-7.99 3.58-7.99 8s3.57 8 7.99 8c3.73 0 6.84-2.55 7.73-6h-2.08c-.82 2.33-3.04 4-5.65 4-3.31 0-6-2.69-6-6s2.69-6 6-6c1.66 0 3.14.69 4.22 1.78L13 11h7V4z"})),_Ae=Et(h.jsx("path",{d:"M19 6.41 17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"})),AAe=Et(h.jsx("path",{d:"M15.5 14h-.79l-.28-.27C15.41 12.59 16 11.11 16 9.5 16 5.91 13.09 3 9.5 3S3 5.91 3 9.5 5.91 16 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14"}));function TAe({value:e,onChange:t,placeholder:r="Search...",onSubmit:n,textFieldProps:i,inputRef:o}){const a=u=>{t(u.target.value)},s=u=>{u.key==="Enter"&&(n==null||n())};return h.jsx(Vt,{value:e,onChange:a,placeholder:r,onKeyDown:s,fullWidth:!0,inputRef:o,InputProps:{startAdornment:h.jsx(y2,{position:"start",children:h.jsx(AAe,{fontSize:"small"})}),endAdornment:e?h.jsx(y2,{position:"end",children:h.jsx(qn,{size:"small",onClick:()=>t(""),"aria-label":"Clear search input",children:h.jsx(_Ae,{fontSize:"small"})})}):void 0},...i})}const MAe=[{value:"timestamp",label:"Timestamp"},{value:"duration",label:"Duration"},{value:"level",label:"Level"},{value:"path",label:"Path"}],RAe=[{value:"desc",label:"Desc"},{value:"asc",label:"Asc"}];function wf({value:e,onChange:t,children:r,searchInputRef:n,tagOptions:i,groupOptions:o,onRefresh:a,refreshing:s=!1,searchOnly:u=!1}){const[d,f]=m.useState(!1),[p,v]=m.useState("include"),y=Kr(),b=e.orderBy??"timestamp",w=e.orderDirection??"desc",x=e.tagsInclude??[],k=e.tagsExclude??[],$=e.groupsInclude??[],P=e.groupsExclude??[],j=U=>{t({...e,pageSize:U})},C=m.useMemo(()=>Array.from(new Set(i??[])).sort(),[i]),I=m.useMemo(()=>Array.from(new Set(o??[])).sort(),[o]),A=(U,V)=>{t({...e,[U]:DAe(V)})},T=e.searchQuery??"",M=p==="exclude",R=p==="include"?x:k,D=p==="include"?$:P,O=U=>{t({...e,tagsInclude:p==="include"?U:x,tagsExclude:p==="exclude"?U:k})},L=U=>{t({...e,groupsInclude:p==="include"?U:$,groupsExclude:p==="exclude"?U:P})},z=()=>v(U=>U==="include"?"exclude":"include"),F=M?{pointerEvents:"none"}:void 0,B=M?{opacity:.5}:void 0;return h.jsxs(ue,{spacing:2,sx:{border:"1px solid",borderColor:M?"error.main":"divider",borderRadius:2,p:2,bgcolor:M?Pi(y.palette.error.main,.08):"transparent",transition:"background-color 150ms ease, border-color 150ms ease"},children:[h.jsxs(ue,{direction:{xs:"column",md:"row"},spacing:2,alignItems:{xs:"stretch",md:"center"},children:[h.jsx(Be,{sx:{flex:1,minWidth:0,...B,...F},children:h.jsx(TAe,{value:T,onChange:U=>A("searchQuery",U),placeholder:"Search",inputRef:n,textFieldProps:{disabled:M}})}),!u&&h.jsxs(h.Fragment,{children:[h.jsx(Vt,{select:!0,label:"Order by",value:b,onChange:U=>A("orderBy",U.target.value),size:"small",disabled:M,sx:B,children:MAe.map(U=>h.jsx(el,{value:U.value,children:U.label},U.value))}),h.jsx(Vt,{select:!0,label:"Direction",value:w,onChange:U=>A("orderDirection",U.target.value),size:"small",disabled:M,sx:B,children:RAe.map(U=>h.jsx(el,{value:U.value,children:U.label},U.value))}),h.jsx(qn,{onClick:()=>f(U=>!U),sx:{transform:d?"rotate(180deg)":"rotate(0deg)",transition:"transform 150ms ease"},"aria-label":"Toggle advanced filters",children:h.jsx(ea,{})}),h.jsx(zt,{variant:M?"contained":"outlined",color:M?"error":"primary",onClick:z,startIcon:M?h.jsx(IAe,{}):h.jsx(EAe,{}),sx:{minWidth:140},children:M?"Exclude mode":"Include mode"})]}),a?h.jsx(zt,{variant:"outlined",color:"primary",onClick:a,startIcon:h.jsx(OAe,{sx:s?{animation:"spin 0.9s linear infinite","@keyframes spin":{from:{transform:"rotate(0deg)"},to:{transform:"rotate(360deg)"}}}:void 0}),disabled:s,sx:{minWidth:140},children:"Refresh"}):null]}),h.jsxs(Yp,{in:d,timeout:"auto",unmountOnExit:!0,children:[h.jsxs(ue,{direction:{xs:"column",md:"row"},spacing:2,alignItems:{xs:"stretch",md:"flex-start"},sx:B,children:[h.jsx(Vt,{label:"After",type:"datetime-local",value:oL(e.afterDate),onChange:U=>A("afterDate",aL(U.target.value)),size:"small",fullWidth:!0,InputLabelProps:{shrink:!0},disabled:M}),h.jsx(Vt,{label:"Before",type:"datetime-local",value:oL(e.beforeDate),onChange:U=>A("beforeDate",aL(U.target.value)),size:"small",fullWidth:!0,InputLabelProps:{shrink:!0},disabled:M}),h.jsx(Vt,{label:"Page size",type:"number",value:e.pageSize??"",onChange:U=>{const V=Number(U.target.value);j(Number.isNaN(V)||V<=0?void 0:V)},size:"small",fullWidth:!0,InputLabelProps:{shrink:!0},inputProps:{min:1,max:500},disabled:M})]}),h.jsxs(ue,{spacing:2,sx:{mt:2},children:[h.jsx(hl,{multiple:!0,freeSolo:!0,options:C,value:R,onChange:(U,V)=>O(V),renderTags:(U,V)=>U.map((K,Z)=>h.jsx(dr,{size:"small",label:K,...V({index:Z})})),renderInput:U=>h.jsx(Vt,{...U,label:`Tags (${p})`,placeholder:"Add tags",size:"small"})}),h.jsx(hl,{multiple:!0,freeSolo:!0,options:I,value:D,onChange:(U,V)=>L(V),renderTags:(U,V)=>U.map((K,Z)=>h.jsx(dr,{size:"small",label:K,...V({index:Z})})),renderInput:U=>h.jsx(Vt,{...U,label:`Groups (${p})`,placeholder:"Add groups",size:"small"})})]})]}),r?h.jsxs(Be,{sx:{borderTop:"1px solid",borderColor:"divider",pt:2},children:[h.jsx(ne,{variant:"overline",color:"text.secondary",sx:{display:"block",mb:1},children:"Additional filters"}),r(p)]}):null]})}function oL(e){if(!e)return"";const t=new Date(e);if(Number.isNaN(t.getTime()))return e;const r=t.getTimezoneOffset();return new Date(t.getTime()-r*60*1e3).toISOString().slice(0,16)}function aL(e){if(!e)return;const t=new Date(e);return Number.isNaN(t.getTime())?e:t.toISOString()}function DAe(e){if(!(typeof e=="string"&&e.trim()==="")&&!(Array.isArray(e)&&e.length===0))return e}const zAe=500,sL=10;function NAe({requests:e,onSelectEndpoint:t}){const{mostUsed:r,slowest:n}=m.useMemo(()=>BAe(e),[e]);return h.jsxs(Bo,{container:!0,spacing:2,children:[h.jsx(lL,{title:"Most used requests",data:r,valueKey:"count",axisFormatter:i=>i.toLocaleString(),tooltipFormatter:i=>`${i.toLocaleString()} calls`,color:"#7aa2ff",emptyLabel:"No request volume in the selected range yet.",onSelectEndpoint:t}),h.jsx(lL,{title:"Slowest requests",data:n,valueKey:"avgDuration",axisFormatter:i=>`${i.toLocaleString()} ms`,tooltipFormatter:i=>`${i.toLocaleString()} ms`,color:"#ffb85c",emptyLabel:"No duration data in the selected range yet.",onSelectEndpoint:t})]})}function lL({title:e,data:t,valueKey:r,axisFormatter:n,tooltipFormatter:i,color:o,emptyLabel:a,onSelectEndpoint:s}){const[u,d]=m.useState(!1),f=t.length>sL,p=u?t:t.slice(0,sL),v=Math.max(p.length*38+60,260),y=f?h.jsx(zt,{size:"small",onClick:()=>d(b=>!b),children:u?"Collapse":`Show all (${t.length})`}):void 0;return h.jsx(_t,{title:e,actions:y,flex:1,children:t.length?h.jsx(Be,{sx:{height:v},children:h.jsx(vl,{width:"100%",height:"100%",children:h.jsxs(oO,{data:p,layout:"vertical",margin:{left:0,right:16,top:8,bottom:8},children:[h.jsx(Il,{stroke:"rgba(255,255,255,0.08)"}),h.jsx(Ol,{type:"number",tick:{fill:"rgba(255,255,255,0.7)",fontSize:12},tickLine:!1,axisLine:!1,tickFormatter:b=>{const w=typeof b=="number"?b:Number(b);return n?n(Number.isFinite(w)?w:0):(Number.isFinite(w)?w:0).toLocaleString()}}),h.jsx(ls,{dataKey:"label",type:"category",width:220,tick:{fill:"rgba(255,255,255,0.85)",fontSize:12},tickLine:!1,axisLine:!1}),h.jsx(bl,{cursor:{fill:"rgba(255,255,255,0.08)"},contentStyle:{backgroundColor:"#1e1b23",borderColor:"rgba(255,255,255,0.12)"},formatter:b=>[i(typeof b=="number"?b:Number(b)||0),""],labelFormatter:b=>b}),h.jsx(r0,{dataKey:r,fill:o,radius:[4,4,4,4],cursor:"pointer",onClick:b=>{const w=b==null?void 0:b.payload;w!=null&&w.endpointId&&s(w.endpointId)}})]})})}):h.jsx(LAe,{label:a})})}function LAe({label:e}){return h.jsx(Be,{sx:{py:4},children:h.jsx(ne,{color:"text.secondary",align:"center",children:e})})}function BAe(e){const t=e.slice(0,zAe),r=new Map;t.forEach(a=>{const{displayId:s}=ad(a.method,a.path);if(!s)return;const u=r.get(s)??{label:s,count:0,totalDuration:0};u.count+=1,u.totalDuration+=a.durationMs??0,r.set(s,u)});const n=Array.from(r.entries()).map(([a,s])=>({endpointId:a,label:s.label,count:s.count,avgDuration:s.count===0?0:Math.round(s.totalDuration/Math.max(s.count,1))})),i=[...n].sort((a,s)=>s.count===a.count?a.label.localeCompare(s.label):s.count-a.count),o=[...n].sort((a,s)=>s.avgDuration===a.avgDuration?a.label.localeCompare(s.label):s.avgDuration-a.avgDuration);return{mostUsed:i,slowest:o}}function FAe({requests:e}){const t=na(),[r,n]=m.useState("all"),[i,o]=m.useState(null),[a,s]=m.useState(null),[u,d]=m.useState(null),[f,p]=m.useState(null),[v,y]=m.useState([]),[b,w]=m.useState(null),x=i!=null,k=r!=="all"||x,$=m.useMemo(()=>UAe(e,r),[e,r]),P=m.useMemo(()=>WAe($,i),[$,i]),j=m.useMemo(()=>KAe(P),[P]),C=m.useMemo(()=>mV($),[$]),I=m.useMemo(()=>C.reduce((q,oe)=>Math.max(q,oe.count),0),[C]),A=I>0?[0,I]:[0,"auto"],T=m.useMemo(()=>{if(a!=null&&u!=null){const q=Math.min(a,u),oe=Math.max(a,u);return q===oe?null:{from:q,to:oe}}return i},[a,u,i]),M=q=>{if(!q)return;const oe=oh(q,{tab:"metrics",layout:"details"});t(oe)},R=(q,oe)=>{oe&&(n(oe),o(null),s(null),d(null))},D=()=>{o(null),s(null),d(null)},O=q=>{if((q==null?void 0:q.activeLabel)==null)return;const oe=Number(q.activeLabel);Number.isFinite(oe)&&(s(oe),d(oe))},L=q=>{if(a==null)return;const oe=Number(q==null?void 0:q.activeLabel);Number.isFinite(oe)&&d(oe)},z=()=>{if(a==null||u==null){s(null),d(null);return}const q=Math.min(a,u),oe=Math.max(a,u);s(null),d(null),!(!Number.isFinite(q)||!Number.isFinite(oe)||q===oe)&&o({from:q,to:oe})},F=q=>{var Y,H;const oe=(H=(Y=q==null?void 0:q.activePayload)==null?void 0:Y[0])==null?void 0:H.payload;!oe||!oe.requests.length||p(oe)},B=(q,oe)=>{q.length&&(p(null),y(q.map(Y=>Y.id)),w(Math.min(Math.max(oe,0),q.length-1)))},U=b!=null&&b>=0&&b<v.length?v[b]:null,V=()=>{y([]),w(null)},K=()=>{w(q=>q==null||!v.length?q:(q-1+v.length)%v.length)},Z=()=>{w(q=>q==null||!v.length?q:(q+1)%v.length)},W=h.jsxs(ue,{direction:"row",spacing:1,alignItems:"center",children:[h.jsxs(uC,{size:"small",exclusive:!0,value:r,onChange:R,children:[h.jsx(pu,{value:"15m",children:"Last 15m"}),h.jsx(pu,{value:"1h",children:"Last 1h"}),h.jsx(pu,{value:"24h",children:"Last 24h"}),h.jsx(pu,{value:"all",children:"All"})]}),x&&h.jsx(zt,{size:"small",onClick:D,children:"Reset range"})]});return h.jsxs(h.Fragment,{children:[h.jsxs(ue,{spacing:3,children:[h.jsxs(Bo,{container:!0,spacing:2,children:[h.jsx(Bo,{component:"div",children:h.jsx(xv,{title:"Total requests",value:j.totalRequests})}),h.jsx(Bo,{component:"div",children:h.jsx(xv,{title:"Error rate",value:`${j.errorRate}%`})}),h.jsx(Bo,{component:"div",children:h.jsx(xv,{title:"Avg duration",value:`${j.avgDuration} ms`})}),h.jsx(Bo,{component:"div",children:h.jsx(xv,{title:"P95 duration",value:`${j.p95Duration} ms`})})]}),h.jsx(_t,{title:"Requests over time",actions:W,children:C.length?h.jsx(Y1,{children:h.jsx(vl,{width:"100%",height:"100%",children:h.jsxs(aO,{data:C,margin:{left:0,right:16,top:8,bottom:8},onMouseDown:O,onMouseMove:L,onMouseUp:z,onClick:F,children:[h.jsx(Il,{stroke:"rgba(255,255,255,0.1)"}),h.jsx(Ol,{dataKey:"timestamp",type:"number",tickFormatter:q=>GAe(q),tick:{fill:"rgba(255,255,255,0.6)",fontSize:12},tickLine:!1,axisLine:!1,domain:["dataMin","dataMax"]}),h.jsx(ls,{tick:{fill:"rgba(255,255,255,0.6)",fontSize:12},allowDecimals:!1,tickLine:!1,axisLine:!1,domain:A}),h.jsx(bl,{wrapperStyle:{pointerEvents:"none"},content:ZAe,contentStyle:{backgroundColor:"#1e1b23",borderColor:"rgba(255,255,255,0.1)"}}),T&&h.jsx(PH,{x1:T.from,x2:T.to,strokeOpacity:0,fill:"rgba(155,93,229,0.18)"}),h.jsx(cd,{dataKey:"count",type:"monotone",stroke:"#9b5de5",fill:"#9b5de5",fillOpacity:.2})]})})}):h.jsx(Q1,{hasActiveTimeFilter:k})}),h.jsxs(Bo,{container:!0,spacing:2,children:[h.jsx(Bo,{component:"div",flex:1,children:h.jsx(_t,{title:"Requests by method",flex:1,children:j.byMethod.length?h.jsx(Y1,{height:260,children:h.jsx(vl,{width:"100%",height:"100%",children:h.jsxs(oO,{data:j.byMethod,children:[h.jsx(Il,{stroke:"rgba(255,255,255,0.1)"}),h.jsx(Ol,{dataKey:"method",tick:{fill:"rgba(255,255,255,0.6)"}}),h.jsx(ls,{allowDecimals:!1,tick:{fill:"rgba(255,255,255,0.6)"}}),h.jsx(bl,{contentStyle:{backgroundColor:"#1e1b23",borderColor:"rgba(255,255,255,0.1)"},formatter:(q,oe)=>[`${q} requests`,String(oe).toUpperCase()]}),h.jsx(r0,{dataKey:"count",fill:"#7aa2ff"})]})})}):h.jsx(Q1,{hasActiveTimeFilter:k})})}),h.jsx(Bo,{component:"div",flex:1,children:h.jsx(_t,{title:"Requests by status",flex:1,children:j.byStatus.length?h.jsx(Y1,{height:260,children:h.jsx(vl,{width:"100%",height:"100%",children:h.jsxs(L_e,{children:[h.jsx(dH,{data:j.byStatus,dataKey:"count",nameKey:"label",outerRadius:90,fill:"#8884d8",label:!0}),h.jsx(bl,{contentStyle:{backgroundColor:"#1e1b23",borderColor:"rgba(255,255,255,0.1)"},formatter:(q,oe)=>[`${q} requests`,String(oe)]}),h.jsx(IE,{})]})})}):h.jsx(Q1,{hasActiveTimeFilter:k})})})]}),h.jsx(NAe,{requests:P,onSelectEndpoint:M})]}),h.jsx(XAe,{open:!!f,bucket:f,onClose:()=>p(null),onSelectRequest:B}),h.jsx(Em,{open:!!U,request:null,requestId:U,onClose:V,onPrev:v.length>1?K:void 0,onNext:v.length>1?Z:void 0})]})}function xv({title:e,value:t}){return h.jsxs(_t,{children:[h.jsx(ne,{variant:"body2",color:"text.secondary",children:e}),h.jsx(ne,{variant:"h5",children:t})]})}function Y1({children:e,height:t=320}){return h.jsx(Be,{sx:{height:t},children:e})}function Q1({hasActiveTimeFilter:e}){const t=e?"No requests in this time range.":"Not enough data to display yet.",r=e?"Try widening the selected time range or clearing filters above.":"Once requests start coming in, you will see trends and breakdowns here.";return h.jsx(ji,{title:t,description:r})}function db(e){const r=new Date(e.createdAt).getTime();return Number.isFinite(r)?r:0}function UAe(e,t){if(!e.length)return[];if(t==="all")return e;const r=e.reduce((o,a)=>{const s=db(a);return s>o?s:o},0);if(!r)return e;let n=0;if(t==="15m"?n=15*6e4:t==="1h"?n=60*6e4:t==="24h"&&(n=1440*6e4),!n)return e;const i=r-n;return e.filter(o=>db(o)>=i)}function WAe(e,t){if(!t)return e;const r=Math.min(t.from,t.to),n=Math.max(t.from,t.to);return e.filter(i=>{const o=db(i);return o>=r&&o<=n})}function KAe(e){const t=e.length,r=e.filter(f=>f.status>=400).length,n=t===0?0:Math.round(r/t*100),i=e.map(f=>f.durationMs||0),o=i.length===0?0:Math.round(i.reduce((f,p)=>f+p,0)/i.length),a=qAe(i,.95),s=mV(e),u=HAe(e),d=VAe(e);return{totalRequests:t,errorRate:n,avgDuration:o,p95Duration:a,byTime:s,byMethod:u,byStatus:d}}function mV(e){const t=new Map;return e.forEach(r=>{const n=db(r),i=new Date(n);i.setSeconds(0,0);const o=i.getTime(),a=t.get(o)??{count:0,requests:[]};a.count+=1,a.requests.push({id:r.id,method:r.method,path:r.path,status:r.status,durationMs:r.durationMs??0,createdAt:n}),t.set(o,a)}),Array.from(t.entries()).sort(([r],[n])=>r-n).map(([r,n])=>({timestamp:r,count:n.count,label:new Date(r).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"}),requests:n.requests.sort((i,o)=>i.createdAt-o.createdAt)}))}function HAe(e){const t=new Map;return e.forEach(r=>{t.set(r.method,(t.get(r.method)??0)+1)}),Array.from(t.entries()).map(([r,n])=>({method:r,count:n}))}function VAe(e){const t={"2xx":0,"3xx":0,"4xx":0,"5xx":0};return e.forEach(r=>{r.status>=500?t["5xx"]+=1:r.status>=400?t["4xx"]+=1:r.status>=300?t["3xx"]+=1:t["2xx"]+=1}),Object.entries(t).filter(([,r])=>r>0).map(([r,n])=>({label:r,count:n}))}function qAe(e,t){if(!e.length)return 0;const r=[...e].sort((i,o)=>i-o),n=Math.floor(t*(r.length-1));return r[n]}function GAe(e){const t=typeof e=="number"?e:Number(e);if(!Number.isFinite(t))return"";try{return new Date(t).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})}catch{return""}}function ZAe(e){var i;const{active:t,payload:r}=e;if(!t||!r||!r.length)return null;const n=(i=r[0])==null?void 0:i.payload;return n?h.jsx(Be,{sx:{p:1.5,minWidth:160},children:h.jsxs(ue,{spacing:.5,children:[h.jsx(ne,{variant:"body2",fontWeight:600,children:n.label}),h.jsxs(ne,{variant:"body2",color:"text.secondary",children:[n.count," requests"]})]})}):null}function XAe({open:e,bucket:t,onClose:r,onSelectRequest:n}){const i=(t==null?void 0:t.requests)??[],o=t?`${t.label} · ${i.length} requests`:"Requests in bucket";return h.jsx(sf,{open:e,onClose:r,title:o,children:i.length?h.jsx(ue,{spacing:1.25,children:i.map((a,s)=>h.jsxs(Be,{onClick:()=>n(i,s),onKeyDown:u=>{(u.key==="Enter"||u.key===" ")&&(u.preventDefault(),n(i,s))},role:"button",tabIndex:0,sx:{borderRadius:1,px:1.25,py:.75,display:"flex",flexDirection:"column",gap:.5,"&:hover":{bgcolor:"action.hover"}},children:[h.jsxs(ue,{direction:"row",spacing:1,alignItems:"center",justifyContent:"space-between",children:[h.jsxs(ue,{direction:"row",spacing:1,alignItems:"center",children:[h.jsx(bf,{method:a.method}),h.jsx(ne,{variant:"body2",sx:{fontFamily:"monospace"},noWrap:!0,title:a.path,children:a.path})]}),h.jsxs(ne,{variant:"caption",color:"text.secondary",sx:{whiteSpace:"nowrap"},children:[a.durationMs," ms"]})]}),h.jsxs(ue,{direction:"row",spacing:1,alignItems:"center",justifyContent:"space-between",children:[h.jsx(jm,{status:a.status}),h.jsx(ne,{variant:"caption",color:"text.secondary",sx:{whiteSpace:"nowrap"},children:new Date(a.createdAt).toLocaleString()})]})]},a.id))}):h.jsx(ne,{color:"text.secondary",children:"No requests recorded in this time bucket."})})}const YAe=Et(h.jsx("path",{d:"M5 20h14v-2H5zM19 9h-4V3H9v6H5l7 7z"})),QAe="text/csv;charset=utf-8;",JAe=e=>e.toLowerCase().endsWith(".csv")?e:`${e}.csv`,uL=e=>{if(e==null)return"";let t;if(e instanceof Date)t=e.toISOString();else if(typeof e=="object")try{t=JSON.stringify(e)}catch{t=String(e)}else t=String(e);const r=t.replace(/"/g,'""');return/[",\n\r]/.test(t)?`"${r}"`:r},eTe=e=>{const t=[],r=new Set;return e.forEach(n=>{Object.keys(n).forEach(i=>{r.has(i)||(r.add(i),t.push(i))})}),t};function tTe(e,t){if(typeof document>"u")throw new Error("exportToCsv can only be used in a browser environment.");const r=eTe(t),n=[];r.length&&n.push(r.map(u=>uL(u)).join(",")),t.forEach(u=>{const d=r.map(f=>uL(u[f]));n.push(d.join(","))});const i=n.join(`\r
374
- `),o=new Blob([i],{type:QAe}),a=URL.createObjectURL(o),s=document.createElement("a");s.href=a,s.setAttribute("download",JAe(e)),s.style.display="none",document.body.appendChild(s),s.click(),document.body.removeChild(s),URL.revokeObjectURL(a)}function Sf({filename:e,rows:t,getRows:r,children:n="Export CSV",disabled:i,startIcon:o,variant:a="outlined",size:s="small",color:u="secondary",...d}){const[f,p]=m.useState(!1),v=m.useCallback(async()=>{if(!f){p(!0);try{let b=[];if(typeof r=="function"){const w=await r();b=Array.isArray(w)?w:[]}else Array.isArray(t)&&(b=t);tTe(e,b)}catch(b){console.error("Failed to export CSV",b)}finally{p(!1)}}},[f,e,r,t]),y=i||f||!t&&!r;return h.jsx(zt,{variant:a,size:s,color:u,disabled:y,onClick:v,startIcon:o??h.jsx(YAe,{fontSize:"small"}),...d,children:n})}const rTe=new Set(["INPUT","TEXTAREA","SELECT"]);function gV({searchInputRef:e}){m.useEffect(()=>{const t=r=>{var i;if(r.defaultPrevented||r.key!=="/"||r.metaKey||r.ctrlKey||r.altKey)return;const n=r.target;n&&rTe.has(n.tagName)||(r.preventDefault(),(i=e==null?void 0:e.current)==null||i.focus())};return window.addEventListener("keydown",t),()=>window.removeEventListener("keydown",t)},[e])}function kf(e,t){const{defaultValue:r,serialize:n,deserialize:i}=t,[o,a]=_$(),s=o.get(e),u=s===null?r:i?i(s):s,d=m.useCallback(f=>{a(p=>{const v=new URLSearchParams(p),y=p.get(e),b=y===null?r:i?i(y):y,w=typeof f=="function"?f(b):f,x=n?n(w):w;return x==null?v.delete(e):v.set(e,x),v},{replace:!0})},[r,i,e,n,a]);return[u,d]}const Pf={orderBy:"timestamp",orderDirection:"desc",tagsInclude:[],tagsExclude:[],groupsInclude:[],groupsExclude:[],pageSize:500};function $f(e){const t={};return Object.entries(e).forEach(([r,n])=>{n!=null&&(typeof n=="string"&&n.trim()===""||Array.isArray(n)&&n.length===0||(t[r]=n))}),Object.keys(t).length===0?null:encodeURIComponent(JSON.stringify(t))}function Cf(e,t){try{const r=JSON.parse(decodeURIComponent(e));return{...t,...r}}catch{return t}}const cL={...Pf,searchQuery:"",methodsInclude:[],methodsExclude:[],statusesInclude:[],statusesExclude:[],endpointKeysInclude:[],endpointKeysExclude:[]};function nTe(){const e=na(),{queuePrefill:t}=sx(),[r,n]=kf("historyFilters",{defaultValue:cL,serialize:Y=>$f(Y),deserialize:Y=>Cf(Y,cL)}),[i,o]=m.useState("table"),[a,s]=m.useState(null),u=m.useRef(null);gV({searchInputRef:u});const d=rn("GET /__rrroutes/requests",{cursorParam:"cursor",getNextPageParam(Y){return Y.meta.nextCursor}}),{data:f,isLoading:p,error:v,refetch:y,isFetching:b,fetchNextPage:w,hasNextPage:x,isFetchingNextPage:k}=d.useEndpoint({query:r}),$=m.useMemo(()=>f?Array.isArray(f.pages)?f.pages.flatMap(Y=>Array.isArray(Y==null?void 0:Y.out)?Y.out:[]):[]:[],[f]),[P,j]=m.useState(()=>{const Y=new Map,H=new Map;return rE.all.forEach(X=>{const{displayId:re,encodedId:he}=ad(X.method,X.path);re&&he&&(Y.set(re,he),H.set(he,re))}),{options:Array.from(Y.keys()).sort(),displayToValue:Y,valueToDisplay:H}});m.useEffect(()=>{$.length&&j(Y=>{let H=!1;const X=new Map(Y.displayToValue),re=new Map(Y.valueToDisplay);return $.forEach(he=>{const{displayId:J,encodedId:ge}=ad(he.method,he.path);!J||!ge||!X.has(J)&&!re.has(ge)&&(X.set(J,ge),re.set(ge,J),H=!0)}),H?{displayToValue:X,valueToDisplay:re,options:Array.from(X.keys()).sort()}:Y})},[$]);const C=P.options;m.useEffect(()=>{a!==null&&($[a]||s(null))},[$,a]);const I=a!==null?$[a]??null:null,A=m.useMemo(()=>{const Y=new Set;return $.forEach(H=>Y.add(H.status)),Array.from(Y).sort((H,X)=>H-X)},[$]),T=m.useMemo(()=>$.map(Y=>{var H,X;return{timestamp:new Date(Y.createdAt).toISOString(),method:((X=(H=Y.method)==null?void 0:H.toUpperCase)==null?void 0:X.call(H))??Y.method,path:Y.path,status:Y.status,durationMs:Y.durationMs,tags:Array.isArray(Y.tags)?Y.tags.join(", "):"",groupId:Y.groupId??"",endpointId:Y.id,fullUrl:Y.fullUrl??""}}),[$]),M=(()=>{if(p)return h.jsx(Ma,{variant:"table"});if(v){const Y=v instanceof Error?v.message:"Failed to load history.",H=v instanceof Error?v.stack:v?String(v):void 0;return h.jsx(ia,{message:Y,details:H,onRetry:()=>y()})}return $.length?h.jsx(xf,{data:f,isLoading:p,items:$,fetchNextPage:w,hasNextPage:x,isFetchingNextPage:k,pageSize:r.pageSize,children:Y=>h.jsx(pV,{requests:Y,onSelect:V})}):h.jsx(ji,{title:"No requests found",description:"Try adjusting your filters or search query."})})(),R=(Y,H)=>{n(X=>{const re=new Set(X.methodsInclude),he=new Set(X.methodsExclude);return H==="include"?(re.has(Y)?re.delete(Y):re.add(Y),he.delete(Y)):(he.has(Y)?he.delete(Y):he.add(Y),re.delete(Y)),{...X,methodsInclude:Array.from(re),methodsExclude:Array.from(he)}})},D=(Y,H)=>{n(X=>{const re=new Set(X.statusesInclude),he=new Set(X.statusesExclude);return H==="include"?(re.has(Y)?re.delete(Y):re.add(Y),he.delete(Y)):(he.has(Y)?he.delete(Y):he.add(Y),re.delete(Y)),{...X,statusesInclude:Array.from(re),statusesExclude:Array.from(he)}})},O=Y=>{var H,X;return(H=r.methodsInclude)!=null&&H.includes(Y)?"include":(X=r.methodsExclude)!=null&&X.includes(Y)?"exclude":"none"},L=Y=>{var H,X;return(H=r.statusesInclude)!=null&&H.includes(Y)?"include":(X=r.statusesExclude)!=null&&X.includes(Y)?"exclude":"none"},z=m.useMemo(()=>{var Y;return(Y=r.endpointKeysInclude)==null?void 0:Y.map(H=>P.valueToDisplay.get(H)??H)},[P,r.endpointKeysInclude]),F=m.useMemo(()=>{var Y;return(Y=r.endpointKeysExclude)==null?void 0:Y.map(H=>P.valueToDisplay.get(H)??H)},[P,r.endpointKeysExclude]),B=(Y,H)=>{const X=Y.map(re=>P.displayToValue.get(re)??re).filter(re=>re.trim().length>0);n(re=>({...re,endpointKeysInclude:H==="include"?X:re.endpointKeysInclude,endpointKeysExclude:H==="exclude"?X:re.endpointKeysExclude}))},U=Y=>{t({method:Y.method,path:Y.path,params:Y.params||{},query:Y.query||{},body:Y.body});const{displayId:H}=ad(Y.method,Y.path);if(!H)return;const X=oh(H,{tab:"metrics",layout:"details"});e(X)},V=(Y,H)=>{var re;const X=((re=$[H])==null?void 0:re.id)===Y.id?H:$.findIndex(he=>he.id===Y.id);X>=0&&s(X)},K=()=>s(null),Z=()=>{s(Y=>Y===null||Y<=0?Y:Y-1)},W=()=>{s(Y=>Y===null||Y>=$.length-1?Y:Y+1)},q=a!==null&&a>0,oe=a!==null&&a<$.length-1;return h.jsxs(Go,{title:"History",subtitle:"Review your recently executed requests.",children:[h.jsxs(ue,{spacing:3,children:[h.jsx(_t,{title:"Filters",children:h.jsx(wf,{value:r,onChange:Y=>n(H=>({...H,...Y})),searchInputRef:u,onRefresh:()=>y(),refreshing:b,children:Y=>h.jsxs(ue,{spacing:2,children:[h.jsxs(ue,{spacing:1,children:[h.jsx(ne,{variant:"overline",color:"text.secondary",children:"Methods"}),h.jsx(ue,{direction:"row",spacing:1,flexWrap:"wrap",useFlexGap:!0,children:ax.map(H=>h.jsx(bf,{method:H,state:O(H),onClick:()=>R(H,Y)},H))})]}),h.jsxs(ue,{spacing:1,children:[h.jsx(ne,{variant:"overline",color:"text.secondary",children:"Statuses"}),h.jsx(ue,{direction:"row",spacing:1,flexWrap:"wrap",useFlexGap:!0,children:A.map(H=>h.jsx(jm,{status:H,state:L(H),onClick:()=>D(H,Y)},H))})]}),h.jsxs(ue,{spacing:1,children:[h.jsx(ne,{variant:"overline",color:"text.secondary",children:"Endpoint"}),h.jsx(hl,{multiple:!0,freeSolo:!0,options:C,value:Y==="include"?z:F,onChange:(H,X)=>{console.log(X),B(X,Y)},ListboxProps:{sx:{maxHeight:240,overflowY:"auto"}},renderInput:H=>h.jsx(Vt,{...H,onChange:X=>{n(re=>({...re,searchQuery:X.target.value}))},label:`Endpoint (${Y})`,placeholder:"GET /api/example",size:"small"})})]})]})})}),h.jsx(_t,{title:"View",actions:h.jsxs(ue,{direction:"row",spacing:1,alignItems:"center",children:[h.jsx(Sf,{filename:"history.csv",rows:T,title:"Exports the currently filtered history results."}),h.jsxs(Ub,{value:i,onChange:(Y,H)=>o(H),variant:"standard",sx:{minHeight:32},children:[h.jsx(ml,{label:"Table",value:"table"}),h.jsx(ml,{label:"Insights",value:"insights"})]})]}),children:i==="table"?M:h.jsx(FAe,{requests:$})})]}),h.jsx(Em,{open:!!I,request:I,onClose:K,onReplay:Y=>U(Y),onPrev:q?Z:void 0,onNext:oe?W:void 0})]})}function iTe({logs:e,onSelect:t}){return h.jsx(oc,{component:Yn,variant:"outlined",children:h.jsxs(nc,{size:"small",children:[h.jsx(ac,{children:h.jsxs(Ii,{children:[h.jsx(Oe,{children:"Timestamp"}),h.jsx(Oe,{children:"Level"}),h.jsx(Oe,{children:"Name"}),h.jsx(Oe,{children:"Message"}),h.jsx(Oe,{children:"Meta"}),h.jsx(Oe,{children:"Tags"}),h.jsx(Oe,{children:"Group"})]})}),h.jsx(ic,{children:e.map(r=>{var n;return h.jsxs(Ii,{hover:!0,sx:{cursor:t?"pointer":"default"},onClick:()=>t==null?void 0:t(r),children:[h.jsx(Oe,{children:new Date(r.createdAt).toLocaleString()}),h.jsx(Oe,{children:h.jsx(Cm,{level:r.level})}),h.jsx(Oe,{sx:{maxWidth:160},children:h.jsx(ne,{variant:"body2",noWrap:!0,sx:{fontFamily:"monospace"},children:r.name||"—"})}),h.jsx(Oe,{sx:{maxWidth:240},children:h.jsx(ne,{variant:"body2",noWrap:!0,children:sO(r)})}),h.jsx(Oe,{sx:{maxWidth:280},children:oTe(r)}),h.jsx(Oe,{children:(n=r.tags)!=null&&n.length?h.jsx(ue,{direction:"row",spacing:.5,flexWrap:"wrap",useFlexGap:!0,children:r.tags.map(i=>h.jsx(dr,{label:i,size:"small"},i))}):h.jsx(ne,{variant:"body2",color:"text.secondary",children:"—"})}),h.jsx(Oe,{children:h.jsx(ne,{variant:"body2",color:r.groupId?"text.primary":"text.secondary",sx:{fontFamily:"monospace"},noWrap:!0,children:r.groupId??"—"})})]},r.id)})})]})})}function oTe(e){const t=aTe(e.meta);if(!t)return h.jsx(ne,{variant:"body2",color:"text.secondary",children:"—"});const r=t.length>80?`${t.slice(0,80)}…`:t;return r===t?h.jsx(ne,{variant:"body2",noWrap:!0,children:t}):h.jsx(Bh,{title:t,children:h.jsx(ne,{variant:"body2",noWrap:!0,children:r})})}function aTe(e){if(e==null)return"";if(typeof e=="string")return e;try{return JSON.stringify(e)}catch{return String(e)}}const dL={...Pf,searchQuery:"",levelsInclude:[],levelsExclude:[]};function sTe(){const[e,t]=kf("logsAppFilters",{defaultValue:dL,serialize:M=>$f(M),deserialize:M=>Cf(M,dL)}),[r,n]=m.useState(null),i=rn("GET /__rrroutes/logs",{cursorParam:"cursor",getNextPageParam(M){return M.meta.nextCursor},splitPageSize:500,splitPageSizeParam:"pageSize"}),{data:o,isLoading:a,error:s,refetch:u,isFetching:d,fetchNextPage:f,hasNextPage:p,isFetchingNextPage:v}=i.useEndpoint({query:e}),y=m.useMemo(()=>o?Array.isArray(o.pages)?o.pages.flatMap(M=>Array.isArray(M==null?void 0:M.out)?M.out:[]):[]:[],[o]),b=(r==null?void 0:r.orderedItems[r.index])??null,w=r!==null&&r.index>0,x=r!==null&&r.index<r.orderedItems.length-1,k=m.useCallback((M,R)=>{const D=R.findIndex(O=>O.id===M.id);n({orderedItems:R.map(O=>({...O})),index:D>=0?D:0})},[]),$=m.useCallback(()=>{n(null)},[]),P=m.useCallback(()=>{n(M=>!M||M.index<=0?M:{...M,index:M.index-1})},[]),j=m.useCallback(()=>{n(M=>!M||M.index>=M.orderedItems.length-1?M:{...M,index:M.index+1})},[]),C=m.useMemo(()=>y.map(M=>({timestamp:lTe(M.createdAt),level:M.level,name:M.name??"",message:uTe(M),meta:h$(M.meta),tags:Array.isArray(M.tags)?M.tags.join(", "):"",groupId:M.groupId??""})),[y]),I=(M,R)=>{t(D=>{const O=new Set(D.levelsInclude),L=new Set(D.levelsExclude);return R==="include"?(O.has(M)?O.delete(M):O.add(M),L.delete(M)):(L.has(M)?L.delete(M):L.add(M),O.delete(M)),{...D,levelsInclude:Array.from(O),levelsExclude:Array.from(L)}})},A=M=>{var R,D;return(R=e.levelsInclude)!=null&&R.includes(M)?"include":(D=e.levelsExclude)!=null&&D.includes(M)?"exclude":"none"},T=(()=>{if(a)return h.jsx(Ma,{variant:"table"});if(s){const M=s instanceof Error?s.message:"Failed to load logs.",R=s instanceof Error?s.stack:s?String(s):void 0;return h.jsx(ia,{message:M,details:R,onRetry:()=>u()})}return y.length?h.jsx(xf,{data:o,isLoading:a,items:y,fetchNextPage:f,hasNextPage:p,isFetchingNextPage:v,pageSize:e.pageSize,children:M=>h.jsx(iTe,{logs:M,onSelect:R=>k(R,M)})}):h.jsx(ji,{title:"No logs",description:"Adjust filters to see additional log entries."})})();return h.jsxs(h.Fragment,{children:[h.jsxs(ue,{spacing:3,sx:{mt:2},children:[h.jsx(_t,{title:"Filters",children:h.jsx(wf,{value:e,onChange:M=>t(R=>({...R,...M})),onRefresh:()=>u(),refreshing:d,children:M=>h.jsxs(ue,{spacing:1,children:[h.jsx(ne,{variant:"overline",color:"text.secondary",children:"Levels"}),h.jsx(ue,{direction:"row",spacing:1,flexWrap:"wrap",useFlexGap:!0,children:z3.map(R=>h.jsx(Cm,{level:R,state:A(R),onClick:()=>I(R,M)},R))})]})})}),h.jsx(_t,{title:"Application logs",actions:h.jsx(Sf,{filename:"application-logs.csv",rows:C,title:"Exports the currently filtered logs."}),children:T})]}),h.jsx(oV,{open:!!b,groupId:b==null?void 0:b.groupId,baseQuery:e,triggerLog:b,onClose:$,onPrev:w?P:void 0,onNext:x?j:void 0})]})}function lTe(e){if(!e)return"";try{return new Date(e).toISOString()}catch{return""}}function uTe(e){if(e.description)return e.description;if(typeof e.meta=="string")return e.meta;if(e.meta&&typeof e.meta=="object"){const t=e.meta;if(typeof t.message=="string")return t.message;if(t.message)return h$(t.message)}return h$(e.meta)}function h$(e){if(e==null)return"";if(typeof e=="string")return e;try{return JSON.stringify(e)}catch{return String(e)}}function cTe(e){return rn("GET /__rrroutes/cache/insights").useEndpoint({query:e})}function vV(){const[e,t]=m.useState([]),r=m.useCallback(s=>{const u=Array.from(new Set(s));t(d=>d.length===u.length&&d.every((f,p)=>f===u[p])?d:u)},[]),n=m.useCallback(s=>{t(u=>u.includes(s)?u.filter(d=>d!==s):[...u,s])},[]),i=m.useCallback(()=>{t([])},[]),o=m.useCallback(s=>e.includes(s),[e]),a=e.length>0;return{selectedIds:e,hasSelection:a,setSelection:r,toggle:n,clear:i,isSelected:o}}const yV=Et(h.jsx("path",{d:"m20 12-1.41-1.41L13 16.17V4h-2v12.17l-5.58-5.59L4 12l8 8z"})),bV=Et(h.jsx("path",{d:"m4 12 1.41 1.41L11 7.83V20h2V7.83l5.58 5.59L20 12l-8-8z"})),fL=["sets","totalSizeKB","totalRequests","hitRate","missRate","avgMissDurationMs","hitsSinceLastSet","missesSinceLastSet","deletesSinceLastSet","avgTimeBetweenSetsMs","avgHitsBetweenSets","avgMissesBetweenSets"],m$={sets:"Sets",totalSizeKB:"Current size (KB)",totalRequests:"Total requests",hitRate:"Hit rate (%)",missRate:"Miss rate (%)",avgMissDurationMs:"Avg miss duration (ms)",hitsSinceLastSet:"Hits since last set",missesSinceLastSet:"Misses since last set",deletesSinceLastSet:"Deletes since last set",avgTimeBetweenSetsMs:"Avg time between sets (ms)",avgHitsBetweenSets:"Avg hits between sets",avgMissesBetweenSets:"Avg misses between sets"},J1=(e,t)=>{switch(t){case"sets":return e.sets;case"totalSizeKB":return e.totalSizeKB;case"totalRequests":return e.totalRequests;case"hitRate":return e.hitRate;case"missRate":return e.missRate;case"avgMissDurationMs":return e.avgMissDurationMs??0;case"hitsSinceLastSet":return e.hitsSinceLastSet??0;case"missesSinceLastSet":return e.missesSinceLastSet??0;case"deletesSinceLastSet":return e.deletesSinceLastSet??0;case"avgTimeBetweenSetsMs":return e.avgTimeBetweenSetsMs??0;case"avgHitsBetweenSets":return e.avgHitsBetweenSets??0;case"avgMissesBetweenSets":return e.avgMissesBetweenSets??0;default:return 0}},dTe=e=>{switch(e){case"hitRate":case"missRate":return"percent";case"totalSizeKB":return"sizeKB";case"avgMissDurationMs":case"avgTimeBetweenSetsMs":return"durationMs";default:return"count"}},fTe=(e,t)=>{switch(t){case"percent":return`${e.toFixed(0)}%`;case"sizeKB":return e.toFixed(1);case"durationMs":return e.toFixed(0);case"count":default:return e.toFixed(0)}},pTe=(e,t,r)=>{const n=m$[t];switch(r){case"percent":return[`${e.toFixed(1)}%`,n];case"sizeKB":return[`${e.toFixed(2)} KB`,n];case"durationMs":return[`${e.toFixed(1)} ms`,n];case"count":default:return[e,n]}},xV=e=>e!=null?Number(e)/1024:0,wV=(e,t)=>Number(e||0)+Number(t||0);function SV({tagStats:e,keyStats:t,defaultDimension:r="tag",onVisibleChange:n}){var O,L,z,F;const i=Kr(),[o,a]=m.useState("hitRate"),[s,u]=m.useState("desc"),[d,f]=m.useState(10),[p,v]=m.useState(r),y=m.useMemo(()=>{const B=[];return e&&e.length>0&&B.push("tag"),t&&t.length>0&&B.push("key"),B},[e,t]);if(y.length===0)return null;const b=y.includes(p)?p:y[0],w=m.useMemo(()=>b==="tag"?e??[]:t??[],[b,e,t]),x=m.useMemo(()=>w.length?fL.filter(B=>w.some(U=>J1(U,B)!==0)):fL,[w]),k=x.includes(o)&&x.length>0?o:x[0]??"hitRate",$=m.useMemo(()=>{const B=[...w];return B.sort((U,V)=>{const K=J1(U,k),Z=J1(V,k);return K===Z?U.label.localeCompare(V.label):s==="desc"?Z-K:K-Z}),B},[w,k,s]),P=m.useMemo(()=>d==="all"?$:$.slice(0,d),[$,d]);m.useEffect(()=>{if(!n)return;const B=P.map(U=>U.id);n(B)},[P,n]);const j=m.useMemo(()=>dTe(k),[k]),C=j==="percent",I=j==="sizeKB",A=B=>{const U=B.target.value;f(U==="all"?"all":Number(U))},T=y.length===1?y[0]==="tag"?"Cache usage by tag":"Cache usage by key (name)":b==="tag"?"Cache usage by tag":"Cache usage by key (name)",M=w.length,R=P.length,D=((L=(O=i==null?void 0:i.palette)==null?void 0:O.info)==null?void 0:L.main)??((F=(z=i==null?void 0:i.palette)==null?void 0:z.primary)==null?void 0:F.main)??"#42a5f5";return h.jsx(_t,{title:T,actions:h.jsxs(ue,{direction:"row",spacing:1,alignItems:"center",flexWrap:"wrap",useFlexGap:!0,children:[y.length>1&&h.jsxs(uC,{size:"small",value:b,exclusive:!0,onChange:(B,U)=>{U&&v(U)},children:[h.jsx(pu,{value:"tag",children:"By tag"}),h.jsx(pu,{value:"key",children:"By key"})]}),h.jsx(Ok,{size:"small",sx:{minWidth:200},children:h.jsx(Jv,{value:k,onChange:B=>a(B.target.value),children:x.map(B=>h.jsx(el,{value:B,children:m$[B]},B))})}),h.jsx(Ok,{size:"small",sx:{minWidth:130},children:h.jsxs(Jv,{value:String(d),onChange:A,children:[h.jsx(el,{value:"5",children:"Top 5"}),h.jsx(el,{value:"10",children:"Top 10"}),h.jsx(el,{value:"25",children:"Top 25"}),h.jsx(el,{value:"all",children:"Show all"})]})}),h.jsx(Bh,{title:s==="desc"?"Sort ascending (smallest first)":"Sort descending (largest first)",children:h.jsx(qn,{size:"small",onClick:()=>u(B=>B==="asc"?"desc":"asc"),children:s==="desc"?h.jsx(yV,{fontSize:"small"}):h.jsx(bV,{fontSize:"small"})})})]}),children:h.jsxs(ue,{spacing:1,children:[h.jsx(Be,{sx:{height:320},children:h.jsx(vl,{width:"100%",height:"100%",children:h.jsxs(oO,{data:P,margin:{left:0,right:16,top:8,bottom:32},children:[h.jsx(Il,{stroke:"rgba(255,255,255,0.08)"}),h.jsx(Ol,{dataKey:"label",tick:{fill:"rgba(255,255,255,0.7)",fontSize:12},tickLine:!1,axisLine:!1,interval:0,angle:-35,textAnchor:"end"}),h.jsx(ls,{allowDecimals:!I&&!C,tick:{fill:"rgba(255,255,255,0.7)",fontSize:12},tickLine:!1,axisLine:!1,tickFormatter:B=>fTe(B,j),domain:[0,"dataMax"]}),h.jsx(bl,{cursor:{fill:"rgba(255,255,255,0.08)"},contentStyle:{backgroundColor:"#1e1b23",borderColor:"rgba(255,255,255,0.12)"},formatter:B=>pTe(B,k,j)}),h.jsx(IE,{}),h.jsx(r0,{dataKey:k,name:m$[k],fill:D,radius:[4,4,0,0]})]})})}),h.jsx(ne,{variant:"caption",color:"text.secondary",children:d==="all"?`Showing all ${M} ${b==="tag"?"tags":"keys"}.`:`Showing top ${R} of ${M} ${b==="tag"?"tags":"keys"}.`})]})})}function hTe(e){return e.map(t=>{const r=wV(t.totalHits,t.totalMisses),n=xV(t.currentSizeBytes);return{id:t.key,label:t.key,sets:Number(t.totalSets)||0,totalSizeKB:n,totalRequests:r,hitRate:Number(t.hitRate)||0,missRate:Number(t.missRate)||0,avgMissDurationMs:null,hitsSinceLastSet:t.hitsSinceLastSet!=null?Number(t.hitsSinceLastSet):void 0,missesSinceLastSet:t.missesSinceLastSet!=null?Number(t.missesSinceLastSet):void 0,deletesSinceLastSet:t.deletesSinceLastSet!=null?Number(t.deletesSinceLastSet):void 0,avgTimeBetweenSetsMs:t.avgTimeBetweenSetsMs!=null?Number(t.avgTimeBetweenSetsMs):null,avgHitsBetweenSets:t.avgHitsBetweenSets!=null?Number(t.avgHitsBetweenSets):null,avgMissesBetweenSets:t.avgMissesBetweenSets!=null?Number(t.avgMissesBetweenSets):null}})}function mTe(e){return e.map(t=>{const r=wV(t.totalHits,t.totalMisses),n=xV(t.approxCurrentSizeBytes);return{id:t.tag,label:t.tag,sets:Number(t.totalSets)||0,totalSizeKB:n,totalRequests:r,hitRate:Number(t.hitRate)||0,missRate:Number(t.missRate)||0,avgMissDurationMs:null,hitsSinceLastSet:void 0,missesSinceLastSet:void 0,deletesSinceLastSet:void 0,avgTimeBetweenSetsMs:t.avgTimeBetweenSetsMs!=null?Number(t.avgTimeBetweenSetsMs):null,avgHitsBetweenSets:t.avgHitsBetweenSets!=null?Number(t.avgHitsBetweenSets):null,avgMissesBetweenSets:t.avgMissesBetweenSets!=null?Number(t.avgMissesBetweenSets):null}})}function gTe({keys:e}){const t=hTe(e),{selectedIds:r,setSelection:n}=vV(),i=m.useMemo(()=>{const d=[...e];return d.sort((f,p)=>{const v=p.missesSinceLastSet-f.missesSinceLastSet;if(v!==0)return v;const y=f.currentSizeBytes??0;return(p.currentSizeBytes??0)-y}),d},[e]),o=m.useMemo(()=>{const d={};return e.forEach(f=>{d[f.key]=f}),d},[e]),a=m.useMemo(()=>{if(!r||r.length===0)return null;const d=r.map(f=>o[f]).filter(f=>!!f);return d.length===0?null:d},[r,o]),s=m.useMemo(()=>a||i.slice(0,10),[a,i]),u=d=>{n(d)};return h.jsxs(ue,{spacing:2,children:[h.jsx(SV,{keyStats:t,defaultDimension:"key",onVisibleChange:u}),h.jsxs(_t,{title:"Top keys by misses since last set",children:[h.jsx(oc,{children:h.jsxs(nc,{size:"small",children:[h.jsx(ac,{children:h.jsxs(Ii,{children:[h.jsx(Oe,{children:"Key"}),h.jsx(Oe,{align:"right",children:"Current size (KB)"}),h.jsx(Oe,{align:"right",children:"Hits since last set"}),h.jsx(Oe,{align:"right",children:"Misses since last set"}),h.jsx(Oe,{align:"right",children:"Avg misses between sets"}),h.jsx(Oe,{children:"Last set"}),h.jsx(Oe,{children:"Last hit"}),h.jsx(Oe,{children:"Last miss"}),h.jsx(Oe,{children:"Last delete"})]})}),h.jsx(ic,{children:s.map(d=>h.jsxs(Ii,{children:[h.jsx(Oe,{children:h.jsx(ne,{component:"span",sx:{fontFamily:"monospace",fontSize:"0.85rem"},children:d.key})}),h.jsx(Oe,{align:"right",children:vTe(d.currentSizeBytes)}),h.jsx(Oe,{align:"right",children:d.hitsSinceLastSet}),h.jsx(Oe,{align:"right",children:d.missesSinceLastSet}),h.jsx(Oe,{align:"right",children:d.avgMissesBetweenSets!=null?d.avgMissesBetweenSets.toFixed(2):"—"}),h.jsx(Oe,{children:wv(d.lastSetAt)}),h.jsx(Oe,{children:wv(d.lastHitAt)}),h.jsx(Oe,{children:wv(d.lastMissAt)}),h.jsx(Oe,{children:wv(d.lastDeleteAt)})]},d.key))})]})}),s.length===0&&h.jsx(Be,{sx:{mt:1},children:h.jsx(ne,{variant:"caption",color:"text.secondary",children:"No key-level insights available for the current filters."})})]})]})}function vTe(e){return e==null?"—":(e/1024).toFixed(2)}function wv(e){if(!e)return"—";try{return new Date(e).toLocaleString()}catch{return"—"}}function yTe({tags:e}){const t=mTe(e),{selectedIds:r,setSelection:n}=vV(),i=m.useMemo(()=>{const d=[...e];return d.sort((f,p)=>{const v=f.approxCurrentSizeBytes??0;return(p.approxCurrentSizeBytes??0)-v}),d},[e]),o=m.useMemo(()=>{const d={};return e.forEach(f=>{d[f.tag]=f}),d},[e]),a=m.useMemo(()=>{if(!r||r.length===0)return null;const d=r.map(f=>o[f]).filter(f=>!!f);return d.length===0?null:d},[r,o]),s=m.useMemo(()=>a||i.slice(0,10),[a,i]),u=d=>{n(d)};return h.jsxs(ue,{spacing:2,children:[h.jsx(SV,{tagStats:t,defaultDimension:"tag",onVisibleChange:u}),h.jsxs(_t,{title:"Top tags by approximate current size",children:[h.jsx(oc,{children:h.jsxs(nc,{size:"small",children:[h.jsx(ac,{children:h.jsxs(Ii,{children:[h.jsx(Oe,{children:"Tag"}),h.jsx(Oe,{align:"right",children:"Approx size (KB)"}),h.jsx(Oe,{align:"right",children:"Total hits"}),h.jsx(Oe,{align:"right",children:"Total misses"}),h.jsx(Oe,{align:"right",children:"Total sets"}),h.jsx(Oe,{align:"right",children:"Total deletes"}),h.jsx(Oe,{align:"right",children:"Hit rate"}),h.jsx(Oe,{align:"right",children:"Miss rate"}),h.jsx(Oe,{align:"right",children:"Avg time between sets (ms)"}),h.jsx(Oe,{align:"right",children:"Avg hits between sets"}),h.jsx(Oe,{align:"right",children:"Avg misses between sets"})]})}),h.jsx(ic,{children:s.map(d=>h.jsxs(Ii,{children:[h.jsx(Oe,{children:h.jsx(ne,{component:"span",sx:{fontFamily:"monospace",fontSize:"0.85rem"},children:d.tag})}),h.jsx(Oe,{align:"right",children:bTe(d.approxCurrentSizeBytes)}),h.jsx(Oe,{align:"right",children:d.totalHits}),h.jsx(Oe,{align:"right",children:d.totalMisses}),h.jsx(Oe,{align:"right",children:d.totalSets}),h.jsx(Oe,{align:"right",children:d.totalDeletes}),h.jsxs(Oe,{align:"right",children:[d.hitRate.toFixed(1),"%"]}),h.jsxs(Oe,{align:"right",children:[d.missRate.toFixed(1),"%"]}),h.jsx(Oe,{align:"right",children:d.avgTimeBetweenSetsMs!=null?d.avgTimeBetweenSetsMs.toFixed(0):"—"}),h.jsx(Oe,{align:"right",children:d.avgHitsBetweenSets!=null?d.avgHitsBetweenSets.toFixed(2):"—"}),h.jsx(Oe,{align:"right",children:d.avgMissesBetweenSets!=null?d.avgMissesBetweenSets.toFixed(2):"—"})]},d.tag))})]})}),s.length===0&&h.jsx(Be,{sx:{mt:1},children:h.jsx(ne,{variant:"caption",color:"text.secondary",children:"No tag-level insights available for the current filters."})})]})]})}function bTe(e){return e==null?"—":(e/1024).toFixed(2)}function xTe({filters:e}){var C,I,A;const{beforeDate:t,afterDate:r,orderBy:n,orderDirection:i,searchQuery:o,groupsInclude:a,groupsExclude:s,tagsInclude:u,tagsExclude:d,keys:f}=e,{data:p,isLoading:v,isFetching:y,error:b,refetch:w}=cTe({beforeDate:t,afterDate:r,orderBy:n,orderDirection:i,searchQuery:o,groupsInclude:a,groupsExclude:s,tagsInclude:u,tagsExclude:d,keys:f,groupBy:"both"}),x=p==null?void 0:p.out,k=((C=x==null?void 0:x.keys)==null?void 0:C.reduce((T,M)=>T+(M.currentSizeBytes??0),0))??0,$=m.useMemo(()=>{var R,D;const T=((R=x==null?void 0:x.keys)==null?void 0:R.map(O=>({entityType:"key",key:O.key,currentSizeBytes:O.currentSizeBytes??"",currentSizeKB:O.currentSizeBytes!=null?(O.currentSizeBytes/1024).toFixed(2):"",lastSetAt:Ip(O.lastSetAt),lastDeleteAt:Ip(O.lastDeleteAt),lastHitAt:Ip(O.lastHitAt),lastMissAt:Ip(O.lastMissAt),lastActivityAt:Ip(O.lastActivityAt),totalHits:O.totalHits,totalMisses:O.totalMisses,totalSets:O.totalSets,totalDeletes:O.totalDeletes,hitsSinceLastSet:O.hitsSinceLastSet,missesSinceLastSet:O.missesSinceLastSet,deletesSinceLastSet:O.deletesSinceLastSet,avgTimeBetweenSetsMs:O.avgTimeBetweenSetsMs??"",avgHitsBetweenSets:O.avgHitsBetweenSets??"",avgMissesBetweenSets:O.avgMissesBetweenSets??"",hitRate:O.hitRate,missRate:O.missRate})))??[],M=((D=x==null?void 0:x.tags)==null?void 0:D.map(O=>({entityType:"tag",tag:O.tag,approxCurrentSizeBytes:O.approxCurrentSizeBytes??"",approxCurrentSizeKB:O.approxCurrentSizeBytes!=null?(O.approxCurrentSizeBytes/1024).toFixed(2):"",totalHits:O.totalHits,totalMisses:O.totalMisses,totalSets:O.totalSets,totalDeletes:O.totalDeletes,avgTimeBetweenSetsMs:O.avgTimeBetweenSetsMs??"",avgHitsBetweenSets:O.avgHitsBetweenSets??"",avgMissesBetweenSets:O.avgMissesBetweenSets??"",hitRate:O.hitRate,missRate:O.missRate})))??[];return[...T,...M]},[x]),P=(x==null?void 0:x.keys)&&x.keys.length>0,j=(x==null?void 0:x.tags)&&x.tags.length>0;if(v||y)return h.jsx(Ma,{variant:"table"});if(b){const T=b instanceof Error?b.message:"Failed to load cache insights.",M=b instanceof Error?b.stack:b?String(b):void 0;return h.jsx(ia,{message:T,details:M,onRetry:()=>w()})}return!x||!((I=x.keys)!=null&&I.length)&&!((A=x.tags)!=null&&A.length)?h.jsx(ji,{title:"No cache insights",description:"Try expanding the time range or relaxing other filters."}):h.jsxs(ue,{spacing:3,children:[h.jsxs(Be,{sx:{borderRadius:1.5,border:"1px solid",borderColor:"divider",px:2,py:1.5,display:"flex",flexDirection:{xs:"column",sm:"row"},gap:2,alignItems:{xs:"flex-start",sm:"center"},justifyContent:"space-between",bgcolor:"background.paper"},children:[h.jsxs(Be,{children:[h.jsx(ne,{variant:"subtitle2",color:"text.secondary",children:"Total approximate current cache size"}),h.jsx(ne,{variant:"h6",sx:{fontFamily:"monospace",mt:.5},children:wTe(k)}),h.jsx(ne,{variant:"caption",color:"text.secondary",sx:{display:"block",mt:.5},children:"Derived from per-key current sizes in the insights window."})]}),h.jsxs(ue,{spacing:1,alignItems:{xs:"flex-start",sm:"flex-end"},children:[h.jsxs(ne,{variant:"caption",color:"text.secondary",children:["Computed at ",ek(x.computedAt)]}),h.jsxs(ue,{direction:"row",spacing:1,flexWrap:"wrap",useFlexGap:!0,children:[x.windowStart&&h.jsx(dr,{size:"small",variant:"outlined",label:`Window start: ${ek(x.windowStart)}`}),x.windowEnd&&h.jsx(dr,{size:"small",variant:"outlined",label:`Window end: ${ek(x.windowEnd)}`})]}),h.jsx(Sf,{filename:"cache-insights.csv",rows:$,title:"Export per-key and per-tag cache insights."})]})]}),P&&h.jsx(gTe,{keys:x.keys}),j&&h.jsx(yTe,{tags:x.tags})]})}function wTe(e){if(!e)return"—";const t=["B","KB","MB","GB"],r=Math.min(Math.floor(Math.log(e)/Math.log(1024)),t.length-1);return`${(e/1024**r).toFixed(2)} ${t[r]}`}function ek(e){if(!e)return"—";try{return new Date(e).toLocaleString()}catch{return"—"}}function Ip(e){if(!e)return"";try{return new Date(e).toISOString()}catch{return""}}function STe({logs:e}){const t=[...e].sort((i,o)=>o.createdAt-i.createdAt),[r,n]=m.useState(null);return h.jsxs(h.Fragment,{children:[h.jsx(oc,{component:Yn,variant:"outlined",children:h.jsxs(nc,{size:"small",sx:{tableLayout:"fixed"},children:[h.jsxs("colgroup",{children:[h.jsx("col",{style:{width:180}})," ",h.jsx("col",{style:{width:220}})," ",h.jsx("col",{style:{width:120}})," ",h.jsx("col",{style:{width:220}})," ",h.jsx("col",{style:{width:100}})," ",h.jsx("col",{})," "]}),h.jsx(ac,{children:h.jsxs(Ii,{children:[h.jsx(Oe,{children:"Timestamp"}),h.jsx(Oe,{children:"Key"}),h.jsx(Oe,{children:"Operation"}),h.jsx(Oe,{children:"Tags"}),h.jsx(Oe,{align:"right",children:"Size"}),h.jsx(Oe,{children:"Value"})]})}),h.jsx(ic,{children:t.map(i=>h.jsxs(Ii,{hover:!0,onClick:()=>n(i),sx:{cursor:"pointer"},children:[h.jsx(Oe,{children:new Date(i.createdAt).toLocaleString()}),h.jsx(Oe,{children:h.jsx(ne,{component:"span",sx:{fontFamily:"monospace",fontSize:"0.9rem",display:"block",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:i.name})}),h.jsx(Oe,{children:h.jsx(lO,{operation:i.operation})}),h.jsx(Oe,{children:i.tags&&i.tags.length>0?h.jsx(ue,{direction:"row",flexWrap:"wrap",spacing:.5,useFlexGap:!0,children:i.tags.map(o=>h.jsx(dr,{label:o,size:"small",variant:"outlined"},o))}):h.jsx(ne,{variant:"body2",color:"text.disabled",component:"span",children:"—"})}),h.jsx(Oe,{align:"right",children:h.jsx(ne,{variant:"body2",component:"span",sx:{fontFamily:"monospace"},children:PTe(i.size)})}),h.jsx(Oe,{children:h.jsx(Be,{sx:{fontFamily:"monospace",fontSize:"0.875rem",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},title:kV(i.value),children:kTe(i.value)})})]},i.id))})]})}),r&&h.jsx(iV,{log:r,onClose:()=>n(null)})]})}function kV(e){if(e==null)return"null";if(typeof e=="string")return e;try{return JSON.stringify(e)}catch{return String(e)}}function kTe(e,t=120){const r=kV(e);return r.length<=t?r:`${r.slice(0,t-1)}…`}function PTe(e){if(!e||!Number.isFinite(e))return"—";const t=["B","KB","MB","GB","TB"],r=Math.min(Math.floor(Math.log(e)/Math.log(1024)),t.length-1);return`${(e/1024**r).toFixed(r===0?0:2)} ${t[r]}`}function $Te({items:e,logs:t,onSelectKey:r}){const[n,i]=m.useState("lastActivity"),[o,a]=m.useState("desc"),s=m.useCallback(v=>{n===v?a(y=>y==="asc"?"desc":"asc"):(i(v),a("asc"))},[n]),u=m.useMemo(()=>{const v=[...e];return v.sort((y,b)=>{const w=n==="key"?y.key.localeCompare(b.key):pL(y,n)-pL(b,n);return o==="asc"?w:-w}),v},[e,n,o]),d=(v,y,b)=>h.jsx(Oe,{sortDirection:n===v?o:!1,align:b,children:h.jsx(Xae,{active:n===v,direction:n===v?o:"asc",onClick:()=>s(v),children:y})}),f=v=>{if(!v)return"—";const y=["B","KB","MB","GB"],b=Math.min(Math.floor(Math.log(v)/Math.log(1024)),y.length-1);return`${(v/1024**b).toFixed(2)} ${y[b]}`},p=m.useMemo(()=>e.reduce((v,y)=>v+(y.sizeBytes??0),0),[e]);return h.jsxs(h.Fragment,{children:[h.jsx(Be,{sx:{mt:2,mb:2},children:h.jsxs(Be,{sx:{borderRadius:1.5,border:"1px solid",borderColor:"divider",px:2,py:1.5,display:"flex",alignItems:"baseline",justifyContent:"space-between",bgcolor:"background.paper"},children:[h.jsxs(Be,{children:[h.jsx(ne,{variant:"subtitle2",color:"text.secondary",children:"Total approximate cache size"}),h.jsx(ne,{variant:"h6",sx:{fontFamily:"monospace",mt:.5},children:f(p)})]}),h.jsxs(ne,{variant:"caption",color:"text.secondary",sx:{opacity:.8},children:["Based on ",t.length," fetched cache entries; actual size may vary."]})]})}),h.jsx(oc,{children:h.jsxs(nc,{size:"small",children:[h.jsx(ac,{children:h.jsxs(Ii,{children:[d("key","Key"),d("lastActivity","Last activity"),d("lastSetAt","Last set"),d("lastHitAt","Last hit"),d("lastMissAt","Last miss"),d("totalHits","Total hits","right"),d("totalMisses","Total misses","right"),d("totalSets","Total sets","right"),d("sizeBytes","Size","right")]})}),h.jsx(ic,{children:u.map((v,y)=>h.jsxs(Ii,{hover:!0,sx:{cursor:r?"pointer":"default"},onClick:()=>r==null?void 0:r(v,y,u.map(b=>({...b}))),children:[h.jsx(Oe,{children:h.jsx(ne,{component:"span",sx:{fontFamily:"monospace",fontSize:"0.9rem"},children:v.key})}),h.jsx(Oe,{children:Sv(PV(v))}),h.jsx(Oe,{children:Sv(v.lastSetAt)}),h.jsx(Oe,{children:Sv(v.lastHitAt)}),h.jsx(Oe,{children:Sv(v.lastMissAt)}),h.jsx(Oe,{align:"right",children:v.totalHits}),h.jsx(Oe,{align:"right",children:v.totalMisses}),h.jsx(Oe,{align:"right",children:v.totalSets}),h.jsx(Oe,{align:"right",children:f(v.sizeBytes||0)})]},v.key))})]})})]})}function Sv(e){if(!e)return"—";try{return new Date(e).toLocaleString()}catch{return"—"}}function pL(e,t){switch(t){case"lastActivity":return PV(e);case"lastSetAt":return e.lastSetAt??0;case"lastHitAt":return e.lastHitAt??0;case"lastMissAt":return e.lastMissAt??0;case"totalHits":return e.totalHits;case"totalMisses":return e.totalMisses;case"totalSets":return e.totalSets;case"sizeBytes":return e.sizeBytes??0;default:return 0}}function PV(e){return Math.max(e.lastSetAt??0,e.lastHitAt??0,e.lastMissAt??0)}const hL={...Pf,operationsInclude:[],operationsExclude:[],keySearch:"",keys:[]};function CTe(){const[e,t]=m.useState("summary"),[r,n]=m.useState(null),[i,o]=m.useState(null),[a,s]=m.useState(null),[u,d]=kf("logsCacheFilters",{defaultValue:hL,serialize:H=>$f(H),deserialize:H=>Cf(H,hL)}),f=rn("GET /__rrroutes/cache",{cursorParam:"cursor",getNextPageParam(H){return H.meta.nextCursor},splitPageSize:500,splitPageSizeParam:"pageSize"}),p=rn("POST /__rrroutes/cache/clear"),{data:v,isLoading:y,error:b,refetch:w,isFetching:x,fetchNextPage:k,hasNextPage:$,isFetchingNextPage:P}=f.useEndpoint({query:u}),j=m.useMemo(()=>v?Array.isArray(v.pages)?v.pages.flatMap(H=>Array.isArray(H==null?void 0:H.out)?H.out:[]):[]:[],[v]),C=m.useMemo(()=>{if(!v)return[];const H=new Map;return j.forEach(X=>{const re=X.name;H.has(re)||H.set(re,{key:X.name,lastSetAt:null,lastHitAt:null,lastMissAt:null,totalHits:0,totalMisses:0,totalSets:0});const he=H.get(re);if(X.operation==="set"?(he.lastSetAt=Math.max(he.lastSetAt??0,X.createdAt),he.totalSets+=1):X.operation==="hit"?(he.lastHitAt=Math.max(he.lastHitAt??0,X.createdAt),he.totalHits+=1):X.operation==="miss"&&(he.lastMissAt=Math.max(he.lastMissAt??0,X.createdAt),he.totalMisses+=1),typeof X.size=="number"){const J=he._sizeSeenAt??0;X.createdAt>=J&&(he.sizeBytes=X.size,he._sizeSeenAt=X.createdAt)}}),Array.from(H.values()).map(({_sizeSeenAt:X,...re})=>re)},[v,j]),I=(u.keySearch??"").trim().toLowerCase(),A=m.useMemo(()=>I?j.filter(H=>(H.name??"").toLowerCase().includes(I)):j,[j,I]),T=m.useMemo(()=>I?C.filter(H=>H.key.toLowerCase().includes(I)):C,[C,I]),M=m.useMemo(()=>{const H=new Set;return C.forEach(X=>H.add(X.key)),Array.from(H).sort((X,re)=>X.localeCompare(re))},[C]),R=m.useMemo(()=>A.map(H=>({timestamp:kv(H.createdAt),operation:H.operation,key:H.name??"",sizeBytes:H.size??"",tags:Array.isArray(H.tags)?H.tags.join(", "):"",valueSummary:ETe(H.value)})),[A]),D=m.useMemo(()=>T.map(H=>({key:H.key,totalHits:H.totalHits,totalMisses:H.totalMisses,totalSets:H.totalSets,lastHitAt:kv(H.lastHitAt),lastMissAt:kv(H.lastMissAt),lastSetAt:kv(H.lastSetAt),sizeBytes:H.sizeBytes??""})),[T]),O=e==="logs"?{filename:"cache-logs.csv",rows:R}:e==="summary"?{filename:"cache-summary.csv",rows:D}:null,L=(a==null?void 0:a.orderedItems[a.index])??null,z=a!==null&&a.index>0,F=a!==null&&a.index<a.orderedItems.length-1,B=m.useCallback((H,X,re)=>{s({orderedItems:re.map(he=>({...he})),index:X})},[]),U=m.useCallback(()=>{s(null)},[]),V=m.useCallback(()=>{s(H=>!H||H.index<=0?H:{...H,index:H.index-1})},[]),K=m.useCallback(()=>{s(H=>!H||H.index>=H.orderedItems.length-1?H:{...H,index:H.index+1})},[]),Z=m.useCallback(H=>{w(),n(`Cache cleared for "${H}"`)},[w]),W=(H,X)=>{d(re=>{const he=new Set(re.operationsInclude),J=new Set(re.operationsExclude);return X==="include"?(he.has(H)?he.delete(H):he.add(H),J.delete(H)):(J.has(H)?J.delete(H):J.add(H),he.delete(H)),{...re,operationsInclude:Array.from(he),operationsExclude:Array.from(J)}})},q=H=>{var X,re;return(X=u.operationsInclude)!=null&&X.includes(H)?"include":(re=u.operationsExclude)!=null&&re.includes(H)?"exclude":"none"},oe=(()=>{if(e==="insights")return h.jsx(xTe,{filters:u});if(y)return h.jsx(Ma,{variant:"table"});if(b){const X=b instanceof Error?b.message:"Failed to load cache logs.",re=b instanceof Error?b.stack:b?String(b):void 0;return h.jsx(ia,{message:X,details:re,onRetry:()=>w()})}if(!j.length)return h.jsx(ji,{title:"No cache logs",description:"Adjust filters or clear the cache."});const H=e==="logs";return H&&!A.length?h.jsx(ji,{title:"No cache logs match",description:"Adjust the key search or filters."}):!H&&!T.length?h.jsx(ji,{title:"No cache keys match",description:"Adjust the key search or filters."}):H?h.jsx(xf,{isLoading:y,data:v,items:A,fetchNextPage:k,hasNextPage:$,isFetchingNextPage:P,pageSize:u.pageSize,children:X=>h.jsx(STe,{logs:X})}):h.jsx($Te,{logs:A,items:T,onSelectKey:B})})(),Y=async()=>{o(null);try{await p.fetch({query:u},void 0),n("Cache cleared"),w()}catch(H){const X=H instanceof Error?H.message:"Failed to clear cache.";o(X)}};return h.jsxs(h.Fragment,{children:[h.jsxs(ue,{spacing:3,sx:{mt:2},children:[h.jsx(_t,{title:"Cache filters",actions:h.jsx(zt,{variant:"outlined",onClick:Y,children:"Clear cache (current filters)"}),children:h.jsx(wf,{value:u,onChange:H=>d(X=>({...X,...H})),onRefresh:()=>w(),refreshing:x,children:H=>h.jsxs(ue,{spacing:2,children:[h.jsxs(ue,{spacing:1,children:[h.jsx(ne,{variant:"overline",color:"text.secondary",children:"Operations"}),h.jsx(ue,{direction:"row",spacing:1,flexWrap:"wrap",useFlexGap:!0,children:R3.map(X=>h.jsx(lO,{operation:X,state:q(X),onClick:()=>W(X,H)},X))})]}),h.jsx(Vt,{label:"Key search",placeholder:"Search cache keys",value:u.keySearch??"",onChange:X=>d(re=>({...re,keySearch:X.target.value})),size:"small",fullWidth:!0}),h.jsx(hl,{multiple:!0,freeSolo:!0,options:M,value:u.keys??[],onChange:(X,re)=>d(he=>({...he,keys:re.map(J=>J.trim()).filter(J=>J.length>0)})),renderTags:(X,re)=>X.map((he,J)=>h.jsx(dr,{size:"small",variant:"outlined",label:he,...re({index:J})})),renderInput:X=>h.jsx(Vt,{...X,label:"Specific keys (exact match)",placeholder:"Add keys",size:"small",helperText:"Filter cache logs server-side for exact keys"})})]})})}),i&&h.jsx(xa,{severity:"error",children:i}),h.jsx(_t,{title:"Cache data",actions:h.jsxs(ue,{direction:"row",spacing:1,alignItems:"center",children:[O&&h.jsx(Sf,{filename:O.filename,rows:O.rows,title:"Exports the data for the current cache view."}),h.jsxs(Ub,{value:e,onChange:(H,X)=>t(X),sx:{minHeight:32},children:[h.jsx(ml,{label:"Logs",value:"logs"}),h.jsx(ml,{label:"Summary",value:"summary"}),h.jsx(ml,{label:"Insights",value:"insights"})]})]}),children:oe})]}),h.jsx(uae,{open:!!r,autoHideDuration:3e3,onClose:()=>n(null),message:r}),h.jsx(nV,{open:!!L,cacheKey:L==null?void 0:L.key,summary:L,baseQuery:u,onClose:U,onPrev:z?V:void 0,onNext:F?K:void 0,onCleared:Z})]})}function kv(e){if(!e)return"";try{return new Date(e).toISOString()}catch{return""}}function jTe(e){if(e==null)return"";if(typeof e=="string")return e;try{return JSON.stringify(e)}catch{return String(e)}}function ETe(e){const t=jTe(e);return t.length<=120?t:`${t.slice(0,119)}…`}function ITe(){const[e,t]=m.useState("application");return h.jsxs(Go,{title:"Logs",subtitle:"Monitor system logs and debugging output.",children:[h.jsxs(Ub,{value:e,onChange:(r,n)=>t(n),children:[h.jsx(ml,{label:"Application",value:"application"}),h.jsx(ml,{label:"Cache",value:"cache"})]}),e==="application"&&h.jsx(sTe,{}),e==="cache"&&h.jsx(CTe,{})]})}function OTe(){return h.jsx(Go,{title:"Page Not Found",subtitle:"The page you're looking for does not exist.",children:h.jsx(ne,{color:"text.secondary",children:"Please double-check the URL or use the navigation to find a destination."})})}function _Te({value:e,onChange:t}){var i;const r=(o,a)=>{t({...e,[o]:a})},n=((i=e.tags)==null?void 0:i.join(", "))??"";return h.jsxs(ue,{spacing:2,children:[h.jsx(ne,{variant:"h6",children:"Preset details"}),h.jsx(Vt,{label:"Name",value:e.name,onChange:o=>r("name",o.target.value),required:!0}),h.jsx(Vt,{label:"Group",value:e.groupId||"",onChange:o=>r("groupId",o.target.value),helperText:"Optional group identifier"}),h.jsx(Vt,{label:"Tags",value:n,onChange:o=>{const a=o.target.value.split(",").map(s=>s.trim()).filter(Boolean);r("tags",a)},helperText:"Comma-separated list"})]})}function ATe({operations:e,onChange:t}){const[r,n]=m.useState({}),[i,o]=m.useState({}),[a,s]=m.useState({}),[u,d]=m.useState({}),[f,p]=m.useState(!1),{fetch:v}=rf();m.useEffect(()=>{const T={};e.forEach((M,R)=>{T[No(R,"body")]=tk(M.body),T[No(R,"query")]=tk(M.query),T[No(R,"extraHeaders")]=tk(M.extraHeaders)}),n(T),o({})},[e]),m.useEffect(()=>{s(T=>{const M={};return e.forEach((R,D)=>{T[D]&&(M[D]=T[D])}),M})},[e]);const y=(T,M)=>{const R=e.map((D,O)=>O===T?{...D,...M}:D);t(R)},b=()=>{const T={name:"",description:"",stepNumber:e.length+1,method:"get",path:"",endpointId:""};t([...e,T])},w=T=>{const M=e.filter((R,D)=>D!==T);t(M)},x=(T,M,R)=>{n(D=>({...D,[No(T,M)]:R}))},k=(T,M)=>{const R=No(T,M),D=r[R]||"";if(!D.trim()){y(T,{[M]:void 0}),o(O=>({...O,[R]:void 0}));return}try{const O=JSON.parse(D);y(T,{[M]:O}),o(L=>({...L,[R]:void 0}))}catch{o(O=>({...O,[R]:"Invalid JSON"}))}},$=m.useMemo(()=>e.map((T,M)=>({op:T,index:M})).sort((T,M)=>{const R=T.op.stepNumber??T.index+1,D=M.op.stepNumber??M.index+1;return R!==D?R-D:T.index-M.index}),[e]),P=(T,M)=>{const R=T+M;if(R<0||R>=$.length)return;const D=$[T],O=$[R],L=D.op.stepNumber??T+1,z=O.op.stepNumber??R+1,F=e.map((B,U)=>U===D.index?{...B,stepNumber:z}:U===O.index?{...B,stepNumber:L}:B);t(F)},j=T=>{d(M=>({...M,[T]:!M[T]}))},C=m.useCallback(async(T,M)=>{const R=e[T];if(!R)return{success:!1};if(!(M!=null&&M.skipConfirm)&&nk(R)&&!window.confirm(`Operation "${R.name||R.path}" may modify data. Continue?`))return{success:!1};if(!R.path.trim())return s(D=>({...D,[T]:{status:"error",errorMessage:"Path is required before running this operation."}})),{success:!1};s(D=>({...D,[T]:{status:"running"}}));try{const D=TTe(R),O=await v(R.method,R.path,D,`preset-run-${T}-${Date.now()}`),L=!O.error&&O.log.status>=200&&O.log.status<400;return s(z=>{var F;return{...z,[T]:{status:L?"success":"error",statusCode:O.log.status,durationMs:O.log.durationMs,errorMessage:(F=O.error)==null?void 0:F.message,response:O.log.output}}}),{success:L}}catch(D){const O=D instanceof Error?D.message:"Failed to run operation.";return s(L=>({...L,[T]:{status:"error",errorMessage:O}})),{success:!1}}},[v,e]),I=m.useCallback(async T=>{await C(T)},[C]),A=m.useCallback(async()=>{if(!(!$.length||$.some(({op:M})=>nk(M))&&!window.confirm("This preset contains operations that may modify or delete data. Run all operations?"))){p(!0);for(const{index:M}of $)if(!(await C(M,{skipConfirm:!0})).success)break;p(!1)}},[C,$]);return h.jsxs(ue,{spacing:2,children:[h.jsxs(ue,{direction:"row",justifyContent:"space-between",alignItems:"center",children:[h.jsx(ne,{variant:"h6",children:"Operations"}),h.jsxs(ue,{direction:"row",spacing:1,children:[h.jsx(zt,{startIcon:h.jsx(cb,{}),variant:"contained",onClick:A,disabled:f||!$.length,children:f?"Running...":"Run all operations"}),h.jsx(zt,{startIcon:h.jsx(cV,{}),variant:"outlined",onClick:b,children:"Add operation"})]})]}),e.length===0&&h.jsx(ne,{color:"text.secondary",children:"No operations defined yet. Add one to start building this preset."}),$.map(({op:T,index:M},R)=>{var D,O;return h.jsxs(ec,{defaultExpanded:!0,children:[h.jsx(rc,{expandIcon:h.jsx(ea,{}),children:h.jsxs(ue,{direction:"row",spacing:2,alignItems:"center",flexWrap:"wrap",sx:{width:"100%"},children:[h.jsxs(ne,{variant:"subtitle1",children:["Operation ",R+1]}),h.jsx(ne,{variant:"body2",color:"text.secondary",children:T.name||"Untitled"}),T.description?h.jsx(ne,{variant:"body2",color:"text.secondary",sx:{fontStyle:"italic"},children:T.description}):null,h.jsx(Be,{sx:{flexGrow:1}}),h.jsx(qn,{size:"small",onClick:L=>{L.stopPropagation(),P(R,-1)},disabled:R===0,children:h.jsx(bV,{fontSize:"small"})}),h.jsx(qn,{size:"small",onClick:L=>{L.stopPropagation(),P(R,1)},disabled:R===$.length-1,children:h.jsx(yV,{fontSize:"small"})}),h.jsx(qn,{onClick:L=>{L.stopPropagation(),w(M)},children:h.jsx(dV,{})})]})}),h.jsx(tc,{children:h.jsxs(ue,{spacing:2,children:[h.jsxs(ue,{direction:{xs:"column",sm:"row"},spacing:2,children:[h.jsx(Vt,{label:"Name",value:T.name||"",onChange:L=>y(M,{name:L.target.value}),fullWidth:!0}),h.jsx(Vt,{type:"number",label:"Step number",value:T.stepNumber??R+1,onChange:L=>y(M,{stepNumber:Number(L.target.value)}),sx:{width:{xs:"100%",sm:160}}})]}),h.jsx(Vt,{label:"Description",value:T.description??"",onChange:L=>y(M,{description:L.target.value}),multiline:!0,minRows:2}),h.jsxs(ue,{direction:{xs:"column",sm:"row"},spacing:2,children:[h.jsx(Vt,{select:!0,label:"Method",value:T.method,onChange:L=>y(M,{method:L.target.value}),sx:{width:{xs:"100%",sm:160}},children:ax.map(L=>h.jsx(el,{value:L,children:L.toUpperCase()},L))}),h.jsx(Vt,{label:"Path",value:T.path,onChange:L=>y(M,{path:L.target.value}),fullWidth:!0})]}),rk({label:"Body",index:M,field:"body",value:r[No(M,"body")]||"",error:i[No(M,"body")],onChange:x,onBlur:k}),rk({label:"Query",index:M,field:"query",value:r[No(M,"query")]||"",error:i[No(M,"query")],onChange:x,onBlur:k}),rk({label:"Extra headers",index:M,field:"extraHeaders",value:r[No(M,"extraHeaders")]||"",error:i[No(M,"extraHeaders")],onChange:x,onBlur:k}),h.jsxs(ue,{spacing:1,children:[h.jsxs(ue,{direction:{xs:"column",sm:"row"},spacing:1,alignItems:{xs:"stretch",sm:"center"},justifyContent:"space-between",children:[h.jsx(zt,{startIcon:h.jsx(cb,{}),variant:"outlined",onClick:()=>I(M),disabled:((D=a[M])==null?void 0:D.status)==="running",children:((O=a[M])==null?void 0:O.status)==="running"?"Running...":"Run this operation"}),nk(T)?h.jsx(ne,{variant:"caption",color:"warning.main",children:"Requires confirmation (potentially destructive)"}):null]}),h.jsx(RTe,{state:a[M],onToggleResponse:()=>j(M),responseVisible:!!u[M]})]})]})})]},`${M}-${T.name}`)})]})}function No(e,t){return`${e}-${t}`}function tk(e){if(e==null)return"";try{return JSON.stringify(e,null,2)}catch{return""}}function rk({label:e,index:t,field:r,value:n,error:i,onChange:o,onBlur:a}){return h.jsx(Vt,{label:e,multiline:!0,minRows:4,value:n,onChange:s=>o(t,r,s.target.value),onBlur:()=>a(t,r),error:!!i,helperText:i||"JSON format",fullWidth:!0})}function TTe(e){return{params:[],query:MTe(e.query),body:e.body?JSON.stringify(e.body,null,2):""}}function MTe(e){return e?Object.entries(e).map(([t,r])=>({key:t,value:r==null?"":String(r),enabled:!0})):[]}function nk(e){return new Set(["delete","patch"]).has(e.method)||/clear|reset|truncate/i.test(e.path)}function RTe({state:e,onToggleResponse:t,responseVisible:r}){if(!e||e.status==="idle")return null;if(e.status==="running")return h.jsx(ne,{variant:"body2",color:"info.main",children:"Running..."});const n=e.status==="success"?"success.main":"error.main";return h.jsxs(ue,{spacing:1,children:[h.jsxs(ue,{direction:"row",spacing:1,alignItems:"center",children:[h.jsx(dr,{size:"small",color:e.status==="success"?"success":"error",label:e.status==="success"?"Success":"Failed"}),h.jsxs(ne,{variant:"body2",color:n,children:["Status ",e.statusCode??"—"," • ",e.durationMs??"—"," ms"]})]}),e.errorMessage?h.jsx(ne,{variant:"body2",color:"error.main",children:e.errorMessage}):null,e.response!==void 0?h.jsxs(ue,{spacing:1,children:[h.jsx(zt,{size:"small",onClick:t,children:r?"Hide response":"View response"}),r?h.jsx(ai,{title:"Response body",value:e.response,collapsedLines:8}):null]}):null]})}function DTe(){const e=na(),{presetId:t}=QL(),r=!t||t==="new",n=rn("GET /__rrroutes/presets"),i=rn("POST /__rrroutes/presets"),o=rn("PUT /__rrroutes/presets"),{data:a,isLoading:s,error:u,refetch:d}=n.useEndpoint({query:{}}),f=m.useMemo(()=>a?Array.isArray(a.pages)?a.pages.flatMap(I=>Array.isArray(I==null?void 0:I.out)?I.out:[]):[]:[],[a]),[p,v]=m.useState(null),[y,b]=m.useState(!1),[w,x]=m.useState(null),[k,$]=m.useState(null);m.useEffect(()=>{if(r){v(zTe());return}if(f.length){const I=f.find(A=>A.id===t);I&&v(I)}},[r,t,f]);const P=I=>{v(I)},j=I=>{p&&v({...p,operations:I})},C=async()=>{if(p){b(!0),x(null),$(null);try{const I={...p,updatedAt:Date.now()};r?await i.fetch(I):await o.fetch(I),$("Preset saved"),setTimeout(()=>e("/presets"),600)}catch(I){const A=I instanceof Error?I.message:"Failed to save preset.";x(A)}finally{b(!1)}}};if(!r&&s)return h.jsx(Go,{title:"Edit preset",children:h.jsx(Ma,{variant:"full"})});if(!r&&u){const I=u instanceof Error?u.message:"Failed to load preset.",A=u instanceof Error?u.stack:u?String(u):void 0;return h.jsx(Go,{title:"Edit preset",children:h.jsx(ia,{message:I,details:A,onRetry:()=>d()})})}return p?h.jsx(Go,{title:r?"New preset":"Edit preset",subtitle:r?"Define the details and operations for your preset.":"Update preset information and operations.",children:h.jsxs(ue,{spacing:3,children:[w&&h.jsx(xa,{severity:"error",children:w}),k&&h.jsx(xa,{severity:"success",children:k}),h.jsx(_t,{title:"Details",children:h.jsx(_Te,{value:p,onChange:P})}),h.jsx(_t,{title:"Operations",children:h.jsx(ATe,{operations:p.operations,onChange:j})}),h.jsx(Be,{sx:{display:"flex",justifyContent:"flex-end"},children:h.jsx(zt,{variant:"contained",onClick:C,disabled:y||!p.name.trim(),children:y?"Saving...":"Save preset"})})]})}):h.jsx(Go,{title:"Edit preset",children:h.jsx(ji,{title:"Preset not found",description:"This preset may have been removed."})})}function zTe(){const e=Date.now();return{id:"",name:"",description:"",groupId:"",tags:[],createdAt:e,updatedAt:e,operations:[]}}function NTe({preset:e,onClick:t}){var r;return h.jsx(cB,{variant:"outlined",sx:{height:"100%"},children:h.jsx(Lre,{onClick:t,sx:{textAlign:"left",p:2,height:"100%",alignItems:"stretch"},children:h.jsxs(ue,{spacing:1.5,children:[h.jsx(ne,{variant:"h6",children:e.name}),e.description&&h.jsx(ne,{variant:"body2",color:"text.secondary",children:e.description}),e.groupId&&h.jsxs(ne,{variant:"body2",color:"text.secondary",children:["Group: ",e.groupId]}),(r=e.tags)!=null&&r.length?h.jsx(ue,{direction:"row",spacing:1,flexWrap:"wrap",useFlexGap:!0,children:e.tags.map(n=>h.jsx(dr,{label:n,size:"small"},n))}):null,h.jsxs(ne,{variant:"body2",color:"text.secondary",children:[e.operations.length," ",e.operations.length===1?"operation":"operations"]}),e.operations.slice(0,3).map((n,i)=>h.jsxs(ne,{variant:"body2",color:"text.secondary",sx:{fontStyle:n.description?"italic":"normal"},children:["• ",n.name||`${n.method.toUpperCase()} ${n.path}`,n.description?` — ${n.description}`:""]},`${n.name}-${i}`))]})})})}const mL={...Pf,searchQuery:"",nameInclude:"",nameExclude:""};function LTe(){const e=na(),[t,r]=kf("presetsFilters",{defaultValue:mL,serialize:$=>$f($),deserialize:$=>Cf($,mL)}),n=rn("GET /__rrroutes/presets",{cursorParam:"cursor",getNextPageParam($){return $.meta.nextCursor}}),{data:i,isLoading:o,error:a,refetch:s,isFetching:u,fetchNextPage:d,hasNextPage:f,isFetchingNextPage:p}=n.useEndpoint({query:t}),v=m.useMemo(()=>i?Array.isArray(i.pages)?i.pages.flatMap($=>Array.isArray($==null?void 0:$.out)?$.out:[]):[]:[],[i]),y=m.useMemo(()=>{const $=(t.searchQuery??"").trim().toLowerCase();return $?v.filter(P=>{var C;return`${P.name} ${((C=P.tags)==null?void 0:C.join(" "))??""}`.toLowerCase().includes($)}):v},[v,t.searchQuery]),b=m.useMemo(()=>y.map($=>({name:$.name,group:$.groupId??"",tags:Array.isArray($.tags)?$.tags.join(", "):"",operations:$.operations.length})),[y]),w=m.useMemo(()=>{const $=new Set;return v.forEach(P=>{var j;return(j=P.tags)==null?void 0:j.forEach(C=>$.add(C))}),Array.from($).sort()},[v]),x=m.useMemo(()=>{const $=new Set;return v.forEach(P=>{P.groupId&&$.add(P.groupId)}),Array.from($).sort()},[v]),k=(()=>{if(o)return h.jsx(Ma,{variant:"table"});if(a){const $=a instanceof Error?a.message:"Failed to load presets.",P=a instanceof Error?a.stack:a?String(a):void 0;return h.jsx(ia,{message:$,details:P,onRetry:()=>s()})}return y.length?h.jsx(xf,{data:i,isLoading:o,items:y,fetchNextPage:d,hasNextPage:f,isFetchingNextPage:p,pageSize:t.pageSize,children:$=>h.jsx(Bo,{container:!0,spacing:2,children:$.map(P=>h.jsx(Bo,{component:"div",children:h.jsx(NTe,{preset:P,onClick:()=>e(`/presets/${P.id}`)})},P.id))})}):h.jsx(ji,{title:"No presets found",description:"Try adjusting your search query or create a new preset."})})();return h.jsx(Go,{title:"Presets",subtitle:"Manage saved request presets for quick access.",actions:h.jsx(zt,{variant:"contained",onClick:()=>e("/presets/new"),children:"New preset"}),children:h.jsxs(ue,{spacing:3,children:[h.jsx(_t,{title:"Filters",children:h.jsx(wf,{value:t,onChange:$=>r(P=>({...P,...$})),tagOptions:w,groupOptions:x,onRefresh:()=>s(),refreshing:u,children:$=>h.jsxs(h.Fragment,{children:[h.jsx(ue,{direction:{xs:"column",sm:"row"},spacing:2,children:h.jsx(Vt,{label:"Name",value:$==="include"?t.nameInclude:t.nameExclude,onChange:P=>r(j=>({...j,[$==="include"?"nameInclude":"nameExclude"]:P.target.value})),size:"small",fullWidth:!0})}),h.jsx(ne,{variant:"body2",color:"text.secondary",sx:{mt:2},children:"Use the base search field to match names and tags locally while the additional filters narrow the server query."})]})})}),h.jsx(_t,{title:"All presets",actions:h.jsx(Sf,{filename:"presets.csv",rows:b,title:"Exports the currently filtered presets."}),children:k})]})})}const gL={...Pf,searchQuery:"",methodsInclude:[],methodsExclude:[],stabilityInclude:[],stabilityExclude:[]};function BTe(){const e=na(),{queuePrefill:t}=sx(),[r,n]=kf("routesFilters",{defaultValue:gL,serialize:z=>$f(z),deserialize:z=>Cf(z,gL)}),[i,o]=_$(),a=i.get("endpointId"),s=m.useRef(null);gV({searchInputRef:s});const u=m.useRef({}),d=rn("GET /__rrroutes/endpoints",{cursorParam:"cursor",getNextPageParam(z){return z.meta.nextCursor}}),{client:f}=rf();f.build(rE.byKey["GET /__rrroutes/endpoints"],{});const{data:p,isLoading:v,error:y,refetch:b,isFetching:w,fetchNextPage:x,hasNextPage:k,isFetchingNextPage:$}=d.useEndpoint({query:r}),P=(p==null?void 0:p.pages.flatMap(z=>z.out))??[],j=m.useMemo(()=>{const z=new Set;return P.forEach(F=>{var B;return(B=F.tags)==null?void 0:B.forEach(U=>z.add(U))}),Array.from(z).sort()},[P]),C=m.useMemo(()=>{const z=new Set;return P.forEach(F=>{F.groupId&&z.add(F.groupId)}),Array.from(z).sort()},[P]),I=m.useMemo(()=>{const z=(r.searchQuery??"").trim().toLowerCase();return P.filter(F=>z?`${F.path} ${F.summary??""}`.toLowerCase().includes(z):!0)},[P,r.searchQuery]),A=m.useMemo(()=>I.map(z=>({method:z.method.toUpperCase(),path:z.path,group:z.groupId??"",stability:z.stability,implemented:z.implemented===!1?"No":"Yes",summary:z.summary??""})),[I]),T=m.useCallback((z,F)=>{F?u.current[z]=F:delete u.current[z]},[]);m.useEffect(()=>{if(!a)return;const z=u.current[a];z&&z.scrollIntoView({behavior:"smooth",block:"start"})},[a]),m.useEffect(()=>{a&&!I.some(z=>z.id===a)&&o(z=>{const F=new URLSearchParams(z);return F.delete("endpointId"),F},{replace:!0})},[a,I,o]);const M=m.useCallback(z=>{o(F=>{const B=new URLSearchParams(F);return a===z?B.delete("endpointId"):B.set("endpointId",z),B})},[a,o]),R=m.useCallback((z,F)=>{t({method:z.method,path:z.path,params:vL(F.params),query:vL(F.query),body:F.body});const{displayId:B}=ad(z.method,z.path);if(!B)return;const U=oh(B,{tab:"playground",layout:"playground"});e(U)},[e,t]),D=y instanceof Error?y.message:"Failed to load endpoints.",O=y instanceof Error?y.stack:y?String(y):void 0,L=v?h.jsx(Ma,{variant:"table"}):y?h.jsx(ia,{message:D,details:O,onRetry:()=>b()}):I.length?h.jsx(xf,{data:p,isLoading:v,items:I,fetchNextPage:x,hasNextPage:k,isFetchingNextPage:$,pageSize:r.pageSize,children:z=>{const F=UTe(z);return h.jsx(ue,{spacing:4,children:F.map(B=>h.jsxs(ue,{spacing:1.5,children:[h.jsxs(ne,{variant:"subtitle2",color:"text.secondary",sx:{textTransform:"capitalize"},children:[B.title," ",h.jsxs(ne,{component:"span",variant:"caption",color:"text.disabled",sx:{ml:.5},children:["(",B.endpoints.length,")"]})]}),h.jsx(ue,{spacing:1,children:B.endpoints.map(U=>h.jsx(FTe,{endpoint:U,expanded:a===U.id,onToggle:M,registerRef:T,onOpenStandalone:R},U.id))})]},B.id))})}}):h.jsx(ji,{title:"No endpoints found",description:"Try adjusting your filters or search query."});return h.jsx(Go,{title:"Endpoints",subtitle:"Browse and filter every endpoint registered with this service.",children:h.jsxs(ue,{spacing:3,children:[h.jsx(_t,{title:"Filters",children:h.jsx(wf,{value:r,onChange:z=>n(F=>({...F,...z})),searchInputRef:s,tagOptions:j,groupOptions:C,onRefresh:()=>b(),refreshing:w,searchOnly:!0})}),h.jsx(_t,{title:"Endpoints",actions:h.jsxs(ue,{direction:"row",spacing:1,alignItems:"center",children:[h.jsx(Sf,{filename:"endpoints.csv",rows:A,title:"Exports the currently filtered endpoints."}),h.jsxs(ne,{variant:"caption",color:"text.secondary",children:[I.length," results"]})]}),children:L})]})})}function FTe({endpoint:e,expanded:t,onToggle:r,registerRef:n,onOpenStandalone:i}){return h.jsxs(ec,{expanded:t,onChange:()=>r(e.id),ref:o=>n(e.id,o),disableGutters:!0,sx:{border:"1px solid",borderColor:t?"primary.main":"divider",borderRadius:2,bgcolor:"background.default","&::before":{display:"none"}},children:[h.jsx(rc,{expandIcon:h.jsx(ea,{}),children:h.jsxs(ue,{spacing:.5,sx:{width:"100%"},children:[h.jsxs(ue,{direction:"row",spacing:1.5,alignItems:"center",children:[h.jsx(bf,{method:e.method}),h.jsx(ne,{sx:{fontFamily:"monospace",flexGrow:1},color:"text.primary",children:e.path}),h.jsx(ne,{variant:"caption",color:"text.secondary",sx:{textTransform:"capitalize"},children:e.stability}),e.implemented===!1&&h.jsx(dr,{label:"Not implemented",size:"small",color:"warning",variant:"outlined"})]}),e.summary&&h.jsx(ne,{variant:"body2",color:"text.secondary",children:e.summary})]})}),h.jsx(tc,{children:t?h.jsx(hV,{endpointId:e.id,onOpenStandalone:i}):null})]})}function UTe(e){const t=new Map;return e.forEach(n=>{var a,s;const i=((a=n.groupId)==null?void 0:a.trim())||"ungrouped",o=((s=n.groupId)==null?void 0:s.trim())||"Ungrouped";t.has(i)||t.set(i,{id:i,title:o,endpoints:[]}),t.get(i).endpoints.push(n)}),Array.from(t.values()).map(n=>({...n,endpoints:n.endpoints.sort((i,o)=>{const a=i.path.localeCompare(o.path);return a!==0?a:i.method.localeCompare(o.method)})})).sort((n,i)=>{const o=n.id==="ungrouped"?"zzzz":n.title.toLowerCase(),a=i.id==="ungrouped"?"zzzz":i.title.toLowerCase();return o.localeCompare(a)})}function vL(e){return e.reduce((t,r)=>(r.enabled&&r.key.trim()&&(t[r.key.trim()]=r.value),t),{})}function WTe(e){const t=rn("GET /__rrroutes/sockets",{cursorParam:"cursor",getNextPageParam(p){return p.meta.nextCursor},splitPageSizeParam:"pageSize",splitPageSize:e.pageSize}),{data:r,isLoading:n,error:i,refetch:o,isFetching:a,fetchNextPage:s,hasNextPage:u,isFetchingNextPage:d}=t.useEndpoint({query:e});return{events:m.useMemo(()=>!r||!Array.isArray(r.pages)?[]:r.pages.flatMap(p=>Array.isArray(p==null?void 0:p.out)?p.out:[]),[r]),data:r,isLoading:n,error:i,refetch:o,isFetching:a,fetchNextPage:s,hasNextPage:u,isFetchingNextPage:d}}function KTe(){const e=rn("POST /__rrroutes/sockets");return{emit:r=>e.fetch(r).then(n=>n.out)}}function HTe({events:e,onSelect:t,onOpenGroup:r}){return h.jsx(oc,{component:Yn,variant:"outlined",children:h.jsxs(nc,{size:"small",children:[h.jsx(ac,{children:h.jsxs(Ii,{children:[h.jsx(Oe,{children:"Timestamp"}),h.jsx(Oe,{children:"Event"}),h.jsx(Oe,{children:"Rooms"}),h.jsx(Oe,{children:"Message"}),h.jsx(Oe,{children:"Tags"}),h.jsx(Oe,{children:"Group"})]})}),h.jsx(ic,{children:e.map(n=>{var i;return h.jsxs(Ii,{hover:!0,sx:{cursor:t?"pointer":"default"},onClick:()=>t==null?void 0:t(n,e),children:[h.jsx(Oe,{children:VTe(n.createdAt)}),h.jsx(Oe,{sx:{maxWidth:200},children:h.jsx(ne,{variant:"body2",noWrap:!0,sx:{fontFamily:"monospace"},children:n.eventName})}),h.jsx(Oe,{sx:{maxWidth:200},children:qTe(n.toRoomId)}),h.jsx(Oe,{sx:{maxWidth:320},children:GTe(n.message)}),h.jsx(Oe,{children:(i=n.tags)!=null&&i.length?h.jsx(ue,{direction:"row",spacing:.5,flexWrap:"wrap",useFlexGap:!0,children:n.tags.map(o=>h.jsx(dr,{label:o,size:"small"},o))}):h.jsx(ne,{variant:"body2",color:"text.secondary",children:"—"})}),h.jsx(Oe,{children:n.groupId?h.jsx(dr,{label:n.groupId,size:"small",variant:"outlined",sx:{fontFamily:"monospace"},onClick:o=>{o.stopPropagation(),r==null||r(n.groupId,n)}}):h.jsx(ne,{variant:"body2",color:"text.secondary",sx:{fontFamily:"monospace"},noWrap:!0,children:"—"})})]},n.id)})})]})})}function VTe(e){if(!e)return"";try{return new Date(e).toLocaleString()}catch{return""}}function qTe(e){if(!e||e.length===0)return h.jsx(ne,{variant:"body2",color:"text.secondary",children:"—"});const t=e.join(", "),r=t.length>80?`${t.slice(0,80)}…`:t;return r===t?h.jsx(ne,{variant:"body2",noWrap:!0,children:t}):h.jsx(Bh,{title:t,children:h.jsx(ne,{variant:"body2",noWrap:!0,children:r})})}function GTe(e){const t=ZTe(e);if(!t)return h.jsx(ne,{variant:"body2",color:"text.secondary",children:"—"});const r=t.length>120?`${t.slice(0,119)}…`:t;return r===t?h.jsx(ne,{variant:"body2",noWrap:!0,children:t}):h.jsx(Bh,{title:t,children:h.jsx(ne,{variant:"body2",noWrap:!0,children:r})})}function ZTe(e){if(e==null)return"";if(typeof e=="string")return e;try{return JSON.stringify(e)}catch{return String(e)}}const yL={...Pf,eventName:"",roomsInclude:[],roomsExclude:[]};function XTe(){const[e,t]=kf("socketEventsFilters",{defaultValue:yL,serialize:C=>$f(C),deserialize:C=>Cf(C,yL)}),[r,n]=m.useState(null),[i,o]=m.useState(null),{events:a,data:s,isLoading:u,error:d,refetch:f,isFetching:p,fetchNextPage:v,hasNextPage:y,isFetchingNextPage:b}=WTe(e),w=a.length>0,x=m.useMemo(()=>{const C=new Set;return a.forEach(I=>{I.eventName&&C.add(I.eventName)}),Array.from(C).sort((I,A)=>I.localeCompare(A))},[a]),k=m.useMemo(()=>{const C=new Set;return a.forEach(I=>{Array.isArray(I.toRoomId)&&I.toRoomId.forEach(A=>{A&&C.add(A)})}),Array.from(C).sort((I,A)=>I.localeCompare(A))},[a]),$=m.useCallback(C=>{n(C)},[]),P=m.useCallback(C=>{C&&(n(null),o(C))},[]),j=(()=>{if(u)return h.jsx(Ma,{variant:"table"});if(d){const C=d instanceof Error?d.message:"Failed to load socket events.",I=d instanceof Error?d.stack:d?String(d):void 0;return h.jsx(ia,{message:C,details:I,onRetry:()=>f()})}return w?h.jsx(xf,{data:s,items:a,isLoading:u,fetchNextPage:v,hasNextPage:y,isFetchingNextPage:b,pageSize:e.pageSize,children:C=>h.jsx(HTe,{events:C,onSelect:I=>$(I),onOpenGroup:I=>P(I)})}):h.jsx(ji,{title:"No socket events",description:"Emit some events from the playground or adjust the filters."})})();return h.jsxs(h.Fragment,{children:[h.jsxs(ue,{spacing:3,sx:{mt:2},children:[h.jsx(_t,{title:"Socket events filters",children:h.jsx(wf,{value:e,onChange:C=>t(I=>({...I,...C})),onRefresh:()=>f(),refreshing:p,children:()=>h.jsxs(ue,{spacing:2,children:[h.jsxs(ue,{spacing:1,children:[h.jsx(ne,{variant:"overline",color:"text.secondary",children:"Event name"}),h.jsx(hl,{freeSolo:!0,options:x,value:e.eventName??"",onChange:(C,I)=>t(A=>({...A,eventName:I??""})),onInputChange:(C,I)=>t(A=>({...A,eventName:I??""})),renderInput:C=>h.jsx(Vt,{...C,label:"Event name",placeholder:"Exact event name",size:"small"})})]}),h.jsxs(ue,{spacing:1,children:[h.jsx(ne,{variant:"overline",color:"text.secondary",children:"Rooms include / exclude"}),h.jsxs(ue,{direction:{xs:"column",sm:"row"},spacing:2,alignItems:{xs:"stretch",sm:"flex-start"},children:[h.jsx(hl,{multiple:!0,freeSolo:!0,options:k,value:e.roomsInclude??[],onChange:(C,I)=>t(A=>({...A,roomsInclude:I.map(T=>T.trim()).filter(T=>T.length>0)})),renderTags:(C,I)=>C.map((A,T)=>h.jsx(dr,{size:"small",variant:"outlined",label:A,...I({index:T})})),renderInput:C=>h.jsx(Vt,{...C,label:"Rooms include",placeholder:"Rooms to include",size:"small"}),sx:{flex:1}}),h.jsx(hl,{multiple:!0,freeSolo:!0,options:k,value:e.roomsExclude??[],onChange:(C,I)=>t(A=>({...A,roomsExclude:I.map(T=>T.trim()).filter(T=>T.length>0)})),renderTags:(C,I)=>C.map((A,T)=>h.jsx(dr,{size:"small",variant:"outlined",label:A,...I({index:T})})),renderInput:C=>h.jsx(Vt,{...C,label:"Rooms exclude",placeholder:"Rooms to exclude",size:"small"}),sx:{flex:1}})]})]})]})})}),h.jsx(_t,{title:"Socket events",children:j})]}),h.jsx(H3,{open:!!r,event:r,onClose:()=>n(null),onOpenGroup:C=>P(C)}),h.jsx(Em,{open:!!i,request:null,requestId:i,onClose:()=>o(null)})]})}function YTe({left:e,right:t,leftWidth:r=35}){const n=Math.min(Math.max(r,10),70);return h.jsxs(Be,{sx:{display:"flex",flexDirection:{xs:"column",md:"row"},gap:3,width:"100%"},children:[h.jsx(Be,{sx:{width:{xs:"100%",md:`${n}%`},flexShrink:0},children:e}),h.jsx(Be,{sx:{width:{xs:"100%",md:`${100-n}%`},flexGrow:1},children:t})]})}function QTe(){const{emit:e}=KTe(),[t,r]=m.useState(""),[n,i]=m.useState(""),[o,a]=m.useState(""),[s,u]=m.useState(null),[d,f]=m.useState(null),[p,v]=m.useState(!1),[y,b]=m.useState(null),[w,x]=m.useState(null),[k,$]=m.useState(null),[P,j]=m.useState(null),[C,I]=m.useState(null),A=async T=>{T.preventDefault(),b(null),x(null),u(null),f(null);const M=t.trim();if(!M){u("Event name is required");return}const R=JTe(n);let D;if(o.trim())try{D=JSON.parse(o)}catch{f("Invalid JSON message");return}const O={eventName:M,message:D,toRoomId:R};v(!0);try{const L=await e(O);$(O),j(L),I(200),x(L!=null&&L.success?`Event emitted successfully${L.eventId?` (eventId: ${L.eventId})`:""}.`:"Event emitted but server reported unsuccessful status.")}catch(L){let z=null,F="Failed to emit event.",B=null;if(L instanceof Jj){if(z=L.status,B=L.body,L.body&&typeof L.body=="object"&&"message"in L.body){const U=L.body.message;typeof U=="string"&&(F=U)}}else L instanceof Error&&(F=L.message);$(O),j(B??L),I(z),b(z?`${F} (status ${z})`:F)}finally{v(!1)}};return h.jsxs(ue,{spacing:3,component:"form",onSubmit:A,children:[h.jsxs(ne,{variant:"body1",color:"text.secondary",children:["Use this playground to emit socket events via the POST"," ",h.jsx("code",{children:"/__rrroutes/sockets"})," endpoint. Provide an event name, an optional list of target rooms, and a JSON message payload."]}),h.jsxs(ue,{spacing:2,children:[h.jsx(Vt,{label:"Event name",value:t,onChange:T=>r(T.target.value),required:!0,fullWidth:!0,error:!!s,helperText:s||"Required. Example: chat.message"}),h.jsx(Vt,{label:"Target rooms",value:n,onChange:T=>i(T.target.value),fullWidth:!0,helperText:"Comma-separated room IDs. Leave empty for broadcast (toRoomId = null)."}),h.jsx(Vt,{label:"Message (JSON)",value:o,onChange:T=>a(T.target.value),multiline:!0,minRows:8,fullWidth:!0,placeholder:'{"text": "Hello from socket playground"}',error:!!d,helperText:d||"Optional JSON payload for the event."})]}),h.jsx(Be,{sx:{display:"flex",justifyContent:"flex-end"},children:h.jsx(zt,{type:"submit",variant:"contained",startIcon:h.jsx(cb,{}),disabled:p,children:p?"Emitting...":"Emit event"})}),y&&h.jsx(xa,{severity:"error",variant:"outlined",children:y}),w&&h.jsx(xa,{severity:"success",variant:"outlined",children:w}),!y&&!w&&h.jsx(ne,{variant:"body2",color:"text.secondary",children:"Emit an event to see the last payload and server response here."}),!!(k||P)&&h.jsx(YTe,{left:h.jsx(ai,{title:"Last emitted payload",value:k??{info:"No payload emitted yet."},collapsedLines:16}),right:h.jsxs(ue,{spacing:1,children:[h.jsxs(ne,{variant:"subtitle2",color:"text.secondary",children:["Server response",C!==null?` (status ${C})`:""]}),h.jsx(ai,{title:"Response body",value:P??{info:"No response recorded yet."},collapsedLines:16})]}),leftWidth:50})]})}function JTe(e){const t=e.trim();if(!t)return null;const r=t.split(",").map(n=>n.trim()).filter(Boolean);return r.length?r:null}function e2e(){return h.jsx(Go,{title:"Sockets",subtitle:"Emit socket events and browse logged socket activity.",children:h.jsxs(ue,{spacing:3,children:[h.jsx(_t,{title:"Socket playground",children:h.jsx(QTe,{})}),h.jsx(XTe,{})]})})}function t2e(){return h.jsx(Cse,{children:h.jsxs(tZ,{children:[h.jsx(Lo,{path:"/",element:h.jsx(oT,{replace:!0,to:"/routes"})}),h.jsx(Lo,{path:"/routes",element:h.jsx(BTe,{})}),h.jsx(Lo,{path:"/routes/:endpointId",element:h.jsx($Ae,{})}),h.jsx(Lo,{path:"/presets",element:h.jsx(LTe,{})}),h.jsx(Lo,{path:"/presets/:presetId",element:h.jsx(DTe,{})}),h.jsx(Lo,{path:"/history",element:h.jsx(nTe,{})}),h.jsx(Lo,{path:"/logs",element:h.jsx(ITe,{})}),h.jsx(Lo,{path:"/sockets",element:h.jsx(e2e,{})}),h.jsx(Lo,{path:"/playground/*",element:h.jsx(oT,{replace:!0,to:"/routes"})}),h.jsx(Lo,{path:"*",element:h.jsx(OTe,{})})]})})}function r2e(){const e=document.getElementById("docs-root");if(e)return e;const t=document.createElement("div");return t.id="docs-root",document.body.appendChild(t),t}function n2e(){const e=document.getElementById("docs-config");if(!e)throw new Error("Docs config element not found");try{return JSON.parse(e.textContent||"{}")}catch(t){throw console.error("Failed to parse docs config",t),t}}const uO=n2e(),i2e=NL({key:"rrroutes-docs",nonce:uO.cspNonce}),o2e=(uO.docsBasePath||"").replace(/\/+$/,"")||"/",a2e=uO.baseUrl||window.location.origin,s2e=r2e();uG.createRoot(s2e).render(h.jsx(J7,{value:i2e,children:h.jsx($Z,{basename:o2e,children:h.jsx(npe,{initialBaseUrl:a2e,children:h.jsx(Cpe,{children:h.jsx(t2e,{})})})})}));
373
+ */var uN;function HCe(){if(uN)return W1;uN=1;var e=qd();function t(u,d){return u===d&&(u!==0||1/u===1/d)||u!==u&&d!==d}var r=typeof Object.is=="function"?Object.is:t,n=e.useSyncExternalStore,i=e.useRef,o=e.useEffect,a=e.useMemo,s=e.useDebugValue;return W1.useSyncExternalStoreWithSelector=function(u,d,f,p,v){var y=i(null);if(y.current===null){var b={hasValue:!1,value:null};y.current=b}else b=y.current;y=a(function(){function x(C){if(!k){if(k=!0,$=C,C=p(C),v!==void 0&&b.hasValue){var I=b.value;if(v(I,C))return P=I}return P=C}if(I=P,r($,C))return I;var A=p(C);return v!==void 0&&v(I,A)?($=C,I):($=C,P=A)}var k=!1,$,P,j=f===void 0?null:f;return[function(){return x(d())},j===null?void 0:function(){return x(j())}]},[d,f,p,v]);var w=n(u,y[0],y[1]);return o(function(){b.hasValue=!0,b.value=w},[w]),s(w),w},W1}var cN;function VCe(){return cN||(cN=1,U1.exports=HCe()),U1.exports}VCe();function qCe(e){e()}function GCe(){let e=null,t=null;return{clear(){e=null,t=null},notify(){qCe(()=>{let r=e;for(;r;)r.callback(),r=r.next})},get(){const r=[];let n=e;for(;n;)r.push(n),n=n.next;return r},subscribe(r){let n=!0;const i=t={callback:r,next:null,prev:t};return i.prev?i.prev.next=i:e=i,function(){!n||e===null||(n=!1,i.next?i.next.prev=i.prev:t=i.prev,i.prev?i.prev.next=i.next:e=i.next)}}}}var dN={notify(){},get:()=>[]};function ZCe(e,t){let r,n=dN,i=0,o=!1;function a(w){f();const x=n.subscribe(w);let k=!1;return()=>{k||(k=!0,x(),p())}}function s(){n.notify()}function u(){b.onStateChange&&b.onStateChange()}function d(){return o}function f(){i++,r||(r=e.subscribe(u),n=GCe())}function p(){i--,r&&i===0&&(r(),r=void 0,n.clear(),n=dN)}function v(){o||(o=!0,f())}function y(){o&&(o=!1,p())}const b={addNestedSub:a,notifyNestedSubs:s,handleChangeWrapper:u,isSubscribed:d,trySubscribe:v,tryUnsubscribe:y,getListeners:()=>n};return b}var XCe=()=>typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",YCe=XCe(),QCe=()=>typeof navigator<"u"&&navigator.product==="ReactNative",JCe=QCe(),eje=()=>YCe||JCe?m.useLayoutEffect:m.useEffect,tje=eje();function fN(e,t){return e===t?e!==0||t!==0||1/e===1/t:e!==e&&t!==t}function rje(e,t){if(fN(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;const r=Object.keys(e),n=Object.keys(t);if(r.length!==n.length)return!1;for(let i=0;i<r.length;i++)if(!Object.prototype.hasOwnProperty.call(t,r[i])||!fN(e[r[i]],t[r[i]]))return!1;return!0}var K1=Symbol.for("react-redux-context"),H1=typeof globalThis<"u"?globalThis:{};function nje(){if(!m.createContext)return{};const e=H1[K1]??(H1[K1]=new Map);let t=e.get(m.createContext);return t||(t=m.createContext(null),e.set(m.createContext,t)),t}var ije=nje();function oje(e){const{children:t,context:r,serverState:n,store:i}=e,o=m.useMemo(()=>{const u=ZCe(i);return{store:i,subscription:u,getServerState:n?()=>n:void 0}},[i,n]),a=m.useMemo(()=>i.getState(),[i]);tje(()=>{const{subscription:u}=o;return u.onStateChange=u.notifyNestedSubs,u.trySubscribe(),a!==i.getState()&&u.notifyNestedSubs(),()=>{u.tryUnsubscribe(),u.onStateChange=void 0}},[o,a]);const s=r||ije;return m.createElement(s.Provider,{value:o},t)}var aje=oje,sje=new Set(["axisLine","tickLine","activeBar","activeDot","activeLabel","activeShape","allowEscapeViewBox","background","cursor","dot","label","line","margin","padding","position","shape","style","tick","wrapperStyle"]);function lje(e,t){return e==null&&t==null?!0:typeof e=="number"&&typeof t=="number"?e===t||e!==e&&t!==t:e===t}function Pm(e,t){var r=new Set([...Object.keys(e),...Object.keys(t)]);for(var n of r)if(sje.has(n)){if(e[n]==null&&t[n]==null)continue;if(!rje(e[n],t[n]))return!1}else if(!lje(e[n],t[n]))return!1;return!0}var uje=["onMouseEnter","onMouseLeave","onClick"],cje=["value","background","tooltipPosition"],dje=["id"],fje=["onMouseEnter","onClick","onMouseLeave"];function xs(){return xs=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},xs.apply(null,arguments)}function pN(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function si(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?pN(Object(r),!0).forEach(function(n){pje(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):pN(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function pje(e,t,r){return(t=hje(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function hje(e){var t=mje(e,"string");return typeof t=="symbol"?t:t+""}function mje(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function nb(e,t){if(e==null)return{};var r,n,i=gje(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n<o.length;n++)r=o[n],t.indexOf(r)===-1&&{}.propertyIsEnumerable.call(e,r)&&(i[r]=e[r])}return i}function gje(e,t){if(e==null)return{};var r={};for(var n in e)if({}.hasOwnProperty.call(e,n)){if(t.indexOf(n)!==-1)continue;r[n]=e[n]}return r}var vje=e=>{var{dataKey:t,name:r,fill:n,legendType:i,hide:o}=e;return[{inactive:o,dataKey:t,type:i,color:n,value:Nl(r,t),payload:e}]},yje=m.memo(e=>{var{dataKey:t,stroke:r,strokeWidth:n,fill:i,name:o,hide:a,unit:s,tooltipType:u}=e,d={dataDefinedOnItem:void 0,positions:void 0,settings:{stroke:r,strokeWidth:n,fill:i,dataKey:t,nameKey:void 0,name:Nl(o,t),hide:a,type:u,color:i,unit:s}};return m.createElement(Yx,{tooltipEntrySettings:d})});function bje(e){var t=Le(jl),{data:r,dataKey:n,background:i,allOtherBarProps:o}=e,{onMouseEnter:a,onMouseLeave:s,onClick:u}=o,d=nb(o,uje),f=VI(a,n),p=qI(s),v=GI(u,n);if(!i||r==null)return null;var y=Vu(i);return m.createElement(Qn,{zIndex:KCe(i,Wr.barBackground)},r.map((b,w)=>{var{value:x,background:k,tooltipPosition:$}=b,P=nb(b,cje);if(!k)return null;var j=f(b,w),C=p(b,w),I=v(b,w),A=si(si(si(si(si({option:i,isActive:String(w)===t},P),{},{fill:"#eee"},k),y),tm(d,b,w)),{},{onMouseEnter:j,onMouseLeave:C,onClick:I,dataKey:n,index:w,className:"recharts-bar-background-rectangle"});return m.createElement(rb,xs({key:"background-bar-".concat(w)},A))}))}function xje(e){var{showLabels:t,children:r,rects:n}=e,i=n==null?void 0:n.map(o=>{var a={x:o.x,y:o.y,width:o.width,lowerWidth:o.width,upperWidth:o.width,height:o.height};return si(si({},a),{},{value:o.value,payload:o.payload,parentViewBox:o.parentViewBox,viewBox:a,fill:o.fill})});return m.createElement(BI,{value:t?i:void 0},r)}function wje(e){var{shape:t,activeBar:r,baseProps:n,entry:i,index:o,dataKey:a}=e,s=Le(jl),u=Le(MI),d=r&&String(o)===s&&(u==null||a===u),f=d?r:t;return d?m.createElement(Qn,{zIndex:Wr.activeBar},m.createElement(rb,xs({},n,{name:String(n.name)},i,{isActive:d,option:f,index:o,dataKey:a}))):m.createElement(rb,xs({},n,{name:String(n.name)},i,{isActive:d,option:f,index:o,dataKey:a}))}function Sje(e){var{shape:t,baseProps:r,entry:n,index:i,dataKey:o}=e;return m.createElement(rb,xs({},r,{name:String(r.name)},n,{isActive:!1,option:t,index:i,dataKey:o}))}function kje(e){var t,{data:r,props:n}=e,i=(t=Zn(n))!==null&&t!==void 0?t:{},{id:o}=i,a=nb(i,dje),{shape:s,dataKey:u,activeBar:d}=n,{onMouseEnter:f,onClick:p,onMouseLeave:v}=n,y=nb(n,fje),b=VI(f,u),w=qI(v),x=GI(p,u);return r?m.createElement(m.Fragment,null,r.map((k,$)=>m.createElement(fr,xs({key:"rectangle-".concat(k==null?void 0:k.x,"-").concat(k==null?void 0:k.y,"-").concat(k==null?void 0:k.value,"-").concat($),className:"recharts-bar-rectangle"},tm(y,k,$),{onMouseEnter:b(k,$),onMouseLeave:w(k,$),onClick:x(k,$)}),d?m.createElement(wje,{shape:s,activeBar:d,baseProps:a,entry:k,index:$,dataKey:u}):m.createElement(Sje,{shape:s,baseProps:a,entry:k,index:$,dataKey:u})))):null}function Pje(e){var{props:t,previousRectanglesRef:r}=e,{data:n,layout:i,isAnimationActive:o,animationBegin:a,animationDuration:s,animationEasing:u,onAnimationEnd:d,onAnimationStart:f}=t,p=r.current,v=cf(t,"recharts-bar-"),[y,b]=m.useState(!1),w=!y,x=m.useCallback(()=>{typeof d=="function"&&d(),b(!1)},[d]),k=m.useCallback(()=>{typeof f=="function"&&f(),b(!0)},[f]);return m.createElement(xje,{showLabels:w,rects:n},m.createElement(uf,{animationId:v,begin:a,duration:s,isActive:o,easing:u,onAnimationEnd:x,onAnimationStart:k,key:v},$=>{var P=$===1?n:n==null?void 0:n.map((j,C)=>{var I=p&&p[C];if(I)return si(si({},j),{},{x:Zt(I.x,j.x,$),y:Zt(I.y,j.y,$),width:Zt(I.width,j.width,$),height:Zt(I.height,j.height,$)});if(i==="horizontal"){var A=Zt(0,j.height,$),T=Zt(j.stackedBarStart,j.y,$);return si(si({},j),{},{y:T,height:A})}var M=Zt(0,j.width,$),R=Zt(j.stackedBarStart,j.x,$);return si(si({},j),{},{width:M,x:R})});return $>0&&(r.current=P??null),P==null?null:m.createElement(fr,null,m.createElement(kje,{props:t,data:P}))}),m.createElement(Gx,{label:t.label}),t.children)}function $je(e){var t=m.useRef(null);return m.createElement(Pje,{previousRectanglesRef:t,props:e})}var gH=0,Cje=(e,t)=>{var r=Array.isArray(e.value)?e.value[1]:e.value;return{x:e.x,y:e.y,value:r,errorVal:Xt(e,t)}};class jje extends m.PureComponent{render(){var{hide:t,data:r,dataKey:n,className:i,xAxisId:o,yAxisId:a,needClip:s,background:u,id:d}=this.props;if(t||r==null)return null;var f=ve("recharts-bar",i),p=d;return m.createElement(fr,{className:f,id:d},s&&m.createElement("defs",null,m.createElement(YI,{clipPathId:p,xAxisId:o,yAxisId:a})),m.createElement(fr,{className:"recharts-bar-rectangles",clipPath:s?"url(#clipPath-".concat(p,")"):void 0},m.createElement(bje,{data:r,dataKey:n,background:u,allOtherBarProps:this.props}),m.createElement($je,this.props)))}}var Eje={activeBar:!1,animationBegin:0,animationDuration:400,animationEasing:"ease",background:!1,hide:!1,isAnimationActive:"auto",label:!1,legendType:"rect",minPointSize:gH,xAxisId:0,yAxisId:0,zIndex:Wr.bar};function Ije(e){var{xAxisId:t,yAxisId:r,hide:n,legendType:i,minPointSize:o,activeBar:a,animationBegin:s,animationDuration:u,animationEasing:d,isAnimationActive:f}=e,{needClip:p}=t0(t,r),v=uc(),y=hn(),b=WI(e.children,qx),w=Le($=>nEe($,t,r,y,e.id,b));if(v!=="vertical"&&v!=="horizontal")return null;var x,k=w==null?void 0:w[0];return k==null||k.height==null||k.width==null?x=0:x=v==="vertical"?k.height/2:k.width/2,m.createElement(mH,{xAxisId:t,yAxisId:r,data:w,dataPointFormatter:Cje,errorBarOffset:x},m.createElement(jje,xs({},e,{layout:v,needClip:p,data:w,xAxisId:t,yAxisId:r,hide:n,legendType:i,minPointSize:o,activeBar:a,animationBegin:s,animationDuration:u,animationEasing:d,isAnimationActive:f})))}function Oje(e){var{layout:t,barSettings:{dataKey:r,minPointSize:n},pos:i,bandSize:o,xAxis:a,yAxis:s,xAxisTicks:u,yAxisTicks:d,stackedData:f,displayedData:p,offset:v,cells:y,parentViewBox:b,dataStartIndex:w}=e,x=t==="horizontal"?s:a,k=f?x.scale.domain():null,$=ove({numericAxis:x}),P=x.scale($);return p.map((j,C)=>{var I,A,T,M,R,D;f?I=eve(f[C+w],k):(I=Xt(j,r),Array.isArray(I)||(I=[$,I]));var O=DCe(n,gH)(I[1],C);if(t==="horizontal"){var L,[z,F]=[s.scale(I[0]),s.scale(I[1])];A=TR({axis:a,ticks:u,bandSize:o,offset:i.offset,entry:j,index:C}),T=(L=F??z)!==null&&L!==void 0?L:void 0,M=i.size;var B=z-F;if(R=wo(B)?0:B,D={x:A,y:v.top,width:M,height:v.height},Math.abs(O)>0&&Math.abs(R)<Math.abs(O)){var U=$n(R||O)*(Math.abs(O)-Math.abs(R));T-=U,R+=U}}else{var[V,K]=[a.scale(I[0]),a.scale(I[1])];if(A=V,T=TR({axis:s,ticks:d,bandSize:o,offset:i.offset,entry:j,index:C}),M=K-V,R=i.size,D={x:v.left,y:T,width:v.width,height:R},Math.abs(O)>0&&Math.abs(M)<Math.abs(O)){var Z=$n(M||O)*(Math.abs(O)-Math.abs(M));M+=Z}}if(A==null||T==null||M==null||R==null)return null;var W=si(si({},j),{},{stackedBarStart:P,x:A,y:T,width:M,height:R,value:f?I:I[1],payload:j,background:D,tooltipPosition:{x:A+M/2,y:T+R/2},parentViewBox:b},y&&y[C]&&y[C].props);return W}).filter(Boolean)}function _je(e){var t=Er(e,Eje),r=hn();return m.createElement(Qx,{id:t.id,type:"bar"},n=>m.createElement(m.Fragment,null,m.createElement(ZI,{legendPayload:vje(t)}),m.createElement(yje,{dataKey:t.dataKey,stroke:t.stroke,strokeWidth:t.strokeWidth,fill:t.fill,name:t.name,hide:t.hide,unit:t.unit,tooltipType:t.tooltipType}),m.createElement(XI,{type:"bar",id:n,data:void 0,xAxisId:t.xAxisId,yAxisId:t.yAxisId,zAxisId:0,dataKey:t.dataKey,stackId:c8(t.stackId),hide:t.hide,barSize:t.barSize,minPointSize:t.minPointSize,maxBarSize:t.maxBarSize,isPanorama:r}),m.createElement(Qn,{zIndex:t.zIndex},m.createElement(Ije,xs({},t,{id:n})))))}var r0=m.memo(_je,Pm);r0.displayName="Bar";function hN(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function mv(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?hN(Object(r),!0).forEach(function(n){Aje(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):hN(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function Aje(e,t,r){return(t=Tje(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Tje(e){var t=Mje(e,"string");return typeof t=="symbol"?t:t+""}function Mje(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var Rje=(e,t)=>t,Dje=(e,t,r)=>r,zje=(e,t,r,n)=>n,Nje=(e,t,r,n,i)=>i,$m=ce([gm,Nje],(e,t)=>e.filter(r=>r.type==="bar").find(r=>r.id===t)),Lje=ce([$m],e=>e==null?void 0:e.maxBarSize),Bje=(e,t,r,n,i,o)=>o,mN=(e,t,r)=>{var n=r??e;if(!xr(n))return Gn(n,t,0)},Fje=ce([At,gm,Rje,Dje,zje],(e,t,r,n,i)=>t.filter(o=>e==="horizontal"?o.xAxisId===r:o.yAxisId===n).filter(o=>o.isPanorama===i).filter(o=>o.hide===!1).filter(o=>o.type==="bar")),Uje=(e,t,r,n)=>{var i=At(e);return i==="horizontal"?bh(e,"yAxis",r,n):bh(e,"xAxis",t,n)},Wje=(e,t,r)=>{var n=At(e);return n==="horizontal"?fz(e,"xAxis",t):fz(e,"yAxis",r)},Kje=(e,t,r)=>{var n={},i=e.filter(Lx),o=e.filter(d=>d.stackId==null),a=i.reduce((d,f)=>(d[f.stackId]||(d[f.stackId]=[]),d[f.stackId].push(f),d),n),s=Object.entries(a).map(d=>{var[f,p]=d,v=p.map(b=>b.dataKey),y=mN(t,r,p[0].barSize);return{stackId:f,dataKeys:v,barSize:y}}),u=o.map(d=>{var f=[d.dataKey].filter(v=>v!=null),p=mN(t,r,d.barSize);return{stackId:void 0,dataKeys:f,barSize:p}});return[...s,...u]},Hje=ce([Fje,wwe,Wje],Kje),Vje=(e,t,r,n,i)=>{var o,a,s=$m(e,t,r,n,i);if(s!=null){var u=At(e),d=M9(e),{maxBarSize:f}=s,p=xr(f)?d:f,v,y;return u==="horizontal"?(v=Ia(e,"xAxis",t,n),y=Ea(e,"xAxis",t,n)):(v=Ia(e,"yAxis",r,n),y=Ea(e,"yAxis",r,n)),(o=(a=Pl(v,y,!0))!==null&&a!==void 0?a:p)!==null&&o!==void 0?o:0}},vH=(e,t,r,n)=>{var i=At(e),o,a;return i==="horizontal"?(o=Ia(e,"xAxis",t,n),a=Ea(e,"xAxis",t,n)):(o=Ia(e,"yAxis",r,n),a=Ea(e,"yAxis",r,n)),Pl(o,a)};function qje(e,t,r,n,i){var o=n.length;if(!(o<1)){var a=Gn(e,r,0,!0),s,u=[];if(wr(n[0].barSize)){var d=!1,f=r/o,p=n.reduce((k,$)=>k+($.barSize||0),0);p+=(o-1)*a,p>=r&&(p-=(o-1)*a,a=0),p>=r&&f>0&&(d=!0,f*=.9,p=o*f);var v=(r-p)/2>>0,y={offset:v-a,size:0};s=n.reduce((k,$)=>{var P,j={stackId:$.stackId,dataKeys:$.dataKeys,position:{offset:y.offset+y.size+a,size:d?f:(P=$.barSize)!==null&&P!==void 0?P:0}},C=[...k,j];return y=C[C.length-1].position,C},u)}else{var b=Gn(t,r,0,!0);r-2*b-(o-1)*a<=0&&(a=0);var w=(r-2*b-(o-1)*a)/o;w>1&&(w>>=0);var x=wr(i)?Math.min(w,i):w;s=n.reduce((k,$,P)=>[...k,{stackId:$.stackId,dataKeys:$.dataKeys,position:{offset:b+(w+a)*P+(w-x)/2,size:x}}],u)}return s}}var Gje=(e,t,r,n,i,o,a)=>{var s=xr(a)?t:a,u=qje(r,n,i!==o?i:o,e,s);return i!==o&&u!=null&&(u=u.map(d=>mv(mv({},d),{},{position:mv(mv({},d.position),{},{offset:d.position.offset-i/2})}))),u},Zje=ce([Hje,M9,xwe,R9,Vje,vH,Lje],Gje),Xje=(e,t,r,n)=>Ia(e,"xAxis",t,n),Yje=(e,t,r,n)=>Ia(e,"yAxis",r,n),Qje=(e,t,r,n)=>Ea(e,"xAxis",t,n),Jje=(e,t,r,n)=>Ea(e,"yAxis",r,n),eEe=ce([Zje,$m],(e,t)=>{if(!(e==null||t==null)){var r=e.find(n=>n.stackId===t.stackId&&t.dataKey!=null&&n.dataKeys.includes(t.dataKey));if(r!=null)return r.position}}),tEe=(e,t)=>{var r=Nx(t);if(!(!e||r==null||t==null)){var{stackId:n}=t;if(n!=null){var i=e[n];if(i){var{stackedData:o}=i;if(o)return o.find(a=>a.key===r)}}}},rEe=ce([Uje,$m],tEe),nEe=ce([pn,kE,Xje,Yje,Qje,Jje,eEe,At,fm,vH,rEe,$m,Bje],(e,t,r,n,i,o,a,s,u,d,f,p,v)=>{var{chartData:y,dataStartIndex:b,dataEndIndex:w}=u;if(!(p==null||a==null||t==null||s!=="horizontal"&&s!=="vertical"||r==null||n==null||i==null||o==null||d==null)){var{data:x}=p,k;if(x!=null&&x.length>0?k=x:k=y==null?void 0:y.slice(b,w+1),k!=null)return Oje({layout:s,barSettings:p,pos:a,parentViewBox:t,bandSize:d,xAxis:r,yAxis:n,xAxisTicks:i,yAxisTicks:o,stackedData:f,displayedData:k,offset:e,cells:v,dataStartIndex:b})}});function gN(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function vN(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?gN(Object(r),!0).forEach(function(n){iEe(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):gN(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function iEe(e,t,r){return(t=oEe(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function oEe(e){var t=aEe(e,"string");return typeof t=="symbol"?t:t+""}function aEe(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var sEe=["Webkit","Moz","O","ms"],lEe=(e,t)=>{var r=e.replace(/(\w)/,i=>i.toUpperCase()),n=sEe.reduce((i,o)=>vN(vN({},i),{},{[o+r]:t}),{});return n[e]=t,n},yH=e=>{var{chartData:t}=e,r=ir(),n=hn();return m.useEffect(()=>n?()=>{}:(r(Pz(t)),()=>{r(Pz(void 0))}),[t,r,n]),null},uEe=e=>e.chartData.chartData,cEe=()=>Le(uEe),dEe=e=>{var{dataStartIndex:t,dataEndIndex:r}=e.chartData;return{startIndex:t,endIndex:r}},fEe=()=>Le(dEe),pEe=m.createContext(()=>{}),yN={x:0,y:0,width:0,height:0,padding:{top:0,right:0,bottom:0,left:0}},bH=Oi({name:"brush",initialState:yN,reducers:{setBrushSettings(e,t){return t.payload==null?yN:t.payload}}}),{setBrushSettings:bN}=bH.actions,hEe=bH.reducer;function xh(){return xh=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},xh.apply(null,arguments)}function xN(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function uu(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?xN(Object(r),!0).forEach(function(n){Ga(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):xN(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function Ga(e,t,r){return(t=mEe(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function mEe(e){var t=gEe(e,"string");return typeof t=="symbol"?t:t+""}function gEe(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function vEe(e){var{x:t,y:r,width:n,height:i,stroke:o}=e,a=Math.floor(r+i/2)-1;return m.createElement(m.Fragment,null,m.createElement("rect",{x:t,y:r,width:n,height:i,fill:o,stroke:"none"}),m.createElement("line",{x1:t+1,y1:a,x2:t+n-1,y2:a,fill:"none",stroke:"#fff"}),m.createElement("line",{x1:t+1,y1:a+2,x2:t+n-1,y2:a+2,fill:"none",stroke:"#fff"}))}function yEe(e){var{travellerProps:t,travellerType:r}=e;return m.isValidElement(r)?m.cloneElement(r,t):typeof r=="function"?r(t):m.createElement(vEe,t)}function wN(e){var t,r,{otherProps:n,travellerX:i,id:o,onMouseEnter:a,onMouseLeave:s,onMouseDown:u,onTouchStart:d,onTravellerMoveKeyboard:f,onFocus:p,onBlur:v}=e,{y,x:b,travellerWidth:w,height:x,traveller:k,ariaLabel:$,data:P,startIndex:j,endIndex:C}=n,I=Math.max(i,b),A=uu(uu({},Zn(n)),{},{x:I,y,width:w,height:x}),T=$||"Min value: ".concat((t=P[j])===null||t===void 0?void 0:t.name,", Max value: ").concat((r=P[C])===null||r===void 0?void 0:r.name);return m.createElement(fr,{tabIndex:0,role:"slider","aria-label":T,"aria-valuenow":i,className:"recharts-brush-traveller",onMouseEnter:a,onMouseLeave:s,onMouseDown:u,onTouchStart:d,onKeyDown:M=>{["ArrowLeft","ArrowRight"].includes(M.key)&&(M.preventDefault(),M.stopPropagation(),f(M.key==="ArrowRight"?1:-1,o))},onFocus:p,onBlur:v,style:{cursor:"col-resize"}},m.createElement(yEe,{travellerType:k,travellerProps:A}))}function SN(e){var{index:t,data:r,tickFormatter:n,dataKey:i}=e,o=Xt(r[t],i,t);return typeof n=="function"?n(o,t):o}function kN(e,t){for(var r=e.length,n=0,i=r-1;i-n>1;){var o=Math.floor((n+i)/2);e[o]>t?i=o:n=o}return t>=e[i]?i:n}function V1(e){var{startX:t,endX:r,scaleValues:n,gap:i,data:o}=e,a=o.length-1,s=Math.min(t,r),u=Math.max(t,r),d=kN(n,s),f=kN(n,u);return{startIndex:d-d%i,endIndex:f===a?a:f-f%i}}function bEe(e){var{x:t,y:r,width:n,height:i,fill:o,stroke:a}=e;return m.createElement("rect",{stroke:a,fill:o,x:t,y:r,width:n,height:i})}function xEe(e){var{startIndex:t,endIndex:r,y:n,height:i,travellerWidth:o,stroke:a,tickFormatter:s,dataKey:u,data:d,startX:f,endX:p}=e,v=5,y={pointerEvents:"none",fill:a};return m.createElement(fr,{className:"recharts-brush-texts"},m.createElement(Vd,xh({textAnchor:"end",verticalAnchor:"middle",x:Math.min(f,p)-v,y:n+i/2},y),SN({index:t,tickFormatter:s,dataKey:u,data:d})),m.createElement(Vd,xh({textAnchor:"start",verticalAnchor:"middle",x:Math.max(f,p)+o+v,y:n+i/2},y),SN({index:r,tickFormatter:s,dataKey:u,data:d})))}function wEe(e){var{y:t,height:r,stroke:n,travellerWidth:i,startX:o,endX:a,onMouseEnter:s,onMouseLeave:u,onMouseDown:d,onTouchStart:f}=e,p=Math.min(o,a)+i,v=Math.max(Math.abs(a-o)-i,0);return m.createElement("rect",{className:"recharts-brush-slide",onMouseEnter:s,onMouseLeave:u,onMouseDown:d,onTouchStart:f,style:{cursor:"move"},stroke:"none",fill:n,fillOpacity:.2,x:p,y:t,width:v,height:r})}function SEe(e){var{x:t,y:r,width:n,height:i,data:o,children:a,padding:s}=e,u=m.Children.count(a)===1;if(!u)return null;var d=m.Children.only(a);return d?m.cloneElement(d,{x:t,y:r,width:n,height:i,margin:s,compact:!0,data:o}):null}var kEe=e=>{var{data:t,startIndex:r,endIndex:n,x:i,width:o,travellerWidth:a}=e;if(!t||!t.length)return{};var s=t.length,u=W8().domain(_E(0,s)).range([i,i+o-a]),d=u.domain().map(f=>u(f)).filter(hW);return{isTextActive:!1,isSlideMoving:!1,isTravellerMoving:!1,isTravellerFocused:!1,startX:u(r),endX:u(n),scale:u,scaleValues:d}},PN=e=>e.changedTouches&&!!e.changedTouches.length;class PEe extends m.PureComponent{constructor(t){super(t),Ga(this,"handleDrag",r=>{this.leaveTimer&&(clearTimeout(this.leaveTimer),this.leaveTimer=null),this.state.isTravellerMoving?this.handleTravellerMove(r):this.state.isSlideMoving&&this.handleSlideDrag(r)}),Ga(this,"handleTouchMove",r=>{r.changedTouches!=null&&r.changedTouches.length>0&&this.handleDrag(r.changedTouches[0])}),Ga(this,"handleDragEnd",()=>{this.setState({isTravellerMoving:!1,isSlideMoving:!1},()=>{var{endIndex:r,onDragEnd:n,startIndex:i}=this.props;n==null||n({endIndex:r,startIndex:i})}),this.detachDragEndListener()}),Ga(this,"handleLeaveWrapper",()=>{(this.state.isTravellerMoving||this.state.isSlideMoving)&&(this.leaveTimer=window.setTimeout(this.handleDragEnd,this.props.leaveTimeOut))}),Ga(this,"handleEnterSlideOrTraveller",()=>{this.setState({isTextActive:!0})}),Ga(this,"handleLeaveSlideOrTraveller",()=>{this.setState({isTextActive:!1})}),Ga(this,"handleSlideDragStart",r=>{var n=PN(r)?r.changedTouches[0]:r;this.setState({isTravellerMoving:!1,isSlideMoving:!0,slideMoveStartX:n.pageX}),this.attachDragEndListener()}),Ga(this,"handleTravellerMoveKeyboard",(r,n)=>{var{data:i,gap:o,startIndex:a,endIndex:s}=this.props,{scaleValues:u,startX:d,endX:f}=this.state;if(u!=null){var p=-1;if(n==="startX"?p=a:n==="endX"&&(p=s),!(p<0||p>=i.length)){var v=p+r;if(!(v===-1||v>=u.length)){var y=u[v];n==="startX"&&y>=f||n==="endX"&&y<=d||this.setState({[n]:y},()=>{this.props.onChange(V1({startX:this.state.startX,endX:this.state.endX,data:i,gap:o,scaleValues:u}))})}}}}),this.travellerDragStartHandlers={startX:this.handleTravellerDragStart.bind(this,"startX"),endX:this.handleTravellerDragStart.bind(this,"endX")},this.state={brushMoveStartX:0,movingTravellerId:void 0,endX:0,startX:0,slideMoveStartX:0}}static getDerivedStateFromProps(t,r){var{data:n,width:i,x:o,travellerWidth:a,startIndex:s,endIndex:u,startIndexControlledFromProps:d,endIndexControlledFromProps:f}=t;if(n!==r.prevData)return uu({prevData:n,prevTravellerWidth:a,prevX:o,prevWidth:i},n&&n.length?kEe({data:n,width:i,x:o,travellerWidth:a,startIndex:s,endIndex:u}):{scale:void 0,scaleValues:void 0});var p=r.scale;if(p&&(i!==r.prevWidth||o!==r.prevX||a!==r.prevTravellerWidth)){p.range([o,o+i-a]);var v=p.domain().map(y=>p(y)).filter(y=>y!=null);return{prevData:n,prevTravellerWidth:a,prevX:o,prevWidth:i,startX:p(t.startIndex),endX:p(t.endIndex),scaleValues:v}}if(r.scale&&!r.isSlideMoving&&!r.isTravellerMoving&&!r.isTravellerFocused&&!r.isTextActive){if(d!=null&&r.prevStartIndexControlledFromProps!==d)return{startX:r.scale(d),prevStartIndexControlledFromProps:d};if(f!=null&&r.prevEndIndexControlledFromProps!==f)return{endX:r.scale(f),prevEndIndexControlledFromProps:f}}return null}componentWillUnmount(){this.leaveTimer&&(clearTimeout(this.leaveTimer),this.leaveTimer=null),this.detachDragEndListener()}attachDragEndListener(){window.addEventListener("mouseup",this.handleDragEnd,!0),window.addEventListener("touchend",this.handleDragEnd,!0),window.addEventListener("mousemove",this.handleDrag,!0)}detachDragEndListener(){window.removeEventListener("mouseup",this.handleDragEnd,!0),window.removeEventListener("touchend",this.handleDragEnd,!0),window.removeEventListener("mousemove",this.handleDrag,!0)}handleSlideDrag(t){var{slideMoveStartX:r,startX:n,endX:i,scaleValues:o}=this.state;if(o!=null){var{x:a,width:s,travellerWidth:u,startIndex:d,endIndex:f,onChange:p,data:v,gap:y}=this.props,b=t.pageX-r;b>0?b=Math.min(b,a+s-u-i,a+s-u-n):b<0&&(b=Math.max(b,a-n,a-i));var w=V1({startX:n+b,endX:i+b,data:v,gap:y,scaleValues:o});(w.startIndex!==d||w.endIndex!==f)&&p&&p(w),this.setState({startX:n+b,endX:i+b,slideMoveStartX:t.pageX})}}handleTravellerDragStart(t,r){var n=PN(r)?r.changedTouches[0]:r;this.setState({isSlideMoving:!1,isTravellerMoving:!0,movingTravellerId:t,brushMoveStartX:n.pageX}),this.attachDragEndListener()}handleTravellerMove(t){var{brushMoveStartX:r,movingTravellerId:n,endX:i,startX:o,scaleValues:a}=this.state;if(!(n==null||a==null)){var s=this.state[n],{x:u,width:d,travellerWidth:f,onChange:p,gap:v,data:y}=this.props,b={startX:this.state.startX,endX:this.state.endX,data:y,gap:v,scaleValues:a},w=t.pageX-r;w>0?w=Math.min(w,u+d-f-s):w<0&&(w=Math.max(w,u-s)),b[n]=s+w;var x=V1(b),{startIndex:k,endIndex:$}=x,P=()=>{var j=y.length-1;return n==="startX"&&(i>o?k%v===0:$%v===0)||i<o&&$===j||n==="endX"&&(i>o?$%v===0:k%v===0)||i>o&&$===j};this.setState({[n]:s+w,brushMoveStartX:t.pageX},()=>{p&&P()&&p(x)})}}render(){var{data:t,className:r,children:n,x:i,y:o,dy:a,width:s,height:u,alwaysShowText:d,fill:f,stroke:p,startIndex:v,endIndex:y,travellerWidth:b,tickFormatter:w,dataKey:x,padding:k}=this.props,{startX:$,endX:P,isTextActive:j,isSlideMoving:C,isTravellerMoving:I,isTravellerFocused:A}=this.state;if(!t||!t.length||!Ue(i)||!Ue(o)||!Ue(s)||!Ue(u)||s<=0||u<=0)return null;var T=ve("recharts-brush",r),M=lEe("userSelect","none"),R=o+(a??0);return m.createElement(fr,{className:T,onMouseLeave:this.handleLeaveWrapper,onTouchMove:this.handleTouchMove,style:M},m.createElement(bEe,{x:i,y:R,width:s,height:u,fill:f,stroke:p}),m.createElement(wve,null,m.createElement(SEe,{x:i,y:R,width:s,height:u,data:t,padding:k},n)),m.createElement(wEe,{y:R,height:u,stroke:p,travellerWidth:b,startX:$,endX:P,onMouseEnter:this.handleEnterSlideOrTraveller,onMouseLeave:this.handleLeaveSlideOrTraveller,onMouseDown:this.handleSlideDragStart,onTouchStart:this.handleSlideDragStart}),m.createElement(wN,{travellerX:$,id:"startX",otherProps:uu(uu({},this.props),{},{y:R}),onMouseEnter:this.handleEnterSlideOrTraveller,onMouseLeave:this.handleLeaveSlideOrTraveller,onMouseDown:this.travellerDragStartHandlers.startX,onTouchStart:this.travellerDragStartHandlers.startX,onTravellerMoveKeyboard:this.handleTravellerMoveKeyboard,onFocus:()=>{this.setState({isTravellerFocused:!0})},onBlur:()=>{this.setState({isTravellerFocused:!1})}}),m.createElement(wN,{travellerX:P,id:"endX",otherProps:uu(uu({},this.props),{},{y:R}),onMouseEnter:this.handleEnterSlideOrTraveller,onMouseLeave:this.handleLeaveSlideOrTraveller,onMouseDown:this.travellerDragStartHandlers.endX,onTouchStart:this.travellerDragStartHandlers.endX,onTravellerMoveKeyboard:this.handleTravellerMoveKeyboard,onFocus:()=>{this.setState({isTravellerFocused:!0})},onBlur:()=>{this.setState({isTravellerFocused:!1})}}),(j||C||I||A||d)&&m.createElement(xEe,{startIndex:v,endIndex:y,y:R,height:u,travellerWidth:b,stroke:p,tickFormatter:w,dataKey:x,data:t,startX:$,endX:P}))}}function $Ee(e){var t=ir(),r=cEe(),n=fEe(),i=m.useContext(pEe),o=e.onChange,{startIndex:a,endIndex:s}=e;m.useEffect(()=>{t(n$({startIndex:a,endIndex:s}))},[t,s,a]),Oke();var u=m.useCallback(x=>{if(n!=null){var{startIndex:k,endIndex:$}=n;(x.startIndex!==k||x.endIndex!==$)&&(i==null||i(x),o==null||o(x),t(n$(x)))}},[o,i,t,n]),d=Le(am);if(d==null||n==null||r==null||!r.length)return null;var{startIndex:f,endIndex:p}=n,{x:v,y,width:b}=d,w={data:r,x:v,y,width:b,startIndex:f,endIndex:p,onChange:u};return m.createElement(PEe,xh({},e,w,{startIndexControlledFromProps:a??void 0,endIndexControlledFromProps:s??void 0}))}function CEe(e){var t=ir();return m.useEffect(()=>(t(bN(e)),()=>{t(bN(null))}),[t,e]),null}var jEe={height:40,travellerWidth:5,gap:1,fill:"#fff",stroke:"#666",padding:{top:1,right:1,bottom:1,left:1},leaveTimeOut:1e3,alwaysShowText:!1};function xH(e){var t=Er(e,jEe);return m.createElement(m.Fragment,null,m.createElement(CEe,{height:t.height,x:t.x,y:t.y,width:t.width,padding:t.padding}),m.createElement($Ee,t))}xH.displayName="Brush";function $N(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function gv(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?$N(Object(r),!0).forEach(function(n){wH(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):$N(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function wH(e,t,r){return(t=EEe(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function EEe(e){var t=IEe(e,"string");return typeof t=="symbol"?t:t+""}function IEe(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var OEe=(e,t)=>{var{x:r,y:n}=e,{x:i,y:o}=t;return{x:Math.min(r,i),y:Math.min(n,o),width:Math.abs(i-r),height:Math.abs(o-n)}};class n0{static create(t){return new n0(t)}constructor(t){this.scale=t}get domain(){return this.scale.domain}get range(){return this.scale.range}get rangeMin(){return this.range()[0]}get rangeMax(){return this.range()[1]}get bandwidth(){return this.scale.bandwidth}apply(t){var{bandAware:r,position:n}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(t!==void 0){if(n)switch(n){case"start":return this.scale(t);case"middle":{var i=this.bandwidth?this.bandwidth()/2:0;return this.scale(t)+i}case"end":{var o=this.bandwidth?this.bandwidth():0;return this.scale(t)+o}default:return this.scale(t)}if(r){var a=this.bandwidth?this.bandwidth()/2:0;return this.scale(t)+a}return this.scale(t)}}isInRange(t){var r=this.range(),n=r[0],i=r[r.length-1];return n<=i?t>=n&&t<=i:t>=i&&t<=n}}wH(n0,"EPS",1e-4);var _Ee=e=>{var t=Object.keys(e).reduce((r,n)=>gv(gv({},r),{},{[n]:n0.create(e[n])}),{});return gv(gv({},t),{},{apply(r){var{bandAware:n,position:i}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return Object.fromEntries(Object.entries(r).map(o=>{var[a,s]=o;return[a,t[a].apply(s,{bandAware:n,position:i})]}))},isInRange(r){return Object.keys(r).every(n=>t[n].isInRange(r[n]))}})};function AEe(e){return(e%180+180)%180}var TEe=function(t){var{width:r,height:n}=t,i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,o=AEe(i),a=o*Math.PI/180,s=Math.atan(n/r),u=a>s&&a<Math.PI-s?n/Math.sin(a):r/Math.cos(a);return Math.abs(u)},MEe={dots:[],areas:[],lines:[]},SH=Oi({name:"referenceElements",initialState:MEe,reducers:{addDot:(e,t)=>{e.dots.push(t.payload)},removeDot:(e,t)=>{var r=Yo(e).dots.findIndex(n=>n===t.payload);r!==-1&&e.dots.splice(r,1)},addArea:(e,t)=>{e.areas.push(t.payload)},removeArea:(e,t)=>{var r=Yo(e).areas.findIndex(n=>n===t.payload);r!==-1&&e.areas.splice(r,1)},addLine:(e,t)=>{e.lines.push(t.payload)},removeLine:(e,t)=>{var r=Yo(e).lines.findIndex(n=>n===t.payload);r!==-1&&e.lines.splice(r,1)}}}),{addDot:S2e,removeDot:k2e,addArea:REe,removeArea:DEe,addLine:P2e,removeLine:$2e}=SH.actions,zEe=SH.reducer,kH=m.createContext(void 0),NEe=e=>{var{children:t}=e,[r]=m.useState("".concat(ah("recharts"),"-clip")),n=e0();if(n==null)return null;var{x:i,y:o,width:a,height:s}=n;return m.createElement(kH.Provider,{value:r},m.createElement("defs",null,m.createElement("clipPath",{id:r},m.createElement("rect",{x:i,y:o,height:s,width:a}))),t)},LEe=()=>m.useContext(kH);function CN(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function jN(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?CN(Object(r),!0).forEach(function(n){BEe(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):CN(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function BEe(e,t,r){return(t=FEe(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function FEe(e){var t=UEe(e,"string");return typeof t=="symbol"?t:t+""}function UEe(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function ib(){return ib=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},ib.apply(null,arguments)}var WEe=(e,t,r,n,i,o,a)=>{var{x1:s,x2:u,y1:d,y2:f}=a;if(i==null||o==null)return null;var p=_Ee({x:i,y:o}),v={x:e?p.x.apply(s,{position:"start"}):p.x.rangeMin,y:r?p.y.apply(d,{position:"start"}):p.y.rangeMin},y={x:t?p.x.apply(u,{position:"end"}):p.x.rangeMax,y:n?p.y.apply(f,{position:"end"}):p.y.rangeMax};return a.ifOverflow==="discard"&&(!p.isInRange(v)||!p.isInRange(y))?null:OEe(v,y)},KEe=(e,t)=>{var r;return m.isValidElement(e)?r=m.cloneElement(e,t):typeof e=="function"?r=e(t):r=m.createElement(OE,ib({},t,{className:"recharts-reference-area-rect"})),r};function HEe(e){var t=ir();return m.useEffect(()=>(t(REe(e)),()=>{t(DEe(e))})),null}function VEe(e){var{x1:t,x2:r,y1:n,y2:i,className:o,shape:a,xAxisId:s,yAxisId:u}=e,d=LEe(),f=hn(),p=Le(j=>Cl(j,"xAxis",s,f)),v=Le(j=>Cl(j,"yAxis",u,f));if(p==null||v==null)return null;var y=Si(t),b=Si(r),w=Si(n),x=Si(i);if(!y&&!b&&!w&&!x&&!a)return null;var k=WEe(y,b,w,x,p,v,e);if(!k&&!a)return null;var $=e.ifOverflow==="hidden",P=$?"url(#".concat(d,")"):void 0;return m.createElement(Qn,{zIndex:e.zIndex},m.createElement(fr,{className:ve("recharts-reference-area",o)},KEe(a,jN(jN({clipPath:P},Rn(e)),k)),k!=null&&m.createElement(QK,ib({},k,{lowerWidth:k.width,upperWidth:k.width}),m.createElement(eH,{label:e.label}),e.children)))}var qEe={ifOverflow:"discard",xAxisId:0,yAxisId:0,radius:0,fill:"#ccc",fillOpacity:.5,stroke:"none",strokeWidth:1,zIndex:Wr.area};function PH(e){var t=Er(e,qEe);return m.createElement(m.Fragment,null,m.createElement(HEe,{yAxisId:t.yAxisId,xAxisId:t.xAxisId,ifOverflow:t.ifOverflow,x1:t.x1,x2:t.x2,y1:t.y1,y2:t.y2}),m.createElement(VEe,t))}PH.displayName="ReferenceArea";function $H(e,t){if(t<1)return[];if(t===1)return e;for(var r=[],n=0;n<e.length;n+=t)r.push(e[n]);return r}function GEe(e,t,r){var n={width:e.width+t.width,height:e.height+t.height};return TEe(n,r)}function ZEe(e,t,r){var n=r==="width",{x:i,y:o,width:a,height:s}=e;return t===1?{start:n?i:o,end:n?i+a:o+s}:{start:n?i+a:o+s,end:n?i:o}}function ob(e,t,r,n,i){if(e*t<e*n||e*t>e*i)return!1;var o=r();return e*(t-e*o/2-n)>=0&&e*(t+e*o/2-i)<=0}function XEe(e,t){return $H(e,t+1)}function YEe(e,t,r,n,i){for(var o=(n||[]).slice(),{start:a,end:s}=t,u=0,d=1,f=a,p=function(){var b=n==null?void 0:n[u];if(b===void 0)return{v:$H(n,d)};var w=u,x,k=()=>(x===void 0&&(x=r(b,w)),x),$=b.coordinate,P=u===0||ob(e,$,k,f,s);P||(u=0,f=a,d+=1),P&&(f=$+e*(k()/2+i),u+=d)},v;d<=o.length;)if(v=p(),v)return v.v;return[]}function EN(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function Hn(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?EN(Object(r),!0).forEach(function(n){QEe(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):EN(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function QEe(e,t,r){return(t=JEe(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function JEe(e){var t=eIe(e,"string");return typeof t=="symbol"?t:t+""}function eIe(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function tIe(e,t,r,n,i){for(var o=(n||[]).slice(),a=o.length,{start:s}=t,{end:u}=t,d=function(v){var y=o[v],b,w=()=>(b===void 0&&(b=r(y,v)),b);if(v===a-1){var x=e*(y.coordinate+e*w()/2-u);o[v]=y=Hn(Hn({},y),{},{tickCoord:x>0?y.coordinate-x*e:y.coordinate})}else o[v]=y=Hn(Hn({},y),{},{tickCoord:y.coordinate});if(y.tickCoord!=null){var k=ob(e,y.tickCoord,w,s,u);k&&(u=y.tickCoord-e*(w()/2+i),o[v]=Hn(Hn({},y),{},{isShow:!0}))}},f=a-1;f>=0;f--)d(f);return o}function rIe(e,t,r,n,i,o){var a=(n||[]).slice(),s=a.length,{start:u,end:d}=t;if(o){var f=n[s-1],p=r(f,s-1),v=e*(f.coordinate+e*p/2-d);if(a[s-1]=f=Hn(Hn({},f),{},{tickCoord:v>0?f.coordinate-v*e:f.coordinate}),f.tickCoord!=null){var y=ob(e,f.tickCoord,()=>p,u,d);y&&(d=f.tickCoord-e*(p/2+i),a[s-1]=Hn(Hn({},f),{},{isShow:!0}))}}for(var b=o?s-1:s,w=function($){var P=a[$],j,C=()=>(j===void 0&&(j=r(P,$)),j);if($===0){var I=e*(P.coordinate-e*C()/2-u);a[$]=P=Hn(Hn({},P),{},{tickCoord:I<0?P.coordinate-I*e:P.coordinate})}else a[$]=P=Hn(Hn({},P),{},{tickCoord:P.coordinate});if(P.tickCoord!=null){var A=ob(e,P.tickCoord,C,u,d);A&&(u=P.tickCoord+e*(C()/2+i),a[$]=Hn(Hn({},P),{},{isShow:!0}))}},x=0;x<b;x++)w(x);return a}function QI(e,t,r){var{tick:n,ticks:i,viewBox:o,minTickGap:a,orientation:s,interval:u,tickFormatter:d,unit:f,angle:p}=e;if(!i||!i.length||!n)return[];if(Ue(u)||lf.isSsr){var v;return(v=XEe(i,Ue(u)?u:0))!==null&&v!==void 0?v:[]}var y=[],b=s==="top"||s==="bottom"?"width":"height",w=f&&b==="width"?Kp(f,{fontSize:t,letterSpacing:r}):{width:0,height:0},x=(P,j)=>{var C=typeof d=="function"?d(P.value,j):P.value;return b==="width"?GEe(Kp(C,{fontSize:t,letterSpacing:r}),w,p):Kp(C,{fontSize:t,letterSpacing:r})[b]},k=i.length>=2?$n(i[1].coordinate-i[0].coordinate):1,$=ZEe(o,k,b);return u==="equidistantPreserveStart"?YEe(k,$,x,i,a):(u==="preserveStart"||u==="preserveStartEnd"?y=rIe(k,$,x,i,a,u==="preserveStartEnd"):y=tIe(k,$,x,i,a),y.filter(P=>P.isShow))}var nIe=e=>{var{ticks:t,label:r,labelGapWithTick:n=5,tickSize:i=0,tickMargin:o=0}=e,a=0;if(t){Array.from(t).forEach(f=>{if(f){var p=f.getBoundingClientRect();p.width>a&&(a=p.width)}});var s=r?r.getBoundingClientRect().width:0,u=i+o,d=a+u+s+(r?n:0);return Math.round(d)}return 0},iIe=["axisLine","width","height","className","hide","ticks","axisType"];function oIe(e,t){if(e==null)return{};var r,n,i=aIe(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n<o.length;n++)r=o[n],t.indexOf(r)===-1&&{}.propertyIsEnumerable.call(e,r)&&(i[r]=e[r])}return i}function aIe(e,t){if(e==null)return{};var r={};for(var n in e)if({}.hasOwnProperty.call(e,n)){if(t.indexOf(n)!==-1)continue;r[n]=e[n]}return r}function Yu(){return Yu=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},Yu.apply(null,arguments)}function IN(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function Jr(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?IN(Object(r),!0).forEach(function(n){sIe(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):IN(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function sIe(e,t,r){return(t=lIe(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function lIe(e){var t=uIe(e,"string");return typeof t=="symbol"?t:t+""}function uIe(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var ss={x:0,y:0,width:0,height:0,viewBox:{x:0,y:0,width:0,height:0},orientation:"bottom",ticks:[],stroke:"#666",tickLine:!0,axisLine:!0,tick:!0,mirror:!1,minTickGap:5,tickSize:6,tickMargin:2,interval:"preserveEnd",zIndex:Wr.axis};function cIe(e){var{x:t,y:r,width:n,height:i,orientation:o,mirror:a,axisLine:s,otherSvgProps:u}=e;if(!s)return null;var d=Jr(Jr(Jr({},u),Zn(s)),{},{fill:"none"});if(o==="top"||o==="bottom"){var f=+(o==="top"&&!a||o==="bottom"&&a);d=Jr(Jr({},d),{},{x1:t,y1:r+f*i,x2:t+n,y2:r+f*i})}else{var p=+(o==="left"&&!a||o==="right"&&a);d=Jr(Jr({},d),{},{x1:t+p*n,y1:r,x2:t+p*n,y2:r+i})}return m.createElement("line",Yu({},d,{className:ve("recharts-cartesian-axis-line",qu(s,"className"))}))}function dIe(e,t,r,n,i,o,a,s,u){var d,f,p,v,y,b,w=s?-1:1,x=e.tickSize||a,k=Ue(e.tickCoord)?e.tickCoord:e.coordinate;switch(o){case"top":d=f=e.coordinate,v=r+ +!s*i,p=v-w*x,b=p-w*u,y=k;break;case"left":p=v=e.coordinate,f=t+ +!s*n,d=f-w*x,y=d-w*u,b=k;break;case"right":p=v=e.coordinate,f=t+ +s*n,d=f+w*x,y=d+w*u,b=k;break;default:d=f=e.coordinate,v=r+ +s*i,p=v+w*x,b=p+w*u,y=k;break}return{line:{x1:d,y1:p,x2:f,y2:v},tick:{x:y,y:b}}}function fIe(e,t){switch(e){case"left":return t?"start":"end";case"right":return t?"end":"start";default:return"middle"}}function pIe(e,t){switch(e){case"left":case"right":return"middle";case"top":return t?"start":"end";default:return t?"end":"start"}}function hIe(e){var{option:t,tickProps:r,value:n}=e,i,o=ve(r.className,"recharts-cartesian-axis-tick-value");if(m.isValidElement(t))i=m.cloneElement(t,Jr(Jr({},r),{},{className:o}));else if(typeof t=="function")i=t(Jr(Jr({},r),{},{className:o}));else{var a="recharts-cartesian-axis-tick-value";typeof t!="boolean"&&(a=ve(a,t==null?void 0:t.className)),i=m.createElement(Vd,Yu({},r,{className:a}),n)}return i}var mIe=m.forwardRef((e,t)=>{var{ticks:r=[],tick:n,tickLine:i,stroke:o,tickFormatter:a,unit:s,padding:u,tickTextProps:d,orientation:f,mirror:p,x:v,y,width:b,height:w,tickSize:x,tickMargin:k,fontSize:$,letterSpacing:P,getTicksConfig:j,events:C,axisType:I}=e,A=QI(Jr(Jr({},j),{},{ticks:r}),$,P),T=fIe(f,p),M=pIe(f,p),R=Zn(j),D=Vu(n),O={};typeof i=="object"&&(O=i);var L=Jr(Jr({},R),{},{fill:"none"},O),z=A.map(U=>Jr({entry:U},dIe(U,v,y,b,w,f,x,p,k))),F=z.map(U=>{var{entry:V,line:K}=U;return m.createElement(fr,{className:"recharts-cartesian-axis-tick",key:"tick-".concat(V.value,"-").concat(V.coordinate,"-").concat(V.tickCoord)},i&&m.createElement("line",Yu({},L,K,{className:ve("recharts-cartesian-axis-tick-line",qu(i,"className"))})))}),B=z.map((U,V)=>{var{entry:K,tick:Z}=U,W=Jr(Jr(Jr(Jr({textAnchor:T,verticalAnchor:M},R),{},{stroke:"none",fill:o},D),Z),{},{index:V,payload:K,visibleTicksCount:A.length,tickFormatter:a,padding:u},d);return m.createElement(fr,Yu({className:"recharts-cartesian-axis-tick-label",key:"tick-label-".concat(K.value,"-").concat(K.coordinate,"-").concat(K.tickCoord)},tm(C,K,V)),n&&m.createElement(hIe,{option:n,tickProps:W,value:"".concat(typeof a=="function"?a(K.value,V):K.value).concat(s||"")}))});return m.createElement("g",{className:"recharts-cartesian-axis-ticks recharts-".concat(I,"-ticks")},B.length>0&&m.createElement(Qn,{zIndex:Wr.label},m.createElement("g",{className:"recharts-cartesian-axis-tick-labels recharts-".concat(I,"-tick-labels"),ref:t},B)),F.length>0&&m.createElement("g",{className:"recharts-cartesian-axis-tick-lines recharts-".concat(I,"-tick-lines")},F))}),gIe=m.forwardRef((e,t)=>{var{axisLine:r,width:n,height:i,className:o,hide:a,ticks:s,axisType:u}=e,d=oIe(e,iIe),[f,p]=m.useState(""),[v,y]=m.useState(""),b=m.useRef(null);m.useImperativeHandle(t,()=>({getCalculatedWidth:()=>{var x;return nIe({ticks:b.current,label:(x=e.labelRef)===null||x===void 0?void 0:x.current,labelGapWithTick:5,tickSize:e.tickSize,tickMargin:e.tickMargin})}}));var w=m.useCallback(x=>{if(x){var k=x.getElementsByClassName("recharts-cartesian-axis-tick-value");b.current=k;var $=k[0];if($){var P=window.getComputedStyle($),j=P.fontSize,C=P.letterSpacing;(j!==f||C!==v)&&(p(j),y(C))}}},[f,v]);return a||n!=null&&n<=0||i!=null&&i<=0?null:m.createElement(Qn,{zIndex:e.zIndex},m.createElement(fr,{className:ve("recharts-cartesian-axis",o)},m.createElement(cIe,{x:e.x,y:e.y,width:n,height:i,orientation:e.orientation,mirror:e.mirror,axisLine:r,otherSvgProps:Zn(e)}),m.createElement(mIe,{ref:w,axisType:u,events:d,fontSize:f,getTicksConfig:e,height:e.height,letterSpacing:v,mirror:e.mirror,orientation:e.orientation,padding:e.padding,stroke:e.stroke,tick:e.tick,tickFormatter:e.tickFormatter,tickLine:e.tickLine,tickMargin:e.tickMargin,tickSize:e.tickSize,tickTextProps:e.tickTextProps,ticks:s,unit:e.unit,width:e.width,x:e.x,y:e.y}),m.createElement(QK,{x:e.x,y:e.y,width:e.width,height:e.height,lowerWidth:e.width,upperWidth:e.width},m.createElement(eH,{label:e.label,labelRef:e.labelRef}),e.children)))}),JI=m.forwardRef((e,t)=>{var r=Er(e,ss);return m.createElement(gIe,Yu({},r,{ref:t}))});JI.displayName="CartesianAxis";var vIe=["x1","y1","x2","y2","key"],yIe=["offset"],bIe=["xAxisId","yAxisId"],xIe=["xAxisId","yAxisId"];function ON(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function Vn(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?ON(Object(r),!0).forEach(function(n){wIe(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):ON(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function wIe(e,t,r){return(t=SIe(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function SIe(e){var t=kIe(e,"string");return typeof t=="symbol"?t:t+""}function kIe(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function bu(){return bu=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},bu.apply(null,arguments)}function ab(e,t){if(e==null)return{};var r,n,i=PIe(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n<o.length;n++)r=o[n],t.indexOf(r)===-1&&{}.propertyIsEnumerable.call(e,r)&&(i[r]=e[r])}return i}function PIe(e,t){if(e==null)return{};var r={};for(var n in e)if({}.hasOwnProperty.call(e,n)){if(t.indexOf(n)!==-1)continue;r[n]=e[n]}return r}var $Ie=e=>{var{fill:t}=e;if(!t||t==="none")return null;var{fillOpacity:r,x:n,y:i,width:o,height:a,ry:s}=e;return m.createElement("rect",{x:n,y:i,ry:s,width:o,height:a,stroke:"none",fill:t,fillOpacity:r,className:"recharts-cartesian-grid-bg"})};function CH(e){var{option:t,lineItemProps:r}=e,n;if(m.isValidElement(t))n=m.cloneElement(t,r);else if(typeof t=="function")n=t(r);else{var i,{x1:o,y1:a,x2:s,y2:u,key:d}=r,f=ab(r,vIe),p=(i=Zn(f))!==null&&i!==void 0?i:{},{offset:v}=p,y=ab(p,yIe);n=m.createElement("line",bu({},y,{x1:o,y1:a,x2:s,y2:u,fill:"none",key:d}))}return n}function CIe(e){var{x:t,width:r,horizontal:n=!0,horizontalPoints:i}=e;if(!n||!i||!i.length)return null;var{xAxisId:o,yAxisId:a}=e,s=ab(e,bIe),u=i.map((d,f)=>{var p=Vn(Vn({},s),{},{x1:t,y1:d,x2:t+r,y2:d,key:"line-".concat(f),index:f});return m.createElement(CH,{key:"line-".concat(f),option:n,lineItemProps:p})});return m.createElement("g",{className:"recharts-cartesian-grid-horizontal"},u)}function jIe(e){var{y:t,height:r,vertical:n=!0,verticalPoints:i}=e;if(!n||!i||!i.length)return null;var{xAxisId:o,yAxisId:a}=e,s=ab(e,xIe),u=i.map((d,f)=>{var p=Vn(Vn({},s),{},{x1:d,y1:t,x2:d,y2:t+r,key:"line-".concat(f),index:f});return m.createElement(CH,{option:n,lineItemProps:p,key:"line-".concat(f)})});return m.createElement("g",{className:"recharts-cartesian-grid-vertical"},u)}function EIe(e){var{horizontalFill:t,fillOpacity:r,x:n,y:i,width:o,height:a,horizontalPoints:s,horizontal:u=!0}=e;if(!u||!t||!t.length||s==null)return null;var d=s.map(p=>Math.round(p+i-i)).sort((p,v)=>p-v);i!==d[0]&&d.unshift(0);var f=d.map((p,v)=>{var y=!d[v+1],b=y?i+a-p:d[v+1]-p;if(b<=0)return null;var w=v%t.length;return m.createElement("rect",{key:"react-".concat(v),y:p,x:n,height:b,width:o,stroke:"none",fill:t[w],fillOpacity:r,className:"recharts-cartesian-grid-bg"})});return m.createElement("g",{className:"recharts-cartesian-gridstripes-horizontal"},f)}function IIe(e){var{vertical:t=!0,verticalFill:r,fillOpacity:n,x:i,y:o,width:a,height:s,verticalPoints:u}=e;if(!t||!r||!r.length)return null;var d=u.map(p=>Math.round(p+i-i)).sort((p,v)=>p-v);i!==d[0]&&d.unshift(0);var f=d.map((p,v)=>{var y=!d[v+1],b=y?i+a-p:d[v+1]-p;if(b<=0)return null;var w=v%r.length;return m.createElement("rect",{key:"react-".concat(v),x:p,y:o,width:b,height:s,stroke:"none",fill:r[w],fillOpacity:n,className:"recharts-cartesian-grid-bg"})});return m.createElement("g",{className:"recharts-cartesian-gridstripes-vertical"},f)}var OIe=(e,t)=>{var{xAxis:r,width:n,height:i,offset:o}=e;return l8(QI(Vn(Vn(Vn({},ss),r),{},{ticks:u8(r),viewBox:{x:0,y:0,width:n,height:i}})),o.left,o.left+o.width,t)},_Ie=(e,t)=>{var{yAxis:r,width:n,height:i,offset:o}=e;return l8(QI(Vn(Vn(Vn({},ss),r),{},{ticks:u8(r),viewBox:{x:0,y:0,width:n,height:i}})),o.top,o.top+o.height,t)},AIe={horizontal:!0,vertical:!0,horizontalPoints:[],verticalPoints:[],stroke:"#ccc",fill:"none",verticalFill:[],horizontalFill:[],xAxisId:0,yAxisId:0,syncWithTicks:!1,zIndex:Wr.grid};function Il(e){var t=$E(),r=CE(),n=b8(),i=Vn(Vn({},Er(e,AIe)),{},{x:Ue(e.x)?e.x:n.left,y:Ue(e.y)?e.y:n.top,width:Ue(e.width)?e.width:n.width,height:Ue(e.height)?e.height:n.height}),{xAxisId:o,yAxisId:a,x:s,y:u,width:d,height:f,syncWithTicks:p,horizontalValues:v,verticalValues:y}=i,b=hn(),w=Le(M=>pz(M,"xAxis",o,b)),x=Le(M=>pz(M,"yAxis",a,b));if(!Ca(d)||!Ca(f)||!Ue(s)||!Ue(u))return null;var k=i.verticalCoordinatesGenerator||OIe,$=i.horizontalCoordinatesGenerator||_Ie,{horizontalPoints:P,verticalPoints:j}=i;if((!P||!P.length)&&typeof $=="function"){var C=v&&v.length,I=$({yAxis:x?Vn(Vn({},x),{},{ticks:C?v:x.ticks}):void 0,width:t??d,height:r??f,offset:n},C?!0:p);Oy(Array.isArray(I),"horizontalCoordinatesGenerator should return Array but instead it returned [".concat(typeof I,"]")),Array.isArray(I)&&(P=I)}if((!j||!j.length)&&typeof k=="function"){var A=y&&y.length,T=k({xAxis:w?Vn(Vn({},w),{},{ticks:A?y:w.ticks}):void 0,width:t??d,height:r??f,offset:n},A?!0:p);Oy(Array.isArray(T),"verticalCoordinatesGenerator should return Array but instead it returned [".concat(typeof T,"]")),Array.isArray(T)&&(j=T)}return m.createElement(Qn,{zIndex:i.zIndex},m.createElement("g",{className:"recharts-cartesian-grid"},m.createElement($Ie,{fill:i.fill,fillOpacity:i.fillOpacity,x:i.x,y:i.y,width:i.width,height:i.height,ry:i.ry}),m.createElement(EIe,bu({},i,{horizontalPoints:P})),m.createElement(IIe,bu({},i,{verticalPoints:j})),m.createElement(CIe,bu({},i,{offset:n,horizontalPoints:P,xAxis:w,yAxis:x})),m.createElement(jIe,bu({},i,{offset:n,verticalPoints:j,xAxis:w,yAxis:x}))))}Il.displayName="CartesianGrid";var jH=(e,t,r,n)=>Ia(e,"xAxis",t,n),EH=(e,t,r,n)=>Ea(e,"xAxis",t,n),IH=(e,t,r,n)=>Ia(e,"yAxis",r,n),OH=(e,t,r,n)=>Ea(e,"yAxis",r,n),TIe=ce([At,jH,IH,EH,OH],(e,t,r,n,i)=>Ra(e,"xAxis")?Pl(t,n,!1):Pl(r,i,!1)),MIe=(e,t,r,n,i)=>i;function RIe(e){return e.type==="line"}var DIe=ce([gm,MIe],(e,t)=>e.filter(RIe).find(r=>r.id===t)),zIe=ce([At,jH,IH,EH,OH,DIe,TIe,fm],(e,t,r,n,i,o,a,s)=>{var{chartData:u,dataStartIndex:d,dataEndIndex:f}=s;if(!(o==null||t==null||r==null||n==null||i==null||n.length===0||i.length===0||a==null||e!=="horizontal"&&e!=="vertical")){var{dataKey:p,data:v}=o,y;if(v!=null&&v.length>0?y=v:y=u==null?void 0:u.slice(d,f+1),y!=null)return nOe({layout:e,xAxis:t,yAxis:r,xAxisTicks:n,yAxisTicks:i,dataKey:p,bandSize:a,displayedData:y})}});function _H(e){var t=Vu(e),r=3,n=2;if(t!=null){var{r:i,strokeWidth:o}=t,a=Number(i),s=Number(o);return(Number.isNaN(a)||a<0)&&(a=r),(Number.isNaN(s)||s<0)&&(s=n),{r:a,strokeWidth:s}}return{r,strokeWidth:n}}var NIe=["id"],LIe=["type","layout","connectNulls","needClip","shape"],BIe=["activeDot","animateNewValues","animationBegin","animationDuration","animationEasing","connectNulls","dot","hide","isAnimationActive","label","legendType","xAxisId","yAxisId","id"];function wh(){return wh=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},wh.apply(null,arguments)}function _N(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function va(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?_N(Object(r),!0).forEach(function(n){FIe(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):_N(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function FIe(e,t,r){return(t=UIe(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function UIe(e){var t=WIe(e,"string");return typeof t=="symbol"?t:t+""}function WIe(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function eO(e,t){if(e==null)return{};var r,n,i=KIe(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n<o.length;n++)r=o[n],t.indexOf(r)===-1&&{}.propertyIsEnumerable.call(e,r)&&(i[r]=e[r])}return i}function KIe(e,t){if(e==null)return{};var r={};for(var n in e)if({}.hasOwnProperty.call(e,n)){if(t.indexOf(n)!==-1)continue;r[n]=e[n]}return r}var HIe=e=>{var{dataKey:t,name:r,stroke:n,legendType:i,hide:o}=e;return[{inactive:o,dataKey:t,type:i,color:n,value:Nl(r,t),payload:e}]},VIe=m.memo(e=>{var{dataKey:t,data:r,stroke:n,strokeWidth:i,fill:o,name:a,hide:s,unit:u,tooltipType:d}=e,f={dataDefinedOnItem:r,positions:void 0,settings:{stroke:n,strokeWidth:i,fill:o,dataKey:t,nameKey:void 0,name:Nl(a,t),hide:s,type:d,color:n,unit:u}};return m.createElement(Yx,{tooltipEntrySettings:f})}),AH=(e,t)=>"".concat(t,"px ").concat(e-t,"px");function qIe(e,t){for(var r=e.length%2!==0?[...e,0]:e,n=[],i=0;i<t;++i)n=[...n,...r];return n}var GIe=(e,t,r)=>{var n=r.reduce((p,v)=>p+v);if(!n)return AH(t,e);for(var i=Math.floor(e/n),o=e%n,a=t-e,s=[],u=0,d=0;u<r.length;d+=r[u],++u)if(d+r[u]>o){s=[...r.slice(0,u),o-d];break}var f=s.length%2===0?[0,a]:[a];return[...qIe(r,i),...s,...f].map(p=>"".concat(p,"px")).join(", ")};function ZIe(e){var{clipPathId:t,points:r,props:n}=e,{dot:i,dataKey:o,needClip:a}=n,{id:s}=n,u=eO(n,NIe),d=Zn(u);return m.createElement(fH,{points:r,dot:i,className:"recharts-line-dots",dotClassName:"recharts-line-dot",dataKey:o,baseProps:d,needClip:a,clipPathId:t})}function XIe(e){var{showLabels:t,children:r,points:n}=e,i=m.useMemo(()=>n==null?void 0:n.map(o=>{var a,s,u={x:(a=o.x)!==null&&a!==void 0?a:0,y:(s=o.y)!==null&&s!==void 0?s:0,width:0,lowerWidth:0,upperWidth:0,height:0};return va(va({},u),{},{value:o.value,payload:o.payload,viewBox:u,parentViewBox:void 0,fill:void 0})}),[n]);return m.createElement(BI,{value:t?i:void 0},r)}function AN(e){var{clipPathId:t,pathRef:r,points:n,strokeDasharray:i,props:o}=e,{type:a,layout:s,connectNulls:u,needClip:d,shape:f}=o,p=eO(o,LIe),v=va(va({},Rn(p)),{},{fill:"none",className:"recharts-line-curve",clipPath:d?"url(#clipPath-".concat(t,")"):void 0,points:n,type:a,layout:s,connectNulls:u,strokeDasharray:i??o.strokeDasharray});return m.createElement(m.Fragment,null,(n==null?void 0:n.length)>1&&m.createElement(HI,wh({shapeType:"curve",option:f},v,{pathRef:r})),m.createElement(ZIe,{points:n,clipPathId:t,props:o}))}function YIe(e){try{return e&&e.getTotalLength&&e.getTotalLength()||0}catch{return 0}}function QIe(e){var{clipPathId:t,props:r,pathRef:n,previousPointsRef:i,longestAnimatedLengthRef:o}=e,{points:a,strokeDasharray:s,isAnimationActive:u,animationBegin:d,animationDuration:f,animationEasing:p,animateNewValues:v,width:y,height:b,onAnimationEnd:w,onAnimationStart:x}=r,k=i.current,$=cf(a,"recharts-line-"),P=m.useRef($),[j,C]=m.useState(!1),I=!j,A=m.useCallback(()=>{typeof w=="function"&&w(),C(!1)},[w]),T=m.useCallback(()=>{typeof x=="function"&&x(),C(!0)},[x]),M=YIe(n.current),R=m.useRef(0);P.current!==$&&(R.current=o.current,P.current=$);var D=R.current;return m.createElement(XIe,{points:a,showLabels:I},r.children,m.createElement(uf,{animationId:$,begin:d,duration:f,isActive:u,easing:p,onAnimationEnd:A,onAnimationStart:T,key:$},O=>{var L=Zt(D,M+D,O),z=Math.min(L,M),F;if(u)if(s){var B="".concat(s).split(/[,\s]+/gim).map(K=>parseFloat(K));F=GIe(z,M,B)}else F=AH(M,z);else F=s==null?void 0:String(s);if(O>0&&M>0&&(i.current=a,o.current=Math.max(o.current,z)),k){var U=k.length/a.length,V=O===1?a:a.map((K,Z)=>{var W=Math.floor(Z*U);if(k[W]){var q=k[W];return va(va({},K),{},{x:Zt(q.x,K.x,O),y:Zt(q.y,K.y,O)})}return v?va(va({},K),{},{x:Zt(y*2,K.x,O),y:Zt(b/2,K.y,O)}):va(va({},K),{},{x:K.x,y:K.y})});return i.current=V,m.createElement(AN,{props:r,points:V,clipPathId:t,pathRef:n,strokeDasharray:F})}return m.createElement(AN,{props:r,points:a,clipPathId:t,pathRef:n,strokeDasharray:F})}),m.createElement(Gx,{label:r.label}))}function JIe(e){var{clipPathId:t,props:r}=e,n=m.useRef(null),i=m.useRef(0),o=m.useRef(null);return m.createElement(QIe,{props:r,clipPathId:t,previousPointsRef:n,longestAnimatedLengthRef:i,pathRef:o})}var eOe=(e,t)=>{var r,n;return{x:(r=e.x)!==null&&r!==void 0?r:void 0,y:(n=e.y)!==null&&n!==void 0?n:void 0,value:e.value,errorVal:Xt(e.payload,t)}};class tOe extends m.Component{render(){var{hide:t,dot:r,points:n,className:i,xAxisId:o,yAxisId:a,top:s,left:u,width:d,height:f,id:p,needClip:v,zIndex:y}=this.props;if(t)return null;var b=ve("recharts-line",i),w=p,{r:x,strokeWidth:k}=_H(r),$=KI(r),P=x*2+k,j=v?"url(#clipPath-".concat($?"":"dots-").concat(w,")"):void 0;return m.createElement(Qn,{zIndex:y},m.createElement(fr,{className:b},v&&m.createElement("defs",null,m.createElement(YI,{clipPathId:w,xAxisId:o,yAxisId:a}),!$&&m.createElement("clipPath",{id:"clipPath-dots-".concat(w)},m.createElement("rect",{x:u-P/2,y:s-P/2,width:d+P,height:f+P}))),m.createElement(mH,{xAxisId:o,yAxisId:a,data:n,dataPointFormatter:eOe,errorBarOffset:0},m.createElement(JIe,{props:this.props,clipPathId:w}))),m.createElement(s$,{activeDot:this.props.activeDot,points:n,mainColor:this.props.stroke,itemDataKey:this.props.dataKey,clipPath:j}))}}var TH={activeDot:!0,animateNewValues:!0,animationBegin:0,animationDuration:1500,animationEasing:"ease",connectNulls:!1,dot:!0,fill:"#fff",hide:!1,isAnimationActive:"auto",label:!1,legendType:"line",stroke:"#3182bd",strokeWidth:1,xAxisId:0,yAxisId:0,zIndex:Wr.line,type:"linear"};function rOe(e){var t=Er(e,TH),{activeDot:r,animateNewValues:n,animationBegin:i,animationDuration:o,animationEasing:a,connectNulls:s,dot:u,hide:d,isAnimationActive:f,label:p,legendType:v,xAxisId:y,yAxisId:b,id:w}=t,x=eO(t,BIe),{needClip:k}=t0(y,b),$=e0(),P=uc(),j=hn(),C=Le(R=>zIe(R,y,b,j,w));if(P!=="horizontal"&&P!=="vertical"||C==null||$==null)return null;var{height:I,width:A,x:T,y:M}=$;return m.createElement(tOe,wh({},x,{id:w,connectNulls:s,dot:u,activeDot:r,animateNewValues:n,animationBegin:i,animationDuration:o,animationEasing:a,isAnimationActive:f,hide:d,label:p,legendType:v,xAxisId:y,yAxisId:b,points:C,layout:P,height:I,width:A,left:T,top:M,needClip:k}))}function nOe(e){var{layout:t,xAxis:r,yAxis:n,xAxisTicks:i,yAxisTicks:o,dataKey:a,bandSize:s,displayedData:u}=e;return u.map((d,f)=>{var p=Xt(d,a);if(t==="horizontal"){var v=Iy({axis:r,ticks:i,bandSize:s,entry:d,index:f}),y=xr(p)?null:n.scale(p);return{x:v,y,value:p,payload:d}}var b=xr(p)?null:r.scale(p),w=Iy({axis:n,ticks:o,bandSize:s,entry:d,index:f});return b==null||w==null?null:{x:b,y:w,value:p,payload:d}}).filter(Boolean)}function iOe(e){var t=Er(e,TH),r=hn();return m.createElement(Qx,{id:t.id,type:"line"},n=>m.createElement(m.Fragment,null,m.createElement(ZI,{legendPayload:HIe(t)}),m.createElement(VIe,{dataKey:t.dataKey,data:t.data,stroke:t.stroke,strokeWidth:t.strokeWidth,fill:t.fill,name:t.name,hide:t.hide,unit:t.unit,tooltipType:t.tooltipType}),m.createElement(XI,{type:"line",id:n,data:t.data,xAxisId:t.xAxisId,yAxisId:t.yAxisId,zAxisId:0,dataKey:t.dataKey,hide:t.hide,isPanorama:r}),m.createElement(rOe,wh({},t,{id:n}))))}var Lv=m.memo(iOe,Pm);Lv.displayName="Line";var MH=(e,t,r,n)=>Ia(e,"xAxis",t,n),RH=(e,t,r,n)=>Ea(e,"xAxis",t,n),DH=(e,t,r,n)=>Ia(e,"yAxis",r,n),zH=(e,t,r,n)=>Ea(e,"yAxis",r,n),oOe=ce([At,MH,DH,RH,zH],(e,t,r,n,i)=>Ra(e,"xAxis")?Pl(t,n,!1):Pl(r,i,!1)),aOe=(e,t,r,n,i)=>i,NH=ce([gm,aOe],(e,t)=>e.filter(r=>r.type==="area").find(r=>r.id===t)),sOe=(e,t,r,n,i)=>{var o,a=NH(e,t,r,n,i);if(a!=null){var s=At(e),u=Ra(s,"xAxis"),d;if(u?d=bh(e,"yAxis",r,n):d=bh(e,"xAxis",t,n),d!=null){var{stackId:f}=a,p=Nx(a);if(!(f==null||p==null)){var v=(o=d[f])===null||o===void 0?void 0:o.stackedData;return v==null?void 0:v.find(y=>y.key===p)}}}},lOe=ce([At,MH,DH,RH,zH,sOe,fm,oOe,NH,Swe],(e,t,r,n,i,o,a,s,u,d)=>{var{chartData:f,dataStartIndex:p,dataEndIndex:v}=a;if(!(u==null||e!=="horizontal"&&e!=="vertical"||t==null||r==null||n==null||i==null||n.length===0||i.length===0||s==null)){var{data:y}=u,b;if(y&&y.length>0?b=y:b=f==null?void 0:f.slice(p,v+1),b!=null)return jOe({layout:e,xAxis:t,yAxis:r,xAxisTicks:n,yAxisTicks:i,dataStartIndex:p,areaSettings:u,stackedData:o,displayedData:b,chartBaseValue:d,bandSize:s})}}),uOe=["id"],cOe=["activeDot","animationBegin","animationDuration","animationEasing","connectNulls","dot","fill","fillOpacity","hide","isAnimationActive","legendType","stroke","xAxisId","yAxisId"];function Mu(){return Mu=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},Mu.apply(null,arguments)}function LH(e,t){if(e==null)return{};var r,n,i=dOe(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n<o.length;n++)r=o[n],t.indexOf(r)===-1&&{}.propertyIsEnumerable.call(e,r)&&(i[r]=e[r])}return i}function dOe(e,t){if(e==null)return{};var r={};for(var n in e)if({}.hasOwnProperty.call(e,n)){if(t.indexOf(n)!==-1)continue;r[n]=e[n]}return r}function TN(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function rd(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?TN(Object(r),!0).forEach(function(n){fOe(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):TN(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function fOe(e,t,r){return(t=pOe(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function pOe(e){var t=hOe(e,"string");return typeof t=="symbol"?t:t+""}function hOe(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function sb(e,t){return e&&e!=="none"?e:t}var mOe=e=>{var{dataKey:t,name:r,stroke:n,fill:i,legendType:o,hide:a}=e;return[{inactive:a,dataKey:t,type:o,color:sb(n,i),value:Nl(r,t),payload:e}]},gOe=m.memo(e=>{var{dataKey:t,data:r,stroke:n,strokeWidth:i,fill:o,name:a,hide:s,unit:u,tooltipType:d}=e,f={dataDefinedOnItem:r,positions:void 0,settings:{stroke:n,strokeWidth:i,fill:o,dataKey:t,nameKey:void 0,name:Nl(a,t),hide:s,type:d,color:sb(n,o),unit:u}};return m.createElement(Yx,{tooltipEntrySettings:f})});function vOe(e){var{clipPathId:t,points:r,props:n}=e,{needClip:i,dot:o,dataKey:a}=n,s=Zn(n);return m.createElement(fH,{points:r,dot:o,className:"recharts-area-dots",dotClassName:"recharts-area-dot",dataKey:a,baseProps:s,needClip:i,clipPathId:t})}function yOe(e){var{showLabels:t,children:r,points:n}=e,i=n.map(o=>{var a,s,u={x:(a=o.x)!==null&&a!==void 0?a:0,y:(s=o.y)!==null&&s!==void 0?s:0,width:0,lowerWidth:0,upperWidth:0,height:0};return rd(rd({},u),{},{value:o.value,payload:o.payload,parentViewBox:void 0,viewBox:u,fill:void 0})});return m.createElement(BI,{value:t?i:void 0},r)}function MN(e){var{points:t,baseLine:r,needClip:n,clipPathId:i,props:o}=e,{layout:a,type:s,stroke:u,connectNulls:d,isRange:f}=o,{id:p}=o,v=LH(o,uOe),y=Zn(v),b=Rn(v);return m.createElement(m.Fragment,null,(t==null?void 0:t.length)>1&&m.createElement(fr,{clipPath:n?"url(#clipPath-".concat(i,")"):void 0},m.createElement(ld,Mu({},b,{id:p,points:t,connectNulls:d,type:s,baseLine:r,layout:a,stroke:"none",className:"recharts-area-area"})),u!=="none"&&m.createElement(ld,Mu({},y,{className:"recharts-area-curve",layout:a,type:s,connectNulls:d,fill:"none",points:t})),u!=="none"&&f&&m.createElement(ld,Mu({},y,{className:"recharts-area-curve",layout:a,type:s,connectNulls:d,fill:"none",points:r}))),m.createElement(vOe,{points:t,props:v,clipPathId:i}))}function bOe(e){var{alpha:t,baseLine:r,points:n,strokeWidth:i}=e,o=n[0].y,a=n[n.length-1].y;if(!wr(o)||!wr(a))return null;var s=t*Math.abs(o-a),u=Math.max(...n.map(d=>d.x||0));return Ue(r)?u=Math.max(r,u):r&&Array.isArray(r)&&r.length&&(u=Math.max(...r.map(d=>d.x||0),u)),Ue(u)?m.createElement("rect",{x:0,y:o<a?o:o-s,width:u+(i?parseInt("".concat(i),10):1),height:Math.floor(s)}):null}function xOe(e){var{alpha:t,baseLine:r,points:n,strokeWidth:i}=e,o=n[0].x,a=n[n.length-1].x;if(!wr(o)||!wr(a))return null;var s=t*Math.abs(o-a),u=Math.max(...n.map(d=>d.y||0));return Ue(r)?u=Math.max(r,u):r&&Array.isArray(r)&&r.length&&(u=Math.max(...r.map(d=>d.y||0),u)),Ue(u)?m.createElement("rect",{x:o<a?o:o-s,y:0,width:s,height:Math.floor(u+(i?parseInt("".concat(i),10):1))}):null}function wOe(e){var{alpha:t,layout:r,points:n,baseLine:i,strokeWidth:o}=e;return r==="vertical"?m.createElement(bOe,{alpha:t,points:n,baseLine:i,strokeWidth:o}):m.createElement(xOe,{alpha:t,points:n,baseLine:i,strokeWidth:o})}function SOe(e){var{needClip:t,clipPathId:r,props:n,previousPointsRef:i,previousBaselineRef:o}=e,{points:a,baseLine:s,isAnimationActive:u,animationBegin:d,animationDuration:f,animationEasing:p,onAnimationStart:v,onAnimationEnd:y}=n,b=m.useMemo(()=>({points:a,baseLine:s}),[a,s]),w=cf(b,"recharts-area-"),x=Fve(),[k,$]=m.useState(!1),P=!k,j=m.useCallback(()=>{typeof y=="function"&&y(),$(!1)},[y]),C=m.useCallback(()=>{typeof v=="function"&&v(),$(!0)},[v]);if(x==null)return null;var I=i.current,A=o.current;return m.createElement(yOe,{showLabels:P,points:a},n.children,m.createElement(uf,{animationId:w,begin:d,duration:f,isActive:u,easing:p,onAnimationEnd:j,onAnimationStart:C,key:w},T=>{if(I){var M=I.length/a.length,R=T===1?a:a.map((O,L)=>{var z=Math.floor(L*M);if(I[z]){var F=I[z];return rd(rd({},O),{},{x:Zt(F.x,O.x,T),y:Zt(F.y,O.y,T)})}return O}),D;return Ue(s)?D=Zt(A,s,T):xr(s)||wo(s)?D=Zt(A,0,T):D=s.map((O,L)=>{var z=Math.floor(L*M);if(Array.isArray(A)&&A[z]){var F=A[z];return rd(rd({},O),{},{x:Zt(F.x,O.x,T),y:Zt(F.y,O.y,T)})}return O}),T>0&&(i.current=R,o.current=D),m.createElement(MN,{points:R,baseLine:D,needClip:t,clipPathId:r,props:n})}return T>0&&(i.current=a,o.current=s),m.createElement(fr,null,u&&m.createElement("defs",null,m.createElement("clipPath",{id:"animationClipPath-".concat(r)},m.createElement(wOe,{alpha:T,points:a,baseLine:s,layout:x,strokeWidth:n.strokeWidth}))),m.createElement(fr,{clipPath:"url(#animationClipPath-".concat(r,")")},m.createElement(MN,{points:a,baseLine:s,needClip:t,clipPathId:r,props:n})))}),m.createElement(Gx,{label:n.label}))}function kOe(e){var{needClip:t,clipPathId:r,props:n}=e,i=m.useRef(null),o=m.useRef();return m.createElement(SOe,{needClip:t,clipPathId:r,props:n,previousPointsRef:i,previousBaselineRef:o})}class POe extends m.PureComponent{render(){var{hide:t,dot:r,points:n,className:i,top:o,left:a,needClip:s,xAxisId:u,yAxisId:d,width:f,height:p,id:v,baseLine:y,zIndex:b}=this.props;if(t)return null;var w=ve("recharts-area",i),x=v,{r:k,strokeWidth:$}=_H(r),P=KI(r),j=k*2+$,C=s?"url(#clipPath-".concat(P?"":"dots-").concat(x,")"):void 0;return m.createElement(Qn,{zIndex:b},m.createElement(fr,{className:w},s&&m.createElement("defs",null,m.createElement(YI,{clipPathId:x,xAxisId:u,yAxisId:d}),!P&&m.createElement("clipPath",{id:"clipPath-dots-".concat(x)},m.createElement("rect",{x:a-j/2,y:o-j/2,width:f+j,height:p+j}))),m.createElement(kOe,{needClip:s,clipPathId:x,props:this.props})),m.createElement(s$,{points:n,mainColor:sb(this.props.stroke,this.props.fill),itemDataKey:this.props.dataKey,activeDot:this.props.activeDot,clipPath:C}),this.props.isRange&&Array.isArray(y)&&m.createElement(s$,{points:y,mainColor:sb(this.props.stroke,this.props.fill),itemDataKey:this.props.dataKey,activeDot:this.props.activeDot,clipPath:C}))}}var BH={activeDot:!0,animationBegin:0,animationDuration:1500,animationEasing:"ease",connectNulls:!1,dot:!1,fill:"#3182bd",fillOpacity:.6,hide:!1,isAnimationActive:"auto",legendType:"line",stroke:"#3182bd",strokeWidth:1,type:"linear",label:!1,xAxisId:0,yAxisId:0,zIndex:Wr.area};function $Oe(e){var t,r=Er(e,BH),{activeDot:n,animationBegin:i,animationDuration:o,animationEasing:a,connectNulls:s,dot:u,fill:d,fillOpacity:f,hide:p,isAnimationActive:v,legendType:y,stroke:b,xAxisId:w,yAxisId:x}=r,k=LH(r,cOe),$=uc(),P=RK(),{needClip:j}=t0(w,x),C=hn(),{points:I,isRange:A,baseLine:T}=(t=Le(z=>lOe(z,w,x,C,e.id)))!==null&&t!==void 0?t:{},M=e0();if($!=="horizontal"&&$!=="vertical"||M==null||P!=="AreaChart"&&P!=="ComposedChart")return null;var{height:R,width:D,x:O,y:L}=M;return!I||!I.length?null:m.createElement(POe,Mu({},k,{activeDot:n,animationBegin:i,animationDuration:o,animationEasing:a,baseLine:T,connectNulls:s,dot:u,fill:d,fillOpacity:f,height:R,hide:p,layout:$,isAnimationActive:v==="auto"?!lf.isSsr:v,isRange:A,legendType:y,needClip:j,points:I,stroke:b,width:D,left:O,top:L,xAxisId:w,yAxisId:x}))}var COe=(e,t,r,n,i)=>{var o=r??t;if(Ue(o))return o;var a=e==="horizontal"?i:n,s=a.scale.domain();if(a.type==="number"){var u=Math.max(s[0],s[1]),d=Math.min(s[0],s[1]);return o==="dataMin"?d:o==="dataMax"||u<0?u:Math.max(Math.min(s[0],s[1]),0)}return o==="dataMin"?s[0]:o==="dataMax"?s[1]:s[0]};function jOe(e){var{areaSettings:{connectNulls:t,baseValue:r,dataKey:n},stackedData:i,layout:o,chartBaseValue:a,xAxis:s,yAxis:u,displayedData:d,dataStartIndex:f,xAxisTicks:p,yAxisTicks:v,bandSize:y}=e,b=i&&i.length,w=COe(o,a,r,s,u),x=o==="horizontal",k=!1,$=d.map((j,C)=>{var I;b?I=i[f+C]:(I=Xt(j,n),Array.isArray(I)?k=!0:I=[w,I]);var A=I[1]==null||b&&!t&&Xt(j,n)==null;return x?{x:Iy({axis:s,ticks:p,bandSize:y,entry:j,index:C}),y:A?null:u.scale(I[1]),value:I,payload:j}:{x:A?null:s.scale(I[1]),y:Iy({axis:u,ticks:v,bandSize:y,entry:j,index:C}),value:I,payload:j}}),P;return b||k?P=$.map(j=>{var C=Array.isArray(j.value)?j.value[0]:null;return x?{x:j.x,y:C!=null&&j.y!=null?u.scale(C):null,payload:j.payload}:{x:C!=null?s.scale(C):null,y:j.y,payload:j.payload}}):P=x?u.scale(w):s.scale(w),{points:$,baseLine:P,isRange:k}}function EOe(e){var t=Er(e,BH),r=hn();return m.createElement(Qx,{id:t.id,type:"area"},n=>m.createElement(m.Fragment,null,m.createElement(ZI,{legendPayload:mOe(t)}),m.createElement(gOe,{dataKey:t.dataKey,data:t.data,stroke:t.stroke,strokeWidth:t.strokeWidth,fill:t.fill,name:t.name,hide:t.hide,unit:t.unit,tooltipType:t.tooltipType}),m.createElement(XI,{type:"area",id:n,data:t.data,dataKey:t.dataKey,xAxisId:t.xAxisId,yAxisId:t.yAxisId,zAxisId:0,stackId:c8(t.stackId),hide:t.hide,barSize:void 0,baseValue:t.baseValue,isPanorama:r,connectNulls:t.connectNulls}),m.createElement($Oe,Mu({},t,{id:n}))))}var cd=m.memo(EOe,Pm);cd.displayName="Area";var IOe=["domain","range"],OOe=["domain","range"];function RN(e,t){if(e==null)return{};var r,n,i=_Oe(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n<o.length;n++)r=o[n],t.indexOf(r)===-1&&{}.propertyIsEnumerable.call(e,r)&&(i[r]=e[r])}return i}function _Oe(e,t){if(e==null)return{};var r={};for(var n in e)if({}.hasOwnProperty.call(e,n)){if(t.indexOf(n)!==-1)continue;r[n]=e[n]}return r}function DN(e,t){return e===t?!0:Array.isArray(e)&&e.length===2&&Array.isArray(t)&&t.length===2?e[0]===t[0]&&e[1]===t[1]:!1}function FH(e,t){if(e===t)return!0;var{domain:r,range:n}=e,i=RN(e,IOe),{domain:o,range:a}=t,s=RN(t,OOe);return!DN(r,o)||!DN(n,a)?!1:Pm(i,s)}var AOe=["dangerouslySetInnerHTML","ticks"],TOe=["id"];function u$(){return u$=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},u$.apply(null,arguments)}function zN(e,t){if(e==null)return{};var r,n,i=MOe(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n<o.length;n++)r=o[n],t.indexOf(r)===-1&&{}.propertyIsEnumerable.call(e,r)&&(i[r]=e[r])}return i}function MOe(e,t){if(e==null)return{};var r={};for(var n in e)if({}.hasOwnProperty.call(e,n)){if(t.indexOf(n)!==-1)continue;r[n]=e[n]}return r}function ROe(e){var t=ir(),r=m.useRef(null);return m.useLayoutEffect(()=>{r.current===null?t(fCe(e)):r.current!==e&&t(pCe({prev:r.current,next:e})),r.current=e},[e,t]),m.useLayoutEffect(()=>()=>{r.current&&(t(hCe(r.current)),r.current=null)},[t]),null}var DOe=e=>{var{xAxisId:t,className:r}=e,n=Le(kE),i=hn(),o="xAxis",a=Le(x=>Cl(x,o,t,i)),s=Le(x=>pK(x,o,t,i)),u=Le(x=>uK(x,t)),d=Le(x=>bSe(x,t)),f=Le(x=>K9(x,t));if(u==null||d==null||f==null)return null;var{dangerouslySetInnerHTML:p,ticks:v}=e,y=zN(e,AOe),{id:b}=f,w=zN(f,TOe);return m.createElement(JI,u$({},y,w,{scale:a,x:d.x,y:d.y,width:u.width,height:u.height,className:ve("recharts-".concat(o," ").concat(o),r),viewBox:n,ticks:s,axisType:o}))},zOe={allowDataOverflow:wn.allowDataOverflow,allowDecimals:wn.allowDecimals,allowDuplicatedCategory:wn.allowDuplicatedCategory,angle:wn.angle,axisLine:ss.axisLine,height:wn.height,hide:!1,includeHidden:wn.includeHidden,interval:wn.interval,minTickGap:wn.minTickGap,mirror:wn.mirror,orientation:wn.orientation,padding:wn.padding,reversed:wn.reversed,scale:wn.scale,tick:wn.tick,tickCount:wn.tickCount,tickLine:ss.tickLine,tickSize:ss.tickSize,type:wn.type,xAxisId:0},NOe=e=>{var t=Er(e,zOe);return m.createElement(m.Fragment,null,m.createElement(ROe,{allowDataOverflow:t.allowDataOverflow,allowDecimals:t.allowDecimals,allowDuplicatedCategory:t.allowDuplicatedCategory,angle:t.angle,dataKey:t.dataKey,domain:t.domain,height:t.height,hide:t.hide,id:t.xAxisId,includeHidden:t.includeHidden,interval:t.interval,minTickGap:t.minTickGap,mirror:t.mirror,name:t.name,orientation:t.orientation,padding:t.padding,reversed:t.reversed,scale:t.scale,tick:t.tick,tickCount:t.tickCount,tickFormatter:t.tickFormatter,ticks:t.ticks,type:t.type,unit:t.unit}),m.createElement(DOe,t))},Ol=m.memo(NOe,FH);Ol.displayName="XAxis";var LOe=["dangerouslySetInnerHTML","ticks"],BOe=["id"];function c$(){return c$=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},c$.apply(null,arguments)}function NN(e,t){if(e==null)return{};var r,n,i=FOe(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n<o.length;n++)r=o[n],t.indexOf(r)===-1&&{}.propertyIsEnumerable.call(e,r)&&(i[r]=e[r])}return i}function FOe(e,t){if(e==null)return{};var r={};for(var n in e)if({}.hasOwnProperty.call(e,n)){if(t.indexOf(n)!==-1)continue;r[n]=e[n]}return r}function UOe(e){var t=ir(),r=m.useRef(null);return m.useLayoutEffect(()=>{r.current===null?t(mCe(e)):r.current!==e&&t(gCe({prev:r.current,next:e})),r.current=e},[e,t]),m.useLayoutEffect(()=>()=>{r.current&&(t(vCe(r.current)),r.current=null)},[t]),null}var WOe=e=>{var{yAxisId:t,className:r,width:n,label:i}=e,o=m.useRef(null),a=m.useRef(null),s=Le(kE),u=hn(),d=ir(),f="yAxis",p=Le(C=>Cl(C,f,t,u)),v=Le(C=>cK(C,t)),y=Le(C=>wSe(C,t)),b=Le(C=>pK(C,f,t,u)),w=Le(C=>H9(C,t));if(m.useLayoutEffect(()=>{if(!(n!=="auto"||!v||LI(i)||m.isValidElement(i)||w==null)){var C=o.current;if(C){var I=C.getCalculatedWidth();Math.round(v.width)!==Math.round(I)&&d(yCe({id:t,width:I}))}}},[b,v,d,i,t,n,w]),v==null||y==null||w==null)return null;var{dangerouslySetInnerHTML:x,ticks:k}=e,$=NN(e,LOe),{id:P}=w,j=NN(w,BOe);return m.createElement(JI,c$({},$,j,{ref:o,labelRef:a,scale:p,x:y.x,y:y.y,tickTextProps:n==="auto"?{width:void 0}:{width:n},width:v.width,height:v.height,className:ve("recharts-".concat(f," ").concat(f),r),viewBox:s,ticks:b,axisType:f}))},KOe={allowDataOverflow:Sn.allowDataOverflow,allowDecimals:Sn.allowDecimals,allowDuplicatedCategory:Sn.allowDuplicatedCategory,angle:Sn.angle,axisLine:ss.axisLine,hide:!1,includeHidden:Sn.includeHidden,interval:Sn.interval,minTickGap:Sn.minTickGap,mirror:Sn.mirror,orientation:Sn.orientation,padding:Sn.padding,reversed:Sn.reversed,scale:Sn.scale,tick:Sn.tick,tickCount:Sn.tickCount,tickLine:ss.tickLine,tickSize:ss.tickSize,type:Sn.type,width:Sn.width,yAxisId:0},HOe=e=>{var t=Er(e,KOe);return m.createElement(m.Fragment,null,m.createElement(UOe,{interval:t.interval,id:t.yAxisId,scale:t.scale,type:t.type,domain:t.domain,allowDataOverflow:t.allowDataOverflow,dataKey:t.dataKey,allowDuplicatedCategory:t.allowDuplicatedCategory,allowDecimals:t.allowDecimals,tickCount:t.tickCount,padding:t.padding,includeHidden:t.includeHidden,reversed:t.reversed,ticks:t.ticks,width:t.width,orientation:t.orientation,mirror:t.mirror,hide:t.hide,unit:t.unit,name:t.name,angle:t.angle,minTickGap:t.minTickGap,tick:t.tick,tickFormatter:t.tickFormatter}),m.createElement(WOe,t))},ls=m.memo(HOe,FH);ls.displayName="YAxis";var VOe=(e,t)=>t,tO=ce([VOe,At,U9,gn,IK,js,D1e,pn],W1e),rO=e=>{var t=e.currentTarget.getBoundingClientRect(),r=t.width/e.currentTarget.offsetWidth,n=t.height/e.currentTarget.offsetHeight;return{chartX:Math.round((e.clientX-t.left)/r),chartY:Math.round((e.clientY-t.top)/n)}},UH=So("mouseClick"),WH=im();WH.startListening({actionCreator:UH,effect:(e,t)=>{var r=e.payload,n=tO(t.getState(),rO(r));(n==null?void 0:n.activeIndex)!=null&&t.dispatch(RSe({activeIndex:n.activeIndex,activeDataKey:void 0,activeCoordinate:n.activeCoordinate}))}});var d$=So("mouseMove"),KH=im(),vv=null;KH.startListening({actionCreator:d$,effect:(e,t)=>{var r=e.payload;vv!==null&&cancelAnimationFrame(vv);var n=rO(r);vv=requestAnimationFrame(()=>{var i=t.getState(),o=EI(i,i.tooltip.settings.shared);if(o==="axis"){var a=tO(i,n);(a==null?void 0:a.activeIndex)!=null?t.dispatch(wK({activeIndex:a.activeIndex,activeDataKey:void 0,activeCoordinate:a.activeCoordinate})):t.dispatch(xK())}vv=null})}});var LN={accessibilityLayer:!0,barCategoryGap:"10%",barGap:4,barSize:void 0,className:void 0,maxBarSize:void 0,stackOffset:"none",syncId:void 0,syncMethod:"index",baseValue:void 0,reverseStackOrder:!1},HH=Oi({name:"rootProps",initialState:LN,reducers:{updateOptions:(e,t)=>{var r;e.accessibilityLayer=t.payload.accessibilityLayer,e.barCategoryGap=t.payload.barCategoryGap,e.barGap=(r=t.payload.barGap)!==null&&r!==void 0?r:LN.barGap,e.barSize=t.payload.barSize,e.maxBarSize=t.payload.maxBarSize,e.stackOffset=t.payload.stackOffset,e.syncId=t.payload.syncId,e.syncMethod=t.payload.syncMethod,e.className=t.payload.className,e.baseValue=t.payload.baseValue,e.reverseStackOrder=t.payload.reverseStackOrder}}}),qOe=HH.reducer,{updateOptions:GOe}=HH.actions,VH=Oi({name:"polarOptions",initialState:null,reducers:{updatePolarOptions:(e,t)=>t.payload}}),{updatePolarOptions:ZOe}=VH.actions,XOe=VH.reducer,qH=So("keyDown"),GH=So("focus"),nO=im();nO.startListening({actionCreator:qH,effect:(e,t)=>{var r=t.getState(),n=r.rootProps.accessibilityLayer!==!1;if(n){var{keyboardInteraction:i}=r.tooltip,o=e.payload;if(!(o!=="ArrowRight"&&o!=="ArrowLeft"&&o!=="Enter")){var a=II(i,yf(r),ym(r),Sm(r)),s=a==null?-1:Number(a);if(!(!Number.isFinite(s)||s<0)){var u=js(r);if(o==="Enter"){var d=Yy(r,"axis","hover",String(i.index));t.dispatch(JP({active:!i.active,activeIndex:i.index,activeDataKey:i.dataKey,activeCoordinate:d}));return}var f=$Se(r),p=f==="left-to-right"?1:-1,v=o==="ArrowRight"?1:-1,y=s+v*p;if(!(u==null||y>=u.length||y<0)){var b=Yy(r,"axis","hover",String(y));t.dispatch(JP({active:!0,activeIndex:y.toString(),activeDataKey:void 0,activeCoordinate:b}))}}}}}});nO.startListening({actionCreator:GH,effect:(e,t)=>{var r=t.getState(),n=r.rootProps.accessibilityLayer!==!1;if(n){var{keyboardInteraction:i}=r.tooltip;if(!i.active&&i.index==null){var o="0",a=Yy(r,"axis","hover",String(o));t.dispatch(JP({activeDataKey:void 0,active:!0,activeIndex:o,activeCoordinate:a}))}}}});var lo=So("externalEvent"),ZH=im(),q1=new Map;ZH.startListening({actionCreator:lo,effect:(e,t)=>{var{handler:r,reactEvent:n}=e.payload;if(r!=null){n.persist();var i=n.type,o=q1.get(i);o!==void 0&&cancelAnimationFrame(o);var a=requestAnimationFrame(()=>{try{var s=t.getState(),u={activeCoordinate:w1e(s),activeDataKey:MI(s),activeIndex:jl(s),activeLabel:AK(s),activeTooltipIndex:jl(s),isTooltipActive:S1e(s)};r(u,n)}finally{q1.delete(i)}});q1.set(i,a)}}});var YOe=ce([vf],e=>e.tooltipItemPayloads),QOe=ce([YOe,xm,(e,t,r)=>t,(e,t,r)=>r],(e,t,r,n)=>{var i=e.find(s=>s.settings.dataKey===n);if(i!=null){var{positions:o}=i;if(o!=null){var a=t(o,r);return a}}}),XH=So("touchMove"),YH=im();YH.startListening({actionCreator:XH,effect:(e,t)=>{var r=e.payload;if(!(r.touches==null||r.touches.length===0)){var n=t.getState(),i=EI(n,n.tooltip.settings.shared);if(i==="axis"){var o=tO(n,rO({clientX:r.touches[0].clientX,clientY:r.touches[0].clientY,currentTarget:r.currentTarget}));(o==null?void 0:o.activeIndex)!=null&&t.dispatch(wK({activeIndex:o.activeIndex,activeDataKey:void 0,activeCoordinate:o.activeCoordinate}))}else if(i==="item"){var a,s=r.touches[0];if(document.elementFromPoint==null)return;var u=document.elementFromPoint(s.clientX,s.clientY);if(!u||!u.getAttribute)return;var d=u.getAttribute(f8),f=(a=u.getAttribute(p8))!==null&&a!==void 0?a:void 0,p=QOe(t.getState(),d,f);t.dispatch(bK({activeDataKey:f,activeIndex:d,activeCoordinate:p}))}}}});var JOe=TW({brush:hEe,cartesianAxis:bCe,chartData:bke,errorBars:NCe,graphicalItems:C$e,layout:Gge,legend:rye,options:mke,polarAxis:KPe,polarOptions:XOe,referenceElements:zEe,rootProps:qOe,tooltip:DSe,zIndex:nke}),e_e=function(t){return bge({reducer:JOe,preloadedState:t,middleware:r=>{var n;return r({serializableCheck:!1,immutableCheck:!["commonjs","es6","production"].includes((n="es6")!==null&&n!==void 0?n:"")}).concat([WH.middleware,KH.middleware,nO.middleware,ZH.middleware,YH.middleware])},enhancers:r=>{var n=r;return typeof r=="function"&&(n=r()),n.concat(GW({type:"raf"}))},devTools:lf.devToolsEnabled})};function QH(e){var{preloadedState:t,children:r,reduxStoreName:n}=e,i=hn(),o=m.useRef(null);if(i)return r;o.current==null&&(o.current=e_e(t));var a=hE;return m.createElement(aje,{context:a,store:o.current},r)}function t_e(e){var{layout:t,margin:r}=e,n=ir(),i=hn();return m.useEffect(()=>{i||(n(Hge(t)),n(Kge(r)))},[n,i,t,r]),null}var JH=m.memo(t_e,Pm);function eV(e){var t=ir();return m.useEffect(()=>{t(GOe(e))},[t,e]),null}function BN(e){var{zIndex:t,isPanorama:r}=e,n=r?"recharts-zindex-panorama-":"recharts-zindex-",i=uH("".concat(n).concat(t)),o=ir();return m.useLayoutEffect(()=>(o(tke({zIndex:t,elementId:i,isPanorama:r})),()=>{o(rke({zIndex:t,isPanorama:r}))}),[o,t,i,r]),m.createElement("g",{tabIndex:-1,id:i})}function FN(e){var{children:t,isPanorama:r}=e,n=Le(H1e);if(!n||n.length===0)return t;var i=n.filter(a=>a<0),o=n.filter(a=>a>0);return m.createElement(m.Fragment,null,i.map(a=>m.createElement(BN,{key:a,zIndex:a,isPanorama:r})),t,o.map(a=>m.createElement(BN,{key:a,zIndex:a,isPanorama:r})))}var r_e=["children"];function n_e(e,t){if(e==null)return{};var r,n,i=i_e(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n<o.length;n++)r=o[n],t.indexOf(r)===-1&&{}.propertyIsEnumerable.call(e,r)&&(i[r]=e[r])}return i}function i_e(e,t){if(e==null)return{};var r={};for(var n in e)if({}.hasOwnProperty.call(e,n)){if(t.indexOf(n)!==-1)continue;r[n]=e[n]}return r}function lb(){return lb=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},lb.apply(null,arguments)}var o_e={width:"100%",height:"100%",display:"block"},a_e=m.forwardRef((e,t)=>{var r=$E(),n=CE(),i=O8();if(!Ca(r)||!Ca(n))return null;var{children:o,otherAttributes:a,title:s,desc:u}=e,d,f;return a!=null&&(typeof a.tabIndex=="number"?d=a.tabIndex:d=i?0:void 0,typeof a.role=="string"?f=a.role:f=i?"application":void 0),m.createElement(iE,lb({},a,{title:s,desc:u,role:f,tabIndex:d,width:r,height:n,style:o_e,ref:t}),o)}),s_e=e=>{var{children:t}=e,r=Le(am);if(!r)return null;var{width:n,height:i,y:o,x:a}=r;return m.createElement(iE,{width:n,height:i,x:a,y:o},t)},UN=m.forwardRef((e,t)=>{var{children:r}=e,n=n_e(e,r_e),i=hn();return i?m.createElement(s_e,null,m.createElement(FN,{isPanorama:!0},r)):m.createElement(a_e,lb({ref:t},n),m.createElement(FN,{isPanorama:!1},r))});function l_e(){var e=ir(),[t,r]=m.useState(null),n=Le(dve);return m.useEffect(()=>{if(t!=null){var i=t.getBoundingClientRect(),o=i.width/t.offsetWidth;wr(o)&&o!==n&&e(qge(o))}},[t,e,n]),r}function WN(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function u_e(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?WN(Object(r),!0).forEach(function(n){c_e(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):WN(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function c_e(e,t,r){return(t=d_e(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function d_e(e){var t=f_e(e,"string");return typeof t=="symbol"?t:t+""}function f_e(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Qu(){return Qu=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},Qu.apply(null,arguments)}var p_e=()=>(Eke(),null);function ub(e){if(typeof e=="number")return e;if(typeof e=="string"){var t=parseFloat(e);if(!Number.isNaN(t))return t}return 0}var h_e=m.forwardRef((e,t)=>{var r,n,i=m.useRef(null),[o,a]=m.useState({containerWidth:ub((r=e.style)===null||r===void 0?void 0:r.width),containerHeight:ub((n=e.style)===null||n===void 0?void 0:n.height)}),s=m.useCallback((d,f)=>{a(p=>{var v=Math.round(d),y=Math.round(f);return p.containerWidth===v&&p.containerHeight===y?p:{containerWidth:v,containerHeight:y}})},[]),u=m.useCallback(d=>{if(typeof t=="function"&&t(d),d!=null&&typeof ResizeObserver<"u"){var{width:f,height:p}=d.getBoundingClientRect();s(f,p);var v=b=>{var{width:w,height:x}=b[0].contentRect;s(w,x)},y=new ResizeObserver(v);y.observe(d),i.current=y}},[t,s]);return m.useEffect(()=>()=>{var d=i.current;d!=null&&d.disconnect()},[s]),m.createElement(m.Fragment,null,m.createElement(Px,{width:o.containerWidth,height:o.containerHeight}),m.createElement("div",Qu({ref:u},e)))}),m_e=m.forwardRef((e,t)=>{var{width:r,height:n}=e,[i,o]=m.useState({containerWidth:ub(r),containerHeight:ub(n)}),a=m.useCallback((u,d)=>{o(f=>{var p=Math.round(u),v=Math.round(d);return f.containerWidth===p&&f.containerHeight===v?f:{containerWidth:p,containerHeight:v}})},[]),s=m.useCallback(u=>{if(typeof t=="function"&&t(u),u!=null){var{width:d,height:f}=u.getBoundingClientRect();a(d,f)}},[t,a]);return m.createElement(m.Fragment,null,m.createElement(Px,{width:i.containerWidth,height:i.containerHeight}),m.createElement("div",Qu({ref:s},e)))}),g_e=m.forwardRef((e,t)=>{var{width:r,height:n}=e;return m.createElement(m.Fragment,null,m.createElement(Px,{width:r,height:n}),m.createElement("div",Qu({ref:t},e)))}),v_e=m.forwardRef((e,t)=>{var{width:r,height:n}=e;return hs(r)||hs(n)?m.createElement(m_e,Qu({},e,{ref:t})):m.createElement(g_e,Qu({},e,{ref:t}))});function y_e(e){return e===!0?h_e:v_e}var b_e=m.forwardRef((e,t)=>{var{children:r,className:n,height:i,onClick:o,onContextMenu:a,onDoubleClick:s,onMouseDown:u,onMouseEnter:d,onMouseLeave:f,onMouseMove:p,onMouseUp:v,onTouchEnd:y,onTouchMove:b,onTouchStart:w,style:x,width:k,responsive:$,dispatchTouchEvents:P=!0}=e,j=m.useRef(null),C=ir(),[I,A]=m.useState(null),[T,M]=m.useState(null),R=l_e(),D=PE(),O=(D==null?void 0:D.width)>0?D.width:k,L=(D==null?void 0:D.height)>0?D.height:i,z=m.useCallback(J=>{R(J),typeof t=="function"&&t(J),A(J),M(J),J!=null&&(j.current=J)},[R,t,A,M]),F=m.useCallback(J=>{C(UH(J)),C(lo({handler:o,reactEvent:J}))},[C,o]),B=m.useCallback(J=>{C(d$(J)),C(lo({handler:d,reactEvent:J}))},[C,d]),U=m.useCallback(J=>{C(xK()),C(lo({handler:f,reactEvent:J}))},[C,f]),V=m.useCallback(J=>{C(d$(J)),C(lo({handler:p,reactEvent:J}))},[C,p]),K=m.useCallback(()=>{C(GH())},[C]),Z=m.useCallback(J=>{C(qH(J.key))},[C]),W=m.useCallback(J=>{C(lo({handler:a,reactEvent:J}))},[C,a]),q=m.useCallback(J=>{C(lo({handler:s,reactEvent:J}))},[C,s]),oe=m.useCallback(J=>{C(lo({handler:u,reactEvent:J}))},[C,u]),Y=m.useCallback(J=>{C(lo({handler:v,reactEvent:J}))},[C,v]),H=m.useCallback(J=>{C(lo({handler:w,reactEvent:J}))},[C,w]),X=m.useCallback(J=>{P&&C(XH(J)),C(lo({handler:b,reactEvent:J}))},[C,P,b]),re=m.useCallback(J=>{C(lo({handler:y,reactEvent:J}))},[C,y]),he=y_e($);return m.createElement(BK.Provider,{value:I},m.createElement(G3.Provider,{value:T},m.createElement(he,{width:O??(x==null?void 0:x.width),height:L??(x==null?void 0:x.height),className:ve("recharts-wrapper",n),style:u_e({position:"relative",cursor:"default",width:O,height:L},x),onClick:F,onContextMenu:W,onDoubleClick:q,onFocus:K,onKeyDown:Z,onMouseDown:oe,onMouseEnter:B,onMouseLeave:U,onMouseMove:V,onMouseUp:Y,onTouchEnd:re,onTouchMove:X,onTouchStart:H,ref:z},m.createElement(p_e,null),r)))}),x_e=["width","height","responsive","children","className","style","compact","title","desc"];function w_e(e,t){if(e==null)return{};var r,n,i=S_e(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n<o.length;n++)r=o[n],t.indexOf(r)===-1&&{}.propertyIsEnumerable.call(e,r)&&(i[r]=e[r])}return i}function S_e(e,t){if(e==null)return{};var r={};for(var n in e)if({}.hasOwnProperty.call(e,n)){if(t.indexOf(n)!==-1)continue;r[n]=e[n]}return r}var tV=m.forwardRef((e,t)=>{var{width:r,height:n,responsive:i,children:o,className:a,style:s,compact:u,title:d,desc:f}=e,p=w_e(e,x_e),v=Zn(p);return u?m.createElement(m.Fragment,null,m.createElement(Px,{width:r,height:n}),m.createElement(UN,{otherAttributes:v,title:d,desc:f},o)):m.createElement(b_e,{className:a,style:s,width:r,height:n,responsive:i??!1,onClick:e.onClick,onMouseLeave:e.onMouseLeave,onMouseEnter:e.onMouseEnter,onMouseMove:e.onMouseMove,onMouseDown:e.onMouseDown,onMouseUp:e.onMouseUp,onContextMenu:e.onContextMenu,onDoubleClick:e.onDoubleClick,onTouchStart:e.onTouchStart,onTouchMove:e.onTouchMove,onTouchEnd:e.onTouchEnd},m.createElement(UN,{otherAttributes:v,title:d,desc:f,ref:t},m.createElement(NEe,null,o)))});function f$(){return f$=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},f$.apply(null,arguments)}var k_e={top:5,right:5,bottom:5,left:5},P_e={accessibilityLayer:!0,barCategoryGap:"10%",barGap:4,layout:"horizontal",margin:k_e,responsive:!1,reverseStackOrder:!1,stackOffset:"none",syncMethod:"index"},iO=m.forwardRef(function(t,r){var n,i=Er(t.categoricalChartProps,P_e),{chartName:o,defaultTooltipEventType:a,validateTooltipEventTypes:s,tooltipPayloadSearcher:u,categoricalChartProps:d}=t,f={chartName:o,defaultTooltipEventType:a,validateTooltipEventTypes:s,tooltipPayloadSearcher:u,eventEmitter:void 0};return m.createElement(QH,{preloadedState:{options:f},reduxStoreName:(n=d.id)!==null&&n!==void 0?n:o},m.createElement(yH,{chartData:d.data}),m.createElement(JH,{layout:i.layout,margin:i.margin}),m.createElement(eV,{baseValue:i.baseValue,accessibilityLayer:i.accessibilityLayer,barCategoryGap:i.barCategoryGap,maxBarSize:i.maxBarSize,stackOffset:i.stackOffset,barGap:i.barGap,barSize:i.barSize,syncId:i.syncId,syncMethod:i.syncMethod,className:i.className,reverseStackOrder:i.reverseStackOrder}),m.createElement(tV,f$({},i,{ref:r})))}),$_e=["axis"],C_e=m.forwardRef((e,t)=>m.createElement(iO,{chartName:"LineChart",defaultTooltipEventType:"axis",validateTooltipEventTypes:$_e,tooltipPayloadSearcher:Vx,categoricalChartProps:e,ref:t})),j_e=["axis","item"],oO=m.forwardRef((e,t)=>m.createElement(iO,{chartName:"BarChart",defaultTooltipEventType:"axis",validateTooltipEventTypes:j_e,tooltipPayloadSearcher:Vx,categoricalChartProps:e,ref:t}));function E_e(e){var t=ir();return m.useEffect(()=>{t(ZOe(e))},[t,e]),null}var I_e=["layout"];function p$(){return p$=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},p$.apply(null,arguments)}function O_e(e,t){if(e==null)return{};var r,n,i=__e(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n<o.length;n++)r=o[n],t.indexOf(r)===-1&&{}.propertyIsEnumerable.call(e,r)&&(i[r]=e[r])}return i}function __e(e,t){if(e==null)return{};var r={};for(var n in e)if({}.hasOwnProperty.call(e,n)){if(t.indexOf(n)!==-1)continue;r[n]=e[n]}return r}var A_e={top:5,right:5,bottom:5,left:5},rV={accessibilityLayer:!0,stackOffset:"none",barCategoryGap:"10%",barGap:4,margin:A_e,reverseStackOrder:!1,syncMethod:"index",layout:"radial",responsive:!1,cx:"50%",cy:"50%",innerRadius:0,outerRadius:"80%"},T_e=m.forwardRef(function(t,r){var n,i=Er(t.categoricalChartProps,rV),{layout:o}=i,a=O_e(i,I_e),{chartName:s,defaultTooltipEventType:u,validateTooltipEventTypes:d,tooltipPayloadSearcher:f}=t,p={chartName:s,defaultTooltipEventType:u,validateTooltipEventTypes:d,tooltipPayloadSearcher:f,eventEmitter:void 0};return m.createElement(QH,{preloadedState:{options:p},reduxStoreName:(n=i.id)!==null&&n!==void 0?n:s},m.createElement(yH,{chartData:i.data}),m.createElement(JH,{layout:o,margin:i.margin}),m.createElement(eV,{baseValue:void 0,accessibilityLayer:i.accessibilityLayer,barCategoryGap:i.barCategoryGap,maxBarSize:i.maxBarSize,stackOffset:i.stackOffset,barGap:i.barGap,barSize:i.barSize,syncId:i.syncId,syncMethod:i.syncMethod,className:i.className,reverseStackOrder:i.reverseStackOrder}),m.createElement(E_e,{cx:i.cx,cy:i.cy,startAngle:i.startAngle,endAngle:i.endAngle,innerRadius:i.innerRadius,outerRadius:i.outerRadius}),m.createElement(tV,p$({},a,{ref:r})))});function KN(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function HN(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?KN(Object(r),!0).forEach(function(n){M_e(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):KN(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function M_e(e,t,r){return(t=R_e(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function R_e(e){var t=D_e(e,"string");return typeof t=="symbol"?t:t+""}function D_e(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var z_e=["item"],N_e=HN(HN({},rV),{},{layout:"centric",startAngle:0,endAngle:360}),L_e=m.forwardRef((e,t)=>{var r=Er(e,N_e);return m.createElement(T_e,{chartName:"PieChart",defaultTooltipEventType:"item",validateTooltipEventTypes:z_e,tooltipPayloadSearcher:Vx,categoricalChartProps:r,ref:t})}),B_e=["axis"],aO=m.forwardRef((e,t)=>m.createElement(iO,{chartName:"AreaChart",defaultTooltipEventType:"axis",validateTooltipEventTypes:B_e,tooltipPayloadSearcher:Vx,categoricalChartProps:e,ref:t}));const F_e=200,U_e=6e4;function nV({open:e,cacheKey:t,summary:r,baseQuery:n,onClose:i,onPrev:o,onNext:a,onCleared:s}){const u=t??"",d=Kr(),f=m.useMemo(()=>({enabled:e&&!!u}),[e,u]),p=rn("GET /__rrroutes/cache",f),v=rn("POST /__rrroutes/cache/clear"),y=m.useMemo(()=>{if(!u)return;const we={...n,keys:[u],cursor:void 0,pageSize:F_e,orderBy:"timestamp",orderDirection:"asc"};return VN(we)},[n,u]),b=m.useMemo(()=>{if(!u)return;const we={...n,keys:[u],cursor:void 0};return VN(we)},[n,u]),{data:w,isLoading:x,error:k,refetch:$}=p.useEndpoint(y?{query:y}:{query:{}}),P=m.useMemo(()=>W_e(w),[w]),[j,C]=m.useState(U_e),[I,A]=m.useState(!0),[T,M]=m.useState(!0),[R,D]=m.useState(!0),[O,L]=m.useState(!1),[z,F]=m.useState(!1),B=m.useMemo(()=>K_e(P,j),[P,j]),U=m.useMemo(()=>H_e(P),[P]),V=m.useMemo(()=>V_e(P),[P]),K=m.useMemo(()=>q_e(P),[P]),Z=m.useMemo(()=>({totalHits:(r==null?void 0:r.totalHits)??V.totalHits,totalMisses:(r==null?void 0:r.totalMisses)??V.totalMisses,totalSets:(r==null?void 0:r.totalSets)??V.totalSets,lastHitAt:(r==null?void 0:r.lastHitAt)??V.lastHitAt,lastMissAt:(r==null?void 0:r.lastMissAt)??V.lastMissAt,lastSetAt:(r==null?void 0:r.lastSetAt)??V.lastSetAt}),[r,V]),W=r==null?void 0:r.sizeBytes,[q,oe]=m.useState(!1),[Y,H]=m.useState(!1),[X,re]=m.useState(null),[he,J]=m.useState(!1);m.useEffect(()=>{oe(!1),H(!1),re(null),J(!1)},[u]);const ge=()=>oe(!1),Se=async()=>{if(!(!u||!b)){H(!0),re(null);try{await v.fetch({query:b},""),J(!0),s==null||s(u),$()}catch(we){const ze=we instanceof Error?we.message:"Failed to clear cache.";re(ze)}finally{H(!1),oe(!1)}}},se={hits:d.palette.success.main,misses:d.palette.error.main,sets:d.palette.info.main},Pe=O||z,ke=we=>O&&!z?`${we.toFixed(0)}%`:!O&&z?`${we.toFixed(0)} ms`:O&&z?we.toFixed(0):"",$e=[{label:"10s",value:1e4},{label:"30s",value:3e4},{label:"1m",value:6e4},{label:"5m",value:5*6e4},{label:"15m",value:15*6e4},{label:"1h",value:60*6e4}];return h.jsx(sf,{open:e,onClose:i,onPrev:o,onNext:a,title:u?`Cache key: ${u}`:"Cache key details",children:u?h.jsxs(ue,{spacing:3,children:[x&&h.jsx(Bb,{}),k?h.jsx(xa,{severity:"error",action:h.jsx(zt,{color:"inherit",size:"small",onClick:()=>$(),children:"Retry"}),children:"Failed to load cache activity for this key."}):null,h.jsxs(ue,{spacing:1,children:[h.jsx(ne,{variant:"subtitle2",children:"Summary"}),h.jsxs(Be,{sx:{display:"grid",gridTemplateColumns:{xs:"repeat(2, minmax(0, 1fr))",sm:"repeat(3, minmax(0, 1fr))"},gap:2},children:[h.jsx(zi,{label:"Total hits",value:Z.totalHits}),h.jsx(zi,{label:"Total misses",value:Z.totalMisses}),h.jsx(zi,{label:"Total sets",value:Z.totalSets}),h.jsx(zi,{label:"Last hit",value:G1(Z.lastHitAt)}),h.jsx(zi,{label:"Last miss",value:G1(Z.lastMissAt)}),h.jsx(zi,{label:"Last set",value:G1(Z.lastSetAt)}),h.jsx(zi,{label:"Approx. size",value:W!=null?Z1(W):"Unknown"}),h.jsx(zi,{label:"Hit latency avg (ms)",value:Vc(K.hits.avgDurationMs)}),h.jsx(zi,{label:"Hit latency p50 (ms)",value:Vc(K.hits.p50DurationMs)}),h.jsx(zi,{label:"Hit latency p95 (ms)",value:Vc(K.hits.p95DurationMs)}),h.jsx(zi,{label:"Miss latency avg (ms)",value:Vc(K.misses.avgDurationMs)}),h.jsx(zi,{label:"Miss latency p50 (ms)",value:Vc(K.misses.p50DurationMs)}),h.jsx(zi,{label:"Miss latency p95 (ms)",value:Vc(K.misses.p95DurationMs)})]})]}),h.jsxs(ue,{spacing:1,children:[h.jsxs(Be,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center",flexWrap:"wrap",gap:1.5},children:[h.jsx(ne,{variant:"subtitle2",children:"Timeline"}),h.jsxs(ue,{direction:"row",spacing:1.5,alignItems:"center",children:[h.jsx(ne,{variant:"caption",color:"text.secondary",children:"Bucket size"}),h.jsx(uC,{exclusive:!0,size:"small",value:j,onChange:(we,ze)=>{typeof ze=="number"&&C(ze)},children:$e.map(we=>h.jsx(pu,{value:we.value,sx:{px:1},children:we.label},we.value))})]})]}),h.jsxs(gie,{row:!0,sx:{gap:1,flexWrap:"wrap"},children:[h.jsx(fp,{control:h.jsx(Zc,{size:"small",checked:I,onChange:we=>A(we.target.checked)}),label:"Hits"}),h.jsx(fp,{control:h.jsx(Zc,{size:"small",checked:T,onChange:we=>M(we.target.checked)}),label:"Misses"}),h.jsx(fp,{control:h.jsx(Zc,{size:"small",checked:R,onChange:we=>D(we.target.checked)}),label:"Sets"}),h.jsx(fp,{control:h.jsx(Zc,{size:"small",checked:O,onChange:we=>L(we.target.checked)}),label:"Hit rate"}),h.jsx(fp,{control:h.jsx(Zc,{size:"small",checked:z,onChange:we=>F(we.target.checked)}),label:"Latency (avg)"})]}),h.jsx(Be,{sx:{height:320},children:B.length?h.jsx(vl,{width:"100%",height:"100%",children:h.jsxs(aO,{data:B,margin:{left:0,right:16,top:8,bottom:8},children:[h.jsx(Il,{stroke:"rgba(255,255,255,0.08)"}),h.jsx(Ol,{dataKey:"timestamp",type:"number",tickFormatter:we=>Ep(we),tick:{fill:"rgba(255,255,255,0.7)",fontSize:12},tickLine:!1,axisLine:!1,domain:["dataMin","dataMax"]}),h.jsx(ls,{yAxisId:"left",allowDecimals:!1,tick:{fill:"rgba(255,255,255,0.7)",fontSize:12},tickLine:!1,axisLine:!1}),Pe&&h.jsx(ls,{yAxisId:"right",orientation:"right",tick:{fill:"rgba(255,255,255,0.7)",fontSize:12},tickLine:!1,axisLine:!1,tickFormatter:ke}),h.jsx(bl,{contentStyle:{backgroundColor:"#1e1b23",borderColor:"rgba(255,255,255,0.12)"},labelFormatter:we=>Ep(we)}),R&&h.jsx(cd,{type:"monotone",dataKey:"sets",yAxisId:"left",stackId:"1",stroke:se.sets,fill:se.sets,fillOpacity:.35,name:"Sets"}),I&&h.jsx(cd,{type:"monotone",dataKey:"hits",yAxisId:"left",stackId:"1",stroke:se.hits,fill:se.hits,fillOpacity:.5,name:"Hits"}),T&&h.jsx(cd,{type:"monotone",dataKey:"misses",yAxisId:"left",stackId:"1",stroke:se.misses,fill:se.misses,fillOpacity:.4,name:"Misses"}),O&&h.jsx(Lv,{type:"monotone",dataKey:"hitRate",yAxisId:"right",stroke:d.palette.warning.main,dot:!1,name:"Hit rate (%)",strokeWidth:1.5}),z&&h.jsx(Lv,{type:"monotone",dataKey:"avgDurationMs",yAxisId:"right",stroke:d.palette.secondary.main,dot:!1,name:"Avg latency (ms)",strokeWidth:1.5}),h.jsx(xH,{dataKey:"timestamp",height:24,travellerWidth:10,stroke:d.palette.primary.main,tickFormatter:we=>Ep(we)})]})}):h.jsx(Be,{sx:{height:"100%",border:"1px dashed",borderColor:"divider",borderRadius:2,display:"flex",alignItems:"center",justifyContent:"center",color:"text.secondary",textAlign:"center",px:2},children:"No cache activity recorded for this key within the selected filters."})})]}),U.length>0&&h.jsxs(ue,{spacing:1,children:[h.jsx(ne,{variant:"subtitle2",children:"Size over time"}),h.jsx(Be,{sx:{height:200},children:h.jsx(vl,{width:"100%",height:"100%",children:h.jsxs(C_e,{data:U,margin:{left:0,right:16,top:8,bottom:8},children:[h.jsx(Il,{stroke:"rgba(255,255,255,0.08)"}),h.jsx(Ol,{dataKey:"timestamp",type:"number",tickFormatter:we=>Ep(we),tick:{fill:"rgba(255,255,255,0.7)",fontSize:12},tickLine:!1,axisLine:!1,domain:["dataMin","dataMax"]}),h.jsx(ls,{tick:{fill:"rgba(255,255,255,0.7)",fontSize:12},tickLine:!1,axisLine:!1,tickFormatter:we=>Z1(we)}),h.jsx(bl,{contentStyle:{backgroundColor:"#1e1b23",borderColor:"rgba(255,255,255,0.12)"},labelFormatter:we=>Ep(we),formatter:we=>[Z1(we),"Size"]}),h.jsx(Lv,{type:"monotone",dataKey:"sizeBytes",stroke:d.palette.info.main,dot:!1,name:"Size"})]})})})]}),h.jsxs(ue,{spacing:1,children:[h.jsx(ne,{variant:"subtitle2",children:"Actions"}),he?h.jsx(xa,{severity:"success",children:"Cache cleared for this key."}):null,X?h.jsx(xa,{severity:"error",children:X}):null,q?h.jsxs(ue,{spacing:1,children:[h.jsxs(xa,{severity:"warning",children:["This will remove cached data for"," ",h.jsx(ne,{component:"span",fontWeight:600,children:u}),". This action cannot be undone."]}),h.jsxs(ue,{direction:{xs:"column",sm:"row"},spacing:1,alignItems:"flex-start",children:[h.jsx(zt,{variant:"contained",color:"error",onClick:Se,disabled:Y,children:Y?"Clearing...":"Confirm clear"}),h.jsx(zt,{onClick:ge,disabled:Y,children:"Cancel"})]})]}):h.jsx(zt,{variant:"outlined",color:"error",onClick:()=>oe(!0),children:"Clear cache for this key"})]})]}):h.jsx(ne,{color:"text.secondary",children:"Select a cache entry to inspect its history."})})}function VN(e){const t={};return Object.entries(e).forEach(([r,n])=>{n!=null&&(t[r]=n)}),t}function W_e(e){return e?Array.isArray(e.pages)?e.pages.flatMap(t=>Array.isArray(t==null?void 0:t.out)?t.out:[]):Array.isArray(e.out)?e.out:[]:[]}function K_e(e,t){if(!e.length||t<=0)return[];const r=[...e].sort((i,o)=>i.createdAt-o.createdAt),n=new Map;for(const i of r){const o=Math.floor(i.createdAt/t)*t;let a=n.get(o);a||(a={timestamp:o,hits:0,misses:0,sets:0,durationSumMs:0,durationCount:0},n.set(o,a)),i.operation==="hit"&&(a.hits+=1),i.operation==="miss"&&(a.misses+=1),i.operation==="set"&&(a.sets+=1),typeof i.durationMs=="number"&&Number.isFinite(i.durationMs)&&(a.durationSumMs+=i.durationMs,a.durationCount+=1)}return Array.from(n.values()).sort((i,o)=>i.timestamp-o.timestamp).map(i=>{const o=i.hits+i.misses,a=o?i.hits/o*100:0,s=i.durationCount>0?i.durationSumMs/i.durationCount:null;return{timestamp:i.timestamp,hits:i.hits,misses:i.misses,sets:i.sets,totalRequests:o,hitRate:a,avgDurationMs:s}})}function H_e(e){const t=[];for(const r of e)r.operation==="set"&&typeof r.size=="number"&&t.push({timestamp:r.createdAt,sizeBytes:r.size});return t.sort((r,n)=>r.timestamp-n.timestamp),t}function V_e(e){return e.reduce((t,r)=>(r.operation==="hit"?(t.totalHits+=1,t.lastHitAt=Math.max(t.lastHitAt??0,r.createdAt)):r.operation==="miss"?(t.totalMisses+=1,t.lastMissAt=Math.max(t.lastMissAt??0,r.createdAt)):r.operation==="set"&&(t.totalSets+=1,t.lastSetAt=Math.max(t.lastSetAt??0,r.createdAt)),t),{totalHits:0,totalMisses:0,totalSets:0,lastHitAt:null,lastMissAt:null,lastSetAt:null})}function q_e(e){const t=[],r=[];for(const n of e)typeof n.durationMs!="number"||!Number.isFinite(n.durationMs)||(n.operation==="hit"?t.push(n.durationMs):n.operation==="miss"&&r.push(n.durationMs));return{hits:qN(t),misses:qN(r)}}function qN(e){if(!e.length)return{avgDurationMs:null,p50DurationMs:null,p95DurationMs:null};const t=[...e].sort((o,a)=>o-a),r=e.reduce((o,a)=>o+a,0)/e.length,n=GN(t,.5),i=GN(t,.95);return{avgDurationMs:r,p50DurationMs:n,p95DurationMs:i}}function GN(e,t){if(!e.length)return null;if(t<=0)return e[0];if(t>=1)return e[e.length-1];const r=Math.floor((e.length-1)*t);return e[r]}function G1(e){if(!e)return"—";try{return new Date(e).toLocaleString()}catch{return"—"}}function Ep(e){const t=typeof e=="number"?e:Number(e);if(!Number.isFinite(t))return"";try{return new Date(t).toLocaleString()}catch{return""}}function Z1(e){if(!e||!Number.isFinite(e))return"—";const t=["B","KB","MB","GB","TB"],r=Math.min(Math.floor(Math.log(e)/Math.log(1024)),t.length-1);return`${(e/1024**r).toFixed(r===0?0:2)} ${t[r]}`}function Vc(e){return e==null||!Number.isFinite(e)?"—":e<1||e<10?e.toFixed(2):e.toFixed(1)}function zi({label:e,value:t}){return h.jsxs(Be,{sx:{border:"1px solid",borderColor:"divider",borderRadius:2,p:1.5},children:[h.jsx(ne,{variant:"caption",color:"text.secondary",children:e}),h.jsx(ne,{variant:"body1",sx:{mt:.5,fontFamily:"monospace"},children:typeof t=="number"?t.toLocaleString():t})]})}function iV({log:e,onClose:t}){const[r,n]=m.useState(!1),[i,o]=m.useState(!1),a=new Date(e.createdAt).toLocaleString(),s=new Date(e.updatedAt).toLocaleString();return h.jsxs(h.Fragment,{children:[h.jsx(sf,{open:!0,onClose:t,title:`Cache log: ${e.name} · ${e.operation.toUpperCase()} · ${a} `,children:h.jsxs(ue,{spacing:3,children:[h.jsx(Be,{children:h.jsx(zt,{variant:"outlined",size:"small",onClick:()=>n(!0),children:"View key history"})}),h.jsxs(ue,{spacing:1,children:[h.jsx(ne,{variant:"subtitle2",children:"Log details"}),h.jsxs(Be,{sx:{display:"grid",gridTemplateColumns:{xs:"repeat(1, minmax(0, 1fr))",sm:"repeat(2, minmax(0, 1fr))"},gap:2},children:[h.jsx(Zs,{label:"Key",children:h.jsx(ne,{component:"span",sx:{fontFamily:"monospace",fontSize:"0.9rem"},children:e.name})}),h.jsx(Zs,{label:"Operation",children:h.jsx(ne,{component:"span",sx:{textTransform:"uppercase"},children:e.operation})}),h.jsx(Zs,{label:"Size",children:h.jsx(ne,{component:"span",sx:{fontFamily:"monospace",fontSize:"0.9rem"},children:G_e(e.size)})}),h.jsx(Zs,{label:"Log ID",children:h.jsx(ne,{component:"span",sx:{fontFamily:"monospace",fontSize:"0.8rem"},children:e.id})}),h.jsx(Zs,{label:"Group ID",children:e.groupId?h.jsx(ne,{component:"span",sx:{fontFamily:"monospace",fontSize:"0.8rem"},children:e.groupId}):h.jsx(ZN,{children:"None"})}),h.jsx(Zs,{label:"Tags",children:e.tags&&e.tags.length>0?h.jsx(ue,{direction:"row",spacing:.5,flexWrap:"wrap",useFlexGap:!0,children:e.tags.map(u=>h.jsx(dr,{label:u,size:"small",variant:"outlined"},u))}):h.jsx(ZN,{children:"None"})}),h.jsx(Zs,{label:"Created at",children:h.jsx(ne,{component:"span",children:a})}),h.jsx(Zs,{label:"Updated at",children:h.jsx(ne,{component:"span",children:s})})]}),e.description?h.jsxs(Be,{sx:{mt:1},children:[h.jsx(ne,{variant:"caption",color:"text.secondary",children:"Description"}),h.jsx(ne,{variant:"body2",sx:{mt:.5},children:e.description})]}):null]}),h.jsx(zu,{}),h.jsxs(ue,{spacing:1,children:[h.jsx(ne,{variant:"subtitle2",children:"Cached value"}),h.jsxs(ne,{variant:"body2",color:"text.secondary",children:["This is the value associated with"," ",h.jsx(ne,{component:"span",sx:{fontFamily:"monospace",fontSize:"0.9rem"},children:e.name})," ","for this log entry."]}),h.jsx(ai,{value:e.value,title:"Value"})]}),h.jsx(zu,{}),h.jsxs(ec,{expanded:i,onChange:()=>o(u=>!u),disableGutters:!0,sx:{border:"1px solid",borderColor:i?"primary.main":"divider",borderRadius:2,bgcolor:"background.default","&::before":{display:"none"}},children:[h.jsx(rc,{expandIcon:h.jsx(ea,{}),children:h.jsx(ne,{variant:"subtitle2",children:"Raw log paylod"})}),h.jsx(tc,{children:i?h.jsx(ai,{value:e,collapsedLines:16}):null})]})]})}),r&&h.jsx(nV,{open:r,cacheKey:e.name,summary:void 0,baseQuery:{},onClose:()=>n(!1)})]})}function Zs({label:e,children:t}){return h.jsxs(Be,{children:[h.jsx(ne,{variant:"caption",color:"text.secondary",children:e}),h.jsx(Be,{sx:{mt:.25},children:t})]})}function ZN({children:e}){return h.jsx(ne,{variant:"body2",color:"text.disabled",component:"span",children:e})}function G_e(e){if(!e||!Number.isFinite(e))return"—";const t=["B","KB","MB","GB","TB"],r=Math.min(Math.floor(Math.log(e)/Math.log(1024)),t.length-1);return`${(e/1024**r).toFixed(r===0?0:2)} ${t[r]}`}const Z_e={info:"#42a5f5",warning:"#ffa726",error:"#ef5350",debug:"#ab47bc",trace:"#26a69a"};function Cm({level:e,state:t,selected:r,onClick:n}){const i=Kr(),o=Z_e[e],a=t??(r?"include":"display"),s=a==="exclude",u=a==="none",d=s?i.palette.error.main:o,f=s?Pi(d,.3):u?void 0:Pi(o,.2);return h.jsx(dr,{label:e.toUpperCase(),size:"small",variant:"outlined",clickable:!!n,onClick:n,sx:{borderColor:d,color:d,bgcolor:f,fontWeight:600,opacity:u?.7:1}})}const X_e=200;function oV({open:e,groupId:t,baseQuery:r,triggerLog:n,onClose:i,onPrev:o,onNext:a}){const[s,u]=m.useState(!1),[d,f]=m.useState(null);m.useEffect(()=>{e||(u(!1),f(null))},[e]),m.useEffect(()=>{u(!1)},[t]);const p=m.useMemo(()=>{if(t)return{...r,groupsInclude:[t],cursor:void 0,pageSize:X_e,orderBy:"timestamp",orderDirection:"asc"}},[r,t]),v=m.useMemo(()=>e&&!!t,[e,t]),y=rn("GET /__rrroutes/logs",{enabled:v,cursorParam:"cursor",getNextPageParam:()=>{}}),{data:b,isLoading:w,error:x,refetch:k}=y.useEndpoint(p?{query:p}:{query:r}),$=m.useMemo(()=>!v||!b?[]:b==null?void 0:b.pages.flatMap(O=>O.out),[b,v]),P=m.useMemo(()=>n!=null&&n.groupId?n.groupId:(XN(n==null?void 0:n.meta)||$.map(L=>XN(L.meta)).find(L=>!!L))??void 0,[$,n]),j=rn("GET /__rrroutes/requests",m.useMemo(()=>({enabled:e&&!!t&&!P,cursorParam:"cursor",getNextPageParam:()=>{}}),[e,t,P])),C=m.useMemo(()=>{if(!(!t||P))return J_e({...r,groups:[t],cursor:void 0,pageSize:1})},[r,t,P]),{data:I}=j.useEndpoint(C?{query:C}:{query:r}),A=m.useMemo(()=>{const O=eAe(I);return O.length?O[0].id:void 0},[I]),T=P??A;m.useEffect(()=>{if(!e)return;const O=(n==null?void 0:n.id)??null,L=!!O&&$.some(F=>F.id===O);if(!(d&&$.some(F=>F.id===d))){if(L&&O){f(O);return}if($.length){f($[0].id);return}f(null)}},[e,n==null?void 0:n.id,$,d]);const M=m.useMemo(()=>d?$.find(O=>O.id===d)||((n==null?void 0:n.id)===d?n:null):n??$[0]??null,[d,$,n]),R=t?h.jsxs(ue,{direction:"row",spacing:1,alignItems:"center",children:[h.jsx(ne,{variant:"subtitle2",color:"text.secondary",children:"Log group"}),T?h.jsx(zt,{size:"small",color:"primary",onClick:()=>u(!0),sx:{textTransform:"none",fontFamily:"monospace",px:1},children:t}):h.jsx(ne,{sx:{fontFamily:"monospace"},children:t})]}):"Log group details",D=()=>{const O=$.length>1;return h.jsxs(Be,{sx:{display:"flex",flexDirection:{xs:"column",md:"row"},gap:2,minHeight:360,maxHeight:{xs:"80vh",md:"70vh"},overflow:"hidden"},children:[O&&h.jsx(Be,{sx:{maxHeight:"100%"},children:h.jsx(Y_e,{logs:$,activeId:d,onSelect:f})}),h.jsx(Be,{sx:{flex:1,display:"flex",flexDirection:"column",minHeight:0,overflow:"hidden"},children:h.jsx(Be,{sx:{flex:1,overflowY:"auto",p:2,bgcolor:"background.paper",display:"flex",flexDirection:"column",gap:2},children:h.jsxs(h.Fragment,{children:[x&&h.jsx(ia,{onRetry:k}),M&&h.jsx(Q_e,{log:M})]})})})]})};return h.jsxs(h.Fragment,{children:[h.jsx(sf,{scroll:"none",open:e,onClose:i,onPrev:o,onNext:a,title:R,children:D()}),h.jsx(Em,{open:s&&!!T,request:null,requestId:T,onClose:()=>u(!1)})]})}function Y_e({logs:e,activeId:t,onSelect:r}){const n=m.useRef(null),i=m.useRef(!1);return m.useEffect(()=>{i.current=!1,n.current=null},[e]),m.useEffect(()=>{!t||i.current||!e.some(a=>a.id===t)||n.current&&(i.current=!0,n.current.scrollIntoView({block:"nearest",inline:"nearest",behavior:"smooth"}))},[t,e]),h.jsxs(ue,{spacing:1.5,sx:{width:{xs:"100%",md:280},flexShrink:0,border:"1px solid",borderColor:"divider",borderRadius:2,p:1.5,maxHeight:{xs:"100%"},overflowY:"auto",bgcolor:"background.default"},children:[h.jsxs(ue,{direction:"row",spacing:1,alignItems:"center",children:[h.jsx(ne,{variant:"subtitle2",children:"Related logs"}),h.jsx(dr,{size:"small",label:e.length})]}),h.jsx(ne,{variant:"caption",color:"text.secondary",children:"Ordered by timestamp"}),h.jsx(ue,{spacing:1,children:e.map(o=>{const a=o.id===t;return h.jsx(Mn,{ref:a?n:void 0,onClick:()=>r(o.id),sx:{width:"100%",textAlign:"left",borderRadius:2,border:"1px solid",borderColor:a?"primary.main":"divider",bgcolor:a?"action.selected":"background.paper",p:1.5,display:"block",alignSelf:"stretch"},children:h.jsxs(ue,{spacing:.5,children:[h.jsxs(ue,{direction:"row",spacing:1,alignItems:"center",children:[h.jsx(Cm,{level:o.level}),h.jsx(ne,{variant:"caption",color:"text.secondary",children:tAe(o.createdAt)})]}),h.jsx(ne,{variant:"body2",noWrap:!0,sx:{fontFamily:"monospace"},children:o.name||"Untitled log"}),h.jsx(ne,{variant:"caption",color:"text.secondary",noWrap:!0,children:sO(o)})]})},o.id)})})]})}function Q_e({log:e}){var i,o;const[t,r]=m.useState(!1),n=sO(e);return h.jsxs(ue,{spacing:2,children:[h.jsxs(ue,{spacing:1,children:[h.jsxs(ue,{direction:{xs:"column",sm:"row"},spacing:1,justifyContent:"space-between",alignItems:{xs:"flex-start",sm:"center"},children:[h.jsxs(ue,{direction:"row",spacing:1,alignItems:"center",children:[h.jsx(Cm,{level:e.level}),h.jsx(ne,{variant:"h6",sx:{fontFamily:"monospace"},children:e.name||"Untitled log"})]}),h.jsx(ne,{variant:"body2",color:"text.secondary",children:new Date(e.createdAt).toLocaleString()})]}),h.jsxs(Be,{sx:{borderRadius:2,border:"1px solid",borderColor:"divider",bgcolor:"background.paper",p:2},children:[h.jsx(ne,{variant:"caption",color:"text.secondary",children:"Message"}),h.jsx(ne,{variant:"body2",sx:{mt:.5,whiteSpace:"pre-wrap"},children:n})]})]}),(i=e.tags)!=null&&i.length?h.jsxs(ue,{spacing:.5,children:[h.jsx(ne,{variant:"caption",color:"text.secondary",children:"Tags"}),h.jsx(ue,{direction:"row",spacing:.5,flexWrap:"wrap",useFlexGap:!0,children:e.tags.map(a=>h.jsx(dr,{label:a,size:"small"},a))})]}):null,h.jsxs(Be,{sx:{display:"grid",gridTemplateColumns:{xs:"repeat(2, minmax(0, 1fr))",sm:"repeat(3, minmax(0, 1fr))"},gap:2},children:[h.jsx(qc,{label:"Log ID",value:e.id,monospace:!0}),h.jsx(qc,{label:"Level",value:e.level.toUpperCase()}),h.jsx(qc,{label:"Timestamp",value:new Date(e.createdAt).toLocaleString()}),h.jsx(qc,{label:"Group ID",value:e.groupId??"—",monospace:!0}),h.jsx(qc,{label:"Name",value:e.name??"—",monospace:!0}),h.jsx(qc,{label:"Tags count",value:(o=e.tags)!=null&&o.length?String(e.tags.length):"0"})]}),e.meta!==void 0?h.jsx(ai,{title:"Metadata",value:e.meta,collapsedLines:16}):null,h.jsxs(ec,{expanded:t,onChange:()=>r(a=>!a),disableGutters:!0,sx:{border:"1px solid",borderColor:t?"primary.main":"divider",borderRadius:2,bgcolor:"background.default","&::before":{display:"none"}},children:[h.jsx(rc,{expandIcon:h.jsx(ea,{}),children:h.jsx(ne,{variant:"subtitle2",children:"Raw log paylod"})}),h.jsx(tc,{children:t?h.jsx(ai,{value:e,collapsedLines:16}):null})]})]})}function qc({label:e,value:t,monospace:r}){return h.jsxs(ue,{spacing:.5,children:[h.jsx(ne,{variant:"caption",color:"text.secondary",children:e}),h.jsx(ne,{variant:"body2",sx:{fontFamily:r?"monospace":void 0},children:t??"—"})]})}function sO(e){if(e.description)return e.description;if(typeof e.meta=="string")return e.meta;if(e.meta&&typeof e.meta=="object"){const t=e.meta,{message:r}=t;if(typeof r=="string")return r;if(r)try{return JSON.stringify(r)}catch{return String(r)}}return"—"}function XN(e){if(!e||typeof e!="object")return;const t=e;if(typeof t.requestId=="string")return t.requestId;if(t.request&&typeof t.request=="object"&&t.request!==null&&typeof t.request.id=="string")return t.request.id}function J_e(e){const t={};return Object.entries(e).forEach(([r,n])=>{n!=null&&(t[r]=n)}),t}function eAe(e){return e?Array.isArray(e.pages)?e.pages.flatMap(t=>Array.isArray(t==null?void 0:t.out)?t.out:[]):Array.isArray(e.out)?e.out:[]:[]}function tAe(e){try{return new Date(e).toLocaleTimeString()}catch{return"—"}}function rAe(e){const t=Kr(),r=e.toLowerCase();return t.palette.http[r]||t.palette.text.primary}function bf({method:e,state:t,selected:r=!1,onClick:n}){const i=Kr(),o=rAe(e),a=t??(r?"include":"display"),s=a==="exclude",u=a==="none",d=s?i.palette.error.main:o,f=s?Pi(d,.3):u?Pi(o,.08):Pi(o,.35);return h.jsx(dr,{label:e.toUpperCase(),size:"small",variant:"outlined",clickable:!!n,onClick:n,sx:{borderColor:d,color:d,bgcolor:f,fontWeight:600,opacity:u?.7:1},"aria-pressed":a==="include"})}function nAe(e){const t=Kr();return e<0?t.palette.text.secondary:e>=500?t.palette.status.error:e>=400?t.palette.status.warning:e>=300?t.palette.text.secondary:e>=200?t.palette.status.success:t.palette.text.secondary}function jm({status:e,state:t="display",onClick:r}){const n=Kr(),i=nAe(e),o=t==="exclude",a=t==="none",s=o?n.palette.error.main:i;return h.jsx(dr,{label:e>0?e:"—",size:"small",variant:"outlined",onClick:r,sx:{borderColor:a?"divider":s,color:a?"text.secondary":s,bgcolor:t==="display"||t==="include"?Pi(i,.15):o?Pi(s,.25):"transparent",fontWeight:600,cursor:r?"pointer":"default",opacity:a?.75:1}})}const iAe={hit:"#66bb6a",miss:"#ffa726",set:"#42a5f5",delete:"#ef5350"};function lO({operation:e,state:t="display",onClick:r}){const n=Kr(),i=iAe[e],o=t==="exclude",a=t==="none",s=o?n.palette.error.main:i,u=o?Pi(s,.3):t==="display"||t==="include"?Pi(i,.2):"transparent";return h.jsx(dr,{label:e.toUpperCase(),size:"small",onClick:r,variant:"outlined",sx:{borderColor:a?"divider":s,color:a?"text.secondary":s,bgcolor:u,fontWeight:600,opacity:a?.75:1,cursor:r?"pointer":"default"}})}function oAe({events:e,onSelectCache:t,onSelectLog:r,onSelectSocket:n}){if(!e.length)return h.jsx(aAe,{text:"No cache, log, or socket events for this request."});const i=[];for(let u=1;u<e.length;u+=1){const d=e[u].createdAt-e[u-1].createdAt;d>0&&Number.isFinite(d)&&i.push(d)}let o=null,a=null;if(i.length){const u=[...i].sort((v,y)=>v-y),d=u.length-1,f=Math.floor(d/3),p=Math.floor(2*d/3);o=u[f],a=u[p]}const s=u=>!o||!a?null:u<=o?"small":u<=a?"medium":"large";return h.jsx(ue,{spacing:1,children:e.map((u,d)=>{const f=d>0?e[d-1]:void 0,p=f&&isFinite(f.createdAt)&&isFinite(u.createdAt)?u.createdAt-f.createdAt:null,v=p&&p>0?s(p):null;return h.jsx(Be,{sx:{display:"flex",alignItems:"flex-start"},children:h.jsx(Be,{sx:{flex:1,minWidth:0},children:h.jsx(sAe,{event:u,deltaMs:p,deltaSeverity:v,onSelectCache:t,onSelectLog:r,onSelectSocket:n})})},u.id)})})}function aAe({text:e}){return h.jsx(ne,{variant:"body2",color:"text.secondary",children:e})}function sAe({event:e,deltaMs:t,deltaSeverity:r,onSelectCache:n,onSelectLog:i,onSelectSocket:o}){const a=()=>{e.kind==="cache"&&n?n(e.cache):e.kind==="log"&&i?i(e.log):e.kind==="socket"&&o&&o(e.socket)};if(e.kind==="cache"){const{cache:f}=e;return h.jsxs(ue,{direction:"row",sx:{alignItems:"center"},children:[h.jsx(X1,{createdAt:e.createdAt}),h.jsx(Mn,{onClick:a,sx:{textAlign:"left",borderRadius:1.5,border:"1px solid",borderColor:"divider",bgcolor:"background.default",px:1,py:.75,width:"100%"},children:h.jsxs(ue,{spacing:.5,sx:{width:"100%"},children:[h.jsxs(ue,{direction:"row",spacing:.75,children:[h.jsx(lO,{operation:f.operation}),f.name&&h.jsx(ne,{variant:"body2",sx:{fontFamily:"monospace"},noWrap:!0,children:f.name})]}),typeof f.size=="number"&&h.jsxs(ne,{variant:"caption",color:"text.secondary",children:["Size: ",f.size," bytes"]})]})})]})}const s=lAe(t);if(e.kind==="log"){const{log:f}=e,p=uAe(f);return h.jsxs(ue,{direction:"row",sx:{alignItems:"center",gap:1},children:[h.jsx(X1,{createdAt:e.createdAt}),h.jsx(Mn,{onClick:a,sx:{textAlign:"left",borderRadius:1.5,border:"1px solid",borderColor:"divider",bgcolor:"background.default",px:1,py:.75,display:"flex",flex:1},children:h.jsxs(ue,{spacing:.25,sx:{width:"100%"},children:[h.jsxs(ue,{direction:"row",spacing:.75,children:[h.jsxs(ue,{direction:"row",spacing:.75,alignItems:"center",children:[h.jsx(Cm,{level:f.level}),f.name&&h.jsx(ne,{variant:"caption",sx:{fontFamily:"monospace"},noWrap:!0,children:f.name})]}),s&&h.jsx(Be,{component:"span",sx:{ml:.5,px:.75,py:.25,alignContent:"center",borderRadius:999,fontSize:"0.7rem",lineHeight:1.2,bgcolor:YN(r),color:r==="large"?"common.white":"text.primary"},children:s})]}),p&&h.jsx(ne,{variant:"caption",color:"text.secondary",noWrap:!0,sx:{mt:.25},children:p})]})})]})}const{socket:u}=e,d=cAe(u);return h.jsxs(ue,{direction:"row",sx:{alignItems:"center",gap:1},children:[h.jsx(X1,{createdAt:e.createdAt}),h.jsx(Mn,{onClick:a,sx:{textAlign:"left",borderRadius:1.5,border:"1px solid",borderColor:"divider",bgcolor:"background.default",px:1,py:.75,display:"flex",flex:1},children:h.jsxs(ue,{spacing:.25,sx:{width:"100%"},children:[h.jsxs(ue,{direction:"row",spacing:.75,alignItems:"center",children:[h.jsx(ne,{variant:"caption",color:"text.secondary",children:"SOCKET"}),h.jsx(ne,{variant:"caption",sx:{fontFamily:"monospace"},noWrap:!0,children:u.name}),s&&h.jsx(Be,{component:"span",sx:{ml:.5,px:.75,py:.25,alignContent:"center",borderRadius:999,fontSize:"0.7rem",lineHeight:1.2,bgcolor:YN(r),color:r==="large"?"common.white":"text.primary"},children:s})]}),d&&h.jsx(ne,{variant:"caption",color:"text.secondary",noWrap:!0,sx:{mt:.25},children:d})]})})]})}function X1({createdAt:e}){return h.jsx(ne,{variant:"caption",color:"text.secondary",children:new Date(e).toLocaleTimeString()})}function lAe(e){if(e==null||!isFinite(e)||e<=0)return null;if(e<1)return"+<1 ms";if(e<1e3)return`+${Math.round(e)} ms`;const t=e/1e3;if(t<60)return`+${t.toFixed(1)} s`;const r=Math.floor(t/60),n=t-r*60;if(r<60)return`+${r}m ${n.toFixed(1)}s`;const i=Math.floor(r/60),o=r-i*60;return`+${i}h ${o}m`}function YN(e){return e?e==="small"?"success.light":e==="medium"?"warning.light":"error.main":"action.hover"}function uAe(e){if(e.description)return e.description;if(typeof e.meta=="string")return e.meta;if(e.meta&&typeof e.meta=="object"){const r=e.meta.message;if(typeof r=="string")return r;if(r)try{return JSON.stringify(r)}catch{return String(r)}}if(e.meta==null)return"";try{return JSON.stringify(e.meta)}catch{return String(e.meta)}}function cAe(e){const t=e.toRoomId&&e.toRoomId.length?`rooms: ${e.toRoomId.join(", ")}`:"";let r="";if(e.message==null)r="";else if(typeof e.message=="string")r=e.message;else try{r=JSON.stringify(e.message)}catch{r=String(e.message)}const i=[t,r].filter(o=>o&&o.trim().length).join(" · ");return i.length<=140?i:`${i.slice(0,139)}…`}function dAe({request:e,caches:t=[],logs:r=[],sockets:n=[],onReplay:i}){const[o,a]=m.useState(null),[s,u]=m.useState(null),[d,f]=m.useState(null),p=m.useMemo(()=>{const v=(t??[]).map(w=>({kind:"cache",id:w.id,createdAt:new Date(w.createdAt).getTime(),cache:w})),y=(r??[]).map(w=>({kind:"log",id:w.id,createdAt:new Date(w.createdAt).getTime(),log:w})),b=(n??[]).map(w=>({kind:"socket",id:w.id,createdAt:new Date(w.createdAt).getTime(),socket:w}));return[...v,...y,...b].sort((w,x)=>w.createdAt-x.createdAt)},[t,r,n]);return h.jsxs(h.Fragment,{children:[h.jsxs(ue,{spacing:3,children:[h.jsxs(ue,{spacing:1,children:[h.jsxs(ue,{direction:"row",spacing:1,alignItems:"center",children:[h.jsx(bf,{method:e.method}),h.jsx(ne,{sx:{fontFamily:"monospace"},children:e.path})]}),h.jsxs(ue,{direction:{xs:"column",sm:"row"},spacing:1,children:[h.jsxs(ue,{direction:"row",spacing:1,alignItems:"center",children:[h.jsx(jm,{status:e.status}),h.jsxs(ne,{variant:"body2",color:"text.secondary",children:[e.durationMs," ms"]})]}),h.jsx(ne,{variant:"body2",color:"text.secondary",children:new Date(e.createdAt).toLocaleString()})]})]}),h.jsx(zu,{}),h.jsxs(_t,{title:"Request",children:[h.jsx(ai,{title:"Params",value:e.params}),h.jsx(ai,{title:"Query",value:e.query}),h.jsx(ai,{title:"Headers",value:e.headers}),h.jsx(ai,{title:"Body",value:e.body})]}),h.jsxs(_t,{title:"Response",children:[h.jsx(ai,{title:"Output",value:e.output}),e.error&&h.jsx(ai,{title:"Error",value:e.error})]}),h.jsx(_t,{title:"Execution timeline",children:h.jsx(oAe,{events:p,onSelectCache:a,onSelectLog:u,onSelectSocket:f})}),i&&h.jsx(_t,{title:"Actions",children:h.jsx(zt,{variant:"contained",startIcon:h.jsx(Tpe,{}),onClick:()=>i(e),children:"Replay in Playground"})})]}),o&&h.jsx(iV,{log:o,onClose:()=>a(null)}),s&&h.jsx(oV,{open:!0,groupId:s.groupId??void 0,baseQuery:{},triggerLog:s,onClose:()=>u(null)}),h.jsx(H3,{open:!!d,event:d,onClose:()=>f(null)})]})}function Em({open:e,request:t,requestId:r,onClose:n,onReplay:i,onPrev:o,onNext:a}){const s=(t==null?void 0:t.id)??r??"",u=m.useMemo(()=>({enabled:e&&!!s}),[e,s]),d=rn("GET /__rrroutes/requests/:requestId",u),{data:f,isLoading:p,error:v,refetch:y}=d.useEndpoint({params:{requestId:s}}),b=(f==null?void 0:f.out)??t??null,w=m.useMemo(()=>({enabled:e&&!!s,cursorParam:"cursor",getNextPageParam:()=>{}}),[e,s]),x=rn("GET /__rrroutes/sockets",w),{data:k}=x.useEndpoint(s?{query:{groupsInclude:[s],cursor:void 0,pageSize:200,orderBy:"timestamp",orderDirection:"asc"}}:{query:{}}),$=m.useMemo(()=>k?Array.isArray(k.pages)?k.pages.flatMap(P=>Array.isArray(P==null?void 0:P.out)?P.out:[]):[]:[],[k]);return h.jsx(sf,{open:e,onClose:n,title:b?`Request ${b.id}`:"Request details",onPrev:o,onNext:a,children:h.jsxs(ue,{spacing:2,children:[p&&h.jsx(Bb,{}),b?h.jsx(dAe,{request:b,caches:f==null?void 0:f.out.caches,logs:f==null?void 0:f.out.logs,sockets:$,onReplay:i}):h.jsx(ne,{color:"text.secondary",children:"Select a request to see details."}),v?h.jsx(xa,{severity:"error",action:h.jsx(zt,{color:"inherit",size:"small",onClick:()=>y(),children:"Retry"}),children:"Failed to load cache and log details."}):null]})})}const fAe=Et(h.jsx("path",{d:"m12 8-6 6 1.41 1.41L12 10.83l4.59 4.58L18 14z"}));function Bv({schema:e,title:t}){return e?h.jsxs(ue,{spacing:1,children:[t&&h.jsx(ne,{variant:"subtitle2",color:"text.primary",children:t}),h.jsx(pAe,{schema:e})]}):h.jsxs(ue,{spacing:.5,children:[t&&h.jsx(ne,{variant:"subtitle2",color:"text.primary",children:t}),h.jsx(ne,{variant:"body2",color:"text.secondary",children:"No schema provided."})]})}function pAe({schema:e}){const[t,r]=m.useReducer((i,o)=>{switch(o.type){case"toggle":return{...i,[o.path]:o.value!==void 0?o.value:!i[o.path]};case"setAll":{const a={},s=(u,d)=>{lV(u)&&(a[d]=o.value),sV(u,d).forEach(({schema:f,path:p})=>s(f,p))};return s(e,"root"),a}default:return i}},{}),n=(i,o)=>{r({type:"toggle",path:i,value:o})};return h.jsxs(ue,{spacing:1,children:[h.jsxs(uB,{size:"small",children:[h.jsx(zt,{onClick:()=>r({type:"setAll",value:!1}),children:"Expand all"}),h.jsx(zt,{onClick:()=>r({type:"setAll",value:!0}),children:"Collapse all"})]}),h.jsx(aV,{schema:e,path:"root",depth:0,collapsed:t,toggle:n})]})}function aV({schema:e,path:t,depth:r,collapsed:n,toggle:i,propertyName:o}){const a=uV(e),s=e.optional||e.nullable,u=m.useMemo(()=>sV(e,t),[e,t]),d=lV(e),f=n[t];return h.jsx(Be,{sx:{borderLeft:r?"1px solid":"none",borderColor:"rgba(255,255,255,0.08)",pl:r?2:0,ml:r?1:0,py:.75},children:h.jsxs(ue,{spacing:.25,children:[h.jsxs(ue,{direction:"row",spacing:1,alignItems:"center",flexWrap:"wrap",children:[d&&h.jsx(qn,{size:"small",onClick:()=>i(t),sx:{p:.25},children:f?h.jsx(ea,{fontSize:"small"}):h.jsx(fAe,{fontSize:"small"})}),o&&h.jsx(ne,{variant:"body2",sx:{fontFamily:"monospace",color:"text.primary"},children:o}),h.jsx(ne,{variant:"body2",color:"text.secondary",children:a}),s&&h.jsxs(ue,{direction:"row",spacing:.5,useFlexGap:!0,flexWrap:"wrap",children:[e.optional&&h.jsx(QN,{label:"optional"}),e.nullable&&h.jsx(QN,{label:"nullable"})]})]}),e.description&&h.jsx(ne,{variant:"caption",color:"text.secondary",children:e.description}),!f&&u.map(({schema:p,propertyName:v,path:y})=>h.jsx(aV,{schema:p,propertyName:v,path:y,depth:r+1,collapsed:n,toggle:i},y))]})})}function sV(e,t){var r;switch(e.kind){case"object":return e.properties?Object.entries(e.properties).map(([n,i])=>({schema:i,propertyName:n,path:`${t}.${n}`})):[];case"array":return e.element?[{schema:e.element,propertyName:"items",path:`${t}.items`}]:[];case"union":return((r=e.union)==null?void 0:r.map((n,i)=>({schema:n,propertyName:`option ${i+1}`,path:`${t}.option${i+1}`})))??[];default:return[]}}function lV(e){return["object","array","union"].includes(e.kind)}function uV(e){switch(e.kind){case"object":return"object";case"array":return`array<${e.element?uV(e.element):"unknown"}>`;case"enum":return"enum";case"union":return"union";case"literal":return"literal";default:return e.kind}}function QN({label:e}){return h.jsx(Be,{component:"span",sx:{border:"1px solid",borderColor:"divider",borderRadius:1,px:.75,py:.25,fontSize:"0.7rem",textTransform:"uppercase",letterSpacing:.5,color:"text.secondary"},children:e})}const cV=Et(h.jsx("path",{d:"M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6z"})),cb=Et(h.jsx("path",{d:"M8 5v14l11-7z"})),dV=Et(h.jsx("path",{d:"M6 19c0 1.1.9 2 2 2h8c1.1 0 2-.9 2-2V7H6zM8 9h8v10H8zm7.5-5-1-1h-5l-1 1H5v2h14V4z"}));function fV({method:e,path:t,contract:r,summary:n,onOpenStandalone:i}){const{fetch:o}=rf(),{addRun:a,getLastRun:s,consumePrefill:u}=sx(),[d,f]=m.useState(null),[p,v]=m.useState(!1),[y,b]=m.useState(null),w=()=>({params:yv(r==null?void 0:r.params),query:yv(r==null?void 0:r.query),body:r!=null&&r.body?JSON.stringify({},null,2):""}),[x,k]=m.useState(w);m.useEffect(()=>{const C=u({method:e,path:t});k(C?{params:eL(yv(r==null?void 0:r.params),C.params),query:eL(yv(r==null?void 0:r.query),C.query),body:hAe(C.body,!!(r!=null&&r.body))}:w()),f(null),b(null)},[u,e,t]);const $=m.useMemo(()=>s({method:e,path:t,id:d}),[d,e,t,s]),P=async()=>{var A;let C;if(x.body)try{C=JSON.parse(x.body),b(null)}catch{b("Invalid JSON body");return}const I=`run-${Date.now()}`;f(I),v(!0);try{const T=await o(e,t,x,I),M=tL(x.params),R=tL(x.query);a({id:T.id,method:T.log.method,path:T.log.path,createdAt:T.log.createdAt,durationMs:T.log.durationMs,status:T.log.status,response:T.log.output,errorMessage:(A=T.error)==null?void 0:A.message,headers:T.log.headers,request:{params:M,query:R,body:C,headers:{}}})}catch(T){console.error("Playground run failed",T)}finally{v(!1)}},j=()=>{i==null||i(x)};return h.jsxs(ue,{spacing:3,children:[h.jsxs(ue,{spacing:.5,children:[h.jsxs(ne,{variant:"h6",children:[e.toUpperCase()," ",t]}),n?h.jsx(ne,{variant:"body2",color:"text.secondary",children:n}):null]}),h.jsx(ne,{variant:"body1",color:"text.secondary",children:"Execute this endpoint directly and inspect the response. Use the contract as a guide when filling params, query, and body."}),h.jsxs(ue,{spacing:2,children:[h.jsx(JN,{title:"Path parameters",rows:x.params,onChange:C=>k(I=>({...I,params:C}))}),h.jsx(JN,{title:"Query parameters",rows:x.query,onChange:C=>k(I=>({...I,query:C}))}),h.jsxs(ec,{defaultExpanded:!0,children:[h.jsx(rc,{expandIcon:h.jsx(ea,{}),children:h.jsx(ne,{variant:"subtitle1",children:"Body"})}),h.jsx(tc,{children:h.jsx(Vt,{placeholder:"JSON body",multiline:!0,minRows:8,fullWidth:!0,value:x.body,onChange:C=>k(I=>({...I,body:C.target.value})),error:!!y,helperText:y||"Leave empty for no body"})})]})]}),h.jsxs(ue,{direction:"row",spacing:1,justifyContent:"flex-end",children:[i?h.jsx(zt,{variant:"outlined",onClick:j,children:"Open playground screen"}):null,h.jsx(zt,{variant:"contained",onClick:P,disabled:p,startIcon:h.jsx(cb,{}),children:p?"Running...":"Run"})]}),h.jsx(zu,{}),h.jsxs(ue,{spacing:2,children:[h.jsx(ne,{variant:"h6",children:"Last run"}),$?h.jsxs(ue,{spacing:2,children:[h.jsxs(ue,{direction:"row",spacing:2,alignItems:"center",children:[h.jsx(jm,{status:$.status}),h.jsxs(ne,{variant:"body2",color:"text.secondary",children:["Duration: ",$.durationMs," ms"]}),h.jsxs(ne,{variant:"body2",color:"text.secondary",children:["Ran at ",new Date($.createdAt).toLocaleTimeString()]})]}),$.errorMessage&&h.jsxs(ne,{color:"error",children:["Error: ",$.errorMessage]}),h.jsx(ai,{value:$.response,title:"Response body"})]}):h.jsx(ne,{color:"text.secondary",children:"Run the endpoint to see output."})]})]})}function JN({title:e,rows:t,onChange:r}){const n=(a,s)=>{const u=t.map((d,f)=>f===a?{...d,...s}:d);r(u)},i=a=>{const s=t.filter((u,d)=>d!==a);r(s)},o=()=>{r([...t,{key:"",value:"",enabled:!0}])};return h.jsxs(ec,{defaultExpanded:!0,children:[h.jsx(rc,{expandIcon:h.jsx(ea,{}),children:h.jsx(ne,{variant:"subtitle1",children:e})}),h.jsx(tc,{children:h.jsxs(ue,{spacing:1.5,children:[t.length===0&&h.jsx(ne,{variant:"body2",color:"text.secondary",children:'No fields defined. Use "Add" to create one.'}),t.map((a,s)=>h.jsxs(ue,{direction:{xs:"column",sm:"row"},spacing:1,alignItems:"center",children:[h.jsx(Zc,{checked:a.enabled,onChange:u=>n(s,{enabled:u.target.checked})}),h.jsx(Vt,{label:"Key",value:a.key,onChange:u=>n(s,{key:u.target.value}),sx:{flexGrow:1}}),h.jsx(Vt,{label:"Value",value:a.value,onChange:u=>n(s,{value:u.target.value}),sx:{flexGrow:2}}),h.jsx(qn,{onClick:()=>i(s),children:h.jsx(dV,{})})]},`${a.key}-${s}`)),h.jsx(zt,{size:"small",variant:"outlined",startIcon:h.jsx(cV,{}),onClick:o,sx:{alignSelf:"flex-start"},children:"Add field"})]})})]})}function eL(e,t){if(!t)return e;const r=e.map(o=>{const a=t[o.key];return a==null?o:{...o,value:String(a),enabled:!0}}),n=new Set(e.map(o=>o.key)),i=Object.entries(t).filter(([o])=>!n.has(o)).map(([o,a])=>({key:o,value:a==null?"":String(a),enabled:!0}));return[...r,...i]}function yv(e){return e?e.kind==="object"&&e.properties?Object.keys(e.properties).map(t=>({key:t,value:"",enabled:!0})):[]:[]}function tL(e){return e.reduce((t,r)=>(r.enabled&&r.key.trim()&&(t[r.key.trim()]=r.value),t),{})}function hAe(e,t){if(e==null)return t?JSON.stringify({},null,2):"";if(typeof e=="string")return e;try{return JSON.stringify(e,null,2)}catch{return t?JSON.stringify({},null,2):""}}function pV({requests:e,onSelect:t}){return h.jsx(oc,{component:Yn,variant:"outlined",children:h.jsxs(nc,{size:"small",children:[h.jsx(ac,{children:h.jsxs(Ii,{children:[h.jsx(Oe,{children:"Timestamp"}),h.jsx(Oe,{children:"Method"}),h.jsx(Oe,{children:"Path"}),h.jsx(Oe,{children:"Status"}),h.jsx(Oe,{align:"right",children:"Duration"})]})}),h.jsx(ic,{children:e.map((r,n)=>h.jsxs(Ii,{hover:!0,sx:{cursor:"pointer"},onClick:()=>t(r,n),children:[h.jsx(Oe,{children:new Date(r.createdAt).toLocaleString()}),h.jsx(Oe,{children:h.jsx(bf,{method:r.method})}),h.jsx(Oe,{sx:{fontFamily:"monospace"},children:r.path}),h.jsx(Oe,{children:h.jsx(jm,{status:r.status})}),h.jsxs(Oe,{align:"right",children:[r.durationMs," ms"]})]},r.id))})]})})}const mAe=30,rL=10;function gAe({method:e,path:t,onSelectRequest:r,onRequestsChange:n}){const[i,o]=m.useState(!1),a=rn("GET /__rrroutes/requests",{cursorParam:"cursor",getNextPageParam(k){var $;return($=k.meta)==null?void 0:$.nextCursor},enabled:!!(e&&t)}),{data:s,isLoading:u,error:d,refetch:f,fetchNextPage:p,hasNextPage:v,isFetchingNextPage:y}=a.useEndpoint({query:{endpointKeysInclude:t&&e?[`${e} ${t}`]:[],pageSize:mAe}});m.useEffect(()=>{o(!1)},[e]);const b=m.useMemo(()=>s?(Array.isArray(s.pages)?s.pages:[]).flatMap($=>Array.isArray($==null?void 0:$.out)?$.out:[]).sort(($,P)=>P.createdAt-$.createdAt):[],[s]);m.useEffect(()=>{n==null||n(b)},[b,n]);const w=i?b:b.slice(0,rL),x=(k,$)=>{const P=i?$:b.findIndex(j=>j.id===k.id);r(k,P>=0?P:$)};return h.jsx(_t,{title:"Requests feed",actions:b.length>rL?h.jsx(zt,{size:"small",onClick:()=>o(k=>!k),startIcon:h.jsx(ea,{}),children:i?"Collapse":"Show more"}):null,children:h.jsxs(ue,{spacing:2,children:[(u||y)&&h.jsx(Bb,{}),d?h.jsxs(ec,{defaultExpanded:!0,children:[h.jsx(rc,{expandIcon:h.jsx(ea,{}),children:h.jsx(ne,{color:"error",children:"Failed to load requests"})}),h.jsx(tc,{children:h.jsxs(ue,{spacing:1,children:[h.jsx(ne,{variant:"body2",color:"text.secondary",children:d instanceof Error?d.message:"Unable to fetch request feed."}),h.jsx(zt,{size:"small",onClick:()=>f(),children:"Retry"})]})})]}):null,t&&e?b.length===0&&!u?h.jsx(Be,{sx:{py:3},children:h.jsx(ne,{variant:"body2",color:"text.secondary",align:"center",children:"No recent requests for this endpoint."})}):h.jsx(pV,{requests:w,onSelect:x}):h.jsx(ne,{variant:"body2",color:"text.secondary",children:"Endpoint identifier missing."}),i&&v?h.jsx(zt,{size:"small",onClick:()=>p(),disabled:y,children:y?"Loading…":"Load more"}):null]})})}function vAe({endpoint:e}){return h.jsxs(ue,{spacing:1,children:[h.jsxs(ue,{direction:"row",spacing:1.5,alignItems:"center",flexWrap:"wrap",useFlexGap:!0,children:[h.jsx(bf,{method:e.method}),h.jsx(ne,{variant:"h6",sx:{fontFamily:"monospace",color:"text.primary"},children:e.path}),h.jsx(dr,{label:e.stability,size:"small",color:"secondary",sx:{textTransform:"capitalize"}})]}),e.summary&&h.jsx(ne,{variant:"body2",color:"text.secondary",children:e.summary})]})}function yAe({data:e}){const t=Kr(),r=e.map(n=>({...n,date:new Date(n.timestamp)}));return r.length?h.jsx(Be,{sx:{height:260},children:h.jsx(vl,{width:"100%",height:"100%",children:h.jsxs(aO,{data:r,children:[h.jsx(Il,{stroke:"rgba(255,255,255,0.1)",strokeDasharray:"3 3"}),h.jsx(Ol,{dataKey:"date",tickFormatter:n=>new Date(n).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"}),tick:{fill:t.palette.text.secondary,fontSize:12},axisLine:!1,tickLine:!1}),h.jsx(ls,{tick:{fill:t.palette.text.secondary,fontSize:12},axisLine:!1,tickLine:!1,allowDecimals:!1}),h.jsx(bl,{labelFormatter:n=>new Date(n).toLocaleString(),formatter:n=>[`${n} requests`,"Volume"],contentStyle:{backgroundColor:t.palette.background.paper,borderColor:t.palette.divider}}),h.jsx(cd,{type:"monotone",dataKey:"count",stroke:t.palette.primary.main,fill:t.palette.primary.main,fillOpacity:.22,strokeWidth:2})]})})}):h.jsx(Be,{sx:{py:4,textAlign:"center",color:"text.secondary"},children:"No volume data available."})}const nL=[{key:"request",label:"Request"},{key:"response",label:"Response"},{key:"meta",label:"Meta"},{key:"metrics",label:"Metrics"},{key:"playground",label:"Details & Playground"}];function hV({endpointId:e,onOpenStandalone:t,hidePlaygroundTab:r=!1,activeTab:n,onTabChange:i}){const o=na(),{queuePrefill:a}=sx(),[s,u]=m.useState("request"),[d,f]=m.useState([]),[p,v]=m.useState(null),y=n??s,b=m.useMemo(()=>({enabled:!!e}),[e]),w=rn("GET /__rrroutes/endpoints/:endpointId",b),x=r?nL.filter(z=>z.key!=="playground"):nL;m.useEffect(()=>{r&&y==="playground"&&(i==null||i("request"),n===void 0&&u("request"))},[r,y,i,n]);const k=m.useMemo(()=>{if(e==null)return"";const[z,F]=e.split(" ");return Rd(z,F,!0)},[e]),{data:$,isLoading:P,error:j,refetch:C}=w.useEndpoint({params:{endpointId:k}});m.useEffect(()=>{p&&!d.some(z=>z.id===p)&&v(null)},[d,p]);const I=p?d.findIndex(z=>z.id===p):-1,A=I>=0?d[I]:null,T=I>0,M=I>=0&&I<d.length-1,R=()=>{T&&v(d[I-1].id)},D=()=>{M&&v(d[I+1].id)},O=z=>{a({method:z.method,path:z.path,params:z.params||{},query:z.query||{},body:z.body});const{displayId:F}=ad(z.method,z.path);if(!F)return;const B=oh(F,{tab:"playground",layout:"playground"});o(B)};if(!e)return h.jsx(_t,{title:"Endpoint details",children:h.jsx(ji,{title:"Select an endpoint",description:"Choose an endpoint from the list to inspect its contract and metrics."})});if(P)return h.jsx(_t,{title:"Endpoint details",children:h.jsx(Ma,{variant:"full"})});if(j){const z=j instanceof Error?j.message:"Unable to load endpoint.",F=j instanceof Error?j.stack:j?String(j):void 0;return h.jsx(_t,{title:"Endpoint details",children:h.jsx(ia,{message:z,details:F,onRetry:()=>C()})})}if(!$)return h.jsx(_t,{title:"Endpoint details",children:h.jsx(ji,{title:"Endpoint not found",description:"This endpoint may have been removed."})});const L=$.out;return h.jsxs(_t,{title:"Endpoint details",children:[h.jsxs(ue,{spacing:3,children:[h.jsxs(Be,{sx:{position:"sticky",top:0,zIndex:1,bgcolor:"background.paper",pb:1},children:[h.jsx(vAe,{endpoint:L}),h.jsx(Ub,{value:y,onChange:(z,F)=>{const B=F;if(B==="playground"){o(oh(e,{tab:"metrics",layout:"details"}));return}i==null||i(B),n===void 0&&u(B)},variant:"scrollable",allowScrollButtonsMobile:!0,sx:{borderBottom:"1px solid",borderColor:"divider"},children:x.map(z=>h.jsx(ml,{label:z.label,value:z.key},z.key))})]}),y==="request"&&h.jsx(bAe,{endpoint:L}),y==="response"&&h.jsx(xAe,{endpoint:L}),y==="meta"&&h.jsx(wAe,{endpoint:L}),y==="metrics"&&h.jsx(SAe,{endpoint:L,onSelectRequest:z=>v(z.id),onRequestsChange:f}),!r&&y==="playground"&&h.jsx(fV,{method:L.method,path:L.path,contract:L.contract,summary:L.summary,onOpenStandalone:t?z=>t(L,z):void 0})]}),h.jsx(Em,{open:!!A,request:A,onClose:()=>v(null),onPrev:T?R:void 0,onNext:M?D:void 0,onReplay:A?O:void 0})]})}function bAe({endpoint:e}){return h.jsxs(ue,{spacing:2.5,children:[h.jsx(Bv,{title:"Body",schema:e.contract.body}),h.jsx(Bv,{title:"Params",schema:e.contract.params}),h.jsx(Bv,{title:"Query",schema:e.contract.query})]})}function xAe({endpoint:e}){return h.jsx(Bv,{title:"Response",schema:e.contract.output})}function wAe({endpoint:e}){const t=Object.entries(e.meta||{});return h.jsxs(ue,{spacing:2,children:[h.jsx(bv,{label:"Feed",value:e.feed?"Yes":"No"}),h.jsx(bv,{label:"Implemented",value:e.implemented?"Yes":"No"}),h.jsx(bv,{label:"Hidden",value:e.hidden?"Yes":"No"}),t.length>0&&h.jsxs(Be,{children:[h.jsx(ne,{variant:"subtitle2",gutterBottom:!0,children:"Metadata"}),h.jsx(ue,{spacing:1,children:t.map(([r,n])=>h.jsx(bv,{label:r,value:n},r))})]})]})}function SAe({endpoint:e,onSelectRequest:t,onRequestsChange:r}){var o;const n=typeof e.successRate=="number"?`${Math.round(e.successRate*100)}%`:"—",i=e.averageDurationMs?`${Math.round(e.averageDurationMs)} ms`:"—";return h.jsxs(ue,{spacing:3,children:[h.jsxs(Be,{sx:{display:"grid",gridTemplateColumns:{xs:"1fr",sm:"repeat(2, minmax(0, 1fr))"},gap:2},children:[h.jsx(iL,{label:"Avg duration",value:i}),h.jsx(iL,{label:"Success rate",value:n})]}),h.jsx(_t,{title:"Request volume",children:h.jsx(yAe,{data:e.volumeTS})}),(o=e.latestErrors)!=null&&o.length?h.jsx(_t,{title:"Latest error request IDs",children:h.jsx(ue,{spacing:.5,children:e.latestErrors.map(a=>h.jsx(ne,{variant:"body2",sx:{fontFamily:"monospace"},children:a.id},a.id))})}):null,h.jsx(gAe,{method:e.method,path:e.path,onSelectRequest:t,onRequestsChange:r})]})}function bv({label:e,value:t}){return h.jsxs(ue,{direction:"row",spacing:1,justifyContent:"space-between",children:[h.jsx(ne,{variant:"body2",color:"text.secondary",children:e}),h.jsx(ne,{variant:"body2",sx:{fontFamily:"monospace",color:"text.primary"},children:t})]})}function iL({label:e,value:t}){return h.jsxs(Be,{sx:{borderRadius:2,border:"1px solid",borderColor:"divider",p:2,bgcolor:"background.default"},children:[h.jsx(ne,{variant:"body2",color:"text.secondary",children:e}),h.jsx(ne,{variant:"h5",sx:{mt:.5},children:t})]})}function Go({title:e,subtitle:t,actions:r,children:n}){const i=!!(e||t||r);return h.jsx(Be,{sx:{width:"100%",mx:"auto"},children:h.jsxs(ue,{spacing:4,children:[i&&h.jsxs(ue,{direction:{xs:"column",sm:"row"},alignItems:{xs:"flex-start",sm:"center"},justifyContent:"space-between",spacing:2,children:[h.jsxs(Be,{children:[e&&h.jsx(ne,{variant:"h4",component:"h1",gutterBottom:!0,children:e}),t&&h.jsx(ne,{variant:"body1",color:"text.secondary",children:t})]}),r&&h.jsx(Be,{sx:{alignSelf:{xs:"stretch",sm:"center"}},children:r})]}),h.jsx(Be,{children:n})]})})}function kAe(e){const{client:t}=rf(),[r,n]=m.useState({isLoading:!1}),i=m.useMemo(()=>Epe(e),[e]);return m.useEffect(()=>{let o=!1;if(!e||!i){n({data:void 0,isLoading:!1,error:void 0});return}return n(a=>({...a,isLoading:!0,error:void 0})),t.fetch({method:"GET",path:"/__rrroutes/endpoints/:endpointId",params:{endpointId:i}}).then(a=>{var s;o||n({isLoading:!1,data:(s=a.data)==null?void 0:s.out,error:void 0})}).catch(a=>{o||n({isLoading:!1,data:void 0,error:a instanceof Error?a:new Error(String(a))})}),()=>{o=!0}},[t,e,i]),r}function PAe(e){const{client:t}=rf(),[r,n]=m.useState([]),[i,o]=m.useState(!1);return m.useEffect(()=>{let a=!1;return o(!0),n([]),t.fetch({method:"GET",path:"/__rrroutes/endpoints",query:{...e?{searchQuery:e}:{},pageSize:"50"}}).then(s=>{if(a)return;const u=s.data,d=Array.isArray(u==null?void 0:u.out)?u.out:Array.isArray(u)?u:[];n(d.map(f=>W3(f)))}).catch(s=>{a||(console.error("Failed to load endpoints",s),n([]))}).finally(()=>{a||o(!1)}),()=>{a=!0}},[t,e]),{options:r,isLoading:i}}function $Ae(){const e=na(),{endpointId:t}=QL(),r=t?decodeURIComponent(t):"",[n,i]=_$(),o=n.get(cP),a=n.get(uP),[s,u]=m.useState(()=>pM(o)),[d,f]=m.useState(()=>fM(a));m.useEffect(()=>{const B=pM(o);u(U=>U===B?U:B)},[o]),m.useEffect(()=>{const B=fM(a);f(U=>U===B?U:B)},[a]);const[p,v]=m.useState(r);m.useEffect(()=>{v(r)},[r]);const[y,b]=m.useState(""),{options:w,isLoading:x}=PAe(y),k=m.useMemo(()=>K3(r),[r]),$=(k==null?void 0:k.display)??r??"",{data:P,isLoading:j,error:C}=kAe($),I=m.useMemo(()=>{const B=[...w],U=V=>{V&&(B.some(K=>K.value===V.value)||B.push(V))};return U(k),U(P?W3(P):void 0),B},[w,k,P]),A=(k==null?void 0:k.method)??(P==null?void 0:P.method),T=(k==null?void 0:k.path)??(P==null?void 0:P.path),M=s!=="playground",R=s!=="details",D=(()=>{if(!A||!T)return h.jsx(ji,{title:"Select an endpoint",description:"Choose an endpoint above to start using the playground."});if($&&j)return h.jsx(Ma,{variant:"full"});if(C){const B=C instanceof Error?C.message:"Failed to load endpoint.",U=C instanceof Error?C.stack:C?String(C):void 0;return h.jsx(ia,{message:B,details:U})}return h.jsx(fV,{method:A,path:T,contract:P==null?void 0:P.contract,summary:P==null?void 0:P.summary})})(),O=(B,U)=>{if(!U)return;const V=I.find(W=>W.value===U);if(!V)return;const K=n.toString(),Z=`/routes/${encodeURIComponent(V.value)}`;e(K?`${Z}?${K}`:Z)},L=B=>{i(U=>{const V=new URLSearchParams(U);return Object.entries(B).forEach(([K,Z])=>{Z==null?V.delete(K):V.set(K,Z)}),V})},z=B=>{u(B),L({[cP]:U3(B)})},F=B=>{f(B),L({[uP]:F3(B)})};return h.jsx(Go,{title:"Endpoint playground",subtitle:"Experiment with any endpoint and inspect its request/response details side-by-side.",children:h.jsxs(ue,{spacing:3,children:[h.jsx(_t,{title:"Endpoint",actions:h.jsx(CAe,{value:s,onChange:z}),children:h.jsx(ue,{spacing:2,children:h.jsx(hl,{freeSolo:!0,options:I.map(B=>B.value),value:$,inputValue:p,loading:x,onChange:O,onInputChange:(B,U,V)=>{v(U),V==="input"&&b(U),(V==="clear"||V==="reset"&&U==="")&&b("")},getOptionLabel:B=>{const U=I.find(V=>V.value===B);return U?U.display:B},renderInput:B=>h.jsx(Vt,{...B,label:"Switch endpoint",placeholder:"GET /v1/example",helperText:"Search by method and path"})})})}),h.jsxs(Be,{sx:{display:"flex",flexDirection:{xs:"column",lg:"row"},gap:3},children:[M&&h.jsx(Be,{sx:{flex:R?"1 1 50%":"1 1 100%"},children:h.jsx(hV,{endpointId:r||null,hidePlaygroundTab:!0,activeTab:d,onTabChange:F})}),R&&h.jsx(Be,{sx:{flex:M?"1 1 50%":"1 1 100%"},children:h.jsx(_t,{title:"Playground",children:D})})]})]})})}function CAe({value:e,onChange:t}){return h.jsxs(uB,{size:"small",children:[h.jsx(zt,{variant:e==="split"?"contained":"outlined",onClick:()=>t("split"),children:"Split"}),h.jsx(zt,{variant:e==="details"?"contained":"outlined",onClick:()=>t("details"),children:"Details only"}),h.jsx(zt,{variant:e==="playground"?"contained":"outlined",onClick:()=>t("playground"),children:"Playground only"})]})}function xf({data:e,items:t,fetchNextPage:r,hasNextPage:n,isFetchingNextPage:i,pageSize:o,isLoading:a,extractItems:s=jAe,children:u}){const d=m.useMemo(()=>{var v;return t||(!e||!((v=e.pages)!=null&&v.length)?[]:e.pages.slice().reverse().flatMap(y=>s(y)))},[e,s,t]),f=m.useCallback(()=>{!n||i||r()},[r,n,i]),p=v=>n===void 0?null:n?h.jsx(zt,{size:"small",onClick:f,disabled:i,sx:{mt:1.5},children:a?"Loading...":`Load more${o?` (${o})`:""}`}):v==="top"?null:h.jsx(ne,{variant:"caption",color:"text.secondary",sx:{mt:1.5},children:"End of results"});return h.jsxs(Be,{children:[h.jsxs(ue,{sx:{alignItems:"flex-start"},children:[h.jsx(ne,{variant:"body1",color:"text.secondary",sx:{mt:1.5},children:`${d.length} items loaded`}),p("top")]}),u(d),i&&h.jsx(Bb,{sx:{mt:1.5}}),p("bottom")]})}function jAe(e){const t=e==null?void 0:e.out;return Array.isArray(t)?t:t?[t]:[]}const EAe=Et(h.jsx("path",{d:"M4.25 5.61C6.27 8.2 10 13 10 13v6c0 .55.45 1 1 1h2c.55 0 1-.45 1-1v-6s3.72-4.8 5.74-7.39c.51-.66.04-1.61-.79-1.61H5.04c-.83 0-1.3.95-.79 1.61"})),IAe=Et(h.jsx("path",{d:"M19.79 5.61C20.3 4.95 19.83 4 19 4H6.83l7.97 7.97zM2.81 2.81 1.39 4.22 10 13v6c0 .55.45 1 1 1h2c.55 0 1-.45 1-1v-2.17l5.78 5.78 1.41-1.41z"})),OAe=Et(h.jsx("path",{d:"M17.65 6.35C16.2 4.9 14.21 4 12 4c-4.42 0-7.99 3.58-7.99 8s3.57 8 7.99 8c3.73 0 6.84-2.55 7.73-6h-2.08c-.82 2.33-3.04 4-5.65 4-3.31 0-6-2.69-6-6s2.69-6 6-6c1.66 0 3.14.69 4.22 1.78L13 11h7V4z"})),_Ae=Et(h.jsx("path",{d:"M19 6.41 17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"})),AAe=Et(h.jsx("path",{d:"M15.5 14h-.79l-.28-.27C15.41 12.59 16 11.11 16 9.5 16 5.91 13.09 3 9.5 3S3 5.91 3 9.5 5.91 16 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14"}));function TAe({value:e,onChange:t,placeholder:r="Search...",onSubmit:n,textFieldProps:i,inputRef:o}){const a=u=>{t(u.target.value)},s=u=>{u.key==="Enter"&&(n==null||n())};return h.jsx(Vt,{value:e,onChange:a,placeholder:r,onKeyDown:s,fullWidth:!0,inputRef:o,InputProps:{startAdornment:h.jsx(y2,{position:"start",children:h.jsx(AAe,{fontSize:"small"})}),endAdornment:e?h.jsx(y2,{position:"end",children:h.jsx(qn,{size:"small",onClick:()=>t(""),"aria-label":"Clear search input",children:h.jsx(_Ae,{fontSize:"small"})})}):void 0},...i})}const MAe=[{value:"timestamp",label:"Timestamp"},{value:"duration",label:"Duration"},{value:"level",label:"Level"},{value:"path",label:"Path"}],RAe=[{value:"desc",label:"Desc"},{value:"asc",label:"Asc"}];function wf({value:e,onChange:t,children:r,searchInputRef:n,tagOptions:i,groupOptions:o,onRefresh:a,refreshing:s=!1,searchOnly:u=!1}){const[d,f]=m.useState(!1),[p,v]=m.useState("include"),y=Kr(),b=e.orderBy??"timestamp",w=e.orderDirection??"desc",x=e.tagsInclude??[],k=e.tagsExclude??[],$=e.groupsInclude??[],P=e.groupsExclude??[],j=U=>{t({...e,pageSize:U})},C=m.useMemo(()=>Array.from(new Set(i??[])).sort(),[i]),I=m.useMemo(()=>Array.from(new Set(o??[])).sort(),[o]),A=(U,V)=>{t({...e,[U]:DAe(V)})},T=e.searchQuery??"",M=p==="exclude",R=p==="include"?x:k,D=p==="include"?$:P,O=U=>{t({...e,tagsInclude:p==="include"?U:x,tagsExclude:p==="exclude"?U:k})},L=U=>{t({...e,groupsInclude:p==="include"?U:$,groupsExclude:p==="exclude"?U:P})},z=()=>v(U=>U==="include"?"exclude":"include"),F=M?{pointerEvents:"none"}:void 0,B=M?{opacity:.5}:void 0;return h.jsxs(ue,{spacing:2,sx:{border:"1px solid",borderColor:M?"error.main":"divider",borderRadius:2,p:2,bgcolor:M?Pi(y.palette.error.main,.08):"transparent",transition:"background-color 150ms ease, border-color 150ms ease"},children:[h.jsxs(ue,{direction:{xs:"column",md:"row"},spacing:2,alignItems:{xs:"stretch",md:"center"},children:[h.jsx(Be,{sx:{flex:1,minWidth:0,...B,...F},children:h.jsx(TAe,{value:T,onChange:U=>A("searchQuery",U),placeholder:"Search",inputRef:n,textFieldProps:{disabled:M}})}),!u&&h.jsxs(h.Fragment,{children:[h.jsx(Vt,{select:!0,label:"Order by",value:b,onChange:U=>A("orderBy",U.target.value),size:"small",disabled:M,sx:B,children:MAe.map(U=>h.jsx(el,{value:U.value,children:U.label},U.value))}),h.jsx(Vt,{select:!0,label:"Direction",value:w,onChange:U=>A("orderDirection",U.target.value),size:"small",disabled:M,sx:B,children:RAe.map(U=>h.jsx(el,{value:U.value,children:U.label},U.value))}),h.jsx(qn,{onClick:()=>f(U=>!U),sx:{transform:d?"rotate(180deg)":"rotate(0deg)",transition:"transform 150ms ease"},"aria-label":"Toggle advanced filters",children:h.jsx(ea,{})}),h.jsx(zt,{variant:M?"contained":"outlined",color:M?"error":"primary",onClick:z,startIcon:M?h.jsx(IAe,{}):h.jsx(EAe,{}),sx:{minWidth:140},children:M?"Exclude mode":"Include mode"})]}),a?h.jsx(zt,{variant:"outlined",color:"primary",onClick:a,startIcon:h.jsx(OAe,{sx:s?{animation:"spin 0.9s linear infinite","@keyframes spin":{from:{transform:"rotate(0deg)"},to:{transform:"rotate(360deg)"}}}:void 0}),disabled:s,sx:{minWidth:140},children:"Refresh"}):null]}),h.jsxs(Yp,{in:d,timeout:"auto",unmountOnExit:!0,children:[h.jsxs(ue,{direction:{xs:"column",md:"row"},spacing:2,alignItems:{xs:"stretch",md:"flex-start"},sx:B,children:[h.jsx(Vt,{label:"After",type:"datetime-local",value:oL(e.afterDate),onChange:U=>A("afterDate",aL(U.target.value)),size:"small",fullWidth:!0,InputLabelProps:{shrink:!0},disabled:M}),h.jsx(Vt,{label:"Before",type:"datetime-local",value:oL(e.beforeDate),onChange:U=>A("beforeDate",aL(U.target.value)),size:"small",fullWidth:!0,InputLabelProps:{shrink:!0},disabled:M}),h.jsx(Vt,{label:"Page size",type:"number",value:e.pageSize??"",onChange:U=>{const V=Number(U.target.value);j(Number.isNaN(V)||V<=0?void 0:V)},size:"small",fullWidth:!0,InputLabelProps:{shrink:!0},inputProps:{min:1,max:500},disabled:M})]}),h.jsxs(ue,{spacing:2,sx:{mt:2},children:[h.jsx(hl,{multiple:!0,freeSolo:!0,options:C,value:R,onChange:(U,V)=>O(V),renderTags:(U,V)=>U.map((K,Z)=>h.jsx(dr,{size:"small",label:K,...V({index:Z})})),renderInput:U=>h.jsx(Vt,{...U,label:`Tags (${p})`,placeholder:"Add tags",size:"small"})}),h.jsx(hl,{multiple:!0,freeSolo:!0,options:I,value:D,onChange:(U,V)=>L(V),renderTags:(U,V)=>U.map((K,Z)=>h.jsx(dr,{size:"small",label:K,...V({index:Z})})),renderInput:U=>h.jsx(Vt,{...U,label:`Groups (${p})`,placeholder:"Add groups",size:"small"})})]})]}),r?h.jsxs(Be,{sx:{borderTop:"1px solid",borderColor:"divider",pt:2},children:[h.jsx(ne,{variant:"overline",color:"text.secondary",sx:{display:"block",mb:1},children:"Additional filters"}),r(p)]}):null]})}function oL(e){if(!e)return"";const t=new Date(e);if(Number.isNaN(t.getTime()))return e;const r=t.getTimezoneOffset();return new Date(t.getTime()-r*60*1e3).toISOString().slice(0,16)}function aL(e){if(!e)return;const t=new Date(e);return Number.isNaN(t.getTime())?e:t.toISOString()}function DAe(e){if(!(typeof e=="string"&&e.trim()==="")&&!(Array.isArray(e)&&e.length===0))return e}const zAe=500,sL=10;function NAe({requests:e,onSelectEndpoint:t}){const{mostUsed:r,slowest:n}=m.useMemo(()=>BAe(e),[e]);return h.jsxs(Bo,{container:!0,spacing:2,children:[h.jsx(lL,{title:"Most used requests",data:r,valueKey:"count",axisFormatter:i=>i.toLocaleString(),tooltipFormatter:i=>`${i.toLocaleString()} calls`,color:"#7aa2ff",emptyLabel:"No request volume in the selected range yet.",onSelectEndpoint:t}),h.jsx(lL,{title:"Slowest requests",data:n,valueKey:"avgDuration",axisFormatter:i=>`${i.toLocaleString()} ms`,tooltipFormatter:i=>`${i.toLocaleString()} ms`,color:"#ffb85c",emptyLabel:"No duration data in the selected range yet.",onSelectEndpoint:t})]})}function lL({title:e,data:t,valueKey:r,axisFormatter:n,tooltipFormatter:i,color:o,emptyLabel:a,onSelectEndpoint:s}){const[u,d]=m.useState(!1),f=t.length>sL,p=u?t:t.slice(0,sL),v=Math.max(p.length*38+60,260),y=f?h.jsx(zt,{size:"small",onClick:()=>d(b=>!b),children:u?"Collapse":`Show all (${t.length})`}):void 0;return h.jsx(_t,{title:e,actions:y,flex:1,children:t.length?h.jsx(Be,{sx:{height:v},children:h.jsx(vl,{width:"100%",height:"100%",children:h.jsxs(oO,{data:p,layout:"vertical",margin:{left:0,right:16,top:8,bottom:8},children:[h.jsx(Il,{stroke:"rgba(255,255,255,0.08)"}),h.jsx(Ol,{type:"number",tick:{fill:"rgba(255,255,255,0.7)",fontSize:12},tickLine:!1,axisLine:!1,tickFormatter:b=>{const w=typeof b=="number"?b:Number(b);return n?n(Number.isFinite(w)?w:0):(Number.isFinite(w)?w:0).toLocaleString()}}),h.jsx(ls,{dataKey:"label",type:"category",width:220,tick:{fill:"rgba(255,255,255,0.85)",fontSize:12},tickLine:!1,axisLine:!1}),h.jsx(bl,{cursor:{fill:"rgba(255,255,255,0.08)"},contentStyle:{backgroundColor:"#1e1b23",borderColor:"rgba(255,255,255,0.12)"},formatter:b=>[i(typeof b=="number"?b:Number(b)||0),""],labelFormatter:b=>b}),h.jsx(r0,{dataKey:r,fill:o,radius:[4,4,4,4],cursor:"pointer",onClick:b=>{const w=b==null?void 0:b.payload;w!=null&&w.endpointId&&s(w.endpointId)}})]})})}):h.jsx(LAe,{label:a})})}function LAe({label:e}){return h.jsx(Be,{sx:{py:4},children:h.jsx(ne,{color:"text.secondary",align:"center",children:e})})}function BAe(e){const t=e.slice(0,zAe),r=new Map;t.forEach(a=>{const{displayId:s}=ad(a.method,a.path);if(!s)return;const u=r.get(s)??{label:s,count:0,totalDuration:0};u.count+=1,u.totalDuration+=a.durationMs??0,r.set(s,u)});const n=Array.from(r.entries()).map(([a,s])=>({endpointId:a,label:s.label,count:s.count,avgDuration:s.count===0?0:Math.round(s.totalDuration/Math.max(s.count,1))})),i=[...n].sort((a,s)=>s.count===a.count?a.label.localeCompare(s.label):s.count-a.count),o=[...n].sort((a,s)=>s.avgDuration===a.avgDuration?a.label.localeCompare(s.label):s.avgDuration-a.avgDuration);return{mostUsed:i,slowest:o}}function FAe({requests:e}){const t=na(),[r,n]=m.useState("all"),[i,o]=m.useState(null),[a,s]=m.useState(null),[u,d]=m.useState(null),[f,p]=m.useState(null),[v,y]=m.useState([]),[b,w]=m.useState(null),x=i!=null,k=r!=="all"||x,$=m.useMemo(()=>UAe(e,r),[e,r]),P=m.useMemo(()=>WAe($,i),[$,i]),j=m.useMemo(()=>KAe(P),[P]),C=m.useMemo(()=>mV($),[$]),I=m.useMemo(()=>C.reduce((q,oe)=>Math.max(q,oe.count),0),[C]),A=I>0?[0,I]:[0,"auto"],T=m.useMemo(()=>{if(a!=null&&u!=null){const q=Math.min(a,u),oe=Math.max(a,u);return q===oe?null:{from:q,to:oe}}return i},[a,u,i]),M=q=>{if(!q)return;const oe=oh(q,{tab:"metrics",layout:"details"});t(oe)},R=(q,oe)=>{oe&&(n(oe),o(null),s(null),d(null))},D=()=>{o(null),s(null),d(null)},O=q=>{if((q==null?void 0:q.activeLabel)==null)return;const oe=Number(q.activeLabel);Number.isFinite(oe)&&(s(oe),d(oe))},L=q=>{if(a==null)return;const oe=Number(q==null?void 0:q.activeLabel);Number.isFinite(oe)&&d(oe)},z=()=>{if(a==null||u==null){s(null),d(null);return}const q=Math.min(a,u),oe=Math.max(a,u);s(null),d(null),!(!Number.isFinite(q)||!Number.isFinite(oe)||q===oe)&&o({from:q,to:oe})},F=q=>{var Y,H;const oe=(H=(Y=q==null?void 0:q.activePayload)==null?void 0:Y[0])==null?void 0:H.payload;!oe||!oe.requests.length||p(oe)},B=(q,oe)=>{q.length&&(p(null),y(q.map(Y=>Y.id)),w(Math.min(Math.max(oe,0),q.length-1)))},U=b!=null&&b>=0&&b<v.length?v[b]:null,V=()=>{y([]),w(null)},K=()=>{w(q=>q==null||!v.length?q:(q-1+v.length)%v.length)},Z=()=>{w(q=>q==null||!v.length?q:(q+1)%v.length)},W=h.jsxs(ue,{direction:"row",spacing:1,alignItems:"center",children:[h.jsxs(uC,{size:"small",exclusive:!0,value:r,onChange:R,children:[h.jsx(pu,{value:"15m",children:"Last 15m"}),h.jsx(pu,{value:"1h",children:"Last 1h"}),h.jsx(pu,{value:"24h",children:"Last 24h"}),h.jsx(pu,{value:"all",children:"All"})]}),x&&h.jsx(zt,{size:"small",onClick:D,children:"Reset range"})]});return h.jsxs(h.Fragment,{children:[h.jsxs(ue,{spacing:3,children:[h.jsxs(Bo,{container:!0,spacing:2,children:[h.jsx(Bo,{component:"div",children:h.jsx(xv,{title:"Total requests",value:j.totalRequests})}),h.jsx(Bo,{component:"div",children:h.jsx(xv,{title:"Error rate",value:`${j.errorRate}%`})}),h.jsx(Bo,{component:"div",children:h.jsx(xv,{title:"Avg duration",value:`${j.avgDuration} ms`})}),h.jsx(Bo,{component:"div",children:h.jsx(xv,{title:"P95 duration",value:`${j.p95Duration} ms`})})]}),h.jsx(_t,{title:"Requests over time",actions:W,children:C.length?h.jsx(Y1,{children:h.jsx(vl,{width:"100%",height:"100%",children:h.jsxs(aO,{data:C,margin:{left:0,right:16,top:8,bottom:8},onMouseDown:O,onMouseMove:L,onMouseUp:z,onClick:F,children:[h.jsx(Il,{stroke:"rgba(255,255,255,0.1)"}),h.jsx(Ol,{dataKey:"timestamp",type:"number",tickFormatter:q=>GAe(q),tick:{fill:"rgba(255,255,255,0.6)",fontSize:12},tickLine:!1,axisLine:!1,domain:["dataMin","dataMax"]}),h.jsx(ls,{tick:{fill:"rgba(255,255,255,0.6)",fontSize:12},allowDecimals:!1,tickLine:!1,axisLine:!1,domain:A}),h.jsx(bl,{wrapperStyle:{pointerEvents:"none"},content:ZAe,contentStyle:{backgroundColor:"#1e1b23",borderColor:"rgba(255,255,255,0.1)"}}),T&&h.jsx(PH,{x1:T.from,x2:T.to,strokeOpacity:0,fill:"rgba(155,93,229,0.18)"}),h.jsx(cd,{dataKey:"count",type:"monotone",stroke:"#9b5de5",fill:"#9b5de5",fillOpacity:.2})]})})}):h.jsx(Q1,{hasActiveTimeFilter:k})}),h.jsxs(Bo,{container:!0,spacing:2,children:[h.jsx(Bo,{component:"div",flex:1,children:h.jsx(_t,{title:"Requests by method",flex:1,children:j.byMethod.length?h.jsx(Y1,{height:260,children:h.jsx(vl,{width:"100%",height:"100%",children:h.jsxs(oO,{data:j.byMethod,children:[h.jsx(Il,{stroke:"rgba(255,255,255,0.1)"}),h.jsx(Ol,{dataKey:"method",tick:{fill:"rgba(255,255,255,0.6)"}}),h.jsx(ls,{allowDecimals:!1,tick:{fill:"rgba(255,255,255,0.6)"}}),h.jsx(bl,{contentStyle:{backgroundColor:"#1e1b23",borderColor:"rgba(255,255,255,0.1)"},formatter:(q,oe)=>[`${q} requests`,String(oe).toUpperCase()]}),h.jsx(r0,{dataKey:"count",fill:"#7aa2ff"})]})})}):h.jsx(Q1,{hasActiveTimeFilter:k})})}),h.jsx(Bo,{component:"div",flex:1,children:h.jsx(_t,{title:"Requests by status",flex:1,children:j.byStatus.length?h.jsx(Y1,{height:260,children:h.jsx(vl,{width:"100%",height:"100%",children:h.jsxs(L_e,{children:[h.jsx(dH,{data:j.byStatus,dataKey:"count",nameKey:"label",outerRadius:90,fill:"#8884d8",label:!0}),h.jsx(bl,{contentStyle:{backgroundColor:"#1e1b23",borderColor:"rgba(255,255,255,0.1)"},formatter:(q,oe)=>[`${q} requests`,String(oe)]}),h.jsx(IE,{})]})})}):h.jsx(Q1,{hasActiveTimeFilter:k})})})]}),h.jsx(NAe,{requests:P,onSelectEndpoint:M})]}),h.jsx(XAe,{open:!!f,bucket:f,onClose:()=>p(null),onSelectRequest:B}),h.jsx(Em,{open:!!U,request:null,requestId:U,onClose:V,onPrev:v.length>1?K:void 0,onNext:v.length>1?Z:void 0})]})}function xv({title:e,value:t}){return h.jsxs(_t,{children:[h.jsx(ne,{variant:"body2",color:"text.secondary",children:e}),h.jsx(ne,{variant:"h5",children:t})]})}function Y1({children:e,height:t=320}){return h.jsx(Be,{sx:{height:t},children:e})}function Q1({hasActiveTimeFilter:e}){const t=e?"No requests in this time range.":"Not enough data to display yet.",r=e?"Try widening the selected time range or clearing filters above.":"Once requests start coming in, you will see trends and breakdowns here.";return h.jsx(ji,{title:t,description:r})}function db(e){const r=new Date(e.createdAt).getTime();return Number.isFinite(r)?r:0}function UAe(e,t){if(!e.length)return[];if(t==="all")return e;const r=e.reduce((o,a)=>{const s=db(a);return s>o?s:o},0);if(!r)return e;let n=0;if(t==="15m"?n=15*6e4:t==="1h"?n=60*6e4:t==="24h"&&(n=1440*6e4),!n)return e;const i=r-n;return e.filter(o=>db(o)>=i)}function WAe(e,t){if(!t)return e;const r=Math.min(t.from,t.to),n=Math.max(t.from,t.to);return e.filter(i=>{const o=db(i);return o>=r&&o<=n})}function KAe(e){const t=e.length,r=e.filter(f=>f.status>=400).length,n=t===0?0:Math.round(r/t*100),i=e.map(f=>f.durationMs||0),o=i.length===0?0:Math.round(i.reduce((f,p)=>f+p,0)/i.length),a=qAe(i,.95),s=mV(e),u=HAe(e),d=VAe(e);return{totalRequests:t,errorRate:n,avgDuration:o,p95Duration:a,byTime:s,byMethod:u,byStatus:d}}function mV(e){const t=new Map;return e.forEach(r=>{const n=db(r),i=new Date(n);i.setSeconds(0,0);const o=i.getTime(),a=t.get(o)??{count:0,requests:[]};a.count+=1,a.requests.push({id:r.id,method:r.method,path:r.path,status:r.status,durationMs:r.durationMs??0,createdAt:n}),t.set(o,a)}),Array.from(t.entries()).sort(([r],[n])=>r-n).map(([r,n])=>({timestamp:r,count:n.count,label:new Date(r).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"}),requests:n.requests.sort((i,o)=>i.createdAt-o.createdAt)}))}function HAe(e){const t=new Map;return e.forEach(r=>{t.set(r.method,(t.get(r.method)??0)+1)}),Array.from(t.entries()).map(([r,n])=>({method:r,count:n}))}function VAe(e){const t={"2xx":0,"3xx":0,"4xx":0,"5xx":0};return e.forEach(r=>{r.status>=500?t["5xx"]+=1:r.status>=400?t["4xx"]+=1:r.status>=300?t["3xx"]+=1:t["2xx"]+=1}),Object.entries(t).filter(([,r])=>r>0).map(([r,n])=>({label:r,count:n}))}function qAe(e,t){if(!e.length)return 0;const r=[...e].sort((i,o)=>i-o),n=Math.floor(t*(r.length-1));return r[n]}function GAe(e){const t=typeof e=="number"?e:Number(e);if(!Number.isFinite(t))return"";try{return new Date(t).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})}catch{return""}}function ZAe(e){var i;const{active:t,payload:r}=e;if(!t||!r||!r.length)return null;const n=(i=r[0])==null?void 0:i.payload;return n?h.jsx(Be,{sx:{p:1.5,minWidth:160},children:h.jsxs(ue,{spacing:.5,children:[h.jsx(ne,{variant:"body2",fontWeight:600,children:n.label}),h.jsxs(ne,{variant:"body2",color:"text.secondary",children:[n.count," requests"]})]})}):null}function XAe({open:e,bucket:t,onClose:r,onSelectRequest:n}){const i=(t==null?void 0:t.requests)??[],o=t?`${t.label} · ${i.length} requests`:"Requests in bucket";return h.jsx(sf,{open:e,onClose:r,title:o,children:i.length?h.jsx(ue,{spacing:1.25,children:i.map((a,s)=>h.jsxs(Be,{onClick:()=>n(i,s),onKeyDown:u=>{(u.key==="Enter"||u.key===" ")&&(u.preventDefault(),n(i,s))},role:"button",tabIndex:0,sx:{borderRadius:1,px:1.25,py:.75,display:"flex",flexDirection:"column",gap:.5,"&:hover":{bgcolor:"action.hover"}},children:[h.jsxs(ue,{direction:"row",spacing:1,alignItems:"center",justifyContent:"space-between",children:[h.jsxs(ue,{direction:"row",spacing:1,alignItems:"center",children:[h.jsx(bf,{method:a.method}),h.jsx(ne,{variant:"body2",sx:{fontFamily:"monospace"},noWrap:!0,title:a.path,children:a.path})]}),h.jsxs(ne,{variant:"caption",color:"text.secondary",sx:{whiteSpace:"nowrap"},children:[a.durationMs," ms"]})]}),h.jsxs(ue,{direction:"row",spacing:1,alignItems:"center",justifyContent:"space-between",children:[h.jsx(jm,{status:a.status}),h.jsx(ne,{variant:"caption",color:"text.secondary",sx:{whiteSpace:"nowrap"},children:new Date(a.createdAt).toLocaleString()})]})]},a.id))}):h.jsx(ne,{color:"text.secondary",children:"No requests recorded in this time bucket."})})}const YAe=Et(h.jsx("path",{d:"M5 20h14v-2H5zM19 9h-4V3H9v6H5l7 7z"})),QAe="text/csv;charset=utf-8;",JAe=e=>e.toLowerCase().endsWith(".csv")?e:`${e}.csv`,uL=e=>{if(e==null)return"";let t;if(e instanceof Date)t=e.toISOString();else if(typeof e=="object")try{t=JSON.stringify(e)}catch{t=String(e)}else t=String(e);const r=t.replace(/"/g,'""');return/[",\n\r]/.test(t)?`"${r}"`:r},eTe=e=>{const t=[],r=new Set;return e.forEach(n=>{Object.keys(n).forEach(i=>{r.has(i)||(r.add(i),t.push(i))})}),t};function tTe(e,t){if(typeof document>"u")throw new Error("exportToCsv can only be used in a browser environment.");const r=eTe(t),n=[];r.length&&n.push(r.map(u=>uL(u)).join(",")),t.forEach(u=>{const d=r.map(f=>uL(u[f]));n.push(d.join(","))});const i=n.join(`\r
374
+ `),o=new Blob([i],{type:QAe}),a=URL.createObjectURL(o),s=document.createElement("a");s.href=a,s.setAttribute("download",JAe(e)),s.style.display="none",document.body.appendChild(s),s.click(),document.body.removeChild(s),URL.revokeObjectURL(a)}function Sf({filename:e,rows:t,getRows:r,children:n="Export CSV",disabled:i,startIcon:o,variant:a="outlined",size:s="small",color:u="secondary",...d}){const[f,p]=m.useState(!1),v=m.useCallback(async()=>{if(!f){p(!0);try{let b=[];if(typeof r=="function"){const w=await r();b=Array.isArray(w)?w:[]}else Array.isArray(t)&&(b=t);tTe(e,b)}catch(b){console.error("Failed to export CSV",b)}finally{p(!1)}}},[f,e,r,t]),y=i||f||!t&&!r;return h.jsx(zt,{variant:a,size:s,color:u,disabled:y,onClick:v,startIcon:o??h.jsx(YAe,{fontSize:"small"}),...d,children:n})}const rTe=new Set(["INPUT","TEXTAREA","SELECT"]);function gV({searchInputRef:e}){m.useEffect(()=>{const t=r=>{var i;if(r.defaultPrevented||r.key!=="/"||r.metaKey||r.ctrlKey||r.altKey)return;const n=r.target;n&&rTe.has(n.tagName)||(r.preventDefault(),(i=e==null?void 0:e.current)==null||i.focus())};return window.addEventListener("keydown",t),()=>window.removeEventListener("keydown",t)},[e])}function kf(e,t){const{defaultValue:r,serialize:n,deserialize:i}=t,[o,a]=_$(),s=o.get(e),u=s===null?r:i?i(s):s,d=m.useCallback(f=>{a(p=>{const v=new URLSearchParams(p),y=p.get(e),b=y===null?r:i?i(y):y,w=typeof f=="function"?f(b):f,x=n?n(w):w;return x==null?v.delete(e):v.set(e,x),v},{replace:!0})},[r,i,e,n,a]);return[u,d]}const Pf={orderBy:"timestamp",orderDirection:"desc",tagsInclude:[],tagsExclude:[],groupsInclude:[],groupsExclude:[],pageSize:500};function $f(e){const t={};return Object.entries(e).forEach(([r,n])=>{n!=null&&(typeof n=="string"&&n.trim()===""||Array.isArray(n)&&n.length===0||(t[r]=n))}),Object.keys(t).length===0?null:encodeURIComponent(JSON.stringify(t))}function Cf(e,t){try{const r=JSON.parse(decodeURIComponent(e));return{...t,...r}}catch{return t}}const cL={...Pf,searchQuery:"",methodsInclude:[],methodsExclude:[],statusesInclude:[],statusesExclude:[],endpointKeysInclude:[],endpointKeysExclude:[]};function nTe(){const e=na(),{queuePrefill:t}=sx(),[r,n]=kf("historyFilters",{defaultValue:cL,serialize:Y=>$f(Y),deserialize:Y=>Cf(Y,cL)}),[i,o]=m.useState("table"),[a,s]=m.useState(null),u=m.useRef(null);gV({searchInputRef:u});const d=rn("GET /__rrroutes/requests",{cursorParam:"cursor",getNextPageParam(Y){return Y.meta.nextCursor}}),{data:f,isLoading:p,error:v,refetch:y,isFetching:b,fetchNextPage:w,hasNextPage:x,isFetchingNextPage:k}=d.useEndpoint({query:r}),$=m.useMemo(()=>f?Array.isArray(f.pages)?f.pages.flatMap(Y=>Array.isArray(Y==null?void 0:Y.out)?Y.out:[]):[]:[],[f]),[P,j]=m.useState(()=>{const Y=new Map,H=new Map;return rE.all.forEach(X=>{const{displayId:re,encodedId:he}=ad(X.method,X.path);re&&he&&(Y.set(re,he),H.set(he,re))}),{options:Array.from(Y.keys()).sort(),displayToValue:Y,valueToDisplay:H}});m.useEffect(()=>{$.length&&j(Y=>{let H=!1;const X=new Map(Y.displayToValue),re=new Map(Y.valueToDisplay);return $.forEach(he=>{const{displayId:J,encodedId:ge}=ad(he.method,he.path);!J||!ge||!X.has(J)&&!re.has(ge)&&(X.set(J,ge),re.set(ge,J),H=!0)}),H?{displayToValue:X,valueToDisplay:re,options:Array.from(X.keys()).sort()}:Y})},[$]);const C=P.options;m.useEffect(()=>{a!==null&&($[a]||s(null))},[$,a]);const I=a!==null?$[a]??null:null,A=m.useMemo(()=>{const Y=new Set;return $.forEach(H=>Y.add(H.status)),Array.from(Y).sort((H,X)=>H-X)},[$]),T=m.useMemo(()=>$.map(Y=>{var H,X;return{timestamp:new Date(Y.createdAt).toISOString(),method:((X=(H=Y.method)==null?void 0:H.toUpperCase)==null?void 0:X.call(H))??Y.method,path:Y.path,status:Y.status,durationMs:Y.durationMs,tags:Array.isArray(Y.tags)?Y.tags.join(", "):"",groupId:Y.groupId??"",endpointId:Y.id,fullUrl:Y.fullUrl??""}}),[$]),M=(()=>{if(p)return h.jsx(Ma,{variant:"table"});if(v){const Y=v instanceof Error?v.message:"Failed to load history.",H=v instanceof Error?v.stack:v?String(v):void 0;return h.jsx(ia,{message:Y,details:H,onRetry:()=>y()})}return $.length?h.jsx(xf,{data:f,isLoading:p,items:$,fetchNextPage:w,hasNextPage:x,isFetchingNextPage:k,pageSize:r.pageSize,children:Y=>h.jsx(pV,{requests:Y,onSelect:V})}):h.jsx(ji,{title:"No requests found",description:"Try adjusting your filters or search query."})})(),R=(Y,H)=>{n(X=>{const re=new Set(X.methodsInclude),he=new Set(X.methodsExclude);return H==="include"?(re.has(Y)?re.delete(Y):re.add(Y),he.delete(Y)):(he.has(Y)?he.delete(Y):he.add(Y),re.delete(Y)),{...X,methodsInclude:Array.from(re),methodsExclude:Array.from(he)}})},D=(Y,H)=>{n(X=>{const re=new Set(X.statusesInclude),he=new Set(X.statusesExclude);return H==="include"?(re.has(Y)?re.delete(Y):re.add(Y),he.delete(Y)):(he.has(Y)?he.delete(Y):he.add(Y),re.delete(Y)),{...X,statusesInclude:Array.from(re),statusesExclude:Array.from(he)}})},O=Y=>{var H,X;return(H=r.methodsInclude)!=null&&H.includes(Y)?"include":(X=r.methodsExclude)!=null&&X.includes(Y)?"exclude":"none"},L=Y=>{var H,X;return(H=r.statusesInclude)!=null&&H.includes(Y)?"include":(X=r.statusesExclude)!=null&&X.includes(Y)?"exclude":"none"},z=m.useMemo(()=>{var Y;return(Y=r.endpointKeysInclude)==null?void 0:Y.map(H=>P.valueToDisplay.get(H)??H)},[P,r.endpointKeysInclude]),F=m.useMemo(()=>{var Y;return(Y=r.endpointKeysExclude)==null?void 0:Y.map(H=>P.valueToDisplay.get(H)??H)},[P,r.endpointKeysExclude]),B=(Y,H)=>{const X=Y.map(re=>P.displayToValue.get(re)??re).filter(re=>re.trim().length>0);n(re=>({...re,endpointKeysInclude:H==="include"?X:re.endpointKeysInclude,endpointKeysExclude:H==="exclude"?X:re.endpointKeysExclude}))},U=Y=>{t({method:Y.method,path:Y.path,params:Y.params||{},query:Y.query||{},body:Y.body});const{displayId:H}=ad(Y.method,Y.path);if(!H)return;const X=oh(H,{tab:"metrics",layout:"details"});e(X)},V=(Y,H)=>{var re;const X=((re=$[H])==null?void 0:re.id)===Y.id?H:$.findIndex(he=>he.id===Y.id);X>=0&&s(X)},K=()=>s(null),Z=()=>{s(Y=>Y===null||Y<=0?Y:Y-1)},W=()=>{s(Y=>Y===null||Y>=$.length-1?Y:Y+1)},q=a!==null&&a>0,oe=a!==null&&a<$.length-1;return h.jsxs(Go,{title:"History",subtitle:"Review your recently executed requests.",children:[h.jsxs(ue,{spacing:3,children:[h.jsx(_t,{title:"Filters",children:h.jsx(wf,{value:r,onChange:Y=>n(H=>({...H,...Y})),searchInputRef:u,onRefresh:()=>y(),refreshing:b,children:Y=>h.jsxs(ue,{spacing:2,children:[h.jsxs(ue,{spacing:1,children:[h.jsx(ne,{variant:"overline",color:"text.secondary",children:"Methods"}),h.jsx(ue,{direction:"row",spacing:1,flexWrap:"wrap",useFlexGap:!0,children:ax.map(H=>h.jsx(bf,{method:H,state:O(H),onClick:()=>R(H,Y)},H))})]}),h.jsxs(ue,{spacing:1,children:[h.jsx(ne,{variant:"overline",color:"text.secondary",children:"Statuses"}),h.jsx(ue,{direction:"row",spacing:1,flexWrap:"wrap",useFlexGap:!0,children:A.map(H=>h.jsx(jm,{status:H,state:L(H),onClick:()=>D(H,Y)},H))})]}),h.jsxs(ue,{spacing:1,children:[h.jsx(ne,{variant:"overline",color:"text.secondary",children:"Endpoint"}),h.jsx(hl,{multiple:!0,freeSolo:!0,options:C,value:Y==="include"?z:F,onChange:(H,X)=>{console.log(X),B(X,Y)},ListboxProps:{sx:{maxHeight:240,overflowY:"auto"}},renderInput:H=>h.jsx(Vt,{...H,onChange:X=>{n(re=>({...re,searchQuery:X.target.value}))},label:`Endpoint (${Y})`,placeholder:"GET /api/example",size:"small"})})]})]})})}),h.jsx(_t,{title:"View",actions:h.jsxs(ue,{direction:"row",spacing:1,alignItems:"center",children:[h.jsx(Sf,{filename:"history.csv",rows:T,title:"Exports the currently filtered history results."}),h.jsxs(Ub,{value:i,onChange:(Y,H)=>o(H),variant:"standard",sx:{minHeight:32},children:[h.jsx(ml,{label:"Table",value:"table"}),h.jsx(ml,{label:"Insights",value:"insights"})]})]}),children:i==="table"?M:h.jsx(FAe,{requests:$})})]}),h.jsx(Em,{open:!!I,request:I,onClose:K,onReplay:Y=>U(Y),onPrev:q?Z:void 0,onNext:oe?W:void 0})]})}function iTe({logs:e,onSelect:t}){return h.jsx(oc,{component:Yn,variant:"outlined",children:h.jsxs(nc,{size:"small",children:[h.jsx(ac,{children:h.jsxs(Ii,{children:[h.jsx(Oe,{children:"Timestamp"}),h.jsx(Oe,{children:"Level"}),h.jsx(Oe,{children:"Name"}),h.jsx(Oe,{children:"Message"}),h.jsx(Oe,{children:"Meta"}),h.jsx(Oe,{children:"Tags"}),h.jsx(Oe,{children:"Group"})]})}),h.jsx(ic,{children:e.map(r=>{var n;return h.jsxs(Ii,{hover:!0,sx:{cursor:t?"pointer":"default"},onClick:()=>t==null?void 0:t(r),children:[h.jsx(Oe,{children:new Date(r.createdAt).toLocaleString()}),h.jsx(Oe,{children:h.jsx(Cm,{level:r.level})}),h.jsx(Oe,{sx:{maxWidth:160},children:h.jsx(ne,{variant:"body2",noWrap:!0,sx:{fontFamily:"monospace"},children:r.name||"—"})}),h.jsx(Oe,{sx:{maxWidth:240},children:h.jsx(ne,{variant:"body2",noWrap:!0,children:sO(r)})}),h.jsx(Oe,{sx:{maxWidth:280},children:oTe(r)}),h.jsx(Oe,{children:(n=r.tags)!=null&&n.length?h.jsx(ue,{direction:"row",spacing:.5,flexWrap:"wrap",useFlexGap:!0,children:r.tags.map(i=>h.jsx(dr,{label:i,size:"small"},i))}):h.jsx(ne,{variant:"body2",color:"text.secondary",children:"—"})}),h.jsx(Oe,{children:h.jsx(ne,{variant:"body2",color:r.groupId?"text.primary":"text.secondary",sx:{fontFamily:"monospace"},noWrap:!0,children:r.groupId??"—"})})]},r.id)})})]})})}function oTe(e){const t=aTe(e.meta);if(!t)return h.jsx(ne,{variant:"body2",color:"text.secondary",children:"—"});const r=t.length>80?`${t.slice(0,80)}…`:t;return r===t?h.jsx(ne,{variant:"body2",noWrap:!0,children:t}):h.jsx(Bh,{title:t,children:h.jsx(ne,{variant:"body2",noWrap:!0,children:r})})}function aTe(e){if(e==null)return"";if(typeof e=="string")return e;try{return JSON.stringify(e)}catch{return String(e)}}const dL={...Pf,searchQuery:"",levelsInclude:[],levelsExclude:[]};function sTe(){const[e,t]=kf("logsAppFilters",{defaultValue:dL,serialize:M=>$f(M),deserialize:M=>Cf(M,dL)}),[r,n]=m.useState(null),i=rn("GET /__rrroutes/logs",{cursorParam:"cursor",getNextPageParam(M){return M.meta.nextCursor},splitPageSize:500,splitPageSizeParam:"pageSize"}),{data:o,isLoading:a,error:s,refetch:u,isFetching:d,fetchNextPage:f,hasNextPage:p,isFetchingNextPage:v}=i.useEndpoint({query:e}),y=m.useMemo(()=>o?Array.isArray(o.pages)?o.pages.flatMap(M=>Array.isArray(M==null?void 0:M.out)?M.out:[]):[]:[],[o]),b=(r==null?void 0:r.orderedItems[r.index])??null,w=r!==null&&r.index>0,x=r!==null&&r.index<r.orderedItems.length-1,k=m.useCallback((M,R)=>{const D=R.findIndex(O=>O.id===M.id);n({orderedItems:R.map(O=>({...O})),index:D>=0?D:0})},[]),$=m.useCallback(()=>{n(null)},[]),P=m.useCallback(()=>{n(M=>!M||M.index<=0?M:{...M,index:M.index-1})},[]),j=m.useCallback(()=>{n(M=>!M||M.index>=M.orderedItems.length-1?M:{...M,index:M.index+1})},[]),C=m.useMemo(()=>y.map(M=>({timestamp:lTe(M.createdAt),level:M.level,name:M.name??"",message:uTe(M),meta:h$(M.meta),tags:Array.isArray(M.tags)?M.tags.join(", "):"",groupId:M.groupId??""})),[y]),I=(M,R)=>{t(D=>{const O=new Set(D.levelsInclude),L=new Set(D.levelsExclude);return R==="include"?(O.has(M)?O.delete(M):O.add(M),L.delete(M)):(L.has(M)?L.delete(M):L.add(M),O.delete(M)),{...D,levelsInclude:Array.from(O),levelsExclude:Array.from(L)}})},A=M=>{var R,D;return(R=e.levelsInclude)!=null&&R.includes(M)?"include":(D=e.levelsExclude)!=null&&D.includes(M)?"exclude":"none"},T=(()=>{if(a)return h.jsx(Ma,{variant:"table"});if(s){const M=s instanceof Error?s.message:"Failed to load logs.",R=s instanceof Error?s.stack:s?String(s):void 0;return h.jsx(ia,{message:M,details:R,onRetry:()=>u()})}return y.length?h.jsx(xf,{data:o,isLoading:a,items:y,fetchNextPage:f,hasNextPage:p,isFetchingNextPage:v,pageSize:e.pageSize,children:M=>h.jsx(iTe,{logs:M,onSelect:R=>k(R,M)})}):h.jsx(ji,{title:"No logs",description:"Adjust filters to see additional log entries."})})();return h.jsxs(h.Fragment,{children:[h.jsxs(ue,{spacing:3,sx:{mt:2},children:[h.jsx(_t,{title:"Filters",children:h.jsx(wf,{value:e,onChange:M=>t(R=>({...R,...M})),onRefresh:()=>u(),refreshing:d,children:M=>h.jsxs(ue,{spacing:1,children:[h.jsx(ne,{variant:"overline",color:"text.secondary",children:"Levels"}),h.jsx(ue,{direction:"row",spacing:1,flexWrap:"wrap",useFlexGap:!0,children:z3.map(R=>h.jsx(Cm,{level:R,state:A(R),onClick:()=>I(R,M)},R))})]})})}),h.jsx(_t,{title:"Application logs",actions:h.jsx(Sf,{filename:"application-logs.csv",rows:C,title:"Exports the currently filtered logs."}),children:T})]}),h.jsx(oV,{open:!!b,groupId:b==null?void 0:b.groupId,baseQuery:e,triggerLog:b,onClose:$,onPrev:w?P:void 0,onNext:x?j:void 0})]})}function lTe(e){if(!e)return"";try{return new Date(e).toISOString()}catch{return""}}function uTe(e){if(e.description)return e.description;if(typeof e.meta=="string")return e.meta;if(e.meta&&typeof e.meta=="object"){const t=e.meta;if(typeof t.message=="string")return t.message;if(t.message)return h$(t.message)}return h$(e.meta)}function h$(e){if(e==null)return"";if(typeof e=="string")return e;try{return JSON.stringify(e)}catch{return String(e)}}function cTe(e){return rn("GET /__rrroutes/cache/insights").useEndpoint({query:e})}function vV(){const[e,t]=m.useState([]),r=m.useCallback(s=>{const u=Array.from(new Set(s));t(d=>d.length===u.length&&d.every((f,p)=>f===u[p])?d:u)},[]),n=m.useCallback(s=>{t(u=>u.includes(s)?u.filter(d=>d!==s):[...u,s])},[]),i=m.useCallback(()=>{t([])},[]),o=m.useCallback(s=>e.includes(s),[e]),a=e.length>0;return{selectedIds:e,hasSelection:a,setSelection:r,toggle:n,clear:i,isSelected:o}}const yV=Et(h.jsx("path",{d:"m20 12-1.41-1.41L13 16.17V4h-2v12.17l-5.58-5.59L4 12l8 8z"})),bV=Et(h.jsx("path",{d:"m4 12 1.41 1.41L11 7.83V20h2V7.83l5.58 5.59L20 12l-8-8z"})),fL=["sets","totalSizeKB","totalRequests","hitRate","missRate","avgMissDurationMs","hitsSinceLastSet","missesSinceLastSet","deletesSinceLastSet","avgTimeBetweenSetsMs","avgHitsBetweenSets","avgMissesBetweenSets"],m$={sets:"Sets",totalSizeKB:"Current size (KB)",totalRequests:"Total requests",hitRate:"Hit rate (%)",missRate:"Miss rate (%)",avgMissDurationMs:"Avg miss duration (ms)",hitsSinceLastSet:"Hits since last set",missesSinceLastSet:"Misses since last set",deletesSinceLastSet:"Deletes since last set",avgTimeBetweenSetsMs:"Avg time between sets (ms)",avgHitsBetweenSets:"Avg hits between sets",avgMissesBetweenSets:"Avg misses between sets"},J1=(e,t)=>{switch(t){case"sets":return e.sets;case"totalSizeKB":return e.totalSizeKB;case"totalRequests":return e.totalRequests;case"hitRate":return e.hitRate;case"missRate":return e.missRate;case"avgMissDurationMs":return e.avgMissDurationMs??0;case"hitsSinceLastSet":return e.hitsSinceLastSet??0;case"missesSinceLastSet":return e.missesSinceLastSet??0;case"deletesSinceLastSet":return e.deletesSinceLastSet??0;case"avgTimeBetweenSetsMs":return e.avgTimeBetweenSetsMs??0;case"avgHitsBetweenSets":return e.avgHitsBetweenSets??0;case"avgMissesBetweenSets":return e.avgMissesBetweenSets??0;default:return 0}},dTe=e=>{switch(e){case"hitRate":case"missRate":return"percent";case"totalSizeKB":return"sizeKB";case"avgMissDurationMs":case"avgTimeBetweenSetsMs":return"durationMs";default:return"count"}},fTe=(e,t)=>{switch(t){case"percent":return`${e.toFixed(0)}%`;case"sizeKB":return e.toFixed(1);case"durationMs":return e.toFixed(0);case"count":default:return e.toFixed(0)}},pTe=(e,t,r)=>{const n=m$[t];switch(r){case"percent":return[`${e.toFixed(1)}%`,n];case"sizeKB":return[`${e.toFixed(2)} KB`,n];case"durationMs":return[`${e.toFixed(1)} ms`,n];case"count":default:return[e,n]}},xV=e=>e!=null?Number(e)/1024:0,wV=(e,t)=>Number(e||0)+Number(t||0);function SV({tagStats:e,keyStats:t,defaultDimension:r="tag",onVisibleChange:n}){var O,L,z,F;const i=Kr(),[o,a]=m.useState("hitRate"),[s,u]=m.useState("desc"),[d,f]=m.useState(10),[p,v]=m.useState(r),y=m.useMemo(()=>{const B=[];return e&&e.length>0&&B.push("tag"),t&&t.length>0&&B.push("key"),B},[e,t]);if(y.length===0)return null;const b=y.includes(p)?p:y[0],w=m.useMemo(()=>b==="tag"?e??[]:t??[],[b,e,t]),x=m.useMemo(()=>w.length?fL.filter(B=>w.some(U=>J1(U,B)!==0)):fL,[w]),k=x.includes(o)&&x.length>0?o:x[0]??"hitRate",$=m.useMemo(()=>{const B=[...w];return B.sort((U,V)=>{const K=J1(U,k),Z=J1(V,k);return K===Z?U.label.localeCompare(V.label):s==="desc"?Z-K:K-Z}),B},[w,k,s]),P=m.useMemo(()=>d==="all"?$:$.slice(0,d),[$,d]);m.useEffect(()=>{if(!n)return;const B=P.map(U=>U.id);n(B)},[P,n]);const j=m.useMemo(()=>dTe(k),[k]),C=j==="percent",I=j==="sizeKB",A=B=>{const U=B.target.value;f(U==="all"?"all":Number(U))},T=y.length===1?y[0]==="tag"?"Cache usage by tag":"Cache usage by key (name)":b==="tag"?"Cache usage by tag":"Cache usage by key (name)",M=w.length,R=P.length,D=((L=(O=i==null?void 0:i.palette)==null?void 0:O.info)==null?void 0:L.main)??((F=(z=i==null?void 0:i.palette)==null?void 0:z.primary)==null?void 0:F.main)??"#42a5f5";return h.jsx(_t,{title:T,actions:h.jsxs(ue,{direction:"row",spacing:1,alignItems:"center",flexWrap:"wrap",useFlexGap:!0,children:[y.length>1&&h.jsxs(uC,{size:"small",value:b,exclusive:!0,onChange:(B,U)=>{U&&v(U)},children:[h.jsx(pu,{value:"tag",children:"By tag"}),h.jsx(pu,{value:"key",children:"By key"})]}),h.jsx(Ok,{size:"small",sx:{minWidth:200},children:h.jsx(Jv,{value:k,onChange:B=>a(B.target.value),children:x.map(B=>h.jsx(el,{value:B,children:m$[B]},B))})}),h.jsx(Ok,{size:"small",sx:{minWidth:130},children:h.jsxs(Jv,{value:String(d),onChange:A,children:[h.jsx(el,{value:"5",children:"Top 5"}),h.jsx(el,{value:"10",children:"Top 10"}),h.jsx(el,{value:"25",children:"Top 25"}),h.jsx(el,{value:"all",children:"Show all"})]})}),h.jsx(Bh,{title:s==="desc"?"Sort ascending (smallest first)":"Sort descending (largest first)",children:h.jsx(qn,{size:"small",onClick:()=>u(B=>B==="asc"?"desc":"asc"),children:s==="desc"?h.jsx(yV,{fontSize:"small"}):h.jsx(bV,{fontSize:"small"})})})]}),children:h.jsxs(ue,{spacing:1,children:[h.jsx(Be,{sx:{height:320},children:h.jsx(vl,{width:"100%",height:"100%",children:h.jsxs(oO,{data:P,margin:{left:0,right:16,top:8,bottom:32},children:[h.jsx(Il,{stroke:"rgba(255,255,255,0.08)"}),h.jsx(Ol,{dataKey:"label",tick:{fill:"rgba(255,255,255,0.7)",fontSize:12},tickLine:!1,axisLine:!1,interval:0,angle:-35,textAnchor:"end"}),h.jsx(ls,{allowDecimals:!I&&!C,tick:{fill:"rgba(255,255,255,0.7)",fontSize:12},tickLine:!1,axisLine:!1,tickFormatter:B=>fTe(B,j),domain:[0,"dataMax"]}),h.jsx(bl,{cursor:{fill:"rgba(255,255,255,0.08)"},contentStyle:{backgroundColor:"#1e1b23",borderColor:"rgba(255,255,255,0.12)"},formatter:B=>pTe(B,k,j)}),h.jsx(IE,{}),h.jsx(r0,{dataKey:k,name:m$[k],fill:D,radius:[4,4,0,0]})]})})}),h.jsx(ne,{variant:"caption",color:"text.secondary",children:d==="all"?`Showing all ${M} ${b==="tag"?"tags":"keys"}.`:`Showing top ${R} of ${M} ${b==="tag"?"tags":"keys"}.`})]})})}function hTe(e){return e.map(t=>{const r=wV(t.totalHits,t.totalMisses),n=xV(t.currentSizeBytes);return{id:t.key,label:t.key,sets:Number(t.totalSets)||0,totalSizeKB:n,totalRequests:r,hitRate:Number(t.hitRate)||0,missRate:Number(t.missRate)||0,avgMissDurationMs:null,hitsSinceLastSet:t.hitsSinceLastSet!=null?Number(t.hitsSinceLastSet):void 0,missesSinceLastSet:t.missesSinceLastSet!=null?Number(t.missesSinceLastSet):void 0,deletesSinceLastSet:t.deletesSinceLastSet!=null?Number(t.deletesSinceLastSet):void 0,avgTimeBetweenSetsMs:t.avgTimeBetweenSetsMs!=null?Number(t.avgTimeBetweenSetsMs):null,avgHitsBetweenSets:t.avgHitsBetweenSets!=null?Number(t.avgHitsBetweenSets):null,avgMissesBetweenSets:t.avgMissesBetweenSets!=null?Number(t.avgMissesBetweenSets):null}})}function mTe(e){return e.map(t=>{const r=wV(t.totalHits,t.totalMisses),n=xV(t.approxCurrentSizeBytes);return{id:t.tag,label:t.tag,sets:Number(t.totalSets)||0,totalSizeKB:n,totalRequests:r,hitRate:Number(t.hitRate)||0,missRate:Number(t.missRate)||0,avgMissDurationMs:null,hitsSinceLastSet:void 0,missesSinceLastSet:void 0,deletesSinceLastSet:void 0,avgTimeBetweenSetsMs:t.avgTimeBetweenSetsMs!=null?Number(t.avgTimeBetweenSetsMs):null,avgHitsBetweenSets:t.avgHitsBetweenSets!=null?Number(t.avgHitsBetweenSets):null,avgMissesBetweenSets:t.avgMissesBetweenSets!=null?Number(t.avgMissesBetweenSets):null}})}function gTe({keys:e}){const t=hTe(e),{selectedIds:r,setSelection:n}=vV(),i=m.useMemo(()=>{const d=[...e];return d.sort((f,p)=>{const v=p.missesSinceLastSet-f.missesSinceLastSet;if(v!==0)return v;const y=f.currentSizeBytes??0;return(p.currentSizeBytes??0)-y}),d},[e]),o=m.useMemo(()=>{const d={};return e.forEach(f=>{d[f.key]=f}),d},[e]),a=m.useMemo(()=>{if(!r||r.length===0)return null;const d=r.map(f=>o[f]).filter(f=>!!f);return d.length===0?null:d},[r,o]),s=m.useMemo(()=>a||i.slice(0,10),[a,i]),u=d=>{n(d)};return h.jsxs(ue,{spacing:2,children:[h.jsx(SV,{keyStats:t,defaultDimension:"key",onVisibleChange:u}),h.jsxs(_t,{title:"Top keys by misses since last set",children:[h.jsx(oc,{children:h.jsxs(nc,{size:"small",children:[h.jsx(ac,{children:h.jsxs(Ii,{children:[h.jsx(Oe,{children:"Key"}),h.jsx(Oe,{align:"right",children:"Current size (KB)"}),h.jsx(Oe,{align:"right",children:"Hits since last set"}),h.jsx(Oe,{align:"right",children:"Misses since last set"}),h.jsx(Oe,{align:"right",children:"Avg misses between sets"}),h.jsx(Oe,{children:"Last set"}),h.jsx(Oe,{children:"Last hit"}),h.jsx(Oe,{children:"Last miss"}),h.jsx(Oe,{children:"Last delete"})]})}),h.jsx(ic,{children:s.map(d=>h.jsxs(Ii,{children:[h.jsx(Oe,{children:h.jsx(ne,{component:"span",sx:{fontFamily:"monospace",fontSize:"0.85rem"},children:d.key})}),h.jsx(Oe,{align:"right",children:vTe(d.currentSizeBytes)}),h.jsx(Oe,{align:"right",children:d.hitsSinceLastSet}),h.jsx(Oe,{align:"right",children:d.missesSinceLastSet}),h.jsx(Oe,{align:"right",children:d.avgMissesBetweenSets!=null?d.avgMissesBetweenSets.toFixed(2):"—"}),h.jsx(Oe,{children:wv(d.lastSetAt)}),h.jsx(Oe,{children:wv(d.lastHitAt)}),h.jsx(Oe,{children:wv(d.lastMissAt)}),h.jsx(Oe,{children:wv(d.lastDeleteAt)})]},d.key))})]})}),s.length===0&&h.jsx(Be,{sx:{mt:1},children:h.jsx(ne,{variant:"caption",color:"text.secondary",children:"No key-level insights available for the current filters."})})]})]})}function vTe(e){return e==null?"—":(e/1024).toFixed(2)}function wv(e){if(!e)return"—";try{return new Date(e).toLocaleString()}catch{return"—"}}function yTe({tags:e}){const t=mTe(e),{selectedIds:r,setSelection:n}=vV(),i=m.useMemo(()=>{const d=[...e];return d.sort((f,p)=>{const v=f.approxCurrentSizeBytes??0;return(p.approxCurrentSizeBytes??0)-v}),d},[e]),o=m.useMemo(()=>{const d={};return e.forEach(f=>{d[f.tag]=f}),d},[e]),a=m.useMemo(()=>{if(!r||r.length===0)return null;const d=r.map(f=>o[f]).filter(f=>!!f);return d.length===0?null:d},[r,o]),s=m.useMemo(()=>a||i.slice(0,10),[a,i]),u=d=>{n(d)};return h.jsxs(ue,{spacing:2,children:[h.jsx(SV,{tagStats:t,defaultDimension:"tag",onVisibleChange:u}),h.jsxs(_t,{title:"Top tags by approximate current size",children:[h.jsx(oc,{children:h.jsxs(nc,{size:"small",children:[h.jsx(ac,{children:h.jsxs(Ii,{children:[h.jsx(Oe,{children:"Tag"}),h.jsx(Oe,{align:"right",children:"Approx size (KB)"}),h.jsx(Oe,{align:"right",children:"Total hits"}),h.jsx(Oe,{align:"right",children:"Total misses"}),h.jsx(Oe,{align:"right",children:"Total sets"}),h.jsx(Oe,{align:"right",children:"Total deletes"}),h.jsx(Oe,{align:"right",children:"Hit rate"}),h.jsx(Oe,{align:"right",children:"Miss rate"}),h.jsx(Oe,{align:"right",children:"Avg time between sets (ms)"}),h.jsx(Oe,{align:"right",children:"Avg hits between sets"}),h.jsx(Oe,{align:"right",children:"Avg misses between sets"})]})}),h.jsx(ic,{children:s.map(d=>h.jsxs(Ii,{children:[h.jsx(Oe,{children:h.jsx(ne,{component:"span",sx:{fontFamily:"monospace",fontSize:"0.85rem"},children:d.tag})}),h.jsx(Oe,{align:"right",children:bTe(d.approxCurrentSizeBytes)}),h.jsx(Oe,{align:"right",children:d.totalHits}),h.jsx(Oe,{align:"right",children:d.totalMisses}),h.jsx(Oe,{align:"right",children:d.totalSets}),h.jsx(Oe,{align:"right",children:d.totalDeletes}),h.jsxs(Oe,{align:"right",children:[d.hitRate.toFixed(1),"%"]}),h.jsxs(Oe,{align:"right",children:[d.missRate.toFixed(1),"%"]}),h.jsx(Oe,{align:"right",children:d.avgTimeBetweenSetsMs!=null?d.avgTimeBetweenSetsMs.toFixed(0):"—"}),h.jsx(Oe,{align:"right",children:d.avgHitsBetweenSets!=null?d.avgHitsBetweenSets.toFixed(2):"—"}),h.jsx(Oe,{align:"right",children:d.avgMissesBetweenSets!=null?d.avgMissesBetweenSets.toFixed(2):"—"})]},d.tag))})]})}),s.length===0&&h.jsx(Be,{sx:{mt:1},children:h.jsx(ne,{variant:"caption",color:"text.secondary",children:"No tag-level insights available for the current filters."})})]})]})}function bTe(e){return e==null?"—":(e/1024).toFixed(2)}function xTe({filters:e}){var C,I,A;const{beforeDate:t,afterDate:r,orderBy:n,orderDirection:i,searchQuery:o,groupsInclude:a,groupsExclude:s,tagsInclude:u,tagsExclude:d,keys:f}=e,{data:p,isLoading:v,isFetching:y,error:b,refetch:w}=cTe({beforeDate:t,afterDate:r,orderBy:n,orderDirection:i,searchQuery:o,groupsInclude:a,groupsExclude:s,tagsInclude:u,tagsExclude:d,keys:f,groupBy:"both"}),x=p==null?void 0:p.out,k=((C=x==null?void 0:x.keys)==null?void 0:C.reduce((T,M)=>T+(M.currentSizeBytes??0),0))??0,$=m.useMemo(()=>{var R,D;const T=((R=x==null?void 0:x.keys)==null?void 0:R.map(O=>({entityType:"key",key:O.key,currentSizeBytes:O.currentSizeBytes??"",currentSizeKB:O.currentSizeBytes!=null?(O.currentSizeBytes/1024).toFixed(2):"",lastSetAt:Ip(O.lastSetAt),lastDeleteAt:Ip(O.lastDeleteAt),lastHitAt:Ip(O.lastHitAt),lastMissAt:Ip(O.lastMissAt),lastActivityAt:Ip(O.lastActivityAt),totalHits:O.totalHits,totalMisses:O.totalMisses,totalSets:O.totalSets,totalDeletes:O.totalDeletes,hitsSinceLastSet:O.hitsSinceLastSet,missesSinceLastSet:O.missesSinceLastSet,deletesSinceLastSet:O.deletesSinceLastSet,avgTimeBetweenSetsMs:O.avgTimeBetweenSetsMs??"",avgHitsBetweenSets:O.avgHitsBetweenSets??"",avgMissesBetweenSets:O.avgMissesBetweenSets??"",hitRate:O.hitRate,missRate:O.missRate})))??[],M=((D=x==null?void 0:x.tags)==null?void 0:D.map(O=>({entityType:"tag",tag:O.tag,approxCurrentSizeBytes:O.approxCurrentSizeBytes??"",approxCurrentSizeKB:O.approxCurrentSizeBytes!=null?(O.approxCurrentSizeBytes/1024).toFixed(2):"",totalHits:O.totalHits,totalMisses:O.totalMisses,totalSets:O.totalSets,totalDeletes:O.totalDeletes,avgTimeBetweenSetsMs:O.avgTimeBetweenSetsMs??"",avgHitsBetweenSets:O.avgHitsBetweenSets??"",avgMissesBetweenSets:O.avgMissesBetweenSets??"",hitRate:O.hitRate,missRate:O.missRate})))??[];return[...T,...M]},[x]),P=(x==null?void 0:x.keys)&&x.keys.length>0,j=(x==null?void 0:x.tags)&&x.tags.length>0;if(v||y)return h.jsx(Ma,{variant:"table"});if(b){const T=b instanceof Error?b.message:"Failed to load cache insights.",M=b instanceof Error?b.stack:b?String(b):void 0;return h.jsx(ia,{message:T,details:M,onRetry:()=>w()})}return!x||!((I=x.keys)!=null&&I.length)&&!((A=x.tags)!=null&&A.length)?h.jsx(ji,{title:"No cache insights",description:"Try expanding the time range or relaxing other filters."}):h.jsxs(ue,{spacing:3,children:[h.jsxs(Be,{sx:{borderRadius:1.5,border:"1px solid",borderColor:"divider",px:2,py:1.5,display:"flex",flexDirection:{xs:"column",sm:"row"},gap:2,alignItems:{xs:"flex-start",sm:"center"},justifyContent:"space-between",bgcolor:"background.paper"},children:[h.jsxs(Be,{children:[h.jsx(ne,{variant:"subtitle2",color:"text.secondary",children:"Total approximate current cache size"}),h.jsx(ne,{variant:"h6",sx:{fontFamily:"monospace",mt:.5},children:wTe(k)}),h.jsx(ne,{variant:"caption",color:"text.secondary",sx:{display:"block",mt:.5},children:"Derived from per-key current sizes in the insights window."})]}),h.jsxs(ue,{spacing:1,alignItems:{xs:"flex-start",sm:"flex-end"},children:[h.jsxs(ne,{variant:"caption",color:"text.secondary",children:["Computed at ",ek(x.computedAt)]}),h.jsxs(ue,{direction:"row",spacing:1,flexWrap:"wrap",useFlexGap:!0,children:[x.windowStart&&h.jsx(dr,{size:"small",variant:"outlined",label:`Window start: ${ek(x.windowStart)}`}),x.windowEnd&&h.jsx(dr,{size:"small",variant:"outlined",label:`Window end: ${ek(x.windowEnd)}`})]}),h.jsx(Sf,{filename:"cache-insights.csv",rows:$,title:"Export per-key and per-tag cache insights."})]})]}),P&&h.jsx(gTe,{keys:x.keys}),j&&h.jsx(yTe,{tags:x.tags})]})}function wTe(e){if(!e)return"—";const t=["B","KB","MB","GB"],r=Math.min(Math.floor(Math.log(e)/Math.log(1024)),t.length-1);return`${(e/1024**r).toFixed(2)} ${t[r]}`}function ek(e){if(!e)return"—";try{return new Date(e).toLocaleString()}catch{return"—"}}function Ip(e){if(!e)return"";try{return new Date(e).toISOString()}catch{return""}}function STe({logs:e}){const t=[...e].sort((i,o)=>o.createdAt-i.createdAt),[r,n]=m.useState(null);return h.jsxs(h.Fragment,{children:[h.jsx(oc,{component:Yn,variant:"outlined",children:h.jsxs(nc,{size:"small",sx:{tableLayout:"fixed"},children:[h.jsxs("colgroup",{children:[h.jsx("col",{style:{width:180}})," ",h.jsx("col",{style:{width:220}})," ",h.jsx("col",{style:{width:120}})," ",h.jsx("col",{style:{width:220}})," ",h.jsx("col",{style:{width:100}})," ",h.jsx("col",{})," "]}),h.jsx(ac,{children:h.jsxs(Ii,{children:[h.jsx(Oe,{children:"Timestamp"}),h.jsx(Oe,{children:"Key"}),h.jsx(Oe,{children:"Operation"}),h.jsx(Oe,{children:"Tags"}),h.jsx(Oe,{align:"right",children:"Size"}),h.jsx(Oe,{children:"Value"})]})}),h.jsx(ic,{children:t.map(i=>h.jsxs(Ii,{hover:!0,onClick:()=>n(i),sx:{cursor:"pointer"},children:[h.jsx(Oe,{children:new Date(i.createdAt).toLocaleString()}),h.jsx(Oe,{children:h.jsx(ne,{component:"span",sx:{fontFamily:"monospace",fontSize:"0.9rem",display:"block",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:i.name})}),h.jsx(Oe,{children:h.jsx(lO,{operation:i.operation})}),h.jsx(Oe,{children:i.tags&&i.tags.length>0?h.jsx(ue,{direction:"row",flexWrap:"wrap",spacing:.5,useFlexGap:!0,children:i.tags.map(o=>h.jsx(dr,{label:o,size:"small",variant:"outlined"},o))}):h.jsx(ne,{variant:"body2",color:"text.disabled",component:"span",children:"—"})}),h.jsx(Oe,{align:"right",children:h.jsx(ne,{variant:"body2",component:"span",sx:{fontFamily:"monospace"},children:PTe(i.size)})}),h.jsx(Oe,{children:h.jsx(Be,{sx:{fontFamily:"monospace",fontSize:"0.875rem",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},title:kV(i.value),children:kTe(i.value)})})]},i.id))})]})}),r&&h.jsx(iV,{log:r,onClose:()=>n(null)})]})}function kV(e){if(e==null)return"null";if(typeof e=="string")return e;try{return JSON.stringify(e)}catch{return String(e)}}function kTe(e,t=120){const r=kV(e);return r.length<=t?r:`${r.slice(0,t-1)}…`}function PTe(e){if(!e||!Number.isFinite(e))return"—";const t=["B","KB","MB","GB","TB"],r=Math.min(Math.floor(Math.log(e)/Math.log(1024)),t.length-1);return`${(e/1024**r).toFixed(r===0?0:2)} ${t[r]}`}function $Te({items:e,logs:t,onSelectKey:r}){const[n,i]=m.useState("lastActivity"),[o,a]=m.useState("desc"),s=m.useCallback(v=>{n===v?a(y=>y==="asc"?"desc":"asc"):(i(v),a("asc"))},[n]),u=m.useMemo(()=>{const v=[...e];return v.sort((y,b)=>{const w=n==="key"?y.key.localeCompare(b.key):pL(y,n)-pL(b,n);return o==="asc"?w:-w}),v},[e,n,o]),d=(v,y,b)=>h.jsx(Oe,{sortDirection:n===v?o:!1,align:b,children:h.jsx(Xae,{active:n===v,direction:n===v?o:"asc",onClick:()=>s(v),children:y})}),f=v=>{if(!v)return"—";const y=["B","KB","MB","GB"],b=Math.min(Math.floor(Math.log(v)/Math.log(1024)),y.length-1);return`${(v/1024**b).toFixed(2)} ${y[b]}`},p=m.useMemo(()=>e.reduce((v,y)=>v+(y.sizeBytes??0),0),[e]);return h.jsxs(h.Fragment,{children:[h.jsx(Be,{sx:{mt:2,mb:2},children:h.jsxs(Be,{sx:{borderRadius:1.5,border:"1px solid",borderColor:"divider",px:2,py:1.5,display:"flex",alignItems:"baseline",justifyContent:"space-between",bgcolor:"background.paper"},children:[h.jsxs(Be,{children:[h.jsx(ne,{variant:"subtitle2",color:"text.secondary",children:"Total approximate cache size"}),h.jsx(ne,{variant:"h6",sx:{fontFamily:"monospace",mt:.5},children:f(p)})]}),h.jsxs(ne,{variant:"caption",color:"text.secondary",sx:{opacity:.8},children:["Based on ",t.length," fetched cache entries; actual size may vary."]})]})}),h.jsx(oc,{children:h.jsxs(nc,{size:"small",children:[h.jsx(ac,{children:h.jsxs(Ii,{children:[d("key","Key"),d("lastActivity","Last activity"),d("lastSetAt","Last set"),d("lastHitAt","Last hit"),d("lastMissAt","Last miss"),d("totalHits","Total hits","right"),d("totalMisses","Total misses","right"),d("totalSets","Total sets","right"),d("sizeBytes","Size","right")]})}),h.jsx(ic,{children:u.map((v,y)=>h.jsxs(Ii,{hover:!0,sx:{cursor:r?"pointer":"default"},onClick:()=>r==null?void 0:r(v,y,u.map(b=>({...b}))),children:[h.jsx(Oe,{children:h.jsx(ne,{component:"span",sx:{fontFamily:"monospace",fontSize:"0.9rem"},children:v.key})}),h.jsx(Oe,{children:Sv(PV(v))}),h.jsx(Oe,{children:Sv(v.lastSetAt)}),h.jsx(Oe,{children:Sv(v.lastHitAt)}),h.jsx(Oe,{children:Sv(v.lastMissAt)}),h.jsx(Oe,{align:"right",children:v.totalHits}),h.jsx(Oe,{align:"right",children:v.totalMisses}),h.jsx(Oe,{align:"right",children:v.totalSets}),h.jsx(Oe,{align:"right",children:f(v.sizeBytes||0)})]},v.key))})]})})]})}function Sv(e){if(!e)return"—";try{return new Date(e).toLocaleString()}catch{return"—"}}function pL(e,t){switch(t){case"lastActivity":return PV(e);case"lastSetAt":return e.lastSetAt??0;case"lastHitAt":return e.lastHitAt??0;case"lastMissAt":return e.lastMissAt??0;case"totalHits":return e.totalHits;case"totalMisses":return e.totalMisses;case"totalSets":return e.totalSets;case"sizeBytes":return e.sizeBytes??0;default:return 0}}function PV(e){return Math.max(e.lastSetAt??0,e.lastHitAt??0,e.lastMissAt??0)}const hL={...Pf,operationsInclude:[],operationsExclude:[],keySearch:"",keys:[]};function CTe(){const[e,t]=m.useState("summary"),[r,n]=m.useState(null),[i,o]=m.useState(null),[a,s]=m.useState(null),[u,d]=kf("logsCacheFilters",{defaultValue:hL,serialize:H=>$f(H),deserialize:H=>Cf(H,hL)}),f=rn("GET /__rrroutes/cache",{cursorParam:"cursor",getNextPageParam(H){return H.meta.nextCursor},splitPageSize:500,splitPageSizeParam:"pageSize"}),p=rn("POST /__rrroutes/cache/clear"),{data:v,isLoading:y,error:b,refetch:w,isFetching:x,fetchNextPage:k,hasNextPage:$,isFetchingNextPage:P}=f.useEndpoint({query:u}),j=m.useMemo(()=>v?Array.isArray(v.pages)?v.pages.flatMap(H=>Array.isArray(H==null?void 0:H.out)?H.out:[]):[]:[],[v]),C=m.useMemo(()=>{if(!v)return[];const H=new Map;return j.forEach(X=>{const re=X.name;H.has(re)||H.set(re,{key:X.name,lastSetAt:null,lastHitAt:null,lastMissAt:null,totalHits:0,totalMisses:0,totalSets:0});const he=H.get(re);if(X.operation==="set"?(he.lastSetAt=Math.max(he.lastSetAt??0,X.createdAt),he.totalSets+=1):X.operation==="hit"?(he.lastHitAt=Math.max(he.lastHitAt??0,X.createdAt),he.totalHits+=1):X.operation==="miss"&&(he.lastMissAt=Math.max(he.lastMissAt??0,X.createdAt),he.totalMisses+=1),typeof X.size=="number"){const J=he._sizeSeenAt??0;X.createdAt>=J&&(he.sizeBytes=X.size,he._sizeSeenAt=X.createdAt)}}),Array.from(H.values()).map(({_sizeSeenAt:X,...re})=>re)},[v,j]),I=(u.keySearch??"").trim().toLowerCase(),A=m.useMemo(()=>I?j.filter(H=>(H.name??"").toLowerCase().includes(I)):j,[j,I]),T=m.useMemo(()=>I?C.filter(H=>H.key.toLowerCase().includes(I)):C,[C,I]),M=m.useMemo(()=>{const H=new Set;return C.forEach(X=>H.add(X.key)),Array.from(H).sort((X,re)=>X.localeCompare(re))},[C]),R=m.useMemo(()=>A.map(H=>({timestamp:kv(H.createdAt),operation:H.operation,key:H.name??"",sizeBytes:H.size??"",tags:Array.isArray(H.tags)?H.tags.join(", "):"",valueSummary:ETe(H.value)})),[A]),D=m.useMemo(()=>T.map(H=>({key:H.key,totalHits:H.totalHits,totalMisses:H.totalMisses,totalSets:H.totalSets,lastHitAt:kv(H.lastHitAt),lastMissAt:kv(H.lastMissAt),lastSetAt:kv(H.lastSetAt),sizeBytes:H.sizeBytes??""})),[T]),O=e==="logs"?{filename:"cache-logs.csv",rows:R}:e==="summary"?{filename:"cache-summary.csv",rows:D}:null,L=(a==null?void 0:a.orderedItems[a.index])??null,z=a!==null&&a.index>0,F=a!==null&&a.index<a.orderedItems.length-1,B=m.useCallback((H,X,re)=>{s({orderedItems:re.map(he=>({...he})),index:X})},[]),U=m.useCallback(()=>{s(null)},[]),V=m.useCallback(()=>{s(H=>!H||H.index<=0?H:{...H,index:H.index-1})},[]),K=m.useCallback(()=>{s(H=>!H||H.index>=H.orderedItems.length-1?H:{...H,index:H.index+1})},[]),Z=m.useCallback(H=>{w(),n(`Cache cleared for "${H}"`)},[w]),W=(H,X)=>{d(re=>{const he=new Set(re.operationsInclude),J=new Set(re.operationsExclude);return X==="include"?(he.has(H)?he.delete(H):he.add(H),J.delete(H)):(J.has(H)?J.delete(H):J.add(H),he.delete(H)),{...re,operationsInclude:Array.from(he),operationsExclude:Array.from(J)}})},q=H=>{var X,re;return(X=u.operationsInclude)!=null&&X.includes(H)?"include":(re=u.operationsExclude)!=null&&re.includes(H)?"exclude":"none"},oe=(()=>{if(e==="insights")return h.jsx(xTe,{filters:u});if(y)return h.jsx(Ma,{variant:"table"});if(b){const X=b instanceof Error?b.message:"Failed to load cache logs.",re=b instanceof Error?b.stack:b?String(b):void 0;return h.jsx(ia,{message:X,details:re,onRetry:()=>w()})}if(!j.length)return h.jsx(ji,{title:"No cache logs",description:"Adjust filters or clear the cache."});const H=e==="logs";return H&&!A.length?h.jsx(ji,{title:"No cache logs match",description:"Adjust the key search or filters."}):!H&&!T.length?h.jsx(ji,{title:"No cache keys match",description:"Adjust the key search or filters."}):H?h.jsx(xf,{isLoading:y,data:v,items:A,fetchNextPage:k,hasNextPage:$,isFetchingNextPage:P,pageSize:u.pageSize,children:X=>h.jsx(STe,{logs:X})}):h.jsx($Te,{logs:A,items:T,onSelectKey:B})})(),Y=async()=>{o(null);try{await p.fetch({query:u},void 0),n("Cache cleared"),w()}catch(H){const X=H instanceof Error?H.message:"Failed to clear cache.";o(X)}};return h.jsxs(h.Fragment,{children:[h.jsxs(ue,{spacing:3,sx:{mt:2},children:[h.jsx(_t,{title:"Cache filters",actions:h.jsx(zt,{variant:"outlined",onClick:Y,children:"Clear cache (current filters)"}),children:h.jsx(wf,{value:u,onChange:H=>d(X=>({...X,...H})),onRefresh:()=>w(),refreshing:x,children:H=>h.jsxs(ue,{spacing:2,children:[h.jsxs(ue,{spacing:1,children:[h.jsx(ne,{variant:"overline",color:"text.secondary",children:"Operations"}),h.jsx(ue,{direction:"row",spacing:1,flexWrap:"wrap",useFlexGap:!0,children:R3.map(X=>h.jsx(lO,{operation:X,state:q(X),onClick:()=>W(X,H)},X))})]}),h.jsx(Vt,{label:"Key search",placeholder:"Search cache keys",value:u.keySearch??"",onChange:X=>d(re=>({...re,keySearch:X.target.value})),size:"small",fullWidth:!0}),h.jsx(hl,{multiple:!0,freeSolo:!0,options:M,value:u.keys??[],onChange:(X,re)=>d(he=>({...he,keys:re.map(J=>J.trim()).filter(J=>J.length>0)})),renderTags:(X,re)=>X.map((he,J)=>h.jsx(dr,{size:"small",variant:"outlined",label:he,...re({index:J})})),renderInput:X=>h.jsx(Vt,{...X,label:"Specific keys (exact match)",placeholder:"Add keys",size:"small",helperText:"Filter cache logs server-side for exact keys"})})]})})}),i&&h.jsx(xa,{severity:"error",children:i}),h.jsx(_t,{title:"Cache data",actions:h.jsxs(ue,{direction:"row",spacing:1,alignItems:"center",children:[O&&h.jsx(Sf,{filename:O.filename,rows:O.rows,title:"Exports the data for the current cache view."}),h.jsxs(Ub,{value:e,onChange:(H,X)=>t(X),sx:{minHeight:32},children:[h.jsx(ml,{label:"Logs",value:"logs"}),h.jsx(ml,{label:"Summary",value:"summary"}),h.jsx(ml,{label:"Insights",value:"insights"})]})]}),children:oe})]}),h.jsx(uae,{open:!!r,autoHideDuration:3e3,onClose:()=>n(null),message:r}),h.jsx(nV,{open:!!L,cacheKey:L==null?void 0:L.key,summary:L,baseQuery:u,onClose:U,onPrev:z?V:void 0,onNext:F?K:void 0,onCleared:Z})]})}function kv(e){if(!e)return"";try{return new Date(e).toISOString()}catch{return""}}function jTe(e){if(e==null)return"";if(typeof e=="string")return e;try{return JSON.stringify(e)}catch{return String(e)}}function ETe(e){const t=jTe(e);return t.length<=120?t:`${t.slice(0,119)}…`}function ITe(){const[e,t]=m.useState("application");return h.jsxs(Go,{title:"Logs",subtitle:"Monitor system logs and debugging output.",children:[h.jsxs(Ub,{value:e,onChange:(r,n)=>t(n),children:[h.jsx(ml,{label:"Application",value:"application"}),h.jsx(ml,{label:"Cache",value:"cache"})]}),e==="application"&&h.jsx(sTe,{}),e==="cache"&&h.jsx(CTe,{})]})}function OTe(){return h.jsx(Go,{title:"Page Not Found",subtitle:"The page you're looking for does not exist.",children:h.jsx(ne,{color:"text.secondary",children:"Please double-check the URL or use the navigation to find a destination."})})}function _Te({value:e,onChange:t}){var i;const r=(o,a)=>{t({...e,[o]:a})},n=((i=e.tags)==null?void 0:i.join(", "))??"";return h.jsxs(ue,{spacing:2,children:[h.jsx(ne,{variant:"h6",children:"Preset details"}),h.jsx(Vt,{label:"Name",value:e.name,onChange:o=>r("name",o.target.value),required:!0}),h.jsx(Vt,{label:"Group",value:e.groupId||"",onChange:o=>r("groupId",o.target.value),helperText:"Optional group identifier"}),h.jsx(Vt,{label:"Tags",value:n,onChange:o=>{const a=o.target.value.split(",").map(s=>s.trim()).filter(Boolean);r("tags",a)},helperText:"Comma-separated list"})]})}function ATe({operations:e,onChange:t}){const[r,n]=m.useState({}),[i,o]=m.useState({}),[a,s]=m.useState({}),[u,d]=m.useState({}),[f,p]=m.useState(!1),{fetch:v}=rf();m.useEffect(()=>{const T={};e.forEach((M,R)=>{T[No(R,"body")]=tk(M.body),T[No(R,"query")]=tk(M.query),T[No(R,"extraHeaders")]=tk(M.extraHeaders)}),n(T),o({})},[e]),m.useEffect(()=>{s(T=>{const M={};return e.forEach((R,D)=>{T[D]&&(M[D]=T[D])}),M})},[e]);const y=(T,M)=>{const R=e.map((D,O)=>O===T?{...D,...M}:D);t(R)},b=()=>{const T={name:"",description:"",stepNumber:e.length+1,method:"get",path:"",endpointId:""};t([...e,T])},w=T=>{const M=e.filter((R,D)=>D!==T);t(M)},x=(T,M,R)=>{n(D=>({...D,[No(T,M)]:R}))},k=(T,M)=>{const R=No(T,M),D=r[R]||"";if(!D.trim()){y(T,{[M]:void 0}),o(O=>({...O,[R]:void 0}));return}try{const O=JSON.parse(D);y(T,{[M]:O}),o(L=>({...L,[R]:void 0}))}catch{o(O=>({...O,[R]:"Invalid JSON"}))}},$=m.useMemo(()=>e.map((T,M)=>({op:T,index:M})).sort((T,M)=>{const R=T.op.stepNumber??T.index+1,D=M.op.stepNumber??M.index+1;return R!==D?R-D:T.index-M.index}),[e]),P=(T,M)=>{const R=T+M;if(R<0||R>=$.length)return;const D=$[T],O=$[R],L=D.op.stepNumber??T+1,z=O.op.stepNumber??R+1,F=e.map((B,U)=>U===D.index?{...B,stepNumber:z}:U===O.index?{...B,stepNumber:L}:B);t(F)},j=T=>{d(M=>({...M,[T]:!M[T]}))},C=m.useCallback(async(T,M)=>{const R=e[T];if(!R)return{success:!1};if(!(M!=null&&M.skipConfirm)&&nk(R)&&!window.confirm(`Operation "${R.name||R.path}" may modify data. Continue?`))return{success:!1};if(!R.path.trim())return s(D=>({...D,[T]:{status:"error",errorMessage:"Path is required before running this operation."}})),{success:!1};s(D=>({...D,[T]:{status:"running"}}));try{const D=TTe(R),O=await v(R.method,R.path,D,`preset-run-${T}-${Date.now()}`),L=!O.error&&O.log.status>=200&&O.log.status<400;return s(z=>{var F;return{...z,[T]:{status:L?"success":"error",statusCode:O.log.status,durationMs:O.log.durationMs,errorMessage:(F=O.error)==null?void 0:F.message,response:O.log.output}}}),{success:L}}catch(D){const O=D instanceof Error?D.message:"Failed to run operation.";return s(L=>({...L,[T]:{status:"error",errorMessage:O}})),{success:!1}}},[v,e]),I=m.useCallback(async T=>{await C(T)},[C]),A=m.useCallback(async()=>{if(!(!$.length||$.some(({op:M})=>nk(M))&&!window.confirm("This preset contains operations that may modify or delete data. Run all operations?"))){p(!0);for(const{index:M}of $)if(!(await C(M,{skipConfirm:!0})).success)break;p(!1)}},[C,$]);return h.jsxs(ue,{spacing:2,children:[h.jsxs(ue,{direction:"row",justifyContent:"space-between",alignItems:"center",children:[h.jsx(ne,{variant:"h6",children:"Operations"}),h.jsxs(ue,{direction:"row",spacing:1,children:[h.jsx(zt,{startIcon:h.jsx(cb,{}),variant:"contained",onClick:A,disabled:f||!$.length,children:f?"Running...":"Run all operations"}),h.jsx(zt,{startIcon:h.jsx(cV,{}),variant:"outlined",onClick:b,children:"Add operation"})]})]}),e.length===0&&h.jsx(ne,{color:"text.secondary",children:"No operations defined yet. Add one to start building this preset."}),$.map(({op:T,index:M},R)=>{var D,O;return h.jsxs(ec,{defaultExpanded:!0,children:[h.jsx(rc,{expandIcon:h.jsx(ea,{}),children:h.jsxs(ue,{direction:"row",spacing:2,alignItems:"center",flexWrap:"wrap",sx:{width:"100%"},children:[h.jsxs(ne,{variant:"subtitle1",children:["Operation ",R+1]}),h.jsx(ne,{variant:"body2",color:"text.secondary",children:T.name||"Untitled"}),T.description?h.jsx(ne,{variant:"body2",color:"text.secondary",sx:{fontStyle:"italic"},children:T.description}):null,h.jsx(Be,{sx:{flexGrow:1}}),h.jsx(qn,{size:"small",onClick:L=>{L.stopPropagation(),P(R,-1)},disabled:R===0,children:h.jsx(bV,{fontSize:"small"})}),h.jsx(qn,{size:"small",onClick:L=>{L.stopPropagation(),P(R,1)},disabled:R===$.length-1,children:h.jsx(yV,{fontSize:"small"})}),h.jsx(qn,{onClick:L=>{L.stopPropagation(),w(M)},children:h.jsx(dV,{})})]})}),h.jsx(tc,{children:h.jsxs(ue,{spacing:2,children:[h.jsxs(ue,{direction:{xs:"column",sm:"row"},spacing:2,children:[h.jsx(Vt,{label:"Name",value:T.name||"",onChange:L=>y(M,{name:L.target.value}),fullWidth:!0}),h.jsx(Vt,{type:"number",label:"Step number",value:T.stepNumber??R+1,onChange:L=>y(M,{stepNumber:Number(L.target.value)}),sx:{width:{xs:"100%",sm:160}}})]}),h.jsx(Vt,{label:"Description",value:T.description??"",onChange:L=>y(M,{description:L.target.value}),multiline:!0,minRows:2}),h.jsxs(ue,{direction:{xs:"column",sm:"row"},spacing:2,children:[h.jsx(Vt,{select:!0,label:"Method",value:T.method,onChange:L=>y(M,{method:L.target.value}),sx:{width:{xs:"100%",sm:160}},children:ax.map(L=>h.jsx(el,{value:L,children:L.toUpperCase()},L))}),h.jsx(Vt,{label:"Path",value:T.path,onChange:L=>y(M,{path:L.target.value}),fullWidth:!0})]}),rk({label:"Body",index:M,field:"body",value:r[No(M,"body")]||"",error:i[No(M,"body")],onChange:x,onBlur:k}),rk({label:"Query",index:M,field:"query",value:r[No(M,"query")]||"",error:i[No(M,"query")],onChange:x,onBlur:k}),rk({label:"Extra headers",index:M,field:"extraHeaders",value:r[No(M,"extraHeaders")]||"",error:i[No(M,"extraHeaders")],onChange:x,onBlur:k}),h.jsxs(ue,{spacing:1,children:[h.jsxs(ue,{direction:{xs:"column",sm:"row"},spacing:1,alignItems:{xs:"stretch",sm:"center"},justifyContent:"space-between",children:[h.jsx(zt,{startIcon:h.jsx(cb,{}),variant:"outlined",onClick:()=>I(M),disabled:((D=a[M])==null?void 0:D.status)==="running",children:((O=a[M])==null?void 0:O.status)==="running"?"Running...":"Run this operation"}),nk(T)?h.jsx(ne,{variant:"caption",color:"warning.main",children:"Requires confirmation (potentially destructive)"}):null]}),h.jsx(RTe,{state:a[M],onToggleResponse:()=>j(M),responseVisible:!!u[M]})]})]})})]},`${M}-${T.name}`)})]})}function No(e,t){return`${e}-${t}`}function tk(e){if(e==null)return"";try{return JSON.stringify(e,null,2)}catch{return""}}function rk({label:e,index:t,field:r,value:n,error:i,onChange:o,onBlur:a}){return h.jsx(Vt,{label:e,multiline:!0,minRows:4,value:n,onChange:s=>o(t,r,s.target.value),onBlur:()=>a(t,r),error:!!i,helperText:i||"JSON format",fullWidth:!0})}function TTe(e){return{params:[],query:MTe(e.query),body:e.body?JSON.stringify(e.body,null,2):""}}function MTe(e){return e?Object.entries(e).map(([t,r])=>({key:t,value:r==null?"":String(r),enabled:!0})):[]}function nk(e){return new Set(["delete","patch"]).has(e.method)||/clear|reset|truncate/i.test(e.path)}function RTe({state:e,onToggleResponse:t,responseVisible:r}){if(!e||e.status==="idle")return null;if(e.status==="running")return h.jsx(ne,{variant:"body2",color:"info.main",children:"Running..."});const n=e.status==="success"?"success.main":"error.main";return h.jsxs(ue,{spacing:1,children:[h.jsxs(ue,{direction:"row",spacing:1,alignItems:"center",children:[h.jsx(dr,{size:"small",color:e.status==="success"?"success":"error",label:e.status==="success"?"Success":"Failed"}),h.jsxs(ne,{variant:"body2",color:n,children:["Status ",e.statusCode??"—"," • ",e.durationMs??"—"," ms"]})]}),e.errorMessage?h.jsx(ne,{variant:"body2",color:"error.main",children:e.errorMessage}):null,e.response!==void 0?h.jsxs(ue,{spacing:1,children:[h.jsx(zt,{size:"small",onClick:t,children:r?"Hide response":"View response"}),r?h.jsx(ai,{title:"Response body",value:e.response,collapsedLines:8}):null]}):null]})}function DTe(){const e=na(),{presetId:t}=QL(),r=!t||t==="new",n=rn("GET /__rrroutes/presets"),i=rn("POST /__rrroutes/presets"),o=rn("PUT /__rrroutes/presets"),{data:a,isLoading:s,error:u,refetch:d}=n.useEndpoint({query:{}}),f=m.useMemo(()=>a?Array.isArray(a.pages)?a.pages.flatMap(I=>Array.isArray(I==null?void 0:I.out)?I.out:[]):[]:[],[a]),[p,v]=m.useState(null),[y,b]=m.useState(!1),[w,x]=m.useState(null),[k,$]=m.useState(null);m.useEffect(()=>{if(r){v(zTe());return}if(f.length){const I=f.find(A=>A.id===t);I&&v(I)}},[r,t,f]);const P=I=>{v(I)},j=I=>{p&&v({...p,operations:I})},C=async()=>{if(p){b(!0),x(null),$(null);try{const I={...p,updatedAt:Date.now()};r?await i.fetch(I):await o.fetch(I),$("Preset saved"),setTimeout(()=>e("/presets"),600)}catch(I){const A=I instanceof Error?I.message:"Failed to save preset.";x(A)}finally{b(!1)}}};if(!r&&s)return h.jsx(Go,{title:"Edit preset",children:h.jsx(Ma,{variant:"full"})});if(!r&&u){const I=u instanceof Error?u.message:"Failed to load preset.",A=u instanceof Error?u.stack:u?String(u):void 0;return h.jsx(Go,{title:"Edit preset",children:h.jsx(ia,{message:I,details:A,onRetry:()=>d()})})}return p?h.jsx(Go,{title:r?"New preset":"Edit preset",subtitle:r?"Define the details and operations for your preset.":"Update preset information and operations.",children:h.jsxs(ue,{spacing:3,children:[w&&h.jsx(xa,{severity:"error",children:w}),k&&h.jsx(xa,{severity:"success",children:k}),h.jsx(_t,{title:"Details",children:h.jsx(_Te,{value:p,onChange:P})}),h.jsx(_t,{title:"Operations",children:h.jsx(ATe,{operations:p.operations,onChange:j})}),h.jsx(Be,{sx:{display:"flex",justifyContent:"flex-end"},children:h.jsx(zt,{variant:"contained",onClick:C,disabled:y||!p.name.trim(),children:y?"Saving...":"Save preset"})})]})}):h.jsx(Go,{title:"Edit preset",children:h.jsx(ji,{title:"Preset not found",description:"This preset may have been removed."})})}function zTe(){const e=Date.now();return{id:"",name:"",description:"",groupId:"",tags:[],createdAt:e,updatedAt:e,operations:[]}}function NTe({preset:e,onClick:t}){var r;return h.jsx(cB,{variant:"outlined",sx:{height:"100%"},children:h.jsx(Lre,{onClick:t,sx:{textAlign:"left",p:2,height:"100%",alignItems:"stretch"},children:h.jsxs(ue,{spacing:1.5,children:[h.jsx(ne,{variant:"h6",children:e.name}),e.description&&h.jsx(ne,{variant:"body2",color:"text.secondary",children:e.description}),e.groupId&&h.jsxs(ne,{variant:"body2",color:"text.secondary",children:["Group: ",e.groupId]}),(r=e.tags)!=null&&r.length?h.jsx(ue,{direction:"row",spacing:1,flexWrap:"wrap",useFlexGap:!0,children:e.tags.map(n=>h.jsx(dr,{label:n,size:"small"},n))}):null,h.jsxs(ne,{variant:"body2",color:"text.secondary",children:[e.operations.length," ",e.operations.length===1?"operation":"operations"]}),e.operations.slice(0,3).map((n,i)=>h.jsxs(ne,{variant:"body2",color:"text.secondary",sx:{fontStyle:n.description?"italic":"normal"},children:["• ",n.name||`${n.method.toUpperCase()} ${n.path}`,n.description?` — ${n.description}`:""]},`${n.name}-${i}`))]})})})}const mL={...Pf,searchQuery:"",nameInclude:"",nameExclude:""};function LTe(){const e=na(),[t,r]=kf("presetsFilters",{defaultValue:mL,serialize:$=>$f($),deserialize:$=>Cf($,mL)}),n=rn("GET /__rrroutes/presets",{cursorParam:"cursor",getNextPageParam($){return $.meta.nextCursor}}),{data:i,isLoading:o,error:a,refetch:s,isFetching:u,fetchNextPage:d,hasNextPage:f,isFetchingNextPage:p}=n.useEndpoint({query:t}),v=m.useMemo(()=>i?Array.isArray(i.pages)?i.pages.flatMap($=>Array.isArray($==null?void 0:$.out)?$.out:[]):[]:[],[i]),y=m.useMemo(()=>{const $=(t.searchQuery??"").trim().toLowerCase();return $?v.filter(P=>{var C;return`${P.name} ${((C=P.tags)==null?void 0:C.join(" "))??""}`.toLowerCase().includes($)}):v},[v,t.searchQuery]),b=m.useMemo(()=>y.map($=>({name:$.name,group:$.groupId??"",tags:Array.isArray($.tags)?$.tags.join(", "):"",operations:$.operations.length})),[y]),w=m.useMemo(()=>{const $=new Set;return v.forEach(P=>{var j;return(j=P.tags)==null?void 0:j.forEach(C=>$.add(C))}),Array.from($).sort()},[v]),x=m.useMemo(()=>{const $=new Set;return v.forEach(P=>{P.groupId&&$.add(P.groupId)}),Array.from($).sort()},[v]),k=(()=>{if(o)return h.jsx(Ma,{variant:"table"});if(a){const $=a instanceof Error?a.message:"Failed to load presets.",P=a instanceof Error?a.stack:a?String(a):void 0;return h.jsx(ia,{message:$,details:P,onRetry:()=>s()})}return y.length?h.jsx(xf,{data:i,isLoading:o,items:y,fetchNextPage:d,hasNextPage:f,isFetchingNextPage:p,pageSize:t.pageSize,children:$=>h.jsx(Bo,{container:!0,spacing:2,children:$.map(P=>h.jsx(Bo,{component:"div",children:h.jsx(NTe,{preset:P,onClick:()=>e(`/presets/${P.id}`)})},P.id))})}):h.jsx(ji,{title:"No presets found",description:"Try adjusting your search query or create a new preset."})})();return h.jsx(Go,{title:"Presets",subtitle:"Manage saved request presets for quick access.",actions:h.jsx(zt,{variant:"contained",onClick:()=>e("/presets/new"),children:"New preset"}),children:h.jsxs(ue,{spacing:3,children:[h.jsx(_t,{title:"Filters",children:h.jsx(wf,{value:t,onChange:$=>r(P=>({...P,...$})),tagOptions:w,groupOptions:x,onRefresh:()=>s(),refreshing:u,children:$=>h.jsxs(h.Fragment,{children:[h.jsx(ue,{direction:{xs:"column",sm:"row"},spacing:2,children:h.jsx(Vt,{label:"Name",value:$==="include"?t.nameInclude:t.nameExclude,onChange:P=>r(j=>({...j,[$==="include"?"nameInclude":"nameExclude"]:P.target.value})),size:"small",fullWidth:!0})}),h.jsx(ne,{variant:"body2",color:"text.secondary",sx:{mt:2},children:"Use the base search field to match names and tags locally while the additional filters narrow the server query."})]})})}),h.jsx(_t,{title:"All presets",actions:h.jsx(Sf,{filename:"presets.csv",rows:b,title:"Exports the currently filtered presets."}),children:k})]})})}const gL={...Pf,searchQuery:"",methodsInclude:[],methodsExclude:[],stabilityInclude:[],stabilityExclude:[]};function BTe(){const e=na(),{queuePrefill:t}=sx(),[r,n]=kf("routesFilters",{defaultValue:gL,serialize:z=>$f(z),deserialize:z=>Cf(z,gL)}),[i,o]=_$(),a=i.get("endpointId"),s=m.useRef(null);gV({searchInputRef:s});const u=m.useRef({}),d=rn("GET /__rrroutes/endpoints",{cursorParam:"cursor",getNextPageParam(z){return z.meta.nextCursor}}),{client:f}=rf();f.build(rE.byKey["GET /__rrroutes/endpoints"],{});const{data:p,isLoading:v,error:y,refetch:b,isFetching:w,fetchNextPage:x,hasNextPage:k,isFetchingNextPage:$}=d.useEndpoint({query:r}),P=(p==null?void 0:p.pages.flatMap(z=>z.out))??[],j=m.useMemo(()=>{const z=new Set;return P.forEach(F=>{var B;return(B=F.tags)==null?void 0:B.forEach(U=>z.add(U))}),Array.from(z).sort()},[P]),C=m.useMemo(()=>{const z=new Set;return P.forEach(F=>{F.groupId&&z.add(F.groupId)}),Array.from(z).sort()},[P]),I=m.useMemo(()=>{const z=(r.searchQuery??"").trim().toLowerCase();return P.filter(F=>z?`${F.path} ${F.summary??""}`.toLowerCase().includes(z):!0)},[P,r.searchQuery]),A=m.useMemo(()=>I.map(z=>({method:z.method.toUpperCase(),path:z.path,group:z.groupId??"",stability:z.stability,implemented:z.implemented===!1?"No":"Yes",summary:z.summary??""})),[I]),T=m.useCallback((z,F)=>{F?u.current[z]=F:delete u.current[z]},[]);m.useEffect(()=>{if(!a)return;const z=u.current[a];z&&z.scrollIntoView({behavior:"smooth",block:"start"})},[a]),m.useEffect(()=>{a&&!I.some(z=>z.id===a)&&o(z=>{const F=new URLSearchParams(z);return F.delete("endpointId"),F},{replace:!0})},[a,I,o]);const M=m.useCallback(z=>{o(F=>{const B=new URLSearchParams(F);return a===z?B.delete("endpointId"):B.set("endpointId",z),B})},[a,o]),R=m.useCallback((z,F)=>{t({method:z.method,path:z.path,params:vL(F.params),query:vL(F.query),body:F.body});const{displayId:B}=ad(z.method,z.path);if(!B)return;const U=oh(B,{tab:"playground",layout:"playground"});e(U)},[e,t]),D=y instanceof Error?y.message:"Failed to load endpoints.",O=y instanceof Error?y.stack:y?String(y):void 0,L=v?h.jsx(Ma,{variant:"table"}):y?h.jsx(ia,{message:D,details:O,onRetry:()=>b()}):I.length?h.jsx(xf,{data:p,isLoading:v,items:I,fetchNextPage:x,hasNextPage:k,isFetchingNextPage:$,pageSize:r.pageSize,children:z=>{const F=UTe(z);return h.jsx(ue,{spacing:4,children:F.map(B=>h.jsxs(ue,{spacing:1.5,children:[h.jsxs(ne,{variant:"subtitle2",color:"text.secondary",sx:{textTransform:"capitalize"},children:[B.title," ",h.jsxs(ne,{component:"span",variant:"caption",color:"text.disabled",sx:{ml:.5},children:["(",B.endpoints.length,")"]})]}),h.jsx(ue,{spacing:1,children:B.endpoints.map(U=>h.jsx(FTe,{endpoint:U,expanded:a===U.id,onToggle:M,registerRef:T,onOpenStandalone:R},U.id))})]},B.id))})}}):h.jsx(ji,{title:"No endpoints found",description:"Try adjusting your filters or search query."});return h.jsx(Go,{title:"Endpoints",subtitle:"Browse and filter every endpoint registered with this service.",children:h.jsxs(ue,{spacing:3,children:[h.jsx(_t,{title:"Filters",children:h.jsx(wf,{value:r,onChange:z=>n(F=>({...F,...z})),searchInputRef:s,tagOptions:j,groupOptions:C,onRefresh:()=>b(),refreshing:w,searchOnly:!0})}),h.jsx(_t,{title:"Endpoints",actions:h.jsxs(ue,{direction:"row",spacing:1,alignItems:"center",children:[h.jsx(Sf,{filename:"endpoints.csv",rows:A,title:"Exports the currently filtered endpoints."}),h.jsxs(ne,{variant:"caption",color:"text.secondary",children:[I.length," results"]})]}),children:L})]})})}function FTe({endpoint:e,expanded:t,onToggle:r,registerRef:n,onOpenStandalone:i}){return h.jsxs(ec,{expanded:t,onChange:()=>r(e.id),ref:o=>n(e.id,o),disableGutters:!0,sx:{border:"1px solid",borderColor:t?"primary.main":"divider",borderRadius:2,bgcolor:"background.default","&::before":{display:"none"}},children:[h.jsx(rc,{expandIcon:h.jsx(ea,{}),children:h.jsxs(ue,{spacing:.5,sx:{width:"100%"},children:[h.jsxs(ue,{direction:"row",spacing:1.5,alignItems:"center",children:[h.jsx(bf,{method:e.method}),h.jsx(ne,{sx:{fontFamily:"monospace",flexGrow:1},color:"text.primary",children:e.path}),h.jsx(ne,{variant:"caption",color:"text.secondary",sx:{textTransform:"capitalize"},children:e.stability}),e.implemented===!1&&h.jsx(dr,{label:"Not implemented",size:"small",color:"warning",variant:"outlined"})]}),e.summary&&h.jsx(ne,{variant:"body2",color:"text.secondary",children:e.summary})]})}),h.jsx(tc,{children:t?h.jsx(hV,{endpointId:e.id,onOpenStandalone:i}):null})]})}function UTe(e){const t=new Map;return e.forEach(n=>{var a,s;const i=((a=n.groupId)==null?void 0:a.trim())||"ungrouped",o=((s=n.groupId)==null?void 0:s.trim())||"Ungrouped";t.has(i)||t.set(i,{id:i,title:o,endpoints:[]}),t.get(i).endpoints.push(n)}),Array.from(t.values()).map(n=>({...n,endpoints:n.endpoints.sort((i,o)=>{const a=i.path.localeCompare(o.path);return a!==0?a:i.method.localeCompare(o.method)})})).sort((n,i)=>{const o=n.id==="ungrouped"?"zzzz":n.title.toLowerCase(),a=i.id==="ungrouped"?"zzzz":i.title.toLowerCase();return o.localeCompare(a)})}function vL(e){return e.reduce((t,r)=>(r.enabled&&r.key.trim()&&(t[r.key.trim()]=r.value),t),{})}function WTe(e){const t=rn("GET /__rrroutes/sockets",{cursorParam:"cursor",getNextPageParam(p){return p.meta.nextCursor},splitPageSizeParam:"pageSize",splitPageSize:e.pageSize}),{data:r,isLoading:n,error:i,refetch:o,isFetching:a,fetchNextPage:s,hasNextPage:u,isFetchingNextPage:d}=t.useEndpoint({query:e});return{events:m.useMemo(()=>!r||!Array.isArray(r.pages)?[]:r.pages.flatMap(p=>Array.isArray(p==null?void 0:p.out)?p.out:[]),[r]),data:r,isLoading:n,error:i,refetch:o,isFetching:a,fetchNextPage:s,hasNextPage:u,isFetchingNextPage:d}}function KTe(){const e=rn("POST /__rrroutes/sockets");return{emit:r=>e.fetch(r).then(n=>n.out)}}function HTe({events:e,onSelect:t,onOpenGroup:r}){return h.jsx(oc,{component:Yn,variant:"outlined",children:h.jsxs(nc,{size:"small",children:[h.jsx(ac,{children:h.jsxs(Ii,{children:[h.jsx(Oe,{children:"Timestamp"}),h.jsx(Oe,{children:"Event"}),h.jsx(Oe,{children:"Rooms"}),h.jsx(Oe,{children:"Message"}),h.jsx(Oe,{children:"Tags"}),h.jsx(Oe,{children:"Group"})]})}),h.jsx(ic,{children:e.map(n=>{var i;return h.jsxs(Ii,{hover:!0,sx:{cursor:t?"pointer":"default"},onClick:()=>t==null?void 0:t(n,e),children:[h.jsx(Oe,{children:VTe(n.createdAt)}),h.jsx(Oe,{sx:{maxWidth:200},children:h.jsx(ne,{variant:"body2",noWrap:!0,sx:{fontFamily:"monospace"},children:n.name})}),h.jsx(Oe,{sx:{maxWidth:200},children:qTe(n.toRoomId)}),h.jsx(Oe,{sx:{maxWidth:320},children:GTe(n.message)}),h.jsx(Oe,{children:(i=n.tags)!=null&&i.length?h.jsx(ue,{direction:"row",spacing:.5,flexWrap:"wrap",useFlexGap:!0,children:n.tags.map(o=>h.jsx(dr,{label:o,size:"small"},o))}):h.jsx(ne,{variant:"body2",color:"text.secondary",children:"—"})}),h.jsx(Oe,{children:n.groupId?h.jsx(dr,{label:n.groupId,size:"small",variant:"outlined",sx:{fontFamily:"monospace"},onClick:o=>{o.stopPropagation(),r==null||r(n.groupId,n)}}):h.jsx(ne,{variant:"body2",color:"text.secondary",sx:{fontFamily:"monospace"},noWrap:!0,children:"—"})})]},n.id)})})]})})}function VTe(e){if(!e)return"";try{return new Date(e).toLocaleString()}catch{return""}}function qTe(e){if(!e||e.length===0)return h.jsx(ne,{variant:"body2",color:"text.secondary",children:"—"});const t=e.join(", "),r=t.length>80?`${t.slice(0,80)}…`:t;return r===t?h.jsx(ne,{variant:"body2",noWrap:!0,children:t}):h.jsx(Bh,{title:t,children:h.jsx(ne,{variant:"body2",noWrap:!0,children:r})})}function GTe(e){const t=ZTe(e);if(!t)return h.jsx(ne,{variant:"body2",color:"text.secondary",children:"—"});const r=t.length>120?`${t.slice(0,119)}…`:t;return r===t?h.jsx(ne,{variant:"body2",noWrap:!0,children:t}):h.jsx(Bh,{title:t,children:h.jsx(ne,{variant:"body2",noWrap:!0,children:r})})}function ZTe(e){if(e==null)return"";if(typeof e=="string")return e;try{return JSON.stringify(e)}catch{return String(e)}}const yL={...Pf,eventName:"",roomsInclude:[],roomsExclude:[]};function XTe(){const[e,t]=kf("socketEventsFilters",{defaultValue:yL,serialize:C=>$f(C),deserialize:C=>Cf(C,yL)}),[r,n]=m.useState(null),[i,o]=m.useState(null),{events:a,data:s,isLoading:u,error:d,refetch:f,isFetching:p,fetchNextPage:v,hasNextPage:y,isFetchingNextPage:b}=WTe(e),w=a.length>0,x=m.useMemo(()=>{const C=new Set;return a.forEach(I=>{I.name&&C.add(I.name)}),Array.from(C).sort((I,A)=>I.localeCompare(A))},[a]),k=m.useMemo(()=>{const C=new Set;return a.forEach(I=>{Array.isArray(I.toRoomId)&&I.toRoomId.forEach(A=>{A&&C.add(A)})}),Array.from(C).sort((I,A)=>I.localeCompare(A))},[a]),$=m.useCallback(C=>{n(C)},[]),P=m.useCallback(C=>{C&&(n(null),o(C))},[]),j=(()=>{if(u)return h.jsx(Ma,{variant:"table"});if(d){const C=d instanceof Error?d.message:"Failed to load socket events.",I=d instanceof Error?d.stack:d?String(d):void 0;return h.jsx(ia,{message:C,details:I,onRetry:()=>f()})}return w?h.jsx(xf,{data:s,items:a,isLoading:u,fetchNextPage:v,hasNextPage:y,isFetchingNextPage:b,pageSize:e.pageSize,children:C=>h.jsx(HTe,{events:C,onSelect:I=>$(I),onOpenGroup:I=>P(I)})}):h.jsx(ji,{title:"No socket events",description:"Emit some events from the playground or adjust the filters."})})();return h.jsxs(h.Fragment,{children:[h.jsxs(ue,{spacing:3,sx:{mt:2},children:[h.jsx(_t,{title:"Socket events filters",children:h.jsx(wf,{value:e,onChange:C=>t(I=>({...I,...C})),onRefresh:()=>f(),refreshing:p,children:()=>h.jsxs(ue,{spacing:2,children:[h.jsxs(ue,{spacing:1,children:[h.jsx(ne,{variant:"overline",color:"text.secondary",children:"Event name"}),h.jsx(hl,{freeSolo:!0,options:x,value:e.eventName??"",onChange:(C,I)=>t(A=>({...A,eventName:I??""})),onInputChange:(C,I)=>t(A=>({...A,eventName:I??""})),renderInput:C=>h.jsx(Vt,{...C,label:"Event name",placeholder:"Exact event name",size:"small"})})]}),h.jsxs(ue,{spacing:1,children:[h.jsx(ne,{variant:"overline",color:"text.secondary",children:"Rooms include / exclude"}),h.jsxs(ue,{direction:{xs:"column",sm:"row"},spacing:2,alignItems:{xs:"stretch",sm:"flex-start"},children:[h.jsx(hl,{multiple:!0,freeSolo:!0,options:k,value:e.roomsInclude??[],onChange:(C,I)=>t(A=>({...A,roomsInclude:I.map(T=>T.trim()).filter(T=>T.length>0)})),renderTags:(C,I)=>C.map((A,T)=>h.jsx(dr,{size:"small",variant:"outlined",label:A,...I({index:T})})),renderInput:C=>h.jsx(Vt,{...C,label:"Rooms include",placeholder:"Rooms to include",size:"small"}),sx:{flex:1}}),h.jsx(hl,{multiple:!0,freeSolo:!0,options:k,value:e.roomsExclude??[],onChange:(C,I)=>t(A=>({...A,roomsExclude:I.map(T=>T.trim()).filter(T=>T.length>0)})),renderTags:(C,I)=>C.map((A,T)=>h.jsx(dr,{size:"small",variant:"outlined",label:A,...I({index:T})})),renderInput:C=>h.jsx(Vt,{...C,label:"Rooms exclude",placeholder:"Rooms to exclude",size:"small"}),sx:{flex:1}})]})]})]})})}),h.jsx(_t,{title:"Socket events",children:j})]}),h.jsx(H3,{open:!!r,event:r,onClose:()=>n(null),onOpenGroup:C=>P(C)}),h.jsx(Em,{open:!!i,request:null,requestId:i,onClose:()=>o(null)})]})}function YTe({left:e,right:t,leftWidth:r=35}){const n=Math.min(Math.max(r,10),70);return h.jsxs(Be,{sx:{display:"flex",flexDirection:{xs:"column",md:"row"},gap:3,width:"100%"},children:[h.jsx(Be,{sx:{width:{xs:"100%",md:`${n}%`},flexShrink:0},children:e}),h.jsx(Be,{sx:{width:{xs:"100%",md:`${100-n}%`},flexGrow:1},children:t})]})}function QTe(){const{emit:e}=KTe(),[t,r]=m.useState(""),[n,i]=m.useState(""),[o,a]=m.useState(""),[s,u]=m.useState(null),[d,f]=m.useState(null),[p,v]=m.useState(!1),[y,b]=m.useState(null),[w,x]=m.useState(null),[k,$]=m.useState(null),[P,j]=m.useState(null),[C,I]=m.useState(null),A=async T=>{T.preventDefault(),b(null),x(null),u(null),f(null);const M=t.trim();if(!M){u("Event name is required");return}const R=JTe(n);let D;if(o.trim())try{D=JSON.parse(o)}catch{f("Invalid JSON message");return}const O={eventName:M,message:D,toRoomId:R};v(!0);try{const L=await e(O);$(O),j(L),I(200),x(L!=null&&L.success?`Event emitted successfully${L.eventId?` (eventId: ${L.eventId})`:""}.`:"Event emitted but server reported unsuccessful status.")}catch(L){let z=null,F="Failed to emit event.",B=null;if(L instanceof Jj){if(z=L.status,B=L.body,L.body&&typeof L.body=="object"&&"message"in L.body){const U=L.body.message;typeof U=="string"&&(F=U)}}else L instanceof Error&&(F=L.message);$(O),j(B??L),I(z),b(z?`${F} (status ${z})`:F)}finally{v(!1)}};return h.jsxs(ue,{spacing:3,component:"form",onSubmit:A,children:[h.jsxs(ne,{variant:"body1",color:"text.secondary",children:["Use this playground to emit socket events via the POST"," ",h.jsx("code",{children:"/__rrroutes/sockets"})," endpoint. Provide an event name, an optional list of target rooms, and a JSON message payload."]}),h.jsxs(ue,{spacing:2,children:[h.jsx(Vt,{label:"Event name",value:t,onChange:T=>r(T.target.value),required:!0,fullWidth:!0,error:!!s,helperText:s||"Required. Example: chat.message"}),h.jsx(Vt,{label:"Target rooms",value:n,onChange:T=>i(T.target.value),fullWidth:!0,helperText:"Comma-separated room IDs. Leave empty for broadcast (toRoomId = null)."}),h.jsx(Vt,{label:"Message (JSON)",value:o,onChange:T=>a(T.target.value),multiline:!0,minRows:8,fullWidth:!0,placeholder:'{"text": "Hello from socket playground"}',error:!!d,helperText:d||"Optional JSON payload for the event."})]}),h.jsx(Be,{sx:{display:"flex",justifyContent:"flex-end"},children:h.jsx(zt,{type:"submit",variant:"contained",startIcon:h.jsx(cb,{}),disabled:p,children:p?"Emitting...":"Emit event"})}),y&&h.jsx(xa,{severity:"error",variant:"outlined",children:y}),w&&h.jsx(xa,{severity:"success",variant:"outlined",children:w}),!y&&!w&&h.jsx(ne,{variant:"body2",color:"text.secondary",children:"Emit an event to see the last payload and server response here."}),!!(k||P)&&h.jsx(YTe,{left:h.jsx(ai,{title:"Last emitted payload",value:k??{info:"No payload emitted yet."},collapsedLines:16}),right:h.jsxs(ue,{spacing:1,children:[h.jsxs(ne,{variant:"subtitle2",color:"text.secondary",children:["Server response",C!==null?` (status ${C})`:""]}),h.jsx(ai,{title:"Response body",value:P??{info:"No response recorded yet."},collapsedLines:16})]}),leftWidth:50})]})}function JTe(e){const t=e.trim();if(!t)return null;const r=t.split(",").map(n=>n.trim()).filter(Boolean);return r.length?r:null}function e2e(){return h.jsx(Go,{title:"Sockets",subtitle:"Emit socket events and browse logged socket activity.",children:h.jsxs(ue,{spacing:3,children:[h.jsx(_t,{title:"Socket playground",children:h.jsx(QTe,{})}),h.jsx(XTe,{})]})})}function t2e(){return h.jsx(Cse,{children:h.jsxs(tZ,{children:[h.jsx(Lo,{path:"/",element:h.jsx(oT,{replace:!0,to:"/routes"})}),h.jsx(Lo,{path:"/routes",element:h.jsx(BTe,{})}),h.jsx(Lo,{path:"/routes/:endpointId",element:h.jsx($Ae,{})}),h.jsx(Lo,{path:"/presets",element:h.jsx(LTe,{})}),h.jsx(Lo,{path:"/presets/:presetId",element:h.jsx(DTe,{})}),h.jsx(Lo,{path:"/history",element:h.jsx(nTe,{})}),h.jsx(Lo,{path:"/logs",element:h.jsx(ITe,{})}),h.jsx(Lo,{path:"/sockets",element:h.jsx(e2e,{})}),h.jsx(Lo,{path:"/playground/*",element:h.jsx(oT,{replace:!0,to:"/routes"})}),h.jsx(Lo,{path:"*",element:h.jsx(OTe,{})})]})})}function r2e(){const e=document.getElementById("docs-root");if(e)return e;const t=document.createElement("div");return t.id="docs-root",document.body.appendChild(t),t}function n2e(){const e=document.getElementById("docs-config");if(!e)throw new Error("Docs config element not found");try{return JSON.parse(e.textContent||"{}")}catch(t){throw console.error("Failed to parse docs config",t),t}}const uO=n2e(),i2e=NL({key:"rrroutes-docs",nonce:uO.cspNonce}),o2e=(uO.docsBasePath||"").replace(/\/+$/,"")||"/",a2e=uO.baseUrl||window.location.origin,s2e=r2e();uG.createRoot(s2e).render(h.jsx(J7,{value:i2e,children:h.jsx($Z,{basename:o2e,children:h.jsx(npe,{initialBaseUrl:a2e,children:h.jsx(Cpe,{children:h.jsx(t2e,{})})})})}));