@tonyclaw/llm-inspector 1.7.5 → 1.7.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.output/nitro.json +1 -1
- package/.output/public/assets/{index-BkNsdDqV.js → index-BKkFFKAM.js} +2 -2
- package/.output/public/assets/{main-CC-HN8LQ.js → main-B3Cmykkm.js} +1 -1
- package/.output/server/_ssr/{index-DosJndBx.mjs → index-DAvMem8_.mjs} +2 -2
- package/.output/server/_ssr/index.mjs +2 -2
- package/.output/server/_ssr/{router-4NfH7bm_.mjs → router-tRLZo2WT.mjs} +1 -1
- package/.output/server/{_tanstack-start-manifest_v-CdS0WV2N.mjs → _tanstack-start-manifest_v-_KPj4BcN.mjs} +1 -1
- package/.output/server/index.mjs +24 -24
- package/package.json +1 -1
- package/src/components/providers/ProvidersPanel.tsx +2 -1
package/.output/nitro.json
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{r as _,a as cr,c as yr,g as Di,j as h,R as tt,b as Hl,d as uh}from"./main-CC-HN8LQ.js";function G(e,t,n){function r(a,l){if(a._zod||Object.defineProperty(a,"_zod",{value:{def:l,constr:s,traits:new Set},enumerable:!1}),a._zod.traits.has(e))return;a._zod.traits.add(e),t(a,l);const c=s.prototype,u=Object.keys(c);for(let f=0;f<u.length;f++){const p=u[f];p in a||(a[p]=c[p].bind(a))}}const o=n?.Parent??Object;class i extends o{}Object.defineProperty(i,"name",{value:e});function s(a){var l;const c=n?.Parent?new i:this;r(c,a),(l=c._zod).deferred??(l.deferred=[]);for(const u of c._zod.deferred)u();return c}return Object.defineProperty(s,"init",{value:r}),Object.defineProperty(s,Symbol.hasInstance,{value:a=>n?.Parent&&a instanceof n.Parent?!0:a?._zod?.traits?.has(e)}),Object.defineProperty(s,"name",{value:e}),s}class kn extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class ql extends Error{constructor(t){super(`Encountered unidirectional transform during encode: ${t}`),this.name="ZodEncodeError"}}const Kl={};function Zt(e){return Kl}function Gl(e){const t=Object.values(e).filter(r=>typeof r=="number");return Object.entries(e).filter(([r,o])=>t.indexOf(+r)===-1).map(([r,o])=>o)}function ii(e,t){return typeof t=="bigint"?t.toString():t}function ro(e){return{get value(){{const t=e();return Object.defineProperty(this,"value",{value:t}),t}}}}function Mi(e){return e==null}function Li(e){const t=e.startsWith("^")?1:0,n=e.endsWith("$")?e.length-1:e.length;return e.slice(t,n)}function dh(e,t){const n=(e.toString().split(".")[1]||"").length,r=t.toString();let o=(r.split(".")[1]||"").length;if(o===0&&/\d?e-\d?/.test(r)){const l=r.match(/\d?e-(\d?)/);l?.[1]&&(o=Number.parseInt(l[1]))}const i=n>o?n:o,s=Number.parseInt(e.toFixed(i).replace(".","")),a=Number.parseInt(t.toFixed(i).replace(".",""));return s%a/10**i}const Ls=Symbol("evaluating");function Ne(e,t,n){let r;Object.defineProperty(e,t,{get(){if(r!==Ls)return r===void 0&&(r=Ls,r=n()),r},set(o){Object.defineProperty(e,t,{value:o})},configurable:!0})}function ln(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function Kt(...e){const t={};for(const n of e){const r=Object.getOwnPropertyDescriptors(n);Object.assign(t,r)}return Object.defineProperties({},t)}function Fs(e){return JSON.stringify(e)}function fh(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}const Yl="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function rr(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}const hh=ro(()=>{if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{const e=Function;return new e(""),!0}catch{return!1}});function Nn(e){if(rr(e)===!1)return!1;const t=e.constructor;if(t===void 0||typeof t!="function")return!0;const n=t.prototype;return!(rr(n)===!1||Object.prototype.hasOwnProperty.call(n,"isPrototypeOf")===!1)}function Jl(e){return Nn(e)?{...e}:Array.isArray(e)?[...e]:e}const ph=new Set(["string","number","symbol"]);function An(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Gt(e,t,n){const r=new e._zod.constr(t??e._zod.def);return(!t||n?.parent)&&(r._zod.parent=e),r}function pe(e){const t=e;if(!t)return{};if(typeof t=="string")return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw new Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error=="string"?{...t,error:()=>t.error}:t}function mh(e){return Object.keys(e).filter(t=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}const gh={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]};function xh(e,t){const n=e._zod.def,r=n.checks;if(r&&r.length>0)throw new Error(".pick() cannot be used on object schemas containing refinements");const i=Kt(e._zod.def,{get shape(){const s={};for(const a in t){if(!(a in n.shape))throw new Error(`Unrecognized key: "${a}"`);t[a]&&(s[a]=n.shape[a])}return ln(this,"shape",s),s},checks:[]});return Gt(e,i)}function yh(e,t){const n=e._zod.def,r=n.checks;if(r&&r.length>0)throw new Error(".omit() cannot be used on object schemas containing refinements");const i=Kt(e._zod.def,{get shape(){const s={...e._zod.def.shape};for(const a in t){if(!(a in n.shape))throw new Error(`Unrecognized key: "${a}"`);t[a]&&delete s[a]}return ln(this,"shape",s),s},checks:[]});return Gt(e,i)}function vh(e,t){if(!Nn(t))throw new Error("Invalid input to extend: expected a plain object");const n=e._zod.def.checks;if(n&&n.length>0){const i=e._zod.def.shape;for(const s in t)if(Object.getOwnPropertyDescriptor(i,s)!==void 0)throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}const o=Kt(e._zod.def,{get shape(){const i={...e._zod.def.shape,...t};return ln(this,"shape",i),i}});return Gt(e,o)}function bh(e,t){if(!Nn(t))throw new Error("Invalid input to safeExtend: expected a plain object");const n=Kt(e._zod.def,{get shape(){const r={...e._zod.def.shape,...t};return ln(this,"shape",r),r}});return Gt(e,n)}function wh(e,t){const n=Kt(e._zod.def,{get shape(){const r={...e._zod.def.shape,...t._zod.def.shape};return ln(this,"shape",r),r},get catchall(){return t._zod.def.catchall},checks:[]});return Gt(e,n)}function _h(e,t,n){const o=t._zod.def.checks;if(o&&o.length>0)throw new Error(".partial() cannot be used on object schemas containing refinements");const s=Kt(t._zod.def,{get shape(){const a=t._zod.def.shape,l={...a};if(n)for(const c in n){if(!(c in a))throw new Error(`Unrecognized key: "${c}"`);n[c]&&(l[c]=e?new e({type:"optional",innerType:a[c]}):a[c])}else for(const c in a)l[c]=e?new e({type:"optional",innerType:a[c]}):a[c];return ln(this,"shape",l),l},checks:[]});return Gt(t,s)}function kh(e,t,n){const r=Kt(t._zod.def,{get shape(){const o=t._zod.def.shape,i={...o};if(n)for(const s in n){if(!(s in i))throw new Error(`Unrecognized key: "${s}"`);n[s]&&(i[s]=new e({type:"nonoptional",innerType:o[s]}))}else for(const s in o)i[s]=new e({type:"nonoptional",innerType:o[s]});return ln(this,"shape",i),i}});return Gt(t,r)}function vn(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue!==!0)return!0;return!1}function bn(e,t){return t.map(n=>{var r;return(r=n).path??(r.path=[]),n.path.unshift(e),n})}function vr(e){return typeof e=="string"?e:e?.message}function Vt(e,t,n){const r={...e,path:e.path??[]};if(!e.message){const o=vr(e.inst?._zod.def?.error?.(e))??vr(t?.error?.(e))??vr(n.customError?.(e))??vr(n.localeError?.(e))??"Invalid input";r.message=o}return delete r.inst,delete r.continue,t?.reportInput||delete r.input,r}function Fi(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}function or(...e){const[t,n,r]=e;return typeof t=="string"?{message:t,code:"custom",input:n,inst:r}:{...t}}const Xl=(e,t)=>{e.name="$ZodError",Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),e.message=JSON.stringify(t,ii,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},Ql=G("$ZodError",Xl),ec=G("$ZodError",Xl,{Parent:Error});function Sh(e,t=n=>n.message){const n={},r=[];for(const o of e.issues)o.path.length>0?(n[o.path[0]]=n[o.path[0]]||[],n[o.path[0]].push(t(o))):r.push(t(o));return{formErrors:r,fieldErrors:n}}function Ch(e,t=n=>n.message){const n={_errors:[]},r=o=>{for(const i of o.issues)if(i.code==="invalid_union"&&i.errors.length)i.errors.map(s=>r({issues:s}));else if(i.code==="invalid_key")r({issues:i.issues});else if(i.code==="invalid_element")r({issues:i.issues});else if(i.path.length===0)n._errors.push(t(i));else{let s=n,a=0;for(;a<i.path.length;){const l=i.path[a];a===i.path.length-1?(s[l]=s[l]||{_errors:[]},s[l]._errors.push(t(i))):s[l]=s[l]||{_errors:[]},s=s[l],a++}}};return r(e),n}const $i=e=>(t,n,r,o)=>{const i=r?Object.assign(r,{async:!1}):{async:!1},s=t._zod.run({value:n,issues:[]},i);if(s instanceof Promise)throw new kn;if(s.issues.length){const a=new(o?.Err??e)(s.issues.map(l=>Vt(l,i,Zt())));throw Yl(a,o?.callee),a}return s.value},Bi=e=>async(t,n,r,o)=>{const i=r?Object.assign(r,{async:!0}):{async:!0};let s=t._zod.run({value:n,issues:[]},i);if(s instanceof Promise&&(s=await s),s.issues.length){const a=new(o?.Err??e)(s.issues.map(l=>Vt(l,i,Zt())));throw Yl(a,o?.callee),a}return s.value},oo=e=>(t,n,r)=>{const o=r?{...r,async:!1}:{async:!1},i=t._zod.run({value:n,issues:[]},o);if(i instanceof Promise)throw new kn;return i.issues.length?{success:!1,error:new(e??Ql)(i.issues.map(s=>Vt(s,o,Zt())))}:{success:!0,data:i.value}},Eh=oo(ec),io=e=>async(t,n,r)=>{const o=r?Object.assign(r,{async:!0}):{async:!0};let i=t._zod.run({value:n,issues:[]},o);return i instanceof Promise&&(i=await i),i.issues.length?{success:!1,error:new e(i.issues.map(s=>Vt(s,o,Zt())))}:{success:!0,data:i.value}},Th=io(ec),Nh=e=>(t,n,r)=>{const o=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return $i(e)(t,n,o)},Ah=e=>(t,n,r)=>$i(e)(t,n,r),zh=e=>async(t,n,r)=>{const o=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return Bi(e)(t,n,o)},Ih=e=>async(t,n,r)=>Bi(e)(t,n,r),jh=e=>(t,n,r)=>{const o=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return oo(e)(t,n,o)},Ph=e=>(t,n,r)=>oo(e)(t,n,r),Oh=e=>async(t,n,r)=>{const o=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return io(e)(t,n,o)},Rh=e=>async(t,n,r)=>io(e)(t,n,r),Dh=/^[cC][^\s-]{8,}$/,Mh=/^[0-9a-z]+$/,Lh=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,Fh=/^[0-9a-vA-V]{20}$/,$h=/^[A-Za-z0-9]{27}$/,Bh=/^[a-zA-Z0-9_-]{21}$/,Uh=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,Zh=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,$s=e=>e?new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,Vh=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,Wh="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function Hh(){return new RegExp(Wh,"u")}const qh=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,Kh=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,Gh=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,Yh=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,Jh=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,tc=/^[A-Za-z0-9_-]*$/,Xh=/^\+[1-9]\d{6,14}$/,nc="(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))",Qh=new RegExp(`^${nc}$`);function rc(e){const t="(?:[01]\\d|2[0-3]):[0-5]\\d";return typeof e.precision=="number"?e.precision===-1?`${t}`:e.precision===0?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function ep(e){return new RegExp(`^${rc(e)}$`)}function tp(e){const t=rc({precision:e.precision}),n=["Z"];e.local&&n.push(""),e.offset&&n.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");const r=`${t}(?:${n.join("|")})`;return new RegExp(`^${nc}T(?:${r})$`)}const np=e=>{const t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${t}$`)},rp=/^-?\d+$/,oc=/^-?\d+(?:\.\d+)?$/,op=/^(?:true|false)$/i,ip=/^null$/i,sp=/^[^A-Z]*$/,ap=/^[^a-z]*$/,rt=G("$ZodCheck",(e,t)=>{var n;e._zod??(e._zod={}),e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),ic={number:"number",bigint:"bigint",object:"date"},sc=G("$ZodCheckLessThan",(e,t)=>{rt.init(e,t);const n=ic[typeof t.value];e._zod.onattach.push(r=>{const o=r._zod.bag,i=(t.inclusive?o.maximum:o.exclusiveMaximum)??Number.POSITIVE_INFINITY;t.value<i&&(t.inclusive?o.maximum=t.value:o.exclusiveMaximum=t.value)}),e._zod.check=r=>{(t.inclusive?r.value<=t.value:r.value<t.value)||r.issues.push({origin:n,code:"too_big",maximum:typeof t.value=="object"?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),ac=G("$ZodCheckGreaterThan",(e,t)=>{rt.init(e,t);const n=ic[typeof t.value];e._zod.onattach.push(r=>{const o=r._zod.bag,i=(t.inclusive?o.minimum:o.exclusiveMinimum)??Number.NEGATIVE_INFINITY;t.value>i&&(t.inclusive?o.minimum=t.value:o.exclusiveMinimum=t.value)}),e._zod.check=r=>{(t.inclusive?r.value>=t.value:r.value>t.value)||r.issues.push({origin:n,code:"too_small",minimum:typeof t.value=="object"?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),lp=G("$ZodCheckMultipleOf",(e,t)=>{rt.init(e,t),e._zod.onattach.push(n=>{var r;(r=n._zod.bag).multipleOf??(r.multipleOf=t.value)}),e._zod.check=n=>{if(typeof n.value!=typeof t.value)throw new Error("Cannot mix number and bigint in multiple_of check.");(typeof n.value=="bigint"?n.value%t.value===BigInt(0):dh(n.value,t.value)===0)||n.issues.push({origin:typeof n.value,code:"not_multiple_of",divisor:t.value,input:n.value,inst:e,continue:!t.abort})}}),cp=G("$ZodCheckNumberFormat",(e,t)=>{rt.init(e,t),t.format=t.format||"float64";const n=t.format?.includes("int"),r=n?"int":"number",[o,i]=gh[t.format];e._zod.onattach.push(s=>{const a=s._zod.bag;a.format=t.format,a.minimum=o,a.maximum=i,n&&(a.pattern=rp)}),e._zod.check=s=>{const a=s.value;if(n){if(!Number.isInteger(a)){s.issues.push({expected:r,format:t.format,code:"invalid_type",continue:!1,input:a,inst:e});return}if(!Number.isSafeInteger(a)){a>0?s.issues.push({input:a,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:r,inclusive:!0,continue:!t.abort}):s.issues.push({input:a,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:r,inclusive:!0,continue:!t.abort});return}}a<o&&s.issues.push({origin:"number",input:a,code:"too_small",minimum:o,inclusive:!0,inst:e,continue:!t.abort}),a>i&&s.issues.push({origin:"number",input:a,code:"too_big",maximum:i,inclusive:!0,inst:e,continue:!t.abort})}}),up=G("$ZodCheckMaxLength",(e,t)=>{var n;rt.init(e,t),(n=e._zod.def).when??(n.when=r=>{const o=r.value;return!Mi(o)&&o.length!==void 0}),e._zod.onattach.push(r=>{const o=r._zod.bag.maximum??Number.POSITIVE_INFINITY;t.maximum<o&&(r._zod.bag.maximum=t.maximum)}),e._zod.check=r=>{const o=r.value;if(o.length<=t.maximum)return;const s=Fi(o);r.issues.push({origin:s,code:"too_big",maximum:t.maximum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),dp=G("$ZodCheckMinLength",(e,t)=>{var n;rt.init(e,t),(n=e._zod.def).when??(n.when=r=>{const o=r.value;return!Mi(o)&&o.length!==void 0}),e._zod.onattach.push(r=>{const o=r._zod.bag.minimum??Number.NEGATIVE_INFINITY;t.minimum>o&&(r._zod.bag.minimum=t.minimum)}),e._zod.check=r=>{const o=r.value;if(o.length>=t.minimum)return;const s=Fi(o);r.issues.push({origin:s,code:"too_small",minimum:t.minimum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),fp=G("$ZodCheckLengthEquals",(e,t)=>{var n;rt.init(e,t),(n=e._zod.def).when??(n.when=r=>{const o=r.value;return!Mi(o)&&o.length!==void 0}),e._zod.onattach.push(r=>{const o=r._zod.bag;o.minimum=t.length,o.maximum=t.length,o.length=t.length}),e._zod.check=r=>{const o=r.value,i=o.length;if(i===t.length)return;const s=Fi(o),a=i>t.length;r.issues.push({origin:s,...a?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:r.value,inst:e,continue:!t.abort})}}),so=G("$ZodCheckStringFormat",(e,t)=>{var n,r;rt.init(e,t),e._zod.onattach.push(o=>{const i=o._zod.bag;i.format=t.format,t.pattern&&(i.patterns??(i.patterns=new Set),i.patterns.add(t.pattern))}),t.pattern?(n=e._zod).check??(n.check=o=>{t.pattern.lastIndex=0,!t.pattern.test(o.value)&&o.issues.push({origin:"string",code:"invalid_format",format:t.format,input:o.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(r=e._zod).check??(r.check=()=>{})}),hp=G("$ZodCheckRegex",(e,t)=>{so.init(e,t),e._zod.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:"string",code:"invalid_format",format:"regex",input:n.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),pp=G("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=sp),so.init(e,t)}),mp=G("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=ap),so.init(e,t)}),gp=G("$ZodCheckIncludes",(e,t)=>{rt.init(e,t);const n=An(t.includes),r=new RegExp(typeof t.position=="number"?`^.{${t.position}}${n}`:n);t.pattern=r,e._zod.onattach.push(o=>{const i=o._zod.bag;i.patterns??(i.patterns=new Set),i.patterns.add(r)}),e._zod.check=o=>{o.value.includes(t.includes,t.position)||o.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:o.value,inst:e,continue:!t.abort})}}),xp=G("$ZodCheckStartsWith",(e,t)=>{rt.init(e,t);const n=new RegExp(`^${An(t.prefix)}.*`);t.pattern??(t.pattern=n),e._zod.onattach.push(r=>{const o=r._zod.bag;o.patterns??(o.patterns=new Set),o.patterns.add(n)}),e._zod.check=r=>{r.value.startsWith(t.prefix)||r.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:r.value,inst:e,continue:!t.abort})}}),yp=G("$ZodCheckEndsWith",(e,t)=>{rt.init(e,t);const n=new RegExp(`.*${An(t.suffix)}$`);t.pattern??(t.pattern=n),e._zod.onattach.push(r=>{const o=r._zod.bag;o.patterns??(o.patterns=new Set),o.patterns.add(n)}),e._zod.check=r=>{r.value.endsWith(t.suffix)||r.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:r.value,inst:e,continue:!t.abort})}}),vp=G("$ZodCheckOverwrite",(e,t)=>{rt.init(e,t),e._zod.check=n=>{n.value=t.tx(n.value)}});class bp{constructor(t=[]){this.content=[],this.indent=0,this&&(this.args=t)}indented(t){this.indent+=1,t(this),this.indent-=1}write(t){if(typeof t=="function"){t(this,{execution:"sync"}),t(this,{execution:"async"});return}const r=t.split(`
|
|
1
|
+
import{r as _,a as cr,c as yr,g as Di,j as h,R as tt,b as Hl,d as uh}from"./main-B3Cmykkm.js";function G(e,t,n){function r(a,l){if(a._zod||Object.defineProperty(a,"_zod",{value:{def:l,constr:s,traits:new Set},enumerable:!1}),a._zod.traits.has(e))return;a._zod.traits.add(e),t(a,l);const c=s.prototype,u=Object.keys(c);for(let f=0;f<u.length;f++){const p=u[f];p in a||(a[p]=c[p].bind(a))}}const o=n?.Parent??Object;class i extends o{}Object.defineProperty(i,"name",{value:e});function s(a){var l;const c=n?.Parent?new i:this;r(c,a),(l=c._zod).deferred??(l.deferred=[]);for(const u of c._zod.deferred)u();return c}return Object.defineProperty(s,"init",{value:r}),Object.defineProperty(s,Symbol.hasInstance,{value:a=>n?.Parent&&a instanceof n.Parent?!0:a?._zod?.traits?.has(e)}),Object.defineProperty(s,"name",{value:e}),s}class kn extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class ql extends Error{constructor(t){super(`Encountered unidirectional transform during encode: ${t}`),this.name="ZodEncodeError"}}const Kl={};function Zt(e){return Kl}function Gl(e){const t=Object.values(e).filter(r=>typeof r=="number");return Object.entries(e).filter(([r,o])=>t.indexOf(+r)===-1).map(([r,o])=>o)}function ii(e,t){return typeof t=="bigint"?t.toString():t}function ro(e){return{get value(){{const t=e();return Object.defineProperty(this,"value",{value:t}),t}}}}function Mi(e){return e==null}function Li(e){const t=e.startsWith("^")?1:0,n=e.endsWith("$")?e.length-1:e.length;return e.slice(t,n)}function dh(e,t){const n=(e.toString().split(".")[1]||"").length,r=t.toString();let o=(r.split(".")[1]||"").length;if(o===0&&/\d?e-\d?/.test(r)){const l=r.match(/\d?e-(\d?)/);l?.[1]&&(o=Number.parseInt(l[1]))}const i=n>o?n:o,s=Number.parseInt(e.toFixed(i).replace(".","")),a=Number.parseInt(t.toFixed(i).replace(".",""));return s%a/10**i}const Ls=Symbol("evaluating");function Ne(e,t,n){let r;Object.defineProperty(e,t,{get(){if(r!==Ls)return r===void 0&&(r=Ls,r=n()),r},set(o){Object.defineProperty(e,t,{value:o})},configurable:!0})}function ln(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function Kt(...e){const t={};for(const n of e){const r=Object.getOwnPropertyDescriptors(n);Object.assign(t,r)}return Object.defineProperties({},t)}function Fs(e){return JSON.stringify(e)}function fh(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}const Yl="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function rr(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}const hh=ro(()=>{if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{const e=Function;return new e(""),!0}catch{return!1}});function Nn(e){if(rr(e)===!1)return!1;const t=e.constructor;if(t===void 0||typeof t!="function")return!0;const n=t.prototype;return!(rr(n)===!1||Object.prototype.hasOwnProperty.call(n,"isPrototypeOf")===!1)}function Jl(e){return Nn(e)?{...e}:Array.isArray(e)?[...e]:e}const ph=new Set(["string","number","symbol"]);function An(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Gt(e,t,n){const r=new e._zod.constr(t??e._zod.def);return(!t||n?.parent)&&(r._zod.parent=e),r}function pe(e){const t=e;if(!t)return{};if(typeof t=="string")return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw new Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error=="string"?{...t,error:()=>t.error}:t}function mh(e){return Object.keys(e).filter(t=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}const gh={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]};function xh(e,t){const n=e._zod.def,r=n.checks;if(r&&r.length>0)throw new Error(".pick() cannot be used on object schemas containing refinements");const i=Kt(e._zod.def,{get shape(){const s={};for(const a in t){if(!(a in n.shape))throw new Error(`Unrecognized key: "${a}"`);t[a]&&(s[a]=n.shape[a])}return ln(this,"shape",s),s},checks:[]});return Gt(e,i)}function yh(e,t){const n=e._zod.def,r=n.checks;if(r&&r.length>0)throw new Error(".omit() cannot be used on object schemas containing refinements");const i=Kt(e._zod.def,{get shape(){const s={...e._zod.def.shape};for(const a in t){if(!(a in n.shape))throw new Error(`Unrecognized key: "${a}"`);t[a]&&delete s[a]}return ln(this,"shape",s),s},checks:[]});return Gt(e,i)}function vh(e,t){if(!Nn(t))throw new Error("Invalid input to extend: expected a plain object");const n=e._zod.def.checks;if(n&&n.length>0){const i=e._zod.def.shape;for(const s in t)if(Object.getOwnPropertyDescriptor(i,s)!==void 0)throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}const o=Kt(e._zod.def,{get shape(){const i={...e._zod.def.shape,...t};return ln(this,"shape",i),i}});return Gt(e,o)}function bh(e,t){if(!Nn(t))throw new Error("Invalid input to safeExtend: expected a plain object");const n=Kt(e._zod.def,{get shape(){const r={...e._zod.def.shape,...t};return ln(this,"shape",r),r}});return Gt(e,n)}function wh(e,t){const n=Kt(e._zod.def,{get shape(){const r={...e._zod.def.shape,...t._zod.def.shape};return ln(this,"shape",r),r},get catchall(){return t._zod.def.catchall},checks:[]});return Gt(e,n)}function _h(e,t,n){const o=t._zod.def.checks;if(o&&o.length>0)throw new Error(".partial() cannot be used on object schemas containing refinements");const s=Kt(t._zod.def,{get shape(){const a=t._zod.def.shape,l={...a};if(n)for(const c in n){if(!(c in a))throw new Error(`Unrecognized key: "${c}"`);n[c]&&(l[c]=e?new e({type:"optional",innerType:a[c]}):a[c])}else for(const c in a)l[c]=e?new e({type:"optional",innerType:a[c]}):a[c];return ln(this,"shape",l),l},checks:[]});return Gt(t,s)}function kh(e,t,n){const r=Kt(t._zod.def,{get shape(){const o=t._zod.def.shape,i={...o};if(n)for(const s in n){if(!(s in i))throw new Error(`Unrecognized key: "${s}"`);n[s]&&(i[s]=new e({type:"nonoptional",innerType:o[s]}))}else for(const s in o)i[s]=new e({type:"nonoptional",innerType:o[s]});return ln(this,"shape",i),i}});return Gt(t,r)}function vn(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue!==!0)return!0;return!1}function bn(e,t){return t.map(n=>{var r;return(r=n).path??(r.path=[]),n.path.unshift(e),n})}function vr(e){return typeof e=="string"?e:e?.message}function Vt(e,t,n){const r={...e,path:e.path??[]};if(!e.message){const o=vr(e.inst?._zod.def?.error?.(e))??vr(t?.error?.(e))??vr(n.customError?.(e))??vr(n.localeError?.(e))??"Invalid input";r.message=o}return delete r.inst,delete r.continue,t?.reportInput||delete r.input,r}function Fi(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}function or(...e){const[t,n,r]=e;return typeof t=="string"?{message:t,code:"custom",input:n,inst:r}:{...t}}const Xl=(e,t)=>{e.name="$ZodError",Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),e.message=JSON.stringify(t,ii,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},Ql=G("$ZodError",Xl),ec=G("$ZodError",Xl,{Parent:Error});function Sh(e,t=n=>n.message){const n={},r=[];for(const o of e.issues)o.path.length>0?(n[o.path[0]]=n[o.path[0]]||[],n[o.path[0]].push(t(o))):r.push(t(o));return{formErrors:r,fieldErrors:n}}function Ch(e,t=n=>n.message){const n={_errors:[]},r=o=>{for(const i of o.issues)if(i.code==="invalid_union"&&i.errors.length)i.errors.map(s=>r({issues:s}));else if(i.code==="invalid_key")r({issues:i.issues});else if(i.code==="invalid_element")r({issues:i.issues});else if(i.path.length===0)n._errors.push(t(i));else{let s=n,a=0;for(;a<i.path.length;){const l=i.path[a];a===i.path.length-1?(s[l]=s[l]||{_errors:[]},s[l]._errors.push(t(i))):s[l]=s[l]||{_errors:[]},s=s[l],a++}}};return r(e),n}const $i=e=>(t,n,r,o)=>{const i=r?Object.assign(r,{async:!1}):{async:!1},s=t._zod.run({value:n,issues:[]},i);if(s instanceof Promise)throw new kn;if(s.issues.length){const a=new(o?.Err??e)(s.issues.map(l=>Vt(l,i,Zt())));throw Yl(a,o?.callee),a}return s.value},Bi=e=>async(t,n,r,o)=>{const i=r?Object.assign(r,{async:!0}):{async:!0};let s=t._zod.run({value:n,issues:[]},i);if(s instanceof Promise&&(s=await s),s.issues.length){const a=new(o?.Err??e)(s.issues.map(l=>Vt(l,i,Zt())));throw Yl(a,o?.callee),a}return s.value},oo=e=>(t,n,r)=>{const o=r?{...r,async:!1}:{async:!1},i=t._zod.run({value:n,issues:[]},o);if(i instanceof Promise)throw new kn;return i.issues.length?{success:!1,error:new(e??Ql)(i.issues.map(s=>Vt(s,o,Zt())))}:{success:!0,data:i.value}},Eh=oo(ec),io=e=>async(t,n,r)=>{const o=r?Object.assign(r,{async:!0}):{async:!0};let i=t._zod.run({value:n,issues:[]},o);return i instanceof Promise&&(i=await i),i.issues.length?{success:!1,error:new e(i.issues.map(s=>Vt(s,o,Zt())))}:{success:!0,data:i.value}},Th=io(ec),Nh=e=>(t,n,r)=>{const o=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return $i(e)(t,n,o)},Ah=e=>(t,n,r)=>$i(e)(t,n,r),zh=e=>async(t,n,r)=>{const o=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return Bi(e)(t,n,o)},Ih=e=>async(t,n,r)=>Bi(e)(t,n,r),jh=e=>(t,n,r)=>{const o=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return oo(e)(t,n,o)},Ph=e=>(t,n,r)=>oo(e)(t,n,r),Oh=e=>async(t,n,r)=>{const o=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return io(e)(t,n,o)},Rh=e=>async(t,n,r)=>io(e)(t,n,r),Dh=/^[cC][^\s-]{8,}$/,Mh=/^[0-9a-z]+$/,Lh=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,Fh=/^[0-9a-vA-V]{20}$/,$h=/^[A-Za-z0-9]{27}$/,Bh=/^[a-zA-Z0-9_-]{21}$/,Uh=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,Zh=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,$s=e=>e?new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,Vh=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,Wh="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function Hh(){return new RegExp(Wh,"u")}const qh=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,Kh=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,Gh=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,Yh=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,Jh=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,tc=/^[A-Za-z0-9_-]*$/,Xh=/^\+[1-9]\d{6,14}$/,nc="(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))",Qh=new RegExp(`^${nc}$`);function rc(e){const t="(?:[01]\\d|2[0-3]):[0-5]\\d";return typeof e.precision=="number"?e.precision===-1?`${t}`:e.precision===0?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function ep(e){return new RegExp(`^${rc(e)}$`)}function tp(e){const t=rc({precision:e.precision}),n=["Z"];e.local&&n.push(""),e.offset&&n.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");const r=`${t}(?:${n.join("|")})`;return new RegExp(`^${nc}T(?:${r})$`)}const np=e=>{const t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${t}$`)},rp=/^-?\d+$/,oc=/^-?\d+(?:\.\d+)?$/,op=/^(?:true|false)$/i,ip=/^null$/i,sp=/^[^A-Z]*$/,ap=/^[^a-z]*$/,rt=G("$ZodCheck",(e,t)=>{var n;e._zod??(e._zod={}),e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),ic={number:"number",bigint:"bigint",object:"date"},sc=G("$ZodCheckLessThan",(e,t)=>{rt.init(e,t);const n=ic[typeof t.value];e._zod.onattach.push(r=>{const o=r._zod.bag,i=(t.inclusive?o.maximum:o.exclusiveMaximum)??Number.POSITIVE_INFINITY;t.value<i&&(t.inclusive?o.maximum=t.value:o.exclusiveMaximum=t.value)}),e._zod.check=r=>{(t.inclusive?r.value<=t.value:r.value<t.value)||r.issues.push({origin:n,code:"too_big",maximum:typeof t.value=="object"?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),ac=G("$ZodCheckGreaterThan",(e,t)=>{rt.init(e,t);const n=ic[typeof t.value];e._zod.onattach.push(r=>{const o=r._zod.bag,i=(t.inclusive?o.minimum:o.exclusiveMinimum)??Number.NEGATIVE_INFINITY;t.value>i&&(t.inclusive?o.minimum=t.value:o.exclusiveMinimum=t.value)}),e._zod.check=r=>{(t.inclusive?r.value>=t.value:r.value>t.value)||r.issues.push({origin:n,code:"too_small",minimum:typeof t.value=="object"?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),lp=G("$ZodCheckMultipleOf",(e,t)=>{rt.init(e,t),e._zod.onattach.push(n=>{var r;(r=n._zod.bag).multipleOf??(r.multipleOf=t.value)}),e._zod.check=n=>{if(typeof n.value!=typeof t.value)throw new Error("Cannot mix number and bigint in multiple_of check.");(typeof n.value=="bigint"?n.value%t.value===BigInt(0):dh(n.value,t.value)===0)||n.issues.push({origin:typeof n.value,code:"not_multiple_of",divisor:t.value,input:n.value,inst:e,continue:!t.abort})}}),cp=G("$ZodCheckNumberFormat",(e,t)=>{rt.init(e,t),t.format=t.format||"float64";const n=t.format?.includes("int"),r=n?"int":"number",[o,i]=gh[t.format];e._zod.onattach.push(s=>{const a=s._zod.bag;a.format=t.format,a.minimum=o,a.maximum=i,n&&(a.pattern=rp)}),e._zod.check=s=>{const a=s.value;if(n){if(!Number.isInteger(a)){s.issues.push({expected:r,format:t.format,code:"invalid_type",continue:!1,input:a,inst:e});return}if(!Number.isSafeInteger(a)){a>0?s.issues.push({input:a,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:r,inclusive:!0,continue:!t.abort}):s.issues.push({input:a,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:r,inclusive:!0,continue:!t.abort});return}}a<o&&s.issues.push({origin:"number",input:a,code:"too_small",minimum:o,inclusive:!0,inst:e,continue:!t.abort}),a>i&&s.issues.push({origin:"number",input:a,code:"too_big",maximum:i,inclusive:!0,inst:e,continue:!t.abort})}}),up=G("$ZodCheckMaxLength",(e,t)=>{var n;rt.init(e,t),(n=e._zod.def).when??(n.when=r=>{const o=r.value;return!Mi(o)&&o.length!==void 0}),e._zod.onattach.push(r=>{const o=r._zod.bag.maximum??Number.POSITIVE_INFINITY;t.maximum<o&&(r._zod.bag.maximum=t.maximum)}),e._zod.check=r=>{const o=r.value;if(o.length<=t.maximum)return;const s=Fi(o);r.issues.push({origin:s,code:"too_big",maximum:t.maximum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),dp=G("$ZodCheckMinLength",(e,t)=>{var n;rt.init(e,t),(n=e._zod.def).when??(n.when=r=>{const o=r.value;return!Mi(o)&&o.length!==void 0}),e._zod.onattach.push(r=>{const o=r._zod.bag.minimum??Number.NEGATIVE_INFINITY;t.minimum>o&&(r._zod.bag.minimum=t.minimum)}),e._zod.check=r=>{const o=r.value;if(o.length>=t.minimum)return;const s=Fi(o);r.issues.push({origin:s,code:"too_small",minimum:t.minimum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),fp=G("$ZodCheckLengthEquals",(e,t)=>{var n;rt.init(e,t),(n=e._zod.def).when??(n.when=r=>{const o=r.value;return!Mi(o)&&o.length!==void 0}),e._zod.onattach.push(r=>{const o=r._zod.bag;o.minimum=t.length,o.maximum=t.length,o.length=t.length}),e._zod.check=r=>{const o=r.value,i=o.length;if(i===t.length)return;const s=Fi(o),a=i>t.length;r.issues.push({origin:s,...a?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:r.value,inst:e,continue:!t.abort})}}),so=G("$ZodCheckStringFormat",(e,t)=>{var n,r;rt.init(e,t),e._zod.onattach.push(o=>{const i=o._zod.bag;i.format=t.format,t.pattern&&(i.patterns??(i.patterns=new Set),i.patterns.add(t.pattern))}),t.pattern?(n=e._zod).check??(n.check=o=>{t.pattern.lastIndex=0,!t.pattern.test(o.value)&&o.issues.push({origin:"string",code:"invalid_format",format:t.format,input:o.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(r=e._zod).check??(r.check=()=>{})}),hp=G("$ZodCheckRegex",(e,t)=>{so.init(e,t),e._zod.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:"string",code:"invalid_format",format:"regex",input:n.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),pp=G("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=sp),so.init(e,t)}),mp=G("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=ap),so.init(e,t)}),gp=G("$ZodCheckIncludes",(e,t)=>{rt.init(e,t);const n=An(t.includes),r=new RegExp(typeof t.position=="number"?`^.{${t.position}}${n}`:n);t.pattern=r,e._zod.onattach.push(o=>{const i=o._zod.bag;i.patterns??(i.patterns=new Set),i.patterns.add(r)}),e._zod.check=o=>{o.value.includes(t.includes,t.position)||o.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:o.value,inst:e,continue:!t.abort})}}),xp=G("$ZodCheckStartsWith",(e,t)=>{rt.init(e,t);const n=new RegExp(`^${An(t.prefix)}.*`);t.pattern??(t.pattern=n),e._zod.onattach.push(r=>{const o=r._zod.bag;o.patterns??(o.patterns=new Set),o.patterns.add(n)}),e._zod.check=r=>{r.value.startsWith(t.prefix)||r.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:r.value,inst:e,continue:!t.abort})}}),yp=G("$ZodCheckEndsWith",(e,t)=>{rt.init(e,t);const n=new RegExp(`.*${An(t.suffix)}$`);t.pattern??(t.pattern=n),e._zod.onattach.push(r=>{const o=r._zod.bag;o.patterns??(o.patterns=new Set),o.patterns.add(n)}),e._zod.check=r=>{r.value.endsWith(t.suffix)||r.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:r.value,inst:e,continue:!t.abort})}}),vp=G("$ZodCheckOverwrite",(e,t)=>{rt.init(e,t),e._zod.check=n=>{n.value=t.tx(n.value)}});class bp{constructor(t=[]){this.content=[],this.indent=0,this&&(this.args=t)}indented(t){this.indent+=1,t(this),this.indent-=1}write(t){if(typeof t=="function"){t(this,{execution:"sync"}),t(this,{execution:"async"});return}const r=t.split(`
|
|
2
2
|
`).filter(s=>s),o=Math.min(...r.map(s=>s.length-s.trimStart().length)),i=r.map(s=>s.slice(o)).map(s=>" ".repeat(this.indent*2)+s);for(const s of i)this.content.push(s)}compile(){const t=Function,n=this?.args,o=[...(this?.content??[""]).map(i=>` ${i}`)];return new t(...n,o.join(`
|
|
3
3
|
`))}}const wp={major:4,minor:3,patch:6},Me=G("$ZodType",(e,t)=>{var n;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=wp;const r=[...e._zod.def.checks??[]];e._zod.traits.has("$ZodCheck")&&r.unshift(e);for(const o of r)for(const i of o._zod.onattach)i(e);if(r.length===0)(n=e._zod).deferred??(n.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{const o=(s,a,l)=>{let c=vn(s),u;for(const f of a){if(f._zod.def.when){if(!f._zod.def.when(s))continue}else if(c)continue;const p=s.issues.length,d=f._zod.check(s);if(d instanceof Promise&&l?.async===!1)throw new kn;if(u||d instanceof Promise)u=(u??Promise.resolve()).then(async()=>{await d,s.issues.length!==p&&(c||(c=vn(s,p)))});else{if(s.issues.length===p)continue;c||(c=vn(s,p))}}return u?u.then(()=>s):s},i=(s,a,l)=>{if(vn(s))return s.aborted=!0,s;const c=o(a,r,l);if(c instanceof Promise){if(l.async===!1)throw new kn;return c.then(u=>e._zod.parse(u,l))}return e._zod.parse(c,l)};e._zod.run=(s,a)=>{if(a.skipChecks)return e._zod.parse(s,a);if(a.direction==="backward"){const c=e._zod.parse({value:s.value,issues:[]},{...a,skipChecks:!0});return c instanceof Promise?c.then(u=>i(u,s,a)):i(c,s,a)}const l=e._zod.parse(s,a);if(l instanceof Promise){if(a.async===!1)throw new kn;return l.then(c=>o(c,r,a))}return o(l,r,a)}}Ne(e,"~standard",()=>({validate:o=>{try{const i=Eh(e,o);return i.success?{value:i.data}:{issues:i.error?.issues}}catch{return Th(e,o).then(s=>s.success?{value:s.data}:{issues:s.error?.issues})}},vendor:"zod",version:1}))}),Ui=G("$ZodString",(e,t)=>{Me.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??np(e._zod.bag),e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=String(n.value)}catch{}return typeof n.value=="string"||n.issues.push({expected:"string",code:"invalid_type",input:n.value,inst:e}),n}}),Fe=G("$ZodStringFormat",(e,t)=>{so.init(e,t),Ui.init(e,t)}),_p=G("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=Zh),Fe.init(e,t)}),kp=G("$ZodUUID",(e,t)=>{if(t.version){const r={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(r===void 0)throw new Error(`Invalid UUID version: "${t.version}"`);t.pattern??(t.pattern=$s(r))}else t.pattern??(t.pattern=$s());Fe.init(e,t)}),Sp=G("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=Vh),Fe.init(e,t)}),Cp=G("$ZodURL",(e,t)=>{Fe.init(e,t),e._zod.check=n=>{try{const r=n.value.trim(),o=new URL(r);t.hostname&&(t.hostname.lastIndex=0,t.hostname.test(o.hostname)||n.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:t.hostname.source,input:n.value,inst:e,continue:!t.abort})),t.protocol&&(t.protocol.lastIndex=0,t.protocol.test(o.protocol.endsWith(":")?o.protocol.slice(0,-1):o.protocol)||n.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:n.value,inst:e,continue:!t.abort})),t.normalize?n.value=o.href:n.value=r;return}catch{n.issues.push({code:"invalid_format",format:"url",input:n.value,inst:e,continue:!t.abort})}}}),Ep=G("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=Hh()),Fe.init(e,t)}),Tp=G("$ZodNanoID",(e,t)=>{t.pattern??(t.pattern=Bh),Fe.init(e,t)}),Np=G("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=Dh),Fe.init(e,t)}),Ap=G("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=Mh),Fe.init(e,t)}),zp=G("$ZodULID",(e,t)=>{t.pattern??(t.pattern=Lh),Fe.init(e,t)}),Ip=G("$ZodXID",(e,t)=>{t.pattern??(t.pattern=Fh),Fe.init(e,t)}),jp=G("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=$h),Fe.init(e,t)}),Pp=G("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=tp(t)),Fe.init(e,t)}),Op=G("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=Qh),Fe.init(e,t)}),Rp=G("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=ep(t)),Fe.init(e,t)}),Dp=G("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=Uh),Fe.init(e,t)}),Mp=G("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=qh),Fe.init(e,t),e._zod.bag.format="ipv4"}),Lp=G("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=Kh),Fe.init(e,t),e._zod.bag.format="ipv6",e._zod.check=n=>{try{new URL(`http://[${n.value}]`)}catch{n.issues.push({code:"invalid_format",format:"ipv6",input:n.value,inst:e,continue:!t.abort})}}}),Fp=G("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=Gh),Fe.init(e,t)}),$p=G("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=Yh),Fe.init(e,t),e._zod.check=n=>{const r=n.value.split("/");try{if(r.length!==2)throw new Error;const[o,i]=r;if(!i)throw new Error;const s=Number(i);if(`${s}`!==i)throw new Error;if(s<0||s>128)throw new Error;new URL(`http://[${o}]`)}catch{n.issues.push({code:"invalid_format",format:"cidrv6",input:n.value,inst:e,continue:!t.abort})}}});function lc(e){if(e==="")return!0;if(e.length%4!==0)return!1;try{return atob(e),!0}catch{return!1}}const Bp=G("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=Jh),Fe.init(e,t),e._zod.bag.contentEncoding="base64",e._zod.check=n=>{lc(n.value)||n.issues.push({code:"invalid_format",format:"base64",input:n.value,inst:e,continue:!t.abort})}});function Up(e){if(!tc.test(e))return!1;const t=e.replace(/[-_]/g,r=>r==="-"?"+":"/"),n=t.padEnd(Math.ceil(t.length/4)*4,"=");return lc(n)}const Zp=G("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=tc),Fe.init(e,t),e._zod.bag.contentEncoding="base64url",e._zod.check=n=>{Up(n.value)||n.issues.push({code:"invalid_format",format:"base64url",input:n.value,inst:e,continue:!t.abort})}}),Vp=G("$ZodE164",(e,t)=>{t.pattern??(t.pattern=Xh),Fe.init(e,t)});function Wp(e,t=null){try{const n=e.split(".");if(n.length!==3)return!1;const[r]=n;if(!r)return!1;const o=JSON.parse(atob(r));return!("typ"in o&&o?.typ!=="JWT"||!o.alg||t&&(!("alg"in o)||o.alg!==t))}catch{return!1}}const Hp=G("$ZodJWT",(e,t)=>{Fe.init(e,t),e._zod.check=n=>{Wp(n.value,t.alg)||n.issues.push({code:"invalid_format",format:"jwt",input:n.value,inst:e,continue:!t.abort})}}),cc=G("$ZodNumber",(e,t)=>{Me.init(e,t),e._zod.pattern=e._zod.bag.pattern??oc,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=Number(n.value)}catch{}const o=n.value;if(typeof o=="number"&&!Number.isNaN(o)&&Number.isFinite(o))return n;const i=typeof o=="number"?Number.isNaN(o)?"NaN":Number.isFinite(o)?void 0:"Infinity":void 0;return n.issues.push({expected:"number",code:"invalid_type",input:o,inst:e,...i?{received:i}:{}}),n}}),qp=G("$ZodNumberFormat",(e,t)=>{cp.init(e,t),cc.init(e,t)}),Kp=G("$ZodBoolean",(e,t)=>{Me.init(e,t),e._zod.pattern=op,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=!!n.value}catch{}const o=n.value;return typeof o=="boolean"||n.issues.push({expected:"boolean",code:"invalid_type",input:o,inst:e}),n}}),Gp=G("$ZodNull",(e,t)=>{Me.init(e,t),e._zod.pattern=ip,e._zod.values=new Set([null]),e._zod.parse=(n,r)=>{const o=n.value;return o===null||n.issues.push({expected:"null",code:"invalid_type",input:o,inst:e}),n}}),Yp=G("$ZodUnknown",(e,t)=>{Me.init(e,t),e._zod.parse=n=>n}),Jp=G("$ZodNever",(e,t)=>{Me.init(e,t),e._zod.parse=(n,r)=>(n.issues.push({expected:"never",code:"invalid_type",input:n.value,inst:e}),n)});function Bs(e,t,n){e.issues.length&&t.issues.push(...bn(n,e.issues)),t.value[n]=e.value}const Xp=G("$ZodArray",(e,t)=>{Me.init(e,t),e._zod.parse=(n,r)=>{const o=n.value;if(!Array.isArray(o))return n.issues.push({expected:"array",code:"invalid_type",input:o,inst:e}),n;n.value=Array(o.length);const i=[];for(let s=0;s<o.length;s++){const a=o[s],l=t.element._zod.run({value:a,issues:[]},r);l instanceof Promise?i.push(l.then(c=>Bs(c,n,s))):Bs(l,n,s)}return i.length?Promise.all(i).then(()=>n):n}});function Br(e,t,n,r,o){if(e.issues.length){if(o&&!(n in r))return;t.issues.push(...bn(n,e.issues))}e.value===void 0?n in r&&(t.value[n]=void 0):t.value[n]=e.value}function uc(e){const t=Object.keys(e.shape);for(const r of t)if(!e.shape?.[r]?._zod?.traits?.has("$ZodType"))throw new Error(`Invalid element at key "${r}": expected a Zod schema`);const n=mh(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(n)}}function dc(e,t,n,r,o,i){const s=[],a=o.keySet,l=o.catchall._zod,c=l.def.type,u=l.optout==="optional";for(const f in t){if(a.has(f))continue;if(c==="never"){s.push(f);continue}const p=l.run({value:t[f],issues:[]},r);p instanceof Promise?e.push(p.then(d=>Br(d,n,f,t,u))):Br(p,n,f,t,u)}return s.length&&n.issues.push({code:"unrecognized_keys",keys:s,input:t,inst:i}),e.length?Promise.all(e).then(()=>n):n}const Qp=G("$ZodObject",(e,t)=>{if(Me.init(e,t),!Object.getOwnPropertyDescriptor(t,"shape")?.get){const a=t.shape;Object.defineProperty(t,"shape",{get:()=>{const l={...a};return Object.defineProperty(t,"shape",{value:l}),l}})}const r=ro(()=>uc(t));Ne(e._zod,"propValues",()=>{const a=t.shape,l={};for(const c in a){const u=a[c]._zod;if(u.values){l[c]??(l[c]=new Set);for(const f of u.values)l[c].add(f)}}return l});const o=rr,i=t.catchall;let s;e._zod.parse=(a,l)=>{s??(s=r.value);const c=a.value;if(!o(c))return a.issues.push({expected:"object",code:"invalid_type",input:c,inst:e}),a;a.value={};const u=[],f=s.shape;for(const p of s.keys){const d=f[p],x=d._zod.optout==="optional",m=d._zod.run({value:c[p],issues:[]},l);m instanceof Promise?u.push(m.then(y=>Br(y,a,p,c,x))):Br(m,a,p,c,x)}return i?dc(u,c,a,l,r.value,e):u.length?Promise.all(u).then(()=>a):a}}),em=G("$ZodObjectJIT",(e,t)=>{Qp.init(e,t);const n=e._zod.parse,r=ro(()=>uc(t)),o=p=>{const d=new bp(["shape","payload","ctx"]),x=r.value,m=k=>{const S=Fs(k);return`shape[${S}]._zod.run({ value: input[${S}], issues: [] }, ctx)`};d.write("const input = payload.value;");const y=Object.create(null);let g=0;for(const k of x.keys)y[k]=`key_${g++}`;d.write("const newResult = {};");for(const k of x.keys){const S=y[k],C=Fs(k),N=p[k]?._zod?.optout==="optional";d.write(`const ${S} = ${m(k)};`),N?d.write(`
|
|
4
4
|
if (${S}.issues.length) {
|
|
@@ -94,4 +94,4 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
94
94
|
|
|
95
95
|
If you want to hide the \`${t.titleName}\`, you can wrap it with our VisuallyHidden component.
|
|
96
96
|
|
|
97
|
-
For more information, see https://radix-ui.com/primitives/docs/components/${t.docsSlug}`;return _.useEffect(()=>{e&&(document.getElementById(e)||console.error(n))},[n,e]),null},hS="DialogDescriptionWarning",pS=({contentRef:e,descriptionId:t})=>{const r=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${pd(hS).contentName}}.`;return _.useEffect(()=>{const o=e.current?.getAttribute("aria-describedby");t&&o&&(document.getElementById(t)||console.warn(r))},[r,e,t]),null},mS=td,gS=rd,xS=id,yS=sd,vS=ad,bS=cd,wS=fd;function _S(e){const t=_.useRef({value:e,previous:e});return _.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}function kS(e){const[t,n]=_.useState(void 0);return qe(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});const r=new ResizeObserver(o=>{if(!Array.isArray(o)||!o.length)return;const i=o[0];let s,a;if("borderBoxSize"in i){const l=i.borderBoxSize,c=Array.isArray(l)?l[0]:l;s=c.inlineSize,a=c.blockSize}else s=e.offsetWidth,a=e.offsetHeight;n({width:s,height:a})});return r.observe(e,{box:"border-box"}),()=>r.unobserve(e)}else n(void 0)},[e]),t}const SS=["top","right","bottom","left"],Ht=Math.min,at=Math.max,Gr=Math.round,Pr=Math.floor,Tt=e=>({x:e,y:e}),CS={left:"right",right:"left",bottom:"top",top:"bottom"},ES={start:"end",end:"start"};function Si(e,t,n){return at(e,Ht(t,n))}function Mt(e,t){return typeof e=="function"?e(t):e}function Lt(e){return e.split("-")[0]}function Un(e){return e.split("-")[1]}function xs(e){return e==="x"?"y":"x"}function ys(e){return e==="y"?"height":"width"}const TS=new Set(["top","bottom"]);function St(e){return TS.has(Lt(e))?"y":"x"}function vs(e){return xs(St(e))}function NS(e,t,n){n===void 0&&(n=!1);const r=Un(e),o=vs(e),i=ys(o);let s=o==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[i]>t.floating[i]&&(s=Yr(s)),[s,Yr(s)]}function AS(e){const t=Yr(e);return[Ci(e),t,Ci(t)]}function Ci(e){return e.replace(/start|end/g,t=>ES[t])}const vl=["left","right"],bl=["right","left"],zS=["top","bottom"],IS=["bottom","top"];function jS(e,t,n){switch(e){case"top":case"bottom":return n?t?bl:vl:t?vl:bl;case"left":case"right":return t?zS:IS;default:return[]}}function PS(e,t,n,r){const o=Un(e);let i=jS(Lt(e),n==="start",r);return o&&(i=i.map(s=>s+"-"+o),t&&(i=i.concat(i.map(Ci)))),i}function Yr(e){return e.replace(/left|right|bottom|top/g,t=>CS[t])}function OS(e){return{top:0,right:0,bottom:0,left:0,...e}}function md(e){return typeof e!="number"?OS(e):{top:e,right:e,bottom:e,left:e}}function Jr(e){const{x:t,y:n,width:r,height:o}=e;return{width:r,height:o,top:n,left:t,right:t+r,bottom:n+o,x:t,y:n}}function wl(e,t,n){let{reference:r,floating:o}=e;const i=St(t),s=vs(t),a=ys(s),l=Lt(t),c=i==="y",u=r.x+r.width/2-o.width/2,f=r.y+r.height/2-o.height/2,p=r[a]/2-o[a]/2;let d;switch(l){case"top":d={x:u,y:r.y-o.height};break;case"bottom":d={x:u,y:r.y+r.height};break;case"right":d={x:r.x+r.width,y:f};break;case"left":d={x:r.x-o.width,y:f};break;default:d={x:r.x,y:r.y}}switch(Un(t)){case"start":d[s]-=p*(n&&c?-1:1);break;case"end":d[s]+=p*(n&&c?-1:1);break}return d}async function RS(e,t){var n;t===void 0&&(t={});const{x:r,y:o,platform:i,rects:s,elements:a,strategy:l}=e,{boundary:c="clippingAncestors",rootBoundary:u="viewport",elementContext:f="floating",altBoundary:p=!1,padding:d=0}=Mt(t,e),x=md(d),y=a[p?f==="floating"?"reference":"floating":f],g=Jr(await i.getClippingRect({element:(n=await(i.isElement==null?void 0:i.isElement(y)))==null||n?y:y.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(a.floating)),boundary:c,rootBoundary:u,strategy:l})),v=f==="floating"?{x:r,y:o,width:s.floating.width,height:s.floating.height}:s.reference,k=await(i.getOffsetParent==null?void 0:i.getOffsetParent(a.floating)),S=await(i.isElement==null?void 0:i.isElement(k))?await(i.getScale==null?void 0:i.getScale(k))||{x:1,y:1}:{x:1,y:1},C=Jr(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:a,rect:v,offsetParent:k,strategy:l}):v);return{top:(g.top-C.top+x.top)/S.y,bottom:(C.bottom-g.bottom+x.bottom)/S.y,left:(g.left-C.left+x.left)/S.x,right:(C.right-g.right+x.right)/S.x}}const DS=async(e,t,n)=>{const{placement:r="bottom",strategy:o="absolute",middleware:i=[],platform:s}=n,a=i.filter(Boolean),l=await(s.isRTL==null?void 0:s.isRTL(t));let c=await s.getElementRects({reference:e,floating:t,strategy:o}),{x:u,y:f}=wl(c,r,l),p=r,d={},x=0;for(let y=0;y<a.length;y++){var m;const{name:g,fn:v}=a[y],{x:k,y:S,data:C,reset:E}=await v({x:u,y:f,initialPlacement:r,placement:p,strategy:o,middlewareData:d,rects:c,platform:{...s,detectOverflow:(m=s.detectOverflow)!=null?m:RS},elements:{reference:e,floating:t}});u=k??u,f=S??f,d={...d,[g]:{...d[g],...C}},E&&x<=50&&(x++,typeof E=="object"&&(E.placement&&(p=E.placement),E.rects&&(c=E.rects===!0?await s.getElementRects({reference:e,floating:t,strategy:o}):E.rects),{x:u,y:f}=wl(c,p,l)),y=-1)}return{x:u,y:f,placement:p,strategy:o,middlewareData:d}},MS=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:r,placement:o,rects:i,platform:s,elements:a,middlewareData:l}=t,{element:c,padding:u=0}=Mt(e,t)||{};if(c==null)return{};const f=md(u),p={x:n,y:r},d=vs(o),x=ys(d),m=await s.getDimensions(c),y=d==="y",g=y?"top":"left",v=y?"bottom":"right",k=y?"clientHeight":"clientWidth",S=i.reference[x]+i.reference[d]-p[d]-i.floating[x],C=p[d]-i.reference[d],E=await(s.getOffsetParent==null?void 0:s.getOffsetParent(c));let N=E?E[k]:0;(!N||!await(s.isElement==null?void 0:s.isElement(E)))&&(N=a.floating[k]||i.floating[x]);const A=S/2-C/2,O=N/2-m[x]/2-1,D=Ht(f[g],O),U=Ht(f[v],O),T=D,M=N-m[x]-U,b=N/2-m[x]/2+A,R=Si(T,b,M),K=!l.arrow&&Un(o)!=null&&b!==R&&i.reference[x]/2-(b<T?D:U)-m[x]/2<0,V=K?b<T?b-T:b-M:0;return{[d]:p[d]+V,data:{[d]:R,centerOffset:b-R-V,...K&&{alignmentOffset:V}},reset:K}}}),LS=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,r;const{placement:o,middlewareData:i,rects:s,initialPlacement:a,platform:l,elements:c}=t,{mainAxis:u=!0,crossAxis:f=!0,fallbackPlacements:p,fallbackStrategy:d="bestFit",fallbackAxisSideDirection:x="none",flipAlignment:m=!0,...y}=Mt(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};const g=Lt(o),v=St(a),k=Lt(a)===a,S=await(l.isRTL==null?void 0:l.isRTL(c.floating)),C=p||(k||!m?[Yr(a)]:AS(a)),E=x!=="none";!p&&E&&C.push(...PS(a,m,x,S));const N=[a,...C],A=await l.detectOverflow(t,y),O=[];let D=((r=i.flip)==null?void 0:r.overflows)||[];if(u&&O.push(A[g]),f){const b=NS(o,s,S);O.push(A[b[0]],A[b[1]])}if(D=[...D,{placement:o,overflows:O}],!O.every(b=>b<=0)){var U,T;const b=(((U=i.flip)==null?void 0:U.index)||0)+1,R=N[b];if(R&&(!(f==="alignment"?v!==St(R):!1)||D.every(W=>St(W.placement)===v?W.overflows[0]>0:!0)))return{data:{index:b,overflows:D},reset:{placement:R}};let K=(T=D.filter(V=>V.overflows[0]<=0).sort((V,W)=>V.overflows[1]-W.overflows[1])[0])==null?void 0:T.placement;if(!K)switch(d){case"bestFit":{var M;const V=(M=D.filter(W=>{if(E){const q=St(W.placement);return q===v||q==="y"}return!0}).map(W=>[W.placement,W.overflows.filter(q=>q>0).reduce((q,I)=>q+I,0)]).sort((W,q)=>W[1]-q[1])[0])==null?void 0:M[0];V&&(K=V);break}case"initialPlacement":K=a;break}if(o!==K)return{reset:{placement:K}}}return{}}}};function _l(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function kl(e){return SS.some(t=>e[t]>=0)}const FS=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n,platform:r}=t,{strategy:o="referenceHidden",...i}=Mt(e,t);switch(o){case"referenceHidden":{const s=await r.detectOverflow(t,{...i,elementContext:"reference"}),a=_l(s,n.reference);return{data:{referenceHiddenOffsets:a,referenceHidden:kl(a)}}}case"escaped":{const s=await r.detectOverflow(t,{...i,altBoundary:!0}),a=_l(s,n.floating);return{data:{escapedOffsets:a,escaped:kl(a)}}}default:return{}}}}},gd=new Set(["left","top"]);async function $S(e,t){const{placement:n,platform:r,elements:o}=e,i=await(r.isRTL==null?void 0:r.isRTL(o.floating)),s=Lt(n),a=Un(n),l=St(n)==="y",c=gd.has(s)?-1:1,u=i&&l?-1:1,f=Mt(t,e);let{mainAxis:p,crossAxis:d,alignmentAxis:x}=typeof f=="number"?{mainAxis:f,crossAxis:0,alignmentAxis:null}:{mainAxis:f.mainAxis||0,crossAxis:f.crossAxis||0,alignmentAxis:f.alignmentAxis};return a&&typeof x=="number"&&(d=a==="end"?x*-1:x),l?{x:d*u,y:p*c}:{x:p*c,y:d*u}}const BS=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,r;const{x:o,y:i,placement:s,middlewareData:a}=t,l=await $S(t,e);return s===((n=a.offset)==null?void 0:n.placement)&&(r=a.arrow)!=null&&r.alignmentOffset?{}:{x:o+l.x,y:i+l.y,data:{...l,placement:s}}}}},US=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:r,placement:o,platform:i}=t,{mainAxis:s=!0,crossAxis:a=!1,limiter:l={fn:g=>{let{x:v,y:k}=g;return{x:v,y:k}}},...c}=Mt(e,t),u={x:n,y:r},f=await i.detectOverflow(t,c),p=St(Lt(o)),d=xs(p);let x=u[d],m=u[p];if(s){const g=d==="y"?"top":"left",v=d==="y"?"bottom":"right",k=x+f[g],S=x-f[v];x=Si(k,x,S)}if(a){const g=p==="y"?"top":"left",v=p==="y"?"bottom":"right",k=m+f[g],S=m-f[v];m=Si(k,m,S)}const y=l.fn({...t,[d]:x,[p]:m});return{...y,data:{x:y.x-n,y:y.y-r,enabled:{[d]:s,[p]:a}}}}}},ZS=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:n,y:r,placement:o,rects:i,middlewareData:s}=t,{offset:a=0,mainAxis:l=!0,crossAxis:c=!0}=Mt(e,t),u={x:n,y:r},f=St(o),p=xs(f);let d=u[p],x=u[f];const m=Mt(a,t),y=typeof m=="number"?{mainAxis:m,crossAxis:0}:{mainAxis:0,crossAxis:0,...m};if(l){const k=p==="y"?"height":"width",S=i.reference[p]-i.floating[k]+y.mainAxis,C=i.reference[p]+i.reference[k]-y.mainAxis;d<S?d=S:d>C&&(d=C)}if(c){var g,v;const k=p==="y"?"width":"height",S=gd.has(Lt(o)),C=i.reference[f]-i.floating[k]+(S&&((g=s.offset)==null?void 0:g[f])||0)+(S?0:y.crossAxis),E=i.reference[f]+i.reference[k]+(S?0:((v=s.offset)==null?void 0:v[f])||0)-(S?y.crossAxis:0);x<C?x=C:x>E&&(x=E)}return{[p]:d,[f]:x}}}},VS=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var n,r;const{placement:o,rects:i,platform:s,elements:a}=t,{apply:l=()=>{},...c}=Mt(e,t),u=await s.detectOverflow(t,c),f=Lt(o),p=Un(o),d=St(o)==="y",{width:x,height:m}=i.floating;let y,g;f==="top"||f==="bottom"?(y=f,g=p===(await(s.isRTL==null?void 0:s.isRTL(a.floating))?"start":"end")?"left":"right"):(g=f,y=p==="end"?"top":"bottom");const v=m-u.top-u.bottom,k=x-u.left-u.right,S=Ht(m-u[y],v),C=Ht(x-u[g],k),E=!t.middlewareData.shift;let N=S,A=C;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(A=k),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(N=v),E&&!p){const D=at(u.left,0),U=at(u.right,0),T=at(u.top,0),M=at(u.bottom,0);d?A=x-2*(D!==0||U!==0?D+U:at(u.left,u.right)):N=m-2*(T!==0||M!==0?T+M:at(u.top,u.bottom))}await l({...t,availableWidth:A,availableHeight:N});const O=await s.getDimensions(a.floating);return x!==O.width||m!==O.height?{reset:{rects:!0}}:{}}}};function yo(){return typeof window<"u"}function Zn(e){return xd(e)?(e.nodeName||"").toLowerCase():"#document"}function ct(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function jt(e){var t;return(t=(xd(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function xd(e){return yo()?e instanceof Node||e instanceof ct(e).Node:!1}function xt(e){return yo()?e instanceof Element||e instanceof ct(e).Element:!1}function It(e){return yo()?e instanceof HTMLElement||e instanceof ct(e).HTMLElement:!1}function Sl(e){return!yo()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof ct(e).ShadowRoot}const WS=new Set(["inline","contents"]);function pr(e){const{overflow:t,overflowX:n,overflowY:r,display:o}=yt(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&!WS.has(o)}const HS=new Set(["table","td","th"]);function qS(e){return HS.has(Zn(e))}const KS=[":popover-open",":modal"];function vo(e){return KS.some(t=>{try{return e.matches(t)}catch{return!1}})}const GS=["transform","translate","scale","rotate","perspective"],YS=["transform","translate","scale","rotate","perspective","filter"],JS=["paint","layout","strict","content"];function bs(e){const t=ws(),n=xt(e)?yt(e):e;return GS.some(r=>n[r]?n[r]!=="none":!1)||(n.containerType?n.containerType!=="normal":!1)||!t&&(n.backdropFilter?n.backdropFilter!=="none":!1)||!t&&(n.filter?n.filter!=="none":!1)||YS.some(r=>(n.willChange||"").includes(r))||JS.some(r=>(n.contain||"").includes(r))}function XS(e){let t=qt(e);for(;It(t)&&!Pn(t);){if(bs(t))return t;if(vo(t))return null;t=qt(t)}return null}function ws(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const QS=new Set(["html","body","#document"]);function Pn(e){return QS.has(Zn(e))}function yt(e){return ct(e).getComputedStyle(e)}function bo(e){return xt(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function qt(e){if(Zn(e)==="html")return e;const t=e.assignedSlot||e.parentNode||Sl(e)&&e.host||jt(e);return Sl(t)?t.host:t}function yd(e){const t=qt(e);return Pn(t)?e.ownerDocument?e.ownerDocument.body:e.body:It(t)&&pr(t)?t:yd(t)}function sr(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);const o=yd(e),i=o===((r=e.ownerDocument)==null?void 0:r.body),s=ct(o);if(i){const a=Ei(s);return t.concat(s,s.visualViewport||[],pr(o)?o:[],a&&n?sr(a):[])}return t.concat(o,sr(o,[],n))}function Ei(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function vd(e){const t=yt(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const o=It(e),i=o?e.offsetWidth:n,s=o?e.offsetHeight:r,a=Gr(n)!==i||Gr(r)!==s;return a&&(n=i,r=s),{width:n,height:r,$:a}}function _s(e){return xt(e)?e:e.contextElement}function Tn(e){const t=_s(e);if(!It(t))return Tt(1);const n=t.getBoundingClientRect(),{width:r,height:o,$:i}=vd(t);let s=(i?Gr(n.width):n.width)/r,a=(i?Gr(n.height):n.height)/o;return(!s||!Number.isFinite(s))&&(s=1),(!a||!Number.isFinite(a))&&(a=1),{x:s,y:a}}const eC=Tt(0);function bd(e){const t=ct(e);return!ws()||!t.visualViewport?eC:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function tC(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==ct(e)?!1:t}function on(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const o=e.getBoundingClientRect(),i=_s(e);let s=Tt(1);t&&(r?xt(r)&&(s=Tn(r)):s=Tn(e));const a=tC(i,n,r)?bd(i):Tt(0);let l=(o.left+a.x)/s.x,c=(o.top+a.y)/s.y,u=o.width/s.x,f=o.height/s.y;if(i){const p=ct(i),d=r&&xt(r)?ct(r):r;let x=p,m=Ei(x);for(;m&&r&&d!==x;){const y=Tn(m),g=m.getBoundingClientRect(),v=yt(m),k=g.left+(m.clientLeft+parseFloat(v.paddingLeft))*y.x,S=g.top+(m.clientTop+parseFloat(v.paddingTop))*y.y;l*=y.x,c*=y.y,u*=y.x,f*=y.y,l+=k,c+=S,x=ct(m),m=Ei(x)}}return Jr({width:u,height:f,x:l,y:c})}function wo(e,t){const n=bo(e).scrollLeft;return t?t.left+n:on(jt(e)).left+n}function wd(e,t){const n=e.getBoundingClientRect(),r=n.left+t.scrollLeft-wo(e,n),o=n.top+t.scrollTop;return{x:r,y:o}}function nC(e){let{elements:t,rect:n,offsetParent:r,strategy:o}=e;const i=o==="fixed",s=jt(r),a=t?vo(t.floating):!1;if(r===s||a&&i)return n;let l={scrollLeft:0,scrollTop:0},c=Tt(1);const u=Tt(0),f=It(r);if((f||!f&&!i)&&((Zn(r)!=="body"||pr(s))&&(l=bo(r)),It(r))){const d=on(r);c=Tn(r),u.x=d.x+r.clientLeft,u.y=d.y+r.clientTop}const p=s&&!f&&!i?wd(s,l):Tt(0);return{width:n.width*c.x,height:n.height*c.y,x:n.x*c.x-l.scrollLeft*c.x+u.x+p.x,y:n.y*c.y-l.scrollTop*c.y+u.y+p.y}}function rC(e){return Array.from(e.getClientRects())}function oC(e){const t=jt(e),n=bo(e),r=e.ownerDocument.body,o=at(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),i=at(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let s=-n.scrollLeft+wo(e);const a=-n.scrollTop;return yt(r).direction==="rtl"&&(s+=at(t.clientWidth,r.clientWidth)-o),{width:o,height:i,x:s,y:a}}const Cl=25;function iC(e,t){const n=ct(e),r=jt(e),o=n.visualViewport;let i=r.clientWidth,s=r.clientHeight,a=0,l=0;if(o){i=o.width,s=o.height;const u=ws();(!u||u&&t==="fixed")&&(a=o.offsetLeft,l=o.offsetTop)}const c=wo(r);if(c<=0){const u=r.ownerDocument,f=u.body,p=getComputedStyle(f),d=u.compatMode==="CSS1Compat"&&parseFloat(p.marginLeft)+parseFloat(p.marginRight)||0,x=Math.abs(r.clientWidth-f.clientWidth-d);x<=Cl&&(i-=x)}else c<=Cl&&(i+=c);return{width:i,height:s,x:a,y:l}}const sC=new Set(["absolute","fixed"]);function aC(e,t){const n=on(e,!0,t==="fixed"),r=n.top+e.clientTop,o=n.left+e.clientLeft,i=It(e)?Tn(e):Tt(1),s=e.clientWidth*i.x,a=e.clientHeight*i.y,l=o*i.x,c=r*i.y;return{width:s,height:a,x:l,y:c}}function El(e,t,n){let r;if(t==="viewport")r=iC(e,n);else if(t==="document")r=oC(jt(e));else if(xt(t))r=aC(t,n);else{const o=bd(e);r={x:t.x-o.x,y:t.y-o.y,width:t.width,height:t.height}}return Jr(r)}function _d(e,t){const n=qt(e);return n===t||!xt(n)||Pn(n)?!1:yt(n).position==="fixed"||_d(n,t)}function lC(e,t){const n=t.get(e);if(n)return n;let r=sr(e,[],!1).filter(a=>xt(a)&&Zn(a)!=="body"),o=null;const i=yt(e).position==="fixed";let s=i?qt(e):e;for(;xt(s)&&!Pn(s);){const a=yt(s),l=bs(s);!l&&a.position==="fixed"&&(o=null),(i?!l&&!o:!l&&a.position==="static"&&!!o&&sC.has(o.position)||pr(s)&&!l&&_d(e,s))?r=r.filter(u=>u!==s):o=a,s=qt(s)}return t.set(e,r),r}function cC(e){let{element:t,boundary:n,rootBoundary:r,strategy:o}=e;const s=[...n==="clippingAncestors"?vo(t)?[]:lC(t,this._c):[].concat(n),r],a=s[0],l=s.reduce((c,u)=>{const f=El(t,u,o);return c.top=at(f.top,c.top),c.right=Ht(f.right,c.right),c.bottom=Ht(f.bottom,c.bottom),c.left=at(f.left,c.left),c},El(t,a,o));return{width:l.right-l.left,height:l.bottom-l.top,x:l.left,y:l.top}}function uC(e){const{width:t,height:n}=vd(e);return{width:t,height:n}}function dC(e,t,n){const r=It(t),o=jt(t),i=n==="fixed",s=on(e,!0,i,t);let a={scrollLeft:0,scrollTop:0};const l=Tt(0);function c(){l.x=wo(o)}if(r||!r&&!i)if((Zn(t)!=="body"||pr(o))&&(a=bo(t)),r){const d=on(t,!0,i,t);l.x=d.x+t.clientLeft,l.y=d.y+t.clientTop}else o&&c();i&&!r&&o&&c();const u=o&&!r&&!i?wd(o,a):Tt(0),f=s.left+a.scrollLeft-l.x-u.x,p=s.top+a.scrollTop-l.y-u.y;return{x:f,y:p,width:s.width,height:s.height}}function ni(e){return yt(e).position==="static"}function Tl(e,t){if(!It(e)||yt(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return jt(e)===n&&(n=n.ownerDocument.body),n}function kd(e,t){const n=ct(e);if(vo(e))return n;if(!It(e)){let o=qt(e);for(;o&&!Pn(o);){if(xt(o)&&!ni(o))return o;o=qt(o)}return n}let r=Tl(e,t);for(;r&&qS(r)&&ni(r);)r=Tl(r,t);return r&&Pn(r)&&ni(r)&&!bs(r)?n:r||XS(e)||n}const fC=async function(e){const t=this.getOffsetParent||kd,n=this.getDimensions,r=await n(e.floating);return{reference:dC(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function hC(e){return yt(e).direction==="rtl"}const pC={convertOffsetParentRelativeRectToViewportRelativeRect:nC,getDocumentElement:jt,getClippingRect:cC,getOffsetParent:kd,getElementRects:fC,getClientRects:rC,getDimensions:uC,getScale:Tn,isElement:xt,isRTL:hC};function Sd(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function mC(e,t){let n=null,r;const o=jt(e);function i(){var a;clearTimeout(r),(a=n)==null||a.disconnect(),n=null}function s(a,l){a===void 0&&(a=!1),l===void 0&&(l=1),i();const c=e.getBoundingClientRect(),{left:u,top:f,width:p,height:d}=c;if(a||t(),!p||!d)return;const x=Pr(f),m=Pr(o.clientWidth-(u+p)),y=Pr(o.clientHeight-(f+d)),g=Pr(u),k={rootMargin:-x+"px "+-m+"px "+-y+"px "+-g+"px",threshold:at(0,Ht(1,l))||1};let S=!0;function C(E){const N=E[0].intersectionRatio;if(N!==l){if(!S)return s();N?s(!1,N):r=setTimeout(()=>{s(!1,1e-7)},1e3)}N===1&&!Sd(c,e.getBoundingClientRect())&&s(),S=!1}try{n=new IntersectionObserver(C,{...k,root:o.ownerDocument})}catch{n=new IntersectionObserver(C,k)}n.observe(e)}return s(!0),i}function gC(e,t,n,r){r===void 0&&(r={});const{ancestorScroll:o=!0,ancestorResize:i=!0,elementResize:s=typeof ResizeObserver=="function",layoutShift:a=typeof IntersectionObserver=="function",animationFrame:l=!1}=r,c=_s(e),u=o||i?[...c?sr(c):[],...sr(t)]:[];u.forEach(g=>{o&&g.addEventListener("scroll",n,{passive:!0}),i&&g.addEventListener("resize",n)});const f=c&&a?mC(c,n):null;let p=-1,d=null;s&&(d=new ResizeObserver(g=>{let[v]=g;v&&v.target===c&&d&&(d.unobserve(t),cancelAnimationFrame(p),p=requestAnimationFrame(()=>{var k;(k=d)==null||k.observe(t)})),n()}),c&&!l&&d.observe(c),d.observe(t));let x,m=l?on(e):null;l&&y();function y(){const g=on(e);m&&!Sd(m,g)&&n(),m=g,x=requestAnimationFrame(y)}return n(),()=>{var g;u.forEach(v=>{o&&v.removeEventListener("scroll",n),i&&v.removeEventListener("resize",n)}),f?.(),(g=d)==null||g.disconnect(),d=null,l&&cancelAnimationFrame(x)}}const xC=BS,yC=US,vC=LS,bC=VS,wC=FS,Nl=MS,_C=ZS,kC=(e,t,n)=>{const r=new Map,o={platform:pC,...n},i={...o.platform,_c:r};return DS(e,t,{...o,platform:i})};var SC=typeof document<"u",CC=function(){},Fr=SC?_.useLayoutEffect:CC;function Xr(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e=="function"&&e.toString()===t.toString())return!0;let n,r,o;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;r--!==0;)if(!Xr(e[r],t[r]))return!1;return!0}if(o=Object.keys(e),n=o.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,o[r]))return!1;for(r=n;r--!==0;){const i=o[r];if(!(i==="_owner"&&e.$$typeof)&&!Xr(e[i],t[i]))return!1}return!0}return e!==e&&t!==t}function Cd(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function Al(e,t){const n=Cd(e);return Math.round(t*n)/n}function ri(e){const t=_.useRef(e);return Fr(()=>{t.current=e}),t}function EC(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:r=[],platform:o,elements:{reference:i,floating:s}={},transform:a=!0,whileElementsMounted:l,open:c}=e,[u,f]=_.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[p,d]=_.useState(r);Xr(p,r)||d(r);const[x,m]=_.useState(null),[y,g]=_.useState(null),v=_.useCallback(W=>{W!==E.current&&(E.current=W,m(W))},[]),k=_.useCallback(W=>{W!==N.current&&(N.current=W,g(W))},[]),S=i||x,C=s||y,E=_.useRef(null),N=_.useRef(null),A=_.useRef(u),O=l!=null,D=ri(l),U=ri(o),T=ri(c),M=_.useCallback(()=>{if(!E.current||!N.current)return;const W={placement:t,strategy:n,middleware:p};U.current&&(W.platform=U.current),kC(E.current,N.current,W).then(q=>{const I={...q,isPositioned:T.current!==!1};b.current&&!Xr(A.current,I)&&(A.current=I,cr.flushSync(()=>{f(I)}))})},[p,t,n,U,T]);Fr(()=>{c===!1&&A.current.isPositioned&&(A.current.isPositioned=!1,f(W=>({...W,isPositioned:!1})))},[c]);const b=_.useRef(!1);Fr(()=>(b.current=!0,()=>{b.current=!1}),[]),Fr(()=>{if(S&&(E.current=S),C&&(N.current=C),S&&C){if(D.current)return D.current(S,C,M);M()}},[S,C,M,D,O]);const R=_.useMemo(()=>({reference:E,floating:N,setReference:v,setFloating:k}),[v,k]),K=_.useMemo(()=>({reference:S,floating:C}),[S,C]),V=_.useMemo(()=>{const W={position:n,left:0,top:0};if(!K.floating)return W;const q=Al(K.floating,u.x),I=Al(K.floating,u.y);return a?{...W,transform:"translate("+q+"px, "+I+"px)",...Cd(K.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:q,top:I}},[n,a,K.floating,u.x,u.y]);return _.useMemo(()=>({...u,update:M,refs:R,elements:K,floatingStyles:V}),[u,M,R,K,V])}const TC=e=>{function t(n){return{}.hasOwnProperty.call(n,"current")}return{name:"arrow",options:e,fn(n){const{element:r,padding:o}=typeof e=="function"?e(n):e;return r&&t(r)?r.current!=null?Nl({element:r.current,padding:o}).fn(n):{}:r?Nl({element:r,padding:o}).fn(n):{}}}},NC=(e,t)=>({...xC(e),options:[e,t]}),AC=(e,t)=>({...yC(e),options:[e,t]}),zC=(e,t)=>({..._C(e),options:[e,t]}),IC=(e,t)=>({...vC(e),options:[e,t]}),jC=(e,t)=>({...bC(e),options:[e,t]}),PC=(e,t)=>({...wC(e),options:[e,t]}),OC=(e,t)=>({...TC(e),options:[e,t]});var RC="Arrow",Ed=_.forwardRef((e,t)=>{const{children:n,width:r=10,height:o=5,...i}=e;return h.jsx(ke.svg,{...i,ref:t,width:r,height:o,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?n:h.jsx("polygon",{points:"0,0 30,0 15,10"})})});Ed.displayName=RC;var DC=Ed,ks="Popper",[Td,_o]=Ft(ks),[MC,Nd]=Td(ks),Ad=e=>{const{__scopePopper:t,children:n}=e,[r,o]=_.useState(null);return h.jsx(MC,{scope:t,anchor:r,onAnchorChange:o,children:n})};Ad.displayName=ks;var zd="PopperAnchor",Id=_.forwardRef((e,t)=>{const{__scopePopper:n,virtualRef:r,...o}=e,i=Nd(zd,n),s=_.useRef(null),a=Pe(t,s),l=_.useRef(null);return _.useEffect(()=>{const c=l.current;l.current=r?.current||s.current,c!==l.current&&i.onAnchorChange(l.current)}),r?null:h.jsx(ke.div,{...o,ref:a})});Id.displayName=zd;var Ss="PopperContent",[LC,FC]=Td(Ss),jd=_.forwardRef((e,t)=>{const{__scopePopper:n,side:r="bottom",sideOffset:o=0,align:i="center",alignOffset:s=0,arrowPadding:a=0,avoidCollisions:l=!0,collisionBoundary:c=[],collisionPadding:u=0,sticky:f="partial",hideWhenDetached:p=!1,updatePositionStrategy:d="optimized",onPlaced:x,...m}=e,y=Nd(Ss,n),[g,v]=_.useState(null),k=Pe(t,oe=>v(oe)),[S,C]=_.useState(null),E=kS(S),N=E?.width??0,A=E?.height??0,O=r+(i!=="center"?"-"+i:""),D=typeof u=="number"?u:{top:0,right:0,bottom:0,left:0,...u},U=Array.isArray(c)?c:[c],T=U.length>0,M={padding:D,boundary:U.filter(BC),altBoundary:T},{refs:b,floatingStyles:R,placement:K,isPositioned:V,middlewareData:W}=EC({strategy:"fixed",placement:O,whileElementsMounted:(...oe)=>gC(...oe,{animationFrame:d==="always"}),elements:{reference:y.anchor},middleware:[NC({mainAxis:o+A,alignmentAxis:s}),l&&AC({mainAxis:!0,crossAxis:!1,limiter:f==="partial"?zC():void 0,...M}),l&&IC({...M}),jC({...M,apply:({elements:oe,rects:le,availableWidth:he,availableHeight:me})=>{const{width:ge,height:Ee}=le.reference,Oe=oe.floating.style;Oe.setProperty("--radix-popper-available-width",`${he}px`),Oe.setProperty("--radix-popper-available-height",`${me}px`),Oe.setProperty("--radix-popper-anchor-width",`${ge}px`),Oe.setProperty("--radix-popper-anchor-height",`${Ee}px`)}}),S&&OC({element:S,padding:a}),UC({arrowWidth:N,arrowHeight:A}),p&&PC({strategy:"referenceHidden",...M})]}),[q,I]=Rd(K),B=Qe(x);qe(()=>{V&&B?.()},[V,B]);const $=W.arrow?.x,z=W.arrow?.y,Q=W.arrow?.centerOffset!==0,[te,xe]=_.useState();return qe(()=>{g&&xe(window.getComputedStyle(g).zIndex)},[g]),h.jsx("div",{ref:b.setFloating,"data-radix-popper-content-wrapper":"",style:{...R,transform:V?R.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:te,"--radix-popper-transform-origin":[W.transformOrigin?.x,W.transformOrigin?.y].join(" "),...W.hide?.referenceHidden&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:h.jsx(LC,{scope:n,placedSide:q,onArrowChange:C,arrowX:$,arrowY:z,shouldHideArrow:Q,children:h.jsx(ke.div,{"data-side":q,"data-align":I,...m,ref:k,style:{...m.style,animation:V?void 0:"none"}})})})});jd.displayName=Ss;var Pd="PopperArrow",$C={top:"bottom",right:"left",bottom:"top",left:"right"},Od=_.forwardRef(function(t,n){const{__scopePopper:r,...o}=t,i=FC(Pd,r),s=$C[i.placedSide];return h.jsx("span",{ref:i.onArrowChange,style:{position:"absolute",left:i.arrowX,top:i.arrowY,[s]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[i.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[i.placedSide],visibility:i.shouldHideArrow?"hidden":void 0},children:h.jsx(DC,{...o,ref:n,style:{...o.style,display:"block"}})})});Od.displayName=Pd;function BC(e){return e!==null}var UC=e=>({name:"transformOrigin",options:e,fn(t){const{placement:n,rects:r,middlewareData:o}=t,s=o.arrow?.centerOffset!==0,a=s?0:e.arrowWidth,l=s?0:e.arrowHeight,[c,u]=Rd(n),f={start:"0%",center:"50%",end:"100%"}[u],p=(o.arrow?.x??0)+a/2,d=(o.arrow?.y??0)+l/2;let x="",m="";return c==="bottom"?(x=s?f:`${p}px`,m=`${-l}px`):c==="top"?(x=s?f:`${p}px`,m=`${r.floating.height+l}px`):c==="right"?(x=`${-l}px`,m=s?f:`${d}px`):c==="left"&&(x=`${r.floating.width+l}px`,m=s?f:`${d}px`),{data:{x,y:m}}}});function Rd(e){const[t,n="center"]=e.split("-");return[t,n]}var Dd=Ad,Md=Id,Ld=jd,Fd=Od,oi="rovingFocusGroup.onEntryFocus",ZC={bubbles:!1,cancelable:!0},mr="RovingFocusGroup",[Ti,$d,VC]=Du(mr),[WC,Bd]=Ft(mr,[VC]),[HC,qC]=WC(mr),Ud=_.forwardRef((e,t)=>h.jsx(Ti.Provider,{scope:e.__scopeRovingFocusGroup,children:h.jsx(Ti.Slot,{scope:e.__scopeRovingFocusGroup,children:h.jsx(KC,{...e,ref:t})})}));Ud.displayName=mr;var KC=_.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,orientation:r,loop:o=!1,dir:i,currentTabStopId:s,defaultCurrentTabStopId:a,onCurrentTabStopIdChange:l,onEntryFocus:c,preventScrollOnEntryFocus:u=!1,...f}=e,p=_.useRef(null),d=Pe(t,p),x=ho(i),[m,y]=nn({prop:s,defaultProp:a??null,onChange:l,caller:mr}),[g,v]=_.useState(!1),k=Qe(c),S=$d(n),C=_.useRef(!1),[E,N]=_.useState(0);return _.useEffect(()=>{const A=p.current;if(A)return A.addEventListener(oi,k),()=>A.removeEventListener(oi,k)},[k]),h.jsx(HC,{scope:n,orientation:r,dir:x,loop:o,currentTabStopId:m,onItemFocus:_.useCallback(A=>y(A),[y]),onItemShiftTab:_.useCallback(()=>v(!0),[]),onFocusableItemAdd:_.useCallback(()=>N(A=>A+1),[]),onFocusableItemRemove:_.useCallback(()=>N(A=>A-1),[]),children:h.jsx(ke.div,{tabIndex:g||E===0?-1:0,"data-orientation":r,...f,ref:d,style:{outline:"none",...e.style},onMouseDown:be(e.onMouseDown,()=>{C.current=!0}),onFocus:be(e.onFocus,A=>{const O=!C.current;if(A.target===A.currentTarget&&O&&!g){const D=new CustomEvent(oi,ZC);if(A.currentTarget.dispatchEvent(D),!D.defaultPrevented){const U=S().filter(K=>K.focusable),T=U.find(K=>K.active),M=U.find(K=>K.id===m),R=[T,M,...U].filter(Boolean).map(K=>K.ref.current);Wd(R,u)}}C.current=!1}),onBlur:be(e.onBlur,()=>v(!1))})})}),Zd="RovingFocusGroupItem",Vd=_.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,focusable:r=!0,active:o=!1,tabStopId:i,children:s,...a}=e,l=Et(),c=i||l,u=qC(Zd,n),f=u.currentTabStopId===c,p=$d(n),{onFocusableItemAdd:d,onFocusableItemRemove:x,currentTabStopId:m}=u;return _.useEffect(()=>{if(r)return d(),()=>x()},[r,d,x]),h.jsx(Ti.ItemSlot,{scope:n,id:c,focusable:r,active:o,children:h.jsx(ke.span,{tabIndex:f?0:-1,"data-orientation":u.orientation,...a,ref:t,onMouseDown:be(e.onMouseDown,y=>{r?u.onItemFocus(c):y.preventDefault()}),onFocus:be(e.onFocus,()=>u.onItemFocus(c)),onKeyDown:be(e.onKeyDown,y=>{if(y.key==="Tab"&&y.shiftKey){u.onItemShiftTab();return}if(y.target!==y.currentTarget)return;const g=JC(y,u.orientation,u.dir);if(g!==void 0){if(y.metaKey||y.ctrlKey||y.altKey||y.shiftKey)return;y.preventDefault();let k=p().filter(S=>S.focusable).map(S=>S.ref.current);if(g==="last")k.reverse();else if(g==="prev"||g==="next"){g==="prev"&&k.reverse();const S=k.indexOf(y.currentTarget);k=u.loop?XC(k,S+1):k.slice(S+1)}setTimeout(()=>Wd(k))}}),children:typeof s=="function"?s({isCurrentTabStop:f,hasTabStop:m!=null}):s})})});Vd.displayName=Zd;var GC={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function YC(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function JC(e,t,n){const r=YC(e.key,n);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(r))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(r)))return GC[r]}function Wd(e,t=!1){const n=document.activeElement;for(const r of e)if(r===n||(r.focus({preventScroll:t}),document.activeElement!==n))return}function XC(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var QC=Ud,eE=Vd;function Ni(e,[t,n]){return Math.min(n,Math.max(t,e))}function tE(e,t){return _.useReducer((n,r)=>t[n][r]??n,e)}var Cs="ScrollArea",[Hd]=Ft(Cs),[nE,pt]=Hd(Cs),qd=_.forwardRef((e,t)=>{const{__scopeScrollArea:n,type:r="hover",dir:o,scrollHideDelay:i=600,...s}=e,[a,l]=_.useState(null),[c,u]=_.useState(null),[f,p]=_.useState(null),[d,x]=_.useState(null),[m,y]=_.useState(null),[g,v]=_.useState(0),[k,S]=_.useState(0),[C,E]=_.useState(!1),[N,A]=_.useState(!1),O=Pe(t,U=>l(U)),D=ho(o);return h.jsx(nE,{scope:n,type:r,dir:D,scrollHideDelay:i,scrollArea:a,viewport:c,onViewportChange:u,content:f,onContentChange:p,scrollbarX:d,onScrollbarXChange:x,scrollbarXEnabled:C,onScrollbarXEnabledChange:E,scrollbarY:m,onScrollbarYChange:y,scrollbarYEnabled:N,onScrollbarYEnabledChange:A,onCornerWidthChange:v,onCornerHeightChange:S,children:h.jsx(ke.div,{dir:D,...s,ref:O,style:{position:"relative","--radix-scroll-area-corner-width":g+"px","--radix-scroll-area-corner-height":k+"px",...e.style}})})});qd.displayName=Cs;var Kd="ScrollAreaViewport",Gd=_.forwardRef((e,t)=>{const{__scopeScrollArea:n,children:r,nonce:o,...i}=e,s=pt(Kd,n),a=_.useRef(null),l=Pe(t,a,s.onViewportChange);return h.jsxs(h.Fragment,{children:[h.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-scroll-area-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-scroll-area-viewport]::-webkit-scrollbar{display:none}"},nonce:o}),h.jsx(ke.div,{"data-radix-scroll-area-viewport":"",...i,ref:l,style:{overflowX:s.scrollbarXEnabled?"scroll":"hidden",overflowY:s.scrollbarYEnabled?"scroll":"hidden",...e.style},children:h.jsx("div",{ref:s.onContentChange,style:{minWidth:"100%",display:"table"},children:r})})]})});Gd.displayName=Kd;var Pt="ScrollAreaScrollbar",Yd=_.forwardRef((e,t)=>{const{forceMount:n,...r}=e,o=pt(Pt,e.__scopeScrollArea),{onScrollbarXEnabledChange:i,onScrollbarYEnabledChange:s}=o,a=e.orientation==="horizontal";return _.useEffect(()=>(a?i(!0):s(!0),()=>{a?i(!1):s(!1)}),[a,i,s]),o.type==="hover"?h.jsx(rE,{...r,ref:t,forceMount:n}):o.type==="scroll"?h.jsx(oE,{...r,ref:t,forceMount:n}):o.type==="auto"?h.jsx(Jd,{...r,ref:t,forceMount:n}):o.type==="always"?h.jsx(Es,{...r,ref:t}):null});Yd.displayName=Pt;var rE=_.forwardRef((e,t)=>{const{forceMount:n,...r}=e,o=pt(Pt,e.__scopeScrollArea),[i,s]=_.useState(!1);return _.useEffect(()=>{const a=o.scrollArea;let l=0;if(a){const c=()=>{window.clearTimeout(l),s(!0)},u=()=>{l=window.setTimeout(()=>s(!1),o.scrollHideDelay)};return a.addEventListener("pointerenter",c),a.addEventListener("pointerleave",u),()=>{window.clearTimeout(l),a.removeEventListener("pointerenter",c),a.removeEventListener("pointerleave",u)}}},[o.scrollArea,o.scrollHideDelay]),h.jsx(ht,{present:n||i,children:h.jsx(Jd,{"data-state":i?"visible":"hidden",...r,ref:t})})}),oE=_.forwardRef((e,t)=>{const{forceMount:n,...r}=e,o=pt(Pt,e.__scopeScrollArea),i=e.orientation==="horizontal",s=So(()=>l("SCROLL_END"),100),[a,l]=tE("hidden",{hidden:{SCROLL:"scrolling"},scrolling:{SCROLL_END:"idle",POINTER_ENTER:"interacting"},interacting:{SCROLL:"interacting",POINTER_LEAVE:"idle"},idle:{HIDE:"hidden",SCROLL:"scrolling",POINTER_ENTER:"interacting"}});return _.useEffect(()=>{if(a==="idle"){const c=window.setTimeout(()=>l("HIDE"),o.scrollHideDelay);return()=>window.clearTimeout(c)}},[a,o.scrollHideDelay,l]),_.useEffect(()=>{const c=o.viewport,u=i?"scrollLeft":"scrollTop";if(c){let f=c[u];const p=()=>{const d=c[u];f!==d&&(l("SCROLL"),s()),f=d};return c.addEventListener("scroll",p),()=>c.removeEventListener("scroll",p)}},[o.viewport,i,l,s]),h.jsx(ht,{present:n||a!=="hidden",children:h.jsx(Es,{"data-state":a==="hidden"?"hidden":"visible",...r,ref:t,onPointerEnter:be(e.onPointerEnter,()=>l("POINTER_ENTER")),onPointerLeave:be(e.onPointerLeave,()=>l("POINTER_LEAVE"))})})}),Jd=_.forwardRef((e,t)=>{const n=pt(Pt,e.__scopeScrollArea),{forceMount:r,...o}=e,[i,s]=_.useState(!1),a=e.orientation==="horizontal",l=So(()=>{if(n.viewport){const c=n.viewport.offsetWidth<n.viewport.scrollWidth,u=n.viewport.offsetHeight<n.viewport.scrollHeight;s(a?c:u)}},10);return On(n.viewport,l),On(n.content,l),h.jsx(ht,{present:r||i,children:h.jsx(Es,{"data-state":i?"visible":"hidden",...o,ref:t})})}),Es=_.forwardRef((e,t)=>{const{orientation:n="vertical",...r}=e,o=pt(Pt,e.__scopeScrollArea),i=_.useRef(null),s=_.useRef(0),[a,l]=_.useState({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),c=nf(a.viewport,a.content),u={...r,sizes:a,onSizesChange:l,hasThumb:c>0&&c<1,onThumbChange:p=>i.current=p,onThumbPointerUp:()=>s.current=0,onThumbPointerDown:p=>s.current=p};function f(p,d){return uE(p,s.current,a,d)}return n==="horizontal"?h.jsx(iE,{...u,ref:t,onThumbPositionChange:()=>{if(o.viewport&&i.current){const p=o.viewport.scrollLeft,d=zl(p,a,o.dir);i.current.style.transform=`translate3d(${d}px, 0, 0)`}},onWheelScroll:p=>{o.viewport&&(o.viewport.scrollLeft=p)},onDragScroll:p=>{o.viewport&&(o.viewport.scrollLeft=f(p,o.dir))}}):n==="vertical"?h.jsx(sE,{...u,ref:t,onThumbPositionChange:()=>{if(o.viewport&&i.current){const p=o.viewport.scrollTop,d=zl(p,a);i.current.style.transform=`translate3d(0, ${d}px, 0)`}},onWheelScroll:p=>{o.viewport&&(o.viewport.scrollTop=p)},onDragScroll:p=>{o.viewport&&(o.viewport.scrollTop=f(p))}}):null}),iE=_.forwardRef((e,t)=>{const{sizes:n,onSizesChange:r,...o}=e,i=pt(Pt,e.__scopeScrollArea),[s,a]=_.useState(),l=_.useRef(null),c=Pe(t,l,i.onScrollbarXChange);return _.useEffect(()=>{l.current&&a(getComputedStyle(l.current))},[l]),h.jsx(Qd,{"data-orientation":"horizontal",...o,ref:c,sizes:n,style:{bottom:0,left:i.dir==="rtl"?"var(--radix-scroll-area-corner-width)":0,right:i.dir==="ltr"?"var(--radix-scroll-area-corner-width)":0,"--radix-scroll-area-thumb-width":ko(n)+"px",...e.style},onThumbPointerDown:u=>e.onThumbPointerDown(u.x),onDragScroll:u=>e.onDragScroll(u.x),onWheelScroll:(u,f)=>{if(i.viewport){const p=i.viewport.scrollLeft+u.deltaX;e.onWheelScroll(p),of(p,f)&&u.preventDefault()}},onResize:()=>{l.current&&i.viewport&&s&&r({content:i.viewport.scrollWidth,viewport:i.viewport.offsetWidth,scrollbar:{size:l.current.clientWidth,paddingStart:eo(s.paddingLeft),paddingEnd:eo(s.paddingRight)}})}})}),sE=_.forwardRef((e,t)=>{const{sizes:n,onSizesChange:r,...o}=e,i=pt(Pt,e.__scopeScrollArea),[s,a]=_.useState(),l=_.useRef(null),c=Pe(t,l,i.onScrollbarYChange);return _.useEffect(()=>{l.current&&a(getComputedStyle(l.current))},[l]),h.jsx(Qd,{"data-orientation":"vertical",...o,ref:c,sizes:n,style:{top:0,right:i.dir==="ltr"?0:void 0,left:i.dir==="rtl"?0:void 0,bottom:"var(--radix-scroll-area-corner-height)","--radix-scroll-area-thumb-height":ko(n)+"px",...e.style},onThumbPointerDown:u=>e.onThumbPointerDown(u.y),onDragScroll:u=>e.onDragScroll(u.y),onWheelScroll:(u,f)=>{if(i.viewport){const p=i.viewport.scrollTop+u.deltaY;e.onWheelScroll(p),of(p,f)&&u.preventDefault()}},onResize:()=>{l.current&&i.viewport&&s&&r({content:i.viewport.scrollHeight,viewport:i.viewport.offsetHeight,scrollbar:{size:l.current.clientHeight,paddingStart:eo(s.paddingTop),paddingEnd:eo(s.paddingBottom)}})}})}),[aE,Xd]=Hd(Pt),Qd=_.forwardRef((e,t)=>{const{__scopeScrollArea:n,sizes:r,hasThumb:o,onThumbChange:i,onThumbPointerUp:s,onThumbPointerDown:a,onThumbPositionChange:l,onDragScroll:c,onWheelScroll:u,onResize:f,...p}=e,d=pt(Pt,n),[x,m]=_.useState(null),y=Pe(t,O=>m(O)),g=_.useRef(null),v=_.useRef(""),k=d.viewport,S=r.content-r.viewport,C=Qe(u),E=Qe(l),N=So(f,10);function A(O){if(g.current){const D=O.clientX-g.current.left,U=O.clientY-g.current.top;c({x:D,y:U})}}return _.useEffect(()=>{const O=D=>{const U=D.target;x?.contains(U)&&C(D,S)};return document.addEventListener("wheel",O,{passive:!1}),()=>document.removeEventListener("wheel",O,{passive:!1})},[k,x,S,C]),_.useEffect(E,[r,E]),On(x,N),On(d.content,N),h.jsx(aE,{scope:n,scrollbar:x,hasThumb:o,onThumbChange:Qe(i),onThumbPointerUp:Qe(s),onThumbPositionChange:E,onThumbPointerDown:Qe(a),children:h.jsx(ke.div,{...p,ref:y,style:{position:"absolute",...p.style},onPointerDown:be(e.onPointerDown,O=>{O.button===0&&(O.target.setPointerCapture(O.pointerId),g.current=x.getBoundingClientRect(),v.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect="none",d.viewport&&(d.viewport.style.scrollBehavior="auto"),A(O))}),onPointerMove:be(e.onPointerMove,A),onPointerUp:be(e.onPointerUp,O=>{const D=O.target;D.hasPointerCapture(O.pointerId)&&D.releasePointerCapture(O.pointerId),document.body.style.webkitUserSelect=v.current,d.viewport&&(d.viewport.style.scrollBehavior=""),g.current=null})})})}),Qr="ScrollAreaThumb",ef=_.forwardRef((e,t)=>{const{forceMount:n,...r}=e,o=Xd(Qr,e.__scopeScrollArea);return h.jsx(ht,{present:n||o.hasThumb,children:h.jsx(lE,{ref:t,...r})})}),lE=_.forwardRef((e,t)=>{const{__scopeScrollArea:n,style:r,...o}=e,i=pt(Qr,n),s=Xd(Qr,n),{onThumbPositionChange:a}=s,l=Pe(t,f=>s.onThumbChange(f)),c=_.useRef(void 0),u=So(()=>{c.current&&(c.current(),c.current=void 0)},100);return _.useEffect(()=>{const f=i.viewport;if(f){const p=()=>{if(u(),!c.current){const d=dE(f,a);c.current=d,a()}};return a(),f.addEventListener("scroll",p),()=>f.removeEventListener("scroll",p)}},[i.viewport,u,a]),h.jsx(ke.div,{"data-state":s.hasThumb?"visible":"hidden",...o,ref:l,style:{width:"var(--radix-scroll-area-thumb-width)",height:"var(--radix-scroll-area-thumb-height)",...r},onPointerDownCapture:be(e.onPointerDownCapture,f=>{const d=f.target.getBoundingClientRect(),x=f.clientX-d.left,m=f.clientY-d.top;s.onThumbPointerDown({x,y:m})}),onPointerUp:be(e.onPointerUp,s.onThumbPointerUp)})});ef.displayName=Qr;var Ts="ScrollAreaCorner",tf=_.forwardRef((e,t)=>{const n=pt(Ts,e.__scopeScrollArea),r=!!(n.scrollbarX&&n.scrollbarY);return n.type!=="scroll"&&r?h.jsx(cE,{...e,ref:t}):null});tf.displayName=Ts;var cE=_.forwardRef((e,t)=>{const{__scopeScrollArea:n,...r}=e,o=pt(Ts,n),[i,s]=_.useState(0),[a,l]=_.useState(0),c=!!(i&&a);return On(o.scrollbarX,()=>{const u=o.scrollbarX?.offsetHeight||0;o.onCornerHeightChange(u),l(u)}),On(o.scrollbarY,()=>{const u=o.scrollbarY?.offsetWidth||0;o.onCornerWidthChange(u),s(u)}),c?h.jsx(ke.div,{...r,ref:t,style:{width:i,height:a,position:"absolute",right:o.dir==="ltr"?0:void 0,left:o.dir==="rtl"?0:void 0,bottom:0,...e.style}}):null});function eo(e){return e?parseInt(e,10):0}function nf(e,t){const n=e/t;return isNaN(n)?0:n}function ko(e){const t=nf(e.viewport,e.content),n=e.scrollbar.paddingStart+e.scrollbar.paddingEnd,r=(e.scrollbar.size-n)*t;return Math.max(r,18)}function uE(e,t,n,r="ltr"){const o=ko(n),i=o/2,s=t||i,a=o-s,l=n.scrollbar.paddingStart+s,c=n.scrollbar.size-n.scrollbar.paddingEnd-a,u=n.content-n.viewport,f=r==="ltr"?[0,u]:[u*-1,0];return rf([l,c],f)(e)}function zl(e,t,n="ltr"){const r=ko(t),o=t.scrollbar.paddingStart+t.scrollbar.paddingEnd,i=t.scrollbar.size-o,s=t.content-t.viewport,a=i-r,l=n==="ltr"?[0,s]:[s*-1,0],c=Ni(e,l);return rf([0,s],[0,a])(c)}function rf(e,t){return n=>{if(e[0]===e[1]||t[0]===t[1])return t[0];const r=(t[1]-t[0])/(e[1]-e[0]);return t[0]+r*(n-e[0])}}function of(e,t){return e>0&&e<t}var dE=(e,t=()=>{})=>{let n={left:e.scrollLeft,top:e.scrollTop},r=0;return(function o(){const i={left:e.scrollLeft,top:e.scrollTop},s=n.left!==i.left,a=n.top!==i.top;(s||a)&&t(),n=i,r=window.requestAnimationFrame(o)})(),()=>window.cancelAnimationFrame(r)};function So(e,t){const n=Qe(e),r=_.useRef(0);return _.useEffect(()=>()=>window.clearTimeout(r.current),[]),_.useCallback(()=>{window.clearTimeout(r.current),r.current=window.setTimeout(n,t)},[n,t])}function On(e,t){const n=Qe(t);qe(()=>{let r=0;if(e){const o=new ResizeObserver(()=>{cancelAnimationFrame(r),r=window.requestAnimationFrame(n)});return o.observe(e),()=>{window.cancelAnimationFrame(r),o.unobserve(e)}}},[e,n])}var fE=qd,hE=Gd,pE=tf,mE=[" ","Enter","ArrowUp","ArrowDown"],gE=[" ","Enter"],sn="Select",[Co,Eo,xE]=Du(sn),[Vn]=Ft(sn,[xE,_o]),To=_o(),[yE,Xt]=Vn(sn),[vE,bE]=Vn(sn),sf=e=>{const{__scopeSelect:t,children:n,open:r,defaultOpen:o,onOpenChange:i,value:s,defaultValue:a,onValueChange:l,dir:c,name:u,autoComplete:f,disabled:p,required:d,form:x}=e,m=To(t),[y,g]=_.useState(null),[v,k]=_.useState(null),[S,C]=_.useState(!1),E=ho(c),[N,A]=nn({prop:r,defaultProp:o??!1,onChange:i,caller:sn}),[O,D]=nn({prop:s,defaultProp:a,onChange:l,caller:sn}),U=_.useRef(null),T=y?x||!!y.closest("form"):!0,[M,b]=_.useState(new Set),R=Array.from(M).map(K=>K.props.value).join(";");return h.jsx(Dd,{...m,children:h.jsxs(yE,{required:d,scope:t,trigger:y,onTriggerChange:g,valueNode:v,onValueNodeChange:k,valueNodeHasChildren:S,onValueNodeHasChildrenChange:C,contentId:Et(),value:O,onValueChange:D,open:N,onOpenChange:A,dir:E,triggerPointerDownPosRef:U,disabled:p,children:[h.jsx(Co.Provider,{scope:t,children:h.jsx(vE,{scope:e.__scopeSelect,onNativeOptionAdd:_.useCallback(K=>{b(V=>new Set(V).add(K))},[]),onNativeOptionRemove:_.useCallback(K=>{b(V=>{const W=new Set(V);return W.delete(K),W})},[]),children:n})}),T?h.jsxs(Nf,{"aria-hidden":!0,required:d,tabIndex:-1,name:u,autoComplete:f,value:O,onChange:K=>D(K.target.value),disabled:p,form:x,children:[O===void 0?h.jsx("option",{value:""}):null,Array.from(M)]},R):null]})})};sf.displayName=sn;var af="SelectTrigger",lf=_.forwardRef((e,t)=>{const{__scopeSelect:n,disabled:r=!1,...o}=e,i=To(n),s=Xt(af,n),a=s.disabled||r,l=Pe(t,s.onTriggerChange),c=Eo(n),u=_.useRef("touch"),[f,p,d]=zf(m=>{const y=c().filter(k=>!k.disabled),g=y.find(k=>k.value===s.value),v=If(y,m,g);v!==void 0&&s.onValueChange(v.value)}),x=m=>{a||(s.onOpenChange(!0),d()),m&&(s.triggerPointerDownPosRef.current={x:Math.round(m.pageX),y:Math.round(m.pageY)})};return h.jsx(Md,{asChild:!0,...i,children:h.jsx(ke.button,{type:"button",role:"combobox","aria-controls":s.contentId,"aria-expanded":s.open,"aria-required":s.required,"aria-autocomplete":"none",dir:s.dir,"data-state":s.open?"open":"closed",disabled:a,"data-disabled":a?"":void 0,"data-placeholder":Af(s.value)?"":void 0,...o,ref:l,onClick:be(o.onClick,m=>{m.currentTarget.focus(),u.current!=="mouse"&&x(m)}),onPointerDown:be(o.onPointerDown,m=>{u.current=m.pointerType;const y=m.target;y.hasPointerCapture(m.pointerId)&&y.releasePointerCapture(m.pointerId),m.button===0&&m.ctrlKey===!1&&m.pointerType==="mouse"&&(x(m),m.preventDefault())}),onKeyDown:be(o.onKeyDown,m=>{const y=f.current!=="";!(m.ctrlKey||m.altKey||m.metaKey)&&m.key.length===1&&p(m.key),!(y&&m.key===" ")&&mE.includes(m.key)&&(x(),m.preventDefault())})})})});lf.displayName=af;var cf="SelectValue",uf=_.forwardRef((e,t)=>{const{__scopeSelect:n,className:r,style:o,children:i,placeholder:s="",...a}=e,l=Xt(cf,n),{onValueNodeHasChildrenChange:c}=l,u=i!==void 0,f=Pe(t,l.onValueNodeChange);return qe(()=>{c(u)},[c,u]),h.jsx(ke.span,{...a,ref:f,style:{pointerEvents:"none"},children:Af(l.value)?h.jsx(h.Fragment,{children:s}):i})});uf.displayName=cf;var wE="SelectIcon",df=_.forwardRef((e,t)=>{const{__scopeSelect:n,children:r,...o}=e;return h.jsx(ke.span,{"aria-hidden":!0,...o,ref:t,children:r||"▼"})});df.displayName=wE;var _E="SelectPortal",ff=e=>h.jsx(mo,{asChild:!0,...e});ff.displayName=_E;var an="SelectContent",hf=_.forwardRef((e,t)=>{const n=Xt(an,e.__scopeSelect),[r,o]=_.useState();if(qe(()=>{o(new DocumentFragment)},[]),!n.open){const i=r;return i?cr.createPortal(h.jsx(pf,{scope:e.__scopeSelect,children:h.jsx(Co.Slot,{scope:e.__scopeSelect,children:h.jsx("div",{children:e.children})})}),i):null}return h.jsx(mf,{...e,ref:t})});hf.displayName=an;var gt=10,[pf,Qt]=Vn(an),kE="SelectContentImpl",SE=jn("SelectContent.RemoveScroll"),mf=_.forwardRef((e,t)=>{const{__scopeSelect:n,position:r="item-aligned",onCloseAutoFocus:o,onEscapeKeyDown:i,onPointerDownOutside:s,side:a,sideOffset:l,align:c,alignOffset:u,arrowPadding:f,collisionBoundary:p,collisionPadding:d,sticky:x,hideWhenDetached:m,avoidCollisions:y,...g}=e,v=Xt(an,n),[k,S]=_.useState(null),[C,E]=_.useState(null),N=Pe(t,oe=>S(oe)),[A,O]=_.useState(null),[D,U]=_.useState(null),T=Eo(n),[M,b]=_.useState(!1),R=_.useRef(!1);_.useEffect(()=>{if(k)return Qu(k)},[k]),Vu();const K=_.useCallback(oe=>{const[le,...he]=T().map(Ee=>Ee.ref.current),[me]=he.slice(-1),ge=document.activeElement;for(const Ee of oe)if(Ee===ge||(Ee?.scrollIntoView({block:"nearest"}),Ee===le&&C&&(C.scrollTop=0),Ee===me&&C&&(C.scrollTop=C.scrollHeight),Ee?.focus(),document.activeElement!==ge))return},[T,C]),V=_.useCallback(()=>K([A,k]),[K,A,k]);_.useEffect(()=>{M&&V()},[M,V]);const{onOpenChange:W,triggerPointerDownPosRef:q}=v;_.useEffect(()=>{if(k){let oe={x:0,y:0};const le=me=>{oe={x:Math.abs(Math.round(me.pageX)-(q.current?.x??0)),y:Math.abs(Math.round(me.pageY)-(q.current?.y??0))}},he=me=>{oe.x<=10&&oe.y<=10?me.preventDefault():k.contains(me.target)||W(!1),document.removeEventListener("pointermove",le),q.current=null};return q.current!==null&&(document.addEventListener("pointermove",le),document.addEventListener("pointerup",he,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",le),document.removeEventListener("pointerup",he,{capture:!0})}}},[k,W,q]),_.useEffect(()=>{const oe=()=>W(!1);return window.addEventListener("blur",oe),window.addEventListener("resize",oe),()=>{window.removeEventListener("blur",oe),window.removeEventListener("resize",oe)}},[W]);const[I,B]=zf(oe=>{const le=T().filter(ge=>!ge.disabled),he=le.find(ge=>ge.ref.current===document.activeElement),me=If(le,oe,he);me&&setTimeout(()=>me.ref.current.focus())}),$=_.useCallback((oe,le,he)=>{const me=!R.current&&!he;(v.value!==void 0&&v.value===le||me)&&(O(oe),me&&(R.current=!0))},[v.value]),z=_.useCallback(()=>k?.focus(),[k]),Q=_.useCallback((oe,le,he)=>{const me=!R.current&&!he;(v.value!==void 0&&v.value===le||me)&&U(oe)},[v.value]),te=r==="popper"?Ai:gf,xe=te===Ai?{side:a,sideOffset:l,align:c,alignOffset:u,arrowPadding:f,collisionBoundary:p,collisionPadding:d,sticky:x,hideWhenDetached:m,avoidCollisions:y}:{};return h.jsx(pf,{scope:n,content:k,viewport:C,onViewportChange:E,itemRefCallback:$,selectedItem:A,onItemLeave:z,itemTextRefCallback:Q,focusSelectedItem:V,selectedItemText:D,position:r,isPositioned:M,searchRef:I,children:h.jsx(hs,{as:SE,allowPinchZoom:!0,children:h.jsx(fs,{asChild:!0,trapped:v.open,onMountAutoFocus:oe=>{oe.preventDefault()},onUnmountAutoFocus:be(o,oe=>{v.trigger?.focus({preventScroll:!0}),oe.preventDefault()}),children:h.jsx(po,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:i,onPointerDownOutside:s,onFocusOutside:oe=>oe.preventDefault(),onDismiss:()=>v.onOpenChange(!1),children:h.jsx(te,{role:"listbox",id:v.contentId,"data-state":v.open?"open":"closed",dir:v.dir,onContextMenu:oe=>oe.preventDefault(),...g,...xe,onPlaced:()=>b(!0),ref:N,style:{display:"flex",flexDirection:"column",outline:"none",...g.style},onKeyDown:be(g.onKeyDown,oe=>{const le=oe.ctrlKey||oe.altKey||oe.metaKey;if(oe.key==="Tab"&&oe.preventDefault(),!le&&oe.key.length===1&&B(oe.key),["ArrowUp","ArrowDown","Home","End"].includes(oe.key)){let me=T().filter(ge=>!ge.disabled).map(ge=>ge.ref.current);if(["ArrowUp","End"].includes(oe.key)&&(me=me.slice().reverse()),["ArrowUp","ArrowDown"].includes(oe.key)){const ge=oe.target,Ee=me.indexOf(ge);me=me.slice(Ee+1)}setTimeout(()=>K(me)),oe.preventDefault()}})})})})})})});mf.displayName=kE;var CE="SelectItemAlignedPosition",gf=_.forwardRef((e,t)=>{const{__scopeSelect:n,onPlaced:r,...o}=e,i=Xt(an,n),s=Qt(an,n),[a,l]=_.useState(null),[c,u]=_.useState(null),f=Pe(t,N=>u(N)),p=Eo(n),d=_.useRef(!1),x=_.useRef(!0),{viewport:m,selectedItem:y,selectedItemText:g,focusSelectedItem:v}=s,k=_.useCallback(()=>{if(i.trigger&&i.valueNode&&a&&c&&m&&y&&g){const N=i.trigger.getBoundingClientRect(),A=c.getBoundingClientRect(),O=i.valueNode.getBoundingClientRect(),D=g.getBoundingClientRect();if(i.dir!=="rtl"){const ge=D.left-A.left,Ee=O.left-ge,Oe=N.left-Ee,w=N.width+Oe,Y=Math.max(w,A.width),H=window.innerWidth-gt,P=Ni(Ee,[gt,Math.max(gt,H-Y)]);a.style.minWidth=w+"px",a.style.left=P+"px"}else{const ge=A.right-D.right,Ee=window.innerWidth-O.right-ge,Oe=window.innerWidth-N.right-Ee,w=N.width+Oe,Y=Math.max(w,A.width),H=window.innerWidth-gt,P=Ni(Ee,[gt,Math.max(gt,H-Y)]);a.style.minWidth=w+"px",a.style.right=P+"px"}const U=p(),T=window.innerHeight-gt*2,M=m.scrollHeight,b=window.getComputedStyle(c),R=parseInt(b.borderTopWidth,10),K=parseInt(b.paddingTop,10),V=parseInt(b.borderBottomWidth,10),W=parseInt(b.paddingBottom,10),q=R+K+M+W+V,I=Math.min(y.offsetHeight*5,q),B=window.getComputedStyle(m),$=parseInt(B.paddingTop,10),z=parseInt(B.paddingBottom,10),Q=N.top+N.height/2-gt,te=T-Q,xe=y.offsetHeight/2,oe=y.offsetTop+xe,le=R+K+oe,he=q-le;if(le<=Q){const ge=U.length>0&&y===U[U.length-1].ref.current;a.style.bottom="0px";const Ee=c.clientHeight-m.offsetTop-m.offsetHeight,Oe=Math.max(te,xe+(ge?z:0)+Ee+V),w=le+Oe;a.style.height=w+"px"}else{const ge=U.length>0&&y===U[0].ref.current;a.style.top="0px";const Oe=Math.max(Q,R+m.offsetTop+(ge?$:0)+xe)+he;a.style.height=Oe+"px",m.scrollTop=le-Q+m.offsetTop}a.style.margin=`${gt}px 0`,a.style.minHeight=I+"px",a.style.maxHeight=T+"px",r?.(),requestAnimationFrame(()=>d.current=!0)}},[p,i.trigger,i.valueNode,a,c,m,y,g,i.dir,r]);qe(()=>k(),[k]);const[S,C]=_.useState();qe(()=>{c&&C(window.getComputedStyle(c).zIndex)},[c]);const E=_.useCallback(N=>{N&&x.current===!0&&(k(),v?.(),x.current=!1)},[k,v]);return h.jsx(TE,{scope:n,contentWrapper:a,shouldExpandOnScrollRef:d,onScrollButtonChange:E,children:h.jsx("div",{ref:l,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:S},children:h.jsx(ke.div,{...o,ref:f,style:{boxSizing:"border-box",maxHeight:"100%",...o.style}})})})});gf.displayName=CE;var EE="SelectPopperPosition",Ai=_.forwardRef((e,t)=>{const{__scopeSelect:n,align:r="start",collisionPadding:o=gt,...i}=e,s=To(n);return h.jsx(Ld,{...s,...i,ref:t,align:r,collisionPadding:o,style:{boxSizing:"border-box",...i.style,"--radix-select-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-select-content-available-width":"var(--radix-popper-available-width)","--radix-select-content-available-height":"var(--radix-popper-available-height)","--radix-select-trigger-width":"var(--radix-popper-anchor-width)","--radix-select-trigger-height":"var(--radix-popper-anchor-height)"}})});Ai.displayName=EE;var[TE,Ns]=Vn(an,{}),zi="SelectViewport",xf=_.forwardRef((e,t)=>{const{__scopeSelect:n,nonce:r,...o}=e,i=Qt(zi,n),s=Ns(zi,n),a=Pe(t,i.onViewportChange),l=_.useRef(0);return h.jsxs(h.Fragment,{children:[h.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}"},nonce:r}),h.jsx(Co.Slot,{scope:n,children:h.jsx(ke.div,{"data-radix-select-viewport":"",role:"presentation",...o,ref:a,style:{position:"relative",flex:1,overflow:"hidden auto",...o.style},onScroll:be(o.onScroll,c=>{const u=c.currentTarget,{contentWrapper:f,shouldExpandOnScrollRef:p}=s;if(p?.current&&f){const d=Math.abs(l.current-u.scrollTop);if(d>0){const x=window.innerHeight-gt*2,m=parseFloat(f.style.minHeight),y=parseFloat(f.style.height),g=Math.max(m,y);if(g<x){const v=g+d,k=Math.min(x,v),S=v-k;f.style.height=k+"px",f.style.bottom==="0px"&&(u.scrollTop=S>0?S:0,f.style.justifyContent="flex-end")}}}l.current=u.scrollTop})})})]})});xf.displayName=zi;var yf="SelectGroup",[NE,AE]=Vn(yf),zE=_.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,o=Et();return h.jsx(NE,{scope:n,id:o,children:h.jsx(ke.div,{role:"group","aria-labelledby":o,...r,ref:t})})});zE.displayName=yf;var vf="SelectLabel",IE=_.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,o=AE(vf,n);return h.jsx(ke.div,{id:o.id,...r,ref:t})});IE.displayName=vf;var to="SelectItem",[jE,bf]=Vn(to),wf=_.forwardRef((e,t)=>{const{__scopeSelect:n,value:r,disabled:o=!1,textValue:i,...s}=e,a=Xt(to,n),l=Qt(to,n),c=a.value===r,[u,f]=_.useState(i??""),[p,d]=_.useState(!1),x=Pe(t,v=>l.itemRefCallback?.(v,r,o)),m=Et(),y=_.useRef("touch"),g=()=>{o||(a.onValueChange(r),a.onOpenChange(!1))};if(r==="")throw new Error("A <Select.Item /> must have a value prop that is not an empty string. This is because the Select value can be set to an empty string to clear the selection and show the placeholder.");return h.jsx(jE,{scope:n,value:r,disabled:o,textId:m,isSelected:c,onItemTextChange:_.useCallback(v=>{f(k=>k||(v?.textContent??"").trim())},[]),children:h.jsx(Co.ItemSlot,{scope:n,value:r,disabled:o,textValue:u,children:h.jsx(ke.div,{role:"option","aria-labelledby":m,"data-highlighted":p?"":void 0,"aria-selected":c&&p,"data-state":c?"checked":"unchecked","aria-disabled":o||void 0,"data-disabled":o?"":void 0,tabIndex:o?void 0:-1,...s,ref:x,onFocus:be(s.onFocus,()=>d(!0)),onBlur:be(s.onBlur,()=>d(!1)),onClick:be(s.onClick,()=>{y.current!=="mouse"&&g()}),onPointerUp:be(s.onPointerUp,()=>{y.current==="mouse"&&g()}),onPointerDown:be(s.onPointerDown,v=>{y.current=v.pointerType}),onPointerMove:be(s.onPointerMove,v=>{y.current=v.pointerType,o?l.onItemLeave?.():y.current==="mouse"&&v.currentTarget.focus({preventScroll:!0})}),onPointerLeave:be(s.onPointerLeave,v=>{v.currentTarget===document.activeElement&&l.onItemLeave?.()}),onKeyDown:be(s.onKeyDown,v=>{l.searchRef?.current!==""&&v.key===" "||(gE.includes(v.key)&&g(),v.key===" "&&v.preventDefault())})})})})});wf.displayName=to;var Qn="SelectItemText",_f=_.forwardRef((e,t)=>{const{__scopeSelect:n,className:r,style:o,...i}=e,s=Xt(Qn,n),a=Qt(Qn,n),l=bf(Qn,n),c=bE(Qn,n),[u,f]=_.useState(null),p=Pe(t,g=>f(g),l.onItemTextChange,g=>a.itemTextRefCallback?.(g,l.value,l.disabled)),d=u?.textContent,x=_.useMemo(()=>h.jsx("option",{value:l.value,disabled:l.disabled,children:d},l.value),[l.disabled,l.value,d]),{onNativeOptionAdd:m,onNativeOptionRemove:y}=c;return qe(()=>(m(x),()=>y(x)),[m,y,x]),h.jsxs(h.Fragment,{children:[h.jsx(ke.span,{id:l.textId,...i,ref:p}),l.isSelected&&s.valueNode&&!s.valueNodeHasChildren?cr.createPortal(i.children,s.valueNode):null]})});_f.displayName=Qn;var kf="SelectItemIndicator",Sf=_.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e;return bf(kf,n).isSelected?h.jsx(ke.span,{"aria-hidden":!0,...r,ref:t}):null});Sf.displayName=kf;var Ii="SelectScrollUpButton",Cf=_.forwardRef((e,t)=>{const n=Qt(Ii,e.__scopeSelect),r=Ns(Ii,e.__scopeSelect),[o,i]=_.useState(!1),s=Pe(t,r.onScrollButtonChange);return qe(()=>{if(n.viewport&&n.isPositioned){let a=function(){const c=l.scrollTop>0;i(c)};const l=n.viewport;return a(),l.addEventListener("scroll",a),()=>l.removeEventListener("scroll",a)}},[n.viewport,n.isPositioned]),o?h.jsx(Tf,{...e,ref:s,onAutoScroll:()=>{const{viewport:a,selectedItem:l}=n;a&&l&&(a.scrollTop=a.scrollTop-l.offsetHeight)}}):null});Cf.displayName=Ii;var ji="SelectScrollDownButton",Ef=_.forwardRef((e,t)=>{const n=Qt(ji,e.__scopeSelect),r=Ns(ji,e.__scopeSelect),[o,i]=_.useState(!1),s=Pe(t,r.onScrollButtonChange);return qe(()=>{if(n.viewport&&n.isPositioned){let a=function(){const c=l.scrollHeight-l.clientHeight,u=Math.ceil(l.scrollTop)<c;i(u)};const l=n.viewport;return a(),l.addEventListener("scroll",a),()=>l.removeEventListener("scroll",a)}},[n.viewport,n.isPositioned]),o?h.jsx(Tf,{...e,ref:s,onAutoScroll:()=>{const{viewport:a,selectedItem:l}=n;a&&l&&(a.scrollTop=a.scrollTop+l.offsetHeight)}}):null});Ef.displayName=ji;var Tf=_.forwardRef((e,t)=>{const{__scopeSelect:n,onAutoScroll:r,...o}=e,i=Qt("SelectScrollButton",n),s=_.useRef(null),a=Eo(n),l=_.useCallback(()=>{s.current!==null&&(window.clearInterval(s.current),s.current=null)},[]);return _.useEffect(()=>()=>l(),[l]),qe(()=>{a().find(u=>u.ref.current===document.activeElement)?.ref.current?.scrollIntoView({block:"nearest"})},[a]),h.jsx(ke.div,{"aria-hidden":!0,...o,ref:t,style:{flexShrink:0,...o.style},onPointerDown:be(o.onPointerDown,()=>{s.current===null&&(s.current=window.setInterval(r,50))}),onPointerMove:be(o.onPointerMove,()=>{i.onItemLeave?.(),s.current===null&&(s.current=window.setInterval(r,50))}),onPointerLeave:be(o.onPointerLeave,()=>{l()})})}),PE="SelectSeparator",OE=_.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e;return h.jsx(ke.div,{"aria-hidden":!0,...r,ref:t})});OE.displayName=PE;var Pi="SelectArrow",RE=_.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,o=To(n),i=Xt(Pi,n),s=Qt(Pi,n);return i.open&&s.position==="popper"?h.jsx(Fd,{...o,...r,ref:t}):null});RE.displayName=Pi;var DE="SelectBubbleInput",Nf=_.forwardRef(({__scopeSelect:e,value:t,...n},r)=>{const o=_.useRef(null),i=Pe(r,o),s=_S(t);return _.useEffect(()=>{const a=o.current;if(!a)return;const l=window.HTMLSelectElement.prototype,u=Object.getOwnPropertyDescriptor(l,"value").set;if(s!==t&&u){const f=new Event("change",{bubbles:!0});u.call(a,t),a.dispatchEvent(f)}},[s,t]),h.jsx(ke.select,{...n,style:{...Ou,...n.style},ref:i,defaultValue:t})});Nf.displayName=DE;function Af(e){return e===""||e===void 0}function zf(e){const t=Qe(e),n=_.useRef(""),r=_.useRef(0),o=_.useCallback(s=>{const a=n.current+s;t(a),(function l(c){n.current=c,window.clearTimeout(r.current),c!==""&&(r.current=window.setTimeout(()=>l(""),1e3))})(a)},[t]),i=_.useCallback(()=>{n.current="",window.clearTimeout(r.current)},[]);return _.useEffect(()=>()=>window.clearTimeout(r.current),[]),[n,o,i]}function If(e,t,n){const o=t.length>1&&Array.from(t).every(c=>c===t[0])?t[0]:t,i=n?e.indexOf(n):-1;let s=ME(e,Math.max(i,0));o.length===1&&(s=s.filter(c=>c!==n));const l=s.find(c=>c.textValue.toLowerCase().startsWith(o.toLowerCase()));return l!==n?l:void 0}function ME(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var LE=sf,FE=lf,$E=uf,BE=df,UE=ff,ZE=hf,VE=xf,WE=wf,HE=_f,qE=Sf,KE=Cf,GE=Ef,YE="Separator",Il="horizontal",JE=["horizontal","vertical"],jf=_.forwardRef((e,t)=>{const{decorative:n,orientation:r=Il,...o}=e,i=XE(r)?r:Il,a=n?{role:"none"}:{"aria-orientation":i==="vertical"?i:void 0,role:"separator"};return h.jsx(ke.div,{"data-orientation":i,...a,...o,ref:t})});jf.displayName=YE;function XE(e){return JE.includes(e)}var QE=jf,No="Tabs",[e3]=Ft(No,[Bd]),Pf=Bd(),[t3,As]=e3(No),Of=_.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,onValueChange:o,defaultValue:i,orientation:s="horizontal",dir:a,activationMode:l="automatic",...c}=e,u=ho(a),[f,p]=nn({prop:r,onChange:o,defaultProp:i??"",caller:No});return h.jsx(t3,{scope:n,baseId:Et(),value:f,onValueChange:p,orientation:s,dir:u,activationMode:l,children:h.jsx(ke.div,{dir:u,"data-orientation":s,...c,ref:t})})});Of.displayName=No;var Rf="TabsList",Df=_.forwardRef((e,t)=>{const{__scopeTabs:n,loop:r=!0,...o}=e,i=As(Rf,n),s=Pf(n);return h.jsx(QC,{asChild:!0,...s,orientation:i.orientation,dir:i.dir,loop:r,children:h.jsx(ke.div,{role:"tablist","aria-orientation":i.orientation,...o,ref:t})})});Df.displayName=Rf;var Mf="TabsTrigger",Lf=_.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,disabled:o=!1,...i}=e,s=As(Mf,n),a=Pf(n),l=Bf(s.baseId,r),c=Uf(s.baseId,r),u=r===s.value;return h.jsx(eE,{asChild:!0,...a,focusable:!o,active:u,children:h.jsx(ke.button,{type:"button",role:"tab","aria-selected":u,"aria-controls":c,"data-state":u?"active":"inactive","data-disabled":o?"":void 0,disabled:o,id:l,...i,ref:t,onMouseDown:be(e.onMouseDown,f=>{!o&&f.button===0&&f.ctrlKey===!1?s.onValueChange(r):f.preventDefault()}),onKeyDown:be(e.onKeyDown,f=>{[" ","Enter"].includes(f.key)&&s.onValueChange(r)}),onFocus:be(e.onFocus,()=>{const f=s.activationMode!=="manual";!u&&!o&&f&&s.onValueChange(r)})})})});Lf.displayName=Mf;var Ff="TabsContent",$f=_.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,forceMount:o,children:i,...s}=e,a=As(Ff,n),l=Bf(a.baseId,r),c=Uf(a.baseId,r),u=r===a.value,f=_.useRef(u);return _.useEffect(()=>{const p=requestAnimationFrame(()=>f.current=!1);return()=>cancelAnimationFrame(p)},[]),h.jsx(ht,{present:o||u,children:({present:p})=>h.jsx(ke.div,{"data-state":u?"active":"inactive","data-orientation":a.orientation,role:"tabpanel","aria-labelledby":l,hidden:!p,id:c,tabIndex:0,...s,ref:t,style:{...e.style,animationDuration:f.current?"0s":void 0},children:p&&i})})});$f.displayName=Ff;function Bf(e,t){return`${e}-trigger-${t}`}function Uf(e,t){return`${e}-content-${t}`}var n3=Of,r3=Df,o3=Lf,i3=$f,[Ao]=Ft("Tooltip",[_o]),zo=_o(),Zf="TooltipProvider",s3=700,Oi="tooltip.open",[a3,zs]=Ao(Zf),Vf=e=>{const{__scopeTooltip:t,delayDuration:n=s3,skipDelayDuration:r=300,disableHoverableContent:o=!1,children:i}=e,s=_.useRef(!0),a=_.useRef(!1),l=_.useRef(0);return _.useEffect(()=>{const c=l.current;return()=>window.clearTimeout(c)},[]),h.jsx(a3,{scope:t,isOpenDelayedRef:s,delayDuration:n,onOpen:_.useCallback(()=>{window.clearTimeout(l.current),s.current=!1},[]),onClose:_.useCallback(()=>{window.clearTimeout(l.current),l.current=window.setTimeout(()=>s.current=!0,r)},[r]),isPointerInTransitRef:a,onPointerInTransitChange:_.useCallback(c=>{a.current=c},[]),disableHoverableContent:o,children:i})};Vf.displayName=Zf;var ar="Tooltip",[l3,gr]=Ao(ar),Wf=e=>{const{__scopeTooltip:t,children:n,open:r,defaultOpen:o,onOpenChange:i,disableHoverableContent:s,delayDuration:a}=e,l=zs(ar,e.__scopeTooltip),c=zo(t),[u,f]=_.useState(null),p=Et(),d=_.useRef(0),x=s??l.disableHoverableContent,m=a??l.delayDuration,y=_.useRef(!1),[g,v]=nn({prop:r,defaultProp:o??!1,onChange:N=>{N?(l.onOpen(),document.dispatchEvent(new CustomEvent(Oi))):l.onClose(),i?.(N)},caller:ar}),k=_.useMemo(()=>g?y.current?"delayed-open":"instant-open":"closed",[g]),S=_.useCallback(()=>{window.clearTimeout(d.current),d.current=0,y.current=!1,v(!0)},[v]),C=_.useCallback(()=>{window.clearTimeout(d.current),d.current=0,v(!1)},[v]),E=_.useCallback(()=>{window.clearTimeout(d.current),d.current=window.setTimeout(()=>{y.current=!0,v(!0),d.current=0},m)},[m,v]);return _.useEffect(()=>()=>{d.current&&(window.clearTimeout(d.current),d.current=0)},[]),h.jsx(Dd,{...c,children:h.jsx(l3,{scope:t,contentId:p,open:g,stateAttribute:k,trigger:u,onTriggerChange:f,onTriggerEnter:_.useCallback(()=>{l.isOpenDelayedRef.current?E():S()},[l.isOpenDelayedRef,E,S]),onTriggerLeave:_.useCallback(()=>{x?C():(window.clearTimeout(d.current),d.current=0)},[C,x]),onOpen:S,onClose:C,disableHoverableContent:x,children:n})})};Wf.displayName=ar;var Ri="TooltipTrigger",Hf=_.forwardRef((e,t)=>{const{__scopeTooltip:n,...r}=e,o=gr(Ri,n),i=zs(Ri,n),s=zo(n),a=_.useRef(null),l=Pe(t,a,o.onTriggerChange),c=_.useRef(!1),u=_.useRef(!1),f=_.useCallback(()=>c.current=!1,[]);return _.useEffect(()=>()=>document.removeEventListener("pointerup",f),[f]),h.jsx(Md,{asChild:!0,...s,children:h.jsx(ke.button,{"aria-describedby":o.open?o.contentId:void 0,"data-state":o.stateAttribute,...r,ref:l,onPointerMove:be(e.onPointerMove,p=>{p.pointerType!=="touch"&&!u.current&&!i.isPointerInTransitRef.current&&(o.onTriggerEnter(),u.current=!0)}),onPointerLeave:be(e.onPointerLeave,()=>{o.onTriggerLeave(),u.current=!1}),onPointerDown:be(e.onPointerDown,()=>{o.open&&o.onClose(),c.current=!0,document.addEventListener("pointerup",f,{once:!0})}),onFocus:be(e.onFocus,()=>{c.current||o.onOpen()}),onBlur:be(e.onBlur,o.onClose),onClick:be(e.onClick,o.onClose)})})});Hf.displayName=Ri;var Is="TooltipPortal",[c3,u3]=Ao(Is,{forceMount:void 0}),qf=e=>{const{__scopeTooltip:t,forceMount:n,children:r,container:o}=e,i=gr(Is,t);return h.jsx(c3,{scope:t,forceMount:n,children:h.jsx(ht,{present:n||i.open,children:h.jsx(mo,{asChild:!0,container:o,children:r})})})};qf.displayName=Is;var Rn="TooltipContent",Kf=_.forwardRef((e,t)=>{const n=u3(Rn,e.__scopeTooltip),{forceMount:r=n.forceMount,side:o="top",...i}=e,s=gr(Rn,e.__scopeTooltip);return h.jsx(ht,{present:r||s.open,children:s.disableHoverableContent?h.jsx(Gf,{side:o,...i,ref:t}):h.jsx(d3,{side:o,...i,ref:t})})}),d3=_.forwardRef((e,t)=>{const n=gr(Rn,e.__scopeTooltip),r=zs(Rn,e.__scopeTooltip),o=_.useRef(null),i=Pe(t,o),[s,a]=_.useState(null),{trigger:l,onClose:c}=n,u=o.current,{onPointerInTransitChange:f}=r,p=_.useCallback(()=>{a(null),f(!1)},[f]),d=_.useCallback((x,m)=>{const y=x.currentTarget,g={x:x.clientX,y:x.clientY},v=m3(g,y.getBoundingClientRect()),k=g3(g,v),S=x3(m.getBoundingClientRect()),C=v3([...k,...S]);a(C),f(!0)},[f]);return _.useEffect(()=>()=>p(),[p]),_.useEffect(()=>{if(l&&u){const x=y=>d(y,u),m=y=>d(y,l);return l.addEventListener("pointerleave",x),u.addEventListener("pointerleave",m),()=>{l.removeEventListener("pointerleave",x),u.removeEventListener("pointerleave",m)}}},[l,u,d,p]),_.useEffect(()=>{if(s){const x=m=>{const y=m.target,g={x:m.clientX,y:m.clientY},v=l?.contains(y)||u?.contains(y),k=!y3(g,s);v?p():k&&(p(),c())};return document.addEventListener("pointermove",x),()=>document.removeEventListener("pointermove",x)}},[l,u,s,c,p]),h.jsx(Gf,{...e,ref:i})}),[f3,h3]=Ao(ar,{isInside:!1}),p3=R_("TooltipContent"),Gf=_.forwardRef((e,t)=>{const{__scopeTooltip:n,children:r,"aria-label":o,onEscapeKeyDown:i,onPointerDownOutside:s,...a}=e,l=gr(Rn,n),c=zo(n),{onClose:u}=l;return _.useEffect(()=>(document.addEventListener(Oi,u),()=>document.removeEventListener(Oi,u)),[u]),_.useEffect(()=>{if(l.trigger){const f=p=>{p.target?.contains(l.trigger)&&u()};return window.addEventListener("scroll",f,{capture:!0}),()=>window.removeEventListener("scroll",f,{capture:!0})}},[l.trigger,u]),h.jsx(po,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:i,onPointerDownOutside:s,onFocusOutside:f=>f.preventDefault(),onDismiss:u,children:h.jsxs(Ld,{"data-state":l.stateAttribute,...c,...a,ref:t,style:{...a.style,"--radix-tooltip-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-tooltip-content-available-width":"var(--radix-popper-available-width)","--radix-tooltip-content-available-height":"var(--radix-popper-available-height)","--radix-tooltip-trigger-width":"var(--radix-popper-anchor-width)","--radix-tooltip-trigger-height":"var(--radix-popper-anchor-height)"},children:[h.jsx(p3,{children:r}),h.jsx(f3,{scope:n,isInside:!0,children:h.jsx(U_,{id:l.contentId,role:"tooltip",children:o||r})})]})})});Kf.displayName=Rn;var Yf="TooltipArrow",Jf=_.forwardRef((e,t)=>{const{__scopeTooltip:n,...r}=e,o=zo(n);return h3(Yf,n).isInside?null:h.jsx(Fd,{...o,...r,ref:t})});Jf.displayName=Yf;function m3(e,t){const n=Math.abs(t.top-e.y),r=Math.abs(t.bottom-e.y),o=Math.abs(t.right-e.x),i=Math.abs(t.left-e.x);switch(Math.min(n,r,o,i)){case i:return"left";case o:return"right";case n:return"top";case r:return"bottom";default:throw new Error("unreachable")}}function g3(e,t,n=5){const r=[];switch(t){case"top":r.push({x:e.x-n,y:e.y+n},{x:e.x+n,y:e.y+n});break;case"bottom":r.push({x:e.x-n,y:e.y-n},{x:e.x+n,y:e.y-n});break;case"left":r.push({x:e.x+n,y:e.y-n},{x:e.x+n,y:e.y+n});break;case"right":r.push({x:e.x-n,y:e.y-n},{x:e.x-n,y:e.y+n});break}return r}function x3(e){const{top:t,right:n,bottom:r,left:o}=e;return[{x:o,y:t},{x:n,y:t},{x:n,y:r},{x:o,y:r}]}function y3(e,t){const{x:n,y:r}=e;let o=!1;for(let i=0,s=t.length-1;i<t.length;s=i++){const a=t[i],l=t[s],c=a.x,u=a.y,f=l.x,p=l.y;u>r!=p>r&&n<(f-c)*(r-u)/(p-u)+c&&(o=!o)}return o}function v3(e){const t=e.slice();return t.sort((n,r)=>n.x<r.x?-1:n.x>r.x?1:n.y<r.y?-1:n.y>r.y?1:0),b3(t)}function b3(e){if(e.length<=1)return e.slice();const t=[];for(let r=0;r<e.length;r++){const o=e[r];for(;t.length>=2;){const i=t[t.length-1],s=t[t.length-2];if((i.x-s.x)*(o.y-s.y)>=(i.y-s.y)*(o.x-s.x))t.pop();else break}t.push(o)}t.pop();const n=[];for(let r=e.length-1;r>=0;r--){const o=e[r];for(;n.length>=2;){const i=n[n.length-1],s=n[n.length-2];if((i.x-s.x)*(o.y-s.y)>=(i.y-s.y)*(o.x-s.x))n.pop();else break}n.push(o)}return n.pop(),t.length===1&&n.length===1&&t[0].x===n[0].x&&t[0].y===n[0].y?t:t.concat(n)}var w3=Vf,_3=Wf,k3=Hf,S3=qf,C3=Kf,E3=Jf;function jl({delayDuration:e=0,...t}){return h.jsx(w3,{"data-slot":"tooltip-provider",delayDuration:e,...t})}function T3({...e}){return h.jsx(_3,{"data-slot":"tooltip",...e})}function N3({...e}){return h.jsx(k3,{"data-slot":"tooltip-trigger",...e})}function A3({className:e,sideOffset:t=0,children:n,...r}){return h.jsx(S3,{children:h.jsxs(C3,{"data-slot":"tooltip-content",sideOffset:t,className:ze("bg-foreground text-background animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 w-fit origin-(--radix-tooltip-content-transform-origin) rounded-md px-3 py-1.5 text-xs text-balance",e),...r,children:[n,h.jsx(E3,{className:"bg-foreground fill-foreground z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px]"})]})})}function Xf(e){if(e===null)return"null";if(Array.isArray(e))return"array";switch(typeof e){case"string":return"string";case"number":return"number";case"boolean":return"boolean";case"object":return"object";case"bigint":case"symbol":case"undefined":case"function":return"object"}}function no(e){return e!==null&&(Array.isArray(e)||typeof e=="object")}function z3(e,t){const n=Object.getOwnPropertyDescriptor(e,t);if(n!==void 0)return n.value}function js(e){return Array.isArray(e)?e.map((t,n)=>[String(n),t]):typeof e=="object"&&e!==null?Object.keys(e).map(t=>{const n=z3(e,t);return[t,lr(n)]}):[]}function Pl(e){return Array.isArray(e)?e.length:typeof e=="object"&&e!==null?Object.keys(e).length:0}const Ol=120;function I3({text:e}){const[t,n]=_.useState(!1);return e.length>Ol?h.jsxs("span",{className:"text-emerald-400 break-all",children:['"',t?h.jsx("span",{className:"cursor-pointer prose prose-sm dark:prose-invert inline max-w-none [&_p]:inline [&_p]:my-0 [&_code]:text-emerald-300 [&_a]:text-emerald-300",onClick:o=>{o.stopPropagation(),n(!1)},onKeyDown:o=>{(o.key==="Enter"||o.key===" ")&&(o.stopPropagation(),n(!1))},role:"button",tabIndex:0,children:h.jsx(In,{children:e})}):h.jsxs(T3,{delayDuration:300,children:[h.jsxs(N3,{onClick:o=>{o.stopPropagation(),n(!0)},className:"text-left cursor-pointer",children:[h.jsx("span",{children:e.slice(0,Ol)}),h.jsx("span",{className:"text-emerald-400/50",children:"…"})]}),h.jsxs(A3,{side:"bottom",className:"max-w-md text-xs p-2 break-words whitespace-pre-wrap",children:[e.slice(0,500),e.length>500?"…":""]})]}),'"']}):h.jsxs("span",{className:"text-emerald-400 break-all",children:['"',h.jsx("span",{className:"prose prose-sm dark:prose-invert inline max-w-none [&_p]:inline [&_p]:my-0 [&_code]:text-emerald-300 [&_a]:text-emerald-300",children:h.jsx(In,{children:e})}),'"']})}function Qf({value:e}){if(e===null)return h.jsx("span",{className:"text-rose-400 italic",children:"null"});switch(typeof e){case"string":return h.jsx(I3,{text:e});case"number":return h.jsx("span",{className:"text-amber-400",children:e});case"boolean":return h.jsx("span",{className:"text-blue-400",children:e?"true":"false"});case"object":case"bigint":case"symbol":case"undefined":case"function":return h.jsx("span",{className:"text-muted-foreground",children:JSON.stringify(e)})}}function Rl({value:e}){const[t,n]=_.useState(!1);function r(o){o.stopPropagation(),window.navigator.clipboard.writeText(JSON.stringify(e,null,2)).then(()=>{n(!0),setTimeout(()=>{n(!1)},2e3)})}return h.jsx("button",{type:"button",onClick:r,className:"inline-flex items-center gap-1 text-[10px] text-muted-foreground hover:text-foreground transition-colors",title:"Copy JSON",children:t?h.jsx(ur,{className:"size-3 text-green-500"}):h.jsx(ao,{className:"size-3"})})}function j3({value:e}){const[t,n]=_.useState(!1);function r(o){o.stopPropagation(),window.navigator.clipboard.writeText(JSON.stringify(e,null,2)).then(()=>{n(!0),setTimeout(()=>{n(!1)},2e3)})}return h.jsx("button",{type:"button",onClick:r,className:"opacity-0 group-hover/row:opacity-100 hover:bg-muted p-0.5 rounded transition-opacity shrink-0",title:"Copy to clipboard",children:t?h.jsx(ur,{className:"size-3 text-green-500"}):h.jsx(ao,{className:"size-3 text-muted-foreground"})})}function P3(e){return no(e)?js(e).some(([,t])=>no(t)):!1}function O3({allExpanded:e,onClick:t}){return h.jsx("button",{type:"button",onClick:t,className:"opacity-0 group-hover/row:opacity-100 hover:bg-muted p-0.5 rounded transition-opacity shrink-0",title:e?"Collapse all":"Expand all",children:e?h.jsx(cy,{className:"size-3.5 text-muted-foreground"}):h.jsx(ay,{className:"size-3.5 text-muted-foreground"})})}function eh({name:e,value:t,level:n,defaultExpandDepth:r,isArrayItem:o}){const[i,s]=_.useState(n<r),[a,l]=_.useState(0),[c,u]=_.useState(null),[f,p]=_.useState(!1),d=no(t),x=Xf(t),m=x==="array"?"[":"{",y=x==="array"?"]":"}";function g(k){k.stopPropagation(),f?(s(!1),u(0),l(S=>S+1),p(!1)):(s(!0),u(Number.POSITIVE_INFINITY),l(S=>S+1),p(!0))}const v=c??r;return h.jsxs("div",{className:ze(n>0&&"border-l border-border/50 ml-2"),children:[h.jsxs("div",{className:ze("flex items-start gap-1 py-0.5 px-1 -ml-1 rounded-sm group/row",d&&"cursor-pointer hover:bg-muted/50"),onClick:d?()=>{i&&p(!1),s(!i)}:void 0,onKeyDown:d?k=>{(k.key==="Enter"||k.key===" ")&&(k.preventDefault(),s(!i))}:void 0,role:d?"button":void 0,tabIndex:d?0:void 0,children:[d?h.jsx("span",{className:"w-4 h-5 flex items-center justify-center shrink-0",children:i?h.jsx(At,{className:"size-3 text-muted-foreground"}):h.jsx(Wt,{className:"size-3 text-muted-foreground"})}):h.jsx("span",{className:"w-4 shrink-0"}),h.jsx("span",{className:ze("shrink-0",o?"text-muted-foreground":"text-cyan-400"),children:o?e:`"${e}"`}),h.jsx("span",{className:"text-muted-foreground shrink-0",children:d?"":":"}),d?h.jsxs("span",{className:"text-muted-foreground",children:[m,h.jsxs("span",{className:"text-muted-foreground/60 text-xs",children:[" ",Pl(t)," ",Pl(t)===1?"item":"items"," ",y]})]}):h.jsx("span",{className:"min-w-0",children:h.jsx(Qf,{value:t})}),d&&P3(t)&&h.jsx(O3,{allExpanded:f,onClick:g}),h.jsx(j3,{value:t})]}),d&&i&&h.jsxs("div",{className:"pl-4",children:[js(t).map(([k,S])=>h.jsx(eh,{name:k,value:S,level:n+1,defaultExpandDepth:v,isArrayItem:x==="array"},k)),h.jsx("div",{className:"text-muted-foreground py-0.5 px-1",children:y})]},a)]})}function Ps({data:e,defaultExpandDepth:t=2,className:n,showCopy:r=!1}){if(!no(e))return h.jsx(jl,{children:h.jsx("div",{className:ze("font-mono text-xs leading-relaxed",n),children:h.jsxs("div",{className:"flex items-center gap-1",children:[h.jsx(Qf,{value:e}),r&&h.jsx(Rl,{value:e})]})})});const s=Xf(e)==="array";return h.jsx(jl,{children:h.jsxs("div",{className:ze("font-mono text-xs leading-relaxed",n),children:[r&&h.jsx(Rl,{value:e}),js(e).map(([a,l])=>h.jsx(eh,{name:a,value:l,level:0,defaultExpandDepth:t,isArrayItem:s},a))]})})}function Dl({text:e,defaultExpandDepth:t=2,className:n}){try{const r=JSON.parse(e);return h.jsx(Ps,{data:lr(r),defaultExpandDepth:t,className:n})}catch{return h.jsx("pre",{className:ze("font-mono text-xs whitespace-pre-wrap break-words",n),children:e})}}function lr(e){if(e==null)return null;switch(typeof e){case"string":return e;case"number":return e;case"boolean":return e;case"object":{if(Array.isArray(e))return e.map(n=>lr(n));const t={};for(const n of Object.keys(e)){const r=Object.getOwnPropertyDescriptor(e,n);t[n]=lr(r?.value)}return t}case"bigint":case"symbol":case"function":case"undefined":return String(e)}return null}function wn({className:e,orientation:t="horizontal",...n}){return h.jsx(n3,{"data-slot":"tabs","data-orientation":t,orientation:t,className:ze("group/tabs flex gap-2 data-[orientation=horizontal]:flex-col",e),...n})}const R3=Ki("rounded-lg p-[3px] group-data-[orientation=horizontal]/tabs:h-9 data-[variant=line]:rounded-none group/tabs-list text-muted-foreground inline-flex w-fit items-center justify-center group-data-[orientation=vertical]/tabs:h-fit group-data-[orientation=vertical]/tabs:flex-col",{variants:{variant:{default:"bg-muted",line:"gap-1 bg-transparent"}},defaultVariants:{variant:"default"}});function _n({className:e,variant:t="default",...n}){return h.jsx(r3,{"data-slot":"tabs-list","data-variant":t,className:ze(R3({variant:t}),e),...n})}function Je({className:e,...t}){return h.jsx(o3,{"data-slot":"tabs-trigger",className:ze("focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:outline-ring text-foreground/60 hover:text-foreground dark:text-muted-foreground dark:hover:text-foreground relative inline-flex h-[calc(100%-1px)] flex-1 items-center justify-center gap-1.5 rounded-md border border-transparent px-2 py-1 text-sm font-medium whitespace-nowrap transition-all group-data-[orientation=vertical]/tabs:w-full group-data-[orientation=vertical]/tabs:justify-start focus-visible:ring-[3px] focus-visible:outline-1 disabled:pointer-events-none disabled:opacity-50 group-data-[variant=default]/tabs-list:data-[state=active]:shadow-sm group-data-[variant=line]/tabs-list:data-[state=active]:shadow-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4","group-data-[variant=line]/tabs-list:bg-transparent group-data-[variant=line]/tabs-list:data-[state=active]:bg-transparent dark:group-data-[variant=line]/tabs-list:data-[state=active]:border-transparent dark:group-data-[variant=line]/tabs-list:data-[state=active]:bg-transparent","data-[state=active]:bg-background dark:data-[state=active]:text-foreground dark:data-[state=active]:border-input dark:data-[state=active]:bg-input/30 data-[state=active]:text-foreground","after:bg-foreground after:absolute after:opacity-0 after:transition-opacity group-data-[orientation=horizontal]/tabs:after:inset-x-0 group-data-[orientation=horizontal]/tabs:after:bottom-[-5px] group-data-[orientation=horizontal]/tabs:after:h-0.5 group-data-[orientation=vertical]/tabs:after:inset-y-0 group-data-[orientation=vertical]/tabs:after:-right-1 group-data-[orientation=vertical]/tabs:after:w-0.5 group-data-[variant=line]/tabs-list:data-[state=active]:after:opacity-100",e),...t})}function Xe({className:e,...t}){return h.jsx(i3,{"data-slot":"tabs-content",className:ze("flex-1 outline-none",e),...t})}const D3=Ki("inline-flex items-center justify-center rounded-full border border-transparent px-2 py-0.5 text-xs font-medium w-fit whitespace-nowrap shrink-0 [&>svg]:size-3 gap-1 [&>svg]:pointer-events-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive transition-[color,box-shadow] overflow-hidden",{variants:{variant:{default:"bg-primary text-primary-foreground [a&]:hover:bg-primary/90",secondary:"bg-secondary text-secondary-foreground [a&]:hover:bg-secondary/90",destructive:"bg-destructive text-white [a&]:hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60",outline:"border-border text-foreground [a&]:hover:bg-accent [a&]:hover:text-accent-foreground",ghost:"[a&]:hover:bg-accent [a&]:hover:text-accent-foreground",link:"text-primary underline-offset-4 [a&]:hover:underline"}},defaultVariants:{variant:"default"}});function dt({className:e,variant:t="default",asChild:n=!1,...r}){const o=n?P_:"span";return h.jsx(o,{"data-slot":"badge","data-variant":t,className:ze(D3({variant:t}),e),...r})}const M3="data:image/svg+xml,%3csvg%20height='2500'%20viewBox='0%206.603%201192.672%201193.397'%20width='2500'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='m233.96%20800.215%20234.684-131.678%203.947-11.436-3.947-6.363h-11.436l-39.221-2.416-134.094-3.624-116.296-4.832-112.67-6.04-28.35-6.04-26.577-35.035%202.738-17.477%2023.84-16.027%2034.147%202.98%2075.463%205.155%20113.235%207.812%2082.147%204.832%20121.692%2012.644h19.329l2.738-7.812-6.604-4.832-5.154-4.832-117.182-79.41-126.845-83.92-66.443-48.321-35.92-24.484-18.12-22.953-7.813-50.093%2032.618-35.92%2043.812%202.98%2011.195%202.98%2044.375%2034.147%2094.792%2073.37%20123.786%2091.167%2018.12%2015.06%207.249-5.154.886-3.624-8.135-13.61-67.329-121.692-71.838-123.785-31.974-51.302-8.456-30.765c-2.98-12.645-5.154-23.275-5.154-36.242l37.127-50.416%2020.537-6.604%2049.53%206.604%2020.86%2018.121%2030.765%2070.39%2049.852%20110.818%2077.315%20150.684%2022.631%2044.698%2012.08%2041.396%204.51%2012.645h7.813v-7.248l6.362-84.886%2011.759-104.215%2011.436-134.094%203.946-37.772%2018.685-45.262%2037.127-24.482%2028.994%2013.852%2023.839%2034.148-3.303%2022.067-14.174%2092.134-27.785%20144.323-18.121%2096.644h10.55l12.08-12.08%2048.887-64.913%2082.147-102.685%2036.242-40.752%2042.282-45.02%2027.14-21.423h51.303l37.772%2056.135-16.913%2057.986-52.832%2067.007-43.812%2056.779-62.82%2084.563-39.22%2067.651%203.623%205.396%209.343-.886%20141.906-30.201%2076.671-13.852%2091.49-15.705%2041.396%2019.329%204.51%2019.65-16.269%2040.189-97.852%2024.16-114.764%2022.954-170.9%2040.43-2.093%201.53%202.416%202.98%2076.993%207.248%2032.94%201.771h80.617l150.12%2011.195%2039.222%2025.933%2023.517%2031.732-3.946%2024.16-60.403%2030.766-81.503-19.33-190.228-45.26-65.235-16.27h-9.02v5.397l54.362%2053.154%2099.624%2089.96%20124.752%20115.973%206.362%2028.671-16.027%2022.63-16.912-2.415-109.611-82.47-42.282-37.127-95.758-80.618h-6.363v8.456l22.067%2032.296%20116.537%20175.167%206.04%2053.719-8.456%2017.476-30.201%2010.55-33.181-6.04-68.215-95.758-70.39-107.84-56.778-96.644-6.926%203.947-33.503%20360.886-15.705%2018.443-36.243%2013.852-30.201-22.953-16.027-37.127%2016.027-73.37%2019.329-95.758%2015.704-76.107%2014.175-94.55%208.456-31.41-.563-2.094-6.927.886-71.275%2097.852-108.402%20146.497-85.772%2091.812-20.537%208.134-35.597-18.443%203.301-32.94%2019.893-29.315%20118.712-151.007%2071.597-93.583%2046.228-54.04-.322-7.813h-2.738l-315.302%20204.725-56.135%207.248-24.16-22.63%202.98-37.128%2011.435-12.08%2094.792-65.236-.322.323z'%20fill='%23d97757'/%3e%3c/svg%3e",L3="data:image/svg+xml,%3csvg%20height='2500'%20viewBox='-1%20-.1%20949.1%20959.8'%20width='2474'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='m925.8%20456.3c10.4%2023.2%2017%2048%2019.7%2073.3%202.6%2025.3%201.3%2050.9-4.1%2075.8-5.3%2024.9-14.5%2048.8-27.3%2070.8-8.4%2014.7-18.3%2028.5-29.7%2041.2-11.3%2012.6-23.9%2024-37.6%2034-13.8%2010-28.5%2018.4-44.1%2025.3-15.5%206.8-31.7%2012-48.3%2015.4-7.8%2024.2-19.4%2047.1-34.4%2067.7-14.9%2020.6-33%2038.7-53.6%2053.6-20.6%2015-43.4%2026.6-67.6%2034.4-24.2%207.9-49.5%2011.8-75%2011.8-16.9.1-33.9-1.7-50.5-5.1-16.5-3.5-32.7-8.8-48.2-15.7s-30.2-15.5-43.9-25.5c-13.6-10-26.2-21.5-37.4-34.2-25%205.4-50.6%206.7-75.9%204.1-25.3-2.7-50.1-9.3-73.4-19.7-23.2-10.3-44.7-24.3-63.6-41.4s-35-37.1-47.7-59.1c-8.5-14.7-15.5-30.2-20.8-46.3s-8.8-32.7-10.6-49.6c-1.8-16.8-1.7-33.8.1-50.7%201.8-16.8%205.5-33.4%2010.8-49.5-17-18.9-31-40.4-41.4-63.6-10.3-23.3-17-48-19.6-73.3-2.7-25.3-1.3-50.9%204-75.8s14.5-48.8%2027.3-70.8c8.4-14.7%2018.3-28.6%2029.6-41.2s24-24%2037.7-34%2028.5-18.5%2044-25.3c15.6-6.9%2031.8-12%2048.4-15.4%207.8-24.3%2019.4-47.1%2034.3-67.7%2015-20.6%2033.1-38.7%2053.7-53.7%2020.6-14.9%2043.4-26.5%2067.6-34.4%2024.2-7.8%2049.5-11.8%2075-11.7%2016.9-.1%2033.9%201.6%2050.5%205.1s32.8%208.7%2048.3%2015.6c15.5%207%2030.2%2015.5%2043.9%2025.5%2013.7%2010.1%2026.3%2021.5%2037.5%2034.2%2024.9-5.3%2050.5-6.6%2075.8-4s50%209.3%2073.3%2019.6c23.2%2010.4%2044.7%2024.3%2063.6%2041.4%2018.9%2017%2035%2036.9%2047.7%2059%208.5%2014.6%2015.5%2030.1%2020.8%2046.3%205.3%2016.1%208.9%2032.7%2010.6%2049.6%201.8%2016.9%201.8%2033.9-.1%2050.8-1.8%2016.9-5.5%2033.5-10.8%2049.6%2017.1%2018.9%2031%2040.3%2041.4%2063.6zm-333.2%20426.9c21.8-9%2041.6-22.3%2058.3-39s30-36.5%2039-58.4c9-21.8%2013.7-45.2%2013.7-68.8v-223q-.1-.3-.2-.7-.1-.3-.3-.6-.2-.3-.5-.5-.3-.3-.6-.4l-80.7-46.6v269.4c0%202.7-.4%205.5-1.1%208.1-.7%202.7-1.7%205.2-3.1%207.6s-3%204.6-5%206.5a32.1%2032.1%200%200%201%20-6.5%205l-191.1%20110.3c-1.6%201-4.3%202.4-5.7%203.2%207.9%206.7%2016.5%2012.6%2025.5%2017.8%209.1%205.2%2018.5%209.6%2028.3%2013.2%209.8%203.5%2019.9%206.2%2030.1%208%2010.3%201.8%2020.7%202.7%2031.1%202.7%2023.6%200%2047-4.7%2068.8-13.8zm-455.1-151.4c11.9%2020.5%2027.6%2038.3%2046.3%2052.7%2018.8%2014.4%2040.1%2024.9%2062.9%2031s46.6%207.7%2070%204.6%2045.9-10.7%2066.4-22.5l193.2-111.5.5-.5q.2-.2.3-.6.2-.3.3-.6v-94l-233.2%20134.9c-2.4%201.4-4.9%202.4-7.5%203.2-2.7.7-5.4%201-8.2%201-2.7%200-5.4-.3-8.1-1-2.6-.8-5.2-1.8-7.6-3.2l-191.1-110.4c-1.7-1-4.2-2.5-5.6-3.4-1.8%2010.3-2.7%2020.7-2.7%2031.1s1%2020.8%202.8%2031.1c1.8%2010.2%204.6%2020.3%208.1%2030.1%203.6%209.8%208%2019.2%2013.2%2028.2zm-50.2-417c-11.8%2020.5-19.4%2043.1-22.5%2066.5s-1.5%2047.1%204.6%2070c6.1%2022.8%2016.6%2044.1%2031%2062.9%2014.4%2018.7%2032.3%2034.4%2052.7%2046.2l193.1%20111.6q.3.1.7.2h.7q.4%200%20.7-.2.3-.1.6-.3l81-46.8-233.2-134.6c-2.3-1.4-4.5-3.1-6.5-5a32.1%2032.1%200%200%201%20-5-6.5c-1.3-2.4-2.4-4.9-3.1-7.6-.7-2.6-1.1-5.3-1-8.1v-227.1c-9.8%203.6-19.3%208-28.3%2013.2-9%205.3-17.5%2011.3-25.5%2018-7.9%206.7-15.3%2014.1-22%2022.1-6.7%207.9-12.6%2016.5-17.8%2025.5zm663.3%20154.4c2.4%201.4%204.6%203%206.6%205%201.9%201.9%203.6%204.1%205%206.5%201.3%202.4%202.4%205%203.1%207.6.6%202.7%201%205.4.9%208.2v227.1c32.1-11.8%2060.1-32.5%2080.8-59.7%2020.8-27.2%2033.3-59.7%2036.2-93.7s-3.9-68.2-19.7-98.5-39.9-55.5-69.5-72.5l-193.1-111.6q-.3-.1-.7-.2h-.7q-.3.1-.7.2-.3.1-.6.3l-80.6%2046.6%20233.2%20134.7zm80.5-121h-.1v.1zm-.1-.1c5.8-33.6%201.9-68.2-11.3-99.7-13.1-31.5-35-58.6-63-78.2-28-19.5-61-30.7-95.1-32.2-34.2-1.4-68%206.9-97.6%2023.9l-193.1%20111.5q-.3.2-.5.5l-.4.6q-.1.3-.2.7-.1.3-.1.7v93.2l233.2-134.7c2.4-1.4%205-2.4%207.6-3.2%202.7-.7%205.4-1%208.1-1%202.8%200%205.5.3%208.2%201%202.6.8%205.1%201.8%207.5%203.2l191.1%20110.4c1.7%201%204.2%202.4%205.6%203.3zm-505.3-103.2c0-2.7.4-5.4%201.1-8.1.7-2.6%201.7-5.2%203.1-7.6%201.4-2.3%203-4.5%205-6.5%201.9-1.9%204.1-3.6%206.5-4.9l191.1-110.3c1.8-1.1%204.3-2.5%205.7-3.2-26.2-21.9-58.2-35.9-92.1-40.2-33.9-4.4-68.3%201-99.2%2015.5-31%2014.5-57.2%2037.6-75.5%2066.4-18.3%2028.9-28%2062.3-28%2096.5v223q.1.4.2.7.1.3.3.6.2.3.5.6.2.2.6.4l80.7%2046.6zm43.8%20294.7%20103.9%2060%20103.9-60v-119.9l-103.8-60-103.9%2060z'/%3e%3c/svg%3e",F3="data:image/svg+xml,%3csvg%20fill='none'%20height='1320'%20viewBox='3.771%206.973%2023.993%2017.652'%20width='2500'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='m27.501%208.469c-.252-.123-.36.111-.508.23-.05.04-.093.09-.135.135-.368.395-.797.652-1.358.621-.821-.045-1.521.213-2.14.842-.132-.776-.57-1.238-1.235-1.535-.349-.155-.701-.309-.944-.645-.171-.238-.217-.504-.303-.765-.054-.159-.108-.32-.29-.348-.197-.031-.274.135-.352.273-.31.567-.43%201.192-.419%201.825.028%201.421.628%202.554%201.82%203.36.136.093.17.186.128.321-.081.278-.178.547-.264.824-.054.178-.135.217-.324.14a5.448%205.448%200%200%201%20-1.719-1.169c-.848-.82-1.614-1.726-2.57-2.435-.225-.166-.449-.32-.681-.467-.976-.95.128-1.729.383-1.82.267-.096.093-.428-.77-.424s-1.653.293-2.659.677a2.782%202.782%200%200%201%20-.46.135%209.554%209.554%200%200%200%20-2.853-.1c-1.866.21-3.356%201.092-4.452%202.6-1.315%201.81-1.625%203.87-1.246%206.018.399%202.261%201.552%204.136%203.326%205.601%201.837%201.518%203.955%202.262%206.37%202.12%201.466-.085%203.1-.282%204.942-1.842.465.23.952.322%201.762.392.623.059%201.223-.031%201.687-.127.728-.154.677-.828.414-.953-2.132-.994-1.665-.59-2.09-.916%201.084-1.285%202.717-2.619%203.356-6.94.05-.343.007-.558%200-.837-.004-.168.034-.235.228-.254a4.084%204.084%200%200%200%201.529-.47c1.382-.757%201.938-1.997%202.07-3.485.02-.227-.004-.463-.243-.582zm-12.041%2013.391c-2.067-1.627-3.07-2.162-3.483-2.138-.387.021-.318.465-.233.754.089.285.205.482.368.732.113.166.19.414-.112.598-.666.414-1.823-.139-1.878-.166-1.347-.793-2.473-1.842-3.267-3.276-.765-1.38-1.21-2.861-1.284-4.441-.02-.383.093-.518.472-.586a4.692%204.692%200%200%201%201.514-.04c2.109.31%203.905%201.255%205.41%202.749.86.853%201.51%201.871%202.18%202.865.711%201.057%201.478%202.063%202.454%202.887.343.289.619.51.881.672-.792.088-2.117.107-3.022-.61zm.99-6.38a.304.304%200%201%201%20.609%200c0%20.17-.136.304-.306.304a.3.3%200%200%201%20-.303-.305zm3.077%201.581c-.197.08-.394.15-.584.159a1.246%201.246%200%200%201%20-.79-.252c-.27-.227-.463-.354-.546-.752a1.752%201.752%200%200%201%20.016-.582c.07-.324-.008-.531-.235-.72-.187-.155-.422-.196-.682-.196a.551.551%200%200%201%20-.252-.078c-.108-.055-.197-.19-.112-.356.027-.053.159-.183.19-.207.352-.201.758-.135%201.134.016.349.142.611.404.99.773.388.448.457.573.678.906.174.264.333.534.441.842.066.192-.02.35-.248.448z'%20fill='%234d6bfe'/%3e%3c/svg%3e",$3="/assets/minimax-BPMzvuL-.jpeg",B3="/assets/alibaba-TTwafVwX.svg",U3="/assets/qwen-CONDcHqt.png",Z3="/assets/zhipuai-BPNAnxo-.svg",V3={"claude-":"anthropic","gpt-":"openai","o1-":"openai","o3-":"openai","deepseek-":"deepseek",MiniMax:"minimax",qwen:"qwen","glm-":"zhipuai"};function W3(e){if(e===null)return"unknown";const t=e.toLowerCase();for(const[n,r]of Object.entries(V3))if(t.startsWith(n.toLowerCase()))return r;return"unknown"}const dn={width:24,height:24,objectFit:"contain"},H3=tt.memo(({className:e})=>h.jsx("img",{src:M3,alt:"Anthropic",className:e,style:dn})),q3=tt.memo(({className:e})=>h.jsx("img",{src:L3,alt:"OpenAI",className:e,style:dn})),K3=tt.memo(({className:e})=>h.jsx("img",{src:F3,alt:"DeepSeek",className:e,style:dn})),G3=tt.memo(({className:e})=>h.jsx("img",{src:$3,alt:"MiniMax",className:e,style:dn})),Y3=tt.memo(({className:e})=>h.jsx("img",{src:B3,alt:"Alibaba",className:e,style:dn})),J3=tt.memo(({className:e})=>h.jsx("img",{src:U3,alt:"Qwen",className:e,style:dn})),X3=tt.memo(({className:e})=>h.jsx("img",{src:Z3,alt:"ZhipuAI",className:e,style:dn}));function Q3({provider:e,className:t}){switch(e){case"anthropic":return h.jsx(H3,{className:t});case"openai":return h.jsx(q3,{className:t});case"deepseek":return h.jsx(K3,{className:t});case"minimax":return h.jsx(G3,{className:t});case"alibaba":return h.jsx(Y3,{className:t});case"qwen":return h.jsx(J3,{className:t});case"zhipuai":return h.jsx(X3,{className:t});case"unknown":return null}}const e5={anthropic:"Anthropic",openai:"OpenAI",unknown:"Unknown"};function t5(e){return e<1e3?`${e}ms`:`${(e/1e3).toFixed(1)}s`}const Ml={success:"bg-emerald-500/15 text-emerald-400 border-emerald-500/25",client_error:"bg-amber-500/15 text-amber-400 border-amber-500/25",server_error:"",pending:"bg-muted text-muted-foreground border-border"};function n5({log:e,parsedRequest:t,expanded:n,onToggle:r}){const o=Yc(e.responseStatus),i=e.inputTokens!==null||e.outputTokens!==null,s=t!==null?t.messages.length:null,a=t!==null&&t.tools!==void 0&&t.tools.length>0?t.tools.length:null;return h.jsxs("div",{role:"button",tabIndex:0,className:ze("flex items-center gap-2.5 px-3 py-2 cursor-pointer transition-colors","hover:bg-muted/50","select-none"),onClick:r,onKeyDown:l=>{(l.key==="Enter"||l.key===" ")&&(l.preventDefault(),r())},children:[h.jsxs("span",{className:"text-blue-400/80 font-mono text-xs font-semibold tabular-nums shrink-0",children:["#",e.id]}),e.model!==null&&h.jsxs(h.Fragment,{children:[h.jsx(Q3,{provider:W3(e.model),className:"size-4 shrink-0"}),h.jsx(dt,{variant:"secondary",className:"text-[10px] px-1.5 py-0 h-5 font-mono",children:e.model})]}),h.jsx(dt,{variant:"outline",className:ze("text-[10px] px-1.5 py-0 h-5 font-mono",e.apiFormat==="openai"&&"border-blue-500/40 text-blue-400",e.apiFormat==="anthropic"&&"border-orange-500/40 text-orange-400",e.apiFormat==="unknown"&&"border-muted text-muted-foreground"),children:e5[e.apiFormat]??e.apiFormat}),o==="server_error"?h.jsx(dt,{variant:"destructive",className:"text-[10px] px-1.5 py-0 h-5 font-mono tabular-nums",children:e.responseStatus}):o==="pending"?h.jsx(dt,{variant:"outline",className:ze("text-[10px] px-1.5 py-0 h-5 font-mono tabular-nums",Ml[o]),children:h.jsx(Pc,{className:"size-3 animate-spin"})}):h.jsx(dt,{variant:"outline",className:ze("text-[10px] px-1.5 py-0 h-5 font-mono tabular-nums",Ml[o]),children:e.responseStatus}),e.elapsedMs!==null&&h.jsxs("span",{className:"flex items-center gap-1 text-muted-foreground text-xs shrink-0",children:[h.jsx(Hi,{className:"size-3"}),h.jsx("span",{className:"font-mono tabular-nums",children:t5(e.elapsedMs)})]}),i&&h.jsxs("span",{className:"flex items-center gap-1 text-xs shrink-0",children:[h.jsx(dr,{className:"size-3 text-muted-foreground"}),h.jsxs("span",{className:"font-mono tabular-nums",children:[h.jsxs("span",{className:e.inputTokens!==null?"text-blue-400":"text-muted-foreground",children:["IN ",e.inputTokens!==null?Ke(e.inputTokens):"—"]})," / ",h.jsxs("span",{className:e.outputTokens!==null?"text-amber-400":"text-muted-foreground",children:["OUT ",e.outputTokens!==null?Ke(e.outputTokens):"—"]})]})]}),e.cacheCreationInputTokens!==null&&e.cacheCreationInputTokens>0&&h.jsx("span",{className:"flex items-center gap-1 text-xs shrink-0",children:h.jsxs("span",{className:"font-mono tabular-nums text-emerald-400",children:["Cache +",Ke(e.cacheCreationInputTokens)]})}),e.cacheReadInputTokens!==null&&e.cacheReadInputTokens>0&&h.jsx("span",{className:"flex items-center gap-1 text-xs shrink-0",children:h.jsxs("span",{className:"font-mono tabular-nums text-purple-400",children:["Cache ~",Ke(e.cacheReadInputTokens)]})}),s!==null&&h.jsxs("span",{className:"flex items-center gap-1 text-muted-foreground text-xs shrink-0",children:[h.jsx(Oc,{className:"size-3"}),h.jsx("span",{className:"font-mono tabular-nums",children:s})]}),a!==null&&h.jsxs("span",{className:"flex items-center gap-1 text-muted-foreground text-xs shrink-0",children:[h.jsx(hv,{className:"size-3"}),h.jsx("span",{className:"font-mono tabular-nums",children:a})]}),e.origin!==null&&h.jsxs("span",{className:"flex items-center gap-1 text-muted-foreground text-xs shrink-0",title:`Origin: ${e.origin}`,children:[h.jsx(Iy,{className:"size-3"}),h.jsx("span",{className:"font-mono tabular-nums truncate max-w-[120px]",title:e.origin,children:e.origin})]}),e.userAgent!==null&&h.jsxs("span",{className:"flex items-center gap-1 text-muted-foreground text-xs shrink-0",title:`User-Agent: ${e.userAgent}`,children:[h.jsx(av,{className:"size-3"}),h.jsx("span",{className:"font-mono tabular-nums truncate max-w-[150px]",title:e.userAgent,children:e.userAgent})]}),(e.clientPid!==null||e.clientProjectFolder!==null)&&h.jsxs("span",{className:"flex items-center gap-1 text-purple-400/80 text-xs shrink-0",title:e.clientCwd!==null?`PID: ${e.clientPid??"?"} | CWD: ${e.clientCwd}`:`PID: ${e.clientPid??"?"}`,children:[h.jsx(Ty,{className:"size-3"}),e.clientProjectFolder!==null?h.jsx("span",{className:"font-mono tabular-nums",children:e.clientProjectFolder}):h.jsxs("span",{className:"font-mono tabular-nums",children:["PID ",e.clientPid]})]}),e.streaming&&h.jsx(Hy,{className:"size-3 text-muted-foreground/60 shrink-0"}),h.jsx("span",{className:"flex-1 min-w-0"}),n?h.jsx(At,{className:"size-4 text-muted-foreground shrink-0"}):h.jsx(Wt,{className:"size-4 text-muted-foreground shrink-0"})]})}function th({...e}){return h.jsx(mS,{"data-slot":"dialog",...e})}function r5({...e}){return h.jsx(gS,{"data-slot":"dialog-trigger",...e})}function o5({...e}){return h.jsx(xS,{"data-slot":"dialog-portal",...e})}function i5({className:e,...t}){return h.jsx(yS,{"data-slot":"dialog-overlay",className:ze("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",e),...t})}function nh({className:e,children:t,...n}){return h.jsxs(o5,{children:[h.jsx(i5,{}),h.jsxs(vS,{"data-slot":"dialog-content",className:ze("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] rounded-lg",e),...n,children:[t,h.jsxs(wS,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground",children:[h.jsx(mv,{className:"size-4"}),h.jsx("span",{className:"sr-only",children:"Close"})]})]})]})}function rh({className:e,...t}){return h.jsx("div",{"data-slot":"dialog-header",className:ze("flex flex-col space-y-1.5 text-center sm:text-left",e),...t})}function oh({className:e,...t}){return h.jsx(bS,{"data-slot":"dialog-title",className:ze("text-lg font-semibold leading-none tracking-tight",e),...t})}function ih({className:e,orientation:t="horizontal",decorative:n=!0,...r}){return h.jsx(QE,{"data-slot":"separator",decorative:n,orientation:t,className:ze("bg-border shrink-0 data-[orientation=horizontal]:h-px data-[orientation=horizontal]:w-full data-[orientation=vertical]:h-full data-[orientation=vertical]:w-px",e),...r})}function Os({...e}){return h.jsx(nk,{"data-slot":"collapsible",...e})}function Rs({...e}){return h.jsx(Fu,{"data-slot":"collapsible-trigger",...e})}function Ds({...e}){return h.jsx($u,{"data-slot":"collapsible-content",...e})}function sh({className:e,children:t,...n}){return h.jsxs(fE,{"data-slot":"scroll-area",className:ze("relative",e),...n,children:[h.jsx(hE,{"data-slot":"scroll-area-viewport",className:"focus-visible:ring-ring/50 size-full rounded-[inherit] transition-[color,box-shadow] outline-none focus-visible:ring-[3px] focus-visible:outline-1",children:t}),h.jsx(s5,{}),h.jsx(pE,{})]})}function s5({className:e,orientation:t="vertical",...n}){return h.jsx(Yd,{"data-slot":"scroll-area-scrollbar",orientation:t,className:ze("flex touch-none p-px transition-colors select-none",t==="vertical"&&"h-full w-2.5 border-l border-l-transparent",t==="horizontal"&&"h-2.5 flex-col border-t border-t-transparent",e),...n,children:h.jsx(ef,{"data-slot":"scroll-area-thumb",className:"bg-border relative flex-1 rounded-full"})})}function a5(e){return h.jsx(h.Fragment,{})}function l5({text:e}){const[t,n]=_.useState(!1);return h.jsxs(Os,{open:t,onOpenChange:n,children:[h.jsxs(Rs,{className:"flex items-center gap-1.5 py-0.5 cursor-pointer hover:opacity-80 transition-opacity group",children:[t?h.jsx(At,{className:"size-3 text-muted-foreground"}):h.jsx(Wt,{className:"size-3 text-muted-foreground"}),h.jsx("span",{className:"text-muted-foreground text-xs italic select-none opacity-60",children:"[system-reminder]"})]}),h.jsx(Ds,{children:h.jsx("div",{className:"pl-4 pt-1",children:h.jsx("div",{className:"prose prose-sm dark:prose-invert max-w-none [&_pre]:bg-muted [&_pre]:text-foreground [&_code]:text-[0.8em] [&_p]:my-1 [&_ul]:my-1 [&_ol]:my-1",children:h.jsx(In,{children:e})})})})]})}function c5({text:e}){return e.includes("<system-reminder>")?h.jsx(l5,{text:e}):h.jsx("div",{className:"prose prose-sm dark:prose-invert max-w-none [&_pre]:bg-muted [&_pre]:text-foreground [&_code]:text-[0.8em] [&_p]:my-1 [&_ul]:my-1 [&_ol]:my-1",children:h.jsx(In,{children:e})})}function u5({thinking:e}){const[t,n]=_.useState(!1);return h.jsx(Os,{open:t,onOpenChange:n,children:h.jsxs("div",{className:"border-l-2 border-purple-500/40 my-1",children:[h.jsxs(Rs,{className:"flex items-center gap-1.5 px-3 py-1 w-full text-left cursor-pointer hover:bg-purple-500/5 transition-colors rounded-r-sm group",children:[h.jsx(ey,{className:"size-3.5 text-purple-400 shrink-0"}),h.jsx("span",{className:"text-xs font-medium text-purple-400",children:"Thinking"}),h.jsxs(dt,{variant:"ghost",className:"text-[10px] text-muted-foreground px-1.5 py-0 h-4 font-mono",children:[e.length.toLocaleString()," chars"]}),h.jsx("span",{className:"flex-1"}),t?h.jsx(At,{className:"size-3 text-muted-foreground"}):h.jsx(Wt,{className:"size-3 text-muted-foreground"})]}),h.jsx(Ds,{children:h.jsx("div",{className:"px-3 pb-2",children:h.jsx(sh,{className:"max-h-[60vh]",children:h.jsx("pre",{className:"text-xs text-muted-foreground whitespace-pre-wrap font-mono leading-relaxed",children:e})})})})]})})}function d5({name:e,input:t}){const[n,r]=_.useState(!1);return h.jsx(Os,{open:n,onOpenChange:r,children:h.jsxs("div",{className:"border-l-2 border-blue-500/40 my-1",children:[h.jsxs(Rs,{className:"flex items-center gap-1.5 px-3 py-1 w-full text-left cursor-pointer hover:bg-blue-500/5 transition-colors rounded-r-sm group",children:[h.jsx(tv,{className:"size-3.5 text-blue-400 shrink-0"}),h.jsx(dt,{variant:"outline",className:"text-[10px] font-mono px-1.5 py-0 h-4",children:e}),h.jsx("span",{className:"flex-1"}),n?h.jsx(At,{className:"size-3 text-muted-foreground"}):h.jsx(Wt,{className:"size-3 text-muted-foreground"})]}),h.jsx(Ds,{children:h.jsx("div",{className:"px-3 pb-2",children:h.jsx(sh,{className:"max-h-[60vh]",children:h.jsx(Ps,{data:lr(t),defaultExpandDepth:2})})})})]})})}function f5({block:e}){switch(e.type){case"text":return h.jsx(c5,{text:e.text});case"thinking":return h.jsx(u5,{thinking:e.thinking});case"tool_use":return h.jsx(d5,{name:e.name,input:e.input});default:return a5()}}function h5({response:e}){return h.jsxs("div",{className:"space-y-3",children:[h.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[h.jsx(dt,{variant:"secondary",className:"text-[10px] px-1.5 py-0 h-5 font-mono",children:e.model}),e.stop_reason!==null&&h.jsxs(dt,{variant:"outline",className:"text-[10px] px-1.5 py-0 h-5 font-mono flex items-center gap-1",children:[h.jsx(jc,{className:"size-2.5"}),e.stop_reason]}),h.jsxs("span",{className:"flex items-center gap-1 text-muted-foreground text-xs",children:[h.jsx(dr,{className:"size-3"}),h.jsxs("span",{className:"font-mono tabular-nums",children:[Ke(e.usage.input_tokens)," in /"," ",Ke(e.usage.output_tokens)," out"]}),e.usage.cache_creation_input_tokens!==void 0&&e.usage.cache_creation_input_tokens>0&&h.jsxs("span",{className:"font-mono tabular-nums text-emerald-400",children:["Cache +",Ke(e.usage.cache_creation_input_tokens)]}),e.usage.cache_read_input_tokens!==void 0&&e.usage.cache_read_input_tokens>0&&h.jsxs("span",{className:"font-mono tabular-nums text-purple-400",children:["Cache ~",Ke(e.usage.cache_read_input_tokens)]})]})]}),h.jsx(ih,{className:"opacity-50"}),h.jsxs("div",{className:"space-y-2",children:[e.content.map((t,n)=>h.jsx(f5,{block:t},n)),e.content.length===0&&h.jsx("p",{className:"text-xs text-muted-foreground italic",children:"Empty response content"})]})]})}function p5({response:e}){const t=e.choices[0],n=t?.message;return h.jsxs("div",{className:"space-y-3",children:[h.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[h.jsx(dt,{variant:"secondary",className:"text-[10px] px-1.5 py-0 h-5 font-mono",children:e.model}),t?.finish_reason!==null&&t?.finish_reason!==void 0&&h.jsxs(dt,{variant:"outline",className:"text-[10px] px-1.5 py-0 h-5 font-mono flex items-center gap-1",children:[h.jsx(jc,{className:"size-2.5"}),t.finish_reason]}),h.jsxs("span",{className:"flex items-center gap-1 text-muted-foreground text-xs",children:[h.jsx(dr,{className:"size-3"}),h.jsxs("span",{className:"font-mono tabular-nums",children:[Ke(e.usage.prompt_tokens)," in /"," ",Ke(e.usage.completion_tokens)," out"]})]})]}),h.jsx(ih,{className:"opacity-50"}),h.jsxs("div",{className:"space-y-2",children:[n?.reasoning_content!==null&&n?.reasoning_content!==void 0&&n.reasoning_content.length>0&&h.jsxs("div",{className:"border border-purple-500/30 rounded-md p-3 bg-purple-500/5",children:[h.jsx("div",{className:"text-xs text-purple-400 font-mono mb-1",children:"thinking"}),h.jsx("div",{className:"text-sm text-purple-200 whitespace-pre-wrap",children:n.reasoning_content})]}),n?.content!==null&&n?.content!==void 0&&n.content.length>0&&h.jsx("div",{className:"prose prose-sm dark:prose-invert max-w-none [&_pre]:bg-muted [&_pre]:text-foreground [&_code]:text-[0.8em] [&_p]:my-1 [&_ul]:my-1 [&_ol]:my-1",children:h.jsx(In,{children:n.content})}),n?.function_call!==null&&n?.function_call!==void 0&&h.jsxs("div",{className:"border border-blue-500/30 rounded-md p-3 bg-blue-500/5",children:[h.jsx("div",{className:"text-xs text-blue-400 font-mono mb-1",children:"function_call"}),h.jsxs("div",{className:"font-mono text-xs",children:[h.jsx("span",{className:"text-blue-300",children:n.function_call.name}),h.jsxs("span",{className:"text-muted-foreground",children:["(",n.function_call.arguments,")"]})]})]}),(n?.content===null||n?.content===void 0||n.content.length===0)&&(n?.reasoning_content===null||n?.reasoning_content===void 0||n.reasoning_content.length===0)&&(n?.function_call===null||n?.function_call===void 0)&&h.jsx("p",{className:"text-xs text-muted-foreground italic",children:"Empty response content"})]})]})}function m5(e){return typeof e!="object"||e===null?!1:Object.getOwnPropertyDescriptor(e,"object")?.value==="chat.completion"}function g5(e,t){return m5(t)?h.jsx(p5,{response:t}):h.jsx(h5,{response:t})}function x5(e){switch(e){case"success":return"text-emerald-400";case"client_error":return"text-amber-400";case"server_error":return"text-red-400";case"pending":return"text-muted-foreground"}}function y5(e,t){try{const n=JSON.parse(e);if(t==="openai"){const o=Ax(e);if(o)return o}const r=kx.safeParse(n);return r.success?r.data:null}catch{return null}}function Or({status:e}){const t=Yc(e),n=x5(t);return e===null?h.jsx("span",{className:"text-xs text-muted-foreground italic",children:"pending"}):h.jsxs("span",{className:ze("flex items-center gap-1 text-xs font-mono font-semibold",n),children:[t==="server_error"&&h.jsx(iv,{className:"size-3"}),e]})}function v5({text:e}){return h.jsx("div",{className:"rounded-md border border-red-500/30 bg-red-500/5 p-3",children:h.jsx("pre",{className:"text-xs text-red-300 whitespace-pre-wrap font-mono leading-relaxed overflow-auto max-h-[60vh]",children:e})})}function b5({text:e}){return h.jsx("div",{className:"prose prose-sm dark:prose-invert max-w-none [&_pre]:bg-muted [&_pre]:text-foreground [&_code]:text-[0.8em] [&_p]:my-1 [&_ul]:my-1 [&_ol]:my-1",children:h.jsx(In,{children:e})})}function $r({responseText:e,responseStatus:t,streaming:n,inputTokens:r,outputTokens:o,cacheCreationInputTokens:i,cacheReadInputTokens:s,apiFormat:a}){if(e===null)return h.jsxs("div",{className:"flex items-center gap-2 py-3",children:[h.jsx(Or,{status:t}),h.jsx("span",{className:"text-xs text-muted-foreground italic",children:"No response"})]});if(t!==null&&t>=400)return h.jsxs("div",{className:"space-y-2",children:[h.jsx(Or,{status:t}),h.jsx(v5,{text:e})]});const c=y5(e,a);return c!==null?h.jsxs("div",{className:"space-y-2",children:[h.jsx(Or,{status:t}),g5(a,c)]}):h.jsxs("div",{className:"space-y-2",children:[h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsx(Or,{status:t}),n&&(r!==null||o!==null)&&h.jsxs("span",{className:"flex items-center gap-1 text-muted-foreground text-xs",children:[h.jsx(dr,{className:"size-3"}),h.jsxs("span",{className:"font-mono tabular-nums",children:[r!==null?Ke(r):"—"," in /"," ",o!==null?Ke(o):"—"," out"]}),i!=null&&i>0&&h.jsxs("span",{className:"font-mono tabular-nums text-emerald-400",children:["Cache +",Ke(i)]}),s!=null&&s>0&&h.jsxs("span",{className:"font-mono tabular-nums text-purple-400",children:["Cache ~",Ke(s)]})]})]}),h.jsx(b5,{text:e})]})}const w5=ue({success:Nt(),error:ne().optional(),responseStatus:ye().optional(),responseText:ne().optional(),inputTokens:ye().optional(),outputTokens:ye().optional(),elapsedMs:ye().optional(),streaming:Nt().optional()});function _5({log:e,open:t,onOpenChange:n}){const[r,o]=_.useState(()=>e.rawRequestBody??"{}"),[i,s]=_.useState(null),[a,l]=_.useState(!1),[c,u]=_.useState(null);async function f(){l(!0),u(null),s(null);try{const x=await(await fetch(`/api/logs/${e.id}/replay`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({modifiedBody:r})})).json(),m=w5.safeParse(x);if(!m.success){u("Invalid response from server"),l(!1);return}const y=m.data;s(y),y.success||u(y.error??"Replay failed")}catch(d){u(d instanceof Error?d.message:"Network error")}finally{l(!1)}}function p(){s(null),u(null),n(!1)}return h.jsx(th,{open:t,onOpenChange:p,children:h.jsxs(nh,{className:"max-w-4xl max-h-[85vh] overflow-auto",children:[h.jsx(rh,{children:h.jsxs(oh,{className:"flex items-center gap-2",children:[h.jsx(Rc,{className:"size-4"}),"Replay Request #",e.id]})}),h.jsxs(wn,{defaultValue:"modified",children:[h.jsxs(_n,{children:[h.jsx(Je,{value:"modified",children:"Modified Request"}),h.jsx(Je,{value:"original",children:"Original Response"}),i&&h.jsx(Je,{value:"replay",children:"Replay Response"})]}),h.jsxs(Xe,{value:"modified",className:"space-y-4",children:[h.jsxs("div",{children:[h.jsx("label",{className:"text-sm font-medium mb-2 block",children:"Request Body (JSON)"}),h.jsx("textarea",{className:"w-full h-64 p-3 font-mono text-xs bg-muted rounded-md border border-input resize-none focus:outline-none focus:ring-2 focus:ring-ring",value:r,onChange:d=>o(d.target.value),spellCheck:!1})]}),c!==null&&c!==""&&h.jsx("div",{className:"text-sm text-destructive bg-destructive/10 px-3 py-2 rounded-md",children:c}),h.jsx("div",{className:"flex justify-end",children:h.jsx(Ct,{onClick:()=>{f()},disabled:a,children:a?"Replaying...":"Replay"})}),i&&i.success&&h.jsxs(wn,{defaultValue:"parsed",children:[h.jsxs(_n,{children:[h.jsx(Je,{value:"parsed",children:"Parsed Response"}),h.jsx(Je,{value:"raw",children:"Raw Response"})]}),h.jsx(Xe,{value:"parsed",children:h.jsx($r,{responseText:i.responseText??null,responseStatus:i.responseStatus??null,streaming:i.streaming??!1,inputTokens:i.inputTokens??null,outputTokens:i.outputTokens??null,apiFormat:e.apiFormat})}),h.jsx(Xe,{value:"raw",children:h.jsx("pre",{className:"font-mono text-xs whitespace-pre-wrap bg-muted p-3 rounded-md max-h-96 overflow-auto",children:i.responseText??"No response"})})]})]}),h.jsx(Xe,{value:"original",children:e.responseText!==null?h.jsxs(wn,{defaultValue:"parsed",children:[h.jsxs(_n,{children:[h.jsx(Je,{value:"parsed",children:"Parsed Response"}),h.jsx(Je,{value:"raw",children:"Raw Response"})]}),h.jsx(Xe,{value:"parsed",children:h.jsx($r,{responseText:e.responseText,responseStatus:e.responseStatus,streaming:e.streaming,inputTokens:e.inputTokens,outputTokens:e.outputTokens,cacheCreationInputTokens:e.cacheCreationInputTokens,cacheReadInputTokens:e.cacheReadInputTokens,apiFormat:e.apiFormat})}),h.jsx(Xe,{value:"raw",children:h.jsx("pre",{className:"font-mono text-xs whitespace-pre-wrap bg-muted p-3 rounded-md max-h-96 overflow-auto",children:e.responseText})})]}):h.jsx("p",{className:"text-sm text-muted-foreground italic",children:"No original response"})}),i&&i.success&&h.jsx(Xe,{value:"replay",children:i.responseText!==null?h.jsxs(wn,{defaultValue:"parsed",children:[h.jsxs(_n,{children:[h.jsx(Je,{value:"parsed",children:"Parsed Response"}),h.jsx(Je,{value:"raw",children:"Raw Response"})]}),h.jsx(Xe,{value:"parsed",children:h.jsx($r,{responseText:i.responseText??null,responseStatus:i.responseStatus??null,streaming:i.streaming??!1,inputTokens:i.inputTokens??null,outputTokens:i.outputTokens??null,apiFormat:e.apiFormat})}),h.jsx(Xe,{value:"raw",children:h.jsx("pre",{className:"font-mono text-xs whitespace-pre-wrap bg-muted p-3 rounded-md max-h-96 overflow-auto",children:i.responseText})})]}):h.jsx("p",{className:"text-sm text-muted-foreground italic",children:"No replay response"})})]})]})})}function k5({logId:e,truncated:t}){const[n,r]=_.useState(!1),[o,i]=_.useState({status:"idle"}),[s,a]=_.useState(new Set);_.useEffect(()=>{!n||o.status!=="idle"||(i({status:"loading"}),fetch(`/api/logs/${e}/chunks`).then(f=>f.ok?f.json():Promise.reject(new Error("Chunks not found"))).then(f=>{i({status:"success",chunks:f.chunks})}).catch(()=>{i({status:"error",message:"Chunk data unavailable"})}))},[n,e,o.status]);const l=_.useMemo(()=>{if(o.status!=="success")return[];const f=new Map;for(const p of o.chunks){const d=f.get(p.index);d?d.push(p):f.set(p.index,[p])}return Array.from(f.entries()).map(([p,d])=>({index:p,chunks:d})).sort((p,d)=>p.index-d.index)},[o]),c=f=>{a(p=>{const d=new Set(p);return d.has(f)?d.delete(f):d.add(f),d})};function u(){return o.status==="idle"||o.status==="loading"?h.jsxs("div",{className:"flex items-center gap-2 py-2 text-xs text-muted-foreground",children:[h.jsx(Pc,{className:"size-3 animate-spin"}),h.jsx("span",{children:"Loading chunks..."})]}):o.status==="error"?h.jsx("div",{className:"py-2 text-xs text-muted-foreground italic",children:o.message}):h.jsxs("div",{className:"p-2 space-y-1",children:[h.jsxs("div",{className:"text-[10px] text-muted-foreground font-mono mb-2",children:[l.length," index group",l.length!==1?"s":""," available"]}),l.map(f=>{const p=s.has(f.index);return h.jsxs("div",{className:"rounded border border-border bg-background",children:[h.jsxs("button",{type:"button",className:"flex items-center gap-2 w-full px-2 py-1.5 text-left hover:bg-muted/50 transition-colors cursor-pointer",onClick:()=>c(f.index),children:[p?h.jsx(At,{className:"size-3 text-muted-foreground"}):h.jsx(Wt,{className:"size-3 text-muted-foreground"}),h.jsxs("span",{className:"text-[10px] text-muted-foreground font-mono",children:["[",f.index,"] ",f.chunks[0]?.type??""]}),h.jsxs("span",{className:"text-[10px] text-muted-foreground font-mono",children:[f.chunks.length," chunk",f.chunks.length!==1?"s":""]})]}),p&&h.jsx("div",{className:"px-2 pb-2 space-y-1",children:f.chunks.map(d=>h.jsxs("div",{className:"rounded border border-border bg-muted/20 p-2",children:[h.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[h.jsxs("span",{className:"text-[10px] text-muted-foreground font-mono",children:["+",d.timestamp,"ms"]}),h.jsx("span",{className:"text-[10px] text-muted-foreground font-mono",children:d.type})]}),h.jsx(Ps,{data:d,defaultExpandDepth:1,showCopy:!0})]},d.index))})]},f.index)})]})}return h.jsxs("div",{className:"space-y-1",children:[h.jsxs("button",{type:"button",className:"flex items-center gap-1.5 text-xs text-muted-foreground hover:text-foreground transition-colors cursor-pointer",onClick:()=>r(f=>!f),children:[n?h.jsx(At,{className:"size-3"}):h.jsx(Wt,{className:"size-3"}),h.jsx("span",{children:"Raw SSE Events"}),h.jsxs(dt,{variant:"outline",className:"text-[9px] px-1 py-0 h-4 font-mono ml-1",children:[e,t===!0?"+":""]})]}),n===!0?h.jsx("div",{className:"rounded-md border border-border bg-muted/20 overflow-auto max-h-64",children:u()}):null]})}function Ll({text:e,label:t,copied:n,onCopy:r}){return e===null?null:h.jsx("button",{type:"button",onClick:r,className:"flex items-center gap-1.5 text-xs text-muted-foreground hover:text-foreground transition-colors px-2 py-1 rounded hover:bg-muted",children:n?h.jsxs(h.Fragment,{children:[h.jsx(ur,{className:"size-3 text-green-500"}),h.jsx("span",{className:"text-green-500",children:"Copied!"})]}):h.jsxs(h.Fragment,{children:[h.jsx(ao,{className:"size-3"}),h.jsx("span",{children:t})]})})}function ah({log:e,viewMode:t="simple"}){const[n,r]=_.useState(!1),[o,i]=_.useState(!1),[s,a]=_.useState(!1),[l,c]=_.useState(!1),u=_.useMemo(()=>jx(e.rawRequestBody),[e.rawRequestBody]);function f(d){d.stopPropagation(),e.rawRequestBody!==null&&window.navigator.clipboard.writeText(e.rawRequestBody).then(()=>{i(!0),setTimeout(()=>i(!1),2e3)})}function p(d){d.stopPropagation(),e.responseText!==null&&window.navigator.clipboard.writeText(e.responseText).then(()=>{a(!0),setTimeout(()=>a(!1),2e3)})}return h.jsxs(h.Fragment,{children:[h.jsxs("div",{className:ze("border border-border rounded-lg mb-3 overflow-hidden"),children:[h.jsx(n5,{log:e,parsedRequest:u,expanded:n,onToggle:()=>r(!n)}),n&&h.jsx("div",{onClick:d=>d.stopPropagation(),onKeyDown:d=>d.stopPropagation(),children:h.jsxs(wn,{defaultValue:"request",children:[h.jsxs(_n,{className:"mx-4 mt-2",children:[t==="full"&&h.jsx(Je,{value:"raw-headers",children:"Raw Headers"}),t==="full"&&h.jsx(Je,{value:"headers",children:"Headers"}),h.jsx(Je,{value:"request",children:"Request"}),t==="full"&&h.jsx(Je,{value:"raw",children:"Raw Response"}),h.jsx(Je,{value:"parsed",children:"Parsed Response"})]}),h.jsx(Xe,{value:"request",children:h.jsxs("div",{className:"px-4 py-3",children:[h.jsxs("div",{className:"flex justify-end gap-2 mb-2",children:[h.jsxs(Ct,{variant:"outline",size:"sm",className:"h-7 text-xs",onClick:d=>{d.stopPropagation(),c(!0)},children:[h.jsx(Rc,{className:"size-3 mr-1"}),"Replay"]}),h.jsx(Ll,{text:e.rawRequestBody,label:"Copy Request",copied:o,onCopy:f})]}),e.rawRequestBody!==null?h.jsx(Dl,{text:e.rawRequestBody,defaultExpandDepth:1}):h.jsx("p",{className:"text-xs text-muted-foreground italic",children:"No request body"})]})}),t==="full"&&h.jsx(Xe,{value:"headers",children:h.jsx("div",{className:"px-4 py-3",children:e.headers&&Object.keys(e.headers).length>0?h.jsx("div",{className:"space-y-1 font-mono text-xs",children:Object.entries(e.headers).sort(([d],[x])=>d.localeCompare(x)).map(([d,x])=>h.jsxs("div",{className:"flex gap-2",children:[h.jsxs("span",{className:"text-blue-600 dark:text-blue-400 font-semibold shrink-0",children:[d,":"]}),h.jsx("span",{className:"text-muted-foreground truncate",title:x,children:x})]},d))}):h.jsx("p",{className:"text-xs text-muted-foreground italic",children:"No headers captured"})})}),t==="full"&&h.jsx(Xe,{value:"raw-headers",children:h.jsx("div",{className:"px-4 py-3",children:e.rawHeaders&&Object.keys(e.rawHeaders).length>0?h.jsx("div",{className:"space-y-1 font-mono text-xs",children:Object.entries(e.rawHeaders).sort(([d],[x])=>d.localeCompare(x)).map(([d,x])=>h.jsxs("div",{className:"flex gap-2",children:[h.jsxs("span",{className:"text-blue-600 dark:text-blue-400 font-semibold shrink-0",children:[d,":"]}),h.jsx("span",{className:"text-muted-foreground truncate",title:x,children:x})]},d))}):h.jsx("p",{className:"text-xs text-muted-foreground italic",children:"No raw headers captured"})})}),h.jsx(Xe,{value:"raw",children:h.jsxs("div",{className:"px-4 py-3 space-y-3",children:[h.jsx("div",{className:"flex justify-end",children:h.jsx(Ll,{text:e.responseText,label:"Copy Response",copied:s,onCopy:p})}),e.responseText!==null?h.jsx(Dl,{text:e.responseText,defaultExpandDepth:1}):h.jsx("p",{className:"text-xs text-muted-foreground italic",children:"No response"}),e.streaming===!0&&h.jsx(k5,{logId:e.id,truncated:e.streamingChunksPath!==null})]})}),h.jsx(Xe,{value:"parsed",children:h.jsx("div",{className:"px-4 py-3",children:h.jsx($r,{responseText:e.responseText,responseStatus:e.responseStatus,streaming:e.streaming,inputTokens:e.inputTokens,outputTokens:e.outputTokens,cacheCreationInputTokens:e.cacheCreationInputTokens,cacheReadInputTokens:e.cacheReadInputTokens,apiFormat:e.apiFormat})})})]})})]}),h.jsx(_5,{log:e,open:l,onOpenChange:c})]})}function S5(e){let t=0,n=0;for(const r of e)r.inputTokens!==null&&(t+=r.inputTokens),r.outputTokens!==null&&(n+=r.outputTokens);return{totalInputTokens:t,totalOutputTokens:n}}function C5({group:e,viewMode:t="simple"}){const[n,r]=_.useState(!1),o=S5(e.logs),i=e.logs[0]?.timestamp??new Date().toISOString(),s=e.logs[e.logs.length-1]?.timestamp??new Date().toISOString(),a=e.conversationId.startsWith("PID:")||e.conversationId.includes("|")?e.conversationId:e.conversationId.length>24?e.conversationId.slice(0,12)+"…"+e.conversationId.slice(-12):e.conversationId;return h.jsxs("div",{className:"mb-4",children:[h.jsx(ub,{conversationId:a,startTime:i,endTime:s,totalCalls:e.logs.length,totalInputTokens:o.totalInputTokens,totalOutputTokens:o.totalOutputTokens,expanded:n,onToggle:()=>r(!n)}),n&&h.jsx("div",{className:"pl-4 border-l-2 border-muted ml-3",children:e.logs.map(l=>h.jsx(ah,{log:l,viewMode:t},l.id))})]})}function Fl({...e}){return h.jsx(LE,{"data-slot":"select",...e})}function $l({...e}){return h.jsx($E,{"data-slot":"select-value",...e})}function Bl({className:e,size:t="default",children:n,...r}){return h.jsxs(FE,{"data-slot":"select-trigger","data-size":t,className:ze("border-input data-[placeholder]:text-muted-foreground [&_svg:not([class*='text-'])]:text-muted-foreground focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:bg-input/30 dark:hover:bg-input/50 flex w-fit items-center justify-between gap-2 rounded-md border bg-transparent px-3 py-2 text-sm whitespace-nowrap shadow-xs transition-[color,box-shadow] outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50 data-[size=default]:h-9 data-[size=sm]:h-8 *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-2 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",e),...r,children:[n,h.jsx(BE,{asChild:!0,children:h.jsx(At,{className:"size-4 opacity-50"})})]})}function Ul({className:e,children:t,position:n="popper",align:r="center",...o}){return h.jsx(UE,{children:h.jsxs(ZE,{"data-slot":"select-content",className:ze("bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 relative z-50 max-h-(--radix-select-content-available-height) min-w-[8rem] origin-(--radix-select-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border shadow-md",n==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",e),position:n,align:r,...o,children:[h.jsx(E5,{}),h.jsx(VE,{className:ze("p-1",n==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)] scroll-my-1"),children:t}),h.jsx(T5,{})]})})}function Rr({className:e,children:t,...n}){return h.jsxs(WE,{"data-slot":"select-item",className:ze("focus:bg-accent focus:text-accent-foreground [&_svg:not([class*='text-'])]:text-muted-foreground relative flex w-full cursor-default items-center gap-2 rounded-sm py-1.5 pr-8 pl-2 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2",e),...n,children:[h.jsx("span",{className:"absolute right-2 flex size-3.5 items-center justify-center",children:h.jsx(qE,{children:h.jsx(ur,{className:"size-4"})})}),h.jsx(HE,{children:t})]})}function E5({className:e,...t}){return h.jsx(KE,{"data-slot":"select-scroll-up-button",className:ze("flex cursor-default items-center justify-center py-1",e),...t,children:h.jsx(iy,{className:"size-4"})})}function T5({className:e,...t}){return h.jsx(GE,{"data-slot":"select-scroll-down-button",className:ze("flex cursor-default items-center justify-center py-1",e),...t,children:h.jsx(At,{className:"size-4"})})}const N5={deepseek:"https://api-docs.deepseek.com/zh-cn/"};function A5(e){return e.length<=8?"••••••••":e.slice(0,4)+"••••••••"+e.slice(-4)}function z5(e){return Object.prototype.hasOwnProperty.call(e,"success")}function I5(e){const t={className:"size-3",strokeWidth:2};switch(e){case"timeout":return h.jsx(Hi,{...t});case"network_unreachable":return h.jsx(cv,{...t});case"connection_refused":return h.jsx(dv,{...t});case"auth_failed":return h.jsx(Ly,{...t});case"rate_limited":return h.jsx(Ay,{...t});case"server_error":return h.jsx(Jy,{...t});case"invalid_response":return h.jsx(py,{...t});case"unknown":return h.jsx(ui,{...t});default:return h.jsx(ui,{...t})}}function Zl({result:e,isTesting:t}){if(!z5(e))return h.jsxs("div",{className:"flex items-center gap-1 text-xs text-muted-foreground",children:[h.jsx(By,{className:"size-3"}),h.jsx("span",{children:"Not configured"})]});if(e.success)return h.jsxs("div",{className:"flex items-center gap-1 text-xs text-green-600",children:[h.jsx(fy,{className:"size-3"}),h.jsx("span",{children:"Connected"})]});const n=e.error,r=n?.message??"Connection failed",o=n?.hint,i=n?.type??"unknown";return h.jsxs("div",{className:"flex flex-col gap-1 min-w-0",children:[h.jsxs("div",{className:"flex items-center gap-1 text-xs text-red-600 min-w-0",title:n?.details??r,children:[I5(i),h.jsx("span",{className:"truncate",children:r})]}),o!==void 0&&h.jsx("div",{className:"text-xs text-muted-foreground pl-4 truncate",title:o,children:o})]})}function j5({provider:e,testResults:t,isTesting:n,onEdit:r,onDelete:o,onTest:i}){const[s,a]=_.useState(!1);return h.jsxs("div",{className:"border rounded-lg p-4 flex flex-col gap-3 bg-card",children:[h.jsxs("div",{className:"flex items-start justify-between gap-2",children:[h.jsx("div",{className:"flex items-center gap-2 min-w-0",children:h.jsx("span",{className:"font-medium truncate",children:e.model!==void 0&&e.model!==""?`${e.model} (${e.name})`:e.name})}),Object.entries(N5).map(([l,c])=>e.name.toLowerCase().includes(l)?h.jsxs("a",{href:c,target:"_blank",rel:"noopener noreferrer",className:"text-muted-foreground hover:text-foreground transition-colors flex items-center gap-1 text-xs",title:"View API documentation",children:[h.jsx(wy,{className:"size-3"}),h.jsx("span",{className:"sr-only",children:"Docs"})]},l):null)]}),h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsx("code",{className:"text-xs text-muted-foreground bg-muted px-2 py-1 rounded flex-1 truncate",children:s?e.apiKey:A5(e.apiKey)}),h.jsx("button",{type:"button",onClick:()=>a(l=>!l),className:"text-muted-foreground hover:text-foreground transition-colors p-1","aria-label":s?"Hide API key":"Show API key",children:s?h.jsx(ky,{className:"size-4"}):h.jsx(Cy,{className:"size-4"})})]}),e.anthropicBaseUrl!==void 0&&e.anthropicBaseUrl!==""&&h.jsxs("div",{className:"flex items-center justify-between gap-2",children:[h.jsxs("div",{className:"text-xs text-muted-foreground min-w-0 flex-1",children:[h.jsx("span",{className:"font-medium",children:"Anthropic:"})," ",h.jsx("span",{className:"truncate",children:e.anthropicBaseUrl})]}),t&&h.jsx(Zl,{result:t.anthropic.nonStreaming,isTesting:n})]}),e.openaiBaseUrl!==void 0&&e.openaiBaseUrl!==""&&h.jsxs("div",{className:"flex items-center justify-between gap-2",children:[h.jsxs("div",{className:"text-xs text-muted-foreground min-w-0 flex-1",children:[h.jsx("span",{className:"font-medium",children:"OpenAI:"})," ",h.jsx("span",{className:"truncate",children:e.openaiBaseUrl})]}),t&&h.jsx(Zl,{result:t.openai.nonStreaming,isTesting:n})]}),h.jsxs("div",{className:"flex gap-2 pt-1 border-t",children:[i!==void 0&&h.jsxs(Ct,{variant:"outline",size:"sm",onClick:()=>i(e.id),className:"text-xs h-7 gap-1",disabled:n??!1,children:[h.jsx(Gy,{className:`size-3 ${n??!1?"animate-spin":""}`}),n??!1?"Testing...":"Test"]}),h.jsxs(Ct,{variant:"outline",size:"sm",onClick:()=>r(e),className:"text-xs h-7 gap-1",children:[h.jsx(Zy,{className:"size-3"}),"Edit"]}),h.jsxs(Ct,{variant:"outline",size:"sm",onClick:()=>o(e.id),className:"text-xs h-7 gap-1 text-destructive hover:text-destructive",children:[h.jsx(rv,{className:"size-3"}),"Delete"]})]})]})}const P5={deepseek:{format:"openai",baseUrl:"https://api.deepseek.com"},minimax:{format:"anthropic",baseUrl:"https://api.minimaxi.com/anthropic"},alibaba:{format:"openai",baseUrl:"https://dashscope.aliyuncs.com/compatible-mode"}},Vl=["MiniMax M2.7","MiniMax M2.7-highspeed","MiniMax M2.5","MiniMax M2.5-highspeed","MiniMax M2.1","MiniMax M2.1-highspeed","MiniMax M2"],Wl=["glm-5","glm-5.1","qwen3.6-plus","qwen3.7-max"];function O5({provider:e,onSubmit:t,onCancel:n}){const[r,o]=_.useState(e?.name??"Provider Name"),[i,s]=_.useState(e?.apiKey??""),[a,l]=_.useState(e?.model??""),[c,u]=_.useState(e?.format??"anthropic"),[f,p]=_.useState(e?.baseUrl??""),[d,x]=_.useState({}),[m,y]=_.useState(!1),[g,v]=_.useState(!1),k=r.toLowerCase().includes("minimax"),S=r.toLowerCase().includes("alibaba");_.useEffect(()=>{e&&(o(e.name),s(e.apiKey),l(e.model??""),u(e.format??"anthropic"),p(e.baseUrl??""),v(!1))},[e]),_.useEffect(()=>{const A=r.toLowerCase();for(const[O,D]of Object.entries(P5))if(A.includes(O)){g||(u(D.format),p(D.baseUrl)),O==="minimax"&&!a&&l(Vl[0]??""),O==="alibaba"&&!a&&l(Wl[0]??"");break}},[r]);function C(){const A={};return r.trim()||(A.name="Name is required"),i.trim()||(A.apiKey="API key is required"),a.trim()||(A.model="Model is required"),f.trim()?E(f.trim())||(A.baseUrl="Invalid URL format"):A.baseUrl="Base URL is required",x(A),Object.keys(A).length===0}function E(A){try{return new URL(A),!0}catch{return!1}}function N(A){if(A.preventDefault(),!!C()){y(!0);try{t({name:r.trim(),apiKey:i.trim(),model:a.trim()||void 0,format:c,baseUrl:f.trim()||void 0})}finally{y(!1)}}}return h.jsxs("form",{onSubmit:N,className:"space-y-4",children:[h.jsxs("div",{className:"space-y-2",children:[h.jsxs("label",{htmlFor:"provider-name",className:"text-sm font-medium",children:["Name ",h.jsx("span",{className:"text-destructive",children:"*"})]}),h.jsx("input",{id:"provider-name",type:"text",value:r,onChange:A=>o(A.target.value),placeholder:"Model Name",className:"w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus-visible:border-ring focus-visible:outline-ring focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50"}),d.name!==void 0&&h.jsx("p",{className:"text-xs text-destructive",children:d.name})]}),h.jsxs("div",{className:"space-y-2",children:[h.jsxs("label",{htmlFor:"provider-apikey",className:"text-sm font-medium",children:["API Key ",h.jsx("span",{className:"text-destructive",children:"*"})]}),h.jsx("input",{id:"provider-apikey",type:"password",value:i,onChange:A=>s(A.target.value),placeholder:"sk-ant-...",className:"w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus-visible:border-ring focus-visible:outline-ring focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50"}),d.apiKey!==void 0&&h.jsx("p",{className:"text-xs text-destructive",children:d.apiKey})]}),h.jsxs("div",{className:"space-y-2",children:[h.jsxs("label",{htmlFor:"provider-model",className:"text-sm font-medium",children:["Model ",h.jsx("span",{className:"text-destructive",children:"*"})]}),k||S?h.jsx("select",{id:"provider-model",value:a,onChange:A=>l(A.target.value),className:"w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background focus-visible:border-ring focus-visible:outline-ring focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50",children:(k?Vl:Wl).map(A=>h.jsx("option",{value:A,children:A},A))}):h.jsx("input",{id:"provider-model",type:"text",value:a,onChange:A=>l(A.target.value),placeholder:"",className:"w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus-visible:border-ring focus-visible:outline-ring focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50"}),d.model!==void 0&&h.jsx("p",{className:"text-xs text-destructive",children:d.model})]}),h.jsxs("div",{className:"space-y-2",children:[h.jsxs("label",{htmlFor:"provider-format",className:"text-sm font-medium",children:["API Format ",h.jsx("span",{className:"text-destructive",children:"*"})]}),h.jsxs("select",{id:"provider-format",value:c,onChange:A=>u(A.target.value==="anthropic"?"anthropic":"openai"),className:"w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background focus-visible:border-ring focus-visible:outline-ring focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50",children:[h.jsx("option",{value:"anthropic",children:"Anthropic (/v1/messages)"}),h.jsx("option",{value:"openai",children:"OpenAI (/v1/chat/completions)"})]}),h.jsx("p",{className:"text-xs text-muted-foreground",children:c==="anthropic"?"Use Anthropic format for /v1/messages endpoint":"Use OpenAI format for /v1/chat/completions endpoint"})]}),h.jsxs("div",{className:"space-y-2",children:[h.jsxs("label",{htmlFor:"provider-base-url",className:"text-sm font-medium",children:["Base URL ",h.jsx("span",{className:"text-destructive",children:"*"})]}),h.jsx("input",{id:"provider-base-url",type:"text",value:f,onChange:A=>{v(!0),p(A.target.value)},placeholder:c==="anthropic"?"https://api.anthropic.com":"https://api.openai.com/v1",className:"w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus-visible:border-ring focus-visible:outline-ring focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50"}),d.baseUrl!==void 0&&h.jsx("p",{className:"text-xs text-destructive",children:d.baseUrl}),h.jsx("p",{className:"text-xs text-muted-foreground",children:"Base URL for the provider API."})]}),h.jsxs("div",{className:"flex gap-2 justify-end pt-2",children:[h.jsx(Ct,{type:"button",variant:"outline",onClick:n,disabled:m,children:"Cancel"}),h.jsx(Ct,{type:"submit",disabled:m,children:m?"Saving...":e?"Update Provider":"Add Provider"})]})]})}function R5(){const[e,t]=_.useState([]),[n,r]=_.useState(!0),[o,i]=_.useState(!1),[s,a]=_.useState(),[l,c]=_.useState(null),[u,f]=_.useState({}),[p,d]=_.useState(new Set),[x,m]=_.useState(null),[y,g]=_.useState(!1),v=_.useCallback(async()=>{try{const A=await(await fetch("/api/providers")).json();t(A)}catch{c("Failed to load providers")}finally{r(!1)}},[]);_.useEffect(()=>{v(),(async()=>{try{const N=await fetch("/api/config/paths");if(N.ok){const A=await N.json();m(A.providerConfig)}}catch{}})()},[v]);const k=_.useCallback(async N=>{d(A=>new Set(A).add(N));try{const A=await fetch(`/api/providers/${N}/test`,{method:"POST"});if(A.ok){const O=await A.json();f(D=>({...D,[N]:O}))}}finally{d(A=>{const O=new Set(A);return O.delete(N),O})}},[]);function S(N){(async()=>{const A={name:N.name,apiKey:N.apiKey,model:N.model,format:N.format,anthropicBaseUrl:N.format==="anthropic"?N.baseUrl:void 0,openaiBaseUrl:N.format==="openai"?N.baseUrl:void 0},O=await fetch("/api/providers",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(A)});if(!O.ok){const U=await O.json();c(U.error??"Failed to add provider");return}const D=await O.json();await v(),i(!1),await k(D.id)})()}function C(N){s&&(async()=>{const A={name:N.name,apiKey:N.apiKey,model:N.model,format:N.format,anthropicBaseUrl:N.format==="anthropic"?N.baseUrl:void 0,openaiBaseUrl:N.format==="openai"?N.baseUrl:void 0},O=await fetch(`/api/providers/${s.id}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(A)});if(!O.ok){const U=await O.json();c(U.error??"Failed to update provider");return}const D=await O.json();await v(),a(void 0),await k(D.id)})()}function E(N){window.confirm("Are you sure you want to delete this provider?")&&(async()=>{const A=await fetch(`/api/providers/${N}`,{method:"DELETE"});if(!A.ok){const O=await A.json();c(O.error??"Failed to delete provider");return}await v()})()}return n?h.jsx("div",{className:"flex items-center justify-center py-8",children:h.jsx("p",{className:"text-sm text-muted-foreground",children:"Loading providers..."})}):o||s?h.jsxs("div",{className:"space-y-4",children:[h.jsx("div",{className:"flex items-center justify-between",children:h.jsx("h3",{className:"text-lg font-medium",children:s?"Edit Provider":"Add New Provider"})}),h.jsx(O5,{provider:s,onSubmit:s?C:S,onCancel:()=>{i(!1),a(void 0)}})]}):h.jsxs("div",{className:"space-y-4",children:[h.jsxs("div",{className:"flex items-center justify-between",children:[h.jsx("h3",{className:"text-lg font-medium",children:"Providers"}),h.jsxs(Ct,{onClick:()=>i(!0),size:"sm",className:"gap-1",children:[h.jsx(fa,{className:"size-4"}),"Add Provider"]})]}),x!==null&&h.jsxs("div",{className:"flex items-center gap-2 text-xs text-muted-foreground bg-muted/30 rounded-md px-3 py-2",children:[h.jsx("span",{className:"shrink-0",children:"Config:"}),h.jsx("span",{className:"font-mono truncate",title:x,children:x}),h.jsx("button",{type:"button",onClick:()=>{window.navigator.clipboard.writeText(x).then(()=>{g(!0),setTimeout(()=>g(!1),2e3)})},className:"shrink-0 ml-auto text-muted-foreground hover:text-foreground transition-colors",title:"Copy path",children:y?h.jsx(ur,{className:"size-3 text-green-500"}):h.jsx(ao,{className:"size-3"})})]}),l!==null&&h.jsxs("div",{className:"flex items-center gap-2 text-sm text-destructive bg-destructive/10 rounded-md px-3 py-2",children:[h.jsx(ui,{className:"size-4 shrink-0"}),l]}),e.length===0?h.jsxs("div",{className:"text-center py-12 space-y-3",children:[h.jsx("p",{className:"text-sm text-muted-foreground",children:"No providers configured yet."}),h.jsxs(Ct,{onClick:()=>i(!0),variant:"outline",size:"sm",children:[h.jsx(fa,{className:"size-4"}),"Add Your First Provider"]})]}):h.jsx("div",{className:"space-y-3",children:e.map(N=>h.jsx(j5,{provider:N,testResults:u[N.id],isTesting:p.has(N.id),onEdit:A=>a(A),onDelete:E,onTest:A=>{k(A)}},N.id))})]})}function D5(){const[e,t]=_.useState(!1),[n,r]=_.useState("providers");return h.jsxs(th,{open:e,onOpenChange:t,children:[h.jsx(r5,{asChild:!0,children:h.jsxs(Ct,{variant:"ghost",size:"icon",className:"size-8",children:[h.jsx(Qy,{className:"size-4"}),h.jsx("span",{className:"sr-only",children:"Settings"})]})}),h.jsxs(nh,{className:"max-w-2xl max-h-[80vh] overflow-hidden flex flex-col",children:[h.jsx(rh,{children:h.jsx(oh,{children:"Settings"})}),h.jsxs(wn,{value:n,onValueChange:r,className:"flex-1 overflow-hidden",children:[h.jsx(_n,{children:h.jsx(Je,{value:"providers",children:"Providers"})}),h.jsx("div",{className:"mt-4 overflow-y-auto flex-1",children:h.jsx(Xe,{value:"providers",children:h.jsx(R5,{})})})]})]})]})}function M5(e){return e.length<=30?e:e.slice(0,12)+"…"+e.slice(-12)}function L5(e){let t=0,n=0;for(const r of e)r.inputTokens!==null&&(t+=r.inputTokens),r.outputTokens!==null&&(n+=r.outputTokens);return{totalIn:t,totalOut:n}}function F5({command:e}){const[t,n]=_.useState(!1),r=_.useCallback(()=>{window.navigator.clipboard.writeText(e).then(()=>{n(!0),setTimeout(()=>n(!1),2e3)})},[e]);return h.jsxs("div",{className:"inline-flex items-center gap-2 bg-muted rounded-md px-3 py-2",children:[h.jsx("pre",{className:"text-blue-500 font-mono text-sm m-0",children:e}),h.jsx("button",{type:"button",onClick:r,className:"text-muted-foreground hover:text-foreground transition-colors shrink-0 cursor-pointer","aria-label":"Copy command",children:t?h.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:h.jsx("path",{d:"M20 6 9 17l-5-5"})}):h.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[h.jsx("rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2"}),h.jsx("path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2"})]})})]})}function $5({logs:e,sessions:t,models:n,selectedSession:r,selectedModel:o,onSessionChange:i,onModelChange:s,onClearAll:a,viewMode:l,onViewModeChange:c}){const{totalIn:u,totalOut:f}=L5(e),[p,d]=_.useState(!0),[x,m]=_.useState(!1),y=_.useCallback(async()=>{m(!0);try{await wv(e)}finally{m(!1)}},[e]),g=_.useRef(null),v=_.useMemo(()=>fb(e),[e]),k=e.length>0&&p&&!(v.length===1&&v[0]?.logs.length===e.length),S=qx({count:k?v.length:e.length,getScrollElement:()=>g.current,estimateSize:()=>150,measureElement:typeof window<"u"?C=>C.getBoundingClientRect().height:void 0,overscan:5});return h.jsxs("div",{className:"max-w-[1200px] mx-auto flex flex-col h-screen",style:{maxHeight:"100vh"},children:[h.jsxs("div",{className:"flex items-center gap-4 mb-4 px-6 pt-6",children:[h.jsx("h1",{className:"text-lg font-bold flex-1",children:"LLM Proxy Inspector"}),h.jsxs("div",{className:"flex items-center border border-border rounded-md overflow-hidden",children:[h.jsx("button",{type:"button",onClick:()=>c("simple"),className:`px-2 py-1 cursor-pointer transition-colors text-xs ${l==="simple"?"bg-muted text-foreground":"text-muted-foreground hover:bg-muted/50"}`,children:"Simple"}),h.jsx("button",{type:"button",onClick:()=>c("full"),className:`px-2 py-1 cursor-pointer transition-colors text-xs ${l==="full"?"bg-muted text-foreground":"text-muted-foreground hover:bg-muted/50"}`,children:"Full"})]}),h.jsx(D5,{}),h.jsxs("span",{className:"text-muted-foreground text-xs font-mono",children:[e.length," request",e.length!==1?"s":"",u>0||f>0?` · ${u.toLocaleString()} in / ${f.toLocaleString()} out`:""]}),e.length>0&&h.jsx("button",{type:"button",onClick:()=>{y()},disabled:x,className:"text-xs text-muted-foreground hover:text-foreground transition-colors cursor-pointer disabled:opacity-50 disabled:cursor-not-allowed inline-flex items-center gap-1",title:"Export all logs as JSON ZIP",children:x?h.jsx("span",{children:"Exporting..."}):h.jsxs(h.Fragment,{children:[h.jsx(vy,{className:"size-3"}),h.jsx("span",{children:"Export All"})]})}),h.jsx("button",{type:"button",onClick:a,className:"text-xs text-muted-foreground hover:text-foreground transition-colors cursor-pointer",title:"Clear all logs",children:"Clear All"})]}),h.jsxs("div",{className:"flex gap-3 px-6 mb-4",children:[h.jsxs(Fl,{value:r,onValueChange:i,children:[h.jsx(Bl,{className:"flex-1 max-w-[400px] text-xs",children:h.jsx($l,{placeholder:"All sessions"})}),h.jsxs(Ul,{children:[h.jsx(Rr,{value:"__all__",children:"All sessions"}),t.map(C=>h.jsx(Rr,{value:C,children:M5(C)},C))]})]}),h.jsxs(Fl,{value:o,onValueChange:s,children:[h.jsx(Bl,{className:"text-xs",children:h.jsx($l,{placeholder:"All models"})}),h.jsxs(Ul,{children:[h.jsx(Rr,{value:"__all__",children:"All models"}),n.map(C=>h.jsx(Rr,{value:C,children:C},C))]})]}),h.jsxs("div",{className:"flex items-center border border-border rounded-md overflow-hidden",children:[h.jsx("button",{type:"button",onClick:()=>d(!0),className:`px-2 py-1.5 cursor-pointer transition-colors ${p?"bg-muted text-foreground":"text-muted-foreground hover:bg-muted/50"}`,title:"Grouped view",children:h.jsx(Py,{className:"size-4"})}),h.jsx("button",{type:"button",onClick:()=>d(!1),className:`px-2 py-1.5 cursor-pointer transition-colors ${p?"text-muted-foreground hover:bg-muted/50":"bg-muted text-foreground"}`,title:"Flat view",children:h.jsx(Ry,{className:"size-4"})})]})]}),h.jsx("div",{className:"flex-1 min-h-0 px-6 pb-6",children:e.length===0?h.jsxs("div",{className:"text-center text-muted-foreground py-16 space-y-4",children:[h.jsx("p",{className:"text-sm",children:"No requests captured yet."}),h.jsx("p",{className:"text-xs",children:"Route AI coding tools through the proxy:"}),h.jsx(F5,{command:"LLM_BASE_URL=http://localhost:25947/proxy <your-tool>"})]}):h.jsx("div",{ref:g,className:"overflow-y-auto h-full",children:h.jsx("div",{style:{height:`${S.getTotalSize()}px`,width:"100%",position:"relative"},children:S.getVirtualItems().map(C=>{if(k){const E=v[C.index];return E===void 0?null:h.jsx("div",{"data-index":C.index,ref:S.measureElement,style:{position:"absolute",top:0,left:0,width:"100%",transform:`translateY(${C.start}px)`},children:h.jsx(C5,{group:E,viewMode:l})},E.id)}else{const E=e[C.index];return E===void 0?null:h.jsx("div",{"data-index":C.index,ref:S.measureElement,style:{position:"absolute",top:0,left:0,width:"100%",transform:`translateY(${C.start}px)`},children:h.jsx(ah,{log:E,viewMode:l})},E.id)}})})})})]})}ue({logs:Ze(ci),total:ye(),offset:ye(),limit:ye()});const B5=Yt([ue({type:Te("init"),logs:Ze(ci)}),ue({type:Te("update"),log:ci})]);function U5(e){const t=new Set;for(const n of e)n.sessionId!==null&&n.sessionId!==""&&t.add(n.sessionId);return[...t]}function Z5(e){const t=new Set;for(const n of e)n.model!==null&&n.model!==""&&t.add(n.model);return[...t]}function V5(){const[e,t]=_.useState([]),[n,r]=_.useState([]),[o,i]=_.useState([]),[s,a]=_.useState("__all__"),[l,c]=_.useState("__all__"),[u,f]=_.useState("simple"),[p,d]=_.useState(null),x=_.useRef(null),m=_.useCallback(async()=>{try{const[v,k]=await Promise.all([fetch("/api/sessions"),fetch("/api/models")]);if(v.ok&&k.ok){const S=await v.json(),C=await k.json(),E=Ze(ne()).safeParse(S),N=Ze(ne()).safeParse(C);E.success&&r(E.data),N.success&&i(N.data)}}catch{}},[]),y=_.useCallback(()=>{x.current&&x.current.close();const v=new URLSearchParams;s!=="__all__"&&v.set("sessionId",s),l!=="__all__"&&v.set("model",l);const k=new EventSource(`/api/logs/stream?${v}`);x.current=k,k.onmessage=S=>{try{const C=String(S.data),E=JSON.parse(C),N=B5.safeParse(E);if(!N.success){d("Failed to parse SSE data");return}const A=N.data;A.type==="init"?(t(A.logs),r(U5(A.logs)),i(Z5(A.logs)),d(null)):A.type==="update"&&(t(O=>{const D=s==="__all__"||A.log.sessionId===s,U=l==="__all__"||A.log.model===l;return!D||!U?O:O.findIndex(M=>M.id===A.log.id)>=0?O.map(M=>M.id===A.log.id?A.log:M):[...O,A.log]}),r(O=>{const D=A.log.sessionId;return D!=null&&D!==""?O.includes(D)?O:[...O,D]:O}),i(O=>{const D=A.log.model;return D!=null&&D!==""?O.includes(D)?O:[...O,D]:O}))}catch{d("Failed to parse SSE data")}},k.onerror=()=>{d("SSE connection lost, reconnecting..."),k.close(),setTimeout(y,3e3)},m()},[s,l,m]);_.useEffect(()=>(y(),()=>{x.current&&(x.current.close(),x.current=null)}),[y]);const g=_.useCallback(()=>{(async()=>{try{if(!(await fetch("/api/logs",{method:"DELETE"})).ok){d("Failed to clear logs");return}t([]),r([]),i([]),d(null)}catch(v){d(v instanceof Error?v.message:"Unknown error clearing logs")}})()},[]);return h.jsxs(h.Fragment,{children:[p!==null&&h.jsx("div",{className:"fixed top-4 right-4 bg-destructive text-destructive-foreground px-4 py-2 rounded-md text-sm z-50",children:p}),h.jsx($5,{logs:e,sessions:n,models:o,selectedSession:s,selectedModel:l,onSessionChange:a,onModelChange:c,onClearAll:g,viewMode:u,onViewModeChange:f})]})}const q5=V5;export{q5 as component};
|
|
97
|
+
For more information, see https://radix-ui.com/primitives/docs/components/${t.docsSlug}`;return _.useEffect(()=>{e&&(document.getElementById(e)||console.error(n))},[n,e]),null},hS="DialogDescriptionWarning",pS=({contentRef:e,descriptionId:t})=>{const r=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${pd(hS).contentName}}.`;return _.useEffect(()=>{const o=e.current?.getAttribute("aria-describedby");t&&o&&(document.getElementById(t)||console.warn(r))},[r,e,t]),null},mS=td,gS=rd,xS=id,yS=sd,vS=ad,bS=cd,wS=fd;function _S(e){const t=_.useRef({value:e,previous:e});return _.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}function kS(e){const[t,n]=_.useState(void 0);return qe(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});const r=new ResizeObserver(o=>{if(!Array.isArray(o)||!o.length)return;const i=o[0];let s,a;if("borderBoxSize"in i){const l=i.borderBoxSize,c=Array.isArray(l)?l[0]:l;s=c.inlineSize,a=c.blockSize}else s=e.offsetWidth,a=e.offsetHeight;n({width:s,height:a})});return r.observe(e,{box:"border-box"}),()=>r.unobserve(e)}else n(void 0)},[e]),t}const SS=["top","right","bottom","left"],Ht=Math.min,at=Math.max,Gr=Math.round,Pr=Math.floor,Tt=e=>({x:e,y:e}),CS={left:"right",right:"left",bottom:"top",top:"bottom"},ES={start:"end",end:"start"};function Si(e,t,n){return at(e,Ht(t,n))}function Mt(e,t){return typeof e=="function"?e(t):e}function Lt(e){return e.split("-")[0]}function Un(e){return e.split("-")[1]}function xs(e){return e==="x"?"y":"x"}function ys(e){return e==="y"?"height":"width"}const TS=new Set(["top","bottom"]);function St(e){return TS.has(Lt(e))?"y":"x"}function vs(e){return xs(St(e))}function NS(e,t,n){n===void 0&&(n=!1);const r=Un(e),o=vs(e),i=ys(o);let s=o==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[i]>t.floating[i]&&(s=Yr(s)),[s,Yr(s)]}function AS(e){const t=Yr(e);return[Ci(e),t,Ci(t)]}function Ci(e){return e.replace(/start|end/g,t=>ES[t])}const vl=["left","right"],bl=["right","left"],zS=["top","bottom"],IS=["bottom","top"];function jS(e,t,n){switch(e){case"top":case"bottom":return n?t?bl:vl:t?vl:bl;case"left":case"right":return t?zS:IS;default:return[]}}function PS(e,t,n,r){const o=Un(e);let i=jS(Lt(e),n==="start",r);return o&&(i=i.map(s=>s+"-"+o),t&&(i=i.concat(i.map(Ci)))),i}function Yr(e){return e.replace(/left|right|bottom|top/g,t=>CS[t])}function OS(e){return{top:0,right:0,bottom:0,left:0,...e}}function md(e){return typeof e!="number"?OS(e):{top:e,right:e,bottom:e,left:e}}function Jr(e){const{x:t,y:n,width:r,height:o}=e;return{width:r,height:o,top:n,left:t,right:t+r,bottom:n+o,x:t,y:n}}function wl(e,t,n){let{reference:r,floating:o}=e;const i=St(t),s=vs(t),a=ys(s),l=Lt(t),c=i==="y",u=r.x+r.width/2-o.width/2,f=r.y+r.height/2-o.height/2,p=r[a]/2-o[a]/2;let d;switch(l){case"top":d={x:u,y:r.y-o.height};break;case"bottom":d={x:u,y:r.y+r.height};break;case"right":d={x:r.x+r.width,y:f};break;case"left":d={x:r.x-o.width,y:f};break;default:d={x:r.x,y:r.y}}switch(Un(t)){case"start":d[s]-=p*(n&&c?-1:1);break;case"end":d[s]+=p*(n&&c?-1:1);break}return d}async function RS(e,t){var n;t===void 0&&(t={});const{x:r,y:o,platform:i,rects:s,elements:a,strategy:l}=e,{boundary:c="clippingAncestors",rootBoundary:u="viewport",elementContext:f="floating",altBoundary:p=!1,padding:d=0}=Mt(t,e),x=md(d),y=a[p?f==="floating"?"reference":"floating":f],g=Jr(await i.getClippingRect({element:(n=await(i.isElement==null?void 0:i.isElement(y)))==null||n?y:y.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(a.floating)),boundary:c,rootBoundary:u,strategy:l})),v=f==="floating"?{x:r,y:o,width:s.floating.width,height:s.floating.height}:s.reference,k=await(i.getOffsetParent==null?void 0:i.getOffsetParent(a.floating)),S=await(i.isElement==null?void 0:i.isElement(k))?await(i.getScale==null?void 0:i.getScale(k))||{x:1,y:1}:{x:1,y:1},C=Jr(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:a,rect:v,offsetParent:k,strategy:l}):v);return{top:(g.top-C.top+x.top)/S.y,bottom:(C.bottom-g.bottom+x.bottom)/S.y,left:(g.left-C.left+x.left)/S.x,right:(C.right-g.right+x.right)/S.x}}const DS=async(e,t,n)=>{const{placement:r="bottom",strategy:o="absolute",middleware:i=[],platform:s}=n,a=i.filter(Boolean),l=await(s.isRTL==null?void 0:s.isRTL(t));let c=await s.getElementRects({reference:e,floating:t,strategy:o}),{x:u,y:f}=wl(c,r,l),p=r,d={},x=0;for(let y=0;y<a.length;y++){var m;const{name:g,fn:v}=a[y],{x:k,y:S,data:C,reset:E}=await v({x:u,y:f,initialPlacement:r,placement:p,strategy:o,middlewareData:d,rects:c,platform:{...s,detectOverflow:(m=s.detectOverflow)!=null?m:RS},elements:{reference:e,floating:t}});u=k??u,f=S??f,d={...d,[g]:{...d[g],...C}},E&&x<=50&&(x++,typeof E=="object"&&(E.placement&&(p=E.placement),E.rects&&(c=E.rects===!0?await s.getElementRects({reference:e,floating:t,strategy:o}):E.rects),{x:u,y:f}=wl(c,p,l)),y=-1)}return{x:u,y:f,placement:p,strategy:o,middlewareData:d}},MS=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:r,placement:o,rects:i,platform:s,elements:a,middlewareData:l}=t,{element:c,padding:u=0}=Mt(e,t)||{};if(c==null)return{};const f=md(u),p={x:n,y:r},d=vs(o),x=ys(d),m=await s.getDimensions(c),y=d==="y",g=y?"top":"left",v=y?"bottom":"right",k=y?"clientHeight":"clientWidth",S=i.reference[x]+i.reference[d]-p[d]-i.floating[x],C=p[d]-i.reference[d],E=await(s.getOffsetParent==null?void 0:s.getOffsetParent(c));let N=E?E[k]:0;(!N||!await(s.isElement==null?void 0:s.isElement(E)))&&(N=a.floating[k]||i.floating[x]);const A=S/2-C/2,O=N/2-m[x]/2-1,D=Ht(f[g],O),U=Ht(f[v],O),T=D,M=N-m[x]-U,b=N/2-m[x]/2+A,R=Si(T,b,M),K=!l.arrow&&Un(o)!=null&&b!==R&&i.reference[x]/2-(b<T?D:U)-m[x]/2<0,V=K?b<T?b-T:b-M:0;return{[d]:p[d]+V,data:{[d]:R,centerOffset:b-R-V,...K&&{alignmentOffset:V}},reset:K}}}),LS=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,r;const{placement:o,middlewareData:i,rects:s,initialPlacement:a,platform:l,elements:c}=t,{mainAxis:u=!0,crossAxis:f=!0,fallbackPlacements:p,fallbackStrategy:d="bestFit",fallbackAxisSideDirection:x="none",flipAlignment:m=!0,...y}=Mt(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};const g=Lt(o),v=St(a),k=Lt(a)===a,S=await(l.isRTL==null?void 0:l.isRTL(c.floating)),C=p||(k||!m?[Yr(a)]:AS(a)),E=x!=="none";!p&&E&&C.push(...PS(a,m,x,S));const N=[a,...C],A=await l.detectOverflow(t,y),O=[];let D=((r=i.flip)==null?void 0:r.overflows)||[];if(u&&O.push(A[g]),f){const b=NS(o,s,S);O.push(A[b[0]],A[b[1]])}if(D=[...D,{placement:o,overflows:O}],!O.every(b=>b<=0)){var U,T;const b=(((U=i.flip)==null?void 0:U.index)||0)+1,R=N[b];if(R&&(!(f==="alignment"?v!==St(R):!1)||D.every(W=>St(W.placement)===v?W.overflows[0]>0:!0)))return{data:{index:b,overflows:D},reset:{placement:R}};let K=(T=D.filter(V=>V.overflows[0]<=0).sort((V,W)=>V.overflows[1]-W.overflows[1])[0])==null?void 0:T.placement;if(!K)switch(d){case"bestFit":{var M;const V=(M=D.filter(W=>{if(E){const q=St(W.placement);return q===v||q==="y"}return!0}).map(W=>[W.placement,W.overflows.filter(q=>q>0).reduce((q,I)=>q+I,0)]).sort((W,q)=>W[1]-q[1])[0])==null?void 0:M[0];V&&(K=V);break}case"initialPlacement":K=a;break}if(o!==K)return{reset:{placement:K}}}return{}}}};function _l(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function kl(e){return SS.some(t=>e[t]>=0)}const FS=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n,platform:r}=t,{strategy:o="referenceHidden",...i}=Mt(e,t);switch(o){case"referenceHidden":{const s=await r.detectOverflow(t,{...i,elementContext:"reference"}),a=_l(s,n.reference);return{data:{referenceHiddenOffsets:a,referenceHidden:kl(a)}}}case"escaped":{const s=await r.detectOverflow(t,{...i,altBoundary:!0}),a=_l(s,n.floating);return{data:{escapedOffsets:a,escaped:kl(a)}}}default:return{}}}}},gd=new Set(["left","top"]);async function $S(e,t){const{placement:n,platform:r,elements:o}=e,i=await(r.isRTL==null?void 0:r.isRTL(o.floating)),s=Lt(n),a=Un(n),l=St(n)==="y",c=gd.has(s)?-1:1,u=i&&l?-1:1,f=Mt(t,e);let{mainAxis:p,crossAxis:d,alignmentAxis:x}=typeof f=="number"?{mainAxis:f,crossAxis:0,alignmentAxis:null}:{mainAxis:f.mainAxis||0,crossAxis:f.crossAxis||0,alignmentAxis:f.alignmentAxis};return a&&typeof x=="number"&&(d=a==="end"?x*-1:x),l?{x:d*u,y:p*c}:{x:p*c,y:d*u}}const BS=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,r;const{x:o,y:i,placement:s,middlewareData:a}=t,l=await $S(t,e);return s===((n=a.offset)==null?void 0:n.placement)&&(r=a.arrow)!=null&&r.alignmentOffset?{}:{x:o+l.x,y:i+l.y,data:{...l,placement:s}}}}},US=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:r,placement:o,platform:i}=t,{mainAxis:s=!0,crossAxis:a=!1,limiter:l={fn:g=>{let{x:v,y:k}=g;return{x:v,y:k}}},...c}=Mt(e,t),u={x:n,y:r},f=await i.detectOverflow(t,c),p=St(Lt(o)),d=xs(p);let x=u[d],m=u[p];if(s){const g=d==="y"?"top":"left",v=d==="y"?"bottom":"right",k=x+f[g],S=x-f[v];x=Si(k,x,S)}if(a){const g=p==="y"?"top":"left",v=p==="y"?"bottom":"right",k=m+f[g],S=m-f[v];m=Si(k,m,S)}const y=l.fn({...t,[d]:x,[p]:m});return{...y,data:{x:y.x-n,y:y.y-r,enabled:{[d]:s,[p]:a}}}}}},ZS=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:n,y:r,placement:o,rects:i,middlewareData:s}=t,{offset:a=0,mainAxis:l=!0,crossAxis:c=!0}=Mt(e,t),u={x:n,y:r},f=St(o),p=xs(f);let d=u[p],x=u[f];const m=Mt(a,t),y=typeof m=="number"?{mainAxis:m,crossAxis:0}:{mainAxis:0,crossAxis:0,...m};if(l){const k=p==="y"?"height":"width",S=i.reference[p]-i.floating[k]+y.mainAxis,C=i.reference[p]+i.reference[k]-y.mainAxis;d<S?d=S:d>C&&(d=C)}if(c){var g,v;const k=p==="y"?"width":"height",S=gd.has(Lt(o)),C=i.reference[f]-i.floating[k]+(S&&((g=s.offset)==null?void 0:g[f])||0)+(S?0:y.crossAxis),E=i.reference[f]+i.reference[k]+(S?0:((v=s.offset)==null?void 0:v[f])||0)-(S?y.crossAxis:0);x<C?x=C:x>E&&(x=E)}return{[p]:d,[f]:x}}}},VS=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var n,r;const{placement:o,rects:i,platform:s,elements:a}=t,{apply:l=()=>{},...c}=Mt(e,t),u=await s.detectOverflow(t,c),f=Lt(o),p=Un(o),d=St(o)==="y",{width:x,height:m}=i.floating;let y,g;f==="top"||f==="bottom"?(y=f,g=p===(await(s.isRTL==null?void 0:s.isRTL(a.floating))?"start":"end")?"left":"right"):(g=f,y=p==="end"?"top":"bottom");const v=m-u.top-u.bottom,k=x-u.left-u.right,S=Ht(m-u[y],v),C=Ht(x-u[g],k),E=!t.middlewareData.shift;let N=S,A=C;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(A=k),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(N=v),E&&!p){const D=at(u.left,0),U=at(u.right,0),T=at(u.top,0),M=at(u.bottom,0);d?A=x-2*(D!==0||U!==0?D+U:at(u.left,u.right)):N=m-2*(T!==0||M!==0?T+M:at(u.top,u.bottom))}await l({...t,availableWidth:A,availableHeight:N});const O=await s.getDimensions(a.floating);return x!==O.width||m!==O.height?{reset:{rects:!0}}:{}}}};function yo(){return typeof window<"u"}function Zn(e){return xd(e)?(e.nodeName||"").toLowerCase():"#document"}function ct(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function jt(e){var t;return(t=(xd(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function xd(e){return yo()?e instanceof Node||e instanceof ct(e).Node:!1}function xt(e){return yo()?e instanceof Element||e instanceof ct(e).Element:!1}function It(e){return yo()?e instanceof HTMLElement||e instanceof ct(e).HTMLElement:!1}function Sl(e){return!yo()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof ct(e).ShadowRoot}const WS=new Set(["inline","contents"]);function pr(e){const{overflow:t,overflowX:n,overflowY:r,display:o}=yt(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&!WS.has(o)}const HS=new Set(["table","td","th"]);function qS(e){return HS.has(Zn(e))}const KS=[":popover-open",":modal"];function vo(e){return KS.some(t=>{try{return e.matches(t)}catch{return!1}})}const GS=["transform","translate","scale","rotate","perspective"],YS=["transform","translate","scale","rotate","perspective","filter"],JS=["paint","layout","strict","content"];function bs(e){const t=ws(),n=xt(e)?yt(e):e;return GS.some(r=>n[r]?n[r]!=="none":!1)||(n.containerType?n.containerType!=="normal":!1)||!t&&(n.backdropFilter?n.backdropFilter!=="none":!1)||!t&&(n.filter?n.filter!=="none":!1)||YS.some(r=>(n.willChange||"").includes(r))||JS.some(r=>(n.contain||"").includes(r))}function XS(e){let t=qt(e);for(;It(t)&&!Pn(t);){if(bs(t))return t;if(vo(t))return null;t=qt(t)}return null}function ws(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const QS=new Set(["html","body","#document"]);function Pn(e){return QS.has(Zn(e))}function yt(e){return ct(e).getComputedStyle(e)}function bo(e){return xt(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function qt(e){if(Zn(e)==="html")return e;const t=e.assignedSlot||e.parentNode||Sl(e)&&e.host||jt(e);return Sl(t)?t.host:t}function yd(e){const t=qt(e);return Pn(t)?e.ownerDocument?e.ownerDocument.body:e.body:It(t)&&pr(t)?t:yd(t)}function sr(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);const o=yd(e),i=o===((r=e.ownerDocument)==null?void 0:r.body),s=ct(o);if(i){const a=Ei(s);return t.concat(s,s.visualViewport||[],pr(o)?o:[],a&&n?sr(a):[])}return t.concat(o,sr(o,[],n))}function Ei(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function vd(e){const t=yt(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const o=It(e),i=o?e.offsetWidth:n,s=o?e.offsetHeight:r,a=Gr(n)!==i||Gr(r)!==s;return a&&(n=i,r=s),{width:n,height:r,$:a}}function _s(e){return xt(e)?e:e.contextElement}function Tn(e){const t=_s(e);if(!It(t))return Tt(1);const n=t.getBoundingClientRect(),{width:r,height:o,$:i}=vd(t);let s=(i?Gr(n.width):n.width)/r,a=(i?Gr(n.height):n.height)/o;return(!s||!Number.isFinite(s))&&(s=1),(!a||!Number.isFinite(a))&&(a=1),{x:s,y:a}}const eC=Tt(0);function bd(e){const t=ct(e);return!ws()||!t.visualViewport?eC:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function tC(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==ct(e)?!1:t}function on(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const o=e.getBoundingClientRect(),i=_s(e);let s=Tt(1);t&&(r?xt(r)&&(s=Tn(r)):s=Tn(e));const a=tC(i,n,r)?bd(i):Tt(0);let l=(o.left+a.x)/s.x,c=(o.top+a.y)/s.y,u=o.width/s.x,f=o.height/s.y;if(i){const p=ct(i),d=r&&xt(r)?ct(r):r;let x=p,m=Ei(x);for(;m&&r&&d!==x;){const y=Tn(m),g=m.getBoundingClientRect(),v=yt(m),k=g.left+(m.clientLeft+parseFloat(v.paddingLeft))*y.x,S=g.top+(m.clientTop+parseFloat(v.paddingTop))*y.y;l*=y.x,c*=y.y,u*=y.x,f*=y.y,l+=k,c+=S,x=ct(m),m=Ei(x)}}return Jr({width:u,height:f,x:l,y:c})}function wo(e,t){const n=bo(e).scrollLeft;return t?t.left+n:on(jt(e)).left+n}function wd(e,t){const n=e.getBoundingClientRect(),r=n.left+t.scrollLeft-wo(e,n),o=n.top+t.scrollTop;return{x:r,y:o}}function nC(e){let{elements:t,rect:n,offsetParent:r,strategy:o}=e;const i=o==="fixed",s=jt(r),a=t?vo(t.floating):!1;if(r===s||a&&i)return n;let l={scrollLeft:0,scrollTop:0},c=Tt(1);const u=Tt(0),f=It(r);if((f||!f&&!i)&&((Zn(r)!=="body"||pr(s))&&(l=bo(r)),It(r))){const d=on(r);c=Tn(r),u.x=d.x+r.clientLeft,u.y=d.y+r.clientTop}const p=s&&!f&&!i?wd(s,l):Tt(0);return{width:n.width*c.x,height:n.height*c.y,x:n.x*c.x-l.scrollLeft*c.x+u.x+p.x,y:n.y*c.y-l.scrollTop*c.y+u.y+p.y}}function rC(e){return Array.from(e.getClientRects())}function oC(e){const t=jt(e),n=bo(e),r=e.ownerDocument.body,o=at(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),i=at(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let s=-n.scrollLeft+wo(e);const a=-n.scrollTop;return yt(r).direction==="rtl"&&(s+=at(t.clientWidth,r.clientWidth)-o),{width:o,height:i,x:s,y:a}}const Cl=25;function iC(e,t){const n=ct(e),r=jt(e),o=n.visualViewport;let i=r.clientWidth,s=r.clientHeight,a=0,l=0;if(o){i=o.width,s=o.height;const u=ws();(!u||u&&t==="fixed")&&(a=o.offsetLeft,l=o.offsetTop)}const c=wo(r);if(c<=0){const u=r.ownerDocument,f=u.body,p=getComputedStyle(f),d=u.compatMode==="CSS1Compat"&&parseFloat(p.marginLeft)+parseFloat(p.marginRight)||0,x=Math.abs(r.clientWidth-f.clientWidth-d);x<=Cl&&(i-=x)}else c<=Cl&&(i+=c);return{width:i,height:s,x:a,y:l}}const sC=new Set(["absolute","fixed"]);function aC(e,t){const n=on(e,!0,t==="fixed"),r=n.top+e.clientTop,o=n.left+e.clientLeft,i=It(e)?Tn(e):Tt(1),s=e.clientWidth*i.x,a=e.clientHeight*i.y,l=o*i.x,c=r*i.y;return{width:s,height:a,x:l,y:c}}function El(e,t,n){let r;if(t==="viewport")r=iC(e,n);else if(t==="document")r=oC(jt(e));else if(xt(t))r=aC(t,n);else{const o=bd(e);r={x:t.x-o.x,y:t.y-o.y,width:t.width,height:t.height}}return Jr(r)}function _d(e,t){const n=qt(e);return n===t||!xt(n)||Pn(n)?!1:yt(n).position==="fixed"||_d(n,t)}function lC(e,t){const n=t.get(e);if(n)return n;let r=sr(e,[],!1).filter(a=>xt(a)&&Zn(a)!=="body"),o=null;const i=yt(e).position==="fixed";let s=i?qt(e):e;for(;xt(s)&&!Pn(s);){const a=yt(s),l=bs(s);!l&&a.position==="fixed"&&(o=null),(i?!l&&!o:!l&&a.position==="static"&&!!o&&sC.has(o.position)||pr(s)&&!l&&_d(e,s))?r=r.filter(u=>u!==s):o=a,s=qt(s)}return t.set(e,r),r}function cC(e){let{element:t,boundary:n,rootBoundary:r,strategy:o}=e;const s=[...n==="clippingAncestors"?vo(t)?[]:lC(t,this._c):[].concat(n),r],a=s[0],l=s.reduce((c,u)=>{const f=El(t,u,o);return c.top=at(f.top,c.top),c.right=Ht(f.right,c.right),c.bottom=Ht(f.bottom,c.bottom),c.left=at(f.left,c.left),c},El(t,a,o));return{width:l.right-l.left,height:l.bottom-l.top,x:l.left,y:l.top}}function uC(e){const{width:t,height:n}=vd(e);return{width:t,height:n}}function dC(e,t,n){const r=It(t),o=jt(t),i=n==="fixed",s=on(e,!0,i,t);let a={scrollLeft:0,scrollTop:0};const l=Tt(0);function c(){l.x=wo(o)}if(r||!r&&!i)if((Zn(t)!=="body"||pr(o))&&(a=bo(t)),r){const d=on(t,!0,i,t);l.x=d.x+t.clientLeft,l.y=d.y+t.clientTop}else o&&c();i&&!r&&o&&c();const u=o&&!r&&!i?wd(o,a):Tt(0),f=s.left+a.scrollLeft-l.x-u.x,p=s.top+a.scrollTop-l.y-u.y;return{x:f,y:p,width:s.width,height:s.height}}function ni(e){return yt(e).position==="static"}function Tl(e,t){if(!It(e)||yt(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return jt(e)===n&&(n=n.ownerDocument.body),n}function kd(e,t){const n=ct(e);if(vo(e))return n;if(!It(e)){let o=qt(e);for(;o&&!Pn(o);){if(xt(o)&&!ni(o))return o;o=qt(o)}return n}let r=Tl(e,t);for(;r&&qS(r)&&ni(r);)r=Tl(r,t);return r&&Pn(r)&&ni(r)&&!bs(r)?n:r||XS(e)||n}const fC=async function(e){const t=this.getOffsetParent||kd,n=this.getDimensions,r=await n(e.floating);return{reference:dC(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function hC(e){return yt(e).direction==="rtl"}const pC={convertOffsetParentRelativeRectToViewportRelativeRect:nC,getDocumentElement:jt,getClippingRect:cC,getOffsetParent:kd,getElementRects:fC,getClientRects:rC,getDimensions:uC,getScale:Tn,isElement:xt,isRTL:hC};function Sd(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function mC(e,t){let n=null,r;const o=jt(e);function i(){var a;clearTimeout(r),(a=n)==null||a.disconnect(),n=null}function s(a,l){a===void 0&&(a=!1),l===void 0&&(l=1),i();const c=e.getBoundingClientRect(),{left:u,top:f,width:p,height:d}=c;if(a||t(),!p||!d)return;const x=Pr(f),m=Pr(o.clientWidth-(u+p)),y=Pr(o.clientHeight-(f+d)),g=Pr(u),k={rootMargin:-x+"px "+-m+"px "+-y+"px "+-g+"px",threshold:at(0,Ht(1,l))||1};let S=!0;function C(E){const N=E[0].intersectionRatio;if(N!==l){if(!S)return s();N?s(!1,N):r=setTimeout(()=>{s(!1,1e-7)},1e3)}N===1&&!Sd(c,e.getBoundingClientRect())&&s(),S=!1}try{n=new IntersectionObserver(C,{...k,root:o.ownerDocument})}catch{n=new IntersectionObserver(C,k)}n.observe(e)}return s(!0),i}function gC(e,t,n,r){r===void 0&&(r={});const{ancestorScroll:o=!0,ancestorResize:i=!0,elementResize:s=typeof ResizeObserver=="function",layoutShift:a=typeof IntersectionObserver=="function",animationFrame:l=!1}=r,c=_s(e),u=o||i?[...c?sr(c):[],...sr(t)]:[];u.forEach(g=>{o&&g.addEventListener("scroll",n,{passive:!0}),i&&g.addEventListener("resize",n)});const f=c&&a?mC(c,n):null;let p=-1,d=null;s&&(d=new ResizeObserver(g=>{let[v]=g;v&&v.target===c&&d&&(d.unobserve(t),cancelAnimationFrame(p),p=requestAnimationFrame(()=>{var k;(k=d)==null||k.observe(t)})),n()}),c&&!l&&d.observe(c),d.observe(t));let x,m=l?on(e):null;l&&y();function y(){const g=on(e);m&&!Sd(m,g)&&n(),m=g,x=requestAnimationFrame(y)}return n(),()=>{var g;u.forEach(v=>{o&&v.removeEventListener("scroll",n),i&&v.removeEventListener("resize",n)}),f?.(),(g=d)==null||g.disconnect(),d=null,l&&cancelAnimationFrame(x)}}const xC=BS,yC=US,vC=LS,bC=VS,wC=FS,Nl=MS,_C=ZS,kC=(e,t,n)=>{const r=new Map,o={platform:pC,...n},i={...o.platform,_c:r};return DS(e,t,{...o,platform:i})};var SC=typeof document<"u",CC=function(){},Fr=SC?_.useLayoutEffect:CC;function Xr(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e=="function"&&e.toString()===t.toString())return!0;let n,r,o;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;r--!==0;)if(!Xr(e[r],t[r]))return!1;return!0}if(o=Object.keys(e),n=o.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,o[r]))return!1;for(r=n;r--!==0;){const i=o[r];if(!(i==="_owner"&&e.$$typeof)&&!Xr(e[i],t[i]))return!1}return!0}return e!==e&&t!==t}function Cd(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function Al(e,t){const n=Cd(e);return Math.round(t*n)/n}function ri(e){const t=_.useRef(e);return Fr(()=>{t.current=e}),t}function EC(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:r=[],platform:o,elements:{reference:i,floating:s}={},transform:a=!0,whileElementsMounted:l,open:c}=e,[u,f]=_.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[p,d]=_.useState(r);Xr(p,r)||d(r);const[x,m]=_.useState(null),[y,g]=_.useState(null),v=_.useCallback(W=>{W!==E.current&&(E.current=W,m(W))},[]),k=_.useCallback(W=>{W!==N.current&&(N.current=W,g(W))},[]),S=i||x,C=s||y,E=_.useRef(null),N=_.useRef(null),A=_.useRef(u),O=l!=null,D=ri(l),U=ri(o),T=ri(c),M=_.useCallback(()=>{if(!E.current||!N.current)return;const W={placement:t,strategy:n,middleware:p};U.current&&(W.platform=U.current),kC(E.current,N.current,W).then(q=>{const I={...q,isPositioned:T.current!==!1};b.current&&!Xr(A.current,I)&&(A.current=I,cr.flushSync(()=>{f(I)}))})},[p,t,n,U,T]);Fr(()=>{c===!1&&A.current.isPositioned&&(A.current.isPositioned=!1,f(W=>({...W,isPositioned:!1})))},[c]);const b=_.useRef(!1);Fr(()=>(b.current=!0,()=>{b.current=!1}),[]),Fr(()=>{if(S&&(E.current=S),C&&(N.current=C),S&&C){if(D.current)return D.current(S,C,M);M()}},[S,C,M,D,O]);const R=_.useMemo(()=>({reference:E,floating:N,setReference:v,setFloating:k}),[v,k]),K=_.useMemo(()=>({reference:S,floating:C}),[S,C]),V=_.useMemo(()=>{const W={position:n,left:0,top:0};if(!K.floating)return W;const q=Al(K.floating,u.x),I=Al(K.floating,u.y);return a?{...W,transform:"translate("+q+"px, "+I+"px)",...Cd(K.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:q,top:I}},[n,a,K.floating,u.x,u.y]);return _.useMemo(()=>({...u,update:M,refs:R,elements:K,floatingStyles:V}),[u,M,R,K,V])}const TC=e=>{function t(n){return{}.hasOwnProperty.call(n,"current")}return{name:"arrow",options:e,fn(n){const{element:r,padding:o}=typeof e=="function"?e(n):e;return r&&t(r)?r.current!=null?Nl({element:r.current,padding:o}).fn(n):{}:r?Nl({element:r,padding:o}).fn(n):{}}}},NC=(e,t)=>({...xC(e),options:[e,t]}),AC=(e,t)=>({...yC(e),options:[e,t]}),zC=(e,t)=>({..._C(e),options:[e,t]}),IC=(e,t)=>({...vC(e),options:[e,t]}),jC=(e,t)=>({...bC(e),options:[e,t]}),PC=(e,t)=>({...wC(e),options:[e,t]}),OC=(e,t)=>({...TC(e),options:[e,t]});var RC="Arrow",Ed=_.forwardRef((e,t)=>{const{children:n,width:r=10,height:o=5,...i}=e;return h.jsx(ke.svg,{...i,ref:t,width:r,height:o,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?n:h.jsx("polygon",{points:"0,0 30,0 15,10"})})});Ed.displayName=RC;var DC=Ed,ks="Popper",[Td,_o]=Ft(ks),[MC,Nd]=Td(ks),Ad=e=>{const{__scopePopper:t,children:n}=e,[r,o]=_.useState(null);return h.jsx(MC,{scope:t,anchor:r,onAnchorChange:o,children:n})};Ad.displayName=ks;var zd="PopperAnchor",Id=_.forwardRef((e,t)=>{const{__scopePopper:n,virtualRef:r,...o}=e,i=Nd(zd,n),s=_.useRef(null),a=Pe(t,s),l=_.useRef(null);return _.useEffect(()=>{const c=l.current;l.current=r?.current||s.current,c!==l.current&&i.onAnchorChange(l.current)}),r?null:h.jsx(ke.div,{...o,ref:a})});Id.displayName=zd;var Ss="PopperContent",[LC,FC]=Td(Ss),jd=_.forwardRef((e,t)=>{const{__scopePopper:n,side:r="bottom",sideOffset:o=0,align:i="center",alignOffset:s=0,arrowPadding:a=0,avoidCollisions:l=!0,collisionBoundary:c=[],collisionPadding:u=0,sticky:f="partial",hideWhenDetached:p=!1,updatePositionStrategy:d="optimized",onPlaced:x,...m}=e,y=Nd(Ss,n),[g,v]=_.useState(null),k=Pe(t,oe=>v(oe)),[S,C]=_.useState(null),E=kS(S),N=E?.width??0,A=E?.height??0,O=r+(i!=="center"?"-"+i:""),D=typeof u=="number"?u:{top:0,right:0,bottom:0,left:0,...u},U=Array.isArray(c)?c:[c],T=U.length>0,M={padding:D,boundary:U.filter(BC),altBoundary:T},{refs:b,floatingStyles:R,placement:K,isPositioned:V,middlewareData:W}=EC({strategy:"fixed",placement:O,whileElementsMounted:(...oe)=>gC(...oe,{animationFrame:d==="always"}),elements:{reference:y.anchor},middleware:[NC({mainAxis:o+A,alignmentAxis:s}),l&&AC({mainAxis:!0,crossAxis:!1,limiter:f==="partial"?zC():void 0,...M}),l&&IC({...M}),jC({...M,apply:({elements:oe,rects:le,availableWidth:he,availableHeight:me})=>{const{width:ge,height:Ee}=le.reference,Oe=oe.floating.style;Oe.setProperty("--radix-popper-available-width",`${he}px`),Oe.setProperty("--radix-popper-available-height",`${me}px`),Oe.setProperty("--radix-popper-anchor-width",`${ge}px`),Oe.setProperty("--radix-popper-anchor-height",`${Ee}px`)}}),S&&OC({element:S,padding:a}),UC({arrowWidth:N,arrowHeight:A}),p&&PC({strategy:"referenceHidden",...M})]}),[q,I]=Rd(K),B=Qe(x);qe(()=>{V&&B?.()},[V,B]);const $=W.arrow?.x,z=W.arrow?.y,Q=W.arrow?.centerOffset!==0,[te,xe]=_.useState();return qe(()=>{g&&xe(window.getComputedStyle(g).zIndex)},[g]),h.jsx("div",{ref:b.setFloating,"data-radix-popper-content-wrapper":"",style:{...R,transform:V?R.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:te,"--radix-popper-transform-origin":[W.transformOrigin?.x,W.transformOrigin?.y].join(" "),...W.hide?.referenceHidden&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:h.jsx(LC,{scope:n,placedSide:q,onArrowChange:C,arrowX:$,arrowY:z,shouldHideArrow:Q,children:h.jsx(ke.div,{"data-side":q,"data-align":I,...m,ref:k,style:{...m.style,animation:V?void 0:"none"}})})})});jd.displayName=Ss;var Pd="PopperArrow",$C={top:"bottom",right:"left",bottom:"top",left:"right"},Od=_.forwardRef(function(t,n){const{__scopePopper:r,...o}=t,i=FC(Pd,r),s=$C[i.placedSide];return h.jsx("span",{ref:i.onArrowChange,style:{position:"absolute",left:i.arrowX,top:i.arrowY,[s]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[i.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[i.placedSide],visibility:i.shouldHideArrow?"hidden":void 0},children:h.jsx(DC,{...o,ref:n,style:{...o.style,display:"block"}})})});Od.displayName=Pd;function BC(e){return e!==null}var UC=e=>({name:"transformOrigin",options:e,fn(t){const{placement:n,rects:r,middlewareData:o}=t,s=o.arrow?.centerOffset!==0,a=s?0:e.arrowWidth,l=s?0:e.arrowHeight,[c,u]=Rd(n),f={start:"0%",center:"50%",end:"100%"}[u],p=(o.arrow?.x??0)+a/2,d=(o.arrow?.y??0)+l/2;let x="",m="";return c==="bottom"?(x=s?f:`${p}px`,m=`${-l}px`):c==="top"?(x=s?f:`${p}px`,m=`${r.floating.height+l}px`):c==="right"?(x=`${-l}px`,m=s?f:`${d}px`):c==="left"&&(x=`${r.floating.width+l}px`,m=s?f:`${d}px`),{data:{x,y:m}}}});function Rd(e){const[t,n="center"]=e.split("-");return[t,n]}var Dd=Ad,Md=Id,Ld=jd,Fd=Od,oi="rovingFocusGroup.onEntryFocus",ZC={bubbles:!1,cancelable:!0},mr="RovingFocusGroup",[Ti,$d,VC]=Du(mr),[WC,Bd]=Ft(mr,[VC]),[HC,qC]=WC(mr),Ud=_.forwardRef((e,t)=>h.jsx(Ti.Provider,{scope:e.__scopeRovingFocusGroup,children:h.jsx(Ti.Slot,{scope:e.__scopeRovingFocusGroup,children:h.jsx(KC,{...e,ref:t})})}));Ud.displayName=mr;var KC=_.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,orientation:r,loop:o=!1,dir:i,currentTabStopId:s,defaultCurrentTabStopId:a,onCurrentTabStopIdChange:l,onEntryFocus:c,preventScrollOnEntryFocus:u=!1,...f}=e,p=_.useRef(null),d=Pe(t,p),x=ho(i),[m,y]=nn({prop:s,defaultProp:a??null,onChange:l,caller:mr}),[g,v]=_.useState(!1),k=Qe(c),S=$d(n),C=_.useRef(!1),[E,N]=_.useState(0);return _.useEffect(()=>{const A=p.current;if(A)return A.addEventListener(oi,k),()=>A.removeEventListener(oi,k)},[k]),h.jsx(HC,{scope:n,orientation:r,dir:x,loop:o,currentTabStopId:m,onItemFocus:_.useCallback(A=>y(A),[y]),onItemShiftTab:_.useCallback(()=>v(!0),[]),onFocusableItemAdd:_.useCallback(()=>N(A=>A+1),[]),onFocusableItemRemove:_.useCallback(()=>N(A=>A-1),[]),children:h.jsx(ke.div,{tabIndex:g||E===0?-1:0,"data-orientation":r,...f,ref:d,style:{outline:"none",...e.style},onMouseDown:be(e.onMouseDown,()=>{C.current=!0}),onFocus:be(e.onFocus,A=>{const O=!C.current;if(A.target===A.currentTarget&&O&&!g){const D=new CustomEvent(oi,ZC);if(A.currentTarget.dispatchEvent(D),!D.defaultPrevented){const U=S().filter(K=>K.focusable),T=U.find(K=>K.active),M=U.find(K=>K.id===m),R=[T,M,...U].filter(Boolean).map(K=>K.ref.current);Wd(R,u)}}C.current=!1}),onBlur:be(e.onBlur,()=>v(!1))})})}),Zd="RovingFocusGroupItem",Vd=_.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,focusable:r=!0,active:o=!1,tabStopId:i,children:s,...a}=e,l=Et(),c=i||l,u=qC(Zd,n),f=u.currentTabStopId===c,p=$d(n),{onFocusableItemAdd:d,onFocusableItemRemove:x,currentTabStopId:m}=u;return _.useEffect(()=>{if(r)return d(),()=>x()},[r,d,x]),h.jsx(Ti.ItemSlot,{scope:n,id:c,focusable:r,active:o,children:h.jsx(ke.span,{tabIndex:f?0:-1,"data-orientation":u.orientation,...a,ref:t,onMouseDown:be(e.onMouseDown,y=>{r?u.onItemFocus(c):y.preventDefault()}),onFocus:be(e.onFocus,()=>u.onItemFocus(c)),onKeyDown:be(e.onKeyDown,y=>{if(y.key==="Tab"&&y.shiftKey){u.onItemShiftTab();return}if(y.target!==y.currentTarget)return;const g=JC(y,u.orientation,u.dir);if(g!==void 0){if(y.metaKey||y.ctrlKey||y.altKey||y.shiftKey)return;y.preventDefault();let k=p().filter(S=>S.focusable).map(S=>S.ref.current);if(g==="last")k.reverse();else if(g==="prev"||g==="next"){g==="prev"&&k.reverse();const S=k.indexOf(y.currentTarget);k=u.loop?XC(k,S+1):k.slice(S+1)}setTimeout(()=>Wd(k))}}),children:typeof s=="function"?s({isCurrentTabStop:f,hasTabStop:m!=null}):s})})});Vd.displayName=Zd;var GC={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function YC(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function JC(e,t,n){const r=YC(e.key,n);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(r))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(r)))return GC[r]}function Wd(e,t=!1){const n=document.activeElement;for(const r of e)if(r===n||(r.focus({preventScroll:t}),document.activeElement!==n))return}function XC(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var QC=Ud,eE=Vd;function Ni(e,[t,n]){return Math.min(n,Math.max(t,e))}function tE(e,t){return _.useReducer((n,r)=>t[n][r]??n,e)}var Cs="ScrollArea",[Hd]=Ft(Cs),[nE,pt]=Hd(Cs),qd=_.forwardRef((e,t)=>{const{__scopeScrollArea:n,type:r="hover",dir:o,scrollHideDelay:i=600,...s}=e,[a,l]=_.useState(null),[c,u]=_.useState(null),[f,p]=_.useState(null),[d,x]=_.useState(null),[m,y]=_.useState(null),[g,v]=_.useState(0),[k,S]=_.useState(0),[C,E]=_.useState(!1),[N,A]=_.useState(!1),O=Pe(t,U=>l(U)),D=ho(o);return h.jsx(nE,{scope:n,type:r,dir:D,scrollHideDelay:i,scrollArea:a,viewport:c,onViewportChange:u,content:f,onContentChange:p,scrollbarX:d,onScrollbarXChange:x,scrollbarXEnabled:C,onScrollbarXEnabledChange:E,scrollbarY:m,onScrollbarYChange:y,scrollbarYEnabled:N,onScrollbarYEnabledChange:A,onCornerWidthChange:v,onCornerHeightChange:S,children:h.jsx(ke.div,{dir:D,...s,ref:O,style:{position:"relative","--radix-scroll-area-corner-width":g+"px","--radix-scroll-area-corner-height":k+"px",...e.style}})})});qd.displayName=Cs;var Kd="ScrollAreaViewport",Gd=_.forwardRef((e,t)=>{const{__scopeScrollArea:n,children:r,nonce:o,...i}=e,s=pt(Kd,n),a=_.useRef(null),l=Pe(t,a,s.onViewportChange);return h.jsxs(h.Fragment,{children:[h.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-scroll-area-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-scroll-area-viewport]::-webkit-scrollbar{display:none}"},nonce:o}),h.jsx(ke.div,{"data-radix-scroll-area-viewport":"",...i,ref:l,style:{overflowX:s.scrollbarXEnabled?"scroll":"hidden",overflowY:s.scrollbarYEnabled?"scroll":"hidden",...e.style},children:h.jsx("div",{ref:s.onContentChange,style:{minWidth:"100%",display:"table"},children:r})})]})});Gd.displayName=Kd;var Pt="ScrollAreaScrollbar",Yd=_.forwardRef((e,t)=>{const{forceMount:n,...r}=e,o=pt(Pt,e.__scopeScrollArea),{onScrollbarXEnabledChange:i,onScrollbarYEnabledChange:s}=o,a=e.orientation==="horizontal";return _.useEffect(()=>(a?i(!0):s(!0),()=>{a?i(!1):s(!1)}),[a,i,s]),o.type==="hover"?h.jsx(rE,{...r,ref:t,forceMount:n}):o.type==="scroll"?h.jsx(oE,{...r,ref:t,forceMount:n}):o.type==="auto"?h.jsx(Jd,{...r,ref:t,forceMount:n}):o.type==="always"?h.jsx(Es,{...r,ref:t}):null});Yd.displayName=Pt;var rE=_.forwardRef((e,t)=>{const{forceMount:n,...r}=e,o=pt(Pt,e.__scopeScrollArea),[i,s]=_.useState(!1);return _.useEffect(()=>{const a=o.scrollArea;let l=0;if(a){const c=()=>{window.clearTimeout(l),s(!0)},u=()=>{l=window.setTimeout(()=>s(!1),o.scrollHideDelay)};return a.addEventListener("pointerenter",c),a.addEventListener("pointerleave",u),()=>{window.clearTimeout(l),a.removeEventListener("pointerenter",c),a.removeEventListener("pointerleave",u)}}},[o.scrollArea,o.scrollHideDelay]),h.jsx(ht,{present:n||i,children:h.jsx(Jd,{"data-state":i?"visible":"hidden",...r,ref:t})})}),oE=_.forwardRef((e,t)=>{const{forceMount:n,...r}=e,o=pt(Pt,e.__scopeScrollArea),i=e.orientation==="horizontal",s=So(()=>l("SCROLL_END"),100),[a,l]=tE("hidden",{hidden:{SCROLL:"scrolling"},scrolling:{SCROLL_END:"idle",POINTER_ENTER:"interacting"},interacting:{SCROLL:"interacting",POINTER_LEAVE:"idle"},idle:{HIDE:"hidden",SCROLL:"scrolling",POINTER_ENTER:"interacting"}});return _.useEffect(()=>{if(a==="idle"){const c=window.setTimeout(()=>l("HIDE"),o.scrollHideDelay);return()=>window.clearTimeout(c)}},[a,o.scrollHideDelay,l]),_.useEffect(()=>{const c=o.viewport,u=i?"scrollLeft":"scrollTop";if(c){let f=c[u];const p=()=>{const d=c[u];f!==d&&(l("SCROLL"),s()),f=d};return c.addEventListener("scroll",p),()=>c.removeEventListener("scroll",p)}},[o.viewport,i,l,s]),h.jsx(ht,{present:n||a!=="hidden",children:h.jsx(Es,{"data-state":a==="hidden"?"hidden":"visible",...r,ref:t,onPointerEnter:be(e.onPointerEnter,()=>l("POINTER_ENTER")),onPointerLeave:be(e.onPointerLeave,()=>l("POINTER_LEAVE"))})})}),Jd=_.forwardRef((e,t)=>{const n=pt(Pt,e.__scopeScrollArea),{forceMount:r,...o}=e,[i,s]=_.useState(!1),a=e.orientation==="horizontal",l=So(()=>{if(n.viewport){const c=n.viewport.offsetWidth<n.viewport.scrollWidth,u=n.viewport.offsetHeight<n.viewport.scrollHeight;s(a?c:u)}},10);return On(n.viewport,l),On(n.content,l),h.jsx(ht,{present:r||i,children:h.jsx(Es,{"data-state":i?"visible":"hidden",...o,ref:t})})}),Es=_.forwardRef((e,t)=>{const{orientation:n="vertical",...r}=e,o=pt(Pt,e.__scopeScrollArea),i=_.useRef(null),s=_.useRef(0),[a,l]=_.useState({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),c=nf(a.viewport,a.content),u={...r,sizes:a,onSizesChange:l,hasThumb:c>0&&c<1,onThumbChange:p=>i.current=p,onThumbPointerUp:()=>s.current=0,onThumbPointerDown:p=>s.current=p};function f(p,d){return uE(p,s.current,a,d)}return n==="horizontal"?h.jsx(iE,{...u,ref:t,onThumbPositionChange:()=>{if(o.viewport&&i.current){const p=o.viewport.scrollLeft,d=zl(p,a,o.dir);i.current.style.transform=`translate3d(${d}px, 0, 0)`}},onWheelScroll:p=>{o.viewport&&(o.viewport.scrollLeft=p)},onDragScroll:p=>{o.viewport&&(o.viewport.scrollLeft=f(p,o.dir))}}):n==="vertical"?h.jsx(sE,{...u,ref:t,onThumbPositionChange:()=>{if(o.viewport&&i.current){const p=o.viewport.scrollTop,d=zl(p,a);i.current.style.transform=`translate3d(0, ${d}px, 0)`}},onWheelScroll:p=>{o.viewport&&(o.viewport.scrollTop=p)},onDragScroll:p=>{o.viewport&&(o.viewport.scrollTop=f(p))}}):null}),iE=_.forwardRef((e,t)=>{const{sizes:n,onSizesChange:r,...o}=e,i=pt(Pt,e.__scopeScrollArea),[s,a]=_.useState(),l=_.useRef(null),c=Pe(t,l,i.onScrollbarXChange);return _.useEffect(()=>{l.current&&a(getComputedStyle(l.current))},[l]),h.jsx(Qd,{"data-orientation":"horizontal",...o,ref:c,sizes:n,style:{bottom:0,left:i.dir==="rtl"?"var(--radix-scroll-area-corner-width)":0,right:i.dir==="ltr"?"var(--radix-scroll-area-corner-width)":0,"--radix-scroll-area-thumb-width":ko(n)+"px",...e.style},onThumbPointerDown:u=>e.onThumbPointerDown(u.x),onDragScroll:u=>e.onDragScroll(u.x),onWheelScroll:(u,f)=>{if(i.viewport){const p=i.viewport.scrollLeft+u.deltaX;e.onWheelScroll(p),of(p,f)&&u.preventDefault()}},onResize:()=>{l.current&&i.viewport&&s&&r({content:i.viewport.scrollWidth,viewport:i.viewport.offsetWidth,scrollbar:{size:l.current.clientWidth,paddingStart:eo(s.paddingLeft),paddingEnd:eo(s.paddingRight)}})}})}),sE=_.forwardRef((e,t)=>{const{sizes:n,onSizesChange:r,...o}=e,i=pt(Pt,e.__scopeScrollArea),[s,a]=_.useState(),l=_.useRef(null),c=Pe(t,l,i.onScrollbarYChange);return _.useEffect(()=>{l.current&&a(getComputedStyle(l.current))},[l]),h.jsx(Qd,{"data-orientation":"vertical",...o,ref:c,sizes:n,style:{top:0,right:i.dir==="ltr"?0:void 0,left:i.dir==="rtl"?0:void 0,bottom:"var(--radix-scroll-area-corner-height)","--radix-scroll-area-thumb-height":ko(n)+"px",...e.style},onThumbPointerDown:u=>e.onThumbPointerDown(u.y),onDragScroll:u=>e.onDragScroll(u.y),onWheelScroll:(u,f)=>{if(i.viewport){const p=i.viewport.scrollTop+u.deltaY;e.onWheelScroll(p),of(p,f)&&u.preventDefault()}},onResize:()=>{l.current&&i.viewport&&s&&r({content:i.viewport.scrollHeight,viewport:i.viewport.offsetHeight,scrollbar:{size:l.current.clientHeight,paddingStart:eo(s.paddingTop),paddingEnd:eo(s.paddingBottom)}})}})}),[aE,Xd]=Hd(Pt),Qd=_.forwardRef((e,t)=>{const{__scopeScrollArea:n,sizes:r,hasThumb:o,onThumbChange:i,onThumbPointerUp:s,onThumbPointerDown:a,onThumbPositionChange:l,onDragScroll:c,onWheelScroll:u,onResize:f,...p}=e,d=pt(Pt,n),[x,m]=_.useState(null),y=Pe(t,O=>m(O)),g=_.useRef(null),v=_.useRef(""),k=d.viewport,S=r.content-r.viewport,C=Qe(u),E=Qe(l),N=So(f,10);function A(O){if(g.current){const D=O.clientX-g.current.left,U=O.clientY-g.current.top;c({x:D,y:U})}}return _.useEffect(()=>{const O=D=>{const U=D.target;x?.contains(U)&&C(D,S)};return document.addEventListener("wheel",O,{passive:!1}),()=>document.removeEventListener("wheel",O,{passive:!1})},[k,x,S,C]),_.useEffect(E,[r,E]),On(x,N),On(d.content,N),h.jsx(aE,{scope:n,scrollbar:x,hasThumb:o,onThumbChange:Qe(i),onThumbPointerUp:Qe(s),onThumbPositionChange:E,onThumbPointerDown:Qe(a),children:h.jsx(ke.div,{...p,ref:y,style:{position:"absolute",...p.style},onPointerDown:be(e.onPointerDown,O=>{O.button===0&&(O.target.setPointerCapture(O.pointerId),g.current=x.getBoundingClientRect(),v.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect="none",d.viewport&&(d.viewport.style.scrollBehavior="auto"),A(O))}),onPointerMove:be(e.onPointerMove,A),onPointerUp:be(e.onPointerUp,O=>{const D=O.target;D.hasPointerCapture(O.pointerId)&&D.releasePointerCapture(O.pointerId),document.body.style.webkitUserSelect=v.current,d.viewport&&(d.viewport.style.scrollBehavior=""),g.current=null})})})}),Qr="ScrollAreaThumb",ef=_.forwardRef((e,t)=>{const{forceMount:n,...r}=e,o=Xd(Qr,e.__scopeScrollArea);return h.jsx(ht,{present:n||o.hasThumb,children:h.jsx(lE,{ref:t,...r})})}),lE=_.forwardRef((e,t)=>{const{__scopeScrollArea:n,style:r,...o}=e,i=pt(Qr,n),s=Xd(Qr,n),{onThumbPositionChange:a}=s,l=Pe(t,f=>s.onThumbChange(f)),c=_.useRef(void 0),u=So(()=>{c.current&&(c.current(),c.current=void 0)},100);return _.useEffect(()=>{const f=i.viewport;if(f){const p=()=>{if(u(),!c.current){const d=dE(f,a);c.current=d,a()}};return a(),f.addEventListener("scroll",p),()=>f.removeEventListener("scroll",p)}},[i.viewport,u,a]),h.jsx(ke.div,{"data-state":s.hasThumb?"visible":"hidden",...o,ref:l,style:{width:"var(--radix-scroll-area-thumb-width)",height:"var(--radix-scroll-area-thumb-height)",...r},onPointerDownCapture:be(e.onPointerDownCapture,f=>{const d=f.target.getBoundingClientRect(),x=f.clientX-d.left,m=f.clientY-d.top;s.onThumbPointerDown({x,y:m})}),onPointerUp:be(e.onPointerUp,s.onThumbPointerUp)})});ef.displayName=Qr;var Ts="ScrollAreaCorner",tf=_.forwardRef((e,t)=>{const n=pt(Ts,e.__scopeScrollArea),r=!!(n.scrollbarX&&n.scrollbarY);return n.type!=="scroll"&&r?h.jsx(cE,{...e,ref:t}):null});tf.displayName=Ts;var cE=_.forwardRef((e,t)=>{const{__scopeScrollArea:n,...r}=e,o=pt(Ts,n),[i,s]=_.useState(0),[a,l]=_.useState(0),c=!!(i&&a);return On(o.scrollbarX,()=>{const u=o.scrollbarX?.offsetHeight||0;o.onCornerHeightChange(u),l(u)}),On(o.scrollbarY,()=>{const u=o.scrollbarY?.offsetWidth||0;o.onCornerWidthChange(u),s(u)}),c?h.jsx(ke.div,{...r,ref:t,style:{width:i,height:a,position:"absolute",right:o.dir==="ltr"?0:void 0,left:o.dir==="rtl"?0:void 0,bottom:0,...e.style}}):null});function eo(e){return e?parseInt(e,10):0}function nf(e,t){const n=e/t;return isNaN(n)?0:n}function ko(e){const t=nf(e.viewport,e.content),n=e.scrollbar.paddingStart+e.scrollbar.paddingEnd,r=(e.scrollbar.size-n)*t;return Math.max(r,18)}function uE(e,t,n,r="ltr"){const o=ko(n),i=o/2,s=t||i,a=o-s,l=n.scrollbar.paddingStart+s,c=n.scrollbar.size-n.scrollbar.paddingEnd-a,u=n.content-n.viewport,f=r==="ltr"?[0,u]:[u*-1,0];return rf([l,c],f)(e)}function zl(e,t,n="ltr"){const r=ko(t),o=t.scrollbar.paddingStart+t.scrollbar.paddingEnd,i=t.scrollbar.size-o,s=t.content-t.viewport,a=i-r,l=n==="ltr"?[0,s]:[s*-1,0],c=Ni(e,l);return rf([0,s],[0,a])(c)}function rf(e,t){return n=>{if(e[0]===e[1]||t[0]===t[1])return t[0];const r=(t[1]-t[0])/(e[1]-e[0]);return t[0]+r*(n-e[0])}}function of(e,t){return e>0&&e<t}var dE=(e,t=()=>{})=>{let n={left:e.scrollLeft,top:e.scrollTop},r=0;return(function o(){const i={left:e.scrollLeft,top:e.scrollTop},s=n.left!==i.left,a=n.top!==i.top;(s||a)&&t(),n=i,r=window.requestAnimationFrame(o)})(),()=>window.cancelAnimationFrame(r)};function So(e,t){const n=Qe(e),r=_.useRef(0);return _.useEffect(()=>()=>window.clearTimeout(r.current),[]),_.useCallback(()=>{window.clearTimeout(r.current),r.current=window.setTimeout(n,t)},[n,t])}function On(e,t){const n=Qe(t);qe(()=>{let r=0;if(e){const o=new ResizeObserver(()=>{cancelAnimationFrame(r),r=window.requestAnimationFrame(n)});return o.observe(e),()=>{window.cancelAnimationFrame(r),o.unobserve(e)}}},[e,n])}var fE=qd,hE=Gd,pE=tf,mE=[" ","Enter","ArrowUp","ArrowDown"],gE=[" ","Enter"],sn="Select",[Co,Eo,xE]=Du(sn),[Vn]=Ft(sn,[xE,_o]),To=_o(),[yE,Xt]=Vn(sn),[vE,bE]=Vn(sn),sf=e=>{const{__scopeSelect:t,children:n,open:r,defaultOpen:o,onOpenChange:i,value:s,defaultValue:a,onValueChange:l,dir:c,name:u,autoComplete:f,disabled:p,required:d,form:x}=e,m=To(t),[y,g]=_.useState(null),[v,k]=_.useState(null),[S,C]=_.useState(!1),E=ho(c),[N,A]=nn({prop:r,defaultProp:o??!1,onChange:i,caller:sn}),[O,D]=nn({prop:s,defaultProp:a,onChange:l,caller:sn}),U=_.useRef(null),T=y?x||!!y.closest("form"):!0,[M,b]=_.useState(new Set),R=Array.from(M).map(K=>K.props.value).join(";");return h.jsx(Dd,{...m,children:h.jsxs(yE,{required:d,scope:t,trigger:y,onTriggerChange:g,valueNode:v,onValueNodeChange:k,valueNodeHasChildren:S,onValueNodeHasChildrenChange:C,contentId:Et(),value:O,onValueChange:D,open:N,onOpenChange:A,dir:E,triggerPointerDownPosRef:U,disabled:p,children:[h.jsx(Co.Provider,{scope:t,children:h.jsx(vE,{scope:e.__scopeSelect,onNativeOptionAdd:_.useCallback(K=>{b(V=>new Set(V).add(K))},[]),onNativeOptionRemove:_.useCallback(K=>{b(V=>{const W=new Set(V);return W.delete(K),W})},[]),children:n})}),T?h.jsxs(Nf,{"aria-hidden":!0,required:d,tabIndex:-1,name:u,autoComplete:f,value:O,onChange:K=>D(K.target.value),disabled:p,form:x,children:[O===void 0?h.jsx("option",{value:""}):null,Array.from(M)]},R):null]})})};sf.displayName=sn;var af="SelectTrigger",lf=_.forwardRef((e,t)=>{const{__scopeSelect:n,disabled:r=!1,...o}=e,i=To(n),s=Xt(af,n),a=s.disabled||r,l=Pe(t,s.onTriggerChange),c=Eo(n),u=_.useRef("touch"),[f,p,d]=zf(m=>{const y=c().filter(k=>!k.disabled),g=y.find(k=>k.value===s.value),v=If(y,m,g);v!==void 0&&s.onValueChange(v.value)}),x=m=>{a||(s.onOpenChange(!0),d()),m&&(s.triggerPointerDownPosRef.current={x:Math.round(m.pageX),y:Math.round(m.pageY)})};return h.jsx(Md,{asChild:!0,...i,children:h.jsx(ke.button,{type:"button",role:"combobox","aria-controls":s.contentId,"aria-expanded":s.open,"aria-required":s.required,"aria-autocomplete":"none",dir:s.dir,"data-state":s.open?"open":"closed",disabled:a,"data-disabled":a?"":void 0,"data-placeholder":Af(s.value)?"":void 0,...o,ref:l,onClick:be(o.onClick,m=>{m.currentTarget.focus(),u.current!=="mouse"&&x(m)}),onPointerDown:be(o.onPointerDown,m=>{u.current=m.pointerType;const y=m.target;y.hasPointerCapture(m.pointerId)&&y.releasePointerCapture(m.pointerId),m.button===0&&m.ctrlKey===!1&&m.pointerType==="mouse"&&(x(m),m.preventDefault())}),onKeyDown:be(o.onKeyDown,m=>{const y=f.current!=="";!(m.ctrlKey||m.altKey||m.metaKey)&&m.key.length===1&&p(m.key),!(y&&m.key===" ")&&mE.includes(m.key)&&(x(),m.preventDefault())})})})});lf.displayName=af;var cf="SelectValue",uf=_.forwardRef((e,t)=>{const{__scopeSelect:n,className:r,style:o,children:i,placeholder:s="",...a}=e,l=Xt(cf,n),{onValueNodeHasChildrenChange:c}=l,u=i!==void 0,f=Pe(t,l.onValueNodeChange);return qe(()=>{c(u)},[c,u]),h.jsx(ke.span,{...a,ref:f,style:{pointerEvents:"none"},children:Af(l.value)?h.jsx(h.Fragment,{children:s}):i})});uf.displayName=cf;var wE="SelectIcon",df=_.forwardRef((e,t)=>{const{__scopeSelect:n,children:r,...o}=e;return h.jsx(ke.span,{"aria-hidden":!0,...o,ref:t,children:r||"▼"})});df.displayName=wE;var _E="SelectPortal",ff=e=>h.jsx(mo,{asChild:!0,...e});ff.displayName=_E;var an="SelectContent",hf=_.forwardRef((e,t)=>{const n=Xt(an,e.__scopeSelect),[r,o]=_.useState();if(qe(()=>{o(new DocumentFragment)},[]),!n.open){const i=r;return i?cr.createPortal(h.jsx(pf,{scope:e.__scopeSelect,children:h.jsx(Co.Slot,{scope:e.__scopeSelect,children:h.jsx("div",{children:e.children})})}),i):null}return h.jsx(mf,{...e,ref:t})});hf.displayName=an;var gt=10,[pf,Qt]=Vn(an),kE="SelectContentImpl",SE=jn("SelectContent.RemoveScroll"),mf=_.forwardRef((e,t)=>{const{__scopeSelect:n,position:r="item-aligned",onCloseAutoFocus:o,onEscapeKeyDown:i,onPointerDownOutside:s,side:a,sideOffset:l,align:c,alignOffset:u,arrowPadding:f,collisionBoundary:p,collisionPadding:d,sticky:x,hideWhenDetached:m,avoidCollisions:y,...g}=e,v=Xt(an,n),[k,S]=_.useState(null),[C,E]=_.useState(null),N=Pe(t,oe=>S(oe)),[A,O]=_.useState(null),[D,U]=_.useState(null),T=Eo(n),[M,b]=_.useState(!1),R=_.useRef(!1);_.useEffect(()=>{if(k)return Qu(k)},[k]),Vu();const K=_.useCallback(oe=>{const[le,...he]=T().map(Ee=>Ee.ref.current),[me]=he.slice(-1),ge=document.activeElement;for(const Ee of oe)if(Ee===ge||(Ee?.scrollIntoView({block:"nearest"}),Ee===le&&C&&(C.scrollTop=0),Ee===me&&C&&(C.scrollTop=C.scrollHeight),Ee?.focus(),document.activeElement!==ge))return},[T,C]),V=_.useCallback(()=>K([A,k]),[K,A,k]);_.useEffect(()=>{M&&V()},[M,V]);const{onOpenChange:W,triggerPointerDownPosRef:q}=v;_.useEffect(()=>{if(k){let oe={x:0,y:0};const le=me=>{oe={x:Math.abs(Math.round(me.pageX)-(q.current?.x??0)),y:Math.abs(Math.round(me.pageY)-(q.current?.y??0))}},he=me=>{oe.x<=10&&oe.y<=10?me.preventDefault():k.contains(me.target)||W(!1),document.removeEventListener("pointermove",le),q.current=null};return q.current!==null&&(document.addEventListener("pointermove",le),document.addEventListener("pointerup",he,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",le),document.removeEventListener("pointerup",he,{capture:!0})}}},[k,W,q]),_.useEffect(()=>{const oe=()=>W(!1);return window.addEventListener("blur",oe),window.addEventListener("resize",oe),()=>{window.removeEventListener("blur",oe),window.removeEventListener("resize",oe)}},[W]);const[I,B]=zf(oe=>{const le=T().filter(ge=>!ge.disabled),he=le.find(ge=>ge.ref.current===document.activeElement),me=If(le,oe,he);me&&setTimeout(()=>me.ref.current.focus())}),$=_.useCallback((oe,le,he)=>{const me=!R.current&&!he;(v.value!==void 0&&v.value===le||me)&&(O(oe),me&&(R.current=!0))},[v.value]),z=_.useCallback(()=>k?.focus(),[k]),Q=_.useCallback((oe,le,he)=>{const me=!R.current&&!he;(v.value!==void 0&&v.value===le||me)&&U(oe)},[v.value]),te=r==="popper"?Ai:gf,xe=te===Ai?{side:a,sideOffset:l,align:c,alignOffset:u,arrowPadding:f,collisionBoundary:p,collisionPadding:d,sticky:x,hideWhenDetached:m,avoidCollisions:y}:{};return h.jsx(pf,{scope:n,content:k,viewport:C,onViewportChange:E,itemRefCallback:$,selectedItem:A,onItemLeave:z,itemTextRefCallback:Q,focusSelectedItem:V,selectedItemText:D,position:r,isPositioned:M,searchRef:I,children:h.jsx(hs,{as:SE,allowPinchZoom:!0,children:h.jsx(fs,{asChild:!0,trapped:v.open,onMountAutoFocus:oe=>{oe.preventDefault()},onUnmountAutoFocus:be(o,oe=>{v.trigger?.focus({preventScroll:!0}),oe.preventDefault()}),children:h.jsx(po,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:i,onPointerDownOutside:s,onFocusOutside:oe=>oe.preventDefault(),onDismiss:()=>v.onOpenChange(!1),children:h.jsx(te,{role:"listbox",id:v.contentId,"data-state":v.open?"open":"closed",dir:v.dir,onContextMenu:oe=>oe.preventDefault(),...g,...xe,onPlaced:()=>b(!0),ref:N,style:{display:"flex",flexDirection:"column",outline:"none",...g.style},onKeyDown:be(g.onKeyDown,oe=>{const le=oe.ctrlKey||oe.altKey||oe.metaKey;if(oe.key==="Tab"&&oe.preventDefault(),!le&&oe.key.length===1&&B(oe.key),["ArrowUp","ArrowDown","Home","End"].includes(oe.key)){let me=T().filter(ge=>!ge.disabled).map(ge=>ge.ref.current);if(["ArrowUp","End"].includes(oe.key)&&(me=me.slice().reverse()),["ArrowUp","ArrowDown"].includes(oe.key)){const ge=oe.target,Ee=me.indexOf(ge);me=me.slice(Ee+1)}setTimeout(()=>K(me)),oe.preventDefault()}})})})})})})});mf.displayName=kE;var CE="SelectItemAlignedPosition",gf=_.forwardRef((e,t)=>{const{__scopeSelect:n,onPlaced:r,...o}=e,i=Xt(an,n),s=Qt(an,n),[a,l]=_.useState(null),[c,u]=_.useState(null),f=Pe(t,N=>u(N)),p=Eo(n),d=_.useRef(!1),x=_.useRef(!0),{viewport:m,selectedItem:y,selectedItemText:g,focusSelectedItem:v}=s,k=_.useCallback(()=>{if(i.trigger&&i.valueNode&&a&&c&&m&&y&&g){const N=i.trigger.getBoundingClientRect(),A=c.getBoundingClientRect(),O=i.valueNode.getBoundingClientRect(),D=g.getBoundingClientRect();if(i.dir!=="rtl"){const ge=D.left-A.left,Ee=O.left-ge,Oe=N.left-Ee,w=N.width+Oe,Y=Math.max(w,A.width),H=window.innerWidth-gt,P=Ni(Ee,[gt,Math.max(gt,H-Y)]);a.style.minWidth=w+"px",a.style.left=P+"px"}else{const ge=A.right-D.right,Ee=window.innerWidth-O.right-ge,Oe=window.innerWidth-N.right-Ee,w=N.width+Oe,Y=Math.max(w,A.width),H=window.innerWidth-gt,P=Ni(Ee,[gt,Math.max(gt,H-Y)]);a.style.minWidth=w+"px",a.style.right=P+"px"}const U=p(),T=window.innerHeight-gt*2,M=m.scrollHeight,b=window.getComputedStyle(c),R=parseInt(b.borderTopWidth,10),K=parseInt(b.paddingTop,10),V=parseInt(b.borderBottomWidth,10),W=parseInt(b.paddingBottom,10),q=R+K+M+W+V,I=Math.min(y.offsetHeight*5,q),B=window.getComputedStyle(m),$=parseInt(B.paddingTop,10),z=parseInt(B.paddingBottom,10),Q=N.top+N.height/2-gt,te=T-Q,xe=y.offsetHeight/2,oe=y.offsetTop+xe,le=R+K+oe,he=q-le;if(le<=Q){const ge=U.length>0&&y===U[U.length-1].ref.current;a.style.bottom="0px";const Ee=c.clientHeight-m.offsetTop-m.offsetHeight,Oe=Math.max(te,xe+(ge?z:0)+Ee+V),w=le+Oe;a.style.height=w+"px"}else{const ge=U.length>0&&y===U[0].ref.current;a.style.top="0px";const Oe=Math.max(Q,R+m.offsetTop+(ge?$:0)+xe)+he;a.style.height=Oe+"px",m.scrollTop=le-Q+m.offsetTop}a.style.margin=`${gt}px 0`,a.style.minHeight=I+"px",a.style.maxHeight=T+"px",r?.(),requestAnimationFrame(()=>d.current=!0)}},[p,i.trigger,i.valueNode,a,c,m,y,g,i.dir,r]);qe(()=>k(),[k]);const[S,C]=_.useState();qe(()=>{c&&C(window.getComputedStyle(c).zIndex)},[c]);const E=_.useCallback(N=>{N&&x.current===!0&&(k(),v?.(),x.current=!1)},[k,v]);return h.jsx(TE,{scope:n,contentWrapper:a,shouldExpandOnScrollRef:d,onScrollButtonChange:E,children:h.jsx("div",{ref:l,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:S},children:h.jsx(ke.div,{...o,ref:f,style:{boxSizing:"border-box",maxHeight:"100%",...o.style}})})})});gf.displayName=CE;var EE="SelectPopperPosition",Ai=_.forwardRef((e,t)=>{const{__scopeSelect:n,align:r="start",collisionPadding:o=gt,...i}=e,s=To(n);return h.jsx(Ld,{...s,...i,ref:t,align:r,collisionPadding:o,style:{boxSizing:"border-box",...i.style,"--radix-select-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-select-content-available-width":"var(--radix-popper-available-width)","--radix-select-content-available-height":"var(--radix-popper-available-height)","--radix-select-trigger-width":"var(--radix-popper-anchor-width)","--radix-select-trigger-height":"var(--radix-popper-anchor-height)"}})});Ai.displayName=EE;var[TE,Ns]=Vn(an,{}),zi="SelectViewport",xf=_.forwardRef((e,t)=>{const{__scopeSelect:n,nonce:r,...o}=e,i=Qt(zi,n),s=Ns(zi,n),a=Pe(t,i.onViewportChange),l=_.useRef(0);return h.jsxs(h.Fragment,{children:[h.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}"},nonce:r}),h.jsx(Co.Slot,{scope:n,children:h.jsx(ke.div,{"data-radix-select-viewport":"",role:"presentation",...o,ref:a,style:{position:"relative",flex:1,overflow:"hidden auto",...o.style},onScroll:be(o.onScroll,c=>{const u=c.currentTarget,{contentWrapper:f,shouldExpandOnScrollRef:p}=s;if(p?.current&&f){const d=Math.abs(l.current-u.scrollTop);if(d>0){const x=window.innerHeight-gt*2,m=parseFloat(f.style.minHeight),y=parseFloat(f.style.height),g=Math.max(m,y);if(g<x){const v=g+d,k=Math.min(x,v),S=v-k;f.style.height=k+"px",f.style.bottom==="0px"&&(u.scrollTop=S>0?S:0,f.style.justifyContent="flex-end")}}}l.current=u.scrollTop})})})]})});xf.displayName=zi;var yf="SelectGroup",[NE,AE]=Vn(yf),zE=_.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,o=Et();return h.jsx(NE,{scope:n,id:o,children:h.jsx(ke.div,{role:"group","aria-labelledby":o,...r,ref:t})})});zE.displayName=yf;var vf="SelectLabel",IE=_.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,o=AE(vf,n);return h.jsx(ke.div,{id:o.id,...r,ref:t})});IE.displayName=vf;var to="SelectItem",[jE,bf]=Vn(to),wf=_.forwardRef((e,t)=>{const{__scopeSelect:n,value:r,disabled:o=!1,textValue:i,...s}=e,a=Xt(to,n),l=Qt(to,n),c=a.value===r,[u,f]=_.useState(i??""),[p,d]=_.useState(!1),x=Pe(t,v=>l.itemRefCallback?.(v,r,o)),m=Et(),y=_.useRef("touch"),g=()=>{o||(a.onValueChange(r),a.onOpenChange(!1))};if(r==="")throw new Error("A <Select.Item /> must have a value prop that is not an empty string. This is because the Select value can be set to an empty string to clear the selection and show the placeholder.");return h.jsx(jE,{scope:n,value:r,disabled:o,textId:m,isSelected:c,onItemTextChange:_.useCallback(v=>{f(k=>k||(v?.textContent??"").trim())},[]),children:h.jsx(Co.ItemSlot,{scope:n,value:r,disabled:o,textValue:u,children:h.jsx(ke.div,{role:"option","aria-labelledby":m,"data-highlighted":p?"":void 0,"aria-selected":c&&p,"data-state":c?"checked":"unchecked","aria-disabled":o||void 0,"data-disabled":o?"":void 0,tabIndex:o?void 0:-1,...s,ref:x,onFocus:be(s.onFocus,()=>d(!0)),onBlur:be(s.onBlur,()=>d(!1)),onClick:be(s.onClick,()=>{y.current!=="mouse"&&g()}),onPointerUp:be(s.onPointerUp,()=>{y.current==="mouse"&&g()}),onPointerDown:be(s.onPointerDown,v=>{y.current=v.pointerType}),onPointerMove:be(s.onPointerMove,v=>{y.current=v.pointerType,o?l.onItemLeave?.():y.current==="mouse"&&v.currentTarget.focus({preventScroll:!0})}),onPointerLeave:be(s.onPointerLeave,v=>{v.currentTarget===document.activeElement&&l.onItemLeave?.()}),onKeyDown:be(s.onKeyDown,v=>{l.searchRef?.current!==""&&v.key===" "||(gE.includes(v.key)&&g(),v.key===" "&&v.preventDefault())})})})})});wf.displayName=to;var Qn="SelectItemText",_f=_.forwardRef((e,t)=>{const{__scopeSelect:n,className:r,style:o,...i}=e,s=Xt(Qn,n),a=Qt(Qn,n),l=bf(Qn,n),c=bE(Qn,n),[u,f]=_.useState(null),p=Pe(t,g=>f(g),l.onItemTextChange,g=>a.itemTextRefCallback?.(g,l.value,l.disabled)),d=u?.textContent,x=_.useMemo(()=>h.jsx("option",{value:l.value,disabled:l.disabled,children:d},l.value),[l.disabled,l.value,d]),{onNativeOptionAdd:m,onNativeOptionRemove:y}=c;return qe(()=>(m(x),()=>y(x)),[m,y,x]),h.jsxs(h.Fragment,{children:[h.jsx(ke.span,{id:l.textId,...i,ref:p}),l.isSelected&&s.valueNode&&!s.valueNodeHasChildren?cr.createPortal(i.children,s.valueNode):null]})});_f.displayName=Qn;var kf="SelectItemIndicator",Sf=_.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e;return bf(kf,n).isSelected?h.jsx(ke.span,{"aria-hidden":!0,...r,ref:t}):null});Sf.displayName=kf;var Ii="SelectScrollUpButton",Cf=_.forwardRef((e,t)=>{const n=Qt(Ii,e.__scopeSelect),r=Ns(Ii,e.__scopeSelect),[o,i]=_.useState(!1),s=Pe(t,r.onScrollButtonChange);return qe(()=>{if(n.viewport&&n.isPositioned){let a=function(){const c=l.scrollTop>0;i(c)};const l=n.viewport;return a(),l.addEventListener("scroll",a),()=>l.removeEventListener("scroll",a)}},[n.viewport,n.isPositioned]),o?h.jsx(Tf,{...e,ref:s,onAutoScroll:()=>{const{viewport:a,selectedItem:l}=n;a&&l&&(a.scrollTop=a.scrollTop-l.offsetHeight)}}):null});Cf.displayName=Ii;var ji="SelectScrollDownButton",Ef=_.forwardRef((e,t)=>{const n=Qt(ji,e.__scopeSelect),r=Ns(ji,e.__scopeSelect),[o,i]=_.useState(!1),s=Pe(t,r.onScrollButtonChange);return qe(()=>{if(n.viewport&&n.isPositioned){let a=function(){const c=l.scrollHeight-l.clientHeight,u=Math.ceil(l.scrollTop)<c;i(u)};const l=n.viewport;return a(),l.addEventListener("scroll",a),()=>l.removeEventListener("scroll",a)}},[n.viewport,n.isPositioned]),o?h.jsx(Tf,{...e,ref:s,onAutoScroll:()=>{const{viewport:a,selectedItem:l}=n;a&&l&&(a.scrollTop=a.scrollTop+l.offsetHeight)}}):null});Ef.displayName=ji;var Tf=_.forwardRef((e,t)=>{const{__scopeSelect:n,onAutoScroll:r,...o}=e,i=Qt("SelectScrollButton",n),s=_.useRef(null),a=Eo(n),l=_.useCallback(()=>{s.current!==null&&(window.clearInterval(s.current),s.current=null)},[]);return _.useEffect(()=>()=>l(),[l]),qe(()=>{a().find(u=>u.ref.current===document.activeElement)?.ref.current?.scrollIntoView({block:"nearest"})},[a]),h.jsx(ke.div,{"aria-hidden":!0,...o,ref:t,style:{flexShrink:0,...o.style},onPointerDown:be(o.onPointerDown,()=>{s.current===null&&(s.current=window.setInterval(r,50))}),onPointerMove:be(o.onPointerMove,()=>{i.onItemLeave?.(),s.current===null&&(s.current=window.setInterval(r,50))}),onPointerLeave:be(o.onPointerLeave,()=>{l()})})}),PE="SelectSeparator",OE=_.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e;return h.jsx(ke.div,{"aria-hidden":!0,...r,ref:t})});OE.displayName=PE;var Pi="SelectArrow",RE=_.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,o=To(n),i=Xt(Pi,n),s=Qt(Pi,n);return i.open&&s.position==="popper"?h.jsx(Fd,{...o,...r,ref:t}):null});RE.displayName=Pi;var DE="SelectBubbleInput",Nf=_.forwardRef(({__scopeSelect:e,value:t,...n},r)=>{const o=_.useRef(null),i=Pe(r,o),s=_S(t);return _.useEffect(()=>{const a=o.current;if(!a)return;const l=window.HTMLSelectElement.prototype,u=Object.getOwnPropertyDescriptor(l,"value").set;if(s!==t&&u){const f=new Event("change",{bubbles:!0});u.call(a,t),a.dispatchEvent(f)}},[s,t]),h.jsx(ke.select,{...n,style:{...Ou,...n.style},ref:i,defaultValue:t})});Nf.displayName=DE;function Af(e){return e===""||e===void 0}function zf(e){const t=Qe(e),n=_.useRef(""),r=_.useRef(0),o=_.useCallback(s=>{const a=n.current+s;t(a),(function l(c){n.current=c,window.clearTimeout(r.current),c!==""&&(r.current=window.setTimeout(()=>l(""),1e3))})(a)},[t]),i=_.useCallback(()=>{n.current="",window.clearTimeout(r.current)},[]);return _.useEffect(()=>()=>window.clearTimeout(r.current),[]),[n,o,i]}function If(e,t,n){const o=t.length>1&&Array.from(t).every(c=>c===t[0])?t[0]:t,i=n?e.indexOf(n):-1;let s=ME(e,Math.max(i,0));o.length===1&&(s=s.filter(c=>c!==n));const l=s.find(c=>c.textValue.toLowerCase().startsWith(o.toLowerCase()));return l!==n?l:void 0}function ME(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var LE=sf,FE=lf,$E=uf,BE=df,UE=ff,ZE=hf,VE=xf,WE=wf,HE=_f,qE=Sf,KE=Cf,GE=Ef,YE="Separator",Il="horizontal",JE=["horizontal","vertical"],jf=_.forwardRef((e,t)=>{const{decorative:n,orientation:r=Il,...o}=e,i=XE(r)?r:Il,a=n?{role:"none"}:{"aria-orientation":i==="vertical"?i:void 0,role:"separator"};return h.jsx(ke.div,{"data-orientation":i,...a,...o,ref:t})});jf.displayName=YE;function XE(e){return JE.includes(e)}var QE=jf,No="Tabs",[e3]=Ft(No,[Bd]),Pf=Bd(),[t3,As]=e3(No),Of=_.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,onValueChange:o,defaultValue:i,orientation:s="horizontal",dir:a,activationMode:l="automatic",...c}=e,u=ho(a),[f,p]=nn({prop:r,onChange:o,defaultProp:i??"",caller:No});return h.jsx(t3,{scope:n,baseId:Et(),value:f,onValueChange:p,orientation:s,dir:u,activationMode:l,children:h.jsx(ke.div,{dir:u,"data-orientation":s,...c,ref:t})})});Of.displayName=No;var Rf="TabsList",Df=_.forwardRef((e,t)=>{const{__scopeTabs:n,loop:r=!0,...o}=e,i=As(Rf,n),s=Pf(n);return h.jsx(QC,{asChild:!0,...s,orientation:i.orientation,dir:i.dir,loop:r,children:h.jsx(ke.div,{role:"tablist","aria-orientation":i.orientation,...o,ref:t})})});Df.displayName=Rf;var Mf="TabsTrigger",Lf=_.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,disabled:o=!1,...i}=e,s=As(Mf,n),a=Pf(n),l=Bf(s.baseId,r),c=Uf(s.baseId,r),u=r===s.value;return h.jsx(eE,{asChild:!0,...a,focusable:!o,active:u,children:h.jsx(ke.button,{type:"button",role:"tab","aria-selected":u,"aria-controls":c,"data-state":u?"active":"inactive","data-disabled":o?"":void 0,disabled:o,id:l,...i,ref:t,onMouseDown:be(e.onMouseDown,f=>{!o&&f.button===0&&f.ctrlKey===!1?s.onValueChange(r):f.preventDefault()}),onKeyDown:be(e.onKeyDown,f=>{[" ","Enter"].includes(f.key)&&s.onValueChange(r)}),onFocus:be(e.onFocus,()=>{const f=s.activationMode!=="manual";!u&&!o&&f&&s.onValueChange(r)})})})});Lf.displayName=Mf;var Ff="TabsContent",$f=_.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,forceMount:o,children:i,...s}=e,a=As(Ff,n),l=Bf(a.baseId,r),c=Uf(a.baseId,r),u=r===a.value,f=_.useRef(u);return _.useEffect(()=>{const p=requestAnimationFrame(()=>f.current=!1);return()=>cancelAnimationFrame(p)},[]),h.jsx(ht,{present:o||u,children:({present:p})=>h.jsx(ke.div,{"data-state":u?"active":"inactive","data-orientation":a.orientation,role:"tabpanel","aria-labelledby":l,hidden:!p,id:c,tabIndex:0,...s,ref:t,style:{...e.style,animationDuration:f.current?"0s":void 0},children:p&&i})})});$f.displayName=Ff;function Bf(e,t){return`${e}-trigger-${t}`}function Uf(e,t){return`${e}-content-${t}`}var n3=Of,r3=Df,o3=Lf,i3=$f,[Ao]=Ft("Tooltip",[_o]),zo=_o(),Zf="TooltipProvider",s3=700,Oi="tooltip.open",[a3,zs]=Ao(Zf),Vf=e=>{const{__scopeTooltip:t,delayDuration:n=s3,skipDelayDuration:r=300,disableHoverableContent:o=!1,children:i}=e,s=_.useRef(!0),a=_.useRef(!1),l=_.useRef(0);return _.useEffect(()=>{const c=l.current;return()=>window.clearTimeout(c)},[]),h.jsx(a3,{scope:t,isOpenDelayedRef:s,delayDuration:n,onOpen:_.useCallback(()=>{window.clearTimeout(l.current),s.current=!1},[]),onClose:_.useCallback(()=>{window.clearTimeout(l.current),l.current=window.setTimeout(()=>s.current=!0,r)},[r]),isPointerInTransitRef:a,onPointerInTransitChange:_.useCallback(c=>{a.current=c},[]),disableHoverableContent:o,children:i})};Vf.displayName=Zf;var ar="Tooltip",[l3,gr]=Ao(ar),Wf=e=>{const{__scopeTooltip:t,children:n,open:r,defaultOpen:o,onOpenChange:i,disableHoverableContent:s,delayDuration:a}=e,l=zs(ar,e.__scopeTooltip),c=zo(t),[u,f]=_.useState(null),p=Et(),d=_.useRef(0),x=s??l.disableHoverableContent,m=a??l.delayDuration,y=_.useRef(!1),[g,v]=nn({prop:r,defaultProp:o??!1,onChange:N=>{N?(l.onOpen(),document.dispatchEvent(new CustomEvent(Oi))):l.onClose(),i?.(N)},caller:ar}),k=_.useMemo(()=>g?y.current?"delayed-open":"instant-open":"closed",[g]),S=_.useCallback(()=>{window.clearTimeout(d.current),d.current=0,y.current=!1,v(!0)},[v]),C=_.useCallback(()=>{window.clearTimeout(d.current),d.current=0,v(!1)},[v]),E=_.useCallback(()=>{window.clearTimeout(d.current),d.current=window.setTimeout(()=>{y.current=!0,v(!0),d.current=0},m)},[m,v]);return _.useEffect(()=>()=>{d.current&&(window.clearTimeout(d.current),d.current=0)},[]),h.jsx(Dd,{...c,children:h.jsx(l3,{scope:t,contentId:p,open:g,stateAttribute:k,trigger:u,onTriggerChange:f,onTriggerEnter:_.useCallback(()=>{l.isOpenDelayedRef.current?E():S()},[l.isOpenDelayedRef,E,S]),onTriggerLeave:_.useCallback(()=>{x?C():(window.clearTimeout(d.current),d.current=0)},[C,x]),onOpen:S,onClose:C,disableHoverableContent:x,children:n})})};Wf.displayName=ar;var Ri="TooltipTrigger",Hf=_.forwardRef((e,t)=>{const{__scopeTooltip:n,...r}=e,o=gr(Ri,n),i=zs(Ri,n),s=zo(n),a=_.useRef(null),l=Pe(t,a,o.onTriggerChange),c=_.useRef(!1),u=_.useRef(!1),f=_.useCallback(()=>c.current=!1,[]);return _.useEffect(()=>()=>document.removeEventListener("pointerup",f),[f]),h.jsx(Md,{asChild:!0,...s,children:h.jsx(ke.button,{"aria-describedby":o.open?o.contentId:void 0,"data-state":o.stateAttribute,...r,ref:l,onPointerMove:be(e.onPointerMove,p=>{p.pointerType!=="touch"&&!u.current&&!i.isPointerInTransitRef.current&&(o.onTriggerEnter(),u.current=!0)}),onPointerLeave:be(e.onPointerLeave,()=>{o.onTriggerLeave(),u.current=!1}),onPointerDown:be(e.onPointerDown,()=>{o.open&&o.onClose(),c.current=!0,document.addEventListener("pointerup",f,{once:!0})}),onFocus:be(e.onFocus,()=>{c.current||o.onOpen()}),onBlur:be(e.onBlur,o.onClose),onClick:be(e.onClick,o.onClose)})})});Hf.displayName=Ri;var Is="TooltipPortal",[c3,u3]=Ao(Is,{forceMount:void 0}),qf=e=>{const{__scopeTooltip:t,forceMount:n,children:r,container:o}=e,i=gr(Is,t);return h.jsx(c3,{scope:t,forceMount:n,children:h.jsx(ht,{present:n||i.open,children:h.jsx(mo,{asChild:!0,container:o,children:r})})})};qf.displayName=Is;var Rn="TooltipContent",Kf=_.forwardRef((e,t)=>{const n=u3(Rn,e.__scopeTooltip),{forceMount:r=n.forceMount,side:o="top",...i}=e,s=gr(Rn,e.__scopeTooltip);return h.jsx(ht,{present:r||s.open,children:s.disableHoverableContent?h.jsx(Gf,{side:o,...i,ref:t}):h.jsx(d3,{side:o,...i,ref:t})})}),d3=_.forwardRef((e,t)=>{const n=gr(Rn,e.__scopeTooltip),r=zs(Rn,e.__scopeTooltip),o=_.useRef(null),i=Pe(t,o),[s,a]=_.useState(null),{trigger:l,onClose:c}=n,u=o.current,{onPointerInTransitChange:f}=r,p=_.useCallback(()=>{a(null),f(!1)},[f]),d=_.useCallback((x,m)=>{const y=x.currentTarget,g={x:x.clientX,y:x.clientY},v=m3(g,y.getBoundingClientRect()),k=g3(g,v),S=x3(m.getBoundingClientRect()),C=v3([...k,...S]);a(C),f(!0)},[f]);return _.useEffect(()=>()=>p(),[p]),_.useEffect(()=>{if(l&&u){const x=y=>d(y,u),m=y=>d(y,l);return l.addEventListener("pointerleave",x),u.addEventListener("pointerleave",m),()=>{l.removeEventListener("pointerleave",x),u.removeEventListener("pointerleave",m)}}},[l,u,d,p]),_.useEffect(()=>{if(s){const x=m=>{const y=m.target,g={x:m.clientX,y:m.clientY},v=l?.contains(y)||u?.contains(y),k=!y3(g,s);v?p():k&&(p(),c())};return document.addEventListener("pointermove",x),()=>document.removeEventListener("pointermove",x)}},[l,u,s,c,p]),h.jsx(Gf,{...e,ref:i})}),[f3,h3]=Ao(ar,{isInside:!1}),p3=R_("TooltipContent"),Gf=_.forwardRef((e,t)=>{const{__scopeTooltip:n,children:r,"aria-label":o,onEscapeKeyDown:i,onPointerDownOutside:s,...a}=e,l=gr(Rn,n),c=zo(n),{onClose:u}=l;return _.useEffect(()=>(document.addEventListener(Oi,u),()=>document.removeEventListener(Oi,u)),[u]),_.useEffect(()=>{if(l.trigger){const f=p=>{p.target?.contains(l.trigger)&&u()};return window.addEventListener("scroll",f,{capture:!0}),()=>window.removeEventListener("scroll",f,{capture:!0})}},[l.trigger,u]),h.jsx(po,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:i,onPointerDownOutside:s,onFocusOutside:f=>f.preventDefault(),onDismiss:u,children:h.jsxs(Ld,{"data-state":l.stateAttribute,...c,...a,ref:t,style:{...a.style,"--radix-tooltip-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-tooltip-content-available-width":"var(--radix-popper-available-width)","--radix-tooltip-content-available-height":"var(--radix-popper-available-height)","--radix-tooltip-trigger-width":"var(--radix-popper-anchor-width)","--radix-tooltip-trigger-height":"var(--radix-popper-anchor-height)"},children:[h.jsx(p3,{children:r}),h.jsx(f3,{scope:n,isInside:!0,children:h.jsx(U_,{id:l.contentId,role:"tooltip",children:o||r})})]})})});Kf.displayName=Rn;var Yf="TooltipArrow",Jf=_.forwardRef((e,t)=>{const{__scopeTooltip:n,...r}=e,o=zo(n);return h3(Yf,n).isInside?null:h.jsx(Fd,{...o,...r,ref:t})});Jf.displayName=Yf;function m3(e,t){const n=Math.abs(t.top-e.y),r=Math.abs(t.bottom-e.y),o=Math.abs(t.right-e.x),i=Math.abs(t.left-e.x);switch(Math.min(n,r,o,i)){case i:return"left";case o:return"right";case n:return"top";case r:return"bottom";default:throw new Error("unreachable")}}function g3(e,t,n=5){const r=[];switch(t){case"top":r.push({x:e.x-n,y:e.y+n},{x:e.x+n,y:e.y+n});break;case"bottom":r.push({x:e.x-n,y:e.y-n},{x:e.x+n,y:e.y-n});break;case"left":r.push({x:e.x+n,y:e.y-n},{x:e.x+n,y:e.y+n});break;case"right":r.push({x:e.x-n,y:e.y-n},{x:e.x-n,y:e.y+n});break}return r}function x3(e){const{top:t,right:n,bottom:r,left:o}=e;return[{x:o,y:t},{x:n,y:t},{x:n,y:r},{x:o,y:r}]}function y3(e,t){const{x:n,y:r}=e;let o=!1;for(let i=0,s=t.length-1;i<t.length;s=i++){const a=t[i],l=t[s],c=a.x,u=a.y,f=l.x,p=l.y;u>r!=p>r&&n<(f-c)*(r-u)/(p-u)+c&&(o=!o)}return o}function v3(e){const t=e.slice();return t.sort((n,r)=>n.x<r.x?-1:n.x>r.x?1:n.y<r.y?-1:n.y>r.y?1:0),b3(t)}function b3(e){if(e.length<=1)return e.slice();const t=[];for(let r=0;r<e.length;r++){const o=e[r];for(;t.length>=2;){const i=t[t.length-1],s=t[t.length-2];if((i.x-s.x)*(o.y-s.y)>=(i.y-s.y)*(o.x-s.x))t.pop();else break}t.push(o)}t.pop();const n=[];for(let r=e.length-1;r>=0;r--){const o=e[r];for(;n.length>=2;){const i=n[n.length-1],s=n[n.length-2];if((i.x-s.x)*(o.y-s.y)>=(i.y-s.y)*(o.x-s.x))n.pop();else break}n.push(o)}return n.pop(),t.length===1&&n.length===1&&t[0].x===n[0].x&&t[0].y===n[0].y?t:t.concat(n)}var w3=Vf,_3=Wf,k3=Hf,S3=qf,C3=Kf,E3=Jf;function jl({delayDuration:e=0,...t}){return h.jsx(w3,{"data-slot":"tooltip-provider",delayDuration:e,...t})}function T3({...e}){return h.jsx(_3,{"data-slot":"tooltip",...e})}function N3({...e}){return h.jsx(k3,{"data-slot":"tooltip-trigger",...e})}function A3({className:e,sideOffset:t=0,children:n,...r}){return h.jsx(S3,{children:h.jsxs(C3,{"data-slot":"tooltip-content",sideOffset:t,className:ze("bg-foreground text-background animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 w-fit origin-(--radix-tooltip-content-transform-origin) rounded-md px-3 py-1.5 text-xs text-balance",e),...r,children:[n,h.jsx(E3,{className:"bg-foreground fill-foreground z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px]"})]})})}function Xf(e){if(e===null)return"null";if(Array.isArray(e))return"array";switch(typeof e){case"string":return"string";case"number":return"number";case"boolean":return"boolean";case"object":return"object";case"bigint":case"symbol":case"undefined":case"function":return"object"}}function no(e){return e!==null&&(Array.isArray(e)||typeof e=="object")}function z3(e,t){const n=Object.getOwnPropertyDescriptor(e,t);if(n!==void 0)return n.value}function js(e){return Array.isArray(e)?e.map((t,n)=>[String(n),t]):typeof e=="object"&&e!==null?Object.keys(e).map(t=>{const n=z3(e,t);return[t,lr(n)]}):[]}function Pl(e){return Array.isArray(e)?e.length:typeof e=="object"&&e!==null?Object.keys(e).length:0}const Ol=120;function I3({text:e}){const[t,n]=_.useState(!1);return e.length>Ol?h.jsxs("span",{className:"text-emerald-400 break-all",children:['"',t?h.jsx("span",{className:"cursor-pointer prose prose-sm dark:prose-invert inline max-w-none [&_p]:inline [&_p]:my-0 [&_code]:text-emerald-300 [&_a]:text-emerald-300",onClick:o=>{o.stopPropagation(),n(!1)},onKeyDown:o=>{(o.key==="Enter"||o.key===" ")&&(o.stopPropagation(),n(!1))},role:"button",tabIndex:0,children:h.jsx(In,{children:e})}):h.jsxs(T3,{delayDuration:300,children:[h.jsxs(N3,{onClick:o=>{o.stopPropagation(),n(!0)},className:"text-left cursor-pointer",children:[h.jsx("span",{children:e.slice(0,Ol)}),h.jsx("span",{className:"text-emerald-400/50",children:"…"})]}),h.jsxs(A3,{side:"bottom",className:"max-w-md text-xs p-2 break-words whitespace-pre-wrap",children:[e.slice(0,500),e.length>500?"…":""]})]}),'"']}):h.jsxs("span",{className:"text-emerald-400 break-all",children:['"',h.jsx("span",{className:"prose prose-sm dark:prose-invert inline max-w-none [&_p]:inline [&_p]:my-0 [&_code]:text-emerald-300 [&_a]:text-emerald-300",children:h.jsx(In,{children:e})}),'"']})}function Qf({value:e}){if(e===null)return h.jsx("span",{className:"text-rose-400 italic",children:"null"});switch(typeof e){case"string":return h.jsx(I3,{text:e});case"number":return h.jsx("span",{className:"text-amber-400",children:e});case"boolean":return h.jsx("span",{className:"text-blue-400",children:e?"true":"false"});case"object":case"bigint":case"symbol":case"undefined":case"function":return h.jsx("span",{className:"text-muted-foreground",children:JSON.stringify(e)})}}function Rl({value:e}){const[t,n]=_.useState(!1);function r(o){o.stopPropagation(),window.navigator.clipboard.writeText(JSON.stringify(e,null,2)).then(()=>{n(!0),setTimeout(()=>{n(!1)},2e3)})}return h.jsx("button",{type:"button",onClick:r,className:"inline-flex items-center gap-1 text-[10px] text-muted-foreground hover:text-foreground transition-colors",title:"Copy JSON",children:t?h.jsx(ur,{className:"size-3 text-green-500"}):h.jsx(ao,{className:"size-3"})})}function j3({value:e}){const[t,n]=_.useState(!1);function r(o){o.stopPropagation(),window.navigator.clipboard.writeText(JSON.stringify(e,null,2)).then(()=>{n(!0),setTimeout(()=>{n(!1)},2e3)})}return h.jsx("button",{type:"button",onClick:r,className:"opacity-0 group-hover/row:opacity-100 hover:bg-muted p-0.5 rounded transition-opacity shrink-0",title:"Copy to clipboard",children:t?h.jsx(ur,{className:"size-3 text-green-500"}):h.jsx(ao,{className:"size-3 text-muted-foreground"})})}function P3(e){return no(e)?js(e).some(([,t])=>no(t)):!1}function O3({allExpanded:e,onClick:t}){return h.jsx("button",{type:"button",onClick:t,className:"opacity-0 group-hover/row:opacity-100 hover:bg-muted p-0.5 rounded transition-opacity shrink-0",title:e?"Collapse all":"Expand all",children:e?h.jsx(cy,{className:"size-3.5 text-muted-foreground"}):h.jsx(ay,{className:"size-3.5 text-muted-foreground"})})}function eh({name:e,value:t,level:n,defaultExpandDepth:r,isArrayItem:o}){const[i,s]=_.useState(n<r),[a,l]=_.useState(0),[c,u]=_.useState(null),[f,p]=_.useState(!1),d=no(t),x=Xf(t),m=x==="array"?"[":"{",y=x==="array"?"]":"}";function g(k){k.stopPropagation(),f?(s(!1),u(0),l(S=>S+1),p(!1)):(s(!0),u(Number.POSITIVE_INFINITY),l(S=>S+1),p(!0))}const v=c??r;return h.jsxs("div",{className:ze(n>0&&"border-l border-border/50 ml-2"),children:[h.jsxs("div",{className:ze("flex items-start gap-1 py-0.5 px-1 -ml-1 rounded-sm group/row",d&&"cursor-pointer hover:bg-muted/50"),onClick:d?()=>{i&&p(!1),s(!i)}:void 0,onKeyDown:d?k=>{(k.key==="Enter"||k.key===" ")&&(k.preventDefault(),s(!i))}:void 0,role:d?"button":void 0,tabIndex:d?0:void 0,children:[d?h.jsx("span",{className:"w-4 h-5 flex items-center justify-center shrink-0",children:i?h.jsx(At,{className:"size-3 text-muted-foreground"}):h.jsx(Wt,{className:"size-3 text-muted-foreground"})}):h.jsx("span",{className:"w-4 shrink-0"}),h.jsx("span",{className:ze("shrink-0",o?"text-muted-foreground":"text-cyan-400"),children:o?e:`"${e}"`}),h.jsx("span",{className:"text-muted-foreground shrink-0",children:d?"":":"}),d?h.jsxs("span",{className:"text-muted-foreground",children:[m,h.jsxs("span",{className:"text-muted-foreground/60 text-xs",children:[" ",Pl(t)," ",Pl(t)===1?"item":"items"," ",y]})]}):h.jsx("span",{className:"min-w-0",children:h.jsx(Qf,{value:t})}),d&&P3(t)&&h.jsx(O3,{allExpanded:f,onClick:g}),h.jsx(j3,{value:t})]}),d&&i&&h.jsxs("div",{className:"pl-4",children:[js(t).map(([k,S])=>h.jsx(eh,{name:k,value:S,level:n+1,defaultExpandDepth:v,isArrayItem:x==="array"},k)),h.jsx("div",{className:"text-muted-foreground py-0.5 px-1",children:y})]},a)]})}function Ps({data:e,defaultExpandDepth:t=2,className:n,showCopy:r=!1}){if(!no(e))return h.jsx(jl,{children:h.jsx("div",{className:ze("font-mono text-xs leading-relaxed",n),children:h.jsxs("div",{className:"flex items-center gap-1",children:[h.jsx(Qf,{value:e}),r&&h.jsx(Rl,{value:e})]})})});const s=Xf(e)==="array";return h.jsx(jl,{children:h.jsxs("div",{className:ze("font-mono text-xs leading-relaxed",n),children:[r&&h.jsx(Rl,{value:e}),js(e).map(([a,l])=>h.jsx(eh,{name:a,value:l,level:0,defaultExpandDepth:t,isArrayItem:s},a))]})})}function Dl({text:e,defaultExpandDepth:t=2,className:n}){try{const r=JSON.parse(e);return h.jsx(Ps,{data:lr(r),defaultExpandDepth:t,className:n})}catch{return h.jsx("pre",{className:ze("font-mono text-xs whitespace-pre-wrap break-words",n),children:e})}}function lr(e){if(e==null)return null;switch(typeof e){case"string":return e;case"number":return e;case"boolean":return e;case"object":{if(Array.isArray(e))return e.map(n=>lr(n));const t={};for(const n of Object.keys(e)){const r=Object.getOwnPropertyDescriptor(e,n);t[n]=lr(r?.value)}return t}case"bigint":case"symbol":case"function":case"undefined":return String(e)}return null}function wn({className:e,orientation:t="horizontal",...n}){return h.jsx(n3,{"data-slot":"tabs","data-orientation":t,orientation:t,className:ze("group/tabs flex gap-2 data-[orientation=horizontal]:flex-col",e),...n})}const R3=Ki("rounded-lg p-[3px] group-data-[orientation=horizontal]/tabs:h-9 data-[variant=line]:rounded-none group/tabs-list text-muted-foreground inline-flex w-fit items-center justify-center group-data-[orientation=vertical]/tabs:h-fit group-data-[orientation=vertical]/tabs:flex-col",{variants:{variant:{default:"bg-muted",line:"gap-1 bg-transparent"}},defaultVariants:{variant:"default"}});function _n({className:e,variant:t="default",...n}){return h.jsx(r3,{"data-slot":"tabs-list","data-variant":t,className:ze(R3({variant:t}),e),...n})}function Je({className:e,...t}){return h.jsx(o3,{"data-slot":"tabs-trigger",className:ze("focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:outline-ring text-foreground/60 hover:text-foreground dark:text-muted-foreground dark:hover:text-foreground relative inline-flex h-[calc(100%-1px)] flex-1 items-center justify-center gap-1.5 rounded-md border border-transparent px-2 py-1 text-sm font-medium whitespace-nowrap transition-all group-data-[orientation=vertical]/tabs:w-full group-data-[orientation=vertical]/tabs:justify-start focus-visible:ring-[3px] focus-visible:outline-1 disabled:pointer-events-none disabled:opacity-50 group-data-[variant=default]/tabs-list:data-[state=active]:shadow-sm group-data-[variant=line]/tabs-list:data-[state=active]:shadow-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4","group-data-[variant=line]/tabs-list:bg-transparent group-data-[variant=line]/tabs-list:data-[state=active]:bg-transparent dark:group-data-[variant=line]/tabs-list:data-[state=active]:border-transparent dark:group-data-[variant=line]/tabs-list:data-[state=active]:bg-transparent","data-[state=active]:bg-background dark:data-[state=active]:text-foreground dark:data-[state=active]:border-input dark:data-[state=active]:bg-input/30 data-[state=active]:text-foreground","after:bg-foreground after:absolute after:opacity-0 after:transition-opacity group-data-[orientation=horizontal]/tabs:after:inset-x-0 group-data-[orientation=horizontal]/tabs:after:bottom-[-5px] group-data-[orientation=horizontal]/tabs:after:h-0.5 group-data-[orientation=vertical]/tabs:after:inset-y-0 group-data-[orientation=vertical]/tabs:after:-right-1 group-data-[orientation=vertical]/tabs:after:w-0.5 group-data-[variant=line]/tabs-list:data-[state=active]:after:opacity-100",e),...t})}function Xe({className:e,...t}){return h.jsx(i3,{"data-slot":"tabs-content",className:ze("flex-1 outline-none",e),...t})}const D3=Ki("inline-flex items-center justify-center rounded-full border border-transparent px-2 py-0.5 text-xs font-medium w-fit whitespace-nowrap shrink-0 [&>svg]:size-3 gap-1 [&>svg]:pointer-events-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive transition-[color,box-shadow] overflow-hidden",{variants:{variant:{default:"bg-primary text-primary-foreground [a&]:hover:bg-primary/90",secondary:"bg-secondary text-secondary-foreground [a&]:hover:bg-secondary/90",destructive:"bg-destructive text-white [a&]:hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60",outline:"border-border text-foreground [a&]:hover:bg-accent [a&]:hover:text-accent-foreground",ghost:"[a&]:hover:bg-accent [a&]:hover:text-accent-foreground",link:"text-primary underline-offset-4 [a&]:hover:underline"}},defaultVariants:{variant:"default"}});function dt({className:e,variant:t="default",asChild:n=!1,...r}){const o=n?P_:"span";return h.jsx(o,{"data-slot":"badge","data-variant":t,className:ze(D3({variant:t}),e),...r})}const M3="data:image/svg+xml,%3csvg%20height='2500'%20viewBox='0%206.603%201192.672%201193.397'%20width='2500'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='m233.96%20800.215%20234.684-131.678%203.947-11.436-3.947-6.363h-11.436l-39.221-2.416-134.094-3.624-116.296-4.832-112.67-6.04-28.35-6.04-26.577-35.035%202.738-17.477%2023.84-16.027%2034.147%202.98%2075.463%205.155%20113.235%207.812%2082.147%204.832%20121.692%2012.644h19.329l2.738-7.812-6.604-4.832-5.154-4.832-117.182-79.41-126.845-83.92-66.443-48.321-35.92-24.484-18.12-22.953-7.813-50.093%2032.618-35.92%2043.812%202.98%2011.195%202.98%2044.375%2034.147%2094.792%2073.37%20123.786%2091.167%2018.12%2015.06%207.249-5.154.886-3.624-8.135-13.61-67.329-121.692-71.838-123.785-31.974-51.302-8.456-30.765c-2.98-12.645-5.154-23.275-5.154-36.242l37.127-50.416%2020.537-6.604%2049.53%206.604%2020.86%2018.121%2030.765%2070.39%2049.852%20110.818%2077.315%20150.684%2022.631%2044.698%2012.08%2041.396%204.51%2012.645h7.813v-7.248l6.362-84.886%2011.759-104.215%2011.436-134.094%203.946-37.772%2018.685-45.262%2037.127-24.482%2028.994%2013.852%2023.839%2034.148-3.303%2022.067-14.174%2092.134-27.785%20144.323-18.121%2096.644h10.55l12.08-12.08%2048.887-64.913%2082.147-102.685%2036.242-40.752%2042.282-45.02%2027.14-21.423h51.303l37.772%2056.135-16.913%2057.986-52.832%2067.007-43.812%2056.779-62.82%2084.563-39.22%2067.651%203.623%205.396%209.343-.886%20141.906-30.201%2076.671-13.852%2091.49-15.705%2041.396%2019.329%204.51%2019.65-16.269%2040.189-97.852%2024.16-114.764%2022.954-170.9%2040.43-2.093%201.53%202.416%202.98%2076.993%207.248%2032.94%201.771h80.617l150.12%2011.195%2039.222%2025.933%2023.517%2031.732-3.946%2024.16-60.403%2030.766-81.503-19.33-190.228-45.26-65.235-16.27h-9.02v5.397l54.362%2053.154%2099.624%2089.96%20124.752%20115.973%206.362%2028.671-16.027%2022.63-16.912-2.415-109.611-82.47-42.282-37.127-95.758-80.618h-6.363v8.456l22.067%2032.296%20116.537%20175.167%206.04%2053.719-8.456%2017.476-30.201%2010.55-33.181-6.04-68.215-95.758-70.39-107.84-56.778-96.644-6.926%203.947-33.503%20360.886-15.705%2018.443-36.243%2013.852-30.201-22.953-16.027-37.127%2016.027-73.37%2019.329-95.758%2015.704-76.107%2014.175-94.55%208.456-31.41-.563-2.094-6.927.886-71.275%2097.852-108.402%20146.497-85.772%2091.812-20.537%208.134-35.597-18.443%203.301-32.94%2019.893-29.315%20118.712-151.007%2071.597-93.583%2046.228-54.04-.322-7.813h-2.738l-315.302%20204.725-56.135%207.248-24.16-22.63%202.98-37.128%2011.435-12.08%2094.792-65.236-.322.323z'%20fill='%23d97757'/%3e%3c/svg%3e",L3="data:image/svg+xml,%3csvg%20height='2500'%20viewBox='-1%20-.1%20949.1%20959.8'%20width='2474'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='m925.8%20456.3c10.4%2023.2%2017%2048%2019.7%2073.3%202.6%2025.3%201.3%2050.9-4.1%2075.8-5.3%2024.9-14.5%2048.8-27.3%2070.8-8.4%2014.7-18.3%2028.5-29.7%2041.2-11.3%2012.6-23.9%2024-37.6%2034-13.8%2010-28.5%2018.4-44.1%2025.3-15.5%206.8-31.7%2012-48.3%2015.4-7.8%2024.2-19.4%2047.1-34.4%2067.7-14.9%2020.6-33%2038.7-53.6%2053.6-20.6%2015-43.4%2026.6-67.6%2034.4-24.2%207.9-49.5%2011.8-75%2011.8-16.9.1-33.9-1.7-50.5-5.1-16.5-3.5-32.7-8.8-48.2-15.7s-30.2-15.5-43.9-25.5c-13.6-10-26.2-21.5-37.4-34.2-25%205.4-50.6%206.7-75.9%204.1-25.3-2.7-50.1-9.3-73.4-19.7-23.2-10.3-44.7-24.3-63.6-41.4s-35-37.1-47.7-59.1c-8.5-14.7-15.5-30.2-20.8-46.3s-8.8-32.7-10.6-49.6c-1.8-16.8-1.7-33.8.1-50.7%201.8-16.8%205.5-33.4%2010.8-49.5-17-18.9-31-40.4-41.4-63.6-10.3-23.3-17-48-19.6-73.3-2.7-25.3-1.3-50.9%204-75.8s14.5-48.8%2027.3-70.8c8.4-14.7%2018.3-28.6%2029.6-41.2s24-24%2037.7-34%2028.5-18.5%2044-25.3c15.6-6.9%2031.8-12%2048.4-15.4%207.8-24.3%2019.4-47.1%2034.3-67.7%2015-20.6%2033.1-38.7%2053.7-53.7%2020.6-14.9%2043.4-26.5%2067.6-34.4%2024.2-7.8%2049.5-11.8%2075-11.7%2016.9-.1%2033.9%201.6%2050.5%205.1s32.8%208.7%2048.3%2015.6c15.5%207%2030.2%2015.5%2043.9%2025.5%2013.7%2010.1%2026.3%2021.5%2037.5%2034.2%2024.9-5.3%2050.5-6.6%2075.8-4s50%209.3%2073.3%2019.6c23.2%2010.4%2044.7%2024.3%2063.6%2041.4%2018.9%2017%2035%2036.9%2047.7%2059%208.5%2014.6%2015.5%2030.1%2020.8%2046.3%205.3%2016.1%208.9%2032.7%2010.6%2049.6%201.8%2016.9%201.8%2033.9-.1%2050.8-1.8%2016.9-5.5%2033.5-10.8%2049.6%2017.1%2018.9%2031%2040.3%2041.4%2063.6zm-333.2%20426.9c21.8-9%2041.6-22.3%2058.3-39s30-36.5%2039-58.4c9-21.8%2013.7-45.2%2013.7-68.8v-223q-.1-.3-.2-.7-.1-.3-.3-.6-.2-.3-.5-.5-.3-.3-.6-.4l-80.7-46.6v269.4c0%202.7-.4%205.5-1.1%208.1-.7%202.7-1.7%205.2-3.1%207.6s-3%204.6-5%206.5a32.1%2032.1%200%200%201%20-6.5%205l-191.1%20110.3c-1.6%201-4.3%202.4-5.7%203.2%207.9%206.7%2016.5%2012.6%2025.5%2017.8%209.1%205.2%2018.5%209.6%2028.3%2013.2%209.8%203.5%2019.9%206.2%2030.1%208%2010.3%201.8%2020.7%202.7%2031.1%202.7%2023.6%200%2047-4.7%2068.8-13.8zm-455.1-151.4c11.9%2020.5%2027.6%2038.3%2046.3%2052.7%2018.8%2014.4%2040.1%2024.9%2062.9%2031s46.6%207.7%2070%204.6%2045.9-10.7%2066.4-22.5l193.2-111.5.5-.5q.2-.2.3-.6.2-.3.3-.6v-94l-233.2%20134.9c-2.4%201.4-4.9%202.4-7.5%203.2-2.7.7-5.4%201-8.2%201-2.7%200-5.4-.3-8.1-1-2.6-.8-5.2-1.8-7.6-3.2l-191.1-110.4c-1.7-1-4.2-2.5-5.6-3.4-1.8%2010.3-2.7%2020.7-2.7%2031.1s1%2020.8%202.8%2031.1c1.8%2010.2%204.6%2020.3%208.1%2030.1%203.6%209.8%208%2019.2%2013.2%2028.2zm-50.2-417c-11.8%2020.5-19.4%2043.1-22.5%2066.5s-1.5%2047.1%204.6%2070c6.1%2022.8%2016.6%2044.1%2031%2062.9%2014.4%2018.7%2032.3%2034.4%2052.7%2046.2l193.1%20111.6q.3.1.7.2h.7q.4%200%20.7-.2.3-.1.6-.3l81-46.8-233.2-134.6c-2.3-1.4-4.5-3.1-6.5-5a32.1%2032.1%200%200%201%20-5-6.5c-1.3-2.4-2.4-4.9-3.1-7.6-.7-2.6-1.1-5.3-1-8.1v-227.1c-9.8%203.6-19.3%208-28.3%2013.2-9%205.3-17.5%2011.3-25.5%2018-7.9%206.7-15.3%2014.1-22%2022.1-6.7%207.9-12.6%2016.5-17.8%2025.5zm663.3%20154.4c2.4%201.4%204.6%203%206.6%205%201.9%201.9%203.6%204.1%205%206.5%201.3%202.4%202.4%205%203.1%207.6.6%202.7%201%205.4.9%208.2v227.1c32.1-11.8%2060.1-32.5%2080.8-59.7%2020.8-27.2%2033.3-59.7%2036.2-93.7s-3.9-68.2-19.7-98.5-39.9-55.5-69.5-72.5l-193.1-111.6q-.3-.1-.7-.2h-.7q-.3.1-.7.2-.3.1-.6.3l-80.6%2046.6%20233.2%20134.7zm80.5-121h-.1v.1zm-.1-.1c5.8-33.6%201.9-68.2-11.3-99.7-13.1-31.5-35-58.6-63-78.2-28-19.5-61-30.7-95.1-32.2-34.2-1.4-68%206.9-97.6%2023.9l-193.1%20111.5q-.3.2-.5.5l-.4.6q-.1.3-.2.7-.1.3-.1.7v93.2l233.2-134.7c2.4-1.4%205-2.4%207.6-3.2%202.7-.7%205.4-1%208.1-1%202.8%200%205.5.3%208.2%201%202.6.8%205.1%201.8%207.5%203.2l191.1%20110.4c1.7%201%204.2%202.4%205.6%203.3zm-505.3-103.2c0-2.7.4-5.4%201.1-8.1.7-2.6%201.7-5.2%203.1-7.6%201.4-2.3%203-4.5%205-6.5%201.9-1.9%204.1-3.6%206.5-4.9l191.1-110.3c1.8-1.1%204.3-2.5%205.7-3.2-26.2-21.9-58.2-35.9-92.1-40.2-33.9-4.4-68.3%201-99.2%2015.5-31%2014.5-57.2%2037.6-75.5%2066.4-18.3%2028.9-28%2062.3-28%2096.5v223q.1.4.2.7.1.3.3.6.2.3.5.6.2.2.6.4l80.7%2046.6zm43.8%20294.7%20103.9%2060%20103.9-60v-119.9l-103.8-60-103.9%2060z'/%3e%3c/svg%3e",F3="data:image/svg+xml,%3csvg%20fill='none'%20height='1320'%20viewBox='3.771%206.973%2023.993%2017.652'%20width='2500'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='m27.501%208.469c-.252-.123-.36.111-.508.23-.05.04-.093.09-.135.135-.368.395-.797.652-1.358.621-.821-.045-1.521.213-2.14.842-.132-.776-.57-1.238-1.235-1.535-.349-.155-.701-.309-.944-.645-.171-.238-.217-.504-.303-.765-.054-.159-.108-.32-.29-.348-.197-.031-.274.135-.352.273-.31.567-.43%201.192-.419%201.825.028%201.421.628%202.554%201.82%203.36.136.093.17.186.128.321-.081.278-.178.547-.264.824-.054.178-.135.217-.324.14a5.448%205.448%200%200%201%20-1.719-1.169c-.848-.82-1.614-1.726-2.57-2.435-.225-.166-.449-.32-.681-.467-.976-.95.128-1.729.383-1.82.267-.096.093-.428-.77-.424s-1.653.293-2.659.677a2.782%202.782%200%200%201%20-.46.135%209.554%209.554%200%200%200%20-2.853-.1c-1.866.21-3.356%201.092-4.452%202.6-1.315%201.81-1.625%203.87-1.246%206.018.399%202.261%201.552%204.136%203.326%205.601%201.837%201.518%203.955%202.262%206.37%202.12%201.466-.085%203.1-.282%204.942-1.842.465.23.952.322%201.762.392.623.059%201.223-.031%201.687-.127.728-.154.677-.828.414-.953-2.132-.994-1.665-.59-2.09-.916%201.084-1.285%202.717-2.619%203.356-6.94.05-.343.007-.558%200-.837-.004-.168.034-.235.228-.254a4.084%204.084%200%200%200%201.529-.47c1.382-.757%201.938-1.997%202.07-3.485.02-.227-.004-.463-.243-.582zm-12.041%2013.391c-2.067-1.627-3.07-2.162-3.483-2.138-.387.021-.318.465-.233.754.089.285.205.482.368.732.113.166.19.414-.112.598-.666.414-1.823-.139-1.878-.166-1.347-.793-2.473-1.842-3.267-3.276-.765-1.38-1.21-2.861-1.284-4.441-.02-.383.093-.518.472-.586a4.692%204.692%200%200%201%201.514-.04c2.109.31%203.905%201.255%205.41%202.749.86.853%201.51%201.871%202.18%202.865.711%201.057%201.478%202.063%202.454%202.887.343.289.619.51.881.672-.792.088-2.117.107-3.022-.61zm.99-6.38a.304.304%200%201%201%20.609%200c0%20.17-.136.304-.306.304a.3.3%200%200%201%20-.303-.305zm3.077%201.581c-.197.08-.394.15-.584.159a1.246%201.246%200%200%201%20-.79-.252c-.27-.227-.463-.354-.546-.752a1.752%201.752%200%200%201%20.016-.582c.07-.324-.008-.531-.235-.72-.187-.155-.422-.196-.682-.196a.551.551%200%200%201%20-.252-.078c-.108-.055-.197-.19-.112-.356.027-.053.159-.183.19-.207.352-.201.758-.135%201.134.016.349.142.611.404.99.773.388.448.457.573.678.906.174.264.333.534.441.842.066.192-.02.35-.248.448z'%20fill='%234d6bfe'/%3e%3c/svg%3e",$3="/assets/minimax-BPMzvuL-.jpeg",B3="/assets/alibaba-TTwafVwX.svg",U3="/assets/qwen-CONDcHqt.png",Z3="/assets/zhipuai-BPNAnxo-.svg",V3={"claude-":"anthropic","gpt-":"openai","o1-":"openai","o3-":"openai","deepseek-":"deepseek",MiniMax:"minimax",qwen:"qwen","glm-":"zhipuai"};function W3(e){if(e===null)return"unknown";const t=e.toLowerCase();for(const[n,r]of Object.entries(V3))if(t.startsWith(n.toLowerCase()))return r;return"unknown"}const dn={width:24,height:24,objectFit:"contain"},H3=tt.memo(({className:e})=>h.jsx("img",{src:M3,alt:"Anthropic",className:e,style:dn})),q3=tt.memo(({className:e})=>h.jsx("img",{src:L3,alt:"OpenAI",className:e,style:dn})),K3=tt.memo(({className:e})=>h.jsx("img",{src:F3,alt:"DeepSeek",className:e,style:dn})),G3=tt.memo(({className:e})=>h.jsx("img",{src:$3,alt:"MiniMax",className:e,style:dn})),Y3=tt.memo(({className:e})=>h.jsx("img",{src:B3,alt:"Alibaba",className:e,style:dn})),J3=tt.memo(({className:e})=>h.jsx("img",{src:U3,alt:"Qwen",className:e,style:dn})),X3=tt.memo(({className:e})=>h.jsx("img",{src:Z3,alt:"ZhipuAI",className:e,style:dn}));function Q3({provider:e,className:t}){switch(e){case"anthropic":return h.jsx(H3,{className:t});case"openai":return h.jsx(q3,{className:t});case"deepseek":return h.jsx(K3,{className:t});case"minimax":return h.jsx(G3,{className:t});case"alibaba":return h.jsx(Y3,{className:t});case"qwen":return h.jsx(J3,{className:t});case"zhipuai":return h.jsx(X3,{className:t});case"unknown":return null}}const e5={anthropic:"Anthropic",openai:"OpenAI",unknown:"Unknown"};function t5(e){return e<1e3?`${e}ms`:`${(e/1e3).toFixed(1)}s`}const Ml={success:"bg-emerald-500/15 text-emerald-400 border-emerald-500/25",client_error:"bg-amber-500/15 text-amber-400 border-amber-500/25",server_error:"",pending:"bg-muted text-muted-foreground border-border"};function n5({log:e,parsedRequest:t,expanded:n,onToggle:r}){const o=Yc(e.responseStatus),i=e.inputTokens!==null||e.outputTokens!==null,s=t!==null?t.messages.length:null,a=t!==null&&t.tools!==void 0&&t.tools.length>0?t.tools.length:null;return h.jsxs("div",{role:"button",tabIndex:0,className:ze("flex items-center gap-2.5 px-3 py-2 cursor-pointer transition-colors","hover:bg-muted/50","select-none"),onClick:r,onKeyDown:l=>{(l.key==="Enter"||l.key===" ")&&(l.preventDefault(),r())},children:[h.jsxs("span",{className:"text-blue-400/80 font-mono text-xs font-semibold tabular-nums shrink-0",children:["#",e.id]}),e.model!==null&&h.jsxs(h.Fragment,{children:[h.jsx(Q3,{provider:W3(e.model),className:"size-4 shrink-0"}),h.jsx(dt,{variant:"secondary",className:"text-[10px] px-1.5 py-0 h-5 font-mono",children:e.model})]}),h.jsx(dt,{variant:"outline",className:ze("text-[10px] px-1.5 py-0 h-5 font-mono",e.apiFormat==="openai"&&"border-blue-500/40 text-blue-400",e.apiFormat==="anthropic"&&"border-orange-500/40 text-orange-400",e.apiFormat==="unknown"&&"border-muted text-muted-foreground"),children:e5[e.apiFormat]??e.apiFormat}),o==="server_error"?h.jsx(dt,{variant:"destructive",className:"text-[10px] px-1.5 py-0 h-5 font-mono tabular-nums",children:e.responseStatus}):o==="pending"?h.jsx(dt,{variant:"outline",className:ze("text-[10px] px-1.5 py-0 h-5 font-mono tabular-nums",Ml[o]),children:h.jsx(Pc,{className:"size-3 animate-spin"})}):h.jsx(dt,{variant:"outline",className:ze("text-[10px] px-1.5 py-0 h-5 font-mono tabular-nums",Ml[o]),children:e.responseStatus}),e.elapsedMs!==null&&h.jsxs("span",{className:"flex items-center gap-1 text-muted-foreground text-xs shrink-0",children:[h.jsx(Hi,{className:"size-3"}),h.jsx("span",{className:"font-mono tabular-nums",children:t5(e.elapsedMs)})]}),i&&h.jsxs("span",{className:"flex items-center gap-1 text-xs shrink-0",children:[h.jsx(dr,{className:"size-3 text-muted-foreground"}),h.jsxs("span",{className:"font-mono tabular-nums",children:[h.jsxs("span",{className:e.inputTokens!==null?"text-blue-400":"text-muted-foreground",children:["IN ",e.inputTokens!==null?Ke(e.inputTokens):"—"]})," / ",h.jsxs("span",{className:e.outputTokens!==null?"text-amber-400":"text-muted-foreground",children:["OUT ",e.outputTokens!==null?Ke(e.outputTokens):"—"]})]})]}),e.cacheCreationInputTokens!==null&&e.cacheCreationInputTokens>0&&h.jsx("span",{className:"flex items-center gap-1 text-xs shrink-0",children:h.jsxs("span",{className:"font-mono tabular-nums text-emerald-400",children:["Cache +",Ke(e.cacheCreationInputTokens)]})}),e.cacheReadInputTokens!==null&&e.cacheReadInputTokens>0&&h.jsx("span",{className:"flex items-center gap-1 text-xs shrink-0",children:h.jsxs("span",{className:"font-mono tabular-nums text-purple-400",children:["Cache ~",Ke(e.cacheReadInputTokens)]})}),s!==null&&h.jsxs("span",{className:"flex items-center gap-1 text-muted-foreground text-xs shrink-0",children:[h.jsx(Oc,{className:"size-3"}),h.jsx("span",{className:"font-mono tabular-nums",children:s})]}),a!==null&&h.jsxs("span",{className:"flex items-center gap-1 text-muted-foreground text-xs shrink-0",children:[h.jsx(hv,{className:"size-3"}),h.jsx("span",{className:"font-mono tabular-nums",children:a})]}),e.origin!==null&&h.jsxs("span",{className:"flex items-center gap-1 text-muted-foreground text-xs shrink-0",title:`Origin: ${e.origin}`,children:[h.jsx(Iy,{className:"size-3"}),h.jsx("span",{className:"font-mono tabular-nums truncate max-w-[120px]",title:e.origin,children:e.origin})]}),e.userAgent!==null&&h.jsxs("span",{className:"flex items-center gap-1 text-muted-foreground text-xs shrink-0",title:`User-Agent: ${e.userAgent}`,children:[h.jsx(av,{className:"size-3"}),h.jsx("span",{className:"font-mono tabular-nums truncate max-w-[150px]",title:e.userAgent,children:e.userAgent})]}),(e.clientPid!==null||e.clientProjectFolder!==null)&&h.jsxs("span",{className:"flex items-center gap-1 text-purple-400/80 text-xs shrink-0",title:e.clientCwd!==null?`PID: ${e.clientPid??"?"} | CWD: ${e.clientCwd}`:`PID: ${e.clientPid??"?"}`,children:[h.jsx(Ty,{className:"size-3"}),e.clientProjectFolder!==null?h.jsx("span",{className:"font-mono tabular-nums",children:e.clientProjectFolder}):h.jsxs("span",{className:"font-mono tabular-nums",children:["PID ",e.clientPid]})]}),e.streaming&&h.jsx(Hy,{className:"size-3 text-muted-foreground/60 shrink-0"}),h.jsx("span",{className:"flex-1 min-w-0"}),n?h.jsx(At,{className:"size-4 text-muted-foreground shrink-0"}):h.jsx(Wt,{className:"size-4 text-muted-foreground shrink-0"})]})}function th({...e}){return h.jsx(mS,{"data-slot":"dialog",...e})}function r5({...e}){return h.jsx(gS,{"data-slot":"dialog-trigger",...e})}function o5({...e}){return h.jsx(xS,{"data-slot":"dialog-portal",...e})}function i5({className:e,...t}){return h.jsx(yS,{"data-slot":"dialog-overlay",className:ze("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",e),...t})}function nh({className:e,children:t,...n}){return h.jsxs(o5,{children:[h.jsx(i5,{}),h.jsxs(vS,{"data-slot":"dialog-content",className:ze("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] rounded-lg",e),...n,children:[t,h.jsxs(wS,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground",children:[h.jsx(mv,{className:"size-4"}),h.jsx("span",{className:"sr-only",children:"Close"})]})]})]})}function rh({className:e,...t}){return h.jsx("div",{"data-slot":"dialog-header",className:ze("flex flex-col space-y-1.5 text-center sm:text-left",e),...t})}function oh({className:e,...t}){return h.jsx(bS,{"data-slot":"dialog-title",className:ze("text-lg font-semibold leading-none tracking-tight",e),...t})}function ih({className:e,orientation:t="horizontal",decorative:n=!0,...r}){return h.jsx(QE,{"data-slot":"separator",decorative:n,orientation:t,className:ze("bg-border shrink-0 data-[orientation=horizontal]:h-px data-[orientation=horizontal]:w-full data-[orientation=vertical]:h-full data-[orientation=vertical]:w-px",e),...r})}function Os({...e}){return h.jsx(nk,{"data-slot":"collapsible",...e})}function Rs({...e}){return h.jsx(Fu,{"data-slot":"collapsible-trigger",...e})}function Ds({...e}){return h.jsx($u,{"data-slot":"collapsible-content",...e})}function sh({className:e,children:t,...n}){return h.jsxs(fE,{"data-slot":"scroll-area",className:ze("relative",e),...n,children:[h.jsx(hE,{"data-slot":"scroll-area-viewport",className:"focus-visible:ring-ring/50 size-full rounded-[inherit] transition-[color,box-shadow] outline-none focus-visible:ring-[3px] focus-visible:outline-1",children:t}),h.jsx(s5,{}),h.jsx(pE,{})]})}function s5({className:e,orientation:t="vertical",...n}){return h.jsx(Yd,{"data-slot":"scroll-area-scrollbar",orientation:t,className:ze("flex touch-none p-px transition-colors select-none",t==="vertical"&&"h-full w-2.5 border-l border-l-transparent",t==="horizontal"&&"h-2.5 flex-col border-t border-t-transparent",e),...n,children:h.jsx(ef,{"data-slot":"scroll-area-thumb",className:"bg-border relative flex-1 rounded-full"})})}function a5(e){return h.jsx(h.Fragment,{})}function l5({text:e}){const[t,n]=_.useState(!1);return h.jsxs(Os,{open:t,onOpenChange:n,children:[h.jsxs(Rs,{className:"flex items-center gap-1.5 py-0.5 cursor-pointer hover:opacity-80 transition-opacity group",children:[t?h.jsx(At,{className:"size-3 text-muted-foreground"}):h.jsx(Wt,{className:"size-3 text-muted-foreground"}),h.jsx("span",{className:"text-muted-foreground text-xs italic select-none opacity-60",children:"[system-reminder]"})]}),h.jsx(Ds,{children:h.jsx("div",{className:"pl-4 pt-1",children:h.jsx("div",{className:"prose prose-sm dark:prose-invert max-w-none [&_pre]:bg-muted [&_pre]:text-foreground [&_code]:text-[0.8em] [&_p]:my-1 [&_ul]:my-1 [&_ol]:my-1",children:h.jsx(In,{children:e})})})})]})}function c5({text:e}){return e.includes("<system-reminder>")?h.jsx(l5,{text:e}):h.jsx("div",{className:"prose prose-sm dark:prose-invert max-w-none [&_pre]:bg-muted [&_pre]:text-foreground [&_code]:text-[0.8em] [&_p]:my-1 [&_ul]:my-1 [&_ol]:my-1",children:h.jsx(In,{children:e})})}function u5({thinking:e}){const[t,n]=_.useState(!1);return h.jsx(Os,{open:t,onOpenChange:n,children:h.jsxs("div",{className:"border-l-2 border-purple-500/40 my-1",children:[h.jsxs(Rs,{className:"flex items-center gap-1.5 px-3 py-1 w-full text-left cursor-pointer hover:bg-purple-500/5 transition-colors rounded-r-sm group",children:[h.jsx(ey,{className:"size-3.5 text-purple-400 shrink-0"}),h.jsx("span",{className:"text-xs font-medium text-purple-400",children:"Thinking"}),h.jsxs(dt,{variant:"ghost",className:"text-[10px] text-muted-foreground px-1.5 py-0 h-4 font-mono",children:[e.length.toLocaleString()," chars"]}),h.jsx("span",{className:"flex-1"}),t?h.jsx(At,{className:"size-3 text-muted-foreground"}):h.jsx(Wt,{className:"size-3 text-muted-foreground"})]}),h.jsx(Ds,{children:h.jsx("div",{className:"px-3 pb-2",children:h.jsx(sh,{className:"max-h-[60vh]",children:h.jsx("pre",{className:"text-xs text-muted-foreground whitespace-pre-wrap font-mono leading-relaxed",children:e})})})})]})})}function d5({name:e,input:t}){const[n,r]=_.useState(!1);return h.jsx(Os,{open:n,onOpenChange:r,children:h.jsxs("div",{className:"border-l-2 border-blue-500/40 my-1",children:[h.jsxs(Rs,{className:"flex items-center gap-1.5 px-3 py-1 w-full text-left cursor-pointer hover:bg-blue-500/5 transition-colors rounded-r-sm group",children:[h.jsx(tv,{className:"size-3.5 text-blue-400 shrink-0"}),h.jsx(dt,{variant:"outline",className:"text-[10px] font-mono px-1.5 py-0 h-4",children:e}),h.jsx("span",{className:"flex-1"}),n?h.jsx(At,{className:"size-3 text-muted-foreground"}):h.jsx(Wt,{className:"size-3 text-muted-foreground"})]}),h.jsx(Ds,{children:h.jsx("div",{className:"px-3 pb-2",children:h.jsx(sh,{className:"max-h-[60vh]",children:h.jsx(Ps,{data:lr(t),defaultExpandDepth:2})})})})]})})}function f5({block:e}){switch(e.type){case"text":return h.jsx(c5,{text:e.text});case"thinking":return h.jsx(u5,{thinking:e.thinking});case"tool_use":return h.jsx(d5,{name:e.name,input:e.input});default:return a5()}}function h5({response:e}){return h.jsxs("div",{className:"space-y-3",children:[h.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[h.jsx(dt,{variant:"secondary",className:"text-[10px] px-1.5 py-0 h-5 font-mono",children:e.model}),e.stop_reason!==null&&h.jsxs(dt,{variant:"outline",className:"text-[10px] px-1.5 py-0 h-5 font-mono flex items-center gap-1",children:[h.jsx(jc,{className:"size-2.5"}),e.stop_reason]}),h.jsxs("span",{className:"flex items-center gap-1 text-muted-foreground text-xs",children:[h.jsx(dr,{className:"size-3"}),h.jsxs("span",{className:"font-mono tabular-nums",children:[Ke(e.usage.input_tokens)," in /"," ",Ke(e.usage.output_tokens)," out"]}),e.usage.cache_creation_input_tokens!==void 0&&e.usage.cache_creation_input_tokens>0&&h.jsxs("span",{className:"font-mono tabular-nums text-emerald-400",children:["Cache +",Ke(e.usage.cache_creation_input_tokens)]}),e.usage.cache_read_input_tokens!==void 0&&e.usage.cache_read_input_tokens>0&&h.jsxs("span",{className:"font-mono tabular-nums text-purple-400",children:["Cache ~",Ke(e.usage.cache_read_input_tokens)]})]})]}),h.jsx(ih,{className:"opacity-50"}),h.jsxs("div",{className:"space-y-2",children:[e.content.map((t,n)=>h.jsx(f5,{block:t},n)),e.content.length===0&&h.jsx("p",{className:"text-xs text-muted-foreground italic",children:"Empty response content"})]})]})}function p5({response:e}){const t=e.choices[0],n=t?.message;return h.jsxs("div",{className:"space-y-3",children:[h.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[h.jsx(dt,{variant:"secondary",className:"text-[10px] px-1.5 py-0 h-5 font-mono",children:e.model}),t?.finish_reason!==null&&t?.finish_reason!==void 0&&h.jsxs(dt,{variant:"outline",className:"text-[10px] px-1.5 py-0 h-5 font-mono flex items-center gap-1",children:[h.jsx(jc,{className:"size-2.5"}),t.finish_reason]}),h.jsxs("span",{className:"flex items-center gap-1 text-muted-foreground text-xs",children:[h.jsx(dr,{className:"size-3"}),h.jsxs("span",{className:"font-mono tabular-nums",children:[Ke(e.usage.prompt_tokens)," in /"," ",Ke(e.usage.completion_tokens)," out"]})]})]}),h.jsx(ih,{className:"opacity-50"}),h.jsxs("div",{className:"space-y-2",children:[n?.reasoning_content!==null&&n?.reasoning_content!==void 0&&n.reasoning_content.length>0&&h.jsxs("div",{className:"border border-purple-500/30 rounded-md p-3 bg-purple-500/5",children:[h.jsx("div",{className:"text-xs text-purple-400 font-mono mb-1",children:"thinking"}),h.jsx("div",{className:"text-sm text-purple-200 whitespace-pre-wrap",children:n.reasoning_content})]}),n?.content!==null&&n?.content!==void 0&&n.content.length>0&&h.jsx("div",{className:"prose prose-sm dark:prose-invert max-w-none [&_pre]:bg-muted [&_pre]:text-foreground [&_code]:text-[0.8em] [&_p]:my-1 [&_ul]:my-1 [&_ol]:my-1",children:h.jsx(In,{children:n.content})}),n?.function_call!==null&&n?.function_call!==void 0&&h.jsxs("div",{className:"border border-blue-500/30 rounded-md p-3 bg-blue-500/5",children:[h.jsx("div",{className:"text-xs text-blue-400 font-mono mb-1",children:"function_call"}),h.jsxs("div",{className:"font-mono text-xs",children:[h.jsx("span",{className:"text-blue-300",children:n.function_call.name}),h.jsxs("span",{className:"text-muted-foreground",children:["(",n.function_call.arguments,")"]})]})]}),(n?.content===null||n?.content===void 0||n.content.length===0)&&(n?.reasoning_content===null||n?.reasoning_content===void 0||n.reasoning_content.length===0)&&(n?.function_call===null||n?.function_call===void 0)&&h.jsx("p",{className:"text-xs text-muted-foreground italic",children:"Empty response content"})]})]})}function m5(e){return typeof e!="object"||e===null?!1:Object.getOwnPropertyDescriptor(e,"object")?.value==="chat.completion"}function g5(e,t){return m5(t)?h.jsx(p5,{response:t}):h.jsx(h5,{response:t})}function x5(e){switch(e){case"success":return"text-emerald-400";case"client_error":return"text-amber-400";case"server_error":return"text-red-400";case"pending":return"text-muted-foreground"}}function y5(e,t){try{const n=JSON.parse(e);if(t==="openai"){const o=Ax(e);if(o)return o}const r=kx.safeParse(n);return r.success?r.data:null}catch{return null}}function Or({status:e}){const t=Yc(e),n=x5(t);return e===null?h.jsx("span",{className:"text-xs text-muted-foreground italic",children:"pending"}):h.jsxs("span",{className:ze("flex items-center gap-1 text-xs font-mono font-semibold",n),children:[t==="server_error"&&h.jsx(iv,{className:"size-3"}),e]})}function v5({text:e}){return h.jsx("div",{className:"rounded-md border border-red-500/30 bg-red-500/5 p-3",children:h.jsx("pre",{className:"text-xs text-red-300 whitespace-pre-wrap font-mono leading-relaxed overflow-auto max-h-[60vh]",children:e})})}function b5({text:e}){return h.jsx("div",{className:"prose prose-sm dark:prose-invert max-w-none [&_pre]:bg-muted [&_pre]:text-foreground [&_code]:text-[0.8em] [&_p]:my-1 [&_ul]:my-1 [&_ol]:my-1",children:h.jsx(In,{children:e})})}function $r({responseText:e,responseStatus:t,streaming:n,inputTokens:r,outputTokens:o,cacheCreationInputTokens:i,cacheReadInputTokens:s,apiFormat:a}){if(e===null)return h.jsxs("div",{className:"flex items-center gap-2 py-3",children:[h.jsx(Or,{status:t}),h.jsx("span",{className:"text-xs text-muted-foreground italic",children:"No response"})]});if(t!==null&&t>=400)return h.jsxs("div",{className:"space-y-2",children:[h.jsx(Or,{status:t}),h.jsx(v5,{text:e})]});const c=y5(e,a);return c!==null?h.jsxs("div",{className:"space-y-2",children:[h.jsx(Or,{status:t}),g5(a,c)]}):h.jsxs("div",{className:"space-y-2",children:[h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsx(Or,{status:t}),n&&(r!==null||o!==null)&&h.jsxs("span",{className:"flex items-center gap-1 text-muted-foreground text-xs",children:[h.jsx(dr,{className:"size-3"}),h.jsxs("span",{className:"font-mono tabular-nums",children:[r!==null?Ke(r):"—"," in /"," ",o!==null?Ke(o):"—"," out"]}),i!=null&&i>0&&h.jsxs("span",{className:"font-mono tabular-nums text-emerald-400",children:["Cache +",Ke(i)]}),s!=null&&s>0&&h.jsxs("span",{className:"font-mono tabular-nums text-purple-400",children:["Cache ~",Ke(s)]})]})]}),h.jsx(b5,{text:e})]})}const w5=ue({success:Nt(),error:ne().optional(),responseStatus:ye().optional(),responseText:ne().optional(),inputTokens:ye().optional(),outputTokens:ye().optional(),elapsedMs:ye().optional(),streaming:Nt().optional()});function _5({log:e,open:t,onOpenChange:n}){const[r,o]=_.useState(()=>e.rawRequestBody??"{}"),[i,s]=_.useState(null),[a,l]=_.useState(!1),[c,u]=_.useState(null);async function f(){l(!0),u(null),s(null);try{const x=await(await fetch(`/api/logs/${e.id}/replay`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({modifiedBody:r})})).json(),m=w5.safeParse(x);if(!m.success){u("Invalid response from server"),l(!1);return}const y=m.data;s(y),y.success||u(y.error??"Replay failed")}catch(d){u(d instanceof Error?d.message:"Network error")}finally{l(!1)}}function p(){s(null),u(null),n(!1)}return h.jsx(th,{open:t,onOpenChange:p,children:h.jsxs(nh,{className:"max-w-4xl max-h-[85vh] overflow-auto",children:[h.jsx(rh,{children:h.jsxs(oh,{className:"flex items-center gap-2",children:[h.jsx(Rc,{className:"size-4"}),"Replay Request #",e.id]})}),h.jsxs(wn,{defaultValue:"modified",children:[h.jsxs(_n,{children:[h.jsx(Je,{value:"modified",children:"Modified Request"}),h.jsx(Je,{value:"original",children:"Original Response"}),i&&h.jsx(Je,{value:"replay",children:"Replay Response"})]}),h.jsxs(Xe,{value:"modified",className:"space-y-4",children:[h.jsxs("div",{children:[h.jsx("label",{className:"text-sm font-medium mb-2 block",children:"Request Body (JSON)"}),h.jsx("textarea",{className:"w-full h-64 p-3 font-mono text-xs bg-muted rounded-md border border-input resize-none focus:outline-none focus:ring-2 focus:ring-ring",value:r,onChange:d=>o(d.target.value),spellCheck:!1})]}),c!==null&&c!==""&&h.jsx("div",{className:"text-sm text-destructive bg-destructive/10 px-3 py-2 rounded-md",children:c}),h.jsx("div",{className:"flex justify-end",children:h.jsx(Ct,{onClick:()=>{f()},disabled:a,children:a?"Replaying...":"Replay"})}),i&&i.success&&h.jsxs(wn,{defaultValue:"parsed",children:[h.jsxs(_n,{children:[h.jsx(Je,{value:"parsed",children:"Parsed Response"}),h.jsx(Je,{value:"raw",children:"Raw Response"})]}),h.jsx(Xe,{value:"parsed",children:h.jsx($r,{responseText:i.responseText??null,responseStatus:i.responseStatus??null,streaming:i.streaming??!1,inputTokens:i.inputTokens??null,outputTokens:i.outputTokens??null,apiFormat:e.apiFormat})}),h.jsx(Xe,{value:"raw",children:h.jsx("pre",{className:"font-mono text-xs whitespace-pre-wrap bg-muted p-3 rounded-md max-h-96 overflow-auto",children:i.responseText??"No response"})})]})]}),h.jsx(Xe,{value:"original",children:e.responseText!==null?h.jsxs(wn,{defaultValue:"parsed",children:[h.jsxs(_n,{children:[h.jsx(Je,{value:"parsed",children:"Parsed Response"}),h.jsx(Je,{value:"raw",children:"Raw Response"})]}),h.jsx(Xe,{value:"parsed",children:h.jsx($r,{responseText:e.responseText,responseStatus:e.responseStatus,streaming:e.streaming,inputTokens:e.inputTokens,outputTokens:e.outputTokens,cacheCreationInputTokens:e.cacheCreationInputTokens,cacheReadInputTokens:e.cacheReadInputTokens,apiFormat:e.apiFormat})}),h.jsx(Xe,{value:"raw",children:h.jsx("pre",{className:"font-mono text-xs whitespace-pre-wrap bg-muted p-3 rounded-md max-h-96 overflow-auto",children:e.responseText})})]}):h.jsx("p",{className:"text-sm text-muted-foreground italic",children:"No original response"})}),i&&i.success&&h.jsx(Xe,{value:"replay",children:i.responseText!==null?h.jsxs(wn,{defaultValue:"parsed",children:[h.jsxs(_n,{children:[h.jsx(Je,{value:"parsed",children:"Parsed Response"}),h.jsx(Je,{value:"raw",children:"Raw Response"})]}),h.jsx(Xe,{value:"parsed",children:h.jsx($r,{responseText:i.responseText??null,responseStatus:i.responseStatus??null,streaming:i.streaming??!1,inputTokens:i.inputTokens??null,outputTokens:i.outputTokens??null,apiFormat:e.apiFormat})}),h.jsx(Xe,{value:"raw",children:h.jsx("pre",{className:"font-mono text-xs whitespace-pre-wrap bg-muted p-3 rounded-md max-h-96 overflow-auto",children:i.responseText})})]}):h.jsx("p",{className:"text-sm text-muted-foreground italic",children:"No replay response"})})]})]})})}function k5({logId:e,truncated:t}){const[n,r]=_.useState(!1),[o,i]=_.useState({status:"idle"}),[s,a]=_.useState(new Set);_.useEffect(()=>{!n||o.status!=="idle"||(i({status:"loading"}),fetch(`/api/logs/${e}/chunks`).then(f=>f.ok?f.json():Promise.reject(new Error("Chunks not found"))).then(f=>{i({status:"success",chunks:f.chunks})}).catch(()=>{i({status:"error",message:"Chunk data unavailable"})}))},[n,e,o.status]);const l=_.useMemo(()=>{if(o.status!=="success")return[];const f=new Map;for(const p of o.chunks){const d=f.get(p.index);d?d.push(p):f.set(p.index,[p])}return Array.from(f.entries()).map(([p,d])=>({index:p,chunks:d})).sort((p,d)=>p.index-d.index)},[o]),c=f=>{a(p=>{const d=new Set(p);return d.has(f)?d.delete(f):d.add(f),d})};function u(){return o.status==="idle"||o.status==="loading"?h.jsxs("div",{className:"flex items-center gap-2 py-2 text-xs text-muted-foreground",children:[h.jsx(Pc,{className:"size-3 animate-spin"}),h.jsx("span",{children:"Loading chunks..."})]}):o.status==="error"?h.jsx("div",{className:"py-2 text-xs text-muted-foreground italic",children:o.message}):h.jsxs("div",{className:"p-2 space-y-1",children:[h.jsxs("div",{className:"text-[10px] text-muted-foreground font-mono mb-2",children:[l.length," index group",l.length!==1?"s":""," available"]}),l.map(f=>{const p=s.has(f.index);return h.jsxs("div",{className:"rounded border border-border bg-background",children:[h.jsxs("button",{type:"button",className:"flex items-center gap-2 w-full px-2 py-1.5 text-left hover:bg-muted/50 transition-colors cursor-pointer",onClick:()=>c(f.index),children:[p?h.jsx(At,{className:"size-3 text-muted-foreground"}):h.jsx(Wt,{className:"size-3 text-muted-foreground"}),h.jsxs("span",{className:"text-[10px] text-muted-foreground font-mono",children:["[",f.index,"] ",f.chunks[0]?.type??""]}),h.jsxs("span",{className:"text-[10px] text-muted-foreground font-mono",children:[f.chunks.length," chunk",f.chunks.length!==1?"s":""]})]}),p&&h.jsx("div",{className:"px-2 pb-2 space-y-1",children:f.chunks.map(d=>h.jsxs("div",{className:"rounded border border-border bg-muted/20 p-2",children:[h.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[h.jsxs("span",{className:"text-[10px] text-muted-foreground font-mono",children:["+",d.timestamp,"ms"]}),h.jsx("span",{className:"text-[10px] text-muted-foreground font-mono",children:d.type})]}),h.jsx(Ps,{data:d,defaultExpandDepth:1,showCopy:!0})]},d.index))})]},f.index)})]})}return h.jsxs("div",{className:"space-y-1",children:[h.jsxs("button",{type:"button",className:"flex items-center gap-1.5 text-xs text-muted-foreground hover:text-foreground transition-colors cursor-pointer",onClick:()=>r(f=>!f),children:[n?h.jsx(At,{className:"size-3"}):h.jsx(Wt,{className:"size-3"}),h.jsx("span",{children:"Raw SSE Events"}),h.jsxs(dt,{variant:"outline",className:"text-[9px] px-1 py-0 h-4 font-mono ml-1",children:[e,t===!0?"+":""]})]}),n===!0?h.jsx("div",{className:"rounded-md border border-border bg-muted/20 overflow-auto max-h-64",children:u()}):null]})}function Ll({text:e,label:t,copied:n,onCopy:r}){return e===null?null:h.jsx("button",{type:"button",onClick:r,className:"flex items-center gap-1.5 text-xs text-muted-foreground hover:text-foreground transition-colors px-2 py-1 rounded hover:bg-muted",children:n?h.jsxs(h.Fragment,{children:[h.jsx(ur,{className:"size-3 text-green-500"}),h.jsx("span",{className:"text-green-500",children:"Copied!"})]}):h.jsxs(h.Fragment,{children:[h.jsx(ao,{className:"size-3"}),h.jsx("span",{children:t})]})})}function ah({log:e,viewMode:t="simple"}){const[n,r]=_.useState(!1),[o,i]=_.useState(!1),[s,a]=_.useState(!1),[l,c]=_.useState(!1),u=_.useMemo(()=>jx(e.rawRequestBody),[e.rawRequestBody]);function f(d){d.stopPropagation(),e.rawRequestBody!==null&&window.navigator.clipboard.writeText(e.rawRequestBody).then(()=>{i(!0),setTimeout(()=>i(!1),2e3)})}function p(d){d.stopPropagation(),e.responseText!==null&&window.navigator.clipboard.writeText(e.responseText).then(()=>{a(!0),setTimeout(()=>a(!1),2e3)})}return h.jsxs(h.Fragment,{children:[h.jsxs("div",{className:ze("border border-border rounded-lg mb-3 overflow-hidden"),children:[h.jsx(n5,{log:e,parsedRequest:u,expanded:n,onToggle:()=>r(!n)}),n&&h.jsx("div",{onClick:d=>d.stopPropagation(),onKeyDown:d=>d.stopPropagation(),children:h.jsxs(wn,{defaultValue:"request",children:[h.jsxs(_n,{className:"mx-4 mt-2",children:[t==="full"&&h.jsx(Je,{value:"raw-headers",children:"Raw Headers"}),t==="full"&&h.jsx(Je,{value:"headers",children:"Headers"}),h.jsx(Je,{value:"request",children:"Request"}),t==="full"&&h.jsx(Je,{value:"raw",children:"Raw Response"}),h.jsx(Je,{value:"parsed",children:"Parsed Response"})]}),h.jsx(Xe,{value:"request",children:h.jsxs("div",{className:"px-4 py-3",children:[h.jsxs("div",{className:"flex justify-end gap-2 mb-2",children:[h.jsxs(Ct,{variant:"outline",size:"sm",className:"h-7 text-xs",onClick:d=>{d.stopPropagation(),c(!0)},children:[h.jsx(Rc,{className:"size-3 mr-1"}),"Replay"]}),h.jsx(Ll,{text:e.rawRequestBody,label:"Copy Request",copied:o,onCopy:f})]}),e.rawRequestBody!==null?h.jsx(Dl,{text:e.rawRequestBody,defaultExpandDepth:1}):h.jsx("p",{className:"text-xs text-muted-foreground italic",children:"No request body"})]})}),t==="full"&&h.jsx(Xe,{value:"headers",children:h.jsx("div",{className:"px-4 py-3",children:e.headers&&Object.keys(e.headers).length>0?h.jsx("div",{className:"space-y-1 font-mono text-xs",children:Object.entries(e.headers).sort(([d],[x])=>d.localeCompare(x)).map(([d,x])=>h.jsxs("div",{className:"flex gap-2",children:[h.jsxs("span",{className:"text-blue-600 dark:text-blue-400 font-semibold shrink-0",children:[d,":"]}),h.jsx("span",{className:"text-muted-foreground truncate",title:x,children:x})]},d))}):h.jsx("p",{className:"text-xs text-muted-foreground italic",children:"No headers captured"})})}),t==="full"&&h.jsx(Xe,{value:"raw-headers",children:h.jsx("div",{className:"px-4 py-3",children:e.rawHeaders&&Object.keys(e.rawHeaders).length>0?h.jsx("div",{className:"space-y-1 font-mono text-xs",children:Object.entries(e.rawHeaders).sort(([d],[x])=>d.localeCompare(x)).map(([d,x])=>h.jsxs("div",{className:"flex gap-2",children:[h.jsxs("span",{className:"text-blue-600 dark:text-blue-400 font-semibold shrink-0",children:[d,":"]}),h.jsx("span",{className:"text-muted-foreground truncate",title:x,children:x})]},d))}):h.jsx("p",{className:"text-xs text-muted-foreground italic",children:"No raw headers captured"})})}),h.jsx(Xe,{value:"raw",children:h.jsxs("div",{className:"px-4 py-3 space-y-3",children:[h.jsx("div",{className:"flex justify-end",children:h.jsx(Ll,{text:e.responseText,label:"Copy Response",copied:s,onCopy:p})}),e.responseText!==null?h.jsx(Dl,{text:e.responseText,defaultExpandDepth:1}):h.jsx("p",{className:"text-xs text-muted-foreground italic",children:"No response"}),e.streaming===!0&&h.jsx(k5,{logId:e.id,truncated:e.streamingChunksPath!==null})]})}),h.jsx(Xe,{value:"parsed",children:h.jsx("div",{className:"px-4 py-3",children:h.jsx($r,{responseText:e.responseText,responseStatus:e.responseStatus,streaming:e.streaming,inputTokens:e.inputTokens,outputTokens:e.outputTokens,cacheCreationInputTokens:e.cacheCreationInputTokens,cacheReadInputTokens:e.cacheReadInputTokens,apiFormat:e.apiFormat})})})]})})]}),h.jsx(_5,{log:e,open:l,onOpenChange:c})]})}function S5(e){let t=0,n=0;for(const r of e)r.inputTokens!==null&&(t+=r.inputTokens),r.outputTokens!==null&&(n+=r.outputTokens);return{totalInputTokens:t,totalOutputTokens:n}}function C5({group:e,viewMode:t="simple"}){const[n,r]=_.useState(!1),o=S5(e.logs),i=e.logs[0]?.timestamp??new Date().toISOString(),s=e.logs[e.logs.length-1]?.timestamp??new Date().toISOString(),a=e.conversationId.startsWith("PID:")||e.conversationId.includes("|")?e.conversationId:e.conversationId.length>24?e.conversationId.slice(0,12)+"…"+e.conversationId.slice(-12):e.conversationId;return h.jsxs("div",{className:"mb-4",children:[h.jsx(ub,{conversationId:a,startTime:i,endTime:s,totalCalls:e.logs.length,totalInputTokens:o.totalInputTokens,totalOutputTokens:o.totalOutputTokens,expanded:n,onToggle:()=>r(!n)}),n&&h.jsx("div",{className:"pl-4 border-l-2 border-muted ml-3",children:e.logs.map(l=>h.jsx(ah,{log:l,viewMode:t},l.id))})]})}function Fl({...e}){return h.jsx(LE,{"data-slot":"select",...e})}function $l({...e}){return h.jsx($E,{"data-slot":"select-value",...e})}function Bl({className:e,size:t="default",children:n,...r}){return h.jsxs(FE,{"data-slot":"select-trigger","data-size":t,className:ze("border-input data-[placeholder]:text-muted-foreground [&_svg:not([class*='text-'])]:text-muted-foreground focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:bg-input/30 dark:hover:bg-input/50 flex w-fit items-center justify-between gap-2 rounded-md border bg-transparent px-3 py-2 text-sm whitespace-nowrap shadow-xs transition-[color,box-shadow] outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50 data-[size=default]:h-9 data-[size=sm]:h-8 *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-2 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",e),...r,children:[n,h.jsx(BE,{asChild:!0,children:h.jsx(At,{className:"size-4 opacity-50"})})]})}function Ul({className:e,children:t,position:n="popper",align:r="center",...o}){return h.jsx(UE,{children:h.jsxs(ZE,{"data-slot":"select-content",className:ze("bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 relative z-50 max-h-(--radix-select-content-available-height) min-w-[8rem] origin-(--radix-select-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border shadow-md",n==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",e),position:n,align:r,...o,children:[h.jsx(E5,{}),h.jsx(VE,{className:ze("p-1",n==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)] scroll-my-1"),children:t}),h.jsx(T5,{})]})})}function Rr({className:e,children:t,...n}){return h.jsxs(WE,{"data-slot":"select-item",className:ze("focus:bg-accent focus:text-accent-foreground [&_svg:not([class*='text-'])]:text-muted-foreground relative flex w-full cursor-default items-center gap-2 rounded-sm py-1.5 pr-8 pl-2 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2",e),...n,children:[h.jsx("span",{className:"absolute right-2 flex size-3.5 items-center justify-center",children:h.jsx(qE,{children:h.jsx(ur,{className:"size-4"})})}),h.jsx(HE,{children:t})]})}function E5({className:e,...t}){return h.jsx(KE,{"data-slot":"select-scroll-up-button",className:ze("flex cursor-default items-center justify-center py-1",e),...t,children:h.jsx(iy,{className:"size-4"})})}function T5({className:e,...t}){return h.jsx(GE,{"data-slot":"select-scroll-down-button",className:ze("flex cursor-default items-center justify-center py-1",e),...t,children:h.jsx(At,{className:"size-4"})})}const N5={deepseek:"https://api-docs.deepseek.com/zh-cn/"};function A5(e){return e.length<=8?"••••••••":e.slice(0,4)+"••••••••"+e.slice(-4)}function z5(e){return Object.prototype.hasOwnProperty.call(e,"success")}function I5(e){const t={className:"size-3",strokeWidth:2};switch(e){case"timeout":return h.jsx(Hi,{...t});case"network_unreachable":return h.jsx(cv,{...t});case"connection_refused":return h.jsx(dv,{...t});case"auth_failed":return h.jsx(Ly,{...t});case"rate_limited":return h.jsx(Ay,{...t});case"server_error":return h.jsx(Jy,{...t});case"invalid_response":return h.jsx(py,{...t});case"unknown":return h.jsx(ui,{...t});default:return h.jsx(ui,{...t})}}function Zl({result:e,isTesting:t}){if(!z5(e))return h.jsxs("div",{className:"flex items-center gap-1 text-xs text-muted-foreground",children:[h.jsx(By,{className:"size-3"}),h.jsx("span",{children:"Not configured"})]});if(e.success)return h.jsxs("div",{className:"flex items-center gap-1 text-xs text-green-600",children:[h.jsx(fy,{className:"size-3"}),h.jsx("span",{children:"Connected"})]});const n=e.error,r=n?.message??"Connection failed",o=n?.hint,i=n?.type??"unknown";return h.jsxs("div",{className:"flex flex-col gap-1 min-w-0",children:[h.jsxs("div",{className:"flex items-center gap-1 text-xs text-red-600 min-w-0",title:n?.details??r,children:[I5(i),h.jsx("span",{className:"truncate",children:r})]}),o!==void 0&&h.jsx("div",{className:"text-xs text-muted-foreground pl-4 truncate",title:o,children:o})]})}function j5({provider:e,testResults:t,isTesting:n,onEdit:r,onDelete:o,onTest:i}){const[s,a]=_.useState(!1);return h.jsxs("div",{className:"border rounded-lg p-4 flex flex-col gap-3 bg-card",children:[h.jsxs("div",{className:"flex items-start justify-between gap-2",children:[h.jsx("div",{className:"flex items-center gap-2 min-w-0",children:h.jsx("span",{className:"font-medium truncate",children:e.model!==void 0&&e.model!==""?`${e.model} (${e.name})`:e.name})}),Object.entries(N5).map(([l,c])=>e.name.toLowerCase().includes(l)?h.jsxs("a",{href:c,target:"_blank",rel:"noopener noreferrer",className:"text-muted-foreground hover:text-foreground transition-colors flex items-center gap-1 text-xs",title:"View API documentation",children:[h.jsx(wy,{className:"size-3"}),h.jsx("span",{className:"sr-only",children:"Docs"})]},l):null)]}),h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsx("code",{className:"text-xs text-muted-foreground bg-muted px-2 py-1 rounded flex-1 truncate",children:s?e.apiKey:A5(e.apiKey)}),h.jsx("button",{type:"button",onClick:()=>a(l=>!l),className:"text-muted-foreground hover:text-foreground transition-colors p-1","aria-label":s?"Hide API key":"Show API key",children:s?h.jsx(ky,{className:"size-4"}):h.jsx(Cy,{className:"size-4"})})]}),e.anthropicBaseUrl!==void 0&&e.anthropicBaseUrl!==""&&h.jsxs("div",{className:"flex items-center justify-between gap-2",children:[h.jsxs("div",{className:"text-xs text-muted-foreground min-w-0 flex-1",children:[h.jsx("span",{className:"font-medium",children:"Anthropic:"})," ",h.jsx("span",{className:"truncate",children:e.anthropicBaseUrl})]}),t&&h.jsx(Zl,{result:t.anthropic.nonStreaming,isTesting:n})]}),e.openaiBaseUrl!==void 0&&e.openaiBaseUrl!==""&&h.jsxs("div",{className:"flex items-center justify-between gap-2",children:[h.jsxs("div",{className:"text-xs text-muted-foreground min-w-0 flex-1",children:[h.jsx("span",{className:"font-medium",children:"OpenAI:"})," ",h.jsx("span",{className:"truncate",children:e.openaiBaseUrl})]}),t&&h.jsx(Zl,{result:t.openai.nonStreaming,isTesting:n})]}),h.jsxs("div",{className:"flex gap-2 pt-1 border-t",children:[i!==void 0&&h.jsxs(Ct,{variant:"outline",size:"sm",onClick:()=>i(e.id),className:"text-xs h-7 gap-1",disabled:n??!1,children:[h.jsx(Gy,{className:`size-3 ${n??!1?"animate-spin":""}`}),n??!1?"Testing...":"Test"]}),h.jsxs(Ct,{variant:"outline",size:"sm",onClick:()=>r(e),className:"text-xs h-7 gap-1",children:[h.jsx(Zy,{className:"size-3"}),"Edit"]}),h.jsxs(Ct,{variant:"outline",size:"sm",onClick:()=>o(e.id),className:"text-xs h-7 gap-1 text-destructive hover:text-destructive",children:[h.jsx(rv,{className:"size-3"}),"Delete"]})]})]})}const P5={deepseek:{format:"openai",baseUrl:"https://api.deepseek.com"},minimax:{format:"anthropic",baseUrl:"https://api.minimaxi.com/anthropic"},alibaba:{format:"openai",baseUrl:"https://dashscope.aliyuncs.com/compatible-mode"}},Vl=["MiniMax M2.7","MiniMax M2.7-highspeed","MiniMax M2.5","MiniMax M2.5-highspeed","MiniMax M2.1","MiniMax M2.1-highspeed","MiniMax M2"],Wl=["glm-5","glm-5.1","qwen3.6-plus","qwen3.7-max"];function O5({provider:e,onSubmit:t,onCancel:n}){const[r,o]=_.useState(e?.name??"Provider Name"),[i,s]=_.useState(e?.apiKey??""),[a,l]=_.useState(e?.model??""),[c,u]=_.useState(e?.format??"anthropic"),[f,p]=_.useState(e?.baseUrl??""),[d,x]=_.useState({}),[m,y]=_.useState(!1),[g,v]=_.useState(!1),k=r.toLowerCase().includes("minimax"),S=r.toLowerCase().includes("alibaba");_.useEffect(()=>{e&&(o(e.name),s(e.apiKey),l(e.model??""),u(e.format??"anthropic"),p(e.baseUrl??""),v(!1))},[e]),_.useEffect(()=>{const A=r.toLowerCase();for(const[O,D]of Object.entries(P5))if(A.includes(O)){g||(u(D.format),p(D.baseUrl)),O==="minimax"&&!a&&l(Vl[0]??""),O==="alibaba"&&!a&&l(Wl[0]??"");break}},[r]);function C(){const A={};return r.trim()||(A.name="Name is required"),i.trim()||(A.apiKey="API key is required"),a.trim()||(A.model="Model is required"),f.trim()?E(f.trim())||(A.baseUrl="Invalid URL format"):A.baseUrl="Base URL is required",x(A),Object.keys(A).length===0}function E(A){try{return new URL(A),!0}catch{return!1}}function N(A){if(A.preventDefault(),!!C()){y(!0);try{t({name:r.trim(),apiKey:i.trim(),model:a.trim()||void 0,format:c,baseUrl:f.trim()||void 0})}finally{y(!1)}}}return h.jsxs("form",{onSubmit:N,className:"space-y-4",children:[h.jsxs("div",{className:"space-y-2",children:[h.jsxs("label",{htmlFor:"provider-name",className:"text-sm font-medium",children:["Name ",h.jsx("span",{className:"text-destructive",children:"*"})]}),h.jsx("input",{id:"provider-name",type:"text",value:r,onChange:A=>o(A.target.value),placeholder:"Model Name",className:"w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus-visible:border-ring focus-visible:outline-ring focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50"}),d.name!==void 0&&h.jsx("p",{className:"text-xs text-destructive",children:d.name})]}),h.jsxs("div",{className:"space-y-2",children:[h.jsxs("label",{htmlFor:"provider-apikey",className:"text-sm font-medium",children:["API Key ",h.jsx("span",{className:"text-destructive",children:"*"})]}),h.jsx("input",{id:"provider-apikey",type:"password",value:i,onChange:A=>s(A.target.value),placeholder:"sk-ant-...",className:"w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus-visible:border-ring focus-visible:outline-ring focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50"}),d.apiKey!==void 0&&h.jsx("p",{className:"text-xs text-destructive",children:d.apiKey})]}),h.jsxs("div",{className:"space-y-2",children:[h.jsxs("label",{htmlFor:"provider-model",className:"text-sm font-medium",children:["Model ",h.jsx("span",{className:"text-destructive",children:"*"})]}),k||S?h.jsx("select",{id:"provider-model",value:a,onChange:A=>l(A.target.value),className:"w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background focus-visible:border-ring focus-visible:outline-ring focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50",children:(k?Vl:Wl).map(A=>h.jsx("option",{value:A,children:A},A))}):h.jsx("input",{id:"provider-model",type:"text",value:a,onChange:A=>l(A.target.value),placeholder:"",className:"w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus-visible:border-ring focus-visible:outline-ring focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50"}),d.model!==void 0&&h.jsx("p",{className:"text-xs text-destructive",children:d.model})]}),h.jsxs("div",{className:"space-y-2",children:[h.jsxs("label",{htmlFor:"provider-format",className:"text-sm font-medium",children:["API Format ",h.jsx("span",{className:"text-destructive",children:"*"})]}),h.jsxs("select",{id:"provider-format",value:c,onChange:A=>u(A.target.value==="anthropic"?"anthropic":"openai"),className:"w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background focus-visible:border-ring focus-visible:outline-ring focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50",children:[h.jsx("option",{value:"anthropic",children:"Anthropic (/v1/messages)"}),h.jsx("option",{value:"openai",children:"OpenAI (/v1/chat/completions)"})]}),h.jsx("p",{className:"text-xs text-muted-foreground",children:c==="anthropic"?"Use Anthropic format for /v1/messages endpoint":"Use OpenAI format for /v1/chat/completions endpoint"})]}),h.jsxs("div",{className:"space-y-2",children:[h.jsxs("label",{htmlFor:"provider-base-url",className:"text-sm font-medium",children:["Base URL ",h.jsx("span",{className:"text-destructive",children:"*"})]}),h.jsx("input",{id:"provider-base-url",type:"text",value:f,onChange:A=>{v(!0),p(A.target.value)},placeholder:c==="anthropic"?"https://api.anthropic.com":"https://api.openai.com/v1",className:"w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus-visible:border-ring focus-visible:outline-ring focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50"}),d.baseUrl!==void 0&&h.jsx("p",{className:"text-xs text-destructive",children:d.baseUrl}),h.jsx("p",{className:"text-xs text-muted-foreground",children:"Base URL for the provider API."})]}),h.jsxs("div",{className:"flex gap-2 justify-end pt-2",children:[h.jsx(Ct,{type:"button",variant:"outline",onClick:n,disabled:m,children:"Cancel"}),h.jsx(Ct,{type:"submit",disabled:m,children:m?"Saving...":e?"Update Provider":"Add Provider"})]})]})}function R5(){const[e,t]=_.useState([]),[n,r]=_.useState(!0),[o,i]=_.useState(!1),[s,a]=_.useState(),[l,c]=_.useState(null),[u,f]=_.useState({}),[p,d]=_.useState(new Set),[x,m]=_.useState(null),[y,g]=_.useState(!1),v=_.useCallback(async()=>{try{const A=await(await fetch("/api/providers")).json();t(A)}catch{c("Failed to load providers")}finally{r(!1)}},[]);_.useEffect(()=>{v(),(async()=>{try{const N=await fetch("/api/config/paths");if(N.ok){const A=await N.json();m(A.providerConfig)}}catch{}})()},[v]);const k=_.useCallback(async N=>{d(A=>new Set(A).add(N));try{const A=await fetch(`/api/providers/${N}/test`,{method:"POST"});if(A.ok){const O=await A.json();f(D=>({...D,[N]:O}))}}finally{d(A=>{const O=new Set(A);return O.delete(N),O})}},[]);function S(N){(async()=>{const A={name:N.name,apiKey:N.apiKey,model:N.model,format:N.format,anthropicBaseUrl:N.format==="anthropic"?N.baseUrl:void 0,openaiBaseUrl:N.format==="openai"?N.baseUrl:void 0},O=await fetch("/api/providers",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(A)});if(!O.ok){const U=await O.json();c(U.error??"Failed to add provider");return}const D=await O.json();await v(),i(!1),await k(D.id)})()}function C(N){s&&(async()=>{const A={name:N.name,apiKey:N.apiKey,model:N.model,format:N.format,anthropicBaseUrl:N.format==="anthropic"?N.baseUrl:void 0,openaiBaseUrl:N.format==="openai"?N.baseUrl:void 0},O=await fetch(`/api/providers/${s.id}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(A)});if(!O.ok){const U=await O.json();c(U.error??"Failed to update provider");return}const D=await O.json();await v(),a(void 0),await k(D.id)})()}function E(N){window.confirm("Are you sure you want to delete this provider?")&&(async()=>{const A=await fetch(`/api/providers/${N}`,{method:"DELETE"});if(!A.ok){const O=await A.json();c(O.error??"Failed to delete provider");return}await v()})()}return n&&e.length===0?h.jsx("div",{className:"flex items-center justify-center py-8",children:h.jsx("p",{className:"text-sm text-muted-foreground",children:"Loading providers..."})}):o||s?h.jsxs("div",{className:"space-y-4",children:[h.jsx("div",{className:"flex items-center justify-between",children:h.jsx("h3",{className:"text-lg font-medium",children:s?"Edit Provider":"Add New Provider"})}),h.jsx(O5,{provider:s,onSubmit:s?C:S,onCancel:()=>{i(!1),a(void 0)}})]}):h.jsxs("div",{className:"space-y-4",children:[h.jsxs("div",{className:"flex items-center justify-between",children:[h.jsx("h3",{className:"text-lg font-medium",children:"Providers"}),h.jsxs(Ct,{onClick:()=>i(!0),size:"sm",className:"gap-1",children:[h.jsx(fa,{className:"size-4"}),"Add Provider"]})]}),x!==null&&h.jsxs("div",{className:"flex items-center gap-2 text-xs text-muted-foreground bg-muted/30 rounded-md px-3 py-2",children:[h.jsx("span",{className:"shrink-0",children:"Config:"}),h.jsx("span",{className:"font-mono truncate",title:x,children:x}),h.jsx("button",{type:"button",onClick:()=>{window.navigator.clipboard.writeText(x).then(()=>{g(!0),setTimeout(()=>g(!1),2e3)})},className:"shrink-0 ml-auto text-muted-foreground hover:text-foreground transition-colors",title:"Copy path",children:y?h.jsx(ur,{className:"size-3 text-green-500"}):h.jsx(ao,{className:"size-3"})})]}),l!==null&&h.jsxs("div",{className:"flex items-center gap-2 text-sm text-destructive bg-destructive/10 rounded-md px-3 py-2",children:[h.jsx(ui,{className:"size-4 shrink-0"}),l]}),e.length===0?h.jsxs("div",{className:"text-center py-12 space-y-3",children:[h.jsx("p",{className:"text-sm text-muted-foreground",children:"No providers configured yet."}),h.jsxs(Ct,{onClick:()=>i(!0),variant:"outline",size:"sm",children:[h.jsx(fa,{className:"size-4"}),"Add Your First Provider"]})]}):h.jsx("div",{className:"space-y-3",children:e.map(N=>h.jsx(j5,{provider:N,testResults:u[N.id],isTesting:p.has(N.id),onEdit:A=>a(A),onDelete:E,onTest:A=>{k(A)}},N.id))})]})}function D5(){const[e,t]=_.useState(!1),[n,r]=_.useState("providers");return h.jsxs(th,{open:e,onOpenChange:t,children:[h.jsx(r5,{asChild:!0,children:h.jsxs(Ct,{variant:"ghost",size:"icon",className:"size-8",children:[h.jsx(Qy,{className:"size-4"}),h.jsx("span",{className:"sr-only",children:"Settings"})]})}),h.jsxs(nh,{className:"max-w-2xl max-h-[80vh] overflow-hidden flex flex-col",children:[h.jsx(rh,{children:h.jsx(oh,{children:"Settings"})}),h.jsxs(wn,{value:n,onValueChange:r,className:"flex-1 overflow-hidden",children:[h.jsx(_n,{children:h.jsx(Je,{value:"providers",children:"Providers"})}),h.jsx("div",{className:"mt-4 overflow-y-auto flex-1",children:h.jsx(Xe,{value:"providers",children:h.jsx(R5,{})})})]})]})]})}function M5(e){return e.length<=30?e:e.slice(0,12)+"…"+e.slice(-12)}function L5(e){let t=0,n=0;for(const r of e)r.inputTokens!==null&&(t+=r.inputTokens),r.outputTokens!==null&&(n+=r.outputTokens);return{totalIn:t,totalOut:n}}function F5({command:e}){const[t,n]=_.useState(!1),r=_.useCallback(()=>{window.navigator.clipboard.writeText(e).then(()=>{n(!0),setTimeout(()=>n(!1),2e3)})},[e]);return h.jsxs("div",{className:"inline-flex items-center gap-2 bg-muted rounded-md px-3 py-2",children:[h.jsx("pre",{className:"text-blue-500 font-mono text-sm m-0",children:e}),h.jsx("button",{type:"button",onClick:r,className:"text-muted-foreground hover:text-foreground transition-colors shrink-0 cursor-pointer","aria-label":"Copy command",children:t?h.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:h.jsx("path",{d:"M20 6 9 17l-5-5"})}):h.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[h.jsx("rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2"}),h.jsx("path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2"})]})})]})}function $5({logs:e,sessions:t,models:n,selectedSession:r,selectedModel:o,onSessionChange:i,onModelChange:s,onClearAll:a,viewMode:l,onViewModeChange:c}){const{totalIn:u,totalOut:f}=L5(e),[p,d]=_.useState(!0),[x,m]=_.useState(!1),y=_.useCallback(async()=>{m(!0);try{await wv(e)}finally{m(!1)}},[e]),g=_.useRef(null),v=_.useMemo(()=>fb(e),[e]),k=e.length>0&&p&&!(v.length===1&&v[0]?.logs.length===e.length),S=qx({count:k?v.length:e.length,getScrollElement:()=>g.current,estimateSize:()=>150,measureElement:typeof window<"u"?C=>C.getBoundingClientRect().height:void 0,overscan:5});return h.jsxs("div",{className:"max-w-[1200px] mx-auto flex flex-col h-screen",style:{maxHeight:"100vh"},children:[h.jsxs("div",{className:"flex items-center gap-4 mb-4 px-6 pt-6",children:[h.jsx("h1",{className:"text-lg font-bold flex-1",children:"LLM Proxy Inspector"}),h.jsxs("div",{className:"flex items-center border border-border rounded-md overflow-hidden",children:[h.jsx("button",{type:"button",onClick:()=>c("simple"),className:`px-2 py-1 cursor-pointer transition-colors text-xs ${l==="simple"?"bg-muted text-foreground":"text-muted-foreground hover:bg-muted/50"}`,children:"Simple"}),h.jsx("button",{type:"button",onClick:()=>c("full"),className:`px-2 py-1 cursor-pointer transition-colors text-xs ${l==="full"?"bg-muted text-foreground":"text-muted-foreground hover:bg-muted/50"}`,children:"Full"})]}),h.jsx(D5,{}),h.jsxs("span",{className:"text-muted-foreground text-xs font-mono",children:[e.length," request",e.length!==1?"s":"",u>0||f>0?` · ${u.toLocaleString()} in / ${f.toLocaleString()} out`:""]}),e.length>0&&h.jsx("button",{type:"button",onClick:()=>{y()},disabled:x,className:"text-xs text-muted-foreground hover:text-foreground transition-colors cursor-pointer disabled:opacity-50 disabled:cursor-not-allowed inline-flex items-center gap-1",title:"Export all logs as JSON ZIP",children:x?h.jsx("span",{children:"Exporting..."}):h.jsxs(h.Fragment,{children:[h.jsx(vy,{className:"size-3"}),h.jsx("span",{children:"Export All"})]})}),h.jsx("button",{type:"button",onClick:a,className:"text-xs text-muted-foreground hover:text-foreground transition-colors cursor-pointer",title:"Clear all logs",children:"Clear All"})]}),h.jsxs("div",{className:"flex gap-3 px-6 mb-4",children:[h.jsxs(Fl,{value:r,onValueChange:i,children:[h.jsx(Bl,{className:"flex-1 max-w-[400px] text-xs",children:h.jsx($l,{placeholder:"All sessions"})}),h.jsxs(Ul,{children:[h.jsx(Rr,{value:"__all__",children:"All sessions"}),t.map(C=>h.jsx(Rr,{value:C,children:M5(C)},C))]})]}),h.jsxs(Fl,{value:o,onValueChange:s,children:[h.jsx(Bl,{className:"text-xs",children:h.jsx($l,{placeholder:"All models"})}),h.jsxs(Ul,{children:[h.jsx(Rr,{value:"__all__",children:"All models"}),n.map(C=>h.jsx(Rr,{value:C,children:C},C))]})]}),h.jsxs("div",{className:"flex items-center border border-border rounded-md overflow-hidden",children:[h.jsx("button",{type:"button",onClick:()=>d(!0),className:`px-2 py-1.5 cursor-pointer transition-colors ${p?"bg-muted text-foreground":"text-muted-foreground hover:bg-muted/50"}`,title:"Grouped view",children:h.jsx(Py,{className:"size-4"})}),h.jsx("button",{type:"button",onClick:()=>d(!1),className:`px-2 py-1.5 cursor-pointer transition-colors ${p?"text-muted-foreground hover:bg-muted/50":"bg-muted text-foreground"}`,title:"Flat view",children:h.jsx(Ry,{className:"size-4"})})]})]}),h.jsx("div",{className:"flex-1 min-h-0 px-6 pb-6",children:e.length===0?h.jsxs("div",{className:"text-center text-muted-foreground py-16 space-y-4",children:[h.jsx("p",{className:"text-sm",children:"No requests captured yet."}),h.jsx("p",{className:"text-xs",children:"Route AI coding tools through the proxy:"}),h.jsx(F5,{command:"LLM_BASE_URL=http://localhost:25947/proxy <your-tool>"})]}):h.jsx("div",{ref:g,className:"overflow-y-auto h-full",children:h.jsx("div",{style:{height:`${S.getTotalSize()}px`,width:"100%",position:"relative"},children:S.getVirtualItems().map(C=>{if(k){const E=v[C.index];return E===void 0?null:h.jsx("div",{"data-index":C.index,ref:S.measureElement,style:{position:"absolute",top:0,left:0,width:"100%",transform:`translateY(${C.start}px)`},children:h.jsx(C5,{group:E,viewMode:l})},E.id)}else{const E=e[C.index];return E===void 0?null:h.jsx("div",{"data-index":C.index,ref:S.measureElement,style:{position:"absolute",top:0,left:0,width:"100%",transform:`translateY(${C.start}px)`},children:h.jsx(ah,{log:E,viewMode:l})},E.id)}})})})})]})}ue({logs:Ze(ci),total:ye(),offset:ye(),limit:ye()});const B5=Yt([ue({type:Te("init"),logs:Ze(ci)}),ue({type:Te("update"),log:ci})]);function U5(e){const t=new Set;for(const n of e)n.sessionId!==null&&n.sessionId!==""&&t.add(n.sessionId);return[...t]}function Z5(e){const t=new Set;for(const n of e)n.model!==null&&n.model!==""&&t.add(n.model);return[...t]}function V5(){const[e,t]=_.useState([]),[n,r]=_.useState([]),[o,i]=_.useState([]),[s,a]=_.useState("__all__"),[l,c]=_.useState("__all__"),[u,f]=_.useState("simple"),[p,d]=_.useState(null),x=_.useRef(null),m=_.useCallback(async()=>{try{const[v,k]=await Promise.all([fetch("/api/sessions"),fetch("/api/models")]);if(v.ok&&k.ok){const S=await v.json(),C=await k.json(),E=Ze(ne()).safeParse(S),N=Ze(ne()).safeParse(C);E.success&&r(E.data),N.success&&i(N.data)}}catch{}},[]),y=_.useCallback(()=>{x.current&&x.current.close();const v=new URLSearchParams;s!=="__all__"&&v.set("sessionId",s),l!=="__all__"&&v.set("model",l);const k=new EventSource(`/api/logs/stream?${v}`);x.current=k,k.onmessage=S=>{try{const C=String(S.data),E=JSON.parse(C),N=B5.safeParse(E);if(!N.success){d("Failed to parse SSE data");return}const A=N.data;A.type==="init"?(t(A.logs),r(U5(A.logs)),i(Z5(A.logs)),d(null)):A.type==="update"&&(t(O=>{const D=s==="__all__"||A.log.sessionId===s,U=l==="__all__"||A.log.model===l;return!D||!U?O:O.findIndex(M=>M.id===A.log.id)>=0?O.map(M=>M.id===A.log.id?A.log:M):[...O,A.log]}),r(O=>{const D=A.log.sessionId;return D!=null&&D!==""?O.includes(D)?O:[...O,D]:O}),i(O=>{const D=A.log.model;return D!=null&&D!==""?O.includes(D)?O:[...O,D]:O}))}catch{d("Failed to parse SSE data")}},k.onerror=()=>{d("SSE connection lost, reconnecting..."),k.close(),setTimeout(y,3e3)},m()},[s,l,m]);_.useEffect(()=>(y(),()=>{x.current&&(x.current.close(),x.current=null)}),[y]);const g=_.useCallback(()=>{(async()=>{try{if(!(await fetch("/api/logs",{method:"DELETE"})).ok){d("Failed to clear logs");return}t([]),r([]),i([]),d(null)}catch(v){d(v instanceof Error?v.message:"Unknown error clearing logs")}})()},[]);return h.jsxs(h.Fragment,{children:[p!==null&&h.jsx("div",{className:"fixed top-4 right-4 bg-destructive text-destructive-foreground px-4 py-2 rounded-md text-sm z-50",children:p}),h.jsx($5,{logs:e,sessions:n,models:o,selectedSession:s,selectedModel:l,onSessionChange:a,onModelChange:c,onClearAll:g,viewMode:u,onViewModeChange:f})]})}const q5=V5;export{q5 as component};
|
|
@@ -14,4 +14,4 @@ Error generating stack: `+l.message+`
|
|
|
14
14
|
`)}else{const p=o.indexOf(`
|
|
15
15
|
`);if(p>=0){const S=o.slice(0,p).trim();o=o.slice(p+1),S.length>0&&(m=JSON.parse(S),f=!0)}}}return(async()=>{try{for(;;){const{value:y,done:h}=await r.read();y&&(o+=y);const p=o.lastIndexOf(`
|
|
16
16
|
`);if(p>=0){const S=o.slice(0,p);o=o.slice(p+1);const b=S.split(`
|
|
17
|
-
`).filter(Boolean);for(const _ of b)try{u(JSON.parse(_))}catch(R){i?.(`Invalid JSON line: ${_}`,R)}}if(h)break}}catch(y){i?.("Stream processing error:",y)}})(),u(m)}async function _E({jsonStream:a,onMessage:u,onError:i}){const r=a.getReader(),{value:o,done:f}=await r.read();if(f||!o)throw new Error("Stream ended before first object");const m=JSON.parse(o);return(async()=>{try{for(;;){const{value:y,done:h}=await r.read();if(h)break;if(y)try{u(JSON.parse(y))}catch(p){i?.(`Invalid JSON: ${y}`,p)}}}catch(y){i?.("Stream processing error:",y)}})(),u(m)}function EE(a){const u="/_serverFn/"+a;return Object.assign((...o)=>{const f=Lp()?.serverFns?.fetch;return gE(u,o,f??fetch)},{url:u,serverFnMeta:{id:a},[Ao]:!0})}const RE={key:"$TSS/serverfn",test:a=>typeof a!="function"||!(Ao in a)?!1:!!a[Ao],toSerializable:({serverFnMeta:a})=>({functionId:a.id}),fromSerializable:({functionId:a})=>EE(a)},TE="/assets/index-B3RwBPLW.css",Hp=G_({head:()=>({meta:[{charSet:"utf-8"},{name:"viewport",content:"width=device-width, initial-scale=1"},{title:"llm-inspector"}],links:[{rel:"stylesheet",href:TE}]}),component:AE});function AE(){return k.jsx(OE,{children:k.jsx(Cp,{})})}function OE({children:a}){return k.jsxs("html",{lang:"en",className:"dark",children:[k.jsx("head",{children:k.jsx(aE,{})}),k.jsxs("body",{children:[a,k.jsx(lE,{})]})]})}const ME="modulepreload",zE=function(a){return"/"+a},zy={},xE=function(u,i,r){let o=Promise.resolve();if(i&&i.length>0){let h=function(p){return Promise.all(p.map(S=>Promise.resolve(S).then(b=>({status:"fulfilled",value:b}),b=>({status:"rejected",reason:b}))))};document.getElementsByTagName("link");const m=document.querySelector("meta[property=csp-nonce]"),y=m?.nonce||m?.getAttribute("nonce");o=h(i.map(p=>{if(p=zE(p),p in zy)return;zy[p]=!0;const S=p.endsWith(".css"),b=S?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${p}"]${b}`))return;const _=document.createElement("link");if(_.rel=S?"stylesheet":ME,S||(_.as="script"),_.crossOrigin="",_.href=p,y&&_.setAttribute("nonce",y),document.head.appendChild(_),S)return new Promise((R,D)=>{_.addEventListener("load",R),_.addEventListener("error",()=>D(new Error(`Unable to preload CSS for ${p}`)))})}))}function f(m){const y=new Event("vite:preloadError",{cancelable:!0});if(y.payload=m,window.dispatchEvent(y),!y.defaultPrevented)throw m}return o.then(m=>{for(const y of m||[])y.status==="rejected"&&f(y.reason);return u().catch(f)})},wE=()=>xE(()=>import("./index-
|
|
17
|
+
`).filter(Boolean);for(const _ of b)try{u(JSON.parse(_))}catch(R){i?.(`Invalid JSON line: ${_}`,R)}}if(h)break}}catch(y){i?.("Stream processing error:",y)}})(),u(m)}async function _E({jsonStream:a,onMessage:u,onError:i}){const r=a.getReader(),{value:o,done:f}=await r.read();if(f||!o)throw new Error("Stream ended before first object");const m=JSON.parse(o);return(async()=>{try{for(;;){const{value:y,done:h}=await r.read();if(h)break;if(y)try{u(JSON.parse(y))}catch(p){i?.(`Invalid JSON: ${y}`,p)}}}catch(y){i?.("Stream processing error:",y)}})(),u(m)}function EE(a){const u="/_serverFn/"+a;return Object.assign((...o)=>{const f=Lp()?.serverFns?.fetch;return gE(u,o,f??fetch)},{url:u,serverFnMeta:{id:a},[Ao]:!0})}const RE={key:"$TSS/serverfn",test:a=>typeof a!="function"||!(Ao in a)?!1:!!a[Ao],toSerializable:({serverFnMeta:a})=>({functionId:a.id}),fromSerializable:({functionId:a})=>EE(a)},TE="/assets/index-B3RwBPLW.css",Hp=G_({head:()=>({meta:[{charSet:"utf-8"},{name:"viewport",content:"width=device-width, initial-scale=1"},{title:"llm-inspector"}],links:[{rel:"stylesheet",href:TE}]}),component:AE});function AE(){return k.jsx(OE,{children:k.jsx(Cp,{})})}function OE({children:a}){return k.jsxs("html",{lang:"en",className:"dark",children:[k.jsx("head",{children:k.jsx(aE,{})}),k.jsxs("body",{children:[a,k.jsx(lE,{})]})]})}const ME="modulepreload",zE=function(a){return"/"+a},zy={},xE=function(u,i,r){let o=Promise.resolve();if(i&&i.length>0){let h=function(p){return Promise.all(p.map(S=>Promise.resolve(S).then(b=>({status:"fulfilled",value:b}),b=>({status:"rejected",reason:b}))))};document.getElementsByTagName("link");const m=document.querySelector("meta[property=csp-nonce]"),y=m?.nonce||m?.getAttribute("nonce");o=h(i.map(p=>{if(p=zE(p),p in zy)return;zy[p]=!0;const S=p.endsWith(".css"),b=S?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${p}"]${b}`))return;const _=document.createElement("link");if(_.rel=S?"stylesheet":ME,S||(_.as="script"),_.crossOrigin="",_.href=p,y&&_.setAttribute("nonce",y),document.head.appendChild(_),S)return new Promise((R,D)=>{_.addEventListener("load",R),_.addEventListener("error",()=>D(new Error(`Unable to preload CSS for ${p}`)))})}))}function f(m){const y=new Event("vite:preloadError",{cancelable:!0});if(y.payload=m,window.dispatchEvent(y),!y.defaultPrevented)throw m}return o.then(m=>{for(const y of m||[])y.status==="rejected"&&f(y.reason);return u().catch(f)})},wE=()=>xE(()=>import("./index-BKkFFKAM.js"),[]),CE=To("/")({component:V_(wE,"component")}),DE=CE.update({id:"/",path:"/",getParentRoute:()=>Hp}),UE={IndexRoute:DE},LE=Hp._addFileChildren(UE);function NE(){return P_({routeTree:LE,scrollRestoration:!1})}async function BE(){const a=await NE();let u;return u=[],window.__TSS_START_OPTIONS__={serializationAdapters:u},u.push(RE),a.options.serializationAdapters&&u.push(...a.options.serializationAdapters),a.update({basepath:"",serializationAdapters:u}),a.state.matches.length||await uE(a),a}async function jE(){const a=await BE();return window.$_TSR?.h(),a}let So;function HE(){return So||(So=jE()),k.jsx(p_,{promise:So,children:a=>k.jsx(I_,{router:a})})}nt.startTransition(()=>{h0.hydrateRoot(document,k.jsx(nt.StrictMode,{children:k.jsx(HE,{})}))});export{Ul as R,Mp as a,s0 as b,qE as c,XE as d,xy as g,k as j,nt as r};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { r as reactExports, j as jsxRuntimeExports, a as React } from "../_libs/react.mjs";
|
|
2
|
-
import { C as CapturedLogSchema, a as parseRequest, p as parseOpenAIResponse, I as InspectorResponseSchema } from "./router-
|
|
2
|
+
import { C as CapturedLogSchema, a as parseRequest, p as parseOpenAIResponse, I as InspectorResponseSchema } from "./router-tRLZo2WT.mjs";
|
|
3
3
|
import { u as useVirtualizer } from "../_libs/tanstack__react-virtual.mjs";
|
|
4
4
|
import { J as JSZip } from "../_libs/jszip.mjs";
|
|
5
5
|
import { c as clsx } from "../_libs/clsx.mjs";
|
|
@@ -2613,7 +2613,7 @@ function ProvidersPanel() {
|
|
|
2613
2613
|
await fetchProviders();
|
|
2614
2614
|
})();
|
|
2615
2615
|
}
|
|
2616
|
-
if (isLoading) {
|
|
2616
|
+
if (isLoading && providers.length === 0) {
|
|
2617
2617
|
return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex items-center justify-center py-8", children: /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "text-sm text-muted-foreground", children: "Loading providers..." }) });
|
|
2618
2618
|
}
|
|
2619
2619
|
if (showForm || editingProvider) {
|
|
@@ -197,7 +197,7 @@ function getResponse() {
|
|
|
197
197
|
return event.res;
|
|
198
198
|
}
|
|
199
199
|
async function getStartManifest(matchedRoutes) {
|
|
200
|
-
const { tsrStartManifest } = await import("../_tanstack-start-manifest_v-
|
|
200
|
+
const { tsrStartManifest } = await import("../_tanstack-start-manifest_v-_KPj4BcN.mjs");
|
|
201
201
|
const startManifest = tsrStartManifest();
|
|
202
202
|
const rootRoute = startManifest.routes[rootRouteId] = startManifest.routes[rootRouteId] || {};
|
|
203
203
|
rootRoute.assets = rootRoute.assets || [];
|
|
@@ -766,7 +766,7 @@ let entriesPromise;
|
|
|
766
766
|
let baseManifestPromise;
|
|
767
767
|
let cachedFinalManifestPromise;
|
|
768
768
|
async function loadEntries() {
|
|
769
|
-
const routerEntry = await import("./router-
|
|
769
|
+
const routerEntry = await import("./router-tRLZo2WT.mjs").then((n) => n.r);
|
|
770
770
|
const startEntry = await import("./start-HYkvq4Ni.mjs");
|
|
771
771
|
return { startEntry, routerEntry };
|
|
772
772
|
}
|
|
@@ -65,7 +65,7 @@ function RootDocument({ children }) {
|
|
|
65
65
|
] })
|
|
66
66
|
] });
|
|
67
67
|
}
|
|
68
|
-
const $$splitComponentImporter = () => import("./index-
|
|
68
|
+
const $$splitComponentImporter = () => import("./index-DAvMem8_.mjs");
|
|
69
69
|
const Route$d = createFileRoute("/")({
|
|
70
70
|
component: lazyRouteComponent($$splitComponentImporter, "component")
|
|
71
71
|
});
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const tsrStartManifest = () => ({ "routes": { "__root__": { "filePath": "C:/Users/claw/workspace/llm-inspector/src/routes/__root.tsx", "children": ["/", "/api/health", "/api/logs", "/api/models", "/api/providers", "/api/sessions", "/proxy/$", "/api/config/paths"], "preloads": ["/assets/main-
|
|
1
|
+
const tsrStartManifest = () => ({ "routes": { "__root__": { "filePath": "C:/Users/claw/workspace/llm-inspector/src/routes/__root.tsx", "children": ["/", "/api/health", "/api/logs", "/api/models", "/api/providers", "/api/sessions", "/proxy/$", "/api/config/paths"], "preloads": ["/assets/main-B3Cmykkm.js"], "assets": [] }, "/": { "filePath": "C:/Users/claw/workspace/llm-inspector/src/routes/index.tsx", "assets": [], "preloads": ["/assets/index-BKkFFKAM.js"] }, "/api/health": { "filePath": "C:/Users/claw/workspace/llm-inspector/src/routes/api/health.ts" }, "/api/logs": { "filePath": "C:/Users/claw/workspace/llm-inspector/src/routes/api/logs.ts", "children": ["/api/logs/$id", "/api/logs/stream"] }, "/api/models": { "filePath": "C:/Users/claw/workspace/llm-inspector/src/routes/api/models.ts" }, "/api/providers": { "filePath": "C:/Users/claw/workspace/llm-inspector/src/routes/api/providers.ts", "children": ["/api/providers/$providerId"] }, "/api/sessions": { "filePath": "C:/Users/claw/workspace/llm-inspector/src/routes/api/sessions.ts" }, "/proxy/$": { "filePath": "C:/Users/claw/workspace/llm-inspector/src/routes/proxy/$.ts" }, "/api/config/paths": { "filePath": "C:/Users/claw/workspace/llm-inspector/src/routes/api/config.paths.ts" }, "/api/logs/$id": { "filePath": "C:/Users/claw/workspace/llm-inspector/src/routes/api/logs.$id.ts", "children": ["/api/logs/$id/chunks", "/api/logs/$id/replay"] }, "/api/logs/stream": { "filePath": "C:/Users/claw/workspace/llm-inspector/src/routes/api/logs.stream.ts" }, "/api/providers/$providerId": { "filePath": "C:/Users/claw/workspace/llm-inspector/src/routes/api/providers.$providerId.ts", "children": ["/api/providers/$providerId/test"] }, "/api/logs/$id/chunks": { "filePath": "C:/Users/claw/workspace/llm-inspector/src/routes/api/logs.$id.chunks.ts" }, "/api/logs/$id/replay": { "filePath": "C:/Users/claw/workspace/llm-inspector/src/routes/api/logs.$id.replay.ts" }, "/api/providers/$providerId/test": { "filePath": "C:/Users/claw/workspace/llm-inspector/src/routes/api/providers.$providerId.test.ts" } }, "clientEntry": "/assets/main-B3Cmykkm.js" });
|
|
2
2
|
export {
|
|
3
3
|
tsrStartManifest
|
|
4
4
|
};
|
package/.output/server/index.mjs
CHANGED
|
@@ -100,51 +100,51 @@ const assets = {
|
|
|
100
100
|
"/assets/alibaba-TTwafVwX.svg": {
|
|
101
101
|
"type": "image/svg+xml",
|
|
102
102
|
"etag": '"171b-6dyV5K8QjiaY35sN9qNprh9zDIs"',
|
|
103
|
-
"mtime": "2026-06-03T11:
|
|
103
|
+
"mtime": "2026-06-03T11:15:10.948Z",
|
|
104
104
|
"size": 5915,
|
|
105
105
|
"path": "../public/assets/alibaba-TTwafVwX.svg"
|
|
106
106
|
},
|
|
107
|
-
"/assets/
|
|
108
|
-
"type": "
|
|
109
|
-
"etag": '"
|
|
110
|
-
"mtime": "2026-06-03T11:
|
|
111
|
-
"size":
|
|
112
|
-
"path": "../public/assets/
|
|
107
|
+
"/assets/index-B3RwBPLW.css": {
|
|
108
|
+
"type": "text/css; charset=utf-8",
|
|
109
|
+
"etag": '"10c74-aXacU4DRFVsUwcC5jHnjoPRSlTA"',
|
|
110
|
+
"mtime": "2026-06-03T11:15:10.948Z",
|
|
111
|
+
"size": 68724,
|
|
112
|
+
"path": "../public/assets/index-B3RwBPLW.css"
|
|
113
113
|
},
|
|
114
114
|
"/assets/minimax-BPMzvuL-.jpeg": {
|
|
115
115
|
"type": "image/jpeg",
|
|
116
116
|
"etag": '"1b06-IwivU89ko5UTMUM1/t7hn4sQK9A"',
|
|
117
|
-
"mtime": "2026-06-03T11:
|
|
117
|
+
"mtime": "2026-06-03T11:15:10.948Z",
|
|
118
118
|
"size": 6918,
|
|
119
119
|
"path": "../public/assets/minimax-BPMzvuL-.jpeg"
|
|
120
120
|
},
|
|
121
|
-
"/assets/main-
|
|
121
|
+
"/assets/main-B3Cmykkm.js": {
|
|
122
122
|
"type": "text/javascript; charset=utf-8",
|
|
123
|
-
"etag": '"4db57-
|
|
124
|
-
"mtime": "2026-06-03T11:
|
|
123
|
+
"etag": '"4db57-BoW6SyNc1bhvI2SIfQuoPlQ7pjU"',
|
|
124
|
+
"mtime": "2026-06-03T11:15:10.950Z",
|
|
125
125
|
"size": 318295,
|
|
126
|
-
"path": "../public/assets/main-
|
|
126
|
+
"path": "../public/assets/main-B3Cmykkm.js"
|
|
127
127
|
},
|
|
128
|
-
"/assets/
|
|
129
|
-
"type": "
|
|
130
|
-
"etag": '"
|
|
131
|
-
"mtime": "2026-06-03T11:
|
|
132
|
-
"size":
|
|
133
|
-
"path": "../public/assets/
|
|
128
|
+
"/assets/zhipuai-BPNAnxo-.svg": {
|
|
129
|
+
"type": "image/svg+xml",
|
|
130
|
+
"etag": '"2bf8-hNaLCTi89nOFCsIIfWpP/jrfo0s"',
|
|
131
|
+
"mtime": "2026-06-03T11:15:10.948Z",
|
|
132
|
+
"size": 11256,
|
|
133
|
+
"path": "../public/assets/zhipuai-BPNAnxo-.svg"
|
|
134
134
|
},
|
|
135
135
|
"/assets/qwen-CONDcHqt.png": {
|
|
136
136
|
"type": "image/png",
|
|
137
137
|
"etag": '"572c3-cdJAPaHdOvFCGzuaQjagdgOu6XE"',
|
|
138
|
-
"mtime": "2026-06-03T11:
|
|
138
|
+
"mtime": "2026-06-03T11:15:10.950Z",
|
|
139
139
|
"size": 357059,
|
|
140
140
|
"path": "../public/assets/qwen-CONDcHqt.png"
|
|
141
141
|
},
|
|
142
|
-
"/assets/index-
|
|
142
|
+
"/assets/index-BKkFFKAM.js": {
|
|
143
143
|
"type": "text/javascript; charset=utf-8",
|
|
144
|
-
"etag": '"
|
|
145
|
-
"mtime": "2026-06-03T11:
|
|
146
|
-
"size":
|
|
147
|
-
"path": "../public/assets/index-
|
|
144
|
+
"etag": '"83213-FJqU+YwY4BQ0ObBCm+z27w3dIRc"',
|
|
145
|
+
"mtime": "2026-06-03T11:15:10.950Z",
|
|
146
|
+
"size": 537107,
|
|
147
|
+
"path": "../public/assets/index-BKkFFKAM.js"
|
|
148
148
|
}
|
|
149
149
|
};
|
|
150
150
|
function readAsset(id) {
|
package/package.json
CHANGED
|
@@ -191,7 +191,8 @@ export function ProvidersPanel(): JSX.Element {
|
|
|
191
191
|
})();
|
|
192
192
|
}
|
|
193
193
|
|
|
194
|
-
if (
|
|
194
|
+
// Only show loading if we have no providers at all (prevents flashing when reopening Settings during test)
|
|
195
|
+
if (isLoading && providers.length === 0) {
|
|
195
196
|
return (
|
|
196
197
|
<div className="flex items-center justify-center py-8">
|
|
197
198
|
<p className="text-sm text-muted-foreground">Loading providers...</p>
|