@tonyclaw/agent-inspector 2.0.36 → 2.0.37
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/{CompareDrawer-Bg2mo0NZ.js → CompareDrawer-nEHCEVP4.js} +1 -1
- package/.output/public/assets/{ProxyViewerContainer-C_Lq5T5V.js → ProxyViewerContainer-BstBIX2B.js} +35 -35
- package/.output/public/assets/{ReplayDialog-Bns-ayOg.js → ReplayDialog-CUnBdt1Q.js} +1 -1
- package/.output/public/assets/{RequestAnatomy-BBcPAIWx.js → RequestAnatomy-BU9VT2Sw.js} +1 -1
- package/.output/public/assets/{ResponseView-DSRS3rHt.js → ResponseView-amxuKPKY.js} +1 -1
- package/.output/public/assets/{StreamingChunkSequence-CzZxKE5-.js → StreamingChunkSequence-DpscrQM2.js} +1 -1
- package/.output/public/assets/_sessionId-7c9bsOFT.js +1 -0
- package/.output/public/assets/index-B7a5OmIO.js +1 -0
- package/.output/public/assets/{main-BVKRHBUl.js → main-D56QvEyw.js} +2 -2
- package/.output/server/_libs/lucide-react.mjs +114 -94
- package/.output/server/{_sessionId-Dsd36Yhc.mjs → _sessionId-ChwEDyI4.mjs} +2 -2
- package/.output/server/_ssr/{CompareDrawer-BbJ5UdYD.mjs → CompareDrawer-Ce2590rK.mjs} +3 -3
- package/.output/server/_ssr/{ProxyViewerContainer-7igCY291.mjs → ProxyViewerContainer-D6xM8A0S.mjs} +797 -781
- package/.output/server/_ssr/{ReplayDialog-CgWweshq.mjs → ReplayDialog-CB4KOlLe.mjs} +4 -4
- package/.output/server/_ssr/{RequestAnatomy-BAyM_j7a.mjs → RequestAnatomy-CsWV3W03.mjs} +3 -3
- package/.output/server/_ssr/{ResponseView-iZQH7EYu.mjs → ResponseView-BuCCV3LU.mjs} +3 -3
- package/.output/server/_ssr/{StreamingChunkSequence-BU6hyHMg.mjs → StreamingChunkSequence-C5dE7V1d.mjs} +2 -2
- package/.output/server/_ssr/{index-D7QF4E6v.mjs → index-BeIi0CPv.mjs} +2 -2
- package/.output/server/_ssr/index.mjs +2 -2
- package/.output/server/_ssr/{router-DLLY6gv_.mjs → router-Ca2MCyUX.mjs} +78 -71
- package/.output/server/{_tanstack-start-manifest_v-CHmIZaVV.mjs → _tanstack-start-manifest_v-CBAJfSAX.mjs} +1 -1
- package/.output/server/index.mjs +60 -60
- package/package.json +1 -1
- package/src/components/ProxyViewer.tsx +42 -8
- package/src/components/proxy-viewer/ConversationHeader.tsx +10 -6
- package/src/proxy/formats/registry.ts +7 -1
- package/src/proxy/store.ts +14 -11
- package/.output/public/assets/_sessionId-DurHDwM1.js +0 -1
- package/.output/public/assets/index-sGphugFR.js +0 -1
package/.output/public/assets/{ProxyViewerContainer-C_Lq5T5V.js → ProxyViewerContainer-BstBIX2B.js}
RENAMED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/CompareDrawer-
|
|
2
|
-
import{u as Vr,a as zd,r as x,j as a,c as no,g as ka,b as Zr,d as ut,e as Rd,f as nx,h as Pd,_ as In}from"./main-BVKRHBUl.js";function re(e,t,n){function r(l,c){if(l._zod||Object.defineProperty(l,"_zod",{value:{def:c,constr:i,traits:new Set},enumerable:!1}),l._zod.traits.has(e))return;l._zod.traits.add(e),t(l,c);const u=i.prototype,d=Object.keys(u);for(let f=0;f<d.length;f++){const h=d[f];h in l||(l[h]=u[h].bind(l))}}const o=n?.Parent??Object;class s extends o{}Object.defineProperty(s,"name",{value:e});function i(l){var c;const u=n?.Parent?new s:this;r(u,l),(c=u._zod).deferred??(c.deferred=[]);for(const d of u._zod.deferred)d();return u}return Object.defineProperty(i,"init",{value:r}),Object.defineProperty(i,Symbol.hasInstance,{value:l=>n?.Parent&&l instanceof n.Parent?!0:l?._zod?.traits?.has(e)}),Object.defineProperty(i,"name",{value:e}),i}class Gn extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class Od extends Error{constructor(t){super(`Encountered unidirectional transform during encode: ${t}`),this.name="ZodEncodeError"}}const Md={};function fn(e){return Md}function Ld(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 ji(e,t){return typeof t=="bigint"?t.toString():t}function is(e){return{get value(){{const t=e();return Object.defineProperty(this,"value",{value:t}),t}}}}function _a(e){return e==null}function Sa(e){const t=e.startsWith("^")?1:0,n=e.endsWith("$")?e.length-1:e.length;return e.slice(t,n)}function rx(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 c=r.match(/\d?e-(\d?)/);c?.[1]&&(o=Number.parseInt(c[1]))}const s=n>o?n:o,i=Number.parseInt(e.toFixed(s).replace(".","")),l=Number.parseInt(t.toFixed(s).replace(".",""));return i%l/10**s}const Ul=Symbol("evaluating");function ze(e,t,n){let r;Object.defineProperty(e,t,{get(){if(r!==Ul)return r===void 0&&(r=Ul,r=n()),r},set(o){Object.defineProperty(e,t,{value:o})},configurable:!0})}function zn(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function xn(...e){const t={};for(const n of e){const r=Object.getOwnPropertyDescriptors(n);Object.assign(t,r)}return Object.defineProperties({},t)}function Wl(e){return JSON.stringify(e)}function ox(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}const Dd="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function Pr(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}const sx=is(()=>{if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{const e=Function;return new e(""),!0}catch{return!1}});function nr(e){if(Pr(e)===!1)return!1;const t=e.constructor;if(t===void 0||typeof t!="function")return!0;const n=t.prototype;return!(Pr(n)===!1||Object.prototype.hasOwnProperty.call(n,"isPrototypeOf")===!1)}function Fd(e){return nr(e)?{...e}:Array.isArray(e)?[...e]:e}const ix=new Set(["string","number","symbol"]);function rr(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function bn(e,t,n){const r=new e._zod.constr(t??e._zod.def);return(!t||n?.parent)&&(r._zod.parent=e),r}function ke(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 ax(e){return Object.keys(e).filter(t=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}const lx={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 cx(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 s=xn(e._zod.def,{get shape(){const i={};for(const l in t){if(!(l in n.shape))throw new Error(`Unrecognized key: "${l}"`);t[l]&&(i[l]=n.shape[l])}return zn(this,"shape",i),i},checks:[]});return bn(e,s)}function ux(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 s=xn(e._zod.def,{get shape(){const i={...e._zod.def.shape};for(const l in t){if(!(l in n.shape))throw new Error(`Unrecognized key: "${l}"`);t[l]&&delete i[l]}return zn(this,"shape",i),i},checks:[]});return bn(e,s)}function dx(e,t){if(!nr(t))throw new Error("Invalid input to extend: expected a plain object");const n=e._zod.def.checks;if(n&&n.length>0){const s=e._zod.def.shape;for(const i in t)if(Object.getOwnPropertyDescriptor(s,i)!==void 0)throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}const o=xn(e._zod.def,{get shape(){const s={...e._zod.def.shape,...t};return zn(this,"shape",s),s}});return bn(e,o)}function fx(e,t){if(!nr(t))throw new Error("Invalid input to safeExtend: expected a plain object");const n=xn(e._zod.def,{get shape(){const r={...e._zod.def.shape,...t};return zn(this,"shape",r),r}});return bn(e,n)}function px(e,t){const n=xn(e._zod.def,{get shape(){const r={...e._zod.def.shape,...t._zod.def.shape};return zn(this,"shape",r),r},get catchall(){return t._zod.def.catchall},checks:[]});return bn(e,n)}function hx(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 i=xn(t._zod.def,{get shape(){const l=t._zod.def.shape,c={...l};if(n)for(const u in n){if(!(u in l))throw new Error(`Unrecognized key: "${u}"`);n[u]&&(c[u]=e?new e({type:"optional",innerType:l[u]}):l[u])}else for(const u in l)c[u]=e?new e({type:"optional",innerType:l[u]}):l[u];return zn(this,"shape",c),c},checks:[]});return bn(t,i)}function mx(e,t,n){const r=xn(t._zod.def,{get shape(){const o=t._zod.def.shape,s={...o};if(n)for(const i in n){if(!(i in s))throw new Error(`Unrecognized key: "${i}"`);n[i]&&(s[i]=new e({type:"nonoptional",innerType:o[i]}))}else for(const i in o)s[i]=new e({type:"nonoptional",innerType:o[i]});return zn(this,"shape",s),s}});return bn(t,r)}function qn(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 Kn(e,t){return t.map(n=>{var r;return(r=n).path??(r.path=[]),n.path.unshift(e),n})}function ro(e){return typeof e=="string"?e:e?.message}function pn(e,t,n){const r={...e,path:e.path??[]};if(!e.message){const o=ro(e.inst?._zod.def?.error?.(e))??ro(t?.error?.(e))??ro(n.customError?.(e))??ro(n.localeError?.(e))??"Invalid input";r.message=o}return delete r.inst,delete r.continue,t?.reportInput||delete r.input,r}function Ca(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 $d=(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,ji,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},Bd=re("$ZodError",$d),Ud=re("$ZodError",$d,{Parent:Error});function gx(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 xx(e,t=n=>n.message){const n={_errors:[]},r=o=>{for(const s of o.issues)if(s.code==="invalid_union"&&s.errors.length)s.errors.map(i=>r({issues:i}));else if(s.code==="invalid_key")r({issues:s.issues});else if(s.code==="invalid_element")r({issues:s.issues});else if(s.path.length===0)n._errors.push(t(s));else{let i=n,l=0;for(;l<s.path.length;){const c=s.path[l];l===s.path.length-1?(i[c]=i[c]||{_errors:[]},i[c]._errors.push(t(s))):i[c]=i[c]||{_errors:[]},i=i[c],l++}}};return r(e),n}const ja=e=>(t,n,r,o)=>{const s=r?Object.assign(r,{async:!1}):{async:!1},i=t._zod.run({value:n,issues:[]},s);if(i instanceof Promise)throw new Gn;if(i.issues.length){const l=new(o?.Err??e)(i.issues.map(c=>pn(c,s,fn())));throw Dd(l,o?.callee),l}return i.value},Na=e=>async(t,n,r,o)=>{const s=r?Object.assign(r,{async:!0}):{async:!0};let i=t._zod.run({value:n,issues:[]},s);if(i instanceof Promise&&(i=await i),i.issues.length){const l=new(o?.Err??e)(i.issues.map(c=>pn(c,s,fn())));throw Dd(l,o?.callee),l}return i.value},as=e=>(t,n,r)=>{const o=r?{...r,async:!1}:{async:!1},s=t._zod.run({value:n,issues:[]},o);if(s instanceof Promise)throw new Gn;return s.issues.length?{success:!1,error:new(e??Bd)(s.issues.map(i=>pn(i,o,fn())))}:{success:!0,data:s.value}},bx=as(Ud),ls=e=>async(t,n,r)=>{const o=r?Object.assign(r,{async:!0}):{async:!0};let s=t._zod.run({value:n,issues:[]},o);return s instanceof Promise&&(s=await s),s.issues.length?{success:!1,error:new e(s.issues.map(i=>pn(i,o,fn())))}:{success:!0,data:s.value}},yx=ls(Ud),vx=e=>(t,n,r)=>{const o=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return ja(e)(t,n,o)},wx=e=>(t,n,r)=>ja(e)(t,n,r),kx=e=>async(t,n,r)=>{const o=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return Na(e)(t,n,o)},_x=e=>async(t,n,r)=>Na(e)(t,n,r),Sx=e=>(t,n,r)=>{const o=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return as(e)(t,n,o)},Cx=e=>(t,n,r)=>as(e)(t,n,r),jx=e=>async(t,n,r)=>{const o=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return ls(e)(t,n,o)},Nx=e=>async(t,n,r)=>ls(e)(t,n,r),Ex=/^[cC][^\s-]{8,}$/,Tx=/^[0-9a-z]+$/,Ax=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,Ix=/^[0-9a-vA-V]{20}$/,zx=/^[A-Za-z0-9]{27}$/,Rx=/^[a-zA-Z0-9_-]{21}$/,Px=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,Ox=/^([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})$/,Hl=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)$/,Mx=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,Lx="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function Dx(){return new RegExp(Lx,"u")}const Fx=/^(?:(?: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])$/,$x=/^(([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}|:))$/,Bx=/^((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])$/,Ux=/^(([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])$/,Wx=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,Wd=/^[A-Za-z0-9_-]*$/,Hx=/^\+[1-9]\d{6,14}$/,Hd="(?:(?:\\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])))",Vx=new RegExp(`^${Hd}$`);function Vd(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 Zx(e){return new RegExp(`^${Vd(e)}$`)}function qx(e){const t=Vd({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(`^${Hd}T(?:${r})$`)}const Kx=e=>{const t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${t}$`)},Gx=/^-?\d+$/,Zd=/^-?\d+(?:\.\d+)?$/,Jx=/^(?:true|false)$/i,Yx=/^null$/i,Xx=/^[^A-Z]*$/,Qx=/^[^a-z]*$/,pt=re("$ZodCheck",(e,t)=>{var n;e._zod??(e._zod={}),e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),qd={number:"number",bigint:"bigint",object:"date"},Kd=re("$ZodCheckLessThan",(e,t)=>{pt.init(e,t);const n=qd[typeof t.value];e._zod.onattach.push(r=>{const o=r._zod.bag,s=(t.inclusive?o.maximum:o.exclusiveMaximum)??Number.POSITIVE_INFINITY;t.value<s&&(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})}}),Gd=re("$ZodCheckGreaterThan",(e,t)=>{pt.init(e,t);const n=qd[typeof t.value];e._zod.onattach.push(r=>{const o=r._zod.bag,s=(t.inclusive?o.minimum:o.exclusiveMinimum)??Number.NEGATIVE_INFINITY;t.value>s&&(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})}}),e0=re("$ZodCheckMultipleOf",(e,t)=>{pt.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):rx(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})}}),t0=re("$ZodCheckNumberFormat",(e,t)=>{pt.init(e,t),t.format=t.format||"float64";const n=t.format?.includes("int"),r=n?"int":"number",[o,s]=lx[t.format];e._zod.onattach.push(i=>{const l=i._zod.bag;l.format=t.format,l.minimum=o,l.maximum=s,n&&(l.pattern=Gx)}),e._zod.check=i=>{const l=i.value;if(n){if(!Number.isInteger(l)){i.issues.push({expected:r,format:t.format,code:"invalid_type",continue:!1,input:l,inst:e});return}if(!Number.isSafeInteger(l)){l>0?i.issues.push({input:l,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}):i.issues.push({input:l,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}}l<o&&i.issues.push({origin:"number",input:l,code:"too_small",minimum:o,inclusive:!0,inst:e,continue:!t.abort}),l>s&&i.issues.push({origin:"number",input:l,code:"too_big",maximum:s,inclusive:!0,inst:e,continue:!t.abort})}}),n0=re("$ZodCheckMaxLength",(e,t)=>{var n;pt.init(e,t),(n=e._zod.def).when??(n.when=r=>{const o=r.value;return!_a(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 i=Ca(o);r.issues.push({origin:i,code:"too_big",maximum:t.maximum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),r0=re("$ZodCheckMinLength",(e,t)=>{var n;pt.init(e,t),(n=e._zod.def).when??(n.when=r=>{const o=r.value;return!_a(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 i=Ca(o);r.issues.push({origin:i,code:"too_small",minimum:t.minimum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),o0=re("$ZodCheckLengthEquals",(e,t)=>{var n;pt.init(e,t),(n=e._zod.def).when??(n.when=r=>{const o=r.value;return!_a(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,s=o.length;if(s===t.length)return;const i=Ca(o),l=s>t.length;r.issues.push({origin:i,...l?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:r.value,inst:e,continue:!t.abort})}}),cs=re("$ZodCheckStringFormat",(e,t)=>{var n,r;pt.init(e,t),e._zod.onattach.push(o=>{const s=o._zod.bag;s.format=t.format,t.pattern&&(s.patterns??(s.patterns=new Set),s.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=()=>{})}),s0=re("$ZodCheckRegex",(e,t)=>{cs.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})}}),i0=re("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=Xx),cs.init(e,t)}),a0=re("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=Qx),cs.init(e,t)}),l0=re("$ZodCheckIncludes",(e,t)=>{pt.init(e,t);const n=rr(t.includes),r=new RegExp(typeof t.position=="number"?`^.{${t.position}}${n}`:n);t.pattern=r,e._zod.onattach.push(o=>{const s=o._zod.bag;s.patterns??(s.patterns=new Set),s.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})}}),c0=re("$ZodCheckStartsWith",(e,t)=>{pt.init(e,t);const n=new RegExp(`^${rr(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})}}),u0=re("$ZodCheckEndsWith",(e,t)=>{pt.init(e,t);const n=new RegExp(`.*${rr(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})}}),d0=re("$ZodCheckOverwrite",(e,t)=>{pt.init(e,t),e._zod.check=n=>{n.value=t.tx(n.value)}});class f0{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
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/CompareDrawer-nEHCEVP4.js","assets/main-D56QvEyw.js","assets/ReplayDialog-CUnBdt1Q.js","assets/ResponseView-amxuKPKY.js","assets/RequestAnatomy-BU9VT2Sw.js","assets/StreamingChunkSequence-DpscrQM2.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{u as Hr,a as zd,r as x,j as a,c as no,g as ka,b as Zr,d as ut,e as Rd,f as nx,h as Pd,_ as zn}from"./main-D56QvEyw.js";function oe(e,t,n){function r(l,c){if(l._zod||Object.defineProperty(l,"_zod",{value:{def:c,constr:i,traits:new Set},enumerable:!1}),l._zod.traits.has(e))return;l._zod.traits.add(e),t(l,c);const u=i.prototype,d=Object.keys(u);for(let f=0;f<d.length;f++){const h=d[f];h in l||(l[h]=u[h].bind(l))}}const o=n?.Parent??Object;class s extends o{}Object.defineProperty(s,"name",{value:e});function i(l){var c;const u=n?.Parent?new s:this;r(u,l),(c=u._zod).deferred??(c.deferred=[]);for(const d of u._zod.deferred)d();return u}return Object.defineProperty(i,"init",{value:r}),Object.defineProperty(i,Symbol.hasInstance,{value:l=>n?.Parent&&l instanceof n.Parent?!0:l?._zod?.traits?.has(e)}),Object.defineProperty(i,"name",{value:e}),i}class Jn extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class Od extends Error{constructor(t){super(`Encountered unidirectional transform during encode: ${t}`),this.name="ZodEncodeError"}}const Md={};function fn(e){return Md}function Ld(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 ji(e,t){return typeof t=="bigint"?t.toString():t}function is(e){return{get value(){{const t=e();return Object.defineProperty(this,"value",{value:t}),t}}}}function _a(e){return e==null}function Sa(e){const t=e.startsWith("^")?1:0,n=e.endsWith("$")?e.length-1:e.length;return e.slice(t,n)}function rx(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 c=r.match(/\d?e-(\d?)/);c?.[1]&&(o=Number.parseInt(c[1]))}const s=n>o?n:o,i=Number.parseInt(e.toFixed(s).replace(".","")),l=Number.parseInt(t.toFixed(s).replace(".",""));return i%l/10**s}const Ul=Symbol("evaluating");function ze(e,t,n){let r;Object.defineProperty(e,t,{get(){if(r!==Ul)return r===void 0&&(r=Ul,r=n()),r},set(o){Object.defineProperty(e,t,{value:o})},configurable:!0})}function Rn(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function xn(...e){const t={};for(const n of e){const r=Object.getOwnPropertyDescriptors(n);Object.assign(t,r)}return Object.defineProperties({},t)}function Wl(e){return JSON.stringify(e)}function ox(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}const Dd="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function Mr(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}const sx=is(()=>{if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{const e=Function;return new e(""),!0}catch{return!1}});function rr(e){if(Mr(e)===!1)return!1;const t=e.constructor;if(t===void 0||typeof t!="function")return!0;const n=t.prototype;return!(Mr(n)===!1||Object.prototype.hasOwnProperty.call(n,"isPrototypeOf")===!1)}function Fd(e){return rr(e)?{...e}:Array.isArray(e)?[...e]:e}const ix=new Set(["string","number","symbol"]);function or(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function bn(e,t,n){const r=new e._zod.constr(t??e._zod.def);return(!t||n?.parent)&&(r._zod.parent=e),r}function ke(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 ax(e){return Object.keys(e).filter(t=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}const lx={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 cx(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 s=xn(e._zod.def,{get shape(){const i={};for(const l in t){if(!(l in n.shape))throw new Error(`Unrecognized key: "${l}"`);t[l]&&(i[l]=n.shape[l])}return Rn(this,"shape",i),i},checks:[]});return bn(e,s)}function ux(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 s=xn(e._zod.def,{get shape(){const i={...e._zod.def.shape};for(const l in t){if(!(l in n.shape))throw new Error(`Unrecognized key: "${l}"`);t[l]&&delete i[l]}return Rn(this,"shape",i),i},checks:[]});return bn(e,s)}function dx(e,t){if(!rr(t))throw new Error("Invalid input to extend: expected a plain object");const n=e._zod.def.checks;if(n&&n.length>0){const s=e._zod.def.shape;for(const i in t)if(Object.getOwnPropertyDescriptor(s,i)!==void 0)throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}const o=xn(e._zod.def,{get shape(){const s={...e._zod.def.shape,...t};return Rn(this,"shape",s),s}});return bn(e,o)}function fx(e,t){if(!rr(t))throw new Error("Invalid input to safeExtend: expected a plain object");const n=xn(e._zod.def,{get shape(){const r={...e._zod.def.shape,...t};return Rn(this,"shape",r),r}});return bn(e,n)}function px(e,t){const n=xn(e._zod.def,{get shape(){const r={...e._zod.def.shape,...t._zod.def.shape};return Rn(this,"shape",r),r},get catchall(){return t._zod.def.catchall},checks:[]});return bn(e,n)}function hx(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 i=xn(t._zod.def,{get shape(){const l=t._zod.def.shape,c={...l};if(n)for(const u in n){if(!(u in l))throw new Error(`Unrecognized key: "${u}"`);n[u]&&(c[u]=e?new e({type:"optional",innerType:l[u]}):l[u])}else for(const u in l)c[u]=e?new e({type:"optional",innerType:l[u]}):l[u];return Rn(this,"shape",c),c},checks:[]});return bn(t,i)}function mx(e,t,n){const r=xn(t._zod.def,{get shape(){const o=t._zod.def.shape,s={...o};if(n)for(const i in n){if(!(i in s))throw new Error(`Unrecognized key: "${i}"`);n[i]&&(s[i]=new e({type:"nonoptional",innerType:o[i]}))}else for(const i in o)s[i]=new e({type:"nonoptional",innerType:o[i]});return Rn(this,"shape",s),s}});return bn(t,r)}function Kn(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 Gn(e,t){return t.map(n=>{var r;return(r=n).path??(r.path=[]),n.path.unshift(e),n})}function ro(e){return typeof e=="string"?e:e?.message}function pn(e,t,n){const r={...e,path:e.path??[]};if(!e.message){const o=ro(e.inst?._zod.def?.error?.(e))??ro(t?.error?.(e))??ro(n.customError?.(e))??ro(n.localeError?.(e))??"Invalid input";r.message=o}return delete r.inst,delete r.continue,t?.reportInput||delete r.input,r}function Ca(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}function Lr(...e){const[t,n,r]=e;return typeof t=="string"?{message:t,code:"custom",input:n,inst:r}:{...t}}const $d=(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,ji,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},Bd=oe("$ZodError",$d),Ud=oe("$ZodError",$d,{Parent:Error});function gx(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 xx(e,t=n=>n.message){const n={_errors:[]},r=o=>{for(const s of o.issues)if(s.code==="invalid_union"&&s.errors.length)s.errors.map(i=>r({issues:i}));else if(s.code==="invalid_key")r({issues:s.issues});else if(s.code==="invalid_element")r({issues:s.issues});else if(s.path.length===0)n._errors.push(t(s));else{let i=n,l=0;for(;l<s.path.length;){const c=s.path[l];l===s.path.length-1?(i[c]=i[c]||{_errors:[]},i[c]._errors.push(t(s))):i[c]=i[c]||{_errors:[]},i=i[c],l++}}};return r(e),n}const ja=e=>(t,n,r,o)=>{const s=r?Object.assign(r,{async:!1}):{async:!1},i=t._zod.run({value:n,issues:[]},s);if(i instanceof Promise)throw new Jn;if(i.issues.length){const l=new(o?.Err??e)(i.issues.map(c=>pn(c,s,fn())));throw Dd(l,o?.callee),l}return i.value},Na=e=>async(t,n,r,o)=>{const s=r?Object.assign(r,{async:!0}):{async:!0};let i=t._zod.run({value:n,issues:[]},s);if(i instanceof Promise&&(i=await i),i.issues.length){const l=new(o?.Err??e)(i.issues.map(c=>pn(c,s,fn())));throw Dd(l,o?.callee),l}return i.value},as=e=>(t,n,r)=>{const o=r?{...r,async:!1}:{async:!1},s=t._zod.run({value:n,issues:[]},o);if(s instanceof Promise)throw new Jn;return s.issues.length?{success:!1,error:new(e??Bd)(s.issues.map(i=>pn(i,o,fn())))}:{success:!0,data:s.value}},bx=as(Ud),ls=e=>async(t,n,r)=>{const o=r?Object.assign(r,{async:!0}):{async:!0};let s=t._zod.run({value:n,issues:[]},o);return s instanceof Promise&&(s=await s),s.issues.length?{success:!1,error:new e(s.issues.map(i=>pn(i,o,fn())))}:{success:!0,data:s.value}},yx=ls(Ud),vx=e=>(t,n,r)=>{const o=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return ja(e)(t,n,o)},wx=e=>(t,n,r)=>ja(e)(t,n,r),kx=e=>async(t,n,r)=>{const o=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return Na(e)(t,n,o)},_x=e=>async(t,n,r)=>Na(e)(t,n,r),Sx=e=>(t,n,r)=>{const o=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return as(e)(t,n,o)},Cx=e=>(t,n,r)=>as(e)(t,n,r),jx=e=>async(t,n,r)=>{const o=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return ls(e)(t,n,o)},Nx=e=>async(t,n,r)=>ls(e)(t,n,r),Ex=/^[cC][^\s-]{8,}$/,Tx=/^[0-9a-z]+$/,Ax=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,Ix=/^[0-9a-vA-V]{20}$/,zx=/^[A-Za-z0-9]{27}$/,Rx=/^[a-zA-Z0-9_-]{21}$/,Px=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,Ox=/^([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})$/,Vl=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)$/,Mx=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,Lx="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function Dx(){return new RegExp(Lx,"u")}const Fx=/^(?:(?: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])$/,$x=/^(([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}|:))$/,Bx=/^((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])$/,Ux=/^(([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])$/,Wx=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,Wd=/^[A-Za-z0-9_-]*$/,Vx=/^\+[1-9]\d{6,14}$/,Vd="(?:(?:\\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])))",Hx=new RegExp(`^${Vd}$`);function Hd(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 Zx(e){return new RegExp(`^${Hd(e)}$`)}function qx(e){const t=Hd({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(`^${Vd}T(?:${r})$`)}const Kx=e=>{const t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${t}$`)},Gx=/^-?\d+$/,Zd=/^-?\d+(?:\.\d+)?$/,Jx=/^(?:true|false)$/i,Yx=/^null$/i,Xx=/^[^A-Z]*$/,Qx=/^[^a-z]*$/,pt=oe("$ZodCheck",(e,t)=>{var n;e._zod??(e._zod={}),e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),qd={number:"number",bigint:"bigint",object:"date"},Kd=oe("$ZodCheckLessThan",(e,t)=>{pt.init(e,t);const n=qd[typeof t.value];e._zod.onattach.push(r=>{const o=r._zod.bag,s=(t.inclusive?o.maximum:o.exclusiveMaximum)??Number.POSITIVE_INFINITY;t.value<s&&(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})}}),Gd=oe("$ZodCheckGreaterThan",(e,t)=>{pt.init(e,t);const n=qd[typeof t.value];e._zod.onattach.push(r=>{const o=r._zod.bag,s=(t.inclusive?o.minimum:o.exclusiveMinimum)??Number.NEGATIVE_INFINITY;t.value>s&&(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})}}),e0=oe("$ZodCheckMultipleOf",(e,t)=>{pt.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):rx(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})}}),t0=oe("$ZodCheckNumberFormat",(e,t)=>{pt.init(e,t),t.format=t.format||"float64";const n=t.format?.includes("int"),r=n?"int":"number",[o,s]=lx[t.format];e._zod.onattach.push(i=>{const l=i._zod.bag;l.format=t.format,l.minimum=o,l.maximum=s,n&&(l.pattern=Gx)}),e._zod.check=i=>{const l=i.value;if(n){if(!Number.isInteger(l)){i.issues.push({expected:r,format:t.format,code:"invalid_type",continue:!1,input:l,inst:e});return}if(!Number.isSafeInteger(l)){l>0?i.issues.push({input:l,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}):i.issues.push({input:l,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}}l<o&&i.issues.push({origin:"number",input:l,code:"too_small",minimum:o,inclusive:!0,inst:e,continue:!t.abort}),l>s&&i.issues.push({origin:"number",input:l,code:"too_big",maximum:s,inclusive:!0,inst:e,continue:!t.abort})}}),n0=oe("$ZodCheckMaxLength",(e,t)=>{var n;pt.init(e,t),(n=e._zod.def).when??(n.when=r=>{const o=r.value;return!_a(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 i=Ca(o);r.issues.push({origin:i,code:"too_big",maximum:t.maximum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),r0=oe("$ZodCheckMinLength",(e,t)=>{var n;pt.init(e,t),(n=e._zod.def).when??(n.when=r=>{const o=r.value;return!_a(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 i=Ca(o);r.issues.push({origin:i,code:"too_small",minimum:t.minimum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),o0=oe("$ZodCheckLengthEquals",(e,t)=>{var n;pt.init(e,t),(n=e._zod.def).when??(n.when=r=>{const o=r.value;return!_a(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,s=o.length;if(s===t.length)return;const i=Ca(o),l=s>t.length;r.issues.push({origin:i,...l?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:r.value,inst:e,continue:!t.abort})}}),cs=oe("$ZodCheckStringFormat",(e,t)=>{var n,r;pt.init(e,t),e._zod.onattach.push(o=>{const s=o._zod.bag;s.format=t.format,t.pattern&&(s.patterns??(s.patterns=new Set),s.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=()=>{})}),s0=oe("$ZodCheckRegex",(e,t)=>{cs.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})}}),i0=oe("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=Xx),cs.init(e,t)}),a0=oe("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=Qx),cs.init(e,t)}),l0=oe("$ZodCheckIncludes",(e,t)=>{pt.init(e,t);const n=or(t.includes),r=new RegExp(typeof t.position=="number"?`^.{${t.position}}${n}`:n);t.pattern=r,e._zod.onattach.push(o=>{const s=o._zod.bag;s.patterns??(s.patterns=new Set),s.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})}}),c0=oe("$ZodCheckStartsWith",(e,t)=>{pt.init(e,t);const n=new RegExp(`^${or(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})}}),u0=oe("$ZodCheckEndsWith",(e,t)=>{pt.init(e,t);const n=new RegExp(`.*${or(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})}}),d0=oe("$ZodCheckOverwrite",(e,t)=>{pt.init(e,t),e._zod.check=n=>{n.value=t.tx(n.value)}});class f0{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(`
|
|
3
3
|
`).filter(i=>i),o=Math.min(...r.map(i=>i.length-i.trimStart().length)),s=r.map(i=>i.slice(o)).map(i=>" ".repeat(this.indent*2)+i);for(const i of s)this.content.push(i)}compile(){const t=Function,n=this?.args,o=[...(this?.content??[""]).map(s=>` ${s}`)];return new t(...n,o.join(`
|
|
4
|
-
`))}}const p0={major:4,minor:3,patch:6},qe=
|
|
4
|
+
`))}}const p0={major:4,minor:3,patch:6},qe=oe("$ZodType",(e,t)=>{var n;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=p0;const r=[...e._zod.def.checks??[]];e._zod.traits.has("$ZodCheck")&&r.unshift(e);for(const o of r)for(const s of o._zod.onattach)s(e);if(r.length===0)(n=e._zod).deferred??(n.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{const o=(i,l,c)=>{let u=Kn(i),d;for(const f of l){if(f._zod.def.when){if(!f._zod.def.when(i))continue}else if(u)continue;const h=i.issues.length,p=f._zod.check(i);if(p instanceof Promise&&c?.async===!1)throw new Jn;if(d||p instanceof Promise)d=(d??Promise.resolve()).then(async()=>{await p,i.issues.length!==h&&(u||(u=Kn(i,h)))});else{if(i.issues.length===h)continue;u||(u=Kn(i,h))}}return d?d.then(()=>i):i},s=(i,l,c)=>{if(Kn(i))return i.aborted=!0,i;const u=o(l,r,c);if(u instanceof Promise){if(c.async===!1)throw new Jn;return u.then(d=>e._zod.parse(d,c))}return e._zod.parse(u,c)};e._zod.run=(i,l)=>{if(l.skipChecks)return e._zod.parse(i,l);if(l.direction==="backward"){const u=e._zod.parse({value:i.value,issues:[]},{...l,skipChecks:!0});return u instanceof Promise?u.then(d=>s(d,i,l)):s(u,i,l)}const c=e._zod.parse(i,l);if(c instanceof Promise){if(l.async===!1)throw new Jn;return c.then(u=>o(u,r,l))}return o(c,r,l)}}ze(e,"~standard",()=>({validate:o=>{try{const s=bx(e,o);return s.success?{value:s.data}:{issues:s.error?.issues}}catch{return yx(e,o).then(i=>i.success?{value:i.data}:{issues:i.error?.issues})}},vendor:"zod",version:1}))}),Ea=oe("$ZodString",(e,t)=>{qe.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??Kx(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}}),Ge=oe("$ZodStringFormat",(e,t)=>{cs.init(e,t),Ea.init(e,t)}),h0=oe("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=Ox),Ge.init(e,t)}),m0=oe("$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=Vl(r))}else t.pattern??(t.pattern=Vl());Ge.init(e,t)}),g0=oe("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=Mx),Ge.init(e,t)}),x0=oe("$ZodURL",(e,t)=>{Ge.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})}}}),b0=oe("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=Dx()),Ge.init(e,t)}),y0=oe("$ZodNanoID",(e,t)=>{t.pattern??(t.pattern=Rx),Ge.init(e,t)}),v0=oe("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=Ex),Ge.init(e,t)}),w0=oe("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=Tx),Ge.init(e,t)}),k0=oe("$ZodULID",(e,t)=>{t.pattern??(t.pattern=Ax),Ge.init(e,t)}),_0=oe("$ZodXID",(e,t)=>{t.pattern??(t.pattern=Ix),Ge.init(e,t)}),S0=oe("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=zx),Ge.init(e,t)}),C0=oe("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=qx(t)),Ge.init(e,t)}),j0=oe("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=Hx),Ge.init(e,t)}),N0=oe("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=Zx(t)),Ge.init(e,t)}),E0=oe("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=Px),Ge.init(e,t)}),T0=oe("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=Fx),Ge.init(e,t),e._zod.bag.format="ipv4"}),A0=oe("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=$x),Ge.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})}}}),I0=oe("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=Bx),Ge.init(e,t)}),z0=oe("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=Ux),Ge.init(e,t),e._zod.check=n=>{const r=n.value.split("/");try{if(r.length!==2)throw new Error;const[o,s]=r;if(!s)throw new Error;const i=Number(s);if(`${i}`!==s)throw new Error;if(i<0||i>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 Jd(e){if(e==="")return!0;if(e.length%4!==0)return!1;try{return atob(e),!0}catch{return!1}}const R0=oe("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=Wx),Ge.init(e,t),e._zod.bag.contentEncoding="base64",e._zod.check=n=>{Jd(n.value)||n.issues.push({code:"invalid_format",format:"base64",input:n.value,inst:e,continue:!t.abort})}});function P0(e){if(!Wd.test(e))return!1;const t=e.replace(/[-_]/g,r=>r==="-"?"+":"/"),n=t.padEnd(Math.ceil(t.length/4)*4,"=");return Jd(n)}const O0=oe("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=Wd),Ge.init(e,t),e._zod.bag.contentEncoding="base64url",e._zod.check=n=>{P0(n.value)||n.issues.push({code:"invalid_format",format:"base64url",input:n.value,inst:e,continue:!t.abort})}}),M0=oe("$ZodE164",(e,t)=>{t.pattern??(t.pattern=Vx),Ge.init(e,t)});function L0(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 D0=oe("$ZodJWT",(e,t)=>{Ge.init(e,t),e._zod.check=n=>{L0(n.value,t.alg)||n.issues.push({code:"invalid_format",format:"jwt",input:n.value,inst:e,continue:!t.abort})}}),Yd=oe("$ZodNumber",(e,t)=>{qe.init(e,t),e._zod.pattern=e._zod.bag.pattern??Zd,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 s=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,...s?{received:s}:{}}),n}}),F0=oe("$ZodNumberFormat",(e,t)=>{t0.init(e,t),Yd.init(e,t)}),$0=oe("$ZodBoolean",(e,t)=>{qe.init(e,t),e._zod.pattern=Jx,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}}),B0=oe("$ZodNull",(e,t)=>{qe.init(e,t),e._zod.pattern=Yx,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}}),U0=oe("$ZodUnknown",(e,t)=>{qe.init(e,t),e._zod.parse=n=>n}),W0=oe("$ZodNever",(e,t)=>{qe.init(e,t),e._zod.parse=(n,r)=>(n.issues.push({expected:"never",code:"invalid_type",input:n.value,inst:e}),n)});function Hl(e,t,n){e.issues.length&&t.issues.push(...Gn(n,e.issues)),t.value[n]=e.value}const V0=oe("$ZodArray",(e,t)=>{qe.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 s=[];for(let i=0;i<o.length;i++){const l=o[i],c=t.element._zod.run({value:l,issues:[]},r);c instanceof Promise?s.push(c.then(u=>Hl(u,n,i))):Hl(c,n,i)}return s.length?Promise.all(s).then(()=>n):n}});function Io(e,t,n,r,o){if(e.issues.length){if(o&&!(n in r))return;t.issues.push(...Gn(n,e.issues))}e.value===void 0?n in r&&(t.value[n]=void 0):t.value[n]=e.value}function Xd(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=ax(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(n)}}function Qd(e,t,n,r,o,s){const i=[],l=o.keySet,c=o.catchall._zod,u=c.def.type,d=c.optout==="optional";for(const f in t){if(l.has(f))continue;if(u==="never"){i.push(f);continue}const h=c.run({value:t[f],issues:[]},r);h instanceof Promise?e.push(h.then(p=>Io(p,n,f,t,d))):Io(h,n,f,t,d)}return i.length&&n.issues.push({code:"unrecognized_keys",keys:i,input:t,inst:s}),e.length?Promise.all(e).then(()=>n):n}const H0=oe("$ZodObject",(e,t)=>{if(qe.init(e,t),!Object.getOwnPropertyDescriptor(t,"shape")?.get){const l=t.shape;Object.defineProperty(t,"shape",{get:()=>{const c={...l};return Object.defineProperty(t,"shape",{value:c}),c}})}const r=is(()=>Xd(t));ze(e._zod,"propValues",()=>{const l=t.shape,c={};for(const u in l){const d=l[u]._zod;if(d.values){c[u]??(c[u]=new Set);for(const f of d.values)c[u].add(f)}}return c});const o=Mr,s=t.catchall;let i;e._zod.parse=(l,c)=>{i??(i=r.value);const u=l.value;if(!o(u))return l.issues.push({expected:"object",code:"invalid_type",input:u,inst:e}),l;l.value={};const d=[],f=i.shape;for(const h of i.keys){const p=f[h],y=p._zod.optout==="optional",m=p._zod.run({value:u[h],issues:[]},c);m instanceof Promise?d.push(m.then(g=>Io(g,l,h,u,y))):Io(m,l,h,u,y)}return s?Qd(d,u,l,c,r.value,e):d.length?Promise.all(d).then(()=>l):l}}),Z0=oe("$ZodObjectJIT",(e,t)=>{H0.init(e,t);const n=e._zod.parse,r=is(()=>Xd(t)),o=h=>{const p=new f0(["shape","payload","ctx"]),y=r.value,m=k=>{const S=Wl(k);return`shape[${S}]._zod.run({ value: input[${S}], issues: [] }, ctx)`};p.write("const input = payload.value;");const g=Object.create(null);let b=0;for(const k of y.keys)g[k]=`key_${b++}`;p.write("const newResult = {};");for(const k of y.keys){const S=g[k],C=Wl(k),E=h[k]?._zod?.optout==="optional";p.write(`const ${S} = ${m(k)};`),E?p.write(`
|
|
5
5
|
if (${S}.issues.length) {
|
|
6
6
|
if (${C} in input) {
|
|
7
7
|
payload.issues = payload.issues.concat(${S}.issues.map(iss => ({
|
|
@@ -35,15 +35,15 @@ import{u as Vr,a as zd,r as x,j as a,c as no,g as ka,b as Zr,d as ut,e as Rd,f a
|
|
|
35
35
|
newResult[${C}] = ${S}.value;
|
|
36
36
|
}
|
|
37
37
|
|
|
38
|
-
`)}p.write("payload.value = newResult;"),p.write("return payload;");const v=p.compile();return(k,S)=>v(h,k,S)};let s;const i=Pr,l=!Md.jitless,u=l&&sx.value,d=t.catchall;let f;e._zod.parse=(h,p)=>{f??(f=r.value);const y=h.value;return i(y)?l&&u&&p?.async===!1&&p.jitless!==!0?(s||(s=o(t.shape)),h=s(h,p),d?Qd([],y,h,p,f,e):h):n(h,p):(h.issues.push({expected:"object",code:"invalid_type",input:y,inst:e}),h)}});function Zl(e,t,n,r){for(const s of e)if(s.issues.length===0)return t.value=s.value,t;const o=e.filter(s=>!qn(s));return o.length===1?(t.value=o[0].value,o[0]):(t.issues.push({code:"invalid_union",input:t.value,inst:n,errors:e.map(s=>s.issues.map(i=>pn(i,r,fn())))}),t)}const ef=re("$ZodUnion",(e,t)=>{qe.init(e,t),ze(e._zod,"optin",()=>t.options.some(o=>o._zod.optin==="optional")?"optional":void 0),ze(e._zod,"optout",()=>t.options.some(o=>o._zod.optout==="optional")?"optional":void 0),ze(e._zod,"values",()=>{if(t.options.every(o=>o._zod.values))return new Set(t.options.flatMap(o=>Array.from(o._zod.values)))}),ze(e._zod,"pattern",()=>{if(t.options.every(o=>o._zod.pattern)){const o=t.options.map(s=>s._zod.pattern);return new RegExp(`^(${o.map(s=>Sa(s.source)).join("|")})$`)}});const n=t.options.length===1,r=t.options[0]._zod.run;e._zod.parse=(o,s)=>{if(n)return r(o,s);let i=!1;const l=[];for(const c of t.options){const u=c._zod.run({value:o.value,issues:[]},s);if(u instanceof Promise)l.push(u),i=!0;else{if(u.issues.length===0)return u;l.push(u)}}return i?Promise.all(l).then(c=>Zl(c,o,e,s)):Zl(l,o,e,s)}}),q0=re("$ZodDiscriminatedUnion",(e,t)=>{t.inclusive=!1,ef.init(e,t);const n=e._zod.parse;ze(e._zod,"propValues",()=>{const o={};for(const s of t.options){const i=s._zod.propValues;if(!i||Object.keys(i).length===0)throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(s)}"`);for(const[l,c]of Object.entries(i)){o[l]||(o[l]=new Set);for(const u of c)o[l].add(u)}}return o});const r=is(()=>{const o=t.options,s=new Map;for(const i of o){const l=i._zod.propValues?.[t.discriminator];if(!l||l.size===0)throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(i)}"`);for(const c of l){if(s.has(c))throw new Error(`Duplicate discriminator value "${String(c)}"`);s.set(c,i)}}return s});e._zod.parse=(o,s)=>{const i=o.value;if(!Pr(i))return o.issues.push({code:"invalid_type",expected:"object",input:i,inst:e}),o;const l=r.value.get(i?.[t.discriminator]);return l?l._zod.run(o,s):t.unionFallback?n(o,s):(o.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:t.discriminator,input:i,path:[t.discriminator],inst:e}),o)}}),K0=re("$ZodIntersection",(e,t)=>{qe.init(e,t),e._zod.parse=(n,r)=>{const o=n.value,s=t.left._zod.run({value:o,issues:[]},r),i=t.right._zod.run({value:o,issues:[]},r);return s instanceof Promise||i instanceof Promise?Promise.all([s,i]).then(([c,u])=>ql(n,c,u)):ql(n,s,i)}});function Ni(e,t){if(e===t)return{valid:!0,data:e};if(e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(nr(e)&&nr(t)){const n=Object.keys(t),r=Object.keys(e).filter(s=>n.indexOf(s)!==-1),o={...e,...t};for(const s of r){const i=Ni(e[s],t[s]);if(!i.valid)return{valid:!1,mergeErrorPath:[s,...i.mergeErrorPath]};o[s]=i.data}return{valid:!0,data:o}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};const n=[];for(let r=0;r<e.length;r++){const o=e[r],s=t[r],i=Ni(o,s);if(!i.valid)return{valid:!1,mergeErrorPath:[r,...i.mergeErrorPath]};n.push(i.data)}return{valid:!0,data:n}}return{valid:!1,mergeErrorPath:[]}}function ql(e,t,n){const r=new Map;let o;for(const l of t.issues)if(l.code==="unrecognized_keys"){o??(o=l);for(const c of l.keys)r.has(c)||r.set(c,{}),r.get(c).l=!0}else e.issues.push(l);for(const l of n.issues)if(l.code==="unrecognized_keys")for(const c of l.keys)r.has(c)||r.set(c,{}),r.get(c).r=!0;else e.issues.push(l);const s=[...r].filter(([,l])=>l.l&&l.r).map(([l])=>l);if(s.length&&o&&e.issues.push({...o,keys:s}),qn(e))return e;const i=Ni(t.value,n.value);if(!i.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(i.mergeErrorPath)}`);return e.value=i.data,e}const G0=re("$ZodRecord",(e,t)=>{qe.init(e,t),e._zod.parse=(n,r)=>{const o=n.value;if(!nr(o))return n.issues.push({expected:"record",code:"invalid_type",input:o,inst:e}),n;const s=[],i=t.keyType._zod.values;if(i){n.value={};const l=new Set;for(const u of i)if(typeof u=="string"||typeof u=="number"||typeof u=="symbol"){l.add(typeof u=="number"?u.toString():u);const d=t.valueType._zod.run({value:o[u],issues:[]},r);d instanceof Promise?s.push(d.then(f=>{f.issues.length&&n.issues.push(...Kn(u,f.issues)),n.value[u]=f.value})):(d.issues.length&&n.issues.push(...Kn(u,d.issues)),n.value[u]=d.value)}let c;for(const u in o)l.has(u)||(c=c??[],c.push(u));c&&c.length>0&&n.issues.push({code:"unrecognized_keys",input:o,inst:e,keys:c})}else{n.value={};for(const l of Reflect.ownKeys(o)){if(l==="__proto__")continue;let c=t.keyType._zod.run({value:l,issues:[]},r);if(c instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(typeof l=="string"&&Zd.test(l)&&c.issues.length){const f=t.keyType._zod.run({value:Number(l),issues:[]},r);if(f instanceof Promise)throw new Error("Async schemas not supported in object keys currently");f.issues.length===0&&(c=f)}if(c.issues.length){t.mode==="loose"?n.value[l]=o[l]:n.issues.push({code:"invalid_key",origin:"record",issues:c.issues.map(f=>pn(f,r,fn())),input:l,path:[l],inst:e});continue}const d=t.valueType._zod.run({value:o[l],issues:[]},r);d instanceof Promise?s.push(d.then(f=>{f.issues.length&&n.issues.push(...Kn(l,f.issues)),n.value[c.value]=f.value})):(d.issues.length&&n.issues.push(...Kn(l,d.issues)),n.value[c.value]=d.value)}}return s.length?Promise.all(s).then(()=>n):n}}),J0=re("$ZodEnum",(e,t)=>{qe.init(e,t);const n=Ld(t.entries),r=new Set(n);e._zod.values=r,e._zod.pattern=new RegExp(`^(${n.filter(o=>ix.has(typeof o)).map(o=>typeof o=="string"?rr(o):o.toString()).join("|")})$`),e._zod.parse=(o,s)=>{const i=o.value;return r.has(i)||o.issues.push({code:"invalid_value",values:n,input:i,inst:e}),o}}),Y0=re("$ZodLiteral",(e,t)=>{if(qe.init(e,t),t.values.length===0)throw new Error("Cannot create literal schema with no valid values");const n=new Set(t.values);e._zod.values=n,e._zod.pattern=new RegExp(`^(${t.values.map(r=>typeof r=="string"?rr(r):r?rr(r.toString()):String(r)).join("|")})$`),e._zod.parse=(r,o)=>{const s=r.value;return n.has(s)||r.issues.push({code:"invalid_value",values:t.values,input:s,inst:e}),r}}),X0=re("$ZodTransform",(e,t)=>{qe.init(e,t),e._zod.parse=(n,r)=>{if(r.direction==="backward")throw new Od(e.constructor.name);const o=t.transform(n.value,n);if(r.async)return(o instanceof Promise?o:Promise.resolve(o)).then(i=>(n.value=i,n));if(o instanceof Promise)throw new Gn;return n.value=o,n}});function Kl(e,t){return e.issues.length&&t===void 0?{issues:[],value:void 0}:e}const tf=re("$ZodOptional",(e,t)=>{qe.init(e,t),e._zod.optin="optional",e._zod.optout="optional",ze(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),ze(e._zod,"pattern",()=>{const n=t.innerType._zod.pattern;return n?new RegExp(`^(${Sa(n.source)})?$`):void 0}),e._zod.parse=(n,r)=>{if(t.innerType._zod.optin==="optional"){const o=t.innerType._zod.run(n,r);return o instanceof Promise?o.then(s=>Kl(s,n.value)):Kl(o,n.value)}return n.value===void 0?n:t.innerType._zod.run(n,r)}}),Q0=re("$ZodExactOptional",(e,t)=>{tf.init(e,t),ze(e._zod,"values",()=>t.innerType._zod.values),ze(e._zod,"pattern",()=>t.innerType._zod.pattern),e._zod.parse=(n,r)=>t.innerType._zod.run(n,r)}),e1=re("$ZodNullable",(e,t)=>{qe.init(e,t),ze(e._zod,"optin",()=>t.innerType._zod.optin),ze(e._zod,"optout",()=>t.innerType._zod.optout),ze(e._zod,"pattern",()=>{const n=t.innerType._zod.pattern;return n?new RegExp(`^(${Sa(n.source)}|null)$`):void 0}),ze(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(n,r)=>n.value===null?n:t.innerType._zod.run(n,r)}),t1=re("$ZodDefault",(e,t)=>{qe.init(e,t),e._zod.optin="optional",ze(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(n,r)=>{if(r.direction==="backward")return t.innerType._zod.run(n,r);if(n.value===void 0)return n.value=t.defaultValue,n;const o=t.innerType._zod.run(n,r);return o instanceof Promise?o.then(s=>Gl(s,t)):Gl(o,t)}});function Gl(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}const n1=re("$ZodPrefault",(e,t)=>{qe.init(e,t),e._zod.optin="optional",ze(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(n,r)=>(r.direction==="backward"||n.value===void 0&&(n.value=t.defaultValue),t.innerType._zod.run(n,r))}),r1=re("$ZodNonOptional",(e,t)=>{qe.init(e,t),ze(e._zod,"values",()=>{const n=t.innerType._zod.values;return n?new Set([...n].filter(r=>r!==void 0)):void 0}),e._zod.parse=(n,r)=>{const o=t.innerType._zod.run(n,r);return o instanceof Promise?o.then(s=>Jl(s,e)):Jl(o,e)}});function Jl(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:t}),e}const o1=re("$ZodCatch",(e,t)=>{qe.init(e,t),ze(e._zod,"optin",()=>t.innerType._zod.optin),ze(e._zod,"optout",()=>t.innerType._zod.optout),ze(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(n,r)=>{if(r.direction==="backward")return t.innerType._zod.run(n,r);const o=t.innerType._zod.run(n,r);return o instanceof Promise?o.then(s=>(n.value=s.value,s.issues.length&&(n.value=t.catchValue({...n,error:{issues:s.issues.map(i=>pn(i,r,fn()))},input:n.value}),n.issues=[]),n)):(n.value=o.value,o.issues.length&&(n.value=t.catchValue({...n,error:{issues:o.issues.map(s=>pn(s,r,fn()))},input:n.value}),n.issues=[]),n)}}),s1=re("$ZodPipe",(e,t)=>{qe.init(e,t),ze(e._zod,"values",()=>t.in._zod.values),ze(e._zod,"optin",()=>t.in._zod.optin),ze(e._zod,"optout",()=>t.out._zod.optout),ze(e._zod,"propValues",()=>t.in._zod.propValues),e._zod.parse=(n,r)=>{if(r.direction==="backward"){const s=t.out._zod.run(n,r);return s instanceof Promise?s.then(i=>oo(i,t.in,r)):oo(s,t.in,r)}const o=t.in._zod.run(n,r);return o instanceof Promise?o.then(s=>oo(s,t.out,r)):oo(o,t.out,r)}});function oo(e,t,n){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},n)}const i1=re("$ZodReadonly",(e,t)=>{qe.init(e,t),ze(e._zod,"propValues",()=>t.innerType._zod.propValues),ze(e._zod,"values",()=>t.innerType._zod.values),ze(e._zod,"optin",()=>t.innerType?._zod?.optin),ze(e._zod,"optout",()=>t.innerType?._zod?.optout),e._zod.parse=(n,r)=>{if(r.direction==="backward")return t.innerType._zod.run(n,r);const o=t.innerType._zod.run(n,r);return o instanceof Promise?o.then(Yl):Yl(o)}});function Yl(e){return e.value=Object.freeze(e.value),e}const a1=re("$ZodLazy",(e,t)=>{qe.init(e,t),ze(e._zod,"innerType",()=>t.getter()),ze(e._zod,"pattern",()=>e._zod.innerType?._zod?.pattern),ze(e._zod,"propValues",()=>e._zod.innerType?._zod?.propValues),ze(e._zod,"optin",()=>e._zod.innerType?._zod?.optin??void 0),ze(e._zod,"optout",()=>e._zod.innerType?._zod?.optout??void 0),e._zod.parse=(n,r)=>e._zod.innerType._zod.run(n,r)}),l1=re("$ZodCustom",(e,t)=>{pt.init(e,t),qe.init(e,t),e._zod.parse=(n,r)=>n,e._zod.check=n=>{const r=n.value,o=t.fn(r);if(o instanceof Promise)return o.then(s=>Xl(s,n,r,e));Xl(o,n,r,e)}});function Xl(e,t,n,r){if(!e){const o={code:"custom",input:n,inst:r,path:[...r._zod.def.path??[]],continue:!r._zod.def.abort};r._zod.def.params&&(o.params=r._zod.def.params),t.issues.push(Or(o))}}var Ql;class c1{constructor(){this._map=new WeakMap,this._idmap=new Map}add(t,...n){const r=n[0];return this._map.set(t,r),r&&typeof r=="object"&&"id"in r&&this._idmap.set(r.id,t),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(t){const n=this._map.get(t);return n&&typeof n=="object"&&"id"in n&&this._idmap.delete(n.id),this._map.delete(t),this}get(t){const n=t._zod.parent;if(n){const r={...this.get(n)??{}};delete r.id;const o={...r,...this._map.get(t)};return Object.keys(o).length?o:void 0}return this._map.get(t)}has(t){return this._map.has(t)}}function u1(){return new c1}(Ql=globalThis).__zod_globalRegistry??(Ql.__zod_globalRegistry=u1());const Nr=globalThis.__zod_globalRegistry;function d1(e,t){return new e({type:"string",...ke(t)})}function f1(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...ke(t)})}function ec(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...ke(t)})}function p1(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...ke(t)})}function h1(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...ke(t)})}function m1(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...ke(t)})}function g1(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...ke(t)})}function x1(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...ke(t)})}function b1(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...ke(t)})}function y1(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...ke(t)})}function v1(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...ke(t)})}function w1(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...ke(t)})}function k1(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...ke(t)})}function _1(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...ke(t)})}function S1(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...ke(t)})}function C1(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...ke(t)})}function j1(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...ke(t)})}function N1(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...ke(t)})}function E1(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...ke(t)})}function T1(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...ke(t)})}function A1(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...ke(t)})}function I1(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...ke(t)})}function z1(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...ke(t)})}function R1(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...ke(t)})}function P1(e,t){return new e({type:"string",format:"date",check:"string_format",...ke(t)})}function O1(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...ke(t)})}function M1(e,t){return new e({type:"string",format:"duration",check:"string_format",...ke(t)})}function L1(e,t){return new e({type:"number",checks:[],...ke(t)})}function D1(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...ke(t)})}function F1(e,t){return new e({type:"boolean",...ke(t)})}function $1(e,t){return new e({type:"null",...ke(t)})}function B1(e){return new e({type:"unknown"})}function U1(e,t){return new e({type:"never",...ke(t)})}function tc(e,t){return new Kd({check:"less_than",...ke(t),value:e,inclusive:!1})}function Us(e,t){return new Kd({check:"less_than",...ke(t),value:e,inclusive:!0})}function nc(e,t){return new Gd({check:"greater_than",...ke(t),value:e,inclusive:!1})}function Ws(e,t){return new Gd({check:"greater_than",...ke(t),value:e,inclusive:!0})}function rc(e,t){return new e0({check:"multiple_of",...ke(t),value:e})}function nf(e,t){return new n0({check:"max_length",...ke(t),maximum:e})}function zo(e,t){return new r0({check:"min_length",...ke(t),minimum:e})}function rf(e,t){return new o0({check:"length_equals",...ke(t),length:e})}function W1(e,t){return new s0({check:"string_format",format:"regex",...ke(t),pattern:e})}function H1(e){return new i0({check:"string_format",format:"lowercase",...ke(e)})}function V1(e){return new a0({check:"string_format",format:"uppercase",...ke(e)})}function Z1(e,t){return new l0({check:"string_format",format:"includes",...ke(t),includes:e})}function q1(e,t){return new c0({check:"string_format",format:"starts_with",...ke(t),prefix:e})}function K1(e,t){return new u0({check:"string_format",format:"ends_with",...ke(t),suffix:e})}function lr(e){return new d0({check:"overwrite",tx:e})}function G1(e){return lr(t=>t.normalize(e))}function J1(){return lr(e=>e.trim())}function Y1(){return lr(e=>e.toLowerCase())}function X1(){return lr(e=>e.toUpperCase())}function Q1(){return lr(e=>ox(e))}function eb(e,t,n){return new e({type:"array",element:t,...ke(n)})}function tb(e,t,n){return new e({type:"custom",check:"custom",fn:t,...ke(n)})}function nb(e){const t=rb(n=>(n.addIssue=r=>{if(typeof r=="string")n.issues.push(Or(r,n.value,t._zod.def));else{const o=r;o.fatal&&(o.continue=!1),o.code??(o.code="custom"),o.input??(o.input=n.value),o.inst??(o.inst=t),o.continue??(o.continue=!t._zod.def.abort),n.issues.push(Or(o))}},e(n.value,n)));return t}function rb(e,t){const n=new pt({check:"custom",...ke(t)});return n._zod.check=e,n}function of(e){let t=e?.target??"draft-2020-12";return t==="draft-4"&&(t="draft-04"),t==="draft-7"&&(t="draft-07"),{processors:e.processors??{},metadataRegistry:e?.metadata??Nr,target:t,unrepresentable:e?.unrepresentable??"throw",override:e?.override??(()=>{}),io:e?.io??"output",counter:0,seen:new Map,cycles:e?.cycles??"ref",reused:e?.reused??"inline",external:e?.external??void 0}}function Xe(e,t,n={path:[],schemaPath:[]}){var r;const o=e._zod.def,s=t.seen.get(e);if(s)return s.count++,n.schemaPath.includes(e)&&(s.cycle=n.path),s.schema;const i={schema:{},count:1,cycle:void 0,path:n.path};t.seen.set(e,i);const l=e._zod.toJSONSchema?.();if(l)i.schema=l;else{const d={...n,schemaPath:[...n.schemaPath,e],path:n.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,i.schema,d);else{const h=i.schema,p=t.processors[o.type];if(!p)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${o.type}`);p(e,t,h,d)}const f=e._zod.parent;f&&(i.ref||(i.ref=f),Xe(f,t,d),t.seen.get(f).isParent=!0)}const c=t.metadataRegistry.get(e);return c&&Object.assign(i.schema,c),t.io==="input"&&at(e)&&(delete i.schema.examples,delete i.schema.default),t.io==="input"&&i.schema._prefault&&((r=i.schema).default??(r.default=i.schema._prefault)),delete i.schema._prefault,t.seen.get(e).schema}function sf(e,t){const n=e.seen.get(t);if(!n)throw new Error("Unprocessed schema. This is a bug in Zod.");const r=new Map;for(const i of e.seen.entries()){const l=e.metadataRegistry.get(i[0])?.id;if(l){const c=r.get(l);if(c&&c!==i[0])throw new Error(`Duplicate schema id "${l}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);r.set(l,i[0])}}const o=i=>{const l=e.target==="draft-2020-12"?"$defs":"definitions";if(e.external){const f=e.external.registry.get(i[0])?.id,h=e.external.uri??(y=>y);if(f)return{ref:h(f)};const p=i[1].defId??i[1].schema.id??`schema${e.counter++}`;return i[1].defId=p,{defId:p,ref:`${h("__shared")}#/${l}/${p}`}}if(i[1]===n)return{ref:"#"};const u=`#/${l}/`,d=i[1].schema.id??`__schema${e.counter++}`;return{defId:d,ref:u+d}},s=i=>{if(i[1].schema.$ref)return;const l=i[1],{ref:c,defId:u}=o(i);l.def={...l.schema},u&&(l.defId=u);const d=l.schema;for(const f in d)delete d[f];d.$ref=c};if(e.cycles==="throw")for(const i of e.seen.entries()){const l=i[1];if(l.cycle)throw new Error(`Cycle detected: #/${l.cycle?.join("/")}/<root>
|
|
38
|
+
`)}p.write("payload.value = newResult;"),p.write("return payload;");const v=p.compile();return(k,S)=>v(h,k,S)};let s;const i=Mr,l=!Md.jitless,u=l&&sx.value,d=t.catchall;let f;e._zod.parse=(h,p)=>{f??(f=r.value);const y=h.value;return i(y)?l&&u&&p?.async===!1&&p.jitless!==!0?(s||(s=o(t.shape)),h=s(h,p),d?Qd([],y,h,p,f,e):h):n(h,p):(h.issues.push({expected:"object",code:"invalid_type",input:y,inst:e}),h)}});function Zl(e,t,n,r){for(const s of e)if(s.issues.length===0)return t.value=s.value,t;const o=e.filter(s=>!Kn(s));return o.length===1?(t.value=o[0].value,o[0]):(t.issues.push({code:"invalid_union",input:t.value,inst:n,errors:e.map(s=>s.issues.map(i=>pn(i,r,fn())))}),t)}const ef=oe("$ZodUnion",(e,t)=>{qe.init(e,t),ze(e._zod,"optin",()=>t.options.some(o=>o._zod.optin==="optional")?"optional":void 0),ze(e._zod,"optout",()=>t.options.some(o=>o._zod.optout==="optional")?"optional":void 0),ze(e._zod,"values",()=>{if(t.options.every(o=>o._zod.values))return new Set(t.options.flatMap(o=>Array.from(o._zod.values)))}),ze(e._zod,"pattern",()=>{if(t.options.every(o=>o._zod.pattern)){const o=t.options.map(s=>s._zod.pattern);return new RegExp(`^(${o.map(s=>Sa(s.source)).join("|")})$`)}});const n=t.options.length===1,r=t.options[0]._zod.run;e._zod.parse=(o,s)=>{if(n)return r(o,s);let i=!1;const l=[];for(const c of t.options){const u=c._zod.run({value:o.value,issues:[]},s);if(u instanceof Promise)l.push(u),i=!0;else{if(u.issues.length===0)return u;l.push(u)}}return i?Promise.all(l).then(c=>Zl(c,o,e,s)):Zl(l,o,e,s)}}),q0=oe("$ZodDiscriminatedUnion",(e,t)=>{t.inclusive=!1,ef.init(e,t);const n=e._zod.parse;ze(e._zod,"propValues",()=>{const o={};for(const s of t.options){const i=s._zod.propValues;if(!i||Object.keys(i).length===0)throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(s)}"`);for(const[l,c]of Object.entries(i)){o[l]||(o[l]=new Set);for(const u of c)o[l].add(u)}}return o});const r=is(()=>{const o=t.options,s=new Map;for(const i of o){const l=i._zod.propValues?.[t.discriminator];if(!l||l.size===0)throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(i)}"`);for(const c of l){if(s.has(c))throw new Error(`Duplicate discriminator value "${String(c)}"`);s.set(c,i)}}return s});e._zod.parse=(o,s)=>{const i=o.value;if(!Mr(i))return o.issues.push({code:"invalid_type",expected:"object",input:i,inst:e}),o;const l=r.value.get(i?.[t.discriminator]);return l?l._zod.run(o,s):t.unionFallback?n(o,s):(o.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:t.discriminator,input:i,path:[t.discriminator],inst:e}),o)}}),K0=oe("$ZodIntersection",(e,t)=>{qe.init(e,t),e._zod.parse=(n,r)=>{const o=n.value,s=t.left._zod.run({value:o,issues:[]},r),i=t.right._zod.run({value:o,issues:[]},r);return s instanceof Promise||i instanceof Promise?Promise.all([s,i]).then(([c,u])=>ql(n,c,u)):ql(n,s,i)}});function Ni(e,t){if(e===t)return{valid:!0,data:e};if(e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(rr(e)&&rr(t)){const n=Object.keys(t),r=Object.keys(e).filter(s=>n.indexOf(s)!==-1),o={...e,...t};for(const s of r){const i=Ni(e[s],t[s]);if(!i.valid)return{valid:!1,mergeErrorPath:[s,...i.mergeErrorPath]};o[s]=i.data}return{valid:!0,data:o}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};const n=[];for(let r=0;r<e.length;r++){const o=e[r],s=t[r],i=Ni(o,s);if(!i.valid)return{valid:!1,mergeErrorPath:[r,...i.mergeErrorPath]};n.push(i.data)}return{valid:!0,data:n}}return{valid:!1,mergeErrorPath:[]}}function ql(e,t,n){const r=new Map;let o;for(const l of t.issues)if(l.code==="unrecognized_keys"){o??(o=l);for(const c of l.keys)r.has(c)||r.set(c,{}),r.get(c).l=!0}else e.issues.push(l);for(const l of n.issues)if(l.code==="unrecognized_keys")for(const c of l.keys)r.has(c)||r.set(c,{}),r.get(c).r=!0;else e.issues.push(l);const s=[...r].filter(([,l])=>l.l&&l.r).map(([l])=>l);if(s.length&&o&&e.issues.push({...o,keys:s}),Kn(e))return e;const i=Ni(t.value,n.value);if(!i.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(i.mergeErrorPath)}`);return e.value=i.data,e}const G0=oe("$ZodRecord",(e,t)=>{qe.init(e,t),e._zod.parse=(n,r)=>{const o=n.value;if(!rr(o))return n.issues.push({expected:"record",code:"invalid_type",input:o,inst:e}),n;const s=[],i=t.keyType._zod.values;if(i){n.value={};const l=new Set;for(const u of i)if(typeof u=="string"||typeof u=="number"||typeof u=="symbol"){l.add(typeof u=="number"?u.toString():u);const d=t.valueType._zod.run({value:o[u],issues:[]},r);d instanceof Promise?s.push(d.then(f=>{f.issues.length&&n.issues.push(...Gn(u,f.issues)),n.value[u]=f.value})):(d.issues.length&&n.issues.push(...Gn(u,d.issues)),n.value[u]=d.value)}let c;for(const u in o)l.has(u)||(c=c??[],c.push(u));c&&c.length>0&&n.issues.push({code:"unrecognized_keys",input:o,inst:e,keys:c})}else{n.value={};for(const l of Reflect.ownKeys(o)){if(l==="__proto__")continue;let c=t.keyType._zod.run({value:l,issues:[]},r);if(c instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(typeof l=="string"&&Zd.test(l)&&c.issues.length){const f=t.keyType._zod.run({value:Number(l),issues:[]},r);if(f instanceof Promise)throw new Error("Async schemas not supported in object keys currently");f.issues.length===0&&(c=f)}if(c.issues.length){t.mode==="loose"?n.value[l]=o[l]:n.issues.push({code:"invalid_key",origin:"record",issues:c.issues.map(f=>pn(f,r,fn())),input:l,path:[l],inst:e});continue}const d=t.valueType._zod.run({value:o[l],issues:[]},r);d instanceof Promise?s.push(d.then(f=>{f.issues.length&&n.issues.push(...Gn(l,f.issues)),n.value[c.value]=f.value})):(d.issues.length&&n.issues.push(...Gn(l,d.issues)),n.value[c.value]=d.value)}}return s.length?Promise.all(s).then(()=>n):n}}),J0=oe("$ZodEnum",(e,t)=>{qe.init(e,t);const n=Ld(t.entries),r=new Set(n);e._zod.values=r,e._zod.pattern=new RegExp(`^(${n.filter(o=>ix.has(typeof o)).map(o=>typeof o=="string"?or(o):o.toString()).join("|")})$`),e._zod.parse=(o,s)=>{const i=o.value;return r.has(i)||o.issues.push({code:"invalid_value",values:n,input:i,inst:e}),o}}),Y0=oe("$ZodLiteral",(e,t)=>{if(qe.init(e,t),t.values.length===0)throw new Error("Cannot create literal schema with no valid values");const n=new Set(t.values);e._zod.values=n,e._zod.pattern=new RegExp(`^(${t.values.map(r=>typeof r=="string"?or(r):r?or(r.toString()):String(r)).join("|")})$`),e._zod.parse=(r,o)=>{const s=r.value;return n.has(s)||r.issues.push({code:"invalid_value",values:t.values,input:s,inst:e}),r}}),X0=oe("$ZodTransform",(e,t)=>{qe.init(e,t),e._zod.parse=(n,r)=>{if(r.direction==="backward")throw new Od(e.constructor.name);const o=t.transform(n.value,n);if(r.async)return(o instanceof Promise?o:Promise.resolve(o)).then(i=>(n.value=i,n));if(o instanceof Promise)throw new Jn;return n.value=o,n}});function Kl(e,t){return e.issues.length&&t===void 0?{issues:[],value:void 0}:e}const tf=oe("$ZodOptional",(e,t)=>{qe.init(e,t),e._zod.optin="optional",e._zod.optout="optional",ze(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),ze(e._zod,"pattern",()=>{const n=t.innerType._zod.pattern;return n?new RegExp(`^(${Sa(n.source)})?$`):void 0}),e._zod.parse=(n,r)=>{if(t.innerType._zod.optin==="optional"){const o=t.innerType._zod.run(n,r);return o instanceof Promise?o.then(s=>Kl(s,n.value)):Kl(o,n.value)}return n.value===void 0?n:t.innerType._zod.run(n,r)}}),Q0=oe("$ZodExactOptional",(e,t)=>{tf.init(e,t),ze(e._zod,"values",()=>t.innerType._zod.values),ze(e._zod,"pattern",()=>t.innerType._zod.pattern),e._zod.parse=(n,r)=>t.innerType._zod.run(n,r)}),e1=oe("$ZodNullable",(e,t)=>{qe.init(e,t),ze(e._zod,"optin",()=>t.innerType._zod.optin),ze(e._zod,"optout",()=>t.innerType._zod.optout),ze(e._zod,"pattern",()=>{const n=t.innerType._zod.pattern;return n?new RegExp(`^(${Sa(n.source)}|null)$`):void 0}),ze(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(n,r)=>n.value===null?n:t.innerType._zod.run(n,r)}),t1=oe("$ZodDefault",(e,t)=>{qe.init(e,t),e._zod.optin="optional",ze(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(n,r)=>{if(r.direction==="backward")return t.innerType._zod.run(n,r);if(n.value===void 0)return n.value=t.defaultValue,n;const o=t.innerType._zod.run(n,r);return o instanceof Promise?o.then(s=>Gl(s,t)):Gl(o,t)}});function Gl(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}const n1=oe("$ZodPrefault",(e,t)=>{qe.init(e,t),e._zod.optin="optional",ze(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(n,r)=>(r.direction==="backward"||n.value===void 0&&(n.value=t.defaultValue),t.innerType._zod.run(n,r))}),r1=oe("$ZodNonOptional",(e,t)=>{qe.init(e,t),ze(e._zod,"values",()=>{const n=t.innerType._zod.values;return n?new Set([...n].filter(r=>r!==void 0)):void 0}),e._zod.parse=(n,r)=>{const o=t.innerType._zod.run(n,r);return o instanceof Promise?o.then(s=>Jl(s,e)):Jl(o,e)}});function Jl(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:t}),e}const o1=oe("$ZodCatch",(e,t)=>{qe.init(e,t),ze(e._zod,"optin",()=>t.innerType._zod.optin),ze(e._zod,"optout",()=>t.innerType._zod.optout),ze(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(n,r)=>{if(r.direction==="backward")return t.innerType._zod.run(n,r);const o=t.innerType._zod.run(n,r);return o instanceof Promise?o.then(s=>(n.value=s.value,s.issues.length&&(n.value=t.catchValue({...n,error:{issues:s.issues.map(i=>pn(i,r,fn()))},input:n.value}),n.issues=[]),n)):(n.value=o.value,o.issues.length&&(n.value=t.catchValue({...n,error:{issues:o.issues.map(s=>pn(s,r,fn()))},input:n.value}),n.issues=[]),n)}}),s1=oe("$ZodPipe",(e,t)=>{qe.init(e,t),ze(e._zod,"values",()=>t.in._zod.values),ze(e._zod,"optin",()=>t.in._zod.optin),ze(e._zod,"optout",()=>t.out._zod.optout),ze(e._zod,"propValues",()=>t.in._zod.propValues),e._zod.parse=(n,r)=>{if(r.direction==="backward"){const s=t.out._zod.run(n,r);return s instanceof Promise?s.then(i=>oo(i,t.in,r)):oo(s,t.in,r)}const o=t.in._zod.run(n,r);return o instanceof Promise?o.then(s=>oo(s,t.out,r)):oo(o,t.out,r)}});function oo(e,t,n){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},n)}const i1=oe("$ZodReadonly",(e,t)=>{qe.init(e,t),ze(e._zod,"propValues",()=>t.innerType._zod.propValues),ze(e._zod,"values",()=>t.innerType._zod.values),ze(e._zod,"optin",()=>t.innerType?._zod?.optin),ze(e._zod,"optout",()=>t.innerType?._zod?.optout),e._zod.parse=(n,r)=>{if(r.direction==="backward")return t.innerType._zod.run(n,r);const o=t.innerType._zod.run(n,r);return o instanceof Promise?o.then(Yl):Yl(o)}});function Yl(e){return e.value=Object.freeze(e.value),e}const a1=oe("$ZodLazy",(e,t)=>{qe.init(e,t),ze(e._zod,"innerType",()=>t.getter()),ze(e._zod,"pattern",()=>e._zod.innerType?._zod?.pattern),ze(e._zod,"propValues",()=>e._zod.innerType?._zod?.propValues),ze(e._zod,"optin",()=>e._zod.innerType?._zod?.optin??void 0),ze(e._zod,"optout",()=>e._zod.innerType?._zod?.optout??void 0),e._zod.parse=(n,r)=>e._zod.innerType._zod.run(n,r)}),l1=oe("$ZodCustom",(e,t)=>{pt.init(e,t),qe.init(e,t),e._zod.parse=(n,r)=>n,e._zod.check=n=>{const r=n.value,o=t.fn(r);if(o instanceof Promise)return o.then(s=>Xl(s,n,r,e));Xl(o,n,r,e)}});function Xl(e,t,n,r){if(!e){const o={code:"custom",input:n,inst:r,path:[...r._zod.def.path??[]],continue:!r._zod.def.abort};r._zod.def.params&&(o.params=r._zod.def.params),t.issues.push(Lr(o))}}var Ql;class c1{constructor(){this._map=new WeakMap,this._idmap=new Map}add(t,...n){const r=n[0];return this._map.set(t,r),r&&typeof r=="object"&&"id"in r&&this._idmap.set(r.id,t),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(t){const n=this._map.get(t);return n&&typeof n=="object"&&"id"in n&&this._idmap.delete(n.id),this._map.delete(t),this}get(t){const n=t._zod.parent;if(n){const r={...this.get(n)??{}};delete r.id;const o={...r,...this._map.get(t)};return Object.keys(o).length?o:void 0}return this._map.get(t)}has(t){return this._map.has(t)}}function u1(){return new c1}(Ql=globalThis).__zod_globalRegistry??(Ql.__zod_globalRegistry=u1());const Tr=globalThis.__zod_globalRegistry;function d1(e,t){return new e({type:"string",...ke(t)})}function f1(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...ke(t)})}function ec(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...ke(t)})}function p1(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...ke(t)})}function h1(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...ke(t)})}function m1(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...ke(t)})}function g1(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...ke(t)})}function x1(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...ke(t)})}function b1(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...ke(t)})}function y1(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...ke(t)})}function v1(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...ke(t)})}function w1(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...ke(t)})}function k1(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...ke(t)})}function _1(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...ke(t)})}function S1(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...ke(t)})}function C1(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...ke(t)})}function j1(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...ke(t)})}function N1(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...ke(t)})}function E1(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...ke(t)})}function T1(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...ke(t)})}function A1(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...ke(t)})}function I1(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...ke(t)})}function z1(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...ke(t)})}function R1(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...ke(t)})}function P1(e,t){return new e({type:"string",format:"date",check:"string_format",...ke(t)})}function O1(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...ke(t)})}function M1(e,t){return new e({type:"string",format:"duration",check:"string_format",...ke(t)})}function L1(e,t){return new e({type:"number",checks:[],...ke(t)})}function D1(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...ke(t)})}function F1(e,t){return new e({type:"boolean",...ke(t)})}function $1(e,t){return new e({type:"null",...ke(t)})}function B1(e){return new e({type:"unknown"})}function U1(e,t){return new e({type:"never",...ke(t)})}function tc(e,t){return new Kd({check:"less_than",...ke(t),value:e,inclusive:!1})}function Us(e,t){return new Kd({check:"less_than",...ke(t),value:e,inclusive:!0})}function nc(e,t){return new Gd({check:"greater_than",...ke(t),value:e,inclusive:!1})}function Ws(e,t){return new Gd({check:"greater_than",...ke(t),value:e,inclusive:!0})}function rc(e,t){return new e0({check:"multiple_of",...ke(t),value:e})}function nf(e,t){return new n0({check:"max_length",...ke(t),maximum:e})}function zo(e,t){return new r0({check:"min_length",...ke(t),minimum:e})}function rf(e,t){return new o0({check:"length_equals",...ke(t),length:e})}function W1(e,t){return new s0({check:"string_format",format:"regex",...ke(t),pattern:e})}function V1(e){return new i0({check:"string_format",format:"lowercase",...ke(e)})}function H1(e){return new a0({check:"string_format",format:"uppercase",...ke(e)})}function Z1(e,t){return new l0({check:"string_format",format:"includes",...ke(t),includes:e})}function q1(e,t){return new c0({check:"string_format",format:"starts_with",...ke(t),prefix:e})}function K1(e,t){return new u0({check:"string_format",format:"ends_with",...ke(t),suffix:e})}function ur(e){return new d0({check:"overwrite",tx:e})}function G1(e){return ur(t=>t.normalize(e))}function J1(){return ur(e=>e.trim())}function Y1(){return ur(e=>e.toLowerCase())}function X1(){return ur(e=>e.toUpperCase())}function Q1(){return ur(e=>ox(e))}function eb(e,t,n){return new e({type:"array",element:t,...ke(n)})}function tb(e,t,n){return new e({type:"custom",check:"custom",fn:t,...ke(n)})}function nb(e){const t=rb(n=>(n.addIssue=r=>{if(typeof r=="string")n.issues.push(Lr(r,n.value,t._zod.def));else{const o=r;o.fatal&&(o.continue=!1),o.code??(o.code="custom"),o.input??(o.input=n.value),o.inst??(o.inst=t),o.continue??(o.continue=!t._zod.def.abort),n.issues.push(Lr(o))}},e(n.value,n)));return t}function rb(e,t){const n=new pt({check:"custom",...ke(t)});return n._zod.check=e,n}function of(e){let t=e?.target??"draft-2020-12";return t==="draft-4"&&(t="draft-04"),t==="draft-7"&&(t="draft-07"),{processors:e.processors??{},metadataRegistry:e?.metadata??Tr,target:t,unrepresentable:e?.unrepresentable??"throw",override:e?.override??(()=>{}),io:e?.io??"output",counter:0,seen:new Map,cycles:e?.cycles??"ref",reused:e?.reused??"inline",external:e?.external??void 0}}function Xe(e,t,n={path:[],schemaPath:[]}){var r;const o=e._zod.def,s=t.seen.get(e);if(s)return s.count++,n.schemaPath.includes(e)&&(s.cycle=n.path),s.schema;const i={schema:{},count:1,cycle:void 0,path:n.path};t.seen.set(e,i);const l=e._zod.toJSONSchema?.();if(l)i.schema=l;else{const d={...n,schemaPath:[...n.schemaPath,e],path:n.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,i.schema,d);else{const h=i.schema,p=t.processors[o.type];if(!p)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${o.type}`);p(e,t,h,d)}const f=e._zod.parent;f&&(i.ref||(i.ref=f),Xe(f,t,d),t.seen.get(f).isParent=!0)}const c=t.metadataRegistry.get(e);return c&&Object.assign(i.schema,c),t.io==="input"&&at(e)&&(delete i.schema.examples,delete i.schema.default),t.io==="input"&&i.schema._prefault&&((r=i.schema).default??(r.default=i.schema._prefault)),delete i.schema._prefault,t.seen.get(e).schema}function sf(e,t){const n=e.seen.get(t);if(!n)throw new Error("Unprocessed schema. This is a bug in Zod.");const r=new Map;for(const i of e.seen.entries()){const l=e.metadataRegistry.get(i[0])?.id;if(l){const c=r.get(l);if(c&&c!==i[0])throw new Error(`Duplicate schema id "${l}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);r.set(l,i[0])}}const o=i=>{const l=e.target==="draft-2020-12"?"$defs":"definitions";if(e.external){const f=e.external.registry.get(i[0])?.id,h=e.external.uri??(y=>y);if(f)return{ref:h(f)};const p=i[1].defId??i[1].schema.id??`schema${e.counter++}`;return i[1].defId=p,{defId:p,ref:`${h("__shared")}#/${l}/${p}`}}if(i[1]===n)return{ref:"#"};const u=`#/${l}/`,d=i[1].schema.id??`__schema${e.counter++}`;return{defId:d,ref:u+d}},s=i=>{if(i[1].schema.$ref)return;const l=i[1],{ref:c,defId:u}=o(i);l.def={...l.schema},u&&(l.defId=u);const d=l.schema;for(const f in d)delete d[f];d.$ref=c};if(e.cycles==="throw")for(const i of e.seen.entries()){const l=i[1];if(l.cycle)throw new Error(`Cycle detected: #/${l.cycle?.join("/")}/<root>
|
|
39
39
|
|
|
40
|
-
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(const i of e.seen.entries()){const l=i[1];if(t===i[0]){s(i);continue}if(e.external){const u=e.external.registry.get(i[0])?.id;if(t!==i[0]&&u){s(i);continue}}if(e.metadataRegistry.get(i[0])?.id){s(i);continue}if(l.cycle){s(i);continue}if(l.count>1&&e.reused==="ref"){s(i);continue}}}function af(e,t){const n=e.seen.get(t);if(!n)throw new Error("Unprocessed schema. This is a bug in Zod.");const r=i=>{const l=e.seen.get(i);if(l.ref===null)return;const c=l.def??l.schema,u={...c},d=l.ref;if(l.ref=null,d){r(d);const h=e.seen.get(d),p=h.schema;if(p.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0")?(c.allOf=c.allOf??[],c.allOf.push(p)):Object.assign(c,p),Object.assign(c,u),i._zod.parent===d)for(const m in c)m==="$ref"||m==="allOf"||m in u||delete c[m];if(p.$ref&&h.def)for(const m in c)m==="$ref"||m==="allOf"||m in h.def&&JSON.stringify(c[m])===JSON.stringify(h.def[m])&&delete c[m]}const f=i._zod.parent;if(f&&f!==d){r(f);const h=e.seen.get(f);if(h?.schema.$ref&&(c.$ref=h.schema.$ref,h.def))for(const p in c)p==="$ref"||p==="allOf"||p in h.def&&JSON.stringify(c[p])===JSON.stringify(h.def[p])&&delete c[p]}e.override({zodSchema:i,jsonSchema:c,path:l.path??[]})};for(const i of[...e.seen.entries()].reverse())r(i[0]);const o={};if(e.target==="draft-2020-12"?o.$schema="https://json-schema.org/draft/2020-12/schema":e.target==="draft-07"?o.$schema="http://json-schema.org/draft-07/schema#":e.target==="draft-04"?o.$schema="http://json-schema.org/draft-04/schema#":e.target,e.external?.uri){const i=e.external.registry.get(t)?.id;if(!i)throw new Error("Schema is missing an `id` property");o.$id=e.external.uri(i)}Object.assign(o,n.def??n.schema);const s=e.external?.defs??{};for(const i of e.seen.entries()){const l=i[1];l.def&&l.defId&&(s[l.defId]=l.def)}e.external||Object.keys(s).length>0&&(e.target==="draft-2020-12"?o.$defs=s:o.definitions=s);try{const i=JSON.parse(JSON.stringify(o));return Object.defineProperty(i,"~standard",{value:{...t["~standard"],jsonSchema:{input:Ro(t,"input",e.processors),output:Ro(t,"output",e.processors)}},enumerable:!1,writable:!1}),i}catch{throw new Error("Error converting schema to JSON.")}}function at(e,t){const n=t??{seen:new Set};if(n.seen.has(e))return!1;n.seen.add(e);const r=e._zod.def;if(r.type==="transform")return!0;if(r.type==="array")return at(r.element,n);if(r.type==="set")return at(r.valueType,n);if(r.type==="lazy")return at(r.getter(),n);if(r.type==="promise"||r.type==="optional"||r.type==="nonoptional"||r.type==="nullable"||r.type==="readonly"||r.type==="default"||r.type==="prefault")return at(r.innerType,n);if(r.type==="intersection")return at(r.left,n)||at(r.right,n);if(r.type==="record"||r.type==="map")return at(r.keyType,n)||at(r.valueType,n);if(r.type==="pipe")return at(r.in,n)||at(r.out,n);if(r.type==="object"){for(const o in r.shape)if(at(r.shape[o],n))return!0;return!1}if(r.type==="union"){for(const o of r.options)if(at(o,n))return!0;return!1}if(r.type==="tuple"){for(const o of r.items)if(at(o,n))return!0;return!!(r.rest&&at(r.rest,n))}return!1}const ob=(e,t={})=>n=>{const r=of({...n,processors:t});return Xe(e,r),sf(r,e),af(r,e)},Ro=(e,t,n={})=>r=>{const{libraryOptions:o,target:s}=r??{},i=of({...o??{},target:s,io:t,processors:n});return Xe(e,i),sf(i,e),af(i,e)},sb={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},ib=(e,t,n,r)=>{const o=n;o.type="string";const{minimum:s,maximum:i,format:l,patterns:c,contentEncoding:u}=e._zod.bag;if(typeof s=="number"&&(o.minLength=s),typeof i=="number"&&(o.maxLength=i),l&&(o.format=sb[l]??l,o.format===""&&delete o.format,l==="time"&&delete o.format),u&&(o.contentEncoding=u),c&&c.size>0){const d=[...c];d.length===1?o.pattern=d[0].source:d.length>1&&(o.allOf=[...d.map(f=>({...t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0"?{type:"string"}:{},pattern:f.source}))])}},ab=(e,t,n,r)=>{const o=n,{minimum:s,maximum:i,format:l,multipleOf:c,exclusiveMaximum:u,exclusiveMinimum:d}=e._zod.bag;typeof l=="string"&&l.includes("int")?o.type="integer":o.type="number",typeof d=="number"&&(t.target==="draft-04"||t.target==="openapi-3.0"?(o.minimum=d,o.exclusiveMinimum=!0):o.exclusiveMinimum=d),typeof s=="number"&&(o.minimum=s,typeof d=="number"&&t.target!=="draft-04"&&(d>=s?delete o.minimum:delete o.exclusiveMinimum)),typeof u=="number"&&(t.target==="draft-04"||t.target==="openapi-3.0"?(o.maximum=u,o.exclusiveMaximum=!0):o.exclusiveMaximum=u),typeof i=="number"&&(o.maximum=i,typeof u=="number"&&t.target!=="draft-04"&&(u<=i?delete o.maximum:delete o.exclusiveMaximum)),typeof c=="number"&&(o.multipleOf=c)},lb=(e,t,n,r)=>{n.type="boolean"},cb=(e,t,n,r)=>{t.target==="openapi-3.0"?(n.type="string",n.nullable=!0,n.enum=[null]):n.type="null"},ub=(e,t,n,r)=>{n.not={}},db=(e,t,n,r)=>{},fb=(e,t,n,r)=>{const o=e._zod.def,s=Ld(o.entries);s.every(i=>typeof i=="number")&&(n.type="number"),s.every(i=>typeof i=="string")&&(n.type="string"),n.enum=s},pb=(e,t,n,r)=>{const o=e._zod.def,s=[];for(const i of o.values)if(i===void 0){if(t.unrepresentable==="throw")throw new Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof i=="bigint"){if(t.unrepresentable==="throw")throw new Error("BigInt literals cannot be represented in JSON Schema");s.push(Number(i))}else s.push(i);if(s.length!==0)if(s.length===1){const i=s[0];n.type=i===null?"null":typeof i,t.target==="draft-04"||t.target==="openapi-3.0"?n.enum=[i]:n.const=i}else s.every(i=>typeof i=="number")&&(n.type="number"),s.every(i=>typeof i=="string")&&(n.type="string"),s.every(i=>typeof i=="boolean")&&(n.type="boolean"),s.every(i=>i===null)&&(n.type="null"),n.enum=s},hb=(e,t,n,r)=>{if(t.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema")},mb=(e,t,n,r)=>{if(t.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema")},gb=(e,t,n,r)=>{const o=n,s=e._zod.def,{minimum:i,maximum:l}=e._zod.bag;typeof i=="number"&&(o.minItems=i),typeof l=="number"&&(o.maxItems=l),o.type="array",o.items=Xe(s.element,t,{...r,path:[...r.path,"items"]})},xb=(e,t,n,r)=>{const o=n,s=e._zod.def;o.type="object",o.properties={};const i=s.shape;for(const u in i)o.properties[u]=Xe(i[u],t,{...r,path:[...r.path,"properties",u]});const l=new Set(Object.keys(i)),c=new Set([...l].filter(u=>{const d=s.shape[u]._zod;return t.io==="input"?d.optin===void 0:d.optout===void 0}));c.size>0&&(o.required=Array.from(c)),s.catchall?._zod.def.type==="never"?o.additionalProperties=!1:s.catchall?s.catchall&&(o.additionalProperties=Xe(s.catchall,t,{...r,path:[...r.path,"additionalProperties"]})):t.io==="output"&&(o.additionalProperties=!1)},bb=(e,t,n,r)=>{const o=e._zod.def,s=o.inclusive===!1,i=o.options.map((l,c)=>Xe(l,t,{...r,path:[...r.path,s?"oneOf":"anyOf",c]}));s?n.oneOf=i:n.anyOf=i},yb=(e,t,n,r)=>{const o=e._zod.def,s=Xe(o.left,t,{...r,path:[...r.path,"allOf",0]}),i=Xe(o.right,t,{...r,path:[...r.path,"allOf",1]}),l=u=>"allOf"in u&&Object.keys(u).length===1,c=[...l(s)?s.allOf:[s],...l(i)?i.allOf:[i]];n.allOf=c},vb=(e,t,n,r)=>{const o=n,s=e._zod.def;o.type="object";const i=s.keyType,c=i._zod.bag?.patterns;if(s.mode==="loose"&&c&&c.size>0){const d=Xe(s.valueType,t,{...r,path:[...r.path,"patternProperties","*"]});o.patternProperties={};for(const f of c)o.patternProperties[f.source]=d}else(t.target==="draft-07"||t.target==="draft-2020-12")&&(o.propertyNames=Xe(s.keyType,t,{...r,path:[...r.path,"propertyNames"]})),o.additionalProperties=Xe(s.valueType,t,{...r,path:[...r.path,"additionalProperties"]});const u=i._zod.values;if(u){const d=[...u].filter(f=>typeof f=="string"||typeof f=="number");d.length>0&&(o.required=d)}},wb=(e,t,n,r)=>{const o=e._zod.def,s=Xe(o.innerType,t,r),i=t.seen.get(e);t.target==="openapi-3.0"?(i.ref=o.innerType,n.nullable=!0):n.anyOf=[s,{type:"null"}]},kb=(e,t,n,r)=>{const o=e._zod.def;Xe(o.innerType,t,r);const s=t.seen.get(e);s.ref=o.innerType},_b=(e,t,n,r)=>{const o=e._zod.def;Xe(o.innerType,t,r);const s=t.seen.get(e);s.ref=o.innerType,n.default=JSON.parse(JSON.stringify(o.defaultValue))},Sb=(e,t,n,r)=>{const o=e._zod.def;Xe(o.innerType,t,r);const s=t.seen.get(e);s.ref=o.innerType,t.io==="input"&&(n._prefault=JSON.parse(JSON.stringify(o.defaultValue)))},Cb=(e,t,n,r)=>{const o=e._zod.def;Xe(o.innerType,t,r);const s=t.seen.get(e);s.ref=o.innerType;let i;try{i=o.catchValue(void 0)}catch{throw new Error("Dynamic catch values are not supported in JSON Schema")}n.default=i},jb=(e,t,n,r)=>{const o=e._zod.def,s=t.io==="input"?o.in._zod.def.type==="transform"?o.out:o.in:o.out;Xe(s,t,r);const i=t.seen.get(e);i.ref=s},Nb=(e,t,n,r)=>{const o=e._zod.def;Xe(o.innerType,t,r);const s=t.seen.get(e);s.ref=o.innerType,n.readOnly=!0},lf=(e,t,n,r)=>{const o=e._zod.def;Xe(o.innerType,t,r);const s=t.seen.get(e);s.ref=o.innerType},Eb=(e,t,n,r)=>{const o=e._zod.innerType;Xe(o,t,r);const s=t.seen.get(e);s.ref=o},Tb=re("ZodISODateTime",(e,t)=>{C0.init(e,t),Ye.init(e,t)});function Ab(e){return R1(Tb,e)}const Ib=re("ZodISODate",(e,t)=>{j0.init(e,t),Ye.init(e,t)});function zb(e){return P1(Ib,e)}const Rb=re("ZodISOTime",(e,t)=>{N0.init(e,t),Ye.init(e,t)});function Pb(e){return O1(Rb,e)}const Ob=re("ZodISODuration",(e,t)=>{E0.init(e,t),Ye.init(e,t)});function Mb(e){return M1(Ob,e)}const Lb=(e,t)=>{Bd.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:n=>xx(e,n)},flatten:{value:n=>gx(e,n)},addIssue:{value:n=>{e.issues.push(n),e.message=JSON.stringify(e.issues,ji,2)}},addIssues:{value:n=>{e.issues.push(...n),e.message=JSON.stringify(e.issues,ji,2)}},isEmpty:{get(){return e.issues.length===0}}})},kt=re("ZodError",Lb,{Parent:Error}),Db=ja(kt),Fb=Na(kt),$b=as(kt),Bb=ls(kt),Ub=vx(kt),Wb=wx(kt),Hb=kx(kt),Vb=_x(kt),Zb=Sx(kt),qb=Cx(kt),Kb=jx(kt),Gb=Nx(kt),Ke=re("ZodType",(e,t)=>(qe.init(e,t),Object.assign(e["~standard"],{jsonSchema:{input:Ro(e,"input"),output:Ro(e,"output")}}),e.toJSONSchema=ob(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.check=(...n)=>e.clone(xn(t,{checks:[...t.checks??[],...n.map(r=>typeof r=="function"?{_zod:{check:r,def:{check:"custom"},onattach:[]}}:r)]}),{parent:!0}),e.with=e.check,e.clone=(n,r)=>bn(e,n,r),e.brand=()=>e,e.register=((n,r)=>(n.add(e,r),e)),e.parse=(n,r)=>Db(e,n,r,{callee:e.parse}),e.safeParse=(n,r)=>$b(e,n,r),e.parseAsync=async(n,r)=>Fb(e,n,r,{callee:e.parseAsync}),e.safeParseAsync=async(n,r)=>Bb(e,n,r),e.spa=e.safeParseAsync,e.encode=(n,r)=>Ub(e,n,r),e.decode=(n,r)=>Wb(e,n,r),e.encodeAsync=async(n,r)=>Hb(e,n,r),e.decodeAsync=async(n,r)=>Vb(e,n,r),e.safeEncode=(n,r)=>Zb(e,n,r),e.safeDecode=(n,r)=>qb(e,n,r),e.safeEncodeAsync=async(n,r)=>Kb(e,n,r),e.safeDecodeAsync=async(n,r)=>Gb(e,n,r),e.refine=(n,r)=>e.check(Vy(n,r)),e.superRefine=n=>e.check(Zy(n)),e.overwrite=n=>e.check(lr(n)),e.optional=()=>ic(e),e.exactOptional=()=>Ay(e),e.nullable=()=>ac(e),e.nullish=()=>ic(ac(e)),e.nonoptional=n=>My(e,n),e.array=()=>we(e),e.or=n=>rn([e,n]),e.and=n=>Sy(e,n),e.transform=n=>lc(e,Ey(n)),e.default=n=>Ry(e,n),e.prefault=n=>Oy(e,n),e.catch=n=>Dy(e,n),e.pipe=n=>lc(e,n),e.readonly=()=>By(e),e.describe=n=>{const r=e.clone();return Nr.add(r,{description:n}),r},Object.defineProperty(e,"description",{get(){return Nr.get(e)?.description},configurable:!0}),e.meta=(...n)=>{if(n.length===0)return Nr.get(e);const r=e.clone();return Nr.add(r,n[0]),r},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e.apply=n=>n(e),e)),cf=re("_ZodString",(e,t)=>{Ea.init(e,t),Ke.init(e,t),e._zod.processJSONSchema=(r,o,s)=>ib(e,r,o);const n=e._zod.bag;e.format=n.format??null,e.minLength=n.minimum??null,e.maxLength=n.maximum??null,e.regex=(...r)=>e.check(W1(...r)),e.includes=(...r)=>e.check(Z1(...r)),e.startsWith=(...r)=>e.check(q1(...r)),e.endsWith=(...r)=>e.check(K1(...r)),e.min=(...r)=>e.check(zo(...r)),e.max=(...r)=>e.check(nf(...r)),e.length=(...r)=>e.check(rf(...r)),e.nonempty=(...r)=>e.check(zo(1,...r)),e.lowercase=r=>e.check(H1(r)),e.uppercase=r=>e.check(V1(r)),e.trim=()=>e.check(J1()),e.normalize=(...r)=>e.check(G1(...r)),e.toLowerCase=()=>e.check(Y1()),e.toUpperCase=()=>e.check(X1()),e.slugify=()=>e.check(Q1())}),Jb=re("ZodString",(e,t)=>{Ea.init(e,t),cf.init(e,t),e.email=n=>e.check(f1(Yb,n)),e.url=n=>e.check(x1(Xb,n)),e.jwt=n=>e.check(z1(py,n)),e.emoji=n=>e.check(b1(Qb,n)),e.guid=n=>e.check(ec(oc,n)),e.uuid=n=>e.check(p1(so,n)),e.uuidv4=n=>e.check(h1(so,n)),e.uuidv6=n=>e.check(m1(so,n)),e.uuidv7=n=>e.check(g1(so,n)),e.nanoid=n=>e.check(y1(ey,n)),e.guid=n=>e.check(ec(oc,n)),e.cuid=n=>e.check(v1(ty,n)),e.cuid2=n=>e.check(w1(ny,n)),e.ulid=n=>e.check(k1(ry,n)),e.base64=n=>e.check(T1(uy,n)),e.base64url=n=>e.check(A1(dy,n)),e.xid=n=>e.check(_1(oy,n)),e.ksuid=n=>e.check(S1(sy,n)),e.ipv4=n=>e.check(C1(iy,n)),e.ipv6=n=>e.check(j1(ay,n)),e.cidrv4=n=>e.check(N1(ly,n)),e.cidrv6=n=>e.check(E1(cy,n)),e.e164=n=>e.check(I1(fy,n)),e.datetime=n=>e.check(Ab(n)),e.date=n=>e.check(zb(n)),e.time=n=>e.check(Pb(n)),e.duration=n=>e.check(Mb(n))});function A(e){return d1(Jb,e)}const Ye=re("ZodStringFormat",(e,t)=>{Ge.init(e,t),cf.init(e,t)}),Yb=re("ZodEmail",(e,t)=>{g0.init(e,t),Ye.init(e,t)}),oc=re("ZodGUID",(e,t)=>{h0.init(e,t),Ye.init(e,t)}),so=re("ZodUUID",(e,t)=>{m0.init(e,t),Ye.init(e,t)}),Xb=re("ZodURL",(e,t)=>{x0.init(e,t),Ye.init(e,t)}),Qb=re("ZodEmoji",(e,t)=>{b0.init(e,t),Ye.init(e,t)}),ey=re("ZodNanoID",(e,t)=>{y0.init(e,t),Ye.init(e,t)}),ty=re("ZodCUID",(e,t)=>{v0.init(e,t),Ye.init(e,t)}),ny=re("ZodCUID2",(e,t)=>{w0.init(e,t),Ye.init(e,t)}),ry=re("ZodULID",(e,t)=>{k0.init(e,t),Ye.init(e,t)}),oy=re("ZodXID",(e,t)=>{_0.init(e,t),Ye.init(e,t)}),sy=re("ZodKSUID",(e,t)=>{S0.init(e,t),Ye.init(e,t)}),iy=re("ZodIPv4",(e,t)=>{T0.init(e,t),Ye.init(e,t)}),ay=re("ZodIPv6",(e,t)=>{A0.init(e,t),Ye.init(e,t)}),ly=re("ZodCIDRv4",(e,t)=>{I0.init(e,t),Ye.init(e,t)}),cy=re("ZodCIDRv6",(e,t)=>{z0.init(e,t),Ye.init(e,t)}),uy=re("ZodBase64",(e,t)=>{R0.init(e,t),Ye.init(e,t)}),dy=re("ZodBase64URL",(e,t)=>{O0.init(e,t),Ye.init(e,t)}),fy=re("ZodE164",(e,t)=>{M0.init(e,t),Ye.init(e,t)}),py=re("ZodJWT",(e,t)=>{D0.init(e,t),Ye.init(e,t)}),uf=re("ZodNumber",(e,t)=>{Yd.init(e,t),Ke.init(e,t),e._zod.processJSONSchema=(r,o,s)=>ab(e,r,o),e.gt=(r,o)=>e.check(nc(r,o)),e.gte=(r,o)=>e.check(Ws(r,o)),e.min=(r,o)=>e.check(Ws(r,o)),e.lt=(r,o)=>e.check(tc(r,o)),e.lte=(r,o)=>e.check(Us(r,o)),e.max=(r,o)=>e.check(Us(r,o)),e.int=r=>e.check(sc(r)),e.safe=r=>e.check(sc(r)),e.positive=r=>e.check(nc(0,r)),e.nonnegative=r=>e.check(Ws(0,r)),e.negative=r=>e.check(tc(0,r)),e.nonpositive=r=>e.check(Us(0,r)),e.multipleOf=(r,o)=>e.check(rc(r,o)),e.step=(r,o)=>e.check(rc(r,o)),e.finite=()=>e;const n=e._zod.bag;e.minValue=Math.max(n.minimum??Number.NEGATIVE_INFINITY,n.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,e.maxValue=Math.min(n.maximum??Number.POSITIVE_INFINITY,n.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,e.isInt=(n.format??"").includes("int")||Number.isSafeInteger(n.multipleOf??.5),e.isFinite=!0,e.format=n.format??null});function ie(e){return L1(uf,e)}const hy=re("ZodNumberFormat",(e,t)=>{F0.init(e,t),uf.init(e,t)});function sc(e){return D1(hy,e)}const my=re("ZodBoolean",(e,t)=>{$0.init(e,t),Ke.init(e,t),e._zod.processJSONSchema=(n,r,o)=>lb(e,n,r)});function Ze(e){return F1(my,e)}const gy=re("ZodNull",(e,t)=>{B0.init(e,t),Ke.init(e,t),e._zod.processJSONSchema=(n,r,o)=>cb(e,n,r)});function Ei(e){return $1(gy,e)}const xy=re("ZodUnknown",(e,t)=>{U0.init(e,t),Ke.init(e,t),e._zod.processJSONSchema=(n,r,o)=>db()});function Ti(){return B1(xy)}const by=re("ZodNever",(e,t)=>{W0.init(e,t),Ke.init(e,t),e._zod.processJSONSchema=(n,r,o)=>ub(e,n,r)});function yy(e){return U1(by,e)}const vy=re("ZodArray",(e,t)=>{H0.init(e,t),Ke.init(e,t),e._zod.processJSONSchema=(n,r,o)=>gb(e,n,r,o),e.element=t.element,e.min=(n,r)=>e.check(zo(n,r)),e.nonempty=n=>e.check(zo(1,n)),e.max=(n,r)=>e.check(nf(n,r)),e.length=(n,r)=>e.check(rf(n,r)),e.unwrap=()=>e.element});function we(e,t){return eb(vy,e,t)}const wy=re("ZodObject",(e,t)=>{Z0.init(e,t),Ke.init(e,t),e._zod.processJSONSchema=(n,r,o)=>xb(e,n,r,o),ze(e,"shape",()=>t.shape),e.keyof=()=>Re(Object.keys(e._zod.def.shape)),e.catchall=n=>e.clone({...e._zod.def,catchall:n}),e.passthrough=()=>e.clone({...e._zod.def,catchall:Ti()}),e.loose=()=>e.clone({...e._zod.def,catchall:Ti()}),e.strict=()=>e.clone({...e._zod.def,catchall:yy()}),e.strip=()=>e.clone({...e._zod.def,catchall:void 0}),e.extend=n=>dx(e,n),e.safeExtend=n=>fx(e,n),e.merge=n=>px(e,n),e.pick=n=>cx(e,n),e.omit=n=>ux(e,n),e.partial=(...n)=>hx(ff,e,n[0]),e.required=(...n)=>mx(pf,e,n[0])});function te(e,t){const n={type:"object",shape:e??{},...ke(t)};return new wy(n)}const df=re("ZodUnion",(e,t)=>{ef.init(e,t),Ke.init(e,t),e._zod.processJSONSchema=(n,r,o)=>bb(e,n,r,o),e.options=t.options});function rn(e,t){return new df({type:"union",options:e,...ke(t)})}const ky=re("ZodDiscriminatedUnion",(e,t)=>{df.init(e,t),q0.init(e,t)});function Rn(e,t,n){return new ky({type:"union",options:t,discriminator:e,...ke(n)})}const _y=re("ZodIntersection",(e,t)=>{K0.init(e,t),Ke.init(e,t),e._zod.processJSONSchema=(n,r,o)=>yb(e,n,r,o)});function Sy(e,t){return new _y({type:"intersection",left:e,right:t})}const Cy=re("ZodRecord",(e,t)=>{G0.init(e,t),Ke.init(e,t),e._zod.processJSONSchema=(n,r,o)=>vb(e,n,r,o),e.keyType=t.keyType,e.valueType=t.valueType});function nt(e,t,n){return new Cy({type:"record",keyType:e,valueType:t,...ke(n)})}const Ai=re("ZodEnum",(e,t)=>{J0.init(e,t),Ke.init(e,t),e._zod.processJSONSchema=(r,o,s)=>fb(e,r,o),e.enum=t.entries,e.options=Object.values(t.entries);const n=new Set(Object.keys(t.entries));e.extract=(r,o)=>{const s={};for(const i of r)if(n.has(i))s[i]=t.entries[i];else throw new Error(`Key ${i} not found in enum`);return new Ai({...t,checks:[],...ke(o),entries:s})},e.exclude=(r,o)=>{const s={...t.entries};for(const i of r)if(n.has(i))delete s[i];else throw new Error(`Key ${i} not found in enum`);return new Ai({...t,checks:[],...ke(o),entries:s})}});function Re(e,t){const n=Array.isArray(e)?Object.fromEntries(e.map(r=>[r,r])):e;return new Ai({type:"enum",entries:n,...ke(t)})}const jy=re("ZodLiteral",(e,t)=>{Y0.init(e,t),Ke.init(e,t),e._zod.processJSONSchema=(n,r,o)=>pb(e,n,r),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function je(e,t){return new jy({type:"literal",values:Array.isArray(e)?e:[e],...ke(t)})}const Ny=re("ZodTransform",(e,t)=>{X0.init(e,t),Ke.init(e,t),e._zod.processJSONSchema=(n,r,o)=>mb(e,n),e._zod.parse=(n,r)=>{if(r.direction==="backward")throw new Od(e.constructor.name);n.addIssue=s=>{if(typeof s=="string")n.issues.push(Or(s,n.value,t));else{const i=s;i.fatal&&(i.continue=!1),i.code??(i.code="custom"),i.input??(i.input=n.value),i.inst??(i.inst=e),n.issues.push(Or(i))}};const o=t.transform(n.value,n);return o instanceof Promise?o.then(s=>(n.value=s,n)):(n.value=o,n)}});function Ey(e){return new Ny({type:"transform",transform:e})}const ff=re("ZodOptional",(e,t)=>{tf.init(e,t),Ke.init(e,t),e._zod.processJSONSchema=(n,r,o)=>lf(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function ic(e){return new ff({type:"optional",innerType:e})}const Ty=re("ZodExactOptional",(e,t)=>{Q0.init(e,t),Ke.init(e,t),e._zod.processJSONSchema=(n,r,o)=>lf(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function Ay(e){return new Ty({type:"optional",innerType:e})}const Iy=re("ZodNullable",(e,t)=>{e1.init(e,t),Ke.init(e,t),e._zod.processJSONSchema=(n,r,o)=>wb(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function ac(e){return new Iy({type:"nullable",innerType:e})}const zy=re("ZodDefault",(e,t)=>{t1.init(e,t),Ke.init(e,t),e._zod.processJSONSchema=(n,r,o)=>_b(e,n,r,o),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function Ry(e,t){return new zy({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():Fd(t)}})}const Py=re("ZodPrefault",(e,t)=>{n1.init(e,t),Ke.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Sb(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function Oy(e,t){return new Py({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():Fd(t)}})}const pf=re("ZodNonOptional",(e,t)=>{r1.init(e,t),Ke.init(e,t),e._zod.processJSONSchema=(n,r,o)=>kb(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function My(e,t){return new pf({type:"nonoptional",innerType:e,...ke(t)})}const Ly=re("ZodCatch",(e,t)=>{o1.init(e,t),Ke.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Cb(e,n,r,o),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function Dy(e,t){return new Ly({type:"catch",innerType:e,catchValue:typeof t=="function"?t:()=>t})}const Fy=re("ZodPipe",(e,t)=>{s1.init(e,t),Ke.init(e,t),e._zod.processJSONSchema=(n,r,o)=>jb(e,n,r,o),e.in=t.in,e.out=t.out});function lc(e,t){return new Fy({type:"pipe",in:e,out:t})}const $y=re("ZodReadonly",(e,t)=>{i1.init(e,t),Ke.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Nb(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function By(e){return new $y({type:"readonly",innerType:e})}const Uy=re("ZodLazy",(e,t)=>{a1.init(e,t),Ke.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Eb(e,n,r,o),e.unwrap=()=>e._zod.def.getter()});function Wy(e){return new Uy({type:"lazy",getter:e})}const Hy=re("ZodCustom",(e,t)=>{l1.init(e,t),Ke.init(e,t),e._zod.processJSONSchema=(n,r,o)=>hb(e,n)});function Vy(e,t={}){return tb(Hy,e,t)}function Zy(e){return nb(e)}const ft=Wy(()=>rn([A(),ie(),Ze(),Ei(),we(ft),nt(A(),ft)]));const Ta=te({type:A(),ttl:A().optional(),scope:A().optional()}),Aa=te({type:je("text"),text:A(),cache_control:Ta.optional()}),hf=te({type:je("thinking"),thinking:A(),signature:A().optional()}),qy=te({type:je("think"),thinking:A(),signature:A().optional()}),Ky=te({type:je("base64"),media_type:A(),data:A()}),mf=te({type:je("image"),source:Ky}),gf=te({type:je("tool_use"),id:A(),name:A(),input:nt(A(),ft)}),Gy=Rn("type",[Aa,mf]),Jy=te({type:je("tool_result"),tool_use_id:A().optional(),content:rn([A(),we(Gy)]),is_error:Ze().optional()}),Yy=Rn("type",[Aa,hf,mf,gf,Jy]),Xy=rn([A(),we(Yy)]),Qy=te({role:Re(["user","assistant"]),content:Xy}),ev=te({type:je("text"),text:A(),cache_control:Ta.optional()}),tv=te({type:A(),properties:nt(A(),nt(A(),ft)).optional(),required:we(A()).optional(),additionalProperties:Ze().optional(),$schema:A().optional()}),nv=te({name:A(),description:A().optional(),input_schema:tv.optional(),cache_control:Ta.optional()}),rv=Rn("type",[te({type:je("enabled"),budget_tokens:ie()}),te({type:je("disabled")}),te({type:je("adaptive")})]),xf=te({model:A(),messages:we(Qy),system:we(ev).optional(),tools:we(nv).optional(),max_tokens:ie().optional(),temperature:ie().optional(),stream:Ze().optional(),thinking:rv.optional(),metadata:te({user_id:A().optional()}).optional()}),Ia=Rn("type",[Aa,hf,qy,gf]),ov=te({input_tokens:ie().nullable().optional(),output_tokens:ie().nullable().optional(),cache_creation_input_tokens:ie().nullable().optional(),cache_read_input_tokens:ie().nullable().optional()}).passthrough(),bf=te({id:A(),type:je("message"),model:A(),role:je("assistant"),content:we(Ia),stop_reason:A().nullable(),stop_sequence:A().nullable().optional(),usage:ov}).passthrough(),sv=te({type:je("message_start"),message:te({id:A(),type:je("message"),model:A(),role:je("assistant"),content:we(Ia),stop_reason:Ei(),stop_sequence:Ei(),usage:te({input_tokens:ie(),cache_creation_input_tokens:ie().optional(),cache_read_input_tokens:ie().optional()}).passthrough()})}),iv=te({type:je("content_block_start"),index:ie(),content_block:Ia}),av=Rn("type",[te({type:je("text_delta"),text:A()}),te({type:je("input_json_delta"),partial_json:A()}),te({type:je("thinking_delta"),thinking:A()}),te({type:je("signature_delta"),signature:A()})]),lv=te({type:je("content_block_delta"),index:ie(),delta:av}),cv=te({type:je("content_block_stop"),index:ie()}),uv=te({type:je("message_delta"),delta:te({stop_reason:A().nullable(),stop_sequence:A().nullable().optional()}),usage:te({output_tokens:ie(),input_tokens:ie().optional(),cache_creation_input_tokens:ie().optional(),cache_read_input_tokens:ie().optional()}).passthrough()}),dv=te({type:je("message_stop")}),fv=te({type:je("ping")}),pv=te({type:je("error"),error:te({type:A(),message:A()})}),hv=Rn("type",[sv,iv,lv,cv,uv,dv,fv,pv]),mv=rn([A(),we(Rn("type",[te({type:je("text"),text:A()}),te({type:je("image_url"),image_url:te({url:A(),detail:A().optional()})})]))]),yf=te({role:Re(["system","user","assistant","tool"]),content:mv,name:A().optional(),reasoning_content:A().optional(),thinking:A().optional(),think:A().optional()}),gv=te({name:A(),arguments:A()}),vf=te({index:ie().optional(),id:A().optional(),type:je("function").optional(),function:te({name:A().optional(),arguments:A().optional()})});yf.extend({content:rn([A(),we(te({type:je("text"),text:A()}))]).optional(),function_call:gv.optional(),tool_calls:we(vf).optional()});const xv=te({type:je("function"),function:te({name:A(),description:A().optional(),parameters:nt(A(),ft)})}),wf=te({model:A(),messages:we(yf),temperature:ie().optional(),max_tokens:ie().optional(),stream:Ze().optional(),tools:we(xv).optional(),tool_choice:rn([Re(["auto","none","required"]),te({type:je("auto")}),te({type:je("none")}),te({type:je("function"),function:te({name:A()})})]).optional(),user:A().optional()}),kf=te({role:Re(["assistant"]).optional(),content:A().nullable().optional(),reasoning_content:A().nullable().optional(),thinking:A().nullable().optional(),think:A().nullable().optional(),function_call:te({name:A().optional(),arguments:A().optional()}).nullable().optional(),tool_calls:we(te({index:ie(),id:A().optional(),type:je("function").optional(),function:te({name:A().optional(),arguments:A().optional()})})).nullable().optional()}),bv=te({index:ie(),message:te({role:Re(["assistant"]),content:A().nullable(),reasoning_content:A().optional(),thinking:A().optional(),think:A().optional(),function_call:te({name:A(),arguments:A()}).nullable().optional(),tool_calls:we(vf).optional()}).optional(),delta:kf.optional(),finish_reason:A().nullable()}),yv=te({id:A(),object:je("chat.completion"),created:ie(),model:A(),choices:we(bv),usage:te({prompt_tokens:ie().nullable().optional(),completion_tokens:ie().nullable().optional(),total_tokens:ie().nullable().optional()}).passthrough(),service_tier:A().nullable().optional(),system_fingerprint:A().nullable().optional()}).passthrough(),vv=te({id:A(),object:je("chat.completion.chunk"),created:ie(),model:A(),choices:we(te({index:ie(),delta:kf,finish_reason:A().nullable().optional()})),usage:te({prompt_tokens:ie().nullable().optional(),completion_tokens:ie().nullable().optional(),total_tokens:ie().nullable().optional()}).passthrough().nullable().optional()}).passthrough();function _f(e){try{const t=JSON.parse(e),n=yv.safeParse(t);return n.success?n.data:null}catch{return null}}const Sf=te({index:ie(),timestamp:ie(),type:A(),data:ft}),wv=te({chunks:we(Sf),truncated:Ze().optional().default(!1)}),cc=te({id:ie(),timestamp:A(),method:A(),path:A(),model:A().nullable(),sessionId:A().nullable(),rawRequestBody:A().nullable(),responseStatus:ie().nullable(),responseText:A().nullable(),inputTokens:ie().nullable(),outputTokens:ie().nullable(),cacheCreationInputTokens:ie().nullable(),cacheReadInputTokens:ie().nullable(),elapsedMs:ie().nullable(),firstChunkMs:ie().nullable().optional(),totalStreamMs:ie().nullable().optional(),tokensPerSecond:ie().nullable().optional(),streaming:Ze(),userAgent:A().nullable(),origin:A().nullable(),rawHeaders:nt(A(),A()).optional(),headers:nt(A(),A()).optional(),apiFormat:Re(["anthropic","openai","unknown"]).default("unknown"),isTest:Ze().optional().default(!1),replayOfLogId:ie().nullable().optional(),providerName:A().nullable().optional(),clientPort:ie().nullable().optional(),clientPid:ie().nullable().optional(),clientCwd:A().nullable().optional(),clientProjectFolder:A().nullable().optional(),streamingChunks:wv.optional(),streamingChunksPath:A().nullable().optional(),rawRequestBodyBytes:ie().int().nonnegative().nullable().optional(),responseTextBytes:ie().int().nonnegative().nullable().optional(),bodyContentMode:Re(["full","compact","truncated"]).optional(),error:A().nullable().optional()});te({model:A()});te({model:A().optional(),metadata:te({user_id:A().optional()}).passthrough().optional()});const kv=te({error:A()});async function It(e,t){const n=await e.json();return t.parse(n)}async function Qt(e,t){try{const n=await e.json(),r=kv.safeParse(n);return r.success?r.data.error:t}catch{return t}}async function Pn(e,t,n,r){const o=await fetch(e,n);if(!o.ok){const s=r?.(o)??`Request failed with status ${o.status}`;throw new Error(await Qt(o,s))}return It(o,t)}const Po=10,Ii=600,Oo=60,zi=600,Mo="time",za="simple",Cf=Re(["time","full"]),_v=Re(["simple","full"]),us=te({stripClaudeCodeBillingHeader:Ze(),hasSeenOnboarding:Ze().default(!1),slowResponseThresholdSeconds:ie().int().min(0).max(Ii).default(Po),providerTestTimeoutSeconds:ie().int().min(1).max(zi).default(Oo),timeDisplayFormat:Cf.default(Mo),captureMode:_v.default(za)}),Zn="/api/config";async function Sv(e){return Pn(e,us,void 0,t=>`Failed to fetch ${e}: ${t.status}`)}async function io(e){return Pn(Zn,us,{method:"PATCH",headers:{"content-type":"application/json"},body:JSON.stringify(e)},t=>`PATCH failed with status ${t.status}`)}function Ra(){const e=Vr(Zn,Sv,{revalidateOnFocus:!1,revalidateIfStale:!1}),{mutate:t}=zd(),n=e.data?.stripClaudeCodeBillingHeader??!1,r=e.data?.captureMode??za,o=e.data?.slowResponseThresholdSeconds??Po,s=e.data?.providerTestTimeoutSeconds??Oo,i=e.data?.timeDisplayFormat??Mo,l=h=>({stripClaudeCodeBillingHeader:e.data?.stripClaudeCodeBillingHeader??!1,hasSeenOnboarding:e.data?.hasSeenOnboarding??!1,slowResponseThresholdSeconds:e.data?.slowResponseThresholdSeconds??Po,providerTestTimeoutSeconds:e.data?.providerTestTimeoutSeconds??Oo,timeDisplayFormat:e.data?.timeDisplayFormat??Mo,captureMode:r,...h}),c=async h=>{await t(Zn,io({stripClaudeCodeBillingHeader:h}),{optimisticData:l({stripClaudeCodeBillingHeader:h}),rollbackOnError:!0,revalidate:!1})},u=async h=>{await t(Zn,io({slowResponseThresholdSeconds:h}),{optimisticData:l({slowResponseThresholdSeconds:h}),rollbackOnError:!0,revalidate:!1})},d=async h=>{await t(Zn,io({timeDisplayFormat:h}),{optimisticData:l({timeDisplayFormat:h}),rollbackOnError:!0,revalidate:!1})},f=async h=>{await t(Zn,io({providerTestTimeoutSeconds:h}),{optimisticData:l({providerTestTimeoutSeconds:h}),rollbackOnError:!0,revalidate:!1})};return{strip:n,captureMode:r,slowResponseThresholdSeconds:o,providerTestTimeoutSeconds:s,timeDisplayFormat:i,isLoading:e.isLoading,isError:e.error!==void 0,setStrip:c,setSlowResponseThresholdSeconds:u,setProviderTestTimeoutSeconds:f,setTimeDisplayFormat:d}}const jf=(...e)=>e.filter((t,n,r)=>!!t&&t.trim()!==""&&r.indexOf(t)===n).join(" ").trim();const Cv=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();const jv=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(t,n,r)=>r?r.toUpperCase():n.toLowerCase());const uc=e=>{const t=jv(e);return t.charAt(0).toUpperCase()+t.slice(1)};var Nv={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};const Ev=e=>{for(const t in e)if(t.startsWith("aria-")||t==="role"||t==="title")return!0;return!1};const Tv=x.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:n=2,absoluteStrokeWidth:r,className:o="",children:s,iconNode:i,...l},c)=>x.createElement("svg",{ref:c,...Nv,width:t,height:t,stroke:e,strokeWidth:r?Number(n)*24/Number(t):n,className:jf("lucide",o),...!s&&!Ev(l)&&{"aria-hidden":"true"},...l},[...i.map(([u,d])=>x.createElement(u,d)),...Array.isArray(s)?s:[s]]));const ge=(e,t)=>{const n=x.forwardRef(({className:r,...o},s)=>x.createElement(Tv,{ref:s,iconNode:t,className:jf(`lucide-${Cv(uc(e))}`,`lucide-${e}`,r),...o}));return n.displayName=uc(e),n};const Av=[["path",{d:"m7 7 10 10",key:"1fmybs"}],["path",{d:"M17 7v10H7",key:"6fjiku"}]],Iv=ge("arrow-down-right",Av);const zv=[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]],Rv=ge("arrow-down",zv);const Pv=[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]],Ov=ge("arrow-left",Pv);const Mv=[["path",{d:"M7 7h10v10",key:"1tivn9"}],["path",{d:"M7 17 17 7",key:"1vkiza"}]],Lv=ge("arrow-up-right",Mv);const Dv=[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]],Fv=ge("arrow-up",Dv);const $v=[["path",{d:"M10 22V7a1 1 0 0 0-1-1H4a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-5a1 1 0 0 0-1-1H2",key:"1ah6g2"}],["rect",{x:"14",y:"2",width:"8",height:"8",rx:"1",key:"88lufb"}]],Bv=ge("blocks",$v);const Uv=[["path",{d:"M12 18V5",key:"adv99a"}],["path",{d:"M15 13a4.17 4.17 0 0 1-3-4 4.17 4.17 0 0 1-3 4",key:"1e3is1"}],["path",{d:"M17.598 6.5A3 3 0 1 0 12 5a3 3 0 1 0-5.598 1.5",key:"1gqd8o"}],["path",{d:"M17.997 5.125a4 4 0 0 1 2.526 5.77",key:"iwvgf7"}],["path",{d:"M18 18a4 4 0 0 0 2-7.464",key:"efp6ie"}],["path",{d:"M19.967 17.483A4 4 0 1 1 12 18a4 4 0 1 1-7.967-.517",key:"1gq6am"}],["path",{d:"M6 18a4 4 0 0 1-2-7.464",key:"k1g0md"}],["path",{d:"M6.003 5.125a4 4 0 0 0-2.526 5.77",key:"q97ue3"}]],Nf=ge("brain",Uv);const Wv=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],rt=ge("check",Wv);const Hv=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],Zt=ge("chevron-down",Hv);const Vv=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],on=ge("chevron-right",Vv);const Zv=[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]],qv=ge("chevron-up",Zv);const Kv=[["path",{d:"m7 6 5 5 5-5",key:"1lc07p"}],["path",{d:"m7 13 5 5 5-5",key:"1d48rs"}]],Ef=ge("chevrons-down",Kv);const Gv=[["path",{d:"m17 11-5-5-5 5",key:"e8nh98"}],["path",{d:"m17 18-5-5-5 5",key:"2avn1x"}]],Jv=ge("chevrons-up",Gv);const Yv=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]],Mr=ge("circle-alert",Yv);const Xv=[["path",{d:"M21.801 10A10 10 0 1 1 17 3.335",key:"yps3ct"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]],Qv=ge("circle-check-big",Xv);const e2=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],dc=ge("circle-check",e2);const t2=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",key:"1u773s"}],["path",{d:"M12 17h.01",key:"p32p05"}]],n2=ge("circle-question-mark",t2);const r2=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]],Tf=ge("circle-x",r2);const o2=[["path",{d:"M12 6v6l4 2",key:"mmk7yg"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],hn=ge("clock",o2);const s2=[["path",{d:"M12 13v8",key:"1l5pq0"}],["path",{d:"M4 14.899A7 7 0 1 1 15.71 8h1.79a4.5 4.5 0 0 1 2.5 8.242",key:"1pljnt"}],["path",{d:"m8 17 4-4 4 4",key:"1quai1"}]],i2=ge("cloud-upload",s2);const a2=[["path",{d:"m18 16 4-4-4-4",key:"1inbqp"}],["path",{d:"m6 8-4 4 4 4",key:"15zrgr"}],["path",{d:"m14.5 4-5 16",key:"e7oirm"}]],l2=ge("code-xml",a2);const c2=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M12 3v18",key:"108xh3"}]],u2=ge("columns-2",c2);const d2=[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]],_t=ge("copy",d2);const f2=[["path",{d:"M12 15V3",key:"m9g1x1"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["path",{d:"m7 10 5 5 5-5",key:"brsn70"}]],ds=ge("download",f2);const p2=[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"19",cy:"12",r:"1",key:"1wjl8i"}],["circle",{cx:"5",cy:"12",r:"1",key:"1pcz8c"}]],h2=ge("ellipsis",p2);const m2=[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]],Pa=ge("external-link",m2);const g2=[["path",{d:"M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49",key:"ct8e1f"}],["path",{d:"M14.084 14.158a3 3 0 0 1-4.242-4.242",key:"151rxh"}],["path",{d:"M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143",key:"13bj9a"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]],Oa=ge("eye-off",g2);const x2=[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],Ma=ge("eye",x2);const b2=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M9 10h6",key:"9gxzsh"}],["path",{d:"M12 13V7",key:"h0r20n"}],["path",{d:"M9 17h6",key:"r8uit2"}]],y2=ge("file-diff",b2);const v2=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["circle",{cx:"11.5",cy:"14.5",r:"2.5",key:"1bq0ko"}],["path",{d:"M13.3 16.3 15 18",key:"2quom7"}]],w2=ge("file-search",v2);const k2=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"m8 16 2-2-2-2",key:"10vzyd"}],["path",{d:"M12 18h4",key:"1wd2n7"}]],_2=ge("file-terminal",k2);const S2=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]],C2=ge("file-text",S2);const j2=[["path",{d:"m12 14 4-4",key:"9kzdfg"}],["path",{d:"M3.34 19a10 10 0 1 1 17.32 0",key:"19p75a"}]],Af=ge("gauge",j2);const N2=[["circle",{cx:"5",cy:"6",r:"3",key:"1qnov2"}],["path",{d:"M12 6h5a2 2 0 0 1 2 2v7",key:"1yj91y"}],["path",{d:"m15 9-3-3 3-3",key:"1lwv8l"}],["circle",{cx:"19",cy:"18",r:"3",key:"1qljk2"}],["path",{d:"M12 18H7a2 2 0 0 1-2-2V9",key:"16sdep"}],["path",{d:"m9 15 3 3-3 3",key:"1m3kbl"}]],E2=ge("git-compare-arrows",N2);const T2=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20",key:"13o1zl"}],["path",{d:"M2 12h20",key:"9i4pu4"}]],If=ge("globe",T2);const A2=[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}],["path",{d:"M12 7v5l4 2",key:"1fdv2h"}]],I2=ge("history",A2);const z2=[["path",{d:"M12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83z",key:"zw3jo"}],["path",{d:"M2 12a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 12",key:"1wduqc"}],["path",{d:"M2 17a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 17",key:"kqbvx6"}]],fc=ge("layers",z2);const R2=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],Wt=ge("loader-circle",R2);const P2=[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2",key:"1w4ew1"}],["path",{d:"M7 11V7a5 5 0 0 1 10 0v4",key:"fwvmzm"}]],O2=ge("lock",P2);const M2=[["path",{d:"M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z",key:"18887p"}]],fs=ge("message-square",M2);const L2=[["path",{d:"M5 12h14",key:"1ays0h"}]],D2=ge("minus",L2);const F2=[["path",{d:"M14 4.1 12 6",key:"ita8i4"}],["path",{d:"m5.1 8-2.9-.8",key:"1go3kf"}],["path",{d:"m6 12-1.9 2",key:"mnht97"}],["path",{d:"M7.2 2.2 8 5.1",key:"1cfko1"}],["path",{d:"M9.037 9.69a.498.498 0 0 1 .653-.653l11 4.5a.5.5 0 0 1-.074.949l-4.349 1.041a1 1 0 0 0-.74.739l-1.04 4.35a.5.5 0 0 1-.95.074z",key:"s0h3yz"}]],$2=ge("mouse-pointer-click",F2);const B2=[["path",{d:"M12 16h.01",key:"1drbdi"}],["path",{d:"M12 8v4",key:"1got3b"}],["path",{d:"M15.312 2a2 2 0 0 1 1.414.586l4.688 4.688A2 2 0 0 1 22 8.688v6.624a2 2 0 0 1-.586 1.414l-4.688 4.688a2 2 0 0 1-1.414.586H8.688a2 2 0 0 1-1.414-.586l-4.688-4.688A2 2 0 0 1 2 15.312V8.688a2 2 0 0 1 .586-1.414l4.688-4.688A2 2 0 0 1 8.688 2z",key:"1fd625"}]],U2=ge("octagon-alert",B2);const W2=[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]],zf=ge("pencil",W2);const H2=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],Ri=ge("plus",H2);const V2=[["path",{d:"M16.247 7.761a6 6 0 0 1 0 8.478",key:"1fwjs5"}],["path",{d:"M19.075 4.933a10 10 0 0 1 0 14.134",key:"ehdyv1"}],["path",{d:"M4.925 19.067a10 10 0 0 1 0-14.134",key:"1q22gi"}],["path",{d:"M7.753 16.239a6 6 0 0 1 0-8.478",key:"r2q7qm"}],["circle",{cx:"12",cy:"12",r:"2",key:"1c9p78"}]],pc=ge("radio",V2);const Z2=[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]],Pi=ge("refresh-cw",Z2);const q2=[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]],K2=ge("rotate-ccw",q2);const G2=[["path",{d:"M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8",key:"1p45f6"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}]],Oi=ge("rotate-cw",G2);const J2=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M21 9H3",key:"1338ky"}],["path",{d:"M21 15H3",key:"9uk58r"}]],Y2=ge("rows-3",J2);const X2=[["path",{d:"M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",key:"1c8476"}],["path",{d:"M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7",key:"1ydtos"}],["path",{d:"M7 3v4a1 1 0 0 0 1 1h7",key:"t51u73"}]],Q2=ge("save",X2);const ew=[["path",{d:"M3 7V5a2 2 0 0 1 2-2h2",key:"aa7l1z"}],["path",{d:"M17 3h2a2 2 0 0 1 2 2v2",key:"4qcy5o"}],["path",{d:"M21 17v2a2 2 0 0 1-2 2h-2",key:"6vwrx8"}],["path",{d:"M7 21H5a2 2 0 0 1-2-2v-2",key:"ioqczr"}]],tw=ge("scan",ew);const nw=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],rw=ge("search",nw);const ow=[["rect",{width:"20",height:"8",x:"2",y:"2",rx:"2",ry:"2",key:"ngkwjq"}],["rect",{width:"20",height:"8",x:"2",y:"14",rx:"2",ry:"2",key:"iecqi9"}],["line",{x1:"6",x2:"6.01",y1:"6",y2:"6",key:"16zg32"}],["line",{x1:"6",x2:"6.01",y1:"18",y2:"18",key:"nzw8ys"}]],sw=ge("server",ow);const iw=[["path",{d:"M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915",key:"1i5ecw"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],aw=ge("settings",iw);const lw=[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],hc=ge("shield-check",lw);const cw=[["path",{d:"M12 19h8",key:"baeox8"}],["path",{d:"m4 17 6-6-6-6",key:"1yngyt"}]],Rf=ge("terminal",cw);const uw=[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]],Lr=ge("trash-2",uw);const dw=[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]],Lo=ge("triangle-alert",dw);const fw=[["path",{d:"M12 3v12",key:"1x0j5s"}],["path",{d:"m17 8-5-5-5 5",key:"7q97r8"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}]],pw=ge("upload",fw);const hw=[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]],mw=ge("user",hw);const gw=[["path",{d:"M12 20h.01",key:"zekei9"}],["path",{d:"M8.5 16.429a5 5 0 0 1 7 0",key:"1bycff"}],["path",{d:"M5 12.859a10 10 0 0 1 5.17-2.69",key:"1dl1wf"}],["path",{d:"M19 12.859a10 10 0 0 0-2.007-1.523",key:"4k23kn"}],["path",{d:"M2 8.82a15 15 0 0 1 4.177-2.643",key:"1grhjp"}],["path",{d:"M22 8.82a15 15 0 0 0-11.288-3.764",key:"z3jwby"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]],xw=ge("wifi-off",gw);const bw=[["path",{d:"M12 20h.01",key:"zekei9"}],["path",{d:"M2 8.82a15 15 0 0 1 20 0",key:"dnpr2z"}],["path",{d:"M5 12.859a10 10 0 0 1 14 0",key:"1x1e6c"}],["path",{d:"M8.5 16.429a5 5 0 0 1 7 0",key:"1bycff"}]],yw=ge("wifi",bw);const vw=[["path",{d:"M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.106-3.105c.32-.322.863-.22.983.218a6 6 0 0 1-8.259 7.057l-7.91 7.91a1 1 0 0 1-2.999-3l7.91-7.91a6 6 0 0 1 7.057-8.259c.438.12.54.662.219.984z",key:"1ngwbx"}]],qr=ge("wrench",vw);const ww=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],La=ge("x",ww);const kw=[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]],Dr=ge("zap",kw),Mi="/api/config";async function _w(e){return Pn(e,us,void 0,t=>`Failed to fetch ${e}: ${t.status}`)}async function Sw(e){return Pn(Mi,us,{method:"PATCH",headers:{"content-type":"application/json"},body:JSON.stringify(e)},t=>`PATCH failed with status ${t.status}`)}function Cw(){const e=Vr(Mi,_w,{revalidateOnFocus:!1,revalidateIfStale:!1}),{mutate:t}=zd(),n=e.data?.hasSeenOnboarding??!1,r=e.data?.captureMode??za,o=async()=>{await t(Mi,Sw({hasSeenOnboarding:!0}),{optimisticData:{stripClaudeCodeBillingHeader:e.data?.stripClaudeCodeBillingHeader??!1,hasSeenOnboarding:!0,slowResponseThresholdSeconds:e.data?.slowResponseThresholdSeconds??Po,providerTestTimeoutSeconds:e.data?.providerTestTimeoutSeconds??Oo,timeDisplayFormat:e.data?.timeDisplayFormat??Mo,captureMode:r},rollbackOnError:!0,revalidate:!1})};return{hasSeenOnboarding:n,captureMode:r,isLoading:e.isLoading,markSeen:o}}function jw(){const{hasSeenOnboarding:e,captureMode:t,isLoading:n,markSeen:r}=Cw();if(n||e)return null;const o=t==="full";return a.jsxs("div",{role:"note","aria-label":"Onboarding tip",className:"mx-4 mt-2 mb-1 flex items-start gap-3 rounded-md border border-amber-500/30 bg-amber-500/5 px-4 py-3 text-sm",children:[a.jsxs("div",{className:"min-w-0 flex-1",children:[a.jsx("div",{className:"mb-1 font-medium text-amber-600 dark:text-amber-400",children:o?"Agent Inspector is ready in Full mode":"Agent Inspector is ready in Simple mode"}),a.jsxs("ol",{className:"space-y-0.5 text-xs leading-relaxed text-muted-foreground",children:[a.jsxs("li",{children:[a.jsx("strong",{children:"1. Start in the right mode"}),": this process is currently running in"," ",a.jsx("code",{children:t}),". Mode is fixed at startup."]}),o?a.jsxs(a.Fragment,{children:[a.jsxs("li",{children:[a.jsx("strong",{children:"2. Full diagnostics"}),": raw headers, raw response, and SSE chunks are captured for deep investigations."]}),a.jsxs("li",{children:[a.jsx("strong",{children:"3. Daily work"}),": restart with"," ",a.jsx("code",{children:"agent-inspector --mode simple"})," to reduce capture overhead."]})]}):a.jsxs(a.Fragment,{children:[a.jsxs("li",{children:[a.jsx("strong",{children:"2. Simple capture"}),": requests, responses, tools, timing, tokens, replay, and memory candidates are available with lower overhead."]}),a.jsxs("li",{children:[a.jsx("strong",{children:"3. Need raw diagnostics?"})," Restart with"," ",a.jsx("code",{children:"agent-inspector --mode full"})," for raw headers, raw response, and SSE chunks."]})]}),a.jsxs("li",{children:[a.jsx("strong",{children:"Agent setup"}),": run ",a.jsx("code",{children:"agent-inspector onboard --status"}),", then use ",a.jsx("code",{children:"/agent-inspector:onboard"})," in Claude Code or ask Codex to use"," ",a.jsx("code",{children:"agent-inspector-onboard"}),"."]}),a.jsxs("li",{children:[a.jsx("strong",{children:"Container networking"}),": if the AI tool runs outside this Inspector container or host, replace ",a.jsx("code",{children:"localhost"})," with a reachable address."]})]})]}),a.jsxs("button",{type:"button",onClick:()=>{r()},className:"inline-flex h-8 shrink-0 items-center gap-1.5 rounded-md border border-amber-500/40 px-3 text-xs text-amber-700 transition-colors hover:bg-amber-500/10 dark:text-amber-300","aria-label":"Dismiss onboarding tip",children:[a.jsx(rt,{className:"size-3.5"}),"Got it"]}),a.jsx("button",{type:"button",onClick:()=>{r()},className:"-m-1 shrink-0 p-1 text-muted-foreground transition-colors hover:text-foreground","aria-label":"Dismiss",children:a.jsx(La,{className:"size-3.5"})})]})}function ao(e){throw new Error('Could not dynamically require "'+e+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var Hs={exports:{}};var mc;function Nw(){return mc||(mc=1,(function(e,t){(function(n){e.exports=n()})(function(){return(function n(r,o,s){function i(u,d){if(!o[u]){if(!r[u]){var f=typeof ao=="function"&&ao;if(!d&&f)return f(u,!0);if(l)return l(u,!0);var h=new Error("Cannot find module '"+u+"'");throw h.code="MODULE_NOT_FOUND",h}var p=o[u]={exports:{}};r[u][0].call(p.exports,function(y){var m=r[u][1][y];return i(m||y)},p,p.exports,n,r,o,s)}return o[u].exports}for(var l=typeof ao=="function"&&ao,c=0;c<s.length;c++)i(s[c]);return i})({1:[function(n,r,o){var s=n("./utils"),i=n("./support"),l="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";o.encode=function(c){for(var u,d,f,h,p,y,m,g=[],b=0,v=c.length,k=v,S=s.getTypeOf(c)!=="string";b<c.length;)k=v-b,f=S?(u=c[b++],d=b<v?c[b++]:0,b<v?c[b++]:0):(u=c.charCodeAt(b++),d=b<v?c.charCodeAt(b++):0,b<v?c.charCodeAt(b++):0),h=u>>2,p=(3&u)<<4|d>>4,y=1<k?(15&d)<<2|f>>6:64,m=2<k?63&f:64,g.push(l.charAt(h)+l.charAt(p)+l.charAt(y)+l.charAt(m));return g.join("")},o.decode=function(c){var u,d,f,h,p,y,m=0,g=0,b="data:";if(c.substr(0,b.length)===b)throw new Error("Invalid base64 input, it looks like a data url.");var v,k=3*(c=c.replace(/[^A-Za-z0-9+/=]/g,"")).length/4;if(c.charAt(c.length-1)===l.charAt(64)&&k--,c.charAt(c.length-2)===l.charAt(64)&&k--,k%1!=0)throw new Error("Invalid base64 input, bad content length.");for(v=i.uint8array?new Uint8Array(0|k):new Array(0|k);m<c.length;)u=l.indexOf(c.charAt(m++))<<2|(h=l.indexOf(c.charAt(m++)))>>4,d=(15&h)<<4|(p=l.indexOf(c.charAt(m++)))>>2,f=(3&p)<<6|(y=l.indexOf(c.charAt(m++))),v[g++]=u,p!==64&&(v[g++]=d),y!==64&&(v[g++]=f);return v}},{"./support":30,"./utils":32}],2:[function(n,r,o){var s=n("./external"),i=n("./stream/DataWorker"),l=n("./stream/Crc32Probe"),c=n("./stream/DataLengthProbe");function u(d,f,h,p,y){this.compressedSize=d,this.uncompressedSize=f,this.crc32=h,this.compression=p,this.compressedContent=y}u.prototype={getContentWorker:function(){var d=new i(s.Promise.resolve(this.compressedContent)).pipe(this.compression.uncompressWorker()).pipe(new c("data_length")),f=this;return d.on("end",function(){if(this.streamInfo.data_length!==f.uncompressedSize)throw new Error("Bug : uncompressed data size mismatch")}),d},getCompressedWorker:function(){return new i(s.Promise.resolve(this.compressedContent)).withStreamInfo("compressedSize",this.compressedSize).withStreamInfo("uncompressedSize",this.uncompressedSize).withStreamInfo("crc32",this.crc32).withStreamInfo("compression",this.compression)}},u.createWorkerFrom=function(d,f,h){return d.pipe(new l).pipe(new c("uncompressedSize")).pipe(f.compressWorker(h)).pipe(new c("compressedSize")).withStreamInfo("compression",f)},r.exports=u},{"./external":6,"./stream/Crc32Probe":25,"./stream/DataLengthProbe":26,"./stream/DataWorker":27}],3:[function(n,r,o){var s=n("./stream/GenericWorker");o.STORE={magic:"\0\0",compressWorker:function(){return new s("STORE compression")},uncompressWorker:function(){return new s("STORE decompression")}},o.DEFLATE=n("./flate")},{"./flate":7,"./stream/GenericWorker":28}],4:[function(n,r,o){var s=n("./utils"),i=(function(){for(var l,c=[],u=0;u<256;u++){l=u;for(var d=0;d<8;d++)l=1&l?3988292384^l>>>1:l>>>1;c[u]=l}return c})();r.exports=function(l,c){return l!==void 0&&l.length?s.getTypeOf(l)!=="string"?(function(u,d,f,h){var p=i,y=h+f;u^=-1;for(var m=h;m<y;m++)u=u>>>8^p[255&(u^d[m])];return-1^u})(0|c,l,l.length,0):(function(u,d,f,h){var p=i,y=h+f;u^=-1;for(var m=h;m<y;m++)u=u>>>8^p[255&(u^d.charCodeAt(m))];return-1^u})(0|c,l,l.length,0):0}},{"./utils":32}],5:[function(n,r,o){o.base64=!1,o.binary=!1,o.dir=!1,o.createFolders=!0,o.date=null,o.compression=null,o.compressionOptions=null,o.comment=null,o.unixPermissions=null,o.dosPermissions=null},{}],6:[function(n,r,o){var s=null;s=typeof Promise<"u"?Promise:n("lie"),r.exports={Promise:s}},{lie:37}],7:[function(n,r,o){var s=typeof Uint8Array<"u"&&typeof Uint16Array<"u"&&typeof Uint32Array<"u",i=n("pako"),l=n("./utils"),c=n("./stream/GenericWorker"),u=s?"uint8array":"array";function d(f,h){c.call(this,"FlateWorker/"+f),this._pako=null,this._pakoAction=f,this._pakoOptions=h,this.meta={}}o.magic="\b\0",l.inherits(d,c),d.prototype.processChunk=function(f){this.meta=f.meta,this._pako===null&&this._createPako(),this._pako.push(l.transformTo(u,f.data),!1)},d.prototype.flush=function(){c.prototype.flush.call(this),this._pako===null&&this._createPako(),this._pako.push([],!0)},d.prototype.cleanUp=function(){c.prototype.cleanUp.call(this),this._pako=null},d.prototype._createPako=function(){this._pako=new i[this._pakoAction]({raw:!0,level:this._pakoOptions.level||-1});var f=this;this._pako.onData=function(h){f.push({data:h,meta:f.meta})}},o.compressWorker=function(f){return new d("Deflate",f)},o.uncompressWorker=function(){return new d("Inflate",{})}},{"./stream/GenericWorker":28,"./utils":32,pako:38}],8:[function(n,r,o){function s(p,y){var m,g="";for(m=0;m<y;m++)g+=String.fromCharCode(255&p),p>>>=8;return g}function i(p,y,m,g,b,v){var k,S,C=p.file,j=p.compression,E=v!==u.utf8encode,T=l.transformTo("string",v(C.name)),z=l.transformTo("string",u.utf8encode(C.name)),O=C.comment,B=l.transformTo("string",v(O)),N=l.transformTo("string",u.utf8encode(O)),D=z.length!==C.name.length,w=N.length!==O.length,L="",W="",U="",F=C.dir,K=C.date,I={crc32:0,compressedSize:0,uncompressedSize:0};y&&!m||(I.crc32=p.crc32,I.compressedSize=p.compressedSize,I.uncompressedSize=p.uncompressedSize);var V=0;y&&(V|=8),E||!D&&!w||(V|=2048);var G=0,R=0;F&&(G|=16),b==="UNIX"?(R=798,G|=(function(oe,fe){var le=oe;return oe||(le=fe?16893:33204),(65535&le)<<16})(C.unixPermissions,F)):(R=20,G|=(function(oe){return 63&(oe||0)})(C.dosPermissions)),k=K.getUTCHours(),k<<=6,k|=K.getUTCMinutes(),k<<=5,k|=K.getUTCSeconds()/2,S=K.getUTCFullYear()-1980,S<<=4,S|=K.getUTCMonth()+1,S<<=5,S|=K.getUTCDate(),D&&(W=s(1,1)+s(d(T),4)+z,L+="up"+s(W.length,2)+W),w&&(U=s(1,1)+s(d(B),4)+N,L+="uc"+s(U.length,2)+U);var ae="";return ae+=`
|
|
41
|
-
\0`,ae+=s(V,2),ae+=j.magic,ae+=s(k,2),ae+=s(S,2),ae+=s(I.crc32,4),ae+=s(I.compressedSize,4),ae+=s(I.uncompressedSize,4),ae+=s(T.length,2),ae+=s(L.length,2),{fileRecord:f.LOCAL_FILE_HEADER+ae+T+L,dirRecord:f.CENTRAL_FILE_HEADER+s(R,2)+ae+s(B.length,2)+"\0\0\0\0"+s(G,4)+s(g,4)+T+L+B}}var l=n("../utils"),c=n("../stream/GenericWorker"),u=n("../utf8"),d=n("../crc32"),f=n("../signature");function h(p,y,m,g){c.call(this,"ZipFileWorker"),this.bytesWritten=0,this.zipComment=y,this.zipPlatform=m,this.encodeFileName=g,this.streamFiles=p,this.accumulate=!1,this.contentBuffer=[],this.dirRecords=[],this.currentSourceOffset=0,this.entriesCount=0,this.currentFile=null,this._sources=[]}l.inherits(h,c),h.prototype.push=function(p){var y=p.meta.percent||0,m=this.entriesCount,g=this._sources.length;this.accumulate?this.contentBuffer.push(p):(this.bytesWritten+=p.data.length,c.prototype.push.call(this,{data:p.data,meta:{currentFile:this.currentFile,percent:m?(y+100*(m-g-1))/m:100}}))},h.prototype.openedSource=function(p){this.currentSourceOffset=this.bytesWritten,this.currentFile=p.file.name;var y=this.streamFiles&&!p.file.dir;if(y){var m=i(p,y,!1,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);this.push({data:m.fileRecord,meta:{percent:0}})}else this.accumulate=!0},h.prototype.closedSource=function(p){this.accumulate=!1;var y=this.streamFiles&&!p.file.dir,m=i(p,y,!0,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);if(this.dirRecords.push(m.dirRecord),y)this.push({data:(function(g){return f.DATA_DESCRIPTOR+s(g.crc32,4)+s(g.compressedSize,4)+s(g.uncompressedSize,4)})(p),meta:{percent:100}});else for(this.push({data:m.fileRecord,meta:{percent:0}});this.contentBuffer.length;)this.push(this.contentBuffer.shift());this.currentFile=null},h.prototype.flush=function(){for(var p=this.bytesWritten,y=0;y<this.dirRecords.length;y++)this.push({data:this.dirRecords[y],meta:{percent:100}});var m=this.bytesWritten-p,g=(function(b,v,k,S,C){var j=l.transformTo("string",C(S));return f.CENTRAL_DIRECTORY_END+"\0\0\0\0"+s(b,2)+s(b,2)+s(v,4)+s(k,4)+s(j.length,2)+j})(this.dirRecords.length,m,p,this.zipComment,this.encodeFileName);this.push({data:g,meta:{percent:100}})},h.prototype.prepareNextSource=function(){this.previous=this._sources.shift(),this.openedSource(this.previous.streamInfo),this.isPaused?this.previous.pause():this.previous.resume()},h.prototype.registerPrevious=function(p){this._sources.push(p);var y=this;return p.on("data",function(m){y.processChunk(m)}),p.on("end",function(){y.closedSource(y.previous.streamInfo),y._sources.length?y.prepareNextSource():y.end()}),p.on("error",function(m){y.error(m)}),this},h.prototype.resume=function(){return!!c.prototype.resume.call(this)&&(!this.previous&&this._sources.length?(this.prepareNextSource(),!0):this.previous||this._sources.length||this.generatedError?void 0:(this.end(),!0))},h.prototype.error=function(p){var y=this._sources;if(!c.prototype.error.call(this,p))return!1;for(var m=0;m<y.length;m++)try{y[m].error(p)}catch{}return!0},h.prototype.lock=function(){c.prototype.lock.call(this);for(var p=this._sources,y=0;y<p.length;y++)p[y].lock()},r.exports=h},{"../crc32":4,"../signature":23,"../stream/GenericWorker":28,"../utf8":31,"../utils":32}],9:[function(n,r,o){var s=n("../compressions"),i=n("./ZipFileWorker");o.generateWorker=function(l,c,u){var d=new i(c.streamFiles,u,c.platform,c.encodeFileName),f=0;try{l.forEach(function(h,p){f++;var y=(function(v,k){var S=v||k,C=s[S];if(!C)throw new Error(S+" is not a valid compression method !");return C})(p.options.compression,c.compression),m=p.options.compressionOptions||c.compressionOptions||{},g=p.dir,b=p.date;p._compressWorker(y,m).withStreamInfo("file",{name:h,dir:g,date:b,comment:p.comment||"",unixPermissions:p.unixPermissions,dosPermissions:p.dosPermissions}).pipe(d)}),d.entriesCount=f}catch(h){d.error(h)}return d}},{"../compressions":3,"./ZipFileWorker":8}],10:[function(n,r,o){function s(){if(!(this instanceof s))return new s;if(arguments.length)throw new Error("The constructor with parameters has been removed in JSZip 3.0, please check the upgrade guide.");this.files=Object.create(null),this.comment=null,this.root="",this.clone=function(){var i=new s;for(var l in this)typeof this[l]!="function"&&(i[l]=this[l]);return i}}(s.prototype=n("./object")).loadAsync=n("./load"),s.support=n("./support"),s.defaults=n("./defaults"),s.version="3.10.1",s.loadAsync=function(i,l){return new s().loadAsync(i,l)},s.external=n("./external"),r.exports=s},{"./defaults":5,"./external":6,"./load":11,"./object":15,"./support":30}],11:[function(n,r,o){var s=n("./utils"),i=n("./external"),l=n("./utf8"),c=n("./zipEntries"),u=n("./stream/Crc32Probe"),d=n("./nodejsUtils");function f(h){return new i.Promise(function(p,y){var m=h.decompressed.getContentWorker().pipe(new u);m.on("error",function(g){y(g)}).on("end",function(){m.streamInfo.crc32!==h.decompressed.crc32?y(new Error("Corrupted zip : CRC32 mismatch")):p()}).resume()})}r.exports=function(h,p){var y=this;return p=s.extend(p||{},{base64:!1,checkCRC32:!1,optimizedBinaryString:!1,createFolders:!1,decodeFileName:l.utf8decode}),d.isNode&&d.isStream(h)?i.Promise.reject(new Error("JSZip can't accept a stream when loading a zip file.")):s.prepareContent("the loaded zip file",h,!0,p.optimizedBinaryString,p.base64).then(function(m){var g=new c(p);return g.load(m),g}).then(function(m){var g=[i.Promise.resolve(m)],b=m.files;if(p.checkCRC32)for(var v=0;v<b.length;v++)g.push(f(b[v]));return i.Promise.all(g)}).then(function(m){for(var g=m.shift(),b=g.files,v=0;v<b.length;v++){var k=b[v],S=k.fileNameStr,C=s.resolve(k.fileNameStr);y.file(C,k.decompressed,{binary:!0,optimizedBinaryString:!0,date:k.date,dir:k.dir,comment:k.fileCommentStr.length?k.fileCommentStr:null,unixPermissions:k.unixPermissions,dosPermissions:k.dosPermissions,createFolders:p.createFolders}),k.dir||(y.file(C).unsafeOriginalName=S)}return g.zipComment.length&&(y.comment=g.zipComment),y})}},{"./external":6,"./nodejsUtils":14,"./stream/Crc32Probe":25,"./utf8":31,"./utils":32,"./zipEntries":33}],12:[function(n,r,o){var s=n("../utils"),i=n("../stream/GenericWorker");function l(c,u){i.call(this,"Nodejs stream input adapter for "+c),this._upstreamEnded=!1,this._bindStream(u)}s.inherits(l,i),l.prototype._bindStream=function(c){var u=this;(this._stream=c).pause(),c.on("data",function(d){u.push({data:d,meta:{percent:0}})}).on("error",function(d){u.isPaused?this.generatedError=d:u.error(d)}).on("end",function(){u.isPaused?u._upstreamEnded=!0:u.end()})},l.prototype.pause=function(){return!!i.prototype.pause.call(this)&&(this._stream.pause(),!0)},l.prototype.resume=function(){return!!i.prototype.resume.call(this)&&(this._upstreamEnded?this.end():this._stream.resume(),!0)},r.exports=l},{"../stream/GenericWorker":28,"../utils":32}],13:[function(n,r,o){var s=n("readable-stream").Readable;function i(l,c,u){s.call(this,c),this._helper=l;var d=this;l.on("data",function(f,h){d.push(f)||d._helper.pause(),u&&u(h)}).on("error",function(f){d.emit("error",f)}).on("end",function(){d.push(null)})}n("../utils").inherits(i,s),i.prototype._read=function(){this._helper.resume()},r.exports=i},{"../utils":32,"readable-stream":16}],14:[function(n,r,o){r.exports={isNode:typeof Buffer<"u",newBufferFrom:function(s,i){if(Buffer.from&&Buffer.from!==Uint8Array.from)return Buffer.from(s,i);if(typeof s=="number")throw new Error('The "data" argument must not be a number');return new Buffer(s,i)},allocBuffer:function(s){if(Buffer.alloc)return Buffer.alloc(s);var i=new Buffer(s);return i.fill(0),i},isBuffer:function(s){return Buffer.isBuffer(s)},isStream:function(s){return s&&typeof s.on=="function"&&typeof s.pause=="function"&&typeof s.resume=="function"}}},{}],15:[function(n,r,o){function s(C,j,E){var T,z=l.getTypeOf(j),O=l.extend(E||{},d);O.date=O.date||new Date,O.compression!==null&&(O.compression=O.compression.toUpperCase()),typeof O.unixPermissions=="string"&&(O.unixPermissions=parseInt(O.unixPermissions,8)),O.unixPermissions&&16384&O.unixPermissions&&(O.dir=!0),O.dosPermissions&&16&O.dosPermissions&&(O.dir=!0),O.dir&&(C=b(C)),O.createFolders&&(T=g(C))&&v.call(this,T,!0);var B=z==="string"&&O.binary===!1&&O.base64===!1;E&&E.binary!==void 0||(O.binary=!B),(j instanceof f&&j.uncompressedSize===0||O.dir||!j||j.length===0)&&(O.base64=!1,O.binary=!0,j="",O.compression="STORE",z="string");var N=null;N=j instanceof f||j instanceof c?j:y.isNode&&y.isStream(j)?new m(C,j):l.prepareContent(C,j,O.binary,O.optimizedBinaryString,O.base64);var D=new h(C,N,O);this.files[C]=D}var i=n("./utf8"),l=n("./utils"),c=n("./stream/GenericWorker"),u=n("./stream/StreamHelper"),d=n("./defaults"),f=n("./compressedObject"),h=n("./zipObject"),p=n("./generate"),y=n("./nodejsUtils"),m=n("./nodejs/NodejsStreamInputAdapter"),g=function(C){C.slice(-1)==="/"&&(C=C.substring(0,C.length-1));var j=C.lastIndexOf("/");return 0<j?C.substring(0,j):""},b=function(C){return C.slice(-1)!=="/"&&(C+="/"),C},v=function(C,j){return j=j!==void 0?j:d.createFolders,C=b(C),this.files[C]||s.call(this,C,null,{dir:!0,createFolders:j}),this.files[C]};function k(C){return Object.prototype.toString.call(C)==="[object RegExp]"}var S={load:function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},forEach:function(C){var j,E,T;for(j in this.files)T=this.files[j],(E=j.slice(this.root.length,j.length))&&j.slice(0,this.root.length)===this.root&&C(E,T)},filter:function(C){var j=[];return this.forEach(function(E,T){C(E,T)&&j.push(T)}),j},file:function(C,j,E){if(arguments.length!==1)return C=this.root+C,s.call(this,C,j,E),this;if(k(C)){var T=C;return this.filter(function(O,B){return!B.dir&&T.test(O)})}var z=this.files[this.root+C];return z&&!z.dir?z:null},folder:function(C){if(!C)return this;if(k(C))return this.filter(function(z,O){return O.dir&&C.test(z)});var j=this.root+C,E=v.call(this,j),T=this.clone();return T.root=E.name,T},remove:function(C){C=this.root+C;var j=this.files[C];if(j||(C.slice(-1)!=="/"&&(C+="/"),j=this.files[C]),j&&!j.dir)delete this.files[C];else for(var E=this.filter(function(z,O){return O.name.slice(0,C.length)===C}),T=0;T<E.length;T++)delete this.files[E[T].name];return this},generate:function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},generateInternalStream:function(C){var j,E={};try{if((E=l.extend(C||{},{streamFiles:!1,compression:"STORE",compressionOptions:null,type:"",platform:"DOS",comment:null,mimeType:"application/zip",encodeFileName:i.utf8encode})).type=E.type.toLowerCase(),E.compression=E.compression.toUpperCase(),E.type==="binarystring"&&(E.type="string"),!E.type)throw new Error("No output type specified.");l.checkSupport(E.type),E.platform!=="darwin"&&E.platform!=="freebsd"&&E.platform!=="linux"&&E.platform!=="sunos"||(E.platform="UNIX"),E.platform==="win32"&&(E.platform="DOS");var T=E.comment||this.comment||"";j=p.generateWorker(this,E,T)}catch(z){(j=new c("error")).error(z)}return new u(j,E.type||"string",E.mimeType)},generateAsync:function(C,j){return this.generateInternalStream(C).accumulate(j)},generateNodeStream:function(C,j){return(C=C||{}).type||(C.type="nodebuffer"),this.generateInternalStream(C).toNodejsStream(j)}};r.exports=S},{"./compressedObject":2,"./defaults":5,"./generate":9,"./nodejs/NodejsStreamInputAdapter":12,"./nodejsUtils":14,"./stream/GenericWorker":28,"./stream/StreamHelper":29,"./utf8":31,"./utils":32,"./zipObject":35}],16:[function(n,r,o){r.exports=n("stream")},{stream:void 0}],17:[function(n,r,o){var s=n("./DataReader");function i(l){s.call(this,l);for(var c=0;c<this.data.length;c++)l[c]=255&l[c]}n("../utils").inherits(i,s),i.prototype.byteAt=function(l){return this.data[this.zero+l]},i.prototype.lastIndexOfSignature=function(l){for(var c=l.charCodeAt(0),u=l.charCodeAt(1),d=l.charCodeAt(2),f=l.charCodeAt(3),h=this.length-4;0<=h;--h)if(this.data[h]===c&&this.data[h+1]===u&&this.data[h+2]===d&&this.data[h+3]===f)return h-this.zero;return-1},i.prototype.readAndCheckSignature=function(l){var c=l.charCodeAt(0),u=l.charCodeAt(1),d=l.charCodeAt(2),f=l.charCodeAt(3),h=this.readData(4);return c===h[0]&&u===h[1]&&d===h[2]&&f===h[3]},i.prototype.readData=function(l){if(this.checkOffset(l),l===0)return[];var c=this.data.slice(this.zero+this.index,this.zero+this.index+l);return this.index+=l,c},r.exports=i},{"../utils":32,"./DataReader":18}],18:[function(n,r,o){var s=n("../utils");function i(l){this.data=l,this.length=l.length,this.index=0,this.zero=0}i.prototype={checkOffset:function(l){this.checkIndex(this.index+l)},checkIndex:function(l){if(this.length<this.zero+l||l<0)throw new Error("End of data reached (data length = "+this.length+", asked index = "+l+"). Corrupted zip ?")},setIndex:function(l){this.checkIndex(l),this.index=l},skip:function(l){this.setIndex(this.index+l)},byteAt:function(){},readInt:function(l){var c,u=0;for(this.checkOffset(l),c=this.index+l-1;c>=this.index;c--)u=(u<<8)+this.byteAt(c);return this.index+=l,u},readString:function(l){return s.transformTo("string",this.readData(l))},readData:function(){},lastIndexOfSignature:function(){},readAndCheckSignature:function(){},readDate:function(){var l=this.readInt(4);return new Date(Date.UTC(1980+(l>>25&127),(l>>21&15)-1,l>>16&31,l>>11&31,l>>5&63,(31&l)<<1))}},r.exports=i},{"../utils":32}],19:[function(n,r,o){var s=n("./Uint8ArrayReader");function i(l){s.call(this,l)}n("../utils").inherits(i,s),i.prototype.readData=function(l){this.checkOffset(l);var c=this.data.slice(this.zero+this.index,this.zero+this.index+l);return this.index+=l,c},r.exports=i},{"../utils":32,"./Uint8ArrayReader":21}],20:[function(n,r,o){var s=n("./DataReader");function i(l){s.call(this,l)}n("../utils").inherits(i,s),i.prototype.byteAt=function(l){return this.data.charCodeAt(this.zero+l)},i.prototype.lastIndexOfSignature=function(l){return this.data.lastIndexOf(l)-this.zero},i.prototype.readAndCheckSignature=function(l){return l===this.readData(4)},i.prototype.readData=function(l){this.checkOffset(l);var c=this.data.slice(this.zero+this.index,this.zero+this.index+l);return this.index+=l,c},r.exports=i},{"../utils":32,"./DataReader":18}],21:[function(n,r,o){var s=n("./ArrayReader");function i(l){s.call(this,l)}n("../utils").inherits(i,s),i.prototype.readData=function(l){if(this.checkOffset(l),l===0)return new Uint8Array(0);var c=this.data.subarray(this.zero+this.index,this.zero+this.index+l);return this.index+=l,c},r.exports=i},{"../utils":32,"./ArrayReader":17}],22:[function(n,r,o){var s=n("../utils"),i=n("../support"),l=n("./ArrayReader"),c=n("./StringReader"),u=n("./NodeBufferReader"),d=n("./Uint8ArrayReader");r.exports=function(f){var h=s.getTypeOf(f);return s.checkSupport(h),h!=="string"||i.uint8array?h==="nodebuffer"?new u(f):i.uint8array?new d(s.transformTo("uint8array",f)):new l(s.transformTo("array",f)):new c(f)}},{"../support":30,"../utils":32,"./ArrayReader":17,"./NodeBufferReader":19,"./StringReader":20,"./Uint8ArrayReader":21}],23:[function(n,r,o){o.LOCAL_FILE_HEADER="PK",o.CENTRAL_FILE_HEADER="PK",o.CENTRAL_DIRECTORY_END="PK",o.ZIP64_CENTRAL_DIRECTORY_LOCATOR="PK\x07",o.ZIP64_CENTRAL_DIRECTORY_END="PK",o.DATA_DESCRIPTOR="PK\x07\b"},{}],24:[function(n,r,o){var s=n("./GenericWorker"),i=n("../utils");function l(c){s.call(this,"ConvertWorker to "+c),this.destType=c}i.inherits(l,s),l.prototype.processChunk=function(c){this.push({data:i.transformTo(this.destType,c.data),meta:c.meta})},r.exports=l},{"../utils":32,"./GenericWorker":28}],25:[function(n,r,o){var s=n("./GenericWorker"),i=n("../crc32");function l(){s.call(this,"Crc32Probe"),this.withStreamInfo("crc32",0)}n("../utils").inherits(l,s),l.prototype.processChunk=function(c){this.streamInfo.crc32=i(c.data,this.streamInfo.crc32||0),this.push(c)},r.exports=l},{"../crc32":4,"../utils":32,"./GenericWorker":28}],26:[function(n,r,o){var s=n("../utils"),i=n("./GenericWorker");function l(c){i.call(this,"DataLengthProbe for "+c),this.propName=c,this.withStreamInfo(c,0)}s.inherits(l,i),l.prototype.processChunk=function(c){if(c){var u=this.streamInfo[this.propName]||0;this.streamInfo[this.propName]=u+c.data.length}i.prototype.processChunk.call(this,c)},r.exports=l},{"../utils":32,"./GenericWorker":28}],27:[function(n,r,o){var s=n("../utils"),i=n("./GenericWorker");function l(c){i.call(this,"DataWorker");var u=this;this.dataIsReady=!1,this.index=0,this.max=0,this.data=null,this.type="",this._tickScheduled=!1,c.then(function(d){u.dataIsReady=!0,u.data=d,u.max=d&&d.length||0,u.type=s.getTypeOf(d),u.isPaused||u._tickAndRepeat()},function(d){u.error(d)})}s.inherits(l,i),l.prototype.cleanUp=function(){i.prototype.cleanUp.call(this),this.data=null},l.prototype.resume=function(){return!!i.prototype.resume.call(this)&&(!this._tickScheduled&&this.dataIsReady&&(this._tickScheduled=!0,s.delay(this._tickAndRepeat,[],this)),!0)},l.prototype._tickAndRepeat=function(){this._tickScheduled=!1,this.isPaused||this.isFinished||(this._tick(),this.isFinished||(s.delay(this._tickAndRepeat,[],this),this._tickScheduled=!0))},l.prototype._tick=function(){if(this.isPaused||this.isFinished)return!1;var c=null,u=Math.min(this.max,this.index+16384);if(this.index>=this.max)return this.end();switch(this.type){case"string":c=this.data.substring(this.index,u);break;case"uint8array":c=this.data.subarray(this.index,u);break;case"array":case"nodebuffer":c=this.data.slice(this.index,u)}return this.index=u,this.push({data:c,meta:{percent:this.max?this.index/this.max*100:0}})},r.exports=l},{"../utils":32,"./GenericWorker":28}],28:[function(n,r,o){function s(i){this.name=i||"default",this.streamInfo={},this.generatedError=null,this.extraStreamInfo={},this.isPaused=!0,this.isFinished=!1,this.isLocked=!1,this._listeners={data:[],end:[],error:[]},this.previous=null}s.prototype={push:function(i){this.emit("data",i)},end:function(){if(this.isFinished)return!1;this.flush();try{this.emit("end"),this.cleanUp(),this.isFinished=!0}catch(i){this.emit("error",i)}return!0},error:function(i){return!this.isFinished&&(this.isPaused?this.generatedError=i:(this.isFinished=!0,this.emit("error",i),this.previous&&this.previous.error(i),this.cleanUp()),!0)},on:function(i,l){return this._listeners[i].push(l),this},cleanUp:function(){this.streamInfo=this.generatedError=this.extraStreamInfo=null,this._listeners=[]},emit:function(i,l){if(this._listeners[i])for(var c=0;c<this._listeners[i].length;c++)this._listeners[i][c].call(this,l)},pipe:function(i){return i.registerPrevious(this)},registerPrevious:function(i){if(this.isLocked)throw new Error("The stream '"+this+"' has already been used.");this.streamInfo=i.streamInfo,this.mergeStreamInfo(),this.previous=i;var l=this;return i.on("data",function(c){l.processChunk(c)}),i.on("end",function(){l.end()}),i.on("error",function(c){l.error(c)}),this},pause:function(){return!this.isPaused&&!this.isFinished&&(this.isPaused=!0,this.previous&&this.previous.pause(),!0)},resume:function(){if(!this.isPaused||this.isFinished)return!1;var i=this.isPaused=!1;return this.generatedError&&(this.error(this.generatedError),i=!0),this.previous&&this.previous.resume(),!i},flush:function(){},processChunk:function(i){this.push(i)},withStreamInfo:function(i,l){return this.extraStreamInfo[i]=l,this.mergeStreamInfo(),this},mergeStreamInfo:function(){for(var i in this.extraStreamInfo)Object.prototype.hasOwnProperty.call(this.extraStreamInfo,i)&&(this.streamInfo[i]=this.extraStreamInfo[i])},lock:function(){if(this.isLocked)throw new Error("The stream '"+this+"' has already been used.");this.isLocked=!0,this.previous&&this.previous.lock()},toString:function(){var i="Worker "+this.name;return this.previous?this.previous+" -> "+i:i}},r.exports=s},{}],29:[function(n,r,o){var s=n("../utils"),i=n("./ConvertWorker"),l=n("./GenericWorker"),c=n("../base64"),u=n("../support"),d=n("../external"),f=null;if(u.nodestream)try{f=n("../nodejs/NodejsStreamOutputAdapter")}catch{}function h(y,m){return new d.Promise(function(g,b){var v=[],k=y._internalType,S=y._outputType,C=y._mimeType;y.on("data",function(j,E){v.push(j),m&&m(E)}).on("error",function(j){v=[],b(j)}).on("end",function(){try{var j=(function(E,T,z){switch(E){case"blob":return s.newBlob(s.transformTo("arraybuffer",T),z);case"base64":return c.encode(T);default:return s.transformTo(E,T)}})(S,(function(E,T){var z,O=0,B=null,N=0;for(z=0;z<T.length;z++)N+=T[z].length;switch(E){case"string":return T.join("");case"array":return Array.prototype.concat.apply([],T);case"uint8array":for(B=new Uint8Array(N),z=0;z<T.length;z++)B.set(T[z],O),O+=T[z].length;return B;case"nodebuffer":return Buffer.concat(T);default:throw new Error("concat : unsupported type '"+E+"'")}})(k,v),C);g(j)}catch(E){b(E)}v=[]}).resume()})}function p(y,m,g){var b=m;switch(m){case"blob":case"arraybuffer":b="uint8array";break;case"base64":b="string"}try{this._internalType=b,this._outputType=m,this._mimeType=g,s.checkSupport(b),this._worker=y.pipe(new i(b)),y.lock()}catch(v){this._worker=new l("error"),this._worker.error(v)}}p.prototype={accumulate:function(y){return h(this,y)},on:function(y,m){var g=this;return y==="data"?this._worker.on(y,function(b){m.call(g,b.data,b.meta)}):this._worker.on(y,function(){s.delay(m,arguments,g)}),this},resume:function(){return s.delay(this._worker.resume,[],this._worker),this},pause:function(){return this._worker.pause(),this},toNodejsStream:function(y){if(s.checkSupport("nodestream"),this._outputType!=="nodebuffer")throw new Error(this._outputType+" is not supported by this method");return new f(this,{objectMode:this._outputType!=="nodebuffer"},y)}},r.exports=p},{"../base64":1,"../external":6,"../nodejs/NodejsStreamOutputAdapter":13,"../support":30,"../utils":32,"./ConvertWorker":24,"./GenericWorker":28}],30:[function(n,r,o){if(o.base64=!0,o.array=!0,o.string=!0,o.arraybuffer=typeof ArrayBuffer<"u"&&typeof Uint8Array<"u",o.nodebuffer=typeof Buffer<"u",o.uint8array=typeof Uint8Array<"u",typeof ArrayBuffer>"u")o.blob=!1;else{var s=new ArrayBuffer(0);try{o.blob=new Blob([s],{type:"application/zip"}).size===0}catch{try{var i=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);i.append(s),o.blob=i.getBlob("application/zip").size===0}catch{o.blob=!1}}}try{o.nodestream=!!n("readable-stream").Readable}catch{o.nodestream=!1}},{"readable-stream":16}],31:[function(n,r,o){for(var s=n("./utils"),i=n("./support"),l=n("./nodejsUtils"),c=n("./stream/GenericWorker"),u=new Array(256),d=0;d<256;d++)u[d]=252<=d?6:248<=d?5:240<=d?4:224<=d?3:192<=d?2:1;u[254]=u[254]=1;function f(){c.call(this,"utf-8 decode"),this.leftOver=null}function h(){c.call(this,"utf-8 encode")}o.utf8encode=function(p){return i.nodebuffer?l.newBufferFrom(p,"utf-8"):(function(y){var m,g,b,v,k,S=y.length,C=0;for(v=0;v<S;v++)(64512&(g=y.charCodeAt(v)))==55296&&v+1<S&&(64512&(b=y.charCodeAt(v+1)))==56320&&(g=65536+(g-55296<<10)+(b-56320),v++),C+=g<128?1:g<2048?2:g<65536?3:4;for(m=i.uint8array?new Uint8Array(C):new Array(C),v=k=0;k<C;v++)(64512&(g=y.charCodeAt(v)))==55296&&v+1<S&&(64512&(b=y.charCodeAt(v+1)))==56320&&(g=65536+(g-55296<<10)+(b-56320),v++),g<128?m[k++]=g:(g<2048?m[k++]=192|g>>>6:(g<65536?m[k++]=224|g>>>12:(m[k++]=240|g>>>18,m[k++]=128|g>>>12&63),m[k++]=128|g>>>6&63),m[k++]=128|63&g);return m})(p)},o.utf8decode=function(p){return i.nodebuffer?s.transformTo("nodebuffer",p).toString("utf-8"):(function(y){var m,g,b,v,k=y.length,S=new Array(2*k);for(m=g=0;m<k;)if((b=y[m++])<128)S[g++]=b;else if(4<(v=u[b]))S[g++]=65533,m+=v-1;else{for(b&=v===2?31:v===3?15:7;1<v&&m<k;)b=b<<6|63&y[m++],v--;1<v?S[g++]=65533:b<65536?S[g++]=b:(b-=65536,S[g++]=55296|b>>10&1023,S[g++]=56320|1023&b)}return S.length!==g&&(S.subarray?S=S.subarray(0,g):S.length=g),s.applyFromCharCode(S)})(p=s.transformTo(i.uint8array?"uint8array":"array",p))},s.inherits(f,c),f.prototype.processChunk=function(p){var y=s.transformTo(i.uint8array?"uint8array":"array",p.data);if(this.leftOver&&this.leftOver.length){if(i.uint8array){var m=y;(y=new Uint8Array(m.length+this.leftOver.length)).set(this.leftOver,0),y.set(m,this.leftOver.length)}else y=this.leftOver.concat(y);this.leftOver=null}var g=(function(v,k){var S;for((k=k||v.length)>v.length&&(k=v.length),S=k-1;0<=S&&(192&v[S])==128;)S--;return S<0||S===0?k:S+u[v[S]]>k?S:k})(y),b=y;g!==y.length&&(i.uint8array?(b=y.subarray(0,g),this.leftOver=y.subarray(g,y.length)):(b=y.slice(0,g),this.leftOver=y.slice(g,y.length))),this.push({data:o.utf8decode(b),meta:p.meta})},f.prototype.flush=function(){this.leftOver&&this.leftOver.length&&(this.push({data:o.utf8decode(this.leftOver),meta:{}}),this.leftOver=null)},o.Utf8DecodeWorker=f,s.inherits(h,c),h.prototype.processChunk=function(p){this.push({data:o.utf8encode(p.data),meta:p.meta})},o.Utf8EncodeWorker=h},{"./nodejsUtils":14,"./stream/GenericWorker":28,"./support":30,"./utils":32}],32:[function(n,r,o){var s=n("./support"),i=n("./base64"),l=n("./nodejsUtils"),c=n("./external");function u(m){return m}function d(m,g){for(var b=0;b<m.length;++b)g[b]=255&m.charCodeAt(b);return g}n("setimmediate"),o.newBlob=function(m,g){o.checkSupport("blob");try{return new Blob([m],{type:g})}catch{try{var b=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);return b.append(m),b.getBlob(g)}catch{throw new Error("Bug : can't construct the Blob.")}}};var f={stringifyByChunk:function(m,g,b){var v=[],k=0,S=m.length;if(S<=b)return String.fromCharCode.apply(null,m);for(;k<S;)g==="array"||g==="nodebuffer"?v.push(String.fromCharCode.apply(null,m.slice(k,Math.min(k+b,S)))):v.push(String.fromCharCode.apply(null,m.subarray(k,Math.min(k+b,S)))),k+=b;return v.join("")},stringifyByChar:function(m){for(var g="",b=0;b<m.length;b++)g+=String.fromCharCode(m[b]);return g},applyCanBeUsed:{uint8array:(function(){try{return s.uint8array&&String.fromCharCode.apply(null,new Uint8Array(1)).length===1}catch{return!1}})(),nodebuffer:(function(){try{return s.nodebuffer&&String.fromCharCode.apply(null,l.allocBuffer(1)).length===1}catch{return!1}})()}};function h(m){var g=65536,b=o.getTypeOf(m),v=!0;if(b==="uint8array"?v=f.applyCanBeUsed.uint8array:b==="nodebuffer"&&(v=f.applyCanBeUsed.nodebuffer),v)for(;1<g;)try{return f.stringifyByChunk(m,b,g)}catch{g=Math.floor(g/2)}return f.stringifyByChar(m)}function p(m,g){for(var b=0;b<m.length;b++)g[b]=m[b];return g}o.applyFromCharCode=h;var y={};y.string={string:u,array:function(m){return d(m,new Array(m.length))},arraybuffer:function(m){return y.string.uint8array(m).buffer},uint8array:function(m){return d(m,new Uint8Array(m.length))},nodebuffer:function(m){return d(m,l.allocBuffer(m.length))}},y.array={string:h,array:u,arraybuffer:function(m){return new Uint8Array(m).buffer},uint8array:function(m){return new Uint8Array(m)},nodebuffer:function(m){return l.newBufferFrom(m)}},y.arraybuffer={string:function(m){return h(new Uint8Array(m))},array:function(m){return p(new Uint8Array(m),new Array(m.byteLength))},arraybuffer:u,uint8array:function(m){return new Uint8Array(m)},nodebuffer:function(m){return l.newBufferFrom(new Uint8Array(m))}},y.uint8array={string:h,array:function(m){return p(m,new Array(m.length))},arraybuffer:function(m){return m.buffer},uint8array:u,nodebuffer:function(m){return l.newBufferFrom(m)}},y.nodebuffer={string:h,array:function(m){return p(m,new Array(m.length))},arraybuffer:function(m){return y.nodebuffer.uint8array(m).buffer},uint8array:function(m){return p(m,new Uint8Array(m.length))},nodebuffer:u},o.transformTo=function(m,g){if(g=g||"",!m)return g;o.checkSupport(m);var b=o.getTypeOf(g);return y[b][m](g)},o.resolve=function(m){for(var g=m.split("/"),b=[],v=0;v<g.length;v++){var k=g[v];k==="."||k===""&&v!==0&&v!==g.length-1||(k===".."?b.pop():b.push(k))}return b.join("/")},o.getTypeOf=function(m){return typeof m=="string"?"string":Object.prototype.toString.call(m)==="[object Array]"?"array":s.nodebuffer&&l.isBuffer(m)?"nodebuffer":s.uint8array&&m instanceof Uint8Array?"uint8array":s.arraybuffer&&m instanceof ArrayBuffer?"arraybuffer":void 0},o.checkSupport=function(m){if(!s[m.toLowerCase()])throw new Error(m+" is not supported by this platform")},o.MAX_VALUE_16BITS=65535,o.MAX_VALUE_32BITS=-1,o.pretty=function(m){var g,b,v="";for(b=0;b<(m||"").length;b++)v+="\\x"+((g=m.charCodeAt(b))<16?"0":"")+g.toString(16).toUpperCase();return v},o.delay=function(m,g,b){setImmediate(function(){m.apply(b||null,g||[])})},o.inherits=function(m,g){function b(){}b.prototype=g.prototype,m.prototype=new b},o.extend=function(){var m,g,b={};for(m=0;m<arguments.length;m++)for(g in arguments[m])Object.prototype.hasOwnProperty.call(arguments[m],g)&&b[g]===void 0&&(b[g]=arguments[m][g]);return b},o.prepareContent=function(m,g,b,v,k){return c.Promise.resolve(g).then(function(S){return s.blob&&(S instanceof Blob||["[object File]","[object Blob]"].indexOf(Object.prototype.toString.call(S))!==-1)&&typeof FileReader<"u"?new c.Promise(function(C,j){var E=new FileReader;E.onload=function(T){C(T.target.result)},E.onerror=function(T){j(T.target.error)},E.readAsArrayBuffer(S)}):S}).then(function(S){var C=o.getTypeOf(S);return C?(C==="arraybuffer"?S=o.transformTo("uint8array",S):C==="string"&&(k?S=i.decode(S):b&&v!==!0&&(S=(function(j){return d(j,s.uint8array?new Uint8Array(j.length):new Array(j.length))})(S))),S):c.Promise.reject(new Error("Can't read the data of '"+m+"'. Is it in a supported JavaScript type (String, Blob, ArrayBuffer, etc) ?"))})}},{"./base64":1,"./external":6,"./nodejsUtils":14,"./support":30,setimmediate:54}],33:[function(n,r,o){var s=n("./reader/readerFor"),i=n("./utils"),l=n("./signature"),c=n("./zipEntry"),u=n("./support");function d(f){this.files=[],this.loadOptions=f}d.prototype={checkSignature:function(f){if(!this.reader.readAndCheckSignature(f)){this.reader.index-=4;var h=this.reader.readString(4);throw new Error("Corrupted zip or bug: unexpected signature ("+i.pretty(h)+", expected "+i.pretty(f)+")")}},isSignature:function(f,h){var p=this.reader.index;this.reader.setIndex(f);var y=this.reader.readString(4)===h;return this.reader.setIndex(p),y},readBlockEndOfCentral:function(){this.diskNumber=this.reader.readInt(2),this.diskWithCentralDirStart=this.reader.readInt(2),this.centralDirRecordsOnThisDisk=this.reader.readInt(2),this.centralDirRecords=this.reader.readInt(2),this.centralDirSize=this.reader.readInt(4),this.centralDirOffset=this.reader.readInt(4),this.zipCommentLength=this.reader.readInt(2);var f=this.reader.readData(this.zipCommentLength),h=u.uint8array?"uint8array":"array",p=i.transformTo(h,f);this.zipComment=this.loadOptions.decodeFileName(p)},readBlockZip64EndOfCentral:function(){this.zip64EndOfCentralSize=this.reader.readInt(8),this.reader.skip(4),this.diskNumber=this.reader.readInt(4),this.diskWithCentralDirStart=this.reader.readInt(4),this.centralDirRecordsOnThisDisk=this.reader.readInt(8),this.centralDirRecords=this.reader.readInt(8),this.centralDirSize=this.reader.readInt(8),this.centralDirOffset=this.reader.readInt(8),this.zip64ExtensibleData={};for(var f,h,p,y=this.zip64EndOfCentralSize-44;0<y;)f=this.reader.readInt(2),h=this.reader.readInt(4),p=this.reader.readData(h),this.zip64ExtensibleData[f]={id:f,length:h,value:p}},readBlockZip64EndOfCentralLocator:function(){if(this.diskWithZip64CentralDirStart=this.reader.readInt(4),this.relativeOffsetEndOfZip64CentralDir=this.reader.readInt(8),this.disksCount=this.reader.readInt(4),1<this.disksCount)throw new Error("Multi-volumes zip are not supported")},readLocalFiles:function(){var f,h;for(f=0;f<this.files.length;f++)h=this.files[f],this.reader.setIndex(h.localHeaderOffset),this.checkSignature(l.LOCAL_FILE_HEADER),h.readLocalPart(this.reader),h.handleUTF8(),h.processAttributes()},readCentralDir:function(){var f;for(this.reader.setIndex(this.centralDirOffset);this.reader.readAndCheckSignature(l.CENTRAL_FILE_HEADER);)(f=new c({zip64:this.zip64},this.loadOptions)).readCentralPart(this.reader),this.files.push(f);if(this.centralDirRecords!==this.files.length&&this.centralDirRecords!==0&&this.files.length===0)throw new Error("Corrupted zip or bug: expected "+this.centralDirRecords+" records in central dir, got "+this.files.length)},readEndOfCentral:function(){var f=this.reader.lastIndexOfSignature(l.CENTRAL_DIRECTORY_END);if(f<0)throw this.isSignature(0,l.LOCAL_FILE_HEADER)?new Error("Corrupted zip: can't find end of central directory"):new Error("Can't find end of central directory : is this a zip file ? If it is, see https://stuk.github.io/jszip/documentation/howto/read_zip.html");this.reader.setIndex(f);var h=f;if(this.checkSignature(l.CENTRAL_DIRECTORY_END),this.readBlockEndOfCentral(),this.diskNumber===i.MAX_VALUE_16BITS||this.diskWithCentralDirStart===i.MAX_VALUE_16BITS||this.centralDirRecordsOnThisDisk===i.MAX_VALUE_16BITS||this.centralDirRecords===i.MAX_VALUE_16BITS||this.centralDirSize===i.MAX_VALUE_32BITS||this.centralDirOffset===i.MAX_VALUE_32BITS){if(this.zip64=!0,(f=this.reader.lastIndexOfSignature(l.ZIP64_CENTRAL_DIRECTORY_LOCATOR))<0)throw new Error("Corrupted zip: can't find the ZIP64 end of central directory locator");if(this.reader.setIndex(f),this.checkSignature(l.ZIP64_CENTRAL_DIRECTORY_LOCATOR),this.readBlockZip64EndOfCentralLocator(),!this.isSignature(this.relativeOffsetEndOfZip64CentralDir,l.ZIP64_CENTRAL_DIRECTORY_END)&&(this.relativeOffsetEndOfZip64CentralDir=this.reader.lastIndexOfSignature(l.ZIP64_CENTRAL_DIRECTORY_END),this.relativeOffsetEndOfZip64CentralDir<0))throw new Error("Corrupted zip: can't find the ZIP64 end of central directory");this.reader.setIndex(this.relativeOffsetEndOfZip64CentralDir),this.checkSignature(l.ZIP64_CENTRAL_DIRECTORY_END),this.readBlockZip64EndOfCentral()}var p=this.centralDirOffset+this.centralDirSize;this.zip64&&(p+=20,p+=12+this.zip64EndOfCentralSize);var y=h-p;if(0<y)this.isSignature(h,l.CENTRAL_FILE_HEADER)||(this.reader.zero=y);else if(y<0)throw new Error("Corrupted zip: missing "+Math.abs(y)+" bytes.")},prepareReader:function(f){this.reader=s(f)},load:function(f){this.prepareReader(f),this.readEndOfCentral(),this.readCentralDir(),this.readLocalFiles()}},r.exports=d},{"./reader/readerFor":22,"./signature":23,"./support":30,"./utils":32,"./zipEntry":34}],34:[function(n,r,o){var s=n("./reader/readerFor"),i=n("./utils"),l=n("./compressedObject"),c=n("./crc32"),u=n("./utf8"),d=n("./compressions"),f=n("./support");function h(p,y){this.options=p,this.loadOptions=y}h.prototype={isEncrypted:function(){return(1&this.bitFlag)==1},useUTF8:function(){return(2048&this.bitFlag)==2048},readLocalPart:function(p){var y,m;if(p.skip(22),this.fileNameLength=p.readInt(2),m=p.readInt(2),this.fileName=p.readData(this.fileNameLength),p.skip(m),this.compressedSize===-1||this.uncompressedSize===-1)throw new Error("Bug or corrupted zip : didn't get enough information from the central directory (compressedSize === -1 || uncompressedSize === -1)");if((y=(function(g){for(var b in d)if(Object.prototype.hasOwnProperty.call(d,b)&&d[b].magic===g)return d[b];return null})(this.compressionMethod))===null)throw new Error("Corrupted zip : compression "+i.pretty(this.compressionMethod)+" unknown (inner file : "+i.transformTo("string",this.fileName)+")");this.decompressed=new l(this.compressedSize,this.uncompressedSize,this.crc32,y,p.readData(this.compressedSize))},readCentralPart:function(p){this.versionMadeBy=p.readInt(2),p.skip(2),this.bitFlag=p.readInt(2),this.compressionMethod=p.readString(2),this.date=p.readDate(),this.crc32=p.readInt(4),this.compressedSize=p.readInt(4),this.uncompressedSize=p.readInt(4);var y=p.readInt(2);if(this.extraFieldsLength=p.readInt(2),this.fileCommentLength=p.readInt(2),this.diskNumberStart=p.readInt(2),this.internalFileAttributes=p.readInt(2),this.externalFileAttributes=p.readInt(4),this.localHeaderOffset=p.readInt(4),this.isEncrypted())throw new Error("Encrypted zip are not supported");p.skip(y),this.readExtraFields(p),this.parseZIP64ExtraField(p),this.fileComment=p.readData(this.fileCommentLength)},processAttributes:function(){this.unixPermissions=null,this.dosPermissions=null;var p=this.versionMadeBy>>8;this.dir=!!(16&this.externalFileAttributes),p==0&&(this.dosPermissions=63&this.externalFileAttributes),p==3&&(this.unixPermissions=this.externalFileAttributes>>16&65535),this.dir||this.fileNameStr.slice(-1)!=="/"||(this.dir=!0)},parseZIP64ExtraField:function(){if(this.extraFields[1]){var p=s(this.extraFields[1].value);this.uncompressedSize===i.MAX_VALUE_32BITS&&(this.uncompressedSize=p.readInt(8)),this.compressedSize===i.MAX_VALUE_32BITS&&(this.compressedSize=p.readInt(8)),this.localHeaderOffset===i.MAX_VALUE_32BITS&&(this.localHeaderOffset=p.readInt(8)),this.diskNumberStart===i.MAX_VALUE_32BITS&&(this.diskNumberStart=p.readInt(4))}},readExtraFields:function(p){var y,m,g,b=p.index+this.extraFieldsLength;for(this.extraFields||(this.extraFields={});p.index+4<b;)y=p.readInt(2),m=p.readInt(2),g=p.readData(m),this.extraFields[y]={id:y,length:m,value:g};p.setIndex(b)},handleUTF8:function(){var p=f.uint8array?"uint8array":"array";if(this.useUTF8())this.fileNameStr=u.utf8decode(this.fileName),this.fileCommentStr=u.utf8decode(this.fileComment);else{var y=this.findExtraFieldUnicodePath();if(y!==null)this.fileNameStr=y;else{var m=i.transformTo(p,this.fileName);this.fileNameStr=this.loadOptions.decodeFileName(m)}var g=this.findExtraFieldUnicodeComment();if(g!==null)this.fileCommentStr=g;else{var b=i.transformTo(p,this.fileComment);this.fileCommentStr=this.loadOptions.decodeFileName(b)}}},findExtraFieldUnicodePath:function(){var p=this.extraFields[28789];if(p){var y=s(p.value);return y.readInt(1)!==1||c(this.fileName)!==y.readInt(4)?null:u.utf8decode(y.readData(p.length-5))}return null},findExtraFieldUnicodeComment:function(){var p=this.extraFields[25461];if(p){var y=s(p.value);return y.readInt(1)!==1||c(this.fileComment)!==y.readInt(4)?null:u.utf8decode(y.readData(p.length-5))}return null}},r.exports=h},{"./compressedObject":2,"./compressions":3,"./crc32":4,"./reader/readerFor":22,"./support":30,"./utf8":31,"./utils":32}],35:[function(n,r,o){function s(y,m,g){this.name=y,this.dir=g.dir,this.date=g.date,this.comment=g.comment,this.unixPermissions=g.unixPermissions,this.dosPermissions=g.dosPermissions,this._data=m,this._dataBinary=g.binary,this.options={compression:g.compression,compressionOptions:g.compressionOptions}}var i=n("./stream/StreamHelper"),l=n("./stream/DataWorker"),c=n("./utf8"),u=n("./compressedObject"),d=n("./stream/GenericWorker");s.prototype={internalStream:function(y){var m=null,g="string";try{if(!y)throw new Error("No output type specified.");var b=(g=y.toLowerCase())==="string"||g==="text";g!=="binarystring"&&g!=="text"||(g="string"),m=this._decompressWorker();var v=!this._dataBinary;v&&!b&&(m=m.pipe(new c.Utf8EncodeWorker)),!v&&b&&(m=m.pipe(new c.Utf8DecodeWorker))}catch(k){(m=new d("error")).error(k)}return new i(m,g,"")},async:function(y,m){return this.internalStream(y).accumulate(m)},nodeStream:function(y,m){return this.internalStream(y||"nodebuffer").toNodejsStream(m)},_compressWorker:function(y,m){if(this._data instanceof u&&this._data.compression.magic===y.magic)return this._data.getCompressedWorker();var g=this._decompressWorker();return this._dataBinary||(g=g.pipe(new c.Utf8EncodeWorker)),u.createWorkerFrom(g,y,m)},_decompressWorker:function(){return this._data instanceof u?this._data.getContentWorker():this._data instanceof d?this._data:new l(this._data)}};for(var f=["asText","asBinary","asNodeBuffer","asUint8Array","asArrayBuffer"],h=function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},p=0;p<f.length;p++)s.prototype[f[p]]=h;r.exports=s},{"./compressedObject":2,"./stream/DataWorker":27,"./stream/GenericWorker":28,"./stream/StreamHelper":29,"./utf8":31}],36:[function(n,r,o){(function(s){var i,l,c=s.MutationObserver||s.WebKitMutationObserver;if(c){var u=0,d=new c(y),f=s.document.createTextNode("");d.observe(f,{characterData:!0}),i=function(){f.data=u=++u%2}}else if(s.setImmediate||s.MessageChannel===void 0)i="document"in s&&"onreadystatechange"in s.document.createElement("script")?function(){var m=s.document.createElement("script");m.onreadystatechange=function(){y(),m.onreadystatechange=null,m.parentNode.removeChild(m),m=null},s.document.documentElement.appendChild(m)}:function(){setTimeout(y,0)};else{var h=new s.MessageChannel;h.port1.onmessage=y,i=function(){h.port2.postMessage(0)}}var p=[];function y(){var m,g;l=!0;for(var b=p.length;b;){for(g=p,p=[],m=-1;++m<b;)g[m]();b=p.length}l=!1}r.exports=function(m){p.push(m)!==1||l||i()}}).call(this,typeof no<"u"?no:typeof self<"u"?self:typeof window<"u"?window:{})},{}],37:[function(n,r,o){var s=n("immediate");function i(){}var l={},c=["REJECTED"],u=["FULFILLED"],d=["PENDING"];function f(b){if(typeof b!="function")throw new TypeError("resolver must be a function");this.state=d,this.queue=[],this.outcome=void 0,b!==i&&m(this,b)}function h(b,v,k){this.promise=b,typeof v=="function"&&(this.onFulfilled=v,this.callFulfilled=this.otherCallFulfilled),typeof k=="function"&&(this.onRejected=k,this.callRejected=this.otherCallRejected)}function p(b,v,k){s(function(){var S;try{S=v(k)}catch(C){return l.reject(b,C)}S===b?l.reject(b,new TypeError("Cannot resolve promise with itself")):l.resolve(b,S)})}function y(b){var v=b&&b.then;if(b&&(typeof b=="object"||typeof b=="function")&&typeof v=="function")return function(){v.apply(b,arguments)}}function m(b,v){var k=!1;function S(E){k||(k=!0,l.reject(b,E))}function C(E){k||(k=!0,l.resolve(b,E))}var j=g(function(){v(C,S)});j.status==="error"&&S(j.value)}function g(b,v){var k={};try{k.value=b(v),k.status="success"}catch(S){k.status="error",k.value=S}return k}(r.exports=f).prototype.finally=function(b){if(typeof b!="function")return this;var v=this.constructor;return this.then(function(k){return v.resolve(b()).then(function(){return k})},function(k){return v.resolve(b()).then(function(){throw k})})},f.prototype.catch=function(b){return this.then(null,b)},f.prototype.then=function(b,v){if(typeof b!="function"&&this.state===u||typeof v!="function"&&this.state===c)return this;var k=new this.constructor(i);return this.state!==d?p(k,this.state===u?b:v,this.outcome):this.queue.push(new h(k,b,v)),k},h.prototype.callFulfilled=function(b){l.resolve(this.promise,b)},h.prototype.otherCallFulfilled=function(b){p(this.promise,this.onFulfilled,b)},h.prototype.callRejected=function(b){l.reject(this.promise,b)},h.prototype.otherCallRejected=function(b){p(this.promise,this.onRejected,b)},l.resolve=function(b,v){var k=g(y,v);if(k.status==="error")return l.reject(b,k.value);var S=k.value;if(S)m(b,S);else{b.state=u,b.outcome=v;for(var C=-1,j=b.queue.length;++C<j;)b.queue[C].callFulfilled(v)}return b},l.reject=function(b,v){b.state=c,b.outcome=v;for(var k=-1,S=b.queue.length;++k<S;)b.queue[k].callRejected(v);return b},f.resolve=function(b){return b instanceof this?b:l.resolve(new this(i),b)},f.reject=function(b){var v=new this(i);return l.reject(v,b)},f.all=function(b){var v=this;if(Object.prototype.toString.call(b)!=="[object Array]")return this.reject(new TypeError("must be an array"));var k=b.length,S=!1;if(!k)return this.resolve([]);for(var C=new Array(k),j=0,E=-1,T=new this(i);++E<k;)z(b[E],E);return T;function z(O,B){v.resolve(O).then(function(N){C[B]=N,++j!==k||S||(S=!0,l.resolve(T,C))},function(N){S||(S=!0,l.reject(T,N))})}},f.race=function(b){var v=this;if(Object.prototype.toString.call(b)!=="[object Array]")return this.reject(new TypeError("must be an array"));var k=b.length,S=!1;if(!k)return this.resolve([]);for(var C=-1,j=new this(i);++C<k;)E=b[C],v.resolve(E).then(function(T){S||(S=!0,l.resolve(j,T))},function(T){S||(S=!0,l.reject(j,T))});var E;return j}},{immediate:36}],38:[function(n,r,o){var s={};(0,n("./lib/utils/common").assign)(s,n("./lib/deflate"),n("./lib/inflate"),n("./lib/zlib/constants")),r.exports=s},{"./lib/deflate":39,"./lib/inflate":40,"./lib/utils/common":41,"./lib/zlib/constants":44}],39:[function(n,r,o){var s=n("./zlib/deflate"),i=n("./utils/common"),l=n("./utils/strings"),c=n("./zlib/messages"),u=n("./zlib/zstream"),d=Object.prototype.toString,f=0,h=-1,p=0,y=8;function m(b){if(!(this instanceof m))return new m(b);this.options=i.assign({level:h,method:y,chunkSize:16384,windowBits:15,memLevel:8,strategy:p,to:""},b||{});var v=this.options;v.raw&&0<v.windowBits?v.windowBits=-v.windowBits:v.gzip&&0<v.windowBits&&v.windowBits<16&&(v.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new u,this.strm.avail_out=0;var k=s.deflateInit2(this.strm,v.level,v.method,v.windowBits,v.memLevel,v.strategy);if(k!==f)throw new Error(c[k]);if(v.header&&s.deflateSetHeader(this.strm,v.header),v.dictionary){var S;if(S=typeof v.dictionary=="string"?l.string2buf(v.dictionary):d.call(v.dictionary)==="[object ArrayBuffer]"?new Uint8Array(v.dictionary):v.dictionary,(k=s.deflateSetDictionary(this.strm,S))!==f)throw new Error(c[k]);this._dict_set=!0}}function g(b,v){var k=new m(v);if(k.push(b,!0),k.err)throw k.msg||c[k.err];return k.result}m.prototype.push=function(b,v){var k,S,C=this.strm,j=this.options.chunkSize;if(this.ended)return!1;S=v===~~v?v:v===!0?4:0,typeof b=="string"?C.input=l.string2buf(b):d.call(b)==="[object ArrayBuffer]"?C.input=new Uint8Array(b):C.input=b,C.next_in=0,C.avail_in=C.input.length;do{if(C.avail_out===0&&(C.output=new i.Buf8(j),C.next_out=0,C.avail_out=j),(k=s.deflate(C,S))!==1&&k!==f)return this.onEnd(k),!(this.ended=!0);C.avail_out!==0&&(C.avail_in!==0||S!==4&&S!==2)||(this.options.to==="string"?this.onData(l.buf2binstring(i.shrinkBuf(C.output,C.next_out))):this.onData(i.shrinkBuf(C.output,C.next_out)))}while((0<C.avail_in||C.avail_out===0)&&k!==1);return S===4?(k=s.deflateEnd(this.strm),this.onEnd(k),this.ended=!0,k===f):S!==2||(this.onEnd(f),!(C.avail_out=0))},m.prototype.onData=function(b){this.chunks.push(b)},m.prototype.onEnd=function(b){b===f&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=i.flattenChunks(this.chunks)),this.chunks=[],this.err=b,this.msg=this.strm.msg},o.Deflate=m,o.deflate=g,o.deflateRaw=function(b,v){return(v=v||{}).raw=!0,g(b,v)},o.gzip=function(b,v){return(v=v||{}).gzip=!0,g(b,v)}},{"./utils/common":41,"./utils/strings":42,"./zlib/deflate":46,"./zlib/messages":51,"./zlib/zstream":53}],40:[function(n,r,o){var s=n("./zlib/inflate"),i=n("./utils/common"),l=n("./utils/strings"),c=n("./zlib/constants"),u=n("./zlib/messages"),d=n("./zlib/zstream"),f=n("./zlib/gzheader"),h=Object.prototype.toString;function p(m){if(!(this instanceof p))return new p(m);this.options=i.assign({chunkSize:16384,windowBits:0,to:""},m||{});var g=this.options;g.raw&&0<=g.windowBits&&g.windowBits<16&&(g.windowBits=-g.windowBits,g.windowBits===0&&(g.windowBits=-15)),!(0<=g.windowBits&&g.windowBits<16)||m&&m.windowBits||(g.windowBits+=32),15<g.windowBits&&g.windowBits<48&&(15&g.windowBits)==0&&(g.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new d,this.strm.avail_out=0;var b=s.inflateInit2(this.strm,g.windowBits);if(b!==c.Z_OK)throw new Error(u[b]);this.header=new f,s.inflateGetHeader(this.strm,this.header)}function y(m,g){var b=new p(g);if(b.push(m,!0),b.err)throw b.msg||u[b.err];return b.result}p.prototype.push=function(m,g){var b,v,k,S,C,j,E=this.strm,T=this.options.chunkSize,z=this.options.dictionary,O=!1;if(this.ended)return!1;v=g===~~g?g:g===!0?c.Z_FINISH:c.Z_NO_FLUSH,typeof m=="string"?E.input=l.binstring2buf(m):h.call(m)==="[object ArrayBuffer]"?E.input=new Uint8Array(m):E.input=m,E.next_in=0,E.avail_in=E.input.length;do{if(E.avail_out===0&&(E.output=new i.Buf8(T),E.next_out=0,E.avail_out=T),(b=s.inflate(E,c.Z_NO_FLUSH))===c.Z_NEED_DICT&&z&&(j=typeof z=="string"?l.string2buf(z):h.call(z)==="[object ArrayBuffer]"?new Uint8Array(z):z,b=s.inflateSetDictionary(this.strm,j)),b===c.Z_BUF_ERROR&&O===!0&&(b=c.Z_OK,O=!1),b!==c.Z_STREAM_END&&b!==c.Z_OK)return this.onEnd(b),!(this.ended=!0);E.next_out&&(E.avail_out!==0&&b!==c.Z_STREAM_END&&(E.avail_in!==0||v!==c.Z_FINISH&&v!==c.Z_SYNC_FLUSH)||(this.options.to==="string"?(k=l.utf8border(E.output,E.next_out),S=E.next_out-k,C=l.buf2string(E.output,k),E.next_out=S,E.avail_out=T-S,S&&i.arraySet(E.output,E.output,k,S,0),this.onData(C)):this.onData(i.shrinkBuf(E.output,E.next_out)))),E.avail_in===0&&E.avail_out===0&&(O=!0)}while((0<E.avail_in||E.avail_out===0)&&b!==c.Z_STREAM_END);return b===c.Z_STREAM_END&&(v=c.Z_FINISH),v===c.Z_FINISH?(b=s.inflateEnd(this.strm),this.onEnd(b),this.ended=!0,b===c.Z_OK):v!==c.Z_SYNC_FLUSH||(this.onEnd(c.Z_OK),!(E.avail_out=0))},p.prototype.onData=function(m){this.chunks.push(m)},p.prototype.onEnd=function(m){m===c.Z_OK&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=i.flattenChunks(this.chunks)),this.chunks=[],this.err=m,this.msg=this.strm.msg},o.Inflate=p,o.inflate=y,o.inflateRaw=function(m,g){return(g=g||{}).raw=!0,y(m,g)},o.ungzip=y},{"./utils/common":41,"./utils/strings":42,"./zlib/constants":44,"./zlib/gzheader":47,"./zlib/inflate":49,"./zlib/messages":51,"./zlib/zstream":53}],41:[function(n,r,o){var s=typeof Uint8Array<"u"&&typeof Uint16Array<"u"&&typeof Int32Array<"u";o.assign=function(c){for(var u=Array.prototype.slice.call(arguments,1);u.length;){var d=u.shift();if(d){if(typeof d!="object")throw new TypeError(d+"must be non-object");for(var f in d)d.hasOwnProperty(f)&&(c[f]=d[f])}}return c},o.shrinkBuf=function(c,u){return c.length===u?c:c.subarray?c.subarray(0,u):(c.length=u,c)};var i={arraySet:function(c,u,d,f,h){if(u.subarray&&c.subarray)c.set(u.subarray(d,d+f),h);else for(var p=0;p<f;p++)c[h+p]=u[d+p]},flattenChunks:function(c){var u,d,f,h,p,y;for(u=f=0,d=c.length;u<d;u++)f+=c[u].length;for(y=new Uint8Array(f),u=h=0,d=c.length;u<d;u++)p=c[u],y.set(p,h),h+=p.length;return y}},l={arraySet:function(c,u,d,f,h){for(var p=0;p<f;p++)c[h+p]=u[d+p]},flattenChunks:function(c){return[].concat.apply([],c)}};o.setTyped=function(c){c?(o.Buf8=Uint8Array,o.Buf16=Uint16Array,o.Buf32=Int32Array,o.assign(o,i)):(o.Buf8=Array,o.Buf16=Array,o.Buf32=Array,o.assign(o,l))},o.setTyped(s)},{}],42:[function(n,r,o){var s=n("./common"),i=!0,l=!0;try{String.fromCharCode.apply(null,[0])}catch{i=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch{l=!1}for(var c=new s.Buf8(256),u=0;u<256;u++)c[u]=252<=u?6:248<=u?5:240<=u?4:224<=u?3:192<=u?2:1;function d(f,h){if(h<65537&&(f.subarray&&l||!f.subarray&&i))return String.fromCharCode.apply(null,s.shrinkBuf(f,h));for(var p="",y=0;y<h;y++)p+=String.fromCharCode(f[y]);return p}c[254]=c[254]=1,o.string2buf=function(f){var h,p,y,m,g,b=f.length,v=0;for(m=0;m<b;m++)(64512&(p=f.charCodeAt(m)))==55296&&m+1<b&&(64512&(y=f.charCodeAt(m+1)))==56320&&(p=65536+(p-55296<<10)+(y-56320),m++),v+=p<128?1:p<2048?2:p<65536?3:4;for(h=new s.Buf8(v),m=g=0;g<v;m++)(64512&(p=f.charCodeAt(m)))==55296&&m+1<b&&(64512&(y=f.charCodeAt(m+1)))==56320&&(p=65536+(p-55296<<10)+(y-56320),m++),p<128?h[g++]=p:(p<2048?h[g++]=192|p>>>6:(p<65536?h[g++]=224|p>>>12:(h[g++]=240|p>>>18,h[g++]=128|p>>>12&63),h[g++]=128|p>>>6&63),h[g++]=128|63&p);return h},o.buf2binstring=function(f){return d(f,f.length)},o.binstring2buf=function(f){for(var h=new s.Buf8(f.length),p=0,y=h.length;p<y;p++)h[p]=f.charCodeAt(p);return h},o.buf2string=function(f,h){var p,y,m,g,b=h||f.length,v=new Array(2*b);for(p=y=0;p<b;)if((m=f[p++])<128)v[y++]=m;else if(4<(g=c[m]))v[y++]=65533,p+=g-1;else{for(m&=g===2?31:g===3?15:7;1<g&&p<b;)m=m<<6|63&f[p++],g--;1<g?v[y++]=65533:m<65536?v[y++]=m:(m-=65536,v[y++]=55296|m>>10&1023,v[y++]=56320|1023&m)}return d(v,y)},o.utf8border=function(f,h){var p;for((h=h||f.length)>f.length&&(h=f.length),p=h-1;0<=p&&(192&f[p])==128;)p--;return p<0||p===0?h:p+c[f[p]]>h?p:h}},{"./common":41}],43:[function(n,r,o){r.exports=function(s,i,l,c){for(var u=65535&s|0,d=s>>>16&65535|0,f=0;l!==0;){for(l-=f=2e3<l?2e3:l;d=d+(u=u+i[c++]|0)|0,--f;);u%=65521,d%=65521}return u|d<<16|0}},{}],44:[function(n,r,o){r.exports={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8}},{}],45:[function(n,r,o){var s=(function(){for(var i,l=[],c=0;c<256;c++){i=c;for(var u=0;u<8;u++)i=1&i?3988292384^i>>>1:i>>>1;l[c]=i}return l})();r.exports=function(i,l,c,u){var d=s,f=u+c;i^=-1;for(var h=u;h<f;h++)i=i>>>8^d[255&(i^l[h])];return-1^i}},{}],46:[function(n,r,o){var s,i=n("../utils/common"),l=n("./trees"),c=n("./adler32"),u=n("./crc32"),d=n("./messages"),f=0,h=4,p=0,y=-2,m=-1,g=4,b=2,v=8,k=9,S=286,C=30,j=19,E=2*S+1,T=15,z=3,O=258,B=O+z+1,N=42,D=113,w=1,L=2,W=3,U=4;function F(_,ne){return _.msg=d[ne],ne}function K(_){return(_<<1)-(4<_?9:0)}function I(_){for(var ne=_.length;0<=--ne;)_[ne]=0}function V(_){var ne=_.state,Q=ne.pending;Q>_.avail_out&&(Q=_.avail_out),Q!==0&&(i.arraySet(_.output,ne.pending_buf,ne.pending_out,Q,_.next_out),_.next_out+=Q,ne.pending_out+=Q,_.total_out+=Q,_.avail_out-=Q,ne.pending-=Q,ne.pending===0&&(ne.pending_out=0))}function G(_,ne){l._tr_flush_block(_,0<=_.block_start?_.block_start:-1,_.strstart-_.block_start,ne),_.block_start=_.strstart,V(_.strm)}function R(_,ne){_.pending_buf[_.pending++]=ne}function ae(_,ne){_.pending_buf[_.pending++]=ne>>>8&255,_.pending_buf[_.pending++]=255&ne}function oe(_,ne){var Q,M,P=_.max_chain_length,q=_.strstart,Z=_.prev_length,J=_.nice_match,H=_.strstart>_.w_size-B?_.strstart-(_.w_size-B):0,se=_.window,Y=_.w_mask,ee=_.prev,$=_.strstart+O,X=se[q+Z-1],ce=se[q+Z];_.prev_length>=_.good_match&&(P>>=2),J>_.lookahead&&(J=_.lookahead);do if(se[(Q=ne)+Z]===ce&&se[Q+Z-1]===X&&se[Q]===se[q]&&se[++Q]===se[q+1]){q+=2,Q++;do;while(se[++q]===se[++Q]&&se[++q]===se[++Q]&&se[++q]===se[++Q]&&se[++q]===se[++Q]&&se[++q]===se[++Q]&&se[++q]===se[++Q]&&se[++q]===se[++Q]&&se[++q]===se[++Q]&&q<$);if(M=O-($-q),q=$-O,Z<M){if(_.match_start=ne,J<=(Z=M))break;X=se[q+Z-1],ce=se[q+Z]}}while((ne=ee[ne&Y])>H&&--P!=0);return Z<=_.lookahead?Z:_.lookahead}function fe(_){var ne,Q,M,P,q,Z,J,H,se,Y,ee=_.w_size;do{if(P=_.window_size-_.lookahead-_.strstart,_.strstart>=ee+(ee-B)){for(i.arraySet(_.window,_.window,ee,ee,0),_.match_start-=ee,_.strstart-=ee,_.block_start-=ee,ne=Q=_.hash_size;M=_.head[--ne],_.head[ne]=ee<=M?M-ee:0,--Q;);for(ne=Q=ee;M=_.prev[--ne],_.prev[ne]=ee<=M?M-ee:0,--Q;);P+=ee}if(_.strm.avail_in===0)break;if(Z=_.strm,J=_.window,H=_.strstart+_.lookahead,se=P,Y=void 0,Y=Z.avail_in,se<Y&&(Y=se),Q=Y===0?0:(Z.avail_in-=Y,i.arraySet(J,Z.input,Z.next_in,Y,H),Z.state.wrap===1?Z.adler=c(Z.adler,J,Y,H):Z.state.wrap===2&&(Z.adler=u(Z.adler,J,Y,H)),Z.next_in+=Y,Z.total_in+=Y,Y),_.lookahead+=Q,_.lookahead+_.insert>=z)for(q=_.strstart-_.insert,_.ins_h=_.window[q],_.ins_h=(_.ins_h<<_.hash_shift^_.window[q+1])&_.hash_mask;_.insert&&(_.ins_h=(_.ins_h<<_.hash_shift^_.window[q+z-1])&_.hash_mask,_.prev[q&_.w_mask]=_.head[_.ins_h],_.head[_.ins_h]=q,q++,_.insert--,!(_.lookahead+_.insert<z)););}while(_.lookahead<B&&_.strm.avail_in!==0)}function le(_,ne){for(var Q,M;;){if(_.lookahead<B){if(fe(_),_.lookahead<B&&ne===f)return w;if(_.lookahead===0)break}if(Q=0,_.lookahead>=z&&(_.ins_h=(_.ins_h<<_.hash_shift^_.window[_.strstart+z-1])&_.hash_mask,Q=_.prev[_.strstart&_.w_mask]=_.head[_.ins_h],_.head[_.ins_h]=_.strstart),Q!==0&&_.strstart-Q<=_.w_size-B&&(_.match_length=oe(_,Q)),_.match_length>=z)if(M=l._tr_tally(_,_.strstart-_.match_start,_.match_length-z),_.lookahead-=_.match_length,_.match_length<=_.max_lazy_match&&_.lookahead>=z){for(_.match_length--;_.strstart++,_.ins_h=(_.ins_h<<_.hash_shift^_.window[_.strstart+z-1])&_.hash_mask,Q=_.prev[_.strstart&_.w_mask]=_.head[_.ins_h],_.head[_.ins_h]=_.strstart,--_.match_length!=0;);_.strstart++}else _.strstart+=_.match_length,_.match_length=0,_.ins_h=_.window[_.strstart],_.ins_h=(_.ins_h<<_.hash_shift^_.window[_.strstart+1])&_.hash_mask;else M=l._tr_tally(_,0,_.window[_.strstart]),_.lookahead--,_.strstart++;if(M&&(G(_,!1),_.strm.avail_out===0))return w}return _.insert=_.strstart<z-1?_.strstart:z-1,ne===h?(G(_,!0),_.strm.avail_out===0?W:U):_.last_lit&&(G(_,!1),_.strm.avail_out===0)?w:L}function de(_,ne){for(var Q,M,P;;){if(_.lookahead<B){if(fe(_),_.lookahead<B&&ne===f)return w;if(_.lookahead===0)break}if(Q=0,_.lookahead>=z&&(_.ins_h=(_.ins_h<<_.hash_shift^_.window[_.strstart+z-1])&_.hash_mask,Q=_.prev[_.strstart&_.w_mask]=_.head[_.ins_h],_.head[_.ins_h]=_.strstart),_.prev_length=_.match_length,_.prev_match=_.match_start,_.match_length=z-1,Q!==0&&_.prev_length<_.max_lazy_match&&_.strstart-Q<=_.w_size-B&&(_.match_length=oe(_,Q),_.match_length<=5&&(_.strategy===1||_.match_length===z&&4096<_.strstart-_.match_start)&&(_.match_length=z-1)),_.prev_length>=z&&_.match_length<=_.prev_length){for(P=_.strstart+_.lookahead-z,M=l._tr_tally(_,_.strstart-1-_.prev_match,_.prev_length-z),_.lookahead-=_.prev_length-1,_.prev_length-=2;++_.strstart<=P&&(_.ins_h=(_.ins_h<<_.hash_shift^_.window[_.strstart+z-1])&_.hash_mask,Q=_.prev[_.strstart&_.w_mask]=_.head[_.ins_h],_.head[_.ins_h]=_.strstart),--_.prev_length!=0;);if(_.match_available=0,_.match_length=z-1,_.strstart++,M&&(G(_,!1),_.strm.avail_out===0))return w}else if(_.match_available){if((M=l._tr_tally(_,0,_.window[_.strstart-1]))&&G(_,!1),_.strstart++,_.lookahead--,_.strm.avail_out===0)return w}else _.match_available=1,_.strstart++,_.lookahead--}return _.match_available&&(M=l._tr_tally(_,0,_.window[_.strstart-1]),_.match_available=0),_.insert=_.strstart<z-1?_.strstart:z-1,ne===h?(G(_,!0),_.strm.avail_out===0?W:U):_.last_lit&&(G(_,!1),_.strm.avail_out===0)?w:L}function pe(_,ne,Q,M,P){this.good_length=_,this.max_lazy=ne,this.nice_length=Q,this.max_chain=M,this.func=P}function he(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=v,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new i.Buf16(2*E),this.dyn_dtree=new i.Buf16(2*(2*C+1)),this.bl_tree=new i.Buf16(2*(2*j+1)),I(this.dyn_ltree),I(this.dyn_dtree),I(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new i.Buf16(T+1),this.heap=new i.Buf16(2*S+1),I(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new i.Buf16(2*S+1),I(this.depth),this.l_buf=0,this.lit_bufsize=0,this.last_lit=0,this.d_buf=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}function me(_){var ne;return _&&_.state?(_.total_in=_.total_out=0,_.data_type=b,(ne=_.state).pending=0,ne.pending_out=0,ne.wrap<0&&(ne.wrap=-ne.wrap),ne.status=ne.wrap?N:D,_.adler=ne.wrap===2?0:1,ne.last_flush=f,l._tr_init(ne),p):F(_,y)}function _e(_){var ne=me(_);return ne===p&&(function(Q){Q.window_size=2*Q.w_size,I(Q.head),Q.max_lazy_match=s[Q.level].max_lazy,Q.good_match=s[Q.level].good_length,Q.nice_match=s[Q.level].nice_length,Q.max_chain_length=s[Q.level].max_chain,Q.strstart=0,Q.block_start=0,Q.lookahead=0,Q.insert=0,Q.match_length=Q.prev_length=z-1,Q.match_available=0,Q.ins_h=0})(_.state),ne}function Pe(_,ne,Q,M,P,q){if(!_)return y;var Z=1;if(ne===m&&(ne=6),M<0?(Z=0,M=-M):15<M&&(Z=2,M-=16),P<1||k<P||Q!==v||M<8||15<M||ne<0||9<ne||q<0||g<q)return F(_,y);M===8&&(M=9);var J=new he;return(_.state=J).strm=_,J.wrap=Z,J.gzhead=null,J.w_bits=M,J.w_size=1<<J.w_bits,J.w_mask=J.w_size-1,J.hash_bits=P+7,J.hash_size=1<<J.hash_bits,J.hash_mask=J.hash_size-1,J.hash_shift=~~((J.hash_bits+z-1)/z),J.window=new i.Buf8(2*J.w_size),J.head=new i.Buf16(J.hash_size),J.prev=new i.Buf16(J.w_size),J.lit_bufsize=1<<P+6,J.pending_buf_size=4*J.lit_bufsize,J.pending_buf=new i.Buf8(J.pending_buf_size),J.d_buf=1*J.lit_bufsize,J.l_buf=3*J.lit_bufsize,J.level=ne,J.strategy=q,J.method=Q,_e(_)}s=[new pe(0,0,0,0,function(_,ne){var Q=65535;for(Q>_.pending_buf_size-5&&(Q=_.pending_buf_size-5);;){if(_.lookahead<=1){if(fe(_),_.lookahead===0&&ne===f)return w;if(_.lookahead===0)break}_.strstart+=_.lookahead,_.lookahead=0;var M=_.block_start+Q;if((_.strstart===0||_.strstart>=M)&&(_.lookahead=_.strstart-M,_.strstart=M,G(_,!1),_.strm.avail_out===0)||_.strstart-_.block_start>=_.w_size-B&&(G(_,!1),_.strm.avail_out===0))return w}return _.insert=0,ne===h?(G(_,!0),_.strm.avail_out===0?W:U):(_.strstart>_.block_start&&(G(_,!1),_.strm.avail_out),w)}),new pe(4,4,8,4,le),new pe(4,5,16,8,le),new pe(4,6,32,32,le),new pe(4,4,16,16,de),new pe(8,16,32,32,de),new pe(8,16,128,128,de),new pe(8,32,128,256,de),new pe(32,128,258,1024,de),new pe(32,258,258,4096,de)],o.deflateInit=function(_,ne){return Pe(_,ne,v,15,8,0)},o.deflateInit2=Pe,o.deflateReset=_e,o.deflateResetKeep=me,o.deflateSetHeader=function(_,ne){return _&&_.state?_.state.wrap!==2?y:(_.state.gzhead=ne,p):y},o.deflate=function(_,ne){var Q,M,P,q;if(!_||!_.state||5<ne||ne<0)return _?F(_,y):y;if(M=_.state,!_.output||!_.input&&_.avail_in!==0||M.status===666&&ne!==h)return F(_,_.avail_out===0?-5:y);if(M.strm=_,Q=M.last_flush,M.last_flush=ne,M.status===N)if(M.wrap===2)_.adler=0,R(M,31),R(M,139),R(M,8),M.gzhead?(R(M,(M.gzhead.text?1:0)+(M.gzhead.hcrc?2:0)+(M.gzhead.extra?4:0)+(M.gzhead.name?8:0)+(M.gzhead.comment?16:0)),R(M,255&M.gzhead.time),R(M,M.gzhead.time>>8&255),R(M,M.gzhead.time>>16&255),R(M,M.gzhead.time>>24&255),R(M,M.level===9?2:2<=M.strategy||M.level<2?4:0),R(M,255&M.gzhead.os),M.gzhead.extra&&M.gzhead.extra.length&&(R(M,255&M.gzhead.extra.length),R(M,M.gzhead.extra.length>>8&255)),M.gzhead.hcrc&&(_.adler=u(_.adler,M.pending_buf,M.pending,0)),M.gzindex=0,M.status=69):(R(M,0),R(M,0),R(M,0),R(M,0),R(M,0),R(M,M.level===9?2:2<=M.strategy||M.level<2?4:0),R(M,3),M.status=D);else{var Z=v+(M.w_bits-8<<4)<<8;Z|=(2<=M.strategy||M.level<2?0:M.level<6?1:M.level===6?2:3)<<6,M.strstart!==0&&(Z|=32),Z+=31-Z%31,M.status=D,ae(M,Z),M.strstart!==0&&(ae(M,_.adler>>>16),ae(M,65535&_.adler)),_.adler=1}if(M.status===69)if(M.gzhead.extra){for(P=M.pending;M.gzindex<(65535&M.gzhead.extra.length)&&(M.pending!==M.pending_buf_size||(M.gzhead.hcrc&&M.pending>P&&(_.adler=u(_.adler,M.pending_buf,M.pending-P,P)),V(_),P=M.pending,M.pending!==M.pending_buf_size));)R(M,255&M.gzhead.extra[M.gzindex]),M.gzindex++;M.gzhead.hcrc&&M.pending>P&&(_.adler=u(_.adler,M.pending_buf,M.pending-P,P)),M.gzindex===M.gzhead.extra.length&&(M.gzindex=0,M.status=73)}else M.status=73;if(M.status===73)if(M.gzhead.name){P=M.pending;do{if(M.pending===M.pending_buf_size&&(M.gzhead.hcrc&&M.pending>P&&(_.adler=u(_.adler,M.pending_buf,M.pending-P,P)),V(_),P=M.pending,M.pending===M.pending_buf_size)){q=1;break}q=M.gzindex<M.gzhead.name.length?255&M.gzhead.name.charCodeAt(M.gzindex++):0,R(M,q)}while(q!==0);M.gzhead.hcrc&&M.pending>P&&(_.adler=u(_.adler,M.pending_buf,M.pending-P,P)),q===0&&(M.gzindex=0,M.status=91)}else M.status=91;if(M.status===91)if(M.gzhead.comment){P=M.pending;do{if(M.pending===M.pending_buf_size&&(M.gzhead.hcrc&&M.pending>P&&(_.adler=u(_.adler,M.pending_buf,M.pending-P,P)),V(_),P=M.pending,M.pending===M.pending_buf_size)){q=1;break}q=M.gzindex<M.gzhead.comment.length?255&M.gzhead.comment.charCodeAt(M.gzindex++):0,R(M,q)}while(q!==0);M.gzhead.hcrc&&M.pending>P&&(_.adler=u(_.adler,M.pending_buf,M.pending-P,P)),q===0&&(M.status=103)}else M.status=103;if(M.status===103&&(M.gzhead.hcrc?(M.pending+2>M.pending_buf_size&&V(_),M.pending+2<=M.pending_buf_size&&(R(M,255&_.adler),R(M,_.adler>>8&255),_.adler=0,M.status=D)):M.status=D),M.pending!==0){if(V(_),_.avail_out===0)return M.last_flush=-1,p}else if(_.avail_in===0&&K(ne)<=K(Q)&&ne!==h)return F(_,-5);if(M.status===666&&_.avail_in!==0)return F(_,-5);if(_.avail_in!==0||M.lookahead!==0||ne!==f&&M.status!==666){var J=M.strategy===2?(function(H,se){for(var Y;;){if(H.lookahead===0&&(fe(H),H.lookahead===0)){if(se===f)return w;break}if(H.match_length=0,Y=l._tr_tally(H,0,H.window[H.strstart]),H.lookahead--,H.strstart++,Y&&(G(H,!1),H.strm.avail_out===0))return w}return H.insert=0,se===h?(G(H,!0),H.strm.avail_out===0?W:U):H.last_lit&&(G(H,!1),H.strm.avail_out===0)?w:L})(M,ne):M.strategy===3?(function(H,se){for(var Y,ee,$,X,ce=H.window;;){if(H.lookahead<=O){if(fe(H),H.lookahead<=O&&se===f)return w;if(H.lookahead===0)break}if(H.match_length=0,H.lookahead>=z&&0<H.strstart&&(ee=ce[$=H.strstart-1])===ce[++$]&&ee===ce[++$]&&ee===ce[++$]){X=H.strstart+O;do;while(ee===ce[++$]&&ee===ce[++$]&&ee===ce[++$]&&ee===ce[++$]&&ee===ce[++$]&&ee===ce[++$]&&ee===ce[++$]&&ee===ce[++$]&&$<X);H.match_length=O-(X-$),H.match_length>H.lookahead&&(H.match_length=H.lookahead)}if(H.match_length>=z?(Y=l._tr_tally(H,1,H.match_length-z),H.lookahead-=H.match_length,H.strstart+=H.match_length,H.match_length=0):(Y=l._tr_tally(H,0,H.window[H.strstart]),H.lookahead--,H.strstart++),Y&&(G(H,!1),H.strm.avail_out===0))return w}return H.insert=0,se===h?(G(H,!0),H.strm.avail_out===0?W:U):H.last_lit&&(G(H,!1),H.strm.avail_out===0)?w:L})(M,ne):s[M.level].func(M,ne);if(J!==W&&J!==U||(M.status=666),J===w||J===W)return _.avail_out===0&&(M.last_flush=-1),p;if(J===L&&(ne===1?l._tr_align(M):ne!==5&&(l._tr_stored_block(M,0,0,!1),ne===3&&(I(M.head),M.lookahead===0&&(M.strstart=0,M.block_start=0,M.insert=0))),V(_),_.avail_out===0))return M.last_flush=-1,p}return ne!==h?p:M.wrap<=0?1:(M.wrap===2?(R(M,255&_.adler),R(M,_.adler>>8&255),R(M,_.adler>>16&255),R(M,_.adler>>24&255),R(M,255&_.total_in),R(M,_.total_in>>8&255),R(M,_.total_in>>16&255),R(M,_.total_in>>24&255)):(ae(M,_.adler>>>16),ae(M,65535&_.adler)),V(_),0<M.wrap&&(M.wrap=-M.wrap),M.pending!==0?p:1)},o.deflateEnd=function(_){var ne;return _&&_.state?(ne=_.state.status)!==N&&ne!==69&&ne!==73&&ne!==91&&ne!==103&&ne!==D&&ne!==666?F(_,y):(_.state=null,ne===D?F(_,-3):p):y},o.deflateSetDictionary=function(_,ne){var Q,M,P,q,Z,J,H,se,Y=ne.length;if(!_||!_.state||(q=(Q=_.state).wrap)===2||q===1&&Q.status!==N||Q.lookahead)return y;for(q===1&&(_.adler=c(_.adler,ne,Y,0)),Q.wrap=0,Y>=Q.w_size&&(q===0&&(I(Q.head),Q.strstart=0,Q.block_start=0,Q.insert=0),se=new i.Buf8(Q.w_size),i.arraySet(se,ne,Y-Q.w_size,Q.w_size,0),ne=se,Y=Q.w_size),Z=_.avail_in,J=_.next_in,H=_.input,_.avail_in=Y,_.next_in=0,_.input=ne,fe(Q);Q.lookahead>=z;){for(M=Q.strstart,P=Q.lookahead-(z-1);Q.ins_h=(Q.ins_h<<Q.hash_shift^Q.window[M+z-1])&Q.hash_mask,Q.prev[M&Q.w_mask]=Q.head[Q.ins_h],Q.head[Q.ins_h]=M,M++,--P;);Q.strstart=M,Q.lookahead=z-1,fe(Q)}return Q.strstart+=Q.lookahead,Q.block_start=Q.strstart,Q.insert=Q.lookahead,Q.lookahead=0,Q.match_length=Q.prev_length=z-1,Q.match_available=0,_.next_in=J,_.input=H,_.avail_in=Z,Q.wrap=q,p},o.deflateInfo="pako deflate (from Nodeca project)"},{"../utils/common":41,"./adler32":43,"./crc32":45,"./messages":51,"./trees":52}],47:[function(n,r,o){r.exports=function(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1}},{}],48:[function(n,r,o){r.exports=function(s,i){var l,c,u,d,f,h,p,y,m,g,b,v,k,S,C,j,E,T,z,O,B,N,D,w,L;l=s.state,c=s.next_in,w=s.input,u=c+(s.avail_in-5),d=s.next_out,L=s.output,f=d-(i-s.avail_out),h=d+(s.avail_out-257),p=l.dmax,y=l.wsize,m=l.whave,g=l.wnext,b=l.window,v=l.hold,k=l.bits,S=l.lencode,C=l.distcode,j=(1<<l.lenbits)-1,E=(1<<l.distbits)-1;e:do{k<15&&(v+=w[c++]<<k,k+=8,v+=w[c++]<<k,k+=8),T=S[v&j];t:for(;;){if(v>>>=z=T>>>24,k-=z,(z=T>>>16&255)===0)L[d++]=65535&T;else{if(!(16&z)){if((64&z)==0){T=S[(65535&T)+(v&(1<<z)-1)];continue t}if(32&z){l.mode=12;break e}s.msg="invalid literal/length code",l.mode=30;break e}O=65535&T,(z&=15)&&(k<z&&(v+=w[c++]<<k,k+=8),O+=v&(1<<z)-1,v>>>=z,k-=z),k<15&&(v+=w[c++]<<k,k+=8,v+=w[c++]<<k,k+=8),T=C[v&E];n:for(;;){if(v>>>=z=T>>>24,k-=z,!(16&(z=T>>>16&255))){if((64&z)==0){T=C[(65535&T)+(v&(1<<z)-1)];continue n}s.msg="invalid distance code",l.mode=30;break e}if(B=65535&T,k<(z&=15)&&(v+=w[c++]<<k,(k+=8)<z&&(v+=w[c++]<<k,k+=8)),p<(B+=v&(1<<z)-1)){s.msg="invalid distance too far back",l.mode=30;break e}if(v>>>=z,k-=z,(z=d-f)<B){if(m<(z=B-z)&&l.sane){s.msg="invalid distance too far back",l.mode=30;break e}if(D=b,(N=0)===g){if(N+=y-z,z<O){for(O-=z;L[d++]=b[N++],--z;);N=d-B,D=L}}else if(g<z){if(N+=y+g-z,(z-=g)<O){for(O-=z;L[d++]=b[N++],--z;);if(N=0,g<O){for(O-=z=g;L[d++]=b[N++],--z;);N=d-B,D=L}}}else if(N+=g-z,z<O){for(O-=z;L[d++]=b[N++],--z;);N=d-B,D=L}for(;2<O;)L[d++]=D[N++],L[d++]=D[N++],L[d++]=D[N++],O-=3;O&&(L[d++]=D[N++],1<O&&(L[d++]=D[N++]))}else{for(N=d-B;L[d++]=L[N++],L[d++]=L[N++],L[d++]=L[N++],2<(O-=3););O&&(L[d++]=L[N++],1<O&&(L[d++]=L[N++]))}break}}break}}while(c<u&&d<h);c-=O=k>>3,v&=(1<<(k-=O<<3))-1,s.next_in=c,s.next_out=d,s.avail_in=c<u?u-c+5:5-(c-u),s.avail_out=d<h?h-d+257:257-(d-h),l.hold=v,l.bits=k}},{}],49:[function(n,r,o){var s=n("../utils/common"),i=n("./adler32"),l=n("./crc32"),c=n("./inffast"),u=n("./inftrees"),d=1,f=2,h=0,p=-2,y=1,m=852,g=592;function b(N){return(N>>>24&255)+(N>>>8&65280)+((65280&N)<<8)+((255&N)<<24)}function v(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new s.Buf16(320),this.work=new s.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function k(N){var D;return N&&N.state?(D=N.state,N.total_in=N.total_out=D.total=0,N.msg="",D.wrap&&(N.adler=1&D.wrap),D.mode=y,D.last=0,D.havedict=0,D.dmax=32768,D.head=null,D.hold=0,D.bits=0,D.lencode=D.lendyn=new s.Buf32(m),D.distcode=D.distdyn=new s.Buf32(g),D.sane=1,D.back=-1,h):p}function S(N){var D;return N&&N.state?((D=N.state).wsize=0,D.whave=0,D.wnext=0,k(N)):p}function C(N,D){var w,L;return N&&N.state?(L=N.state,D<0?(w=0,D=-D):(w=1+(D>>4),D<48&&(D&=15)),D&&(D<8||15<D)?p:(L.window!==null&&L.wbits!==D&&(L.window=null),L.wrap=w,L.wbits=D,S(N))):p}function j(N,D){var w,L;return N?(L=new v,(N.state=L).window=null,(w=C(N,D))!==h&&(N.state=null),w):p}var E,T,z=!0;function O(N){if(z){var D;for(E=new s.Buf32(512),T=new s.Buf32(32),D=0;D<144;)N.lens[D++]=8;for(;D<256;)N.lens[D++]=9;for(;D<280;)N.lens[D++]=7;for(;D<288;)N.lens[D++]=8;for(u(d,N.lens,0,288,E,0,N.work,{bits:9}),D=0;D<32;)N.lens[D++]=5;u(f,N.lens,0,32,T,0,N.work,{bits:5}),z=!1}N.lencode=E,N.lenbits=9,N.distcode=T,N.distbits=5}function B(N,D,w,L){var W,U=N.state;return U.window===null&&(U.wsize=1<<U.wbits,U.wnext=0,U.whave=0,U.window=new s.Buf8(U.wsize)),L>=U.wsize?(s.arraySet(U.window,D,w-U.wsize,U.wsize,0),U.wnext=0,U.whave=U.wsize):(L<(W=U.wsize-U.wnext)&&(W=L),s.arraySet(U.window,D,w-L,W,U.wnext),(L-=W)?(s.arraySet(U.window,D,w-L,L,0),U.wnext=L,U.whave=U.wsize):(U.wnext+=W,U.wnext===U.wsize&&(U.wnext=0),U.whave<U.wsize&&(U.whave+=W))),0}o.inflateReset=S,o.inflateReset2=C,o.inflateResetKeep=k,o.inflateInit=function(N){return j(N,15)},o.inflateInit2=j,o.inflate=function(N,D){var w,L,W,U,F,K,I,V,G,R,ae,oe,fe,le,de,pe,he,me,_e,Pe,_,ne,Q,M,P=0,q=new s.Buf8(4),Z=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];if(!N||!N.state||!N.output||!N.input&&N.avail_in!==0)return p;(w=N.state).mode===12&&(w.mode=13),F=N.next_out,W=N.output,I=N.avail_out,U=N.next_in,L=N.input,K=N.avail_in,V=w.hold,G=w.bits,R=K,ae=I,ne=h;e:for(;;)switch(w.mode){case y:if(w.wrap===0){w.mode=13;break}for(;G<16;){if(K===0)break e;K--,V+=L[U++]<<G,G+=8}if(2&w.wrap&&V===35615){q[w.check=0]=255&V,q[1]=V>>>8&255,w.check=l(w.check,q,2,0),G=V=0,w.mode=2;break}if(w.flags=0,w.head&&(w.head.done=!1),!(1&w.wrap)||(((255&V)<<8)+(V>>8))%31){N.msg="incorrect header check",w.mode=30;break}if((15&V)!=8){N.msg="unknown compression method",w.mode=30;break}if(G-=4,_=8+(15&(V>>>=4)),w.wbits===0)w.wbits=_;else if(_>w.wbits){N.msg="invalid window size",w.mode=30;break}w.dmax=1<<_,N.adler=w.check=1,w.mode=512&V?10:12,G=V=0;break;case 2:for(;G<16;){if(K===0)break e;K--,V+=L[U++]<<G,G+=8}if(w.flags=V,(255&w.flags)!=8){N.msg="unknown compression method",w.mode=30;break}if(57344&w.flags){N.msg="unknown header flags set",w.mode=30;break}w.head&&(w.head.text=V>>8&1),512&w.flags&&(q[0]=255&V,q[1]=V>>>8&255,w.check=l(w.check,q,2,0)),G=V=0,w.mode=3;case 3:for(;G<32;){if(K===0)break e;K--,V+=L[U++]<<G,G+=8}w.head&&(w.head.time=V),512&w.flags&&(q[0]=255&V,q[1]=V>>>8&255,q[2]=V>>>16&255,q[3]=V>>>24&255,w.check=l(w.check,q,4,0)),G=V=0,w.mode=4;case 4:for(;G<16;){if(K===0)break e;K--,V+=L[U++]<<G,G+=8}w.head&&(w.head.xflags=255&V,w.head.os=V>>8),512&w.flags&&(q[0]=255&V,q[1]=V>>>8&255,w.check=l(w.check,q,2,0)),G=V=0,w.mode=5;case 5:if(1024&w.flags){for(;G<16;){if(K===0)break e;K--,V+=L[U++]<<G,G+=8}w.length=V,w.head&&(w.head.extra_len=V),512&w.flags&&(q[0]=255&V,q[1]=V>>>8&255,w.check=l(w.check,q,2,0)),G=V=0}else w.head&&(w.head.extra=null);w.mode=6;case 6:if(1024&w.flags&&(K<(oe=w.length)&&(oe=K),oe&&(w.head&&(_=w.head.extra_len-w.length,w.head.extra||(w.head.extra=new Array(w.head.extra_len)),s.arraySet(w.head.extra,L,U,oe,_)),512&w.flags&&(w.check=l(w.check,L,oe,U)),K-=oe,U+=oe,w.length-=oe),w.length))break e;w.length=0,w.mode=7;case 7:if(2048&w.flags){if(K===0)break e;for(oe=0;_=L[U+oe++],w.head&&_&&w.length<65536&&(w.head.name+=String.fromCharCode(_)),_&&oe<K;);if(512&w.flags&&(w.check=l(w.check,L,oe,U)),K-=oe,U+=oe,_)break e}else w.head&&(w.head.name=null);w.length=0,w.mode=8;case 8:if(4096&w.flags){if(K===0)break e;for(oe=0;_=L[U+oe++],w.head&&_&&w.length<65536&&(w.head.comment+=String.fromCharCode(_)),_&&oe<K;);if(512&w.flags&&(w.check=l(w.check,L,oe,U)),K-=oe,U+=oe,_)break e}else w.head&&(w.head.comment=null);w.mode=9;case 9:if(512&w.flags){for(;G<16;){if(K===0)break e;K--,V+=L[U++]<<G,G+=8}if(V!==(65535&w.check)){N.msg="header crc mismatch",w.mode=30;break}G=V=0}w.head&&(w.head.hcrc=w.flags>>9&1,w.head.done=!0),N.adler=w.check=0,w.mode=12;break;case 10:for(;G<32;){if(K===0)break e;K--,V+=L[U++]<<G,G+=8}N.adler=w.check=b(V),G=V=0,w.mode=11;case 11:if(w.havedict===0)return N.next_out=F,N.avail_out=I,N.next_in=U,N.avail_in=K,w.hold=V,w.bits=G,2;N.adler=w.check=1,w.mode=12;case 12:if(D===5||D===6)break e;case 13:if(w.last){V>>>=7&G,G-=7&G,w.mode=27;break}for(;G<3;){if(K===0)break e;K--,V+=L[U++]<<G,G+=8}switch(w.last=1&V,G-=1,3&(V>>>=1)){case 0:w.mode=14;break;case 1:if(O(w),w.mode=20,D!==6)break;V>>>=2,G-=2;break e;case 2:w.mode=17;break;case 3:N.msg="invalid block type",w.mode=30}V>>>=2,G-=2;break;case 14:for(V>>>=7&G,G-=7&G;G<32;){if(K===0)break e;K--,V+=L[U++]<<G,G+=8}if((65535&V)!=(V>>>16^65535)){N.msg="invalid stored block lengths",w.mode=30;break}if(w.length=65535&V,G=V=0,w.mode=15,D===6)break e;case 15:w.mode=16;case 16:if(oe=w.length){if(K<oe&&(oe=K),I<oe&&(oe=I),oe===0)break e;s.arraySet(W,L,U,oe,F),K-=oe,U+=oe,I-=oe,F+=oe,w.length-=oe;break}w.mode=12;break;case 17:for(;G<14;){if(K===0)break e;K--,V+=L[U++]<<G,G+=8}if(w.nlen=257+(31&V),V>>>=5,G-=5,w.ndist=1+(31&V),V>>>=5,G-=5,w.ncode=4+(15&V),V>>>=4,G-=4,286<w.nlen||30<w.ndist){N.msg="too many length or distance symbols",w.mode=30;break}w.have=0,w.mode=18;case 18:for(;w.have<w.ncode;){for(;G<3;){if(K===0)break e;K--,V+=L[U++]<<G,G+=8}w.lens[Z[w.have++]]=7&V,V>>>=3,G-=3}for(;w.have<19;)w.lens[Z[w.have++]]=0;if(w.lencode=w.lendyn,w.lenbits=7,Q={bits:w.lenbits},ne=u(0,w.lens,0,19,w.lencode,0,w.work,Q),w.lenbits=Q.bits,ne){N.msg="invalid code lengths set",w.mode=30;break}w.have=0,w.mode=19;case 19:for(;w.have<w.nlen+w.ndist;){for(;pe=(P=w.lencode[V&(1<<w.lenbits)-1])>>>16&255,he=65535&P,!((de=P>>>24)<=G);){if(K===0)break e;K--,V+=L[U++]<<G,G+=8}if(he<16)V>>>=de,G-=de,w.lens[w.have++]=he;else{if(he===16){for(M=de+2;G<M;){if(K===0)break e;K--,V+=L[U++]<<G,G+=8}if(V>>>=de,G-=de,w.have===0){N.msg="invalid bit length repeat",w.mode=30;break}_=w.lens[w.have-1],oe=3+(3&V),V>>>=2,G-=2}else if(he===17){for(M=de+3;G<M;){if(K===0)break e;K--,V+=L[U++]<<G,G+=8}G-=de,_=0,oe=3+(7&(V>>>=de)),V>>>=3,G-=3}else{for(M=de+7;G<M;){if(K===0)break e;K--,V+=L[U++]<<G,G+=8}G-=de,_=0,oe=11+(127&(V>>>=de)),V>>>=7,G-=7}if(w.have+oe>w.nlen+w.ndist){N.msg="invalid bit length repeat",w.mode=30;break}for(;oe--;)w.lens[w.have++]=_}}if(w.mode===30)break;if(w.lens[256]===0){N.msg="invalid code -- missing end-of-block",w.mode=30;break}if(w.lenbits=9,Q={bits:w.lenbits},ne=u(d,w.lens,0,w.nlen,w.lencode,0,w.work,Q),w.lenbits=Q.bits,ne){N.msg="invalid literal/lengths set",w.mode=30;break}if(w.distbits=6,w.distcode=w.distdyn,Q={bits:w.distbits},ne=u(f,w.lens,w.nlen,w.ndist,w.distcode,0,w.work,Q),w.distbits=Q.bits,ne){N.msg="invalid distances set",w.mode=30;break}if(w.mode=20,D===6)break e;case 20:w.mode=21;case 21:if(6<=K&&258<=I){N.next_out=F,N.avail_out=I,N.next_in=U,N.avail_in=K,w.hold=V,w.bits=G,c(N,ae),F=N.next_out,W=N.output,I=N.avail_out,U=N.next_in,L=N.input,K=N.avail_in,V=w.hold,G=w.bits,w.mode===12&&(w.back=-1);break}for(w.back=0;pe=(P=w.lencode[V&(1<<w.lenbits)-1])>>>16&255,he=65535&P,!((de=P>>>24)<=G);){if(K===0)break e;K--,V+=L[U++]<<G,G+=8}if(pe&&(240&pe)==0){for(me=de,_e=pe,Pe=he;pe=(P=w.lencode[Pe+((V&(1<<me+_e)-1)>>me)])>>>16&255,he=65535&P,!(me+(de=P>>>24)<=G);){if(K===0)break e;K--,V+=L[U++]<<G,G+=8}V>>>=me,G-=me,w.back+=me}if(V>>>=de,G-=de,w.back+=de,w.length=he,pe===0){w.mode=26;break}if(32&pe){w.back=-1,w.mode=12;break}if(64&pe){N.msg="invalid literal/length code",w.mode=30;break}w.extra=15&pe,w.mode=22;case 22:if(w.extra){for(M=w.extra;G<M;){if(K===0)break e;K--,V+=L[U++]<<G,G+=8}w.length+=V&(1<<w.extra)-1,V>>>=w.extra,G-=w.extra,w.back+=w.extra}w.was=w.length,w.mode=23;case 23:for(;pe=(P=w.distcode[V&(1<<w.distbits)-1])>>>16&255,he=65535&P,!((de=P>>>24)<=G);){if(K===0)break e;K--,V+=L[U++]<<G,G+=8}if((240&pe)==0){for(me=de,_e=pe,Pe=he;pe=(P=w.distcode[Pe+((V&(1<<me+_e)-1)>>me)])>>>16&255,he=65535&P,!(me+(de=P>>>24)<=G);){if(K===0)break e;K--,V+=L[U++]<<G,G+=8}V>>>=me,G-=me,w.back+=me}if(V>>>=de,G-=de,w.back+=de,64&pe){N.msg="invalid distance code",w.mode=30;break}w.offset=he,w.extra=15&pe,w.mode=24;case 24:if(w.extra){for(M=w.extra;G<M;){if(K===0)break e;K--,V+=L[U++]<<G,G+=8}w.offset+=V&(1<<w.extra)-1,V>>>=w.extra,G-=w.extra,w.back+=w.extra}if(w.offset>w.dmax){N.msg="invalid distance too far back",w.mode=30;break}w.mode=25;case 25:if(I===0)break e;if(oe=ae-I,w.offset>oe){if((oe=w.offset-oe)>w.whave&&w.sane){N.msg="invalid distance too far back",w.mode=30;break}fe=oe>w.wnext?(oe-=w.wnext,w.wsize-oe):w.wnext-oe,oe>w.length&&(oe=w.length),le=w.window}else le=W,fe=F-w.offset,oe=w.length;for(I<oe&&(oe=I),I-=oe,w.length-=oe;W[F++]=le[fe++],--oe;);w.length===0&&(w.mode=21);break;case 26:if(I===0)break e;W[F++]=w.length,I--,w.mode=21;break;case 27:if(w.wrap){for(;G<32;){if(K===0)break e;K--,V|=L[U++]<<G,G+=8}if(ae-=I,N.total_out+=ae,w.total+=ae,ae&&(N.adler=w.check=w.flags?l(w.check,W,ae,F-ae):i(w.check,W,ae,F-ae)),ae=I,(w.flags?V:b(V))!==w.check){N.msg="incorrect data check",w.mode=30;break}G=V=0}w.mode=28;case 28:if(w.wrap&&w.flags){for(;G<32;){if(K===0)break e;K--,V+=L[U++]<<G,G+=8}if(V!==(4294967295&w.total)){N.msg="incorrect length check",w.mode=30;break}G=V=0}w.mode=29;case 29:ne=1;break e;case 30:ne=-3;break e;case 31:return-4;default:return p}return N.next_out=F,N.avail_out=I,N.next_in=U,N.avail_in=K,w.hold=V,w.bits=G,(w.wsize||ae!==N.avail_out&&w.mode<30&&(w.mode<27||D!==4))&&B(N,N.output,N.next_out,ae-N.avail_out)?(w.mode=31,-4):(R-=N.avail_in,ae-=N.avail_out,N.total_in+=R,N.total_out+=ae,w.total+=ae,w.wrap&&ae&&(N.adler=w.check=w.flags?l(w.check,W,ae,N.next_out-ae):i(w.check,W,ae,N.next_out-ae)),N.data_type=w.bits+(w.last?64:0)+(w.mode===12?128:0)+(w.mode===20||w.mode===15?256:0),(R==0&&ae===0||D===4)&&ne===h&&(ne=-5),ne)},o.inflateEnd=function(N){if(!N||!N.state)return p;var D=N.state;return D.window&&(D.window=null),N.state=null,h},o.inflateGetHeader=function(N,D){var w;return N&&N.state?(2&(w=N.state).wrap)==0?p:((w.head=D).done=!1,h):p},o.inflateSetDictionary=function(N,D){var w,L=D.length;return N&&N.state?(w=N.state).wrap!==0&&w.mode!==11?p:w.mode===11&&i(1,D,L,0)!==w.check?-3:B(N,D,L,L)?(w.mode=31,-4):(w.havedict=1,h):p},o.inflateInfo="pako inflate (from Nodeca project)"},{"../utils/common":41,"./adler32":43,"./crc32":45,"./inffast":48,"./inftrees":50}],50:[function(n,r,o){var s=n("../utils/common"),i=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0],l=[16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78],c=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0],u=[16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64];r.exports=function(d,f,h,p,y,m,g,b){var v,k,S,C,j,E,T,z,O,B=b.bits,N=0,D=0,w=0,L=0,W=0,U=0,F=0,K=0,I=0,V=0,G=null,R=0,ae=new s.Buf16(16),oe=new s.Buf16(16),fe=null,le=0;for(N=0;N<=15;N++)ae[N]=0;for(D=0;D<p;D++)ae[f[h+D]]++;for(W=B,L=15;1<=L&&ae[L]===0;L--);if(L<W&&(W=L),L===0)return y[m++]=20971520,y[m++]=20971520,b.bits=1,0;for(w=1;w<L&&ae[w]===0;w++);for(W<w&&(W=w),N=K=1;N<=15;N++)if(K<<=1,(K-=ae[N])<0)return-1;if(0<K&&(d===0||L!==1))return-1;for(oe[1]=0,N=1;N<15;N++)oe[N+1]=oe[N]+ae[N];for(D=0;D<p;D++)f[h+D]!==0&&(g[oe[f[h+D]]++]=D);if(E=d===0?(G=fe=g,19):d===1?(G=i,R-=257,fe=l,le-=257,256):(G=c,fe=u,-1),N=w,j=m,F=D=V=0,S=-1,C=(I=1<<(U=W))-1,d===1&&852<I||d===2&&592<I)return 1;for(;;){for(T=N-F,O=g[D]<E?(z=0,g[D]):g[D]>E?(z=fe[le+g[D]],G[R+g[D]]):(z=96,0),v=1<<N-F,w=k=1<<U;y[j+(V>>F)+(k-=v)]=T<<24|z<<16|O|0,k!==0;);for(v=1<<N-1;V&v;)v>>=1;if(v!==0?(V&=v-1,V+=v):V=0,D++,--ae[N]==0){if(N===L)break;N=f[h+g[D]]}if(W<N&&(V&C)!==S){for(F===0&&(F=W),j+=w,K=1<<(U=N-F);U+F<L&&!((K-=ae[U+F])<=0);)U++,K<<=1;if(I+=1<<U,d===1&&852<I||d===2&&592<I)return 1;y[S=V&C]=W<<24|U<<16|j-m|0}}return V!==0&&(y[j+V]=N-F<<24|64<<16|0),b.bits=W,0}},{"../utils/common":41}],51:[function(n,r,o){r.exports={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"}},{}],52:[function(n,r,o){var s=n("../utils/common"),i=0,l=1;function c(P){for(var q=P.length;0<=--q;)P[q]=0}var u=0,d=29,f=256,h=f+1+d,p=30,y=19,m=2*h+1,g=15,b=16,v=7,k=256,S=16,C=17,j=18,E=[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0],T=[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13],z=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],O=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],B=new Array(2*(h+2));c(B);var N=new Array(2*p);c(N);var D=new Array(512);c(D);var w=new Array(256);c(w);var L=new Array(d);c(L);var W,U,F,K=new Array(p);function I(P,q,Z,J,H){this.static_tree=P,this.extra_bits=q,this.extra_base=Z,this.elems=J,this.max_length=H,this.has_stree=P&&P.length}function V(P,q){this.dyn_tree=P,this.max_code=0,this.stat_desc=q}function G(P){return P<256?D[P]:D[256+(P>>>7)]}function R(P,q){P.pending_buf[P.pending++]=255&q,P.pending_buf[P.pending++]=q>>>8&255}function ae(P,q,Z){P.bi_valid>b-Z?(P.bi_buf|=q<<P.bi_valid&65535,R(P,P.bi_buf),P.bi_buf=q>>b-P.bi_valid,P.bi_valid+=Z-b):(P.bi_buf|=q<<P.bi_valid&65535,P.bi_valid+=Z)}function oe(P,q,Z){ae(P,Z[2*q],Z[2*q+1])}function fe(P,q){for(var Z=0;Z|=1&P,P>>>=1,Z<<=1,0<--q;);return Z>>>1}function le(P,q,Z){var J,H,se=new Array(g+1),Y=0;for(J=1;J<=g;J++)se[J]=Y=Y+Z[J-1]<<1;for(H=0;H<=q;H++){var ee=P[2*H+1];ee!==0&&(P[2*H]=fe(se[ee]++,ee))}}function de(P){var q;for(q=0;q<h;q++)P.dyn_ltree[2*q]=0;for(q=0;q<p;q++)P.dyn_dtree[2*q]=0;for(q=0;q<y;q++)P.bl_tree[2*q]=0;P.dyn_ltree[2*k]=1,P.opt_len=P.static_len=0,P.last_lit=P.matches=0}function pe(P){8<P.bi_valid?R(P,P.bi_buf):0<P.bi_valid&&(P.pending_buf[P.pending++]=P.bi_buf),P.bi_buf=0,P.bi_valid=0}function he(P,q,Z,J){var H=2*q,se=2*Z;return P[H]<P[se]||P[H]===P[se]&&J[q]<=J[Z]}function me(P,q,Z){for(var J=P.heap[Z],H=Z<<1;H<=P.heap_len&&(H<P.heap_len&&he(q,P.heap[H+1],P.heap[H],P.depth)&&H++,!he(q,J,P.heap[H],P.depth));)P.heap[Z]=P.heap[H],Z=H,H<<=1;P.heap[Z]=J}function _e(P,q,Z){var J,H,se,Y,ee=0;if(P.last_lit!==0)for(;J=P.pending_buf[P.d_buf+2*ee]<<8|P.pending_buf[P.d_buf+2*ee+1],H=P.pending_buf[P.l_buf+ee],ee++,J===0?oe(P,H,q):(oe(P,(se=w[H])+f+1,q),(Y=E[se])!==0&&ae(P,H-=L[se],Y),oe(P,se=G(--J),Z),(Y=T[se])!==0&&ae(P,J-=K[se],Y)),ee<P.last_lit;);oe(P,k,q)}function Pe(P,q){var Z,J,H,se=q.dyn_tree,Y=q.stat_desc.static_tree,ee=q.stat_desc.has_stree,$=q.stat_desc.elems,X=-1;for(P.heap_len=0,P.heap_max=m,Z=0;Z<$;Z++)se[2*Z]!==0?(P.heap[++P.heap_len]=X=Z,P.depth[Z]=0):se[2*Z+1]=0;for(;P.heap_len<2;)se[2*(H=P.heap[++P.heap_len]=X<2?++X:0)]=1,P.depth[H]=0,P.opt_len--,ee&&(P.static_len-=Y[2*H+1]);for(q.max_code=X,Z=P.heap_len>>1;1<=Z;Z--)me(P,se,Z);for(H=$;Z=P.heap[1],P.heap[1]=P.heap[P.heap_len--],me(P,se,1),J=P.heap[1],P.heap[--P.heap_max]=Z,P.heap[--P.heap_max]=J,se[2*H]=se[2*Z]+se[2*J],P.depth[H]=(P.depth[Z]>=P.depth[J]?P.depth[Z]:P.depth[J])+1,se[2*Z+1]=se[2*J+1]=H,P.heap[1]=H++,me(P,se,1),2<=P.heap_len;);P.heap[--P.heap_max]=P.heap[1],(function(ce,xe){var Ne,Ue,mt,Oe,Ot,Gt,Je=xe.dyn_tree,Jt=xe.max_code,Nt=xe.stat_desc.static_tree,ex=xe.stat_desc.has_stree,tx=xe.stat_desc.extra_bits,Bl=xe.stat_desc.extra_base,xr=xe.stat_desc.max_length,to=0;for(Oe=0;Oe<=g;Oe++)ce.bl_count[Oe]=0;for(Je[2*ce.heap[ce.heap_max]+1]=0,Ne=ce.heap_max+1;Ne<m;Ne++)xr<(Oe=Je[2*Je[2*(Ue=ce.heap[Ne])+1]+1]+1)&&(Oe=xr,to++),Je[2*Ue+1]=Oe,Jt<Ue||(ce.bl_count[Oe]++,Ot=0,Bl<=Ue&&(Ot=tx[Ue-Bl]),Gt=Je[2*Ue],ce.opt_len+=Gt*(Oe+Ot),ex&&(ce.static_len+=Gt*(Nt[2*Ue+1]+Ot)));if(to!==0){do{for(Oe=xr-1;ce.bl_count[Oe]===0;)Oe--;ce.bl_count[Oe]--,ce.bl_count[Oe+1]+=2,ce.bl_count[xr]--,to-=2}while(0<to);for(Oe=xr;Oe!==0;Oe--)for(Ue=ce.bl_count[Oe];Ue!==0;)Jt<(mt=ce.heap[--Ne])||(Je[2*mt+1]!==Oe&&(ce.opt_len+=(Oe-Je[2*mt+1])*Je[2*mt],Je[2*mt+1]=Oe),Ue--)}})(P,q),le(se,X,P.bl_count)}function _(P,q,Z){var J,H,se=-1,Y=q[1],ee=0,$=7,X=4;for(Y===0&&($=138,X=3),q[2*(Z+1)+1]=65535,J=0;J<=Z;J++)H=Y,Y=q[2*(J+1)+1],++ee<$&&H===Y||(ee<X?P.bl_tree[2*H]+=ee:H!==0?(H!==se&&P.bl_tree[2*H]++,P.bl_tree[2*S]++):ee<=10?P.bl_tree[2*C]++:P.bl_tree[2*j]++,se=H,X=(ee=0)===Y?($=138,3):H===Y?($=6,3):($=7,4))}function ne(P,q,Z){var J,H,se=-1,Y=q[1],ee=0,$=7,X=4;for(Y===0&&($=138,X=3),J=0;J<=Z;J++)if(H=Y,Y=q[2*(J+1)+1],!(++ee<$&&H===Y)){if(ee<X)for(;oe(P,H,P.bl_tree),--ee!=0;);else H!==0?(H!==se&&(oe(P,H,P.bl_tree),ee--),oe(P,S,P.bl_tree),ae(P,ee-3,2)):ee<=10?(oe(P,C,P.bl_tree),ae(P,ee-3,3)):(oe(P,j,P.bl_tree),ae(P,ee-11,7));se=H,X=(ee=0)===Y?($=138,3):H===Y?($=6,3):($=7,4)}}c(K);var Q=!1;function M(P,q,Z,J){ae(P,(u<<1)+(J?1:0),3),(function(H,se,Y,ee){pe(H),R(H,Y),R(H,~Y),s.arraySet(H.pending_buf,H.window,se,Y,H.pending),H.pending+=Y})(P,q,Z)}o._tr_init=function(P){Q||((function(){var q,Z,J,H,se,Y=new Array(g+1);for(H=J=0;H<d-1;H++)for(L[H]=J,q=0;q<1<<E[H];q++)w[J++]=H;for(w[J-1]=H,H=se=0;H<16;H++)for(K[H]=se,q=0;q<1<<T[H];q++)D[se++]=H;for(se>>=7;H<p;H++)for(K[H]=se<<7,q=0;q<1<<T[H]-7;q++)D[256+se++]=H;for(Z=0;Z<=g;Z++)Y[Z]=0;for(q=0;q<=143;)B[2*q+1]=8,q++,Y[8]++;for(;q<=255;)B[2*q+1]=9,q++,Y[9]++;for(;q<=279;)B[2*q+1]=7,q++,Y[7]++;for(;q<=287;)B[2*q+1]=8,q++,Y[8]++;for(le(B,h+1,Y),q=0;q<p;q++)N[2*q+1]=5,N[2*q]=fe(q,5);W=new I(B,E,f+1,h,g),U=new I(N,T,0,p,g),F=new I(new Array(0),z,0,y,v)})(),Q=!0),P.l_desc=new V(P.dyn_ltree,W),P.d_desc=new V(P.dyn_dtree,U),P.bl_desc=new V(P.bl_tree,F),P.bi_buf=0,P.bi_valid=0,de(P)},o._tr_stored_block=M,o._tr_flush_block=function(P,q,Z,J){var H,se,Y=0;0<P.level?(P.strm.data_type===2&&(P.strm.data_type=(function(ee){var $,X=4093624447;for($=0;$<=31;$++,X>>>=1)if(1&X&&ee.dyn_ltree[2*$]!==0)return i;if(ee.dyn_ltree[18]!==0||ee.dyn_ltree[20]!==0||ee.dyn_ltree[26]!==0)return l;for($=32;$<f;$++)if(ee.dyn_ltree[2*$]!==0)return l;return i})(P)),Pe(P,P.l_desc),Pe(P,P.d_desc),Y=(function(ee){var $;for(_(ee,ee.dyn_ltree,ee.l_desc.max_code),_(ee,ee.dyn_dtree,ee.d_desc.max_code),Pe(ee,ee.bl_desc),$=y-1;3<=$&&ee.bl_tree[2*O[$]+1]===0;$--);return ee.opt_len+=3*($+1)+5+5+4,$})(P),H=P.opt_len+3+7>>>3,(se=P.static_len+3+7>>>3)<=H&&(H=se)):H=se=Z+5,Z+4<=H&&q!==-1?M(P,q,Z,J):P.strategy===4||se===H?(ae(P,2+(J?1:0),3),_e(P,B,N)):(ae(P,4+(J?1:0),3),(function(ee,$,X,ce){var xe;for(ae(ee,$-257,5),ae(ee,X-1,5),ae(ee,ce-4,4),xe=0;xe<ce;xe++)ae(ee,ee.bl_tree[2*O[xe]+1],3);ne(ee,ee.dyn_ltree,$-1),ne(ee,ee.dyn_dtree,X-1)})(P,P.l_desc.max_code+1,P.d_desc.max_code+1,Y+1),_e(P,P.dyn_ltree,P.dyn_dtree)),de(P),J&&pe(P)},o._tr_tally=function(P,q,Z){return P.pending_buf[P.d_buf+2*P.last_lit]=q>>>8&255,P.pending_buf[P.d_buf+2*P.last_lit+1]=255&q,P.pending_buf[P.l_buf+P.last_lit]=255&Z,P.last_lit++,q===0?P.dyn_ltree[2*Z]++:(P.matches++,q--,P.dyn_ltree[2*(w[Z]+f+1)]++,P.dyn_dtree[2*G(q)]++),P.last_lit===P.lit_bufsize-1},o._tr_align=function(P){ae(P,2,3),oe(P,k,B),(function(q){q.bi_valid===16?(R(q,q.bi_buf),q.bi_buf=0,q.bi_valid=0):8<=q.bi_valid&&(q.pending_buf[q.pending++]=255&q.bi_buf,q.bi_buf>>=8,q.bi_valid-=8)})(P)}},{"../utils/common":41}],53:[function(n,r,o){r.exports=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}},{}],54:[function(n,r,o){(function(s){(function(i,l){if(!i.setImmediate){var c,u,d,f,h=1,p={},y=!1,m=i.document,g=Object.getPrototypeOf&&Object.getPrototypeOf(i);g=g&&g.setTimeout?g:i,c={}.toString.call(i.process)==="[object process]"?function(S){process.nextTick(function(){v(S)})}:(function(){if(i.postMessage&&!i.importScripts){var S=!0,C=i.onmessage;return i.onmessage=function(){S=!1},i.postMessage("","*"),i.onmessage=C,S}})()?(f="setImmediate$"+Math.random()+"$",i.addEventListener?i.addEventListener("message",k,!1):i.attachEvent("onmessage",k),function(S){i.postMessage(f+S,"*")}):i.MessageChannel?((d=new MessageChannel).port1.onmessage=function(S){v(S.data)},function(S){d.port2.postMessage(S)}):m&&"onreadystatechange"in m.createElement("script")?(u=m.documentElement,function(S){var C=m.createElement("script");C.onreadystatechange=function(){v(S),C.onreadystatechange=null,u.removeChild(C),C=null},u.appendChild(C)}):function(S){setTimeout(v,0,S)},g.setImmediate=function(S){typeof S!="function"&&(S=new Function(""+S));for(var C=new Array(arguments.length-1),j=0;j<C.length;j++)C[j]=arguments[j+1];var E={callback:S,args:C};return p[h]=E,c(h),h++},g.clearImmediate=b}function b(S){delete p[S]}function v(S){if(y)setTimeout(v,0,S);else{var C=p[S];if(C){y=!0;try{(function(j){var E=j.callback,T=j.args;switch(T.length){case 0:E();break;case 1:E(T[0]);break;case 2:E(T[0],T[1]);break;case 3:E(T[0],T[1],T[2]);break;default:E.apply(l,T)}})(C)}finally{b(S),y=!1}}}}function k(S){S.source===i&&typeof S.data=="string"&&S.data.indexOf(f)===0&&v(+S.data.slice(f.length))}})(typeof self>"u"?s===void 0?this:s:self)}).call(this,typeof no<"u"?no:typeof self<"u"?self:typeof window<"u"?window:{})},{}]},{},[10])(10)})})(Hs)),Hs.exports}var Ew=Nw();const Tw=ka(Ew),Pf="[REDACTED]",Aw=/(^|[-_])(api[-_]?key|authorization|cookie|token|secret|password|access[-_]?token|refresh[-_]?token)([-_]|$)/i,Iw=[/Bearer\s+[A-Za-z0-9._~+/=-]{12,}/gi,/\bsk-[A-Za-z0-9_-]{12,}\b/g,/\bsk-ant-[A-Za-z0-9_-]{12,}\b/g,/\bghp_[A-Za-z0-9_]{12,}\b/g,/\bglpat-[A-Za-z0-9_-]{12,}\b/g],gc=200,zw=25e6,xc=50;function Rw(e){return e<1024?`${e} chars`:e<1024*1024?`${Math.ceil(e/1024)} KB`:`${Math.ceil(e/(1024*1024))} MB`}function Pw(e){let t=0;for(const n of e)t+=n.rawRequestBody?.length??0,t+=n.responseText?.length??0;return t}function Ow(e){if(e.length>gc)return`Export is limited to ${gc} logs at once. Narrow the filter and try again.`;const t=Pw(e);return t>zw?`Export is too large (${Rw(t)} of text). Narrow the filter and try again.`:null}async function Mw(e){try{const t=await fetch(`/api/logs/${e}/chunks`);if(!t.ok)return null;const n=await t.json();return JSON.stringify(n,null,2)}catch{return null}}function Lw(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function Li(e){if(Array.isArray(e))return e.map(n=>Li(n));if(!Lw(e))return e;const t={};for(const[n,r]of Object.entries(e))t[n]=Aw.test(n)?Pf:Li(r);return t}function Dw(e){const t=n=>{let r=n;for(const o of Iw)r=r.replace(o,Pf);return r};try{const n=JSON.parse(e);return t(JSON.stringify(Li(n),null,2))}catch{return t(e)}}function Vs(e,t){return t==="redacted"?Dw(e):e}async function Fw(e,t="redacted"){const n=Ow(e);if(n!==null)return{ok:!1,message:n};const r=new Tw,o=t==="redacted"?"redacted":"raw",s=e.filter(u=>u.streaming).slice(0,xc);r.file("manifest.json",JSON.stringify({exportedAt:new Date().toISOString(),mode:t,redacted:t==="redacted",logCount:e.length,logIds:e.map(u=>u.id),streamingChunkExportLimit:xc,streamingChunkLogIds:s.map(u=>u.id)},null,2));for(const u of e)u.rawRequestBody!==null&&r.file(`#${u.id}.Request.json`,Vs(u.rawRequestBody,t)),u.responseText!==null&&r.file(`#${u.id}.Response.json`,Vs(u.responseText,t));for(const u of s){const d=await Mw(u.id);d!==null&&r.file(`#${u.id}.SSE.Response.json`,Vs(d,t))}const i=await r.generateAsync({type:"blob"}),l=URL.createObjectURL(i),c=document.createElement("a");return c.href=l,c.download=`agent-inspector-export-${o}-${new Date().toISOString().slice(0,10)}.zip`,document.body.appendChild(c),c.click(),document.body.removeChild(c),URL.revokeObjectURL(l),{ok:!0}}function Di(e,t){switch(t){case"full":return e;case"time":return new Date(e).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",second:"2-digit"})}}function Da(e,t,n){return`${Di(e,n)} - ${Di(t,n)}`}function Of(e){var t,n,r="";if(typeof e=="string"||typeof e=="number")r+=e;else if(typeof e=="object")if(Array.isArray(e)){var o=e.length;for(t=0;t<o;t++)e[t]&&(n=Of(e[t]))&&(r&&(r+=" "),r+=n)}else for(n in e)e[n]&&(r&&(r+=" "),r+=n);return r}function Mf(){for(var e,t,n=0,r="",o=arguments.length;n<o;n++)(e=arguments[n])&&(t=Of(e))&&(r&&(r+=" "),r+=t);return r}const $w=(e,t)=>{const n=new Array(e.length+t.length);for(let r=0;r<e.length;r++)n[r]=e[r];for(let r=0;r<t.length;r++)n[e.length+r]=t[r];return n},Bw=(e,t)=>({classGroupId:e,validator:t}),Lf=(e=new Map,t=null,n)=>({nextPart:e,validators:t,classGroupId:n}),Do="-",bc=[],Uw="arbitrary..",Ww=e=>{const t=Vw(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=e;return{getClassGroupId:i=>{if(i.startsWith("[")&&i.endsWith("]"))return Hw(i);const l=i.split(Do),c=l[0]===""&&l.length>1?1:0;return Df(l,c,t)},getConflictingClassGroupIds:(i,l)=>{if(l){const c=r[i],u=n[i];return c?u?$w(u,c):c:u||bc}return n[i]||bc}}},Df=(e,t,n)=>{if(e.length-t===0)return n.classGroupId;const o=e[t],s=n.nextPart.get(o);if(s){const u=Df(e,t+1,s);if(u)return u}const i=n.validators;if(i===null)return;const l=t===0?e.join(Do):e.slice(t).join(Do),c=i.length;for(let u=0;u<c;u++){const d=i[u];if(d.validator(l))return d.classGroupId}},Hw=e=>e.slice(1,-1).indexOf(":")===-1?void 0:(()=>{const t=e.slice(1,-1),n=t.indexOf(":"),r=t.slice(0,n);return r?Uw+r:void 0})(),Vw=e=>{const{theme:t,classGroups:n}=e;return Zw(n,t)},Zw=(e,t)=>{const n=Lf();for(const r in e){const o=e[r];Fa(o,n,r,t)}return n},Fa=(e,t,n,r)=>{const o=e.length;for(let s=0;s<o;s++){const i=e[s];qw(i,t,n,r)}},qw=(e,t,n,r)=>{if(typeof e=="string"){Kw(e,t,n);return}if(typeof e=="function"){Gw(e,t,n,r);return}Jw(e,t,n,r)},Kw=(e,t,n)=>{const r=e===""?t:Ff(t,e);r.classGroupId=n},Gw=(e,t,n,r)=>{if(Yw(e)){Fa(e(r),t,n,r);return}t.validators===null&&(t.validators=[]),t.validators.push(Bw(n,e))},Jw=(e,t,n,r)=>{const o=Object.entries(e),s=o.length;for(let i=0;i<s;i++){const[l,c]=o[i];Fa(c,Ff(t,l),n,r)}},Ff=(e,t)=>{let n=e;const r=t.split(Do),o=r.length;for(let s=0;s<o;s++){const i=r[s];let l=n.nextPart.get(i);l||(l=Lf(),n.nextPart.set(i,l)),n=l}return n},Yw=e=>"isThemeGetter"in e&&e.isThemeGetter===!0,Xw=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,n=Object.create(null),r=Object.create(null);const o=(s,i)=>{n[s]=i,t++,t>e&&(t=0,r=n,n=Object.create(null))};return{get(s){let i=n[s];if(i!==void 0)return i;if((i=r[s])!==void 0)return o(s,i),i},set(s,i){s in n?n[s]=i:o(s,i)}}},Fi="!",yc=":",Qw=[],vc=(e,t,n,r,o)=>({modifiers:e,hasImportantModifier:t,baseClassName:n,maybePostfixModifierPosition:r,isExternal:o}),ek=e=>{const{prefix:t,experimentalParseClassName:n}=e;let r=o=>{const s=[];let i=0,l=0,c=0,u;const d=o.length;for(let m=0;m<d;m++){const g=o[m];if(i===0&&l===0){if(g===yc){s.push(o.slice(c,m)),c=m+1;continue}if(g==="/"){u=m;continue}}g==="["?i++:g==="]"?i--:g==="("?l++:g===")"&&l--}const f=s.length===0?o:o.slice(c);let h=f,p=!1;f.endsWith(Fi)?(h=f.slice(0,-1),p=!0):f.startsWith(Fi)&&(h=f.slice(1),p=!0);const y=u&&u>c?u-c:void 0;return vc(s,p,h,y)};if(t){const o=t+yc,s=r;r=i=>i.startsWith(o)?s(i.slice(o.length)):vc(Qw,!1,i,void 0,!0)}if(n){const o=r;r=s=>n({className:s,parseClassName:o})}return r},tk=e=>{const t=new Map;return e.orderSensitiveModifiers.forEach((n,r)=>{t.set(n,1e6+r)}),n=>{const r=[];let o=[];for(let s=0;s<n.length;s++){const i=n[s],l=i[0]==="[",c=t.has(i);l||c?(o.length>0&&(o.sort(),r.push(...o),o=[]),r.push(i)):o.push(i)}return o.length>0&&(o.sort(),r.push(...o)),r}},nk=e=>({cache:Xw(e.cacheSize),parseClassName:ek(e),sortModifiers:tk(e),...Ww(e)}),rk=/\s+/,ok=(e,t)=>{const{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:o,sortModifiers:s}=t,i=[],l=e.trim().split(rk);let c="";for(let u=l.length-1;u>=0;u-=1){const d=l[u],{isExternal:f,modifiers:h,hasImportantModifier:p,baseClassName:y,maybePostfixModifierPosition:m}=n(d);if(f){c=d+(c.length>0?" "+c:c);continue}let g=!!m,b=r(g?y.substring(0,m):y);if(!b){if(!g){c=d+(c.length>0?" "+c:c);continue}if(b=r(y),!b){c=d+(c.length>0?" "+c:c);continue}g=!1}const v=h.length===0?"":h.length===1?h[0]:s(h).join(":"),k=p?v+Fi:v,S=k+b;if(i.indexOf(S)>-1)continue;i.push(S);const C=o(b,g);for(let j=0;j<C.length;++j){const E=C[j];i.push(k+E)}c=d+(c.length>0?" "+c:c)}return c},sk=(...e)=>{let t=0,n,r,o="";for(;t<e.length;)(n=e[t++])&&(r=$f(n))&&(o&&(o+=" "),o+=r);return o},$f=e=>{if(typeof e=="string")return e;let t,n="";for(let r=0;r<e.length;r++)e[r]&&(t=$f(e[r]))&&(n&&(n+=" "),n+=t);return n},ik=(e,...t)=>{let n,r,o,s;const i=c=>{const u=t.reduce((d,f)=>f(d),e());return n=nk(u),r=n.cache.get,o=n.cache.set,s=l,l(c)},l=c=>{const u=r(c);if(u)return u;const d=ok(c,n);return o(c,d),d};return s=i,(...c)=>s(sk(...c))},ak=[],et=e=>{const t=n=>n[e]||ak;return t.isThemeGetter=!0,t},Bf=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,Uf=/^\((?:(\w[\w-]*):)?(.+)\)$/i,lk=/^\d+\/\d+$/,ck=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,uk=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,dk=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,fk=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,pk=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Ln=e=>lk.test(e),Ie=e=>!!e&&!Number.isNaN(Number(e)),an=e=>!!e&&Number.isInteger(Number(e)),Zs=e=>e.endsWith("%")&&Ie(e.slice(0,-1)),Yt=e=>ck.test(e),hk=()=>!0,mk=e=>uk.test(e)&&!dk.test(e),Wf=()=>!1,gk=e=>fk.test(e),xk=e=>pk.test(e),bk=e=>!be(e)&&!ye(e),yk=e=>cr(e,Zf,Wf),be=e=>Bf.test(e),_n=e=>cr(e,qf,mk),qs=e=>cr(e,Sk,Ie),wc=e=>cr(e,Hf,Wf),vk=e=>cr(e,Vf,xk),lo=e=>cr(e,Kf,gk),ye=e=>Uf.test(e),br=e=>ur(e,qf),wk=e=>ur(e,Ck),kc=e=>ur(e,Hf),kk=e=>ur(e,Zf),_k=e=>ur(e,Vf),co=e=>ur(e,Kf,!0),cr=(e,t,n)=>{const r=Bf.exec(e);return r?r[1]?t(r[1]):n(r[2]):!1},ur=(e,t,n=!1)=>{const r=Uf.exec(e);return r?r[1]?t(r[1]):n:!1},Hf=e=>e==="position"||e==="percentage",Vf=e=>e==="image"||e==="url",Zf=e=>e==="length"||e==="size"||e==="bg-size",qf=e=>e==="length",Sk=e=>e==="number",Ck=e=>e==="family-name",Kf=e=>e==="shadow",jk=()=>{const e=et("color"),t=et("font"),n=et("text"),r=et("font-weight"),o=et("tracking"),s=et("leading"),i=et("breakpoint"),l=et("container"),c=et("spacing"),u=et("radius"),d=et("shadow"),f=et("inset-shadow"),h=et("text-shadow"),p=et("drop-shadow"),y=et("blur"),m=et("perspective"),g=et("aspect"),b=et("ease"),v=et("animate"),k=()=>["auto","avoid","all","avoid-page","page","left","right","column"],S=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],C=()=>[...S(),ye,be],j=()=>["auto","hidden","clip","visible","scroll"],E=()=>["auto","contain","none"],T=()=>[ye,be,c],z=()=>[Ln,"full","auto",...T()],O=()=>[an,"none","subgrid",ye,be],B=()=>["auto",{span:["full",an,ye,be]},an,ye,be],N=()=>[an,"auto",ye,be],D=()=>["auto","min","max","fr",ye,be],w=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],L=()=>["start","end","center","stretch","center-safe","end-safe"],W=()=>["auto",...T()],U=()=>[Ln,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...T()],F=()=>[e,ye,be],K=()=>[...S(),kc,wc,{position:[ye,be]}],I=()=>["no-repeat",{repeat:["","x","y","space","round"]}],V=()=>["auto","cover","contain",kk,yk,{size:[ye,be]}],G=()=>[Zs,br,_n],R=()=>["","none","full",u,ye,be],ae=()=>["",Ie,br,_n],oe=()=>["solid","dashed","dotted","double"],fe=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],le=()=>[Ie,Zs,kc,wc],de=()=>["","none",y,ye,be],pe=()=>["none",Ie,ye,be],he=()=>["none",Ie,ye,be],me=()=>[Ie,ye,be],_e=()=>[Ln,"full",...T()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[Yt],breakpoint:[Yt],color:[hk],container:[Yt],"drop-shadow":[Yt],ease:["in","out","in-out"],font:[bk],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[Yt],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[Yt],shadow:[Yt],spacing:["px",Ie],text:[Yt],"text-shadow":[Yt],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",Ln,be,ye,g]}],container:["container"],columns:[{columns:[Ie,be,ye,l]}],"break-after":[{"break-after":k()}],"break-before":[{"break-before":k()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:C()}],overflow:[{overflow:j()}],"overflow-x":[{"overflow-x":j()}],"overflow-y":[{"overflow-y":j()}],overscroll:[{overscroll:E()}],"overscroll-x":[{"overscroll-x":E()}],"overscroll-y":[{"overscroll-y":E()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:z()}],"inset-x":[{"inset-x":z()}],"inset-y":[{"inset-y":z()}],start:[{start:z()}],end:[{end:z()}],top:[{top:z()}],right:[{right:z()}],bottom:[{bottom:z()}],left:[{left:z()}],visibility:["visible","invisible","collapse"],z:[{z:[an,"auto",ye,be]}],basis:[{basis:[Ln,"full","auto",l,...T()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[Ie,Ln,"auto","initial","none",be]}],grow:[{grow:["",Ie,ye,be]}],shrink:[{shrink:["",Ie,ye,be]}],order:[{order:[an,"first","last","none",ye,be]}],"grid-cols":[{"grid-cols":O()}],"col-start-end":[{col:B()}],"col-start":[{"col-start":N()}],"col-end":[{"col-end":N()}],"grid-rows":[{"grid-rows":O()}],"row-start-end":[{row:B()}],"row-start":[{"row-start":N()}],"row-end":[{"row-end":N()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":D()}],"auto-rows":[{"auto-rows":D()}],gap:[{gap:T()}],"gap-x":[{"gap-x":T()}],"gap-y":[{"gap-y":T()}],"justify-content":[{justify:[...w(),"normal"]}],"justify-items":[{"justify-items":[...L(),"normal"]}],"justify-self":[{"justify-self":["auto",...L()]}],"align-content":[{content:["normal",...w()]}],"align-items":[{items:[...L(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...L(),{baseline:["","last"]}]}],"place-content":[{"place-content":w()}],"place-items":[{"place-items":[...L(),"baseline"]}],"place-self":[{"place-self":["auto",...L()]}],p:[{p:T()}],px:[{px:T()}],py:[{py:T()}],ps:[{ps:T()}],pe:[{pe:T()}],pt:[{pt:T()}],pr:[{pr:T()}],pb:[{pb:T()}],pl:[{pl:T()}],m:[{m:W()}],mx:[{mx:W()}],my:[{my:W()}],ms:[{ms:W()}],me:[{me:W()}],mt:[{mt:W()}],mr:[{mr:W()}],mb:[{mb:W()}],ml:[{ml:W()}],"space-x":[{"space-x":T()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":T()}],"space-y-reverse":["space-y-reverse"],size:[{size:U()}],w:[{w:[l,"screen",...U()]}],"min-w":[{"min-w":[l,"screen","none",...U()]}],"max-w":[{"max-w":[l,"screen","none","prose",{screen:[i]},...U()]}],h:[{h:["screen","lh",...U()]}],"min-h":[{"min-h":["screen","lh","none",...U()]}],"max-h":[{"max-h":["screen","lh",...U()]}],"font-size":[{text:["base",n,br,_n]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[r,ye,qs]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",Zs,be]}],"font-family":[{font:[wk,be,t]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:[o,ye,be]}],"line-clamp":[{"line-clamp":[Ie,"none",ye,qs]}],leading:[{leading:[s,...T()]}],"list-image":[{"list-image":["none",ye,be]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",ye,be]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:F()}],"text-color":[{text:F()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...oe(),"wavy"]}],"text-decoration-thickness":[{decoration:[Ie,"from-font","auto",ye,_n]}],"text-decoration-color":[{decoration:F()}],"underline-offset":[{"underline-offset":[Ie,"auto",ye,be]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:T()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",ye,be]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",ye,be]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:K()}],"bg-repeat":[{bg:I()}],"bg-size":[{bg:V()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},an,ye,be],radial:["",ye,be],conic:[an,ye,be]},_k,vk]}],"bg-color":[{bg:F()}],"gradient-from-pos":[{from:G()}],"gradient-via-pos":[{via:G()}],"gradient-to-pos":[{to:G()}],"gradient-from":[{from:F()}],"gradient-via":[{via:F()}],"gradient-to":[{to:F()}],rounded:[{rounded:R()}],"rounded-s":[{"rounded-s":R()}],"rounded-e":[{"rounded-e":R()}],"rounded-t":[{"rounded-t":R()}],"rounded-r":[{"rounded-r":R()}],"rounded-b":[{"rounded-b":R()}],"rounded-l":[{"rounded-l":R()}],"rounded-ss":[{"rounded-ss":R()}],"rounded-se":[{"rounded-se":R()}],"rounded-ee":[{"rounded-ee":R()}],"rounded-es":[{"rounded-es":R()}],"rounded-tl":[{"rounded-tl":R()}],"rounded-tr":[{"rounded-tr":R()}],"rounded-br":[{"rounded-br":R()}],"rounded-bl":[{"rounded-bl":R()}],"border-w":[{border:ae()}],"border-w-x":[{"border-x":ae()}],"border-w-y":[{"border-y":ae()}],"border-w-s":[{"border-s":ae()}],"border-w-e":[{"border-e":ae()}],"border-w-t":[{"border-t":ae()}],"border-w-r":[{"border-r":ae()}],"border-w-b":[{"border-b":ae()}],"border-w-l":[{"border-l":ae()}],"divide-x":[{"divide-x":ae()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":ae()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...oe(),"hidden","none"]}],"divide-style":[{divide:[...oe(),"hidden","none"]}],"border-color":[{border:F()}],"border-color-x":[{"border-x":F()}],"border-color-y":[{"border-y":F()}],"border-color-s":[{"border-s":F()}],"border-color-e":[{"border-e":F()}],"border-color-t":[{"border-t":F()}],"border-color-r":[{"border-r":F()}],"border-color-b":[{"border-b":F()}],"border-color-l":[{"border-l":F()}],"divide-color":[{divide:F()}],"outline-style":[{outline:[...oe(),"none","hidden"]}],"outline-offset":[{"outline-offset":[Ie,ye,be]}],"outline-w":[{outline:["",Ie,br,_n]}],"outline-color":[{outline:F()}],shadow:[{shadow:["","none",d,co,lo]}],"shadow-color":[{shadow:F()}],"inset-shadow":[{"inset-shadow":["none",f,co,lo]}],"inset-shadow-color":[{"inset-shadow":F()}],"ring-w":[{ring:ae()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:F()}],"ring-offset-w":[{"ring-offset":[Ie,_n]}],"ring-offset-color":[{"ring-offset":F()}],"inset-ring-w":[{"inset-ring":ae()}],"inset-ring-color":[{"inset-ring":F()}],"text-shadow":[{"text-shadow":["none",h,co,lo]}],"text-shadow-color":[{"text-shadow":F()}],opacity:[{opacity:[Ie,ye,be]}],"mix-blend":[{"mix-blend":[...fe(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":fe()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[Ie]}],"mask-image-linear-from-pos":[{"mask-linear-from":le()}],"mask-image-linear-to-pos":[{"mask-linear-to":le()}],"mask-image-linear-from-color":[{"mask-linear-from":F()}],"mask-image-linear-to-color":[{"mask-linear-to":F()}],"mask-image-t-from-pos":[{"mask-t-from":le()}],"mask-image-t-to-pos":[{"mask-t-to":le()}],"mask-image-t-from-color":[{"mask-t-from":F()}],"mask-image-t-to-color":[{"mask-t-to":F()}],"mask-image-r-from-pos":[{"mask-r-from":le()}],"mask-image-r-to-pos":[{"mask-r-to":le()}],"mask-image-r-from-color":[{"mask-r-from":F()}],"mask-image-r-to-color":[{"mask-r-to":F()}],"mask-image-b-from-pos":[{"mask-b-from":le()}],"mask-image-b-to-pos":[{"mask-b-to":le()}],"mask-image-b-from-color":[{"mask-b-from":F()}],"mask-image-b-to-color":[{"mask-b-to":F()}],"mask-image-l-from-pos":[{"mask-l-from":le()}],"mask-image-l-to-pos":[{"mask-l-to":le()}],"mask-image-l-from-color":[{"mask-l-from":F()}],"mask-image-l-to-color":[{"mask-l-to":F()}],"mask-image-x-from-pos":[{"mask-x-from":le()}],"mask-image-x-to-pos":[{"mask-x-to":le()}],"mask-image-x-from-color":[{"mask-x-from":F()}],"mask-image-x-to-color":[{"mask-x-to":F()}],"mask-image-y-from-pos":[{"mask-y-from":le()}],"mask-image-y-to-pos":[{"mask-y-to":le()}],"mask-image-y-from-color":[{"mask-y-from":F()}],"mask-image-y-to-color":[{"mask-y-to":F()}],"mask-image-radial":[{"mask-radial":[ye,be]}],"mask-image-radial-from-pos":[{"mask-radial-from":le()}],"mask-image-radial-to-pos":[{"mask-radial-to":le()}],"mask-image-radial-from-color":[{"mask-radial-from":F()}],"mask-image-radial-to-color":[{"mask-radial-to":F()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":S()}],"mask-image-conic-pos":[{"mask-conic":[Ie]}],"mask-image-conic-from-pos":[{"mask-conic-from":le()}],"mask-image-conic-to-pos":[{"mask-conic-to":le()}],"mask-image-conic-from-color":[{"mask-conic-from":F()}],"mask-image-conic-to-color":[{"mask-conic-to":F()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:K()}],"mask-repeat":[{mask:I()}],"mask-size":[{mask:V()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",ye,be]}],filter:[{filter:["","none",ye,be]}],blur:[{blur:de()}],brightness:[{brightness:[Ie,ye,be]}],contrast:[{contrast:[Ie,ye,be]}],"drop-shadow":[{"drop-shadow":["","none",p,co,lo]}],"drop-shadow-color":[{"drop-shadow":F()}],grayscale:[{grayscale:["",Ie,ye,be]}],"hue-rotate":[{"hue-rotate":[Ie,ye,be]}],invert:[{invert:["",Ie,ye,be]}],saturate:[{saturate:[Ie,ye,be]}],sepia:[{sepia:["",Ie,ye,be]}],"backdrop-filter":[{"backdrop-filter":["","none",ye,be]}],"backdrop-blur":[{"backdrop-blur":de()}],"backdrop-brightness":[{"backdrop-brightness":[Ie,ye,be]}],"backdrop-contrast":[{"backdrop-contrast":[Ie,ye,be]}],"backdrop-grayscale":[{"backdrop-grayscale":["",Ie,ye,be]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[Ie,ye,be]}],"backdrop-invert":[{"backdrop-invert":["",Ie,ye,be]}],"backdrop-opacity":[{"backdrop-opacity":[Ie,ye,be]}],"backdrop-saturate":[{"backdrop-saturate":[Ie,ye,be]}],"backdrop-sepia":[{"backdrop-sepia":["",Ie,ye,be]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":T()}],"border-spacing-x":[{"border-spacing-x":T()}],"border-spacing-y":[{"border-spacing-y":T()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",ye,be]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[Ie,"initial",ye,be]}],ease:[{ease:["linear","initial",b,ye,be]}],delay:[{delay:[Ie,ye,be]}],animate:[{animate:["none",v,ye,be]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[m,ye,be]}],"perspective-origin":[{"perspective-origin":C()}],rotate:[{rotate:pe()}],"rotate-x":[{"rotate-x":pe()}],"rotate-y":[{"rotate-y":pe()}],"rotate-z":[{"rotate-z":pe()}],scale:[{scale:he()}],"scale-x":[{"scale-x":he()}],"scale-y":[{"scale-y":he()}],"scale-z":[{"scale-z":he()}],"scale-3d":["scale-3d"],skew:[{skew:me()}],"skew-x":[{"skew-x":me()}],"skew-y":[{"skew-y":me()}],transform:[{transform:[ye,be,"","none","gpu","cpu"]}],"transform-origin":[{origin:C()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:_e()}],"translate-x":[{"translate-x":_e()}],"translate-y":[{"translate-y":_e()}],"translate-z":[{"translate-z":_e()}],"translate-none":["translate-none"],accent:[{accent:F()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:F()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",ye,be]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":T()}],"scroll-mx":[{"scroll-mx":T()}],"scroll-my":[{"scroll-my":T()}],"scroll-ms":[{"scroll-ms":T()}],"scroll-me":[{"scroll-me":T()}],"scroll-mt":[{"scroll-mt":T()}],"scroll-mr":[{"scroll-mr":T()}],"scroll-mb":[{"scroll-mb":T()}],"scroll-ml":[{"scroll-ml":T()}],"scroll-p":[{"scroll-p":T()}],"scroll-px":[{"scroll-px":T()}],"scroll-py":[{"scroll-py":T()}],"scroll-ps":[{"scroll-ps":T()}],"scroll-pe":[{"scroll-pe":T()}],"scroll-pt":[{"scroll-pt":T()}],"scroll-pr":[{"scroll-pr":T()}],"scroll-pb":[{"scroll-pb":T()}],"scroll-pl":[{"scroll-pl":T()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",ye,be]}],fill:[{fill:["none",...F()]}],"stroke-w":[{stroke:[Ie,br,_n,qs]}],stroke:[{stroke:["none",...F()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}},Nk=ik(jk);function ve(...e){return Nk(Mf(e))}function Ve(e){return e>=1e6?(e/1e6).toFixed(1).replace(/\.0$/,"")+"M":(e/1e3).toFixed(1).replace(/\.0$/,"")+"K"}function Gf(e){return e>=1024*1024?(e/(1024*1024)).toFixed(1).replace(/\.0$/,"")+"M":(e/1024).toFixed(1).replace(/\.0$/,"")+"K"}function _c(e,t,n){const r=e*10;return!Number.isSafeInteger(r)||r%t!==0?null:(r/t/10).toFixed(1).replace(/\.0$/,"")+n}function Ek(e){if(!Number.isSafeInteger(e)||e<=0)return e.toString();if(e>=1024*1024){const n=_c(e,1048576,"M");if(n!==null)return n}const t=_c(e,1024,"K");return t!==null?t:e.toString()}function Tk(e){if(e===void 0||e==="")return 1;switch(e.toLowerCase()){case"k":return 1024;case"m":return 1024*1024;default:return null}}function Fo(e){const t=e.trim().replaceAll(",","");if(t==="")return null;const n=/^(\d+(?:\.\d+)?)\s*([kKmM])?$/.exec(t);if(n===null)return null;const r=n[1];if(r===void 0)return null;const o=Number(r),s=n[2],i=Tk(s);if(!Number.isFinite(o)||o<=0||i===null||(s===void 0||s==="")&&!Number.isInteger(o))return null;const l=Math.round(o*i);return!Number.isSafeInteger(l)||l<=0?null:l}function Ak(e){return e===null?"pending":e>=200&&e<300?"success":e>=400&&e<500?"client_error":e>=500?"server_error":"pending"}const Ik=te({model:A().min(1),contextWindow:ie().int().positive().optional(),outputLimit:ie().int().positive().optional(),source:Re(["manual","registry"]).optional(),sourceUrl:A().optional(),updatedAt:A().optional()}),$o=te({id:A(),name:A(),apiKey:A(),model:A().optional(),models:we(A()).min(1),format:Re(["anthropic","openai"]).optional(),baseUrl:A().optional(),anthropicBaseUrl:A().optional(),openaiBaseUrl:A().optional(),authHeader:Re(["bearer","x-api-key"]).optional().default("bearer"),apiDocsUrl:A().optional(),modelMetadataUrl:A().optional(),modelMetadata:we(Ik).optional(),source:Re(["company","personal"]).optional(),createdAt:A(),updatedAt:A()});async function zk(e){return Pn(e,$o.array(),void 0,t=>`Failed to fetch ${e}: ${t.status}`)}function Jf(){const e=Vr("/api/providers?includeSecrets=1",zk,{revalidateOnFocus:!1,revalidateIfStale:!1});return{providers:e.data??[],isLoading:e.isLoading,isError:e.error,mutate:e.mutate}}const Rk="2.0.36",Pk={version:Rk},Sc=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,Cc=Mf,$a=(e,t)=>n=>{var r;if(t?.variants==null)return Cc(e,n?.class,n?.className);const{variants:o,defaultVariants:s}=t,i=Object.keys(o).map(u=>{const d=n?.[u],f=s?.[u];if(d===null)return null;const h=Sc(d)||Sc(f);return o[u][h]}),l=n&&Object.entries(n).reduce((u,d)=>{let[f,h]=d;return h===void 0||(u[f]=h),u},{}),c=t==null||(r=t.compoundVariants)===null||r===void 0?void 0:r.reduce((u,d)=>{let{class:f,className:h,...p}=d;return Object.entries(p).every(y=>{let[m,g]=y;return Array.isArray(g)?g.includes({...s,...l}[m]):{...s,...l}[m]===g})?[...u,f,h]:u},[]);return Cc(e,i,c,n?.class,n?.className)};function jc(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function Yf(...e){return t=>{let n=!1;const r=e.map(o=>{const s=jc(o,t);return!n&&typeof s=="function"&&(n=!0),s});if(n)return()=>{for(let o=0;o<r.length;o++){const s=r[o];typeof s=="function"?s():jc(e[o],null)}}}}function De(...e){return x.useCallback(Yf(...e),e)}function or(e){const t=Mk(e),n=x.forwardRef((r,o)=>{const{children:s,...i}=r,l=x.Children.toArray(s),c=l.find(Dk);if(c){const u=c.props.children,d=l.map(f=>f===c?x.Children.count(u)>1?x.Children.only(null):x.isValidElement(u)?u.props.children:null:f);return a.jsx(t,{...i,ref:o,children:x.isValidElement(u)?x.cloneElement(u,void 0,d):null})}return a.jsx(t,{...i,ref:o,children:s})});return n.displayName=`${e}.Slot`,n}var Ok=or("Slot");function Mk(e){const t=x.forwardRef((n,r)=>{const{children:o,...s}=n;if(x.isValidElement(o)){const i=$k(o),l=Fk(s,o.props);return o.type!==x.Fragment&&(l.ref=r?Yf(r,i):i),x.cloneElement(o,l)}return x.Children.count(o)>1?x.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var Xf=Symbol("radix.slottable");function Lk(e){const t=({children:n})=>a.jsx(a.Fragment,{children:n});return t.displayName=`${e}.Slottable`,t.__radixId=Xf,t}function Dk(e){return x.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===Xf}function Fk(e,t){const n={...t};for(const r in t){const o=e[r],s=t[r];/^on[A-Z]/.test(r)?o&&s?n[r]=(...l)=>{const c=s(...l);return o(...l),c}:o&&(n[r]=o):r==="style"?n[r]={...o,...s}:r==="className"&&(n[r]=[o,s].filter(Boolean).join(" "))}return{...e,...n}}function $k(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var Bk=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Te=Bk.reduce((e,t)=>{const n=or(`Primitive.${t}`),r=x.forwardRef((o,s)=>{const{asChild:i,...l}=o,c=i?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),a.jsx(c,{...l,ref:s})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{});function Uk(e,t){e&&Zr.flushSync(()=>e.dispatchEvent(t))}var Qf=Object.freeze({position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal"}),Wk="VisuallyHidden",ep=x.forwardRef((e,t)=>a.jsx(Te.span,{...e,ref:t,style:{...Qf,...e.style}}));ep.displayName=Wk;var Hk=ep;function Vk(e,t){const n=x.createContext(t),r=s=>{const{children:i,...l}=s,c=x.useMemo(()=>l,Object.values(l));return a.jsx(n.Provider,{value:c,children:i})};r.displayName=e+"Provider";function o(s){const i=x.useContext(n);if(i)return i;if(t!==void 0)return t;throw new Error(`\`${s}\` must be used within \`${e}\``)}return[r,o]}function sn(e,t=[]){let n=[];function r(s,i){const l=x.createContext(i),c=n.length;n=[...n,i];const u=f=>{const{scope:h,children:p,...y}=f,m=h?.[e]?.[c]||l,g=x.useMemo(()=>y,Object.values(y));return a.jsx(m.Provider,{value:g,children:p})};u.displayName=s+"Provider";function d(f,h){const p=h?.[e]?.[c]||l,y=x.useContext(p);if(y)return y;if(i!==void 0)return i;throw new Error(`\`${f}\` must be used within \`${s}\``)}return[u,d]}const o=()=>{const s=n.map(i=>x.createContext(i));return function(l){const c=l?.[e]||s;return x.useMemo(()=>({[`__scope${e}`]:{...l,[e]:c}}),[l,c])}};return o.scopeName=e,[r,Zk(o,...t)]}function Zk(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const r=e.map(o=>({useScope:o(),scopeName:o.scopeName}));return function(s){const i=r.reduce((l,{useScope:c,scopeName:u})=>{const f=c(s)[`__scope${u}`];return{...l,...f}},{});return x.useMemo(()=>({[`__scope${t.scopeName}`]:i}),[i])}};return n.scopeName=t.scopeName,n}function tp(e){const t=e+"CollectionProvider",[n,r]=sn(t),[o,s]=n(t,{collectionRef:{current:null},itemMap:new Map}),i=m=>{const{scope:g,children:b}=m,v=ut.useRef(null),k=ut.useRef(new Map).current;return a.jsx(o,{scope:g,itemMap:k,collectionRef:v,children:b})};i.displayName=t;const l=e+"CollectionSlot",c=or(l),u=ut.forwardRef((m,g)=>{const{scope:b,children:v}=m,k=s(l,b),S=De(g,k.collectionRef);return a.jsx(c,{ref:S,children:v})});u.displayName=l;const d=e+"CollectionItemSlot",f="data-radix-collection-item",h=or(d),p=ut.forwardRef((m,g)=>{const{scope:b,children:v,...k}=m,S=ut.useRef(null),C=De(g,S),j=s(d,b);return ut.useEffect(()=>(j.itemMap.set(S,{ref:S,...k}),()=>{j.itemMap.delete(S)})),a.jsx(h,{[f]:"",ref:C,children:v})});p.displayName=d;function y(m){const g=s(e+"CollectionConsumer",m);return ut.useCallback(()=>{const v=g.collectionRef.current;if(!v)return[];const k=Array.from(v.querySelectorAll(`[${f}]`));return Array.from(g.itemMap.values()).sort((j,E)=>k.indexOf(j.ref.current)-k.indexOf(E.ref.current))},[g.collectionRef,g.itemMap])}return[{Provider:i,Slot:u,ItemSlot:p},y,r]}function Se(e,t,{checkForDefaultPrevented:n=!0}={}){return function(o){if(e?.(o),n===!1||!o.defaultPrevented)return t?.(o)}}var ot=globalThis?.document?x.useLayoutEffect:()=>{},qk=Rd[" useInsertionEffect ".trim().toString()]||ot;function jn({prop:e,defaultProp:t,onChange:n=()=>{},caller:r}){const[o,s,i]=Kk({defaultProp:t,onChange:n}),l=e!==void 0,c=l?e:o;{const d=x.useRef(e!==void 0);x.useEffect(()=>{const f=d.current;f!==l&&console.warn(`${r} is changing from ${f?"controlled":"uncontrolled"} to ${l?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),d.current=l},[l,r])}const u=x.useCallback(d=>{if(l){const f=Gk(d)?d(e):d;f!==e&&i.current?.(f)}else s(d)},[l,e,s,i]);return[c,u]}function Kk({defaultProp:e,onChange:t}){const[n,r]=x.useState(e),o=x.useRef(n),s=x.useRef(t);return qk(()=>{s.current=t},[t]),x.useEffect(()=>{o.current!==n&&(s.current?.(n),o.current=n)},[n,o]),[n,r,s]}function Gk(e){return typeof e=="function"}function Jk(e,t){return x.useReducer((n,r)=>t[n][r]??n,e)}var St=e=>{const{present:t,children:n}=e,r=Yk(t),o=typeof n=="function"?n({present:r.isPresent}):x.Children.only(n),s=De(r.ref,Xk(o));return typeof n=="function"||r.isPresent?x.cloneElement(o,{ref:s}):null};St.displayName="Presence";function Yk(e){const[t,n]=x.useState(),r=x.useRef(null),o=x.useRef(e),s=x.useRef("none"),i=e?"mounted":"unmounted",[l,c]=Jk(i,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return x.useEffect(()=>{const u=uo(r.current);s.current=l==="mounted"?u:"none"},[l]),ot(()=>{const u=r.current,d=o.current;if(d!==e){const h=s.current,p=uo(u);e?c("MOUNT"):p==="none"||u?.display==="none"?c("UNMOUNT"):c(d&&h!==p?"ANIMATION_OUT":"UNMOUNT"),o.current=e}},[e,c]),ot(()=>{if(t){let u;const d=t.ownerDocument.defaultView??window,f=p=>{const m=uo(r.current).includes(CSS.escape(p.animationName));if(p.target===t&&m&&(c("ANIMATION_END"),!o.current)){const g=t.style.animationFillMode;t.style.animationFillMode="forwards",u=d.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=g)})}},h=p=>{p.target===t&&(s.current=uo(r.current))};return t.addEventListener("animationstart",h),t.addEventListener("animationcancel",f),t.addEventListener("animationend",f),()=>{d.clearTimeout(u),t.removeEventListener("animationstart",h),t.removeEventListener("animationcancel",f),t.removeEventListener("animationend",f)}}else c("ANIMATION_END")},[t,c]),{isPresent:["mounted","unmountSuspended"].includes(l),ref:x.useCallback(u=>{r.current=u?getComputedStyle(u):null,n(u)},[])}}function uo(e){return e?.animationName||"none"}function Xk(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var Qk=Rd[" useId ".trim().toString()]||(()=>{}),e_=0;function Bt(e){const[t,n]=x.useState(Qk());return ot(()=>{n(r=>r??String(e_++))},[e]),e||(t?`radix-${t}`:"")}var ps="Collapsible",[t_]=sn(ps),[n_,Ba]=t_(ps),np=x.forwardRef((e,t)=>{const{__scopeCollapsible:n,open:r,defaultOpen:o,disabled:s,onOpenChange:i,...l}=e,[c,u]=jn({prop:r,defaultProp:o??!1,onChange:i,caller:ps});return a.jsx(n_,{scope:n,disabled:s,contentId:Bt(),open:c,onOpenToggle:x.useCallback(()=>u(d=>!d),[u]),children:a.jsx(Te.div,{"data-state":Wa(c),"data-disabled":s?"":void 0,...l,ref:t})})});np.displayName=ps;var rp="CollapsibleTrigger",op=x.forwardRef((e,t)=>{const{__scopeCollapsible:n,...r}=e,o=Ba(rp,n);return a.jsx(Te.button,{type:"button","aria-controls":o.contentId,"aria-expanded":o.open||!1,"data-state":Wa(o.open),"data-disabled":o.disabled?"":void 0,disabled:o.disabled,...r,ref:t,onClick:Se(e.onClick,o.onOpenToggle)})});op.displayName=rp;var Ua="CollapsibleContent",sp=x.forwardRef((e,t)=>{const{forceMount:n,...r}=e,o=Ba(Ua,e.__scopeCollapsible);return a.jsx(St,{present:n||o.open,children:({present:s})=>a.jsx(r_,{...r,ref:t,present:s})})});sp.displayName=Ua;var r_=x.forwardRef((e,t)=>{const{__scopeCollapsible:n,present:r,children:o,...s}=e,i=Ba(Ua,n),[l,c]=x.useState(r),u=x.useRef(null),d=De(t,u),f=x.useRef(0),h=f.current,p=x.useRef(0),y=p.current,m=i.open||l,g=x.useRef(m),b=x.useRef(void 0);return x.useEffect(()=>{const v=requestAnimationFrame(()=>g.current=!1);return()=>cancelAnimationFrame(v)},[]),ot(()=>{const v=u.current;if(v){b.current=b.current||{transitionDuration:v.style.transitionDuration,animationName:v.style.animationName},v.style.transitionDuration="0s",v.style.animationName="none";const k=v.getBoundingClientRect();f.current=k.height,p.current=k.width,g.current||(v.style.transitionDuration=b.current.transitionDuration,v.style.animationName=b.current.animationName),c(r)}},[i.open,r]),a.jsx(Te.div,{"data-state":Wa(i.open),"data-disabled":i.disabled?"":void 0,id:i.contentId,hidden:!m,...s,ref:d,style:{"--radix-collapsible-content-height":h?`${h}px`:void 0,"--radix-collapsible-content-width":y?`${y}px`:void 0,...e.style},children:m&&o})});function Wa(e){return e?"open":"closed"}var o_=np,s_=x.createContext(void 0);function hs(e){const t=x.useContext(s_);return e||t||"ltr"}function lt(e){const t=x.useRef(e);return x.useEffect(()=>{t.current=e}),x.useMemo(()=>(...n)=>t.current?.(...n),[])}function i_(e,t=globalThis?.document){const n=lt(e);x.useEffect(()=>{const r=o=>{o.key==="Escape"&&n(o)};return t.addEventListener("keydown",r,{capture:!0}),()=>t.removeEventListener("keydown",r,{capture:!0})},[n,t])}var a_="DismissableLayer",$i="dismissableLayer.update",l_="dismissableLayer.pointerDownOutside",c_="dismissableLayer.focusOutside",Nc,ip=x.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),ms=x.forwardRef((e,t)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:r,onPointerDownOutside:o,onFocusOutside:s,onInteractOutside:i,onDismiss:l,...c}=e,u=x.useContext(ip),[d,f]=x.useState(null),h=d?.ownerDocument??globalThis?.document,[,p]=x.useState({}),y=De(t,E=>f(E)),m=Array.from(u.layers),[g]=[...u.layersWithOutsidePointerEventsDisabled].slice(-1),b=m.indexOf(g),v=d?m.indexOf(d):-1,k=u.layersWithOutsidePointerEventsDisabled.size>0,S=v>=b,C=f_(E=>{const T=E.target,z=[...u.branches].some(O=>O.contains(T));!S||z||(o?.(E),i?.(E),E.defaultPrevented||l?.())},h),j=p_(E=>{const T=E.target;[...u.branches].some(O=>O.contains(T))||(s?.(E),i?.(E),E.defaultPrevented||l?.())},h);return i_(E=>{v===u.layers.size-1&&(r?.(E),!E.defaultPrevented&&l&&(E.preventDefault(),l()))},h),x.useEffect(()=>{if(d)return n&&(u.layersWithOutsidePointerEventsDisabled.size===0&&(Nc=h.body.style.pointerEvents,h.body.style.pointerEvents="none"),u.layersWithOutsidePointerEventsDisabled.add(d)),u.layers.add(d),Ec(),()=>{n&&u.layersWithOutsidePointerEventsDisabled.size===1&&(h.body.style.pointerEvents=Nc)}},[d,h,n,u]),x.useEffect(()=>()=>{d&&(u.layers.delete(d),u.layersWithOutsidePointerEventsDisabled.delete(d),Ec())},[d,u]),x.useEffect(()=>{const E=()=>p({});return document.addEventListener($i,E),()=>document.removeEventListener($i,E)},[]),a.jsx(Te.div,{...c,ref:y,style:{pointerEvents:k?S?"auto":"none":void 0,...e.style},onFocusCapture:Se(e.onFocusCapture,j.onFocusCapture),onBlurCapture:Se(e.onBlurCapture,j.onBlurCapture),onPointerDownCapture:Se(e.onPointerDownCapture,C.onPointerDownCapture)})});ms.displayName=a_;var u_="DismissableLayerBranch",d_=x.forwardRef((e,t)=>{const n=x.useContext(ip),r=x.useRef(null),o=De(t,r);return x.useEffect(()=>{const s=r.current;if(s)return n.branches.add(s),()=>{n.branches.delete(s)}},[n.branches]),a.jsx(Te.div,{...e,ref:o})});d_.displayName=u_;function f_(e,t=globalThis?.document){const n=lt(e),r=x.useRef(!1),o=x.useRef(()=>{});return x.useEffect(()=>{const s=l=>{if(l.target&&!r.current){let c=function(){ap(l_,n,u,{discrete:!0})};const u={originalEvent:l};l.pointerType==="touch"?(t.removeEventListener("click",o.current),o.current=c,t.addEventListener("click",o.current,{once:!0})):c()}else t.removeEventListener("click",o.current);r.current=!1},i=window.setTimeout(()=>{t.addEventListener("pointerdown",s)},0);return()=>{window.clearTimeout(i),t.removeEventListener("pointerdown",s),t.removeEventListener("click",o.current)}},[t,n]),{onPointerDownCapture:()=>r.current=!0}}function p_(e,t=globalThis?.document){const n=lt(e),r=x.useRef(!1);return x.useEffect(()=>{const o=s=>{s.target&&!r.current&&ap(c_,n,{originalEvent:s},{discrete:!1})};return t.addEventListener("focusin",o),()=>t.removeEventListener("focusin",o)},[t,n]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}function Ec(){const e=new CustomEvent($i);document.dispatchEvent(e)}function ap(e,t,n,{discrete:r}){const o=n.originalEvent.target,s=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&o.addEventListener(e,t,{once:!0}),r?Uk(o,s):o.dispatchEvent(s)}var Ks="focusScope.autoFocusOnMount",Gs="focusScope.autoFocusOnUnmount",Tc={bubbles:!1,cancelable:!0},h_="FocusScope",Ha=x.forwardRef((e,t)=>{const{loop:n=!1,trapped:r=!1,onMountAutoFocus:o,onUnmountAutoFocus:s,...i}=e,[l,c]=x.useState(null),u=lt(o),d=lt(s),f=x.useRef(null),h=De(t,m=>c(m)),p=x.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;x.useEffect(()=>{if(r){let m=function(k){if(p.paused||!l)return;const S=k.target;l.contains(S)?f.current=S:dn(f.current,{select:!0})},g=function(k){if(p.paused||!l)return;const S=k.relatedTarget;S!==null&&(l.contains(S)||dn(f.current,{select:!0}))},b=function(k){if(document.activeElement===document.body)for(const C of k)C.removedNodes.length>0&&dn(l)};document.addEventListener("focusin",m),document.addEventListener("focusout",g);const v=new MutationObserver(b);return l&&v.observe(l,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",m),document.removeEventListener("focusout",g),v.disconnect()}}},[r,l,p.paused]),x.useEffect(()=>{if(l){Ic.add(p);const m=document.activeElement;if(!l.contains(m)){const b=new CustomEvent(Ks,Tc);l.addEventListener(Ks,u),l.dispatchEvent(b),b.defaultPrevented||(m_(v_(lp(l)),{select:!0}),document.activeElement===m&&dn(l))}return()=>{l.removeEventListener(Ks,u),setTimeout(()=>{const b=new CustomEvent(Gs,Tc);l.addEventListener(Gs,d),l.dispatchEvent(b),b.defaultPrevented||dn(m??document.body,{select:!0}),l.removeEventListener(Gs,d),Ic.remove(p)},0)}}},[l,u,d,p]);const y=x.useCallback(m=>{if(!n&&!r||p.paused)return;const g=m.key==="Tab"&&!m.altKey&&!m.ctrlKey&&!m.metaKey,b=document.activeElement;if(g&&b){const v=m.currentTarget,[k,S]=g_(v);k&&S?!m.shiftKey&&b===S?(m.preventDefault(),n&&dn(k,{select:!0})):m.shiftKey&&b===k&&(m.preventDefault(),n&&dn(S,{select:!0})):b===v&&m.preventDefault()}},[n,r,p.paused]);return a.jsx(Te.div,{tabIndex:-1,...i,ref:h,onKeyDown:y})});Ha.displayName=h_;function m_(e,{select:t=!1}={}){const n=document.activeElement;for(const r of e)if(dn(r,{select:t}),document.activeElement!==n)return}function g_(e){const t=lp(e),n=Ac(t,e),r=Ac(t.reverse(),e);return[n,r]}function lp(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:r=>{const o=r.tagName==="INPUT"&&r.type==="hidden";return r.disabled||r.hidden||o?NodeFilter.FILTER_SKIP:r.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function Ac(e,t){for(const n of e)if(!x_(n,{upTo:t}))return n}function x_(e,{upTo:t}){if(getComputedStyle(e).visibility==="hidden")return!0;for(;e;){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display==="none")return!0;e=e.parentElement}return!1}function b_(e){return e instanceof HTMLInputElement&&"select"in e}function dn(e,{select:t=!1}={}){if(e&&e.focus){const n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&b_(e)&&t&&e.select()}}var Ic=y_();function y_(){let e=[];return{add(t){const n=e[0];t!==n&&n?.pause(),e=zc(e,t),e.unshift(t)},remove(t){e=zc(e,t),e[0]?.resume()}}}function zc(e,t){const n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}function v_(e){return e.filter(t=>t.tagName!=="A")}var w_="Portal",gs=x.forwardRef((e,t)=>{const{container:n,...r}=e,[o,s]=x.useState(!1);ot(()=>s(!0),[]);const i=n||o&&globalThis?.document?.body;return i?nx.createPortal(a.jsx(Te.div,{...r,ref:t}),i):null});gs.displayName=w_;var Js=0;function cp(){x.useEffect(()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??Rc()),document.body.insertAdjacentElement("beforeend",e[1]??Rc()),Js++,()=>{Js===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(t=>t.remove()),Js--}},[])}function Rc(){const e=document.createElement("span");return e.setAttribute("data-radix-focus-guard",""),e.tabIndex=0,e.style.outline="none",e.style.opacity="0",e.style.position="fixed",e.style.pointerEvents="none",e}var Dt=function(){return Dt=Object.assign||function(t){for(var n,r=1,o=arguments.length;r<o;r++){n=arguments[r];for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(t[s]=n[s])}return t},Dt.apply(this,arguments)};function up(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var o=0,r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]]);return n}function k_(e,t,n){if(n||arguments.length===2)for(var r=0,o=t.length,s;r<o;r++)(s||!(r in t))&&(s||(s=Array.prototype.slice.call(t,0,r)),s[r]=t[r]);return e.concat(s||Array.prototype.slice.call(t))}var jo="right-scroll-bar-position",No="width-before-scroll-bar",__="with-scroll-bars-hidden",S_="--removed-body-scroll-bar-size";function Ys(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}function C_(e,t){var n=x.useState(function(){return{value:e,callback:t,facade:{get current(){return n.value},set current(r){var o=n.value;o!==r&&(n.value=r,n.callback(r,o))}}}})[0];return n.callback=t,n.facade}var j_=typeof window<"u"?x.useLayoutEffect:x.useEffect,Pc=new WeakMap;function N_(e,t){var n=C_(null,function(r){return e.forEach(function(o){return Ys(o,r)})});return j_(function(){var r=Pc.get(n);if(r){var o=new Set(r),s=new Set(e),i=n.current;o.forEach(function(l){s.has(l)||Ys(l,null)}),s.forEach(function(l){o.has(l)||Ys(l,i)})}Pc.set(n,e)},[e]),n}function E_(e){return e}function T_(e,t){t===void 0&&(t=E_);var n=[],r=!1,o={read:function(){if(r)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return n.length?n[n.length-1]:e},useMedium:function(s){var i=t(s,r);return n.push(i),function(){n=n.filter(function(l){return l!==i})}},assignSyncMedium:function(s){for(r=!0;n.length;){var i=n;n=[],i.forEach(s)}n={push:function(l){return s(l)},filter:function(){return n}}},assignMedium:function(s){r=!0;var i=[];if(n.length){var l=n;n=[],l.forEach(s),i=n}var c=function(){var d=i;i=[],d.forEach(s)},u=function(){return Promise.resolve().then(c)};u(),n={push:function(d){i.push(d),u()},filter:function(d){return i=i.filter(d),n}}}};return o}function A_(e){e===void 0&&(e={});var t=T_(null);return t.options=Dt({async:!0,ssr:!1},e),t}var dp=function(e){var t=e.sideCar,n=up(e,["sideCar"]);if(!t)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var r=t.read();if(!r)throw new Error("Sidecar medium not found");return x.createElement(r,Dt({},n))};dp.isSideCarExport=!0;function I_(e,t){return e.useMedium(t),dp}var fp=A_(),Xs=function(){},xs=x.forwardRef(function(e,t){var n=x.useRef(null),r=x.useState({onScrollCapture:Xs,onWheelCapture:Xs,onTouchMoveCapture:Xs}),o=r[0],s=r[1],i=e.forwardProps,l=e.children,c=e.className,u=e.removeScrollBar,d=e.enabled,f=e.shards,h=e.sideCar,p=e.noRelative,y=e.noIsolation,m=e.inert,g=e.allowPinchZoom,b=e.as,v=b===void 0?"div":b,k=e.gapMode,S=up(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),C=h,j=N_([n,t]),E=Dt(Dt({},S),o);return x.createElement(x.Fragment,null,d&&x.createElement(C,{sideCar:fp,removeScrollBar:u,shards:f,noRelative:p,noIsolation:y,inert:m,setCallbacks:s,allowPinchZoom:!!g,lockRef:n,gapMode:k}),i?x.cloneElement(x.Children.only(l),Dt(Dt({},E),{ref:j})):x.createElement(v,Dt({},E,{className:c,ref:j}),l))});xs.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};xs.classNames={fullWidth:No,zeroRight:jo};var z_=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function R_(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=z_();return t&&e.setAttribute("nonce",t),e}function P_(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function O_(e){var t=document.head||document.getElementsByTagName("head")[0];t.appendChild(e)}var M_=function(){var e=0,t=null;return{add:function(n){e==0&&(t=R_())&&(P_(t,n),O_(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},L_=function(){var e=M_();return function(t,n){x.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},pp=function(){var e=L_(),t=function(n){var r=n.styles,o=n.dynamic;return e(r,o),null};return t},D_={left:0,top:0,right:0,gap:0},Qs=function(e){return parseInt(e||"",10)||0},F_=function(e){var t=window.getComputedStyle(document.body),n=t[e==="padding"?"paddingLeft":"marginLeft"],r=t[e==="padding"?"paddingTop":"marginTop"],o=t[e==="padding"?"paddingRight":"marginRight"];return[Qs(n),Qs(r),Qs(o)]},$_=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return D_;var t=F_(e),n=document.documentElement.clientWidth,r=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,r-n+t[2]-t[0])}},B_=pp(),Jn="data-scroll-locked",U_=function(e,t,n,r){var o=e.left,s=e.top,i=e.right,l=e.gap;return n===void 0&&(n="margin"),`
|
|
42
|
-
.`.concat(
|
|
40
|
+
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(const i of e.seen.entries()){const l=i[1];if(t===i[0]){s(i);continue}if(e.external){const u=e.external.registry.get(i[0])?.id;if(t!==i[0]&&u){s(i);continue}}if(e.metadataRegistry.get(i[0])?.id){s(i);continue}if(l.cycle){s(i);continue}if(l.count>1&&e.reused==="ref"){s(i);continue}}}function af(e,t){const n=e.seen.get(t);if(!n)throw new Error("Unprocessed schema. This is a bug in Zod.");const r=i=>{const l=e.seen.get(i);if(l.ref===null)return;const c=l.def??l.schema,u={...c},d=l.ref;if(l.ref=null,d){r(d);const h=e.seen.get(d),p=h.schema;if(p.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0")?(c.allOf=c.allOf??[],c.allOf.push(p)):Object.assign(c,p),Object.assign(c,u),i._zod.parent===d)for(const m in c)m==="$ref"||m==="allOf"||m in u||delete c[m];if(p.$ref&&h.def)for(const m in c)m==="$ref"||m==="allOf"||m in h.def&&JSON.stringify(c[m])===JSON.stringify(h.def[m])&&delete c[m]}const f=i._zod.parent;if(f&&f!==d){r(f);const h=e.seen.get(f);if(h?.schema.$ref&&(c.$ref=h.schema.$ref,h.def))for(const p in c)p==="$ref"||p==="allOf"||p in h.def&&JSON.stringify(c[p])===JSON.stringify(h.def[p])&&delete c[p]}e.override({zodSchema:i,jsonSchema:c,path:l.path??[]})};for(const i of[...e.seen.entries()].reverse())r(i[0]);const o={};if(e.target==="draft-2020-12"?o.$schema="https://json-schema.org/draft/2020-12/schema":e.target==="draft-07"?o.$schema="http://json-schema.org/draft-07/schema#":e.target==="draft-04"?o.$schema="http://json-schema.org/draft-04/schema#":e.target,e.external?.uri){const i=e.external.registry.get(t)?.id;if(!i)throw new Error("Schema is missing an `id` property");o.$id=e.external.uri(i)}Object.assign(o,n.def??n.schema);const s=e.external?.defs??{};for(const i of e.seen.entries()){const l=i[1];l.def&&l.defId&&(s[l.defId]=l.def)}e.external||Object.keys(s).length>0&&(e.target==="draft-2020-12"?o.$defs=s:o.definitions=s);try{const i=JSON.parse(JSON.stringify(o));return Object.defineProperty(i,"~standard",{value:{...t["~standard"],jsonSchema:{input:Ro(t,"input",e.processors),output:Ro(t,"output",e.processors)}},enumerable:!1,writable:!1}),i}catch{throw new Error("Error converting schema to JSON.")}}function at(e,t){const n=t??{seen:new Set};if(n.seen.has(e))return!1;n.seen.add(e);const r=e._zod.def;if(r.type==="transform")return!0;if(r.type==="array")return at(r.element,n);if(r.type==="set")return at(r.valueType,n);if(r.type==="lazy")return at(r.getter(),n);if(r.type==="promise"||r.type==="optional"||r.type==="nonoptional"||r.type==="nullable"||r.type==="readonly"||r.type==="default"||r.type==="prefault")return at(r.innerType,n);if(r.type==="intersection")return at(r.left,n)||at(r.right,n);if(r.type==="record"||r.type==="map")return at(r.keyType,n)||at(r.valueType,n);if(r.type==="pipe")return at(r.in,n)||at(r.out,n);if(r.type==="object"){for(const o in r.shape)if(at(r.shape[o],n))return!0;return!1}if(r.type==="union"){for(const o of r.options)if(at(o,n))return!0;return!1}if(r.type==="tuple"){for(const o of r.items)if(at(o,n))return!0;return!!(r.rest&&at(r.rest,n))}return!1}const ob=(e,t={})=>n=>{const r=of({...n,processors:t});return Xe(e,r),sf(r,e),af(r,e)},Ro=(e,t,n={})=>r=>{const{libraryOptions:o,target:s}=r??{},i=of({...o??{},target:s,io:t,processors:n});return Xe(e,i),sf(i,e),af(i,e)},sb={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},ib=(e,t,n,r)=>{const o=n;o.type="string";const{minimum:s,maximum:i,format:l,patterns:c,contentEncoding:u}=e._zod.bag;if(typeof s=="number"&&(o.minLength=s),typeof i=="number"&&(o.maxLength=i),l&&(o.format=sb[l]??l,o.format===""&&delete o.format,l==="time"&&delete o.format),u&&(o.contentEncoding=u),c&&c.size>0){const d=[...c];d.length===1?o.pattern=d[0].source:d.length>1&&(o.allOf=[...d.map(f=>({...t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0"?{type:"string"}:{},pattern:f.source}))])}},ab=(e,t,n,r)=>{const o=n,{minimum:s,maximum:i,format:l,multipleOf:c,exclusiveMaximum:u,exclusiveMinimum:d}=e._zod.bag;typeof l=="string"&&l.includes("int")?o.type="integer":o.type="number",typeof d=="number"&&(t.target==="draft-04"||t.target==="openapi-3.0"?(o.minimum=d,o.exclusiveMinimum=!0):o.exclusiveMinimum=d),typeof s=="number"&&(o.minimum=s,typeof d=="number"&&t.target!=="draft-04"&&(d>=s?delete o.minimum:delete o.exclusiveMinimum)),typeof u=="number"&&(t.target==="draft-04"||t.target==="openapi-3.0"?(o.maximum=u,o.exclusiveMaximum=!0):o.exclusiveMaximum=u),typeof i=="number"&&(o.maximum=i,typeof u=="number"&&t.target!=="draft-04"&&(u<=i?delete o.maximum:delete o.exclusiveMaximum)),typeof c=="number"&&(o.multipleOf=c)},lb=(e,t,n,r)=>{n.type="boolean"},cb=(e,t,n,r)=>{t.target==="openapi-3.0"?(n.type="string",n.nullable=!0,n.enum=[null]):n.type="null"},ub=(e,t,n,r)=>{n.not={}},db=(e,t,n,r)=>{},fb=(e,t,n,r)=>{const o=e._zod.def,s=Ld(o.entries);s.every(i=>typeof i=="number")&&(n.type="number"),s.every(i=>typeof i=="string")&&(n.type="string"),n.enum=s},pb=(e,t,n,r)=>{const o=e._zod.def,s=[];for(const i of o.values)if(i===void 0){if(t.unrepresentable==="throw")throw new Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof i=="bigint"){if(t.unrepresentable==="throw")throw new Error("BigInt literals cannot be represented in JSON Schema");s.push(Number(i))}else s.push(i);if(s.length!==0)if(s.length===1){const i=s[0];n.type=i===null?"null":typeof i,t.target==="draft-04"||t.target==="openapi-3.0"?n.enum=[i]:n.const=i}else s.every(i=>typeof i=="number")&&(n.type="number"),s.every(i=>typeof i=="string")&&(n.type="string"),s.every(i=>typeof i=="boolean")&&(n.type="boolean"),s.every(i=>i===null)&&(n.type="null"),n.enum=s},hb=(e,t,n,r)=>{if(t.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema")},mb=(e,t,n,r)=>{if(t.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema")},gb=(e,t,n,r)=>{const o=n,s=e._zod.def,{minimum:i,maximum:l}=e._zod.bag;typeof i=="number"&&(o.minItems=i),typeof l=="number"&&(o.maxItems=l),o.type="array",o.items=Xe(s.element,t,{...r,path:[...r.path,"items"]})},xb=(e,t,n,r)=>{const o=n,s=e._zod.def;o.type="object",o.properties={};const i=s.shape;for(const u in i)o.properties[u]=Xe(i[u],t,{...r,path:[...r.path,"properties",u]});const l=new Set(Object.keys(i)),c=new Set([...l].filter(u=>{const d=s.shape[u]._zod;return t.io==="input"?d.optin===void 0:d.optout===void 0}));c.size>0&&(o.required=Array.from(c)),s.catchall?._zod.def.type==="never"?o.additionalProperties=!1:s.catchall?s.catchall&&(o.additionalProperties=Xe(s.catchall,t,{...r,path:[...r.path,"additionalProperties"]})):t.io==="output"&&(o.additionalProperties=!1)},bb=(e,t,n,r)=>{const o=e._zod.def,s=o.inclusive===!1,i=o.options.map((l,c)=>Xe(l,t,{...r,path:[...r.path,s?"oneOf":"anyOf",c]}));s?n.oneOf=i:n.anyOf=i},yb=(e,t,n,r)=>{const o=e._zod.def,s=Xe(o.left,t,{...r,path:[...r.path,"allOf",0]}),i=Xe(o.right,t,{...r,path:[...r.path,"allOf",1]}),l=u=>"allOf"in u&&Object.keys(u).length===1,c=[...l(s)?s.allOf:[s],...l(i)?i.allOf:[i]];n.allOf=c},vb=(e,t,n,r)=>{const o=n,s=e._zod.def;o.type="object";const i=s.keyType,c=i._zod.bag?.patterns;if(s.mode==="loose"&&c&&c.size>0){const d=Xe(s.valueType,t,{...r,path:[...r.path,"patternProperties","*"]});o.patternProperties={};for(const f of c)o.patternProperties[f.source]=d}else(t.target==="draft-07"||t.target==="draft-2020-12")&&(o.propertyNames=Xe(s.keyType,t,{...r,path:[...r.path,"propertyNames"]})),o.additionalProperties=Xe(s.valueType,t,{...r,path:[...r.path,"additionalProperties"]});const u=i._zod.values;if(u){const d=[...u].filter(f=>typeof f=="string"||typeof f=="number");d.length>0&&(o.required=d)}},wb=(e,t,n,r)=>{const o=e._zod.def,s=Xe(o.innerType,t,r),i=t.seen.get(e);t.target==="openapi-3.0"?(i.ref=o.innerType,n.nullable=!0):n.anyOf=[s,{type:"null"}]},kb=(e,t,n,r)=>{const o=e._zod.def;Xe(o.innerType,t,r);const s=t.seen.get(e);s.ref=o.innerType},_b=(e,t,n,r)=>{const o=e._zod.def;Xe(o.innerType,t,r);const s=t.seen.get(e);s.ref=o.innerType,n.default=JSON.parse(JSON.stringify(o.defaultValue))},Sb=(e,t,n,r)=>{const o=e._zod.def;Xe(o.innerType,t,r);const s=t.seen.get(e);s.ref=o.innerType,t.io==="input"&&(n._prefault=JSON.parse(JSON.stringify(o.defaultValue)))},Cb=(e,t,n,r)=>{const o=e._zod.def;Xe(o.innerType,t,r);const s=t.seen.get(e);s.ref=o.innerType;let i;try{i=o.catchValue(void 0)}catch{throw new Error("Dynamic catch values are not supported in JSON Schema")}n.default=i},jb=(e,t,n,r)=>{const o=e._zod.def,s=t.io==="input"?o.in._zod.def.type==="transform"?o.out:o.in:o.out;Xe(s,t,r);const i=t.seen.get(e);i.ref=s},Nb=(e,t,n,r)=>{const o=e._zod.def;Xe(o.innerType,t,r);const s=t.seen.get(e);s.ref=o.innerType,n.readOnly=!0},lf=(e,t,n,r)=>{const o=e._zod.def;Xe(o.innerType,t,r);const s=t.seen.get(e);s.ref=o.innerType},Eb=(e,t,n,r)=>{const o=e._zod.innerType;Xe(o,t,r);const s=t.seen.get(e);s.ref=o},Tb=oe("ZodISODateTime",(e,t)=>{C0.init(e,t),Ye.init(e,t)});function Ab(e){return R1(Tb,e)}const Ib=oe("ZodISODate",(e,t)=>{j0.init(e,t),Ye.init(e,t)});function zb(e){return P1(Ib,e)}const Rb=oe("ZodISOTime",(e,t)=>{N0.init(e,t),Ye.init(e,t)});function Pb(e){return O1(Rb,e)}const Ob=oe("ZodISODuration",(e,t)=>{E0.init(e,t),Ye.init(e,t)});function Mb(e){return M1(Ob,e)}const Lb=(e,t)=>{Bd.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:n=>xx(e,n)},flatten:{value:n=>gx(e,n)},addIssue:{value:n=>{e.issues.push(n),e.message=JSON.stringify(e.issues,ji,2)}},addIssues:{value:n=>{e.issues.push(...n),e.message=JSON.stringify(e.issues,ji,2)}},isEmpty:{get(){return e.issues.length===0}}})},kt=oe("ZodError",Lb,{Parent:Error}),Db=ja(kt),Fb=Na(kt),$b=as(kt),Bb=ls(kt),Ub=vx(kt),Wb=wx(kt),Vb=kx(kt),Hb=_x(kt),Zb=Sx(kt),qb=Cx(kt),Kb=jx(kt),Gb=Nx(kt),Ke=oe("ZodType",(e,t)=>(qe.init(e,t),Object.assign(e["~standard"],{jsonSchema:{input:Ro(e,"input"),output:Ro(e,"output")}}),e.toJSONSchema=ob(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.check=(...n)=>e.clone(xn(t,{checks:[...t.checks??[],...n.map(r=>typeof r=="function"?{_zod:{check:r,def:{check:"custom"},onattach:[]}}:r)]}),{parent:!0}),e.with=e.check,e.clone=(n,r)=>bn(e,n,r),e.brand=()=>e,e.register=((n,r)=>(n.add(e,r),e)),e.parse=(n,r)=>Db(e,n,r,{callee:e.parse}),e.safeParse=(n,r)=>$b(e,n,r),e.parseAsync=async(n,r)=>Fb(e,n,r,{callee:e.parseAsync}),e.safeParseAsync=async(n,r)=>Bb(e,n,r),e.spa=e.safeParseAsync,e.encode=(n,r)=>Ub(e,n,r),e.decode=(n,r)=>Wb(e,n,r),e.encodeAsync=async(n,r)=>Vb(e,n,r),e.decodeAsync=async(n,r)=>Hb(e,n,r),e.safeEncode=(n,r)=>Zb(e,n,r),e.safeDecode=(n,r)=>qb(e,n,r),e.safeEncodeAsync=async(n,r)=>Kb(e,n,r),e.safeDecodeAsync=async(n,r)=>Gb(e,n,r),e.refine=(n,r)=>e.check(Hy(n,r)),e.superRefine=n=>e.check(Zy(n)),e.overwrite=n=>e.check(ur(n)),e.optional=()=>ic(e),e.exactOptional=()=>Ay(e),e.nullable=()=>ac(e),e.nullish=()=>ic(ac(e)),e.nonoptional=n=>My(e,n),e.array=()=>we(e),e.or=n=>rn([e,n]),e.and=n=>Sy(e,n),e.transform=n=>lc(e,Ey(n)),e.default=n=>Ry(e,n),e.prefault=n=>Oy(e,n),e.catch=n=>Dy(e,n),e.pipe=n=>lc(e,n),e.readonly=()=>By(e),e.describe=n=>{const r=e.clone();return Tr.add(r,{description:n}),r},Object.defineProperty(e,"description",{get(){return Tr.get(e)?.description},configurable:!0}),e.meta=(...n)=>{if(n.length===0)return Tr.get(e);const r=e.clone();return Tr.add(r,n[0]),r},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e.apply=n=>n(e),e)),cf=oe("_ZodString",(e,t)=>{Ea.init(e,t),Ke.init(e,t),e._zod.processJSONSchema=(r,o,s)=>ib(e,r,o);const n=e._zod.bag;e.format=n.format??null,e.minLength=n.minimum??null,e.maxLength=n.maximum??null,e.regex=(...r)=>e.check(W1(...r)),e.includes=(...r)=>e.check(Z1(...r)),e.startsWith=(...r)=>e.check(q1(...r)),e.endsWith=(...r)=>e.check(K1(...r)),e.min=(...r)=>e.check(zo(...r)),e.max=(...r)=>e.check(nf(...r)),e.length=(...r)=>e.check(rf(...r)),e.nonempty=(...r)=>e.check(zo(1,...r)),e.lowercase=r=>e.check(V1(r)),e.uppercase=r=>e.check(H1(r)),e.trim=()=>e.check(J1()),e.normalize=(...r)=>e.check(G1(...r)),e.toLowerCase=()=>e.check(Y1()),e.toUpperCase=()=>e.check(X1()),e.slugify=()=>e.check(Q1())}),Jb=oe("ZodString",(e,t)=>{Ea.init(e,t),cf.init(e,t),e.email=n=>e.check(f1(Yb,n)),e.url=n=>e.check(x1(Xb,n)),e.jwt=n=>e.check(z1(py,n)),e.emoji=n=>e.check(b1(Qb,n)),e.guid=n=>e.check(ec(oc,n)),e.uuid=n=>e.check(p1(so,n)),e.uuidv4=n=>e.check(h1(so,n)),e.uuidv6=n=>e.check(m1(so,n)),e.uuidv7=n=>e.check(g1(so,n)),e.nanoid=n=>e.check(y1(ey,n)),e.guid=n=>e.check(ec(oc,n)),e.cuid=n=>e.check(v1(ty,n)),e.cuid2=n=>e.check(w1(ny,n)),e.ulid=n=>e.check(k1(ry,n)),e.base64=n=>e.check(T1(uy,n)),e.base64url=n=>e.check(A1(dy,n)),e.xid=n=>e.check(_1(oy,n)),e.ksuid=n=>e.check(S1(sy,n)),e.ipv4=n=>e.check(C1(iy,n)),e.ipv6=n=>e.check(j1(ay,n)),e.cidrv4=n=>e.check(N1(ly,n)),e.cidrv6=n=>e.check(E1(cy,n)),e.e164=n=>e.check(I1(fy,n)),e.datetime=n=>e.check(Ab(n)),e.date=n=>e.check(zb(n)),e.time=n=>e.check(Pb(n)),e.duration=n=>e.check(Mb(n))});function A(e){return d1(Jb,e)}const Ye=oe("ZodStringFormat",(e,t)=>{Ge.init(e,t),cf.init(e,t)}),Yb=oe("ZodEmail",(e,t)=>{g0.init(e,t),Ye.init(e,t)}),oc=oe("ZodGUID",(e,t)=>{h0.init(e,t),Ye.init(e,t)}),so=oe("ZodUUID",(e,t)=>{m0.init(e,t),Ye.init(e,t)}),Xb=oe("ZodURL",(e,t)=>{x0.init(e,t),Ye.init(e,t)}),Qb=oe("ZodEmoji",(e,t)=>{b0.init(e,t),Ye.init(e,t)}),ey=oe("ZodNanoID",(e,t)=>{y0.init(e,t),Ye.init(e,t)}),ty=oe("ZodCUID",(e,t)=>{v0.init(e,t),Ye.init(e,t)}),ny=oe("ZodCUID2",(e,t)=>{w0.init(e,t),Ye.init(e,t)}),ry=oe("ZodULID",(e,t)=>{k0.init(e,t),Ye.init(e,t)}),oy=oe("ZodXID",(e,t)=>{_0.init(e,t),Ye.init(e,t)}),sy=oe("ZodKSUID",(e,t)=>{S0.init(e,t),Ye.init(e,t)}),iy=oe("ZodIPv4",(e,t)=>{T0.init(e,t),Ye.init(e,t)}),ay=oe("ZodIPv6",(e,t)=>{A0.init(e,t),Ye.init(e,t)}),ly=oe("ZodCIDRv4",(e,t)=>{I0.init(e,t),Ye.init(e,t)}),cy=oe("ZodCIDRv6",(e,t)=>{z0.init(e,t),Ye.init(e,t)}),uy=oe("ZodBase64",(e,t)=>{R0.init(e,t),Ye.init(e,t)}),dy=oe("ZodBase64URL",(e,t)=>{O0.init(e,t),Ye.init(e,t)}),fy=oe("ZodE164",(e,t)=>{M0.init(e,t),Ye.init(e,t)}),py=oe("ZodJWT",(e,t)=>{D0.init(e,t),Ye.init(e,t)}),uf=oe("ZodNumber",(e,t)=>{Yd.init(e,t),Ke.init(e,t),e._zod.processJSONSchema=(r,o,s)=>ab(e,r,o),e.gt=(r,o)=>e.check(nc(r,o)),e.gte=(r,o)=>e.check(Ws(r,o)),e.min=(r,o)=>e.check(Ws(r,o)),e.lt=(r,o)=>e.check(tc(r,o)),e.lte=(r,o)=>e.check(Us(r,o)),e.max=(r,o)=>e.check(Us(r,o)),e.int=r=>e.check(sc(r)),e.safe=r=>e.check(sc(r)),e.positive=r=>e.check(nc(0,r)),e.nonnegative=r=>e.check(Ws(0,r)),e.negative=r=>e.check(tc(0,r)),e.nonpositive=r=>e.check(Us(0,r)),e.multipleOf=(r,o)=>e.check(rc(r,o)),e.step=(r,o)=>e.check(rc(r,o)),e.finite=()=>e;const n=e._zod.bag;e.minValue=Math.max(n.minimum??Number.NEGATIVE_INFINITY,n.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,e.maxValue=Math.min(n.maximum??Number.POSITIVE_INFINITY,n.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,e.isInt=(n.format??"").includes("int")||Number.isSafeInteger(n.multipleOf??.5),e.isFinite=!0,e.format=n.format??null});function ie(e){return L1(uf,e)}const hy=oe("ZodNumberFormat",(e,t)=>{F0.init(e,t),uf.init(e,t)});function sc(e){return D1(hy,e)}const my=oe("ZodBoolean",(e,t)=>{$0.init(e,t),Ke.init(e,t),e._zod.processJSONSchema=(n,r,o)=>lb(e,n,r)});function Ze(e){return F1(my,e)}const gy=oe("ZodNull",(e,t)=>{B0.init(e,t),Ke.init(e,t),e._zod.processJSONSchema=(n,r,o)=>cb(e,n,r)});function Ei(e){return $1(gy,e)}const xy=oe("ZodUnknown",(e,t)=>{U0.init(e,t),Ke.init(e,t),e._zod.processJSONSchema=(n,r,o)=>db()});function Ti(){return B1(xy)}const by=oe("ZodNever",(e,t)=>{W0.init(e,t),Ke.init(e,t),e._zod.processJSONSchema=(n,r,o)=>ub(e,n,r)});function yy(e){return U1(by,e)}const vy=oe("ZodArray",(e,t)=>{V0.init(e,t),Ke.init(e,t),e._zod.processJSONSchema=(n,r,o)=>gb(e,n,r,o),e.element=t.element,e.min=(n,r)=>e.check(zo(n,r)),e.nonempty=n=>e.check(zo(1,n)),e.max=(n,r)=>e.check(nf(n,r)),e.length=(n,r)=>e.check(rf(n,r)),e.unwrap=()=>e.element});function we(e,t){return eb(vy,e,t)}const wy=oe("ZodObject",(e,t)=>{Z0.init(e,t),Ke.init(e,t),e._zod.processJSONSchema=(n,r,o)=>xb(e,n,r,o),ze(e,"shape",()=>t.shape),e.keyof=()=>Re(Object.keys(e._zod.def.shape)),e.catchall=n=>e.clone({...e._zod.def,catchall:n}),e.passthrough=()=>e.clone({...e._zod.def,catchall:Ti()}),e.loose=()=>e.clone({...e._zod.def,catchall:Ti()}),e.strict=()=>e.clone({...e._zod.def,catchall:yy()}),e.strip=()=>e.clone({...e._zod.def,catchall:void 0}),e.extend=n=>dx(e,n),e.safeExtend=n=>fx(e,n),e.merge=n=>px(e,n),e.pick=n=>cx(e,n),e.omit=n=>ux(e,n),e.partial=(...n)=>hx(ff,e,n[0]),e.required=(...n)=>mx(pf,e,n[0])});function te(e,t){const n={type:"object",shape:e??{},...ke(t)};return new wy(n)}const df=oe("ZodUnion",(e,t)=>{ef.init(e,t),Ke.init(e,t),e._zod.processJSONSchema=(n,r,o)=>bb(e,n,r,o),e.options=t.options});function rn(e,t){return new df({type:"union",options:e,...ke(t)})}const ky=oe("ZodDiscriminatedUnion",(e,t)=>{df.init(e,t),q0.init(e,t)});function Pn(e,t,n){return new ky({type:"union",options:t,discriminator:e,...ke(n)})}const _y=oe("ZodIntersection",(e,t)=>{K0.init(e,t),Ke.init(e,t),e._zod.processJSONSchema=(n,r,o)=>yb(e,n,r,o)});function Sy(e,t){return new _y({type:"intersection",left:e,right:t})}const Cy=oe("ZodRecord",(e,t)=>{G0.init(e,t),Ke.init(e,t),e._zod.processJSONSchema=(n,r,o)=>vb(e,n,r,o),e.keyType=t.keyType,e.valueType=t.valueType});function nt(e,t,n){return new Cy({type:"record",keyType:e,valueType:t,...ke(n)})}const Ai=oe("ZodEnum",(e,t)=>{J0.init(e,t),Ke.init(e,t),e._zod.processJSONSchema=(r,o,s)=>fb(e,r,o),e.enum=t.entries,e.options=Object.values(t.entries);const n=new Set(Object.keys(t.entries));e.extract=(r,o)=>{const s={};for(const i of r)if(n.has(i))s[i]=t.entries[i];else throw new Error(`Key ${i} not found in enum`);return new Ai({...t,checks:[],...ke(o),entries:s})},e.exclude=(r,o)=>{const s={...t.entries};for(const i of r)if(n.has(i))delete s[i];else throw new Error(`Key ${i} not found in enum`);return new Ai({...t,checks:[],...ke(o),entries:s})}});function Re(e,t){const n=Array.isArray(e)?Object.fromEntries(e.map(r=>[r,r])):e;return new Ai({type:"enum",entries:n,...ke(t)})}const jy=oe("ZodLiteral",(e,t)=>{Y0.init(e,t),Ke.init(e,t),e._zod.processJSONSchema=(n,r,o)=>pb(e,n,r),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function je(e,t){return new jy({type:"literal",values:Array.isArray(e)?e:[e],...ke(t)})}const Ny=oe("ZodTransform",(e,t)=>{X0.init(e,t),Ke.init(e,t),e._zod.processJSONSchema=(n,r,o)=>mb(e,n),e._zod.parse=(n,r)=>{if(r.direction==="backward")throw new Od(e.constructor.name);n.addIssue=s=>{if(typeof s=="string")n.issues.push(Lr(s,n.value,t));else{const i=s;i.fatal&&(i.continue=!1),i.code??(i.code="custom"),i.input??(i.input=n.value),i.inst??(i.inst=e),n.issues.push(Lr(i))}};const o=t.transform(n.value,n);return o instanceof Promise?o.then(s=>(n.value=s,n)):(n.value=o,n)}});function Ey(e){return new Ny({type:"transform",transform:e})}const ff=oe("ZodOptional",(e,t)=>{tf.init(e,t),Ke.init(e,t),e._zod.processJSONSchema=(n,r,o)=>lf(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function ic(e){return new ff({type:"optional",innerType:e})}const Ty=oe("ZodExactOptional",(e,t)=>{Q0.init(e,t),Ke.init(e,t),e._zod.processJSONSchema=(n,r,o)=>lf(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function Ay(e){return new Ty({type:"optional",innerType:e})}const Iy=oe("ZodNullable",(e,t)=>{e1.init(e,t),Ke.init(e,t),e._zod.processJSONSchema=(n,r,o)=>wb(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function ac(e){return new Iy({type:"nullable",innerType:e})}const zy=oe("ZodDefault",(e,t)=>{t1.init(e,t),Ke.init(e,t),e._zod.processJSONSchema=(n,r,o)=>_b(e,n,r,o),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function Ry(e,t){return new zy({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():Fd(t)}})}const Py=oe("ZodPrefault",(e,t)=>{n1.init(e,t),Ke.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Sb(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function Oy(e,t){return new Py({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():Fd(t)}})}const pf=oe("ZodNonOptional",(e,t)=>{r1.init(e,t),Ke.init(e,t),e._zod.processJSONSchema=(n,r,o)=>kb(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function My(e,t){return new pf({type:"nonoptional",innerType:e,...ke(t)})}const Ly=oe("ZodCatch",(e,t)=>{o1.init(e,t),Ke.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Cb(e,n,r,o),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function Dy(e,t){return new Ly({type:"catch",innerType:e,catchValue:typeof t=="function"?t:()=>t})}const Fy=oe("ZodPipe",(e,t)=>{s1.init(e,t),Ke.init(e,t),e._zod.processJSONSchema=(n,r,o)=>jb(e,n,r,o),e.in=t.in,e.out=t.out});function lc(e,t){return new Fy({type:"pipe",in:e,out:t})}const $y=oe("ZodReadonly",(e,t)=>{i1.init(e,t),Ke.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Nb(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function By(e){return new $y({type:"readonly",innerType:e})}const Uy=oe("ZodLazy",(e,t)=>{a1.init(e,t),Ke.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Eb(e,n,r,o),e.unwrap=()=>e._zod.def.getter()});function Wy(e){return new Uy({type:"lazy",getter:e})}const Vy=oe("ZodCustom",(e,t)=>{l1.init(e,t),Ke.init(e,t),e._zod.processJSONSchema=(n,r,o)=>hb(e,n)});function Hy(e,t={}){return tb(Vy,e,t)}function Zy(e){return nb(e)}const ft=Wy(()=>rn([A(),ie(),Ze(),Ei(),we(ft),nt(A(),ft)]));const Ta=te({type:A(),ttl:A().optional(),scope:A().optional()}),Aa=te({type:je("text"),text:A(),cache_control:Ta.optional()}),hf=te({type:je("thinking"),thinking:A(),signature:A().optional()}),qy=te({type:je("think"),thinking:A(),signature:A().optional()}),Ky=te({type:je("base64"),media_type:A(),data:A()}),mf=te({type:je("image"),source:Ky}),gf=te({type:je("tool_use"),id:A(),name:A(),input:nt(A(),ft)}),Gy=Pn("type",[Aa,mf]),Jy=te({type:je("tool_result"),tool_use_id:A().optional(),content:rn([A(),we(Gy)]),is_error:Ze().optional()}),Yy=Pn("type",[Aa,hf,mf,gf,Jy]),Xy=rn([A(),we(Yy)]),Qy=te({role:Re(["user","assistant"]),content:Xy}),ev=te({type:je("text"),text:A(),cache_control:Ta.optional()}),tv=te({type:A(),properties:nt(A(),nt(A(),ft)).optional(),required:we(A()).optional(),additionalProperties:Ze().optional(),$schema:A().optional()}),nv=te({name:A(),description:A().optional(),input_schema:tv.optional(),cache_control:Ta.optional()}),rv=Pn("type",[te({type:je("enabled"),budget_tokens:ie()}),te({type:je("disabled")}),te({type:je("adaptive")})]),xf=te({model:A(),messages:we(Qy),system:we(ev).optional(),tools:we(nv).optional(),max_tokens:ie().optional(),temperature:ie().optional(),stream:Ze().optional(),thinking:rv.optional(),metadata:te({user_id:A().optional()}).optional()}),Ia=Pn("type",[Aa,hf,qy,gf]),ov=te({input_tokens:ie().nullable().optional(),output_tokens:ie().nullable().optional(),cache_creation_input_tokens:ie().nullable().optional(),cache_read_input_tokens:ie().nullable().optional()}).passthrough(),bf=te({id:A(),type:je("message"),model:A(),role:je("assistant"),content:we(Ia),stop_reason:A().nullable(),stop_sequence:A().nullable().optional(),usage:ov}).passthrough(),sv=te({type:je("message_start"),message:te({id:A(),type:je("message"),model:A(),role:je("assistant"),content:we(Ia),stop_reason:Ei(),stop_sequence:Ei(),usage:te({input_tokens:ie(),cache_creation_input_tokens:ie().optional(),cache_read_input_tokens:ie().optional()}).passthrough()})}),iv=te({type:je("content_block_start"),index:ie(),content_block:Ia}),av=Pn("type",[te({type:je("text_delta"),text:A()}),te({type:je("input_json_delta"),partial_json:A()}),te({type:je("thinking_delta"),thinking:A()}),te({type:je("signature_delta"),signature:A()})]),lv=te({type:je("content_block_delta"),index:ie(),delta:av}),cv=te({type:je("content_block_stop"),index:ie()}),uv=te({type:je("message_delta"),delta:te({stop_reason:A().nullable(),stop_sequence:A().nullable().optional()}),usage:te({output_tokens:ie(),input_tokens:ie().optional(),cache_creation_input_tokens:ie().optional(),cache_read_input_tokens:ie().optional()}).passthrough()}),dv=te({type:je("message_stop")}),fv=te({type:je("ping")}),pv=te({type:je("error"),error:te({type:A(),message:A()})}),hv=Pn("type",[sv,iv,lv,cv,uv,dv,fv,pv]),mv=rn([A(),we(Pn("type",[te({type:je("text"),text:A()}),te({type:je("image_url"),image_url:te({url:A(),detail:A().optional()})})]))]),yf=te({role:Re(["system","user","assistant","tool"]),content:mv,name:A().optional(),reasoning_content:A().optional(),thinking:A().optional(),think:A().optional()}),gv=te({name:A(),arguments:A()}),vf=te({index:ie().optional(),id:A().optional(),type:je("function").optional(),function:te({name:A().optional(),arguments:A().optional()})});yf.extend({content:rn([A(),we(te({type:je("text"),text:A()}))]).optional(),function_call:gv.optional(),tool_calls:we(vf).optional()});const xv=te({type:je("function"),function:te({name:A(),description:A().optional(),parameters:nt(A(),ft)})}),wf=te({model:A(),messages:we(yf),temperature:ie().optional(),max_tokens:ie().optional(),stream:Ze().optional(),tools:we(xv).optional(),tool_choice:rn([Re(["auto","none","required"]),te({type:je("auto")}),te({type:je("none")}),te({type:je("function"),function:te({name:A()})})]).optional(),user:A().optional()}),kf=te({role:Re(["assistant"]).optional(),content:A().nullable().optional(),reasoning_content:A().nullable().optional(),thinking:A().nullable().optional(),think:A().nullable().optional(),function_call:te({name:A().optional(),arguments:A().optional()}).nullable().optional(),tool_calls:we(te({index:ie(),id:A().optional(),type:je("function").optional(),function:te({name:A().optional(),arguments:A().optional()})})).nullable().optional()}),bv=te({index:ie(),message:te({role:Re(["assistant"]),content:A().nullable(),reasoning_content:A().optional(),thinking:A().optional(),think:A().optional(),function_call:te({name:A(),arguments:A()}).nullable().optional(),tool_calls:we(vf).optional()}).optional(),delta:kf.optional(),finish_reason:A().nullable()}),yv=te({id:A(),object:je("chat.completion"),created:ie(),model:A(),choices:we(bv),usage:te({prompt_tokens:ie().nullable().optional(),completion_tokens:ie().nullable().optional(),total_tokens:ie().nullable().optional()}).passthrough(),service_tier:A().nullable().optional(),system_fingerprint:A().nullable().optional()}).passthrough(),vv=te({id:A(),object:je("chat.completion.chunk"),created:ie(),model:A(),choices:we(te({index:ie(),delta:kf,finish_reason:A().nullable().optional()})),usage:te({prompt_tokens:ie().nullable().optional(),completion_tokens:ie().nullable().optional(),total_tokens:ie().nullable().optional()}).passthrough().nullable().optional()}).passthrough();function _f(e){try{const t=JSON.parse(e),n=yv.safeParse(t);return n.success?n.data:null}catch{return null}}const Sf=te({index:ie(),timestamp:ie(),type:A(),data:ft}),wv=te({chunks:we(Sf),truncated:Ze().optional().default(!1)}),cc=te({id:ie(),timestamp:A(),method:A(),path:A(),model:A().nullable(),sessionId:A().nullable(),rawRequestBody:A().nullable(),responseStatus:ie().nullable(),responseText:A().nullable(),inputTokens:ie().nullable(),outputTokens:ie().nullable(),cacheCreationInputTokens:ie().nullable(),cacheReadInputTokens:ie().nullable(),elapsedMs:ie().nullable(),firstChunkMs:ie().nullable().optional(),totalStreamMs:ie().nullable().optional(),tokensPerSecond:ie().nullable().optional(),streaming:Ze(),userAgent:A().nullable(),origin:A().nullable(),rawHeaders:nt(A(),A()).optional(),headers:nt(A(),A()).optional(),apiFormat:Re(["anthropic","openai","unknown"]).default("unknown"),isTest:Ze().optional().default(!1),replayOfLogId:ie().nullable().optional(),providerName:A().nullable().optional(),clientPort:ie().nullable().optional(),clientPid:ie().nullable().optional(),clientCwd:A().nullable().optional(),clientProjectFolder:A().nullable().optional(),streamingChunks:wv.optional(),streamingChunksPath:A().nullable().optional(),rawRequestBodyBytes:ie().int().nonnegative().nullable().optional(),responseTextBytes:ie().int().nonnegative().nullable().optional(),bodyContentMode:Re(["full","compact","truncated"]).optional(),error:A().nullable().optional()});te({model:A()});te({model:A().optional(),metadata:te({user_id:A().optional()}).passthrough().optional()});const kv=te({error:A()});async function It(e,t){const n=await e.json();return t.parse(n)}async function Qt(e,t){try{const n=await e.json(),r=kv.safeParse(n);return r.success?r.data.error:t}catch{return t}}async function On(e,t,n,r){const o=await fetch(e,n);if(!o.ok){const s=r?.(o)??`Request failed with status ${o.status}`;throw new Error(await Qt(o,s))}return It(o,t)}const Po=10,Ii=600,Oo=60,zi=600,Mo="time",za="simple",Cf=Re(["time","full"]),_v=Re(["simple","full"]),us=te({stripClaudeCodeBillingHeader:Ze(),hasSeenOnboarding:Ze().default(!1),slowResponseThresholdSeconds:ie().int().min(0).max(Ii).default(Po),providerTestTimeoutSeconds:ie().int().min(1).max(zi).default(Oo),timeDisplayFormat:Cf.default(Mo),captureMode:_v.default(za)}),qn="/api/config";async function Sv(e){return On(e,us,void 0,t=>`Failed to fetch ${e}: ${t.status}`)}async function io(e){return On(qn,us,{method:"PATCH",headers:{"content-type":"application/json"},body:JSON.stringify(e)},t=>`PATCH failed with status ${t.status}`)}function Ra(){const e=Hr(qn,Sv,{revalidateOnFocus:!1,revalidateIfStale:!1}),{mutate:t}=zd(),n=e.data?.stripClaudeCodeBillingHeader??!1,r=e.data?.captureMode??za,o=e.data?.slowResponseThresholdSeconds??Po,s=e.data?.providerTestTimeoutSeconds??Oo,i=e.data?.timeDisplayFormat??Mo,l=h=>({stripClaudeCodeBillingHeader:e.data?.stripClaudeCodeBillingHeader??!1,hasSeenOnboarding:e.data?.hasSeenOnboarding??!1,slowResponseThresholdSeconds:e.data?.slowResponseThresholdSeconds??Po,providerTestTimeoutSeconds:e.data?.providerTestTimeoutSeconds??Oo,timeDisplayFormat:e.data?.timeDisplayFormat??Mo,captureMode:r,...h}),c=async h=>{await t(qn,io({stripClaudeCodeBillingHeader:h}),{optimisticData:l({stripClaudeCodeBillingHeader:h}),rollbackOnError:!0,revalidate:!1})},u=async h=>{await t(qn,io({slowResponseThresholdSeconds:h}),{optimisticData:l({slowResponseThresholdSeconds:h}),rollbackOnError:!0,revalidate:!1})},d=async h=>{await t(qn,io({timeDisplayFormat:h}),{optimisticData:l({timeDisplayFormat:h}),rollbackOnError:!0,revalidate:!1})},f=async h=>{await t(qn,io({providerTestTimeoutSeconds:h}),{optimisticData:l({providerTestTimeoutSeconds:h}),rollbackOnError:!0,revalidate:!1})};return{strip:n,captureMode:r,slowResponseThresholdSeconds:o,providerTestTimeoutSeconds:s,timeDisplayFormat:i,isLoading:e.isLoading,isError:e.error!==void 0,setStrip:c,setSlowResponseThresholdSeconds:u,setProviderTestTimeoutSeconds:f,setTimeDisplayFormat:d}}const jf=(...e)=>e.filter((t,n,r)=>!!t&&t.trim()!==""&&r.indexOf(t)===n).join(" ").trim();const Cv=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();const jv=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(t,n,r)=>r?r.toUpperCase():n.toLowerCase());const uc=e=>{const t=jv(e);return t.charAt(0).toUpperCase()+t.slice(1)};var Nv={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};const Ev=e=>{for(const t in e)if(t.startsWith("aria-")||t==="role"||t==="title")return!0;return!1};const Tv=x.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:n=2,absoluteStrokeWidth:r,className:o="",children:s,iconNode:i,...l},c)=>x.createElement("svg",{ref:c,...Nv,width:t,height:t,stroke:e,strokeWidth:r?Number(n)*24/Number(t):n,className:jf("lucide",o),...!s&&!Ev(l)&&{"aria-hidden":"true"},...l},[...i.map(([u,d])=>x.createElement(u,d)),...Array.isArray(s)?s:[s]]));const ge=(e,t)=>{const n=x.forwardRef(({className:r,...o},s)=>x.createElement(Tv,{ref:s,iconNode:t,className:jf(`lucide-${Cv(uc(e))}`,`lucide-${e}`,r),...o}));return n.displayName=uc(e),n};const Av=[["path",{d:"m7 7 10 10",key:"1fmybs"}],["path",{d:"M17 7v10H7",key:"6fjiku"}]],Iv=ge("arrow-down-right",Av);const zv=[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]],Rv=ge("arrow-down",zv);const Pv=[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]],Ov=ge("arrow-left",Pv);const Mv=[["path",{d:"M7 7h10v10",key:"1tivn9"}],["path",{d:"M7 17 17 7",key:"1vkiza"}]],Lv=ge("arrow-up-right",Mv);const Dv=[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]],Fv=ge("arrow-up",Dv);const $v=[["path",{d:"M10 22V7a1 1 0 0 0-1-1H4a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-5a1 1 0 0 0-1-1H2",key:"1ah6g2"}],["rect",{x:"14",y:"2",width:"8",height:"8",rx:"1",key:"88lufb"}]],Bv=ge("blocks",$v);const Uv=[["path",{d:"M12 18V5",key:"adv99a"}],["path",{d:"M15 13a4.17 4.17 0 0 1-3-4 4.17 4.17 0 0 1-3 4",key:"1e3is1"}],["path",{d:"M17.598 6.5A3 3 0 1 0 12 5a3 3 0 1 0-5.598 1.5",key:"1gqd8o"}],["path",{d:"M17.997 5.125a4 4 0 0 1 2.526 5.77",key:"iwvgf7"}],["path",{d:"M18 18a4 4 0 0 0 2-7.464",key:"efp6ie"}],["path",{d:"M19.967 17.483A4 4 0 1 1 12 18a4 4 0 1 1-7.967-.517",key:"1gq6am"}],["path",{d:"M6 18a4 4 0 0 1-2-7.464",key:"k1g0md"}],["path",{d:"M6.003 5.125a4 4 0 0 0-2.526 5.77",key:"q97ue3"}]],Nf=ge("brain",Uv);const Wv=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],rt=ge("check",Wv);const Vv=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],Zt=ge("chevron-down",Vv);const Hv=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],on=ge("chevron-right",Hv);const Zv=[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]],qv=ge("chevron-up",Zv);const Kv=[["path",{d:"m7 6 5 5 5-5",key:"1lc07p"}],["path",{d:"m7 13 5 5 5-5",key:"1d48rs"}]],Ef=ge("chevrons-down",Kv);const Gv=[["path",{d:"m17 11-5-5-5 5",key:"e8nh98"}],["path",{d:"m17 18-5-5-5 5",key:"2avn1x"}]],Jv=ge("chevrons-up",Gv);const Yv=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]],Dr=ge("circle-alert",Yv);const Xv=[["path",{d:"M21.801 10A10 10 0 1 1 17 3.335",key:"yps3ct"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]],Qv=ge("circle-check-big",Xv);const e2=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],dc=ge("circle-check",e2);const t2=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",key:"1u773s"}],["path",{d:"M12 17h.01",key:"p32p05"}]],n2=ge("circle-question-mark",t2);const r2=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]],Tf=ge("circle-x",r2);const o2=[["path",{d:"M12 6v6l4 2",key:"mmk7yg"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],hn=ge("clock",o2);const s2=[["path",{d:"M12 13v8",key:"1l5pq0"}],["path",{d:"M4 14.899A7 7 0 1 1 15.71 8h1.79a4.5 4.5 0 0 1 2.5 8.242",key:"1pljnt"}],["path",{d:"m8 17 4-4 4 4",key:"1quai1"}]],i2=ge("cloud-upload",s2);const a2=[["path",{d:"m18 16 4-4-4-4",key:"1inbqp"}],["path",{d:"m6 8-4 4 4 4",key:"15zrgr"}],["path",{d:"m14.5 4-5 16",key:"e7oirm"}]],l2=ge("code-xml",a2);const c2=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M12 3v18",key:"108xh3"}]],u2=ge("columns-2",c2);const d2=[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]],_t=ge("copy",d2);const f2=[["path",{d:"M12 15V3",key:"m9g1x1"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["path",{d:"m7 10 5 5 5-5",key:"brsn70"}]],ds=ge("download",f2);const p2=[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"19",cy:"12",r:"1",key:"1wjl8i"}],["circle",{cx:"5",cy:"12",r:"1",key:"1pcz8c"}]],h2=ge("ellipsis",p2);const m2=[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]],Pa=ge("external-link",m2);const g2=[["path",{d:"M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49",key:"ct8e1f"}],["path",{d:"M14.084 14.158a3 3 0 0 1-4.242-4.242",key:"151rxh"}],["path",{d:"M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143",key:"13bj9a"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]],Oa=ge("eye-off",g2);const x2=[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],Ma=ge("eye",x2);const b2=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1",key:"1oajmo"}],["path",{d:"M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1",key:"mpwhp6"}]],y2=ge("file-braces",b2);const v2=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M9 10h6",key:"9gxzsh"}],["path",{d:"M12 13V7",key:"h0r20n"}],["path",{d:"M9 17h6",key:"r8uit2"}]],w2=ge("file-diff",v2);const k2=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["circle",{cx:"11.5",cy:"14.5",r:"2.5",key:"1bq0ko"}],["path",{d:"M13.3 16.3 15 18",key:"2quom7"}]],_2=ge("file-search",k2);const S2=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"m8 16 2-2-2-2",key:"10vzyd"}],["path",{d:"M12 18h4",key:"1wd2n7"}]],C2=ge("file-terminal",S2);const j2=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]],N2=ge("file-text",j2);const E2=[["path",{d:"m12 14 4-4",key:"9kzdfg"}],["path",{d:"M3.34 19a10 10 0 1 1 17.32 0",key:"19p75a"}]],Af=ge("gauge",E2);const T2=[["circle",{cx:"5",cy:"6",r:"3",key:"1qnov2"}],["path",{d:"M12 6h5a2 2 0 0 1 2 2v7",key:"1yj91y"}],["path",{d:"m15 9-3-3 3-3",key:"1lwv8l"}],["circle",{cx:"19",cy:"18",r:"3",key:"1qljk2"}],["path",{d:"M12 18H7a2 2 0 0 1-2-2V9",key:"16sdep"}],["path",{d:"m9 15 3 3-3 3",key:"1m3kbl"}]],A2=ge("git-compare-arrows",T2);const I2=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20",key:"13o1zl"}],["path",{d:"M2 12h20",key:"9i4pu4"}]],If=ge("globe",I2);const z2=[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}],["path",{d:"M12 7v5l4 2",key:"1fdv2h"}]],R2=ge("history",z2);const P2=[["path",{d:"M12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83z",key:"zw3jo"}],["path",{d:"M2 12a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 12",key:"1wduqc"}],["path",{d:"M2 17a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 17",key:"kqbvx6"}]],fc=ge("layers",P2);const O2=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],Wt=ge("loader-circle",O2);const M2=[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2",key:"1w4ew1"}],["path",{d:"M7 11V7a5 5 0 0 1 10 0v4",key:"fwvmzm"}]],L2=ge("lock",M2);const D2=[["path",{d:"M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z",key:"18887p"}]],fs=ge("message-square",D2);const F2=[["path",{d:"M5 12h14",key:"1ays0h"}]],$2=ge("minus",F2);const B2=[["path",{d:"M14 4.1 12 6",key:"ita8i4"}],["path",{d:"m5.1 8-2.9-.8",key:"1go3kf"}],["path",{d:"m6 12-1.9 2",key:"mnht97"}],["path",{d:"M7.2 2.2 8 5.1",key:"1cfko1"}],["path",{d:"M9.037 9.69a.498.498 0 0 1 .653-.653l11 4.5a.5.5 0 0 1-.074.949l-4.349 1.041a1 1 0 0 0-.74.739l-1.04 4.35a.5.5 0 0 1-.95.074z",key:"s0h3yz"}]],U2=ge("mouse-pointer-click",B2);const W2=[["path",{d:"M12 16h.01",key:"1drbdi"}],["path",{d:"M12 8v4",key:"1got3b"}],["path",{d:"M15.312 2a2 2 0 0 1 1.414.586l4.688 4.688A2 2 0 0 1 22 8.688v6.624a2 2 0 0 1-.586 1.414l-4.688 4.688a2 2 0 0 1-1.414.586H8.688a2 2 0 0 1-1.414-.586l-4.688-4.688A2 2 0 0 1 2 15.312V8.688a2 2 0 0 1 .586-1.414l4.688-4.688A2 2 0 0 1 8.688 2z",key:"1fd625"}]],V2=ge("octagon-alert",W2);const H2=[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]],zf=ge("pencil",H2);const Z2=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],Ri=ge("plus",Z2);const q2=[["path",{d:"M16.247 7.761a6 6 0 0 1 0 8.478",key:"1fwjs5"}],["path",{d:"M19.075 4.933a10 10 0 0 1 0 14.134",key:"ehdyv1"}],["path",{d:"M4.925 19.067a10 10 0 0 1 0-14.134",key:"1q22gi"}],["path",{d:"M7.753 16.239a6 6 0 0 1 0-8.478",key:"r2q7qm"}],["circle",{cx:"12",cy:"12",r:"2",key:"1c9p78"}]],pc=ge("radio",q2);const K2=[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]],Pi=ge("refresh-cw",K2);const G2=[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]],J2=ge("rotate-ccw",G2);const Y2=[["path",{d:"M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8",key:"1p45f6"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}]],Oi=ge("rotate-cw",Y2);const X2=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M21 9H3",key:"1338ky"}],["path",{d:"M21 15H3",key:"9uk58r"}]],Q2=ge("rows-3",X2);const ew=[["path",{d:"M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",key:"1c8476"}],["path",{d:"M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7",key:"1ydtos"}],["path",{d:"M7 3v4a1 1 0 0 0 1 1h7",key:"t51u73"}]],tw=ge("save",ew);const nw=[["path",{d:"M3 7V5a2 2 0 0 1 2-2h2",key:"aa7l1z"}],["path",{d:"M17 3h2a2 2 0 0 1 2 2v2",key:"4qcy5o"}],["path",{d:"M21 17v2a2 2 0 0 1-2 2h-2",key:"6vwrx8"}],["path",{d:"M7 21H5a2 2 0 0 1-2-2v-2",key:"ioqczr"}]],rw=ge("scan",nw);const ow=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],sw=ge("search",ow);const iw=[["rect",{width:"20",height:"8",x:"2",y:"2",rx:"2",ry:"2",key:"ngkwjq"}],["rect",{width:"20",height:"8",x:"2",y:"14",rx:"2",ry:"2",key:"iecqi9"}],["line",{x1:"6",x2:"6.01",y1:"6",y2:"6",key:"16zg32"}],["line",{x1:"6",x2:"6.01",y1:"18",y2:"18",key:"nzw8ys"}]],aw=ge("server",iw);const lw=[["path",{d:"M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915",key:"1i5ecw"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],cw=ge("settings",lw);const uw=[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],hc=ge("shield-check",uw);const dw=[["path",{d:"M12 19h8",key:"baeox8"}],["path",{d:"m4 17 6-6-6-6",key:"1yngyt"}]],Rf=ge("terminal",dw);const fw=[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]],sr=ge("trash-2",fw);const pw=[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]],Lo=ge("triangle-alert",pw);const hw=[["path",{d:"M12 3v12",key:"1x0j5s"}],["path",{d:"m17 8-5-5-5 5",key:"7q97r8"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}]],mw=ge("upload",hw);const gw=[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]],xw=ge("user",gw);const bw=[["path",{d:"M12 20h.01",key:"zekei9"}],["path",{d:"M8.5 16.429a5 5 0 0 1 7 0",key:"1bycff"}],["path",{d:"M5 12.859a10 10 0 0 1 5.17-2.69",key:"1dl1wf"}],["path",{d:"M19 12.859a10 10 0 0 0-2.007-1.523",key:"4k23kn"}],["path",{d:"M2 8.82a15 15 0 0 1 4.177-2.643",key:"1grhjp"}],["path",{d:"M22 8.82a15 15 0 0 0-11.288-3.764",key:"z3jwby"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]],yw=ge("wifi-off",bw);const vw=[["path",{d:"M12 20h.01",key:"zekei9"}],["path",{d:"M2 8.82a15 15 0 0 1 20 0",key:"dnpr2z"}],["path",{d:"M5 12.859a10 10 0 0 1 14 0",key:"1x1e6c"}],["path",{d:"M8.5 16.429a5 5 0 0 1 7 0",key:"1bycff"}]],ww=ge("wifi",vw);const kw=[["path",{d:"M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.106-3.105c.32-.322.863-.22.983.218a6 6 0 0 1-8.259 7.057l-7.91 7.91a1 1 0 0 1-2.999-3l7.91-7.91a6 6 0 0 1 7.057-8.259c.438.12.54.662.219.984z",key:"1ngwbx"}]],qr=ge("wrench",kw);const _w=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],La=ge("x",_w);const Sw=[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]],Fr=ge("zap",Sw),Mi="/api/config";async function Cw(e){return On(e,us,void 0,t=>`Failed to fetch ${e}: ${t.status}`)}async function jw(e){return On(Mi,us,{method:"PATCH",headers:{"content-type":"application/json"},body:JSON.stringify(e)},t=>`PATCH failed with status ${t.status}`)}function Nw(){const e=Hr(Mi,Cw,{revalidateOnFocus:!1,revalidateIfStale:!1}),{mutate:t}=zd(),n=e.data?.hasSeenOnboarding??!1,r=e.data?.captureMode??za,o=async()=>{await t(Mi,jw({hasSeenOnboarding:!0}),{optimisticData:{stripClaudeCodeBillingHeader:e.data?.stripClaudeCodeBillingHeader??!1,hasSeenOnboarding:!0,slowResponseThresholdSeconds:e.data?.slowResponseThresholdSeconds??Po,providerTestTimeoutSeconds:e.data?.providerTestTimeoutSeconds??Oo,timeDisplayFormat:e.data?.timeDisplayFormat??Mo,captureMode:r},rollbackOnError:!0,revalidate:!1})};return{hasSeenOnboarding:n,captureMode:r,isLoading:e.isLoading,markSeen:o}}function Ew(){const{hasSeenOnboarding:e,captureMode:t,isLoading:n,markSeen:r}=Nw();if(n||e)return null;const o=t==="full";return a.jsxs("div",{role:"note","aria-label":"Onboarding tip",className:"mx-4 mt-2 mb-1 flex items-start gap-3 rounded-md border border-amber-500/30 bg-amber-500/5 px-4 py-3 text-sm",children:[a.jsxs("div",{className:"min-w-0 flex-1",children:[a.jsx("div",{className:"mb-1 font-medium text-amber-600 dark:text-amber-400",children:o?"Agent Inspector is ready in Full mode":"Agent Inspector is ready in Simple mode"}),a.jsxs("ol",{className:"space-y-0.5 text-xs leading-relaxed text-muted-foreground",children:[a.jsxs("li",{children:[a.jsx("strong",{children:"1. Start in the right mode"}),": this process is currently running in"," ",a.jsx("code",{children:t}),". Mode is fixed at startup."]}),o?a.jsxs(a.Fragment,{children:[a.jsxs("li",{children:[a.jsx("strong",{children:"2. Full diagnostics"}),": raw headers, raw response, and SSE chunks are captured for deep investigations."]}),a.jsxs("li",{children:[a.jsx("strong",{children:"3. Daily work"}),": restart with"," ",a.jsx("code",{children:"agent-inspector --mode simple"})," to reduce capture overhead."]})]}):a.jsxs(a.Fragment,{children:[a.jsxs("li",{children:[a.jsx("strong",{children:"2. Simple capture"}),": requests, responses, tools, timing, tokens, replay, and memory candidates are available with lower overhead."]}),a.jsxs("li",{children:[a.jsx("strong",{children:"3. Need raw diagnostics?"})," Restart with"," ",a.jsx("code",{children:"agent-inspector --mode full"})," for raw headers, raw response, and SSE chunks."]})]}),a.jsxs("li",{children:[a.jsx("strong",{children:"Agent setup"}),": run ",a.jsx("code",{children:"agent-inspector onboard --status"}),", then use ",a.jsx("code",{children:"/agent-inspector:onboard"})," in Claude Code or ask Codex to use"," ",a.jsx("code",{children:"agent-inspector-onboard"}),"."]}),a.jsxs("li",{children:[a.jsx("strong",{children:"Container networking"}),": if the AI tool runs outside this Inspector container or host, replace ",a.jsx("code",{children:"localhost"})," with a reachable address."]})]})]}),a.jsxs("button",{type:"button",onClick:()=>{r()},className:"inline-flex h-8 shrink-0 items-center gap-1.5 rounded-md border border-amber-500/40 px-3 text-xs text-amber-700 transition-colors hover:bg-amber-500/10 dark:text-amber-300","aria-label":"Dismiss onboarding tip",children:[a.jsx(rt,{className:"size-3.5"}),"Got it"]}),a.jsx("button",{type:"button",onClick:()=>{r()},className:"-m-1 shrink-0 p-1 text-muted-foreground transition-colors hover:text-foreground","aria-label":"Dismiss",children:a.jsx(La,{className:"size-3.5"})})]})}function ao(e){throw new Error('Could not dynamically require "'+e+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var Vs={exports:{}};var mc;function Tw(){return mc||(mc=1,(function(e,t){(function(n){e.exports=n()})(function(){return(function n(r,o,s){function i(u,d){if(!o[u]){if(!r[u]){var f=typeof ao=="function"&&ao;if(!d&&f)return f(u,!0);if(l)return l(u,!0);var h=new Error("Cannot find module '"+u+"'");throw h.code="MODULE_NOT_FOUND",h}var p=o[u]={exports:{}};r[u][0].call(p.exports,function(y){var m=r[u][1][y];return i(m||y)},p,p.exports,n,r,o,s)}return o[u].exports}for(var l=typeof ao=="function"&&ao,c=0;c<s.length;c++)i(s[c]);return i})({1:[function(n,r,o){var s=n("./utils"),i=n("./support"),l="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";o.encode=function(c){for(var u,d,f,h,p,y,m,g=[],b=0,v=c.length,k=v,S=s.getTypeOf(c)!=="string";b<c.length;)k=v-b,f=S?(u=c[b++],d=b<v?c[b++]:0,b<v?c[b++]:0):(u=c.charCodeAt(b++),d=b<v?c.charCodeAt(b++):0,b<v?c.charCodeAt(b++):0),h=u>>2,p=(3&u)<<4|d>>4,y=1<k?(15&d)<<2|f>>6:64,m=2<k?63&f:64,g.push(l.charAt(h)+l.charAt(p)+l.charAt(y)+l.charAt(m));return g.join("")},o.decode=function(c){var u,d,f,h,p,y,m=0,g=0,b="data:";if(c.substr(0,b.length)===b)throw new Error("Invalid base64 input, it looks like a data url.");var v,k=3*(c=c.replace(/[^A-Za-z0-9+/=]/g,"")).length/4;if(c.charAt(c.length-1)===l.charAt(64)&&k--,c.charAt(c.length-2)===l.charAt(64)&&k--,k%1!=0)throw new Error("Invalid base64 input, bad content length.");for(v=i.uint8array?new Uint8Array(0|k):new Array(0|k);m<c.length;)u=l.indexOf(c.charAt(m++))<<2|(h=l.indexOf(c.charAt(m++)))>>4,d=(15&h)<<4|(p=l.indexOf(c.charAt(m++)))>>2,f=(3&p)<<6|(y=l.indexOf(c.charAt(m++))),v[g++]=u,p!==64&&(v[g++]=d),y!==64&&(v[g++]=f);return v}},{"./support":30,"./utils":32}],2:[function(n,r,o){var s=n("./external"),i=n("./stream/DataWorker"),l=n("./stream/Crc32Probe"),c=n("./stream/DataLengthProbe");function u(d,f,h,p,y){this.compressedSize=d,this.uncompressedSize=f,this.crc32=h,this.compression=p,this.compressedContent=y}u.prototype={getContentWorker:function(){var d=new i(s.Promise.resolve(this.compressedContent)).pipe(this.compression.uncompressWorker()).pipe(new c("data_length")),f=this;return d.on("end",function(){if(this.streamInfo.data_length!==f.uncompressedSize)throw new Error("Bug : uncompressed data size mismatch")}),d},getCompressedWorker:function(){return new i(s.Promise.resolve(this.compressedContent)).withStreamInfo("compressedSize",this.compressedSize).withStreamInfo("uncompressedSize",this.uncompressedSize).withStreamInfo("crc32",this.crc32).withStreamInfo("compression",this.compression)}},u.createWorkerFrom=function(d,f,h){return d.pipe(new l).pipe(new c("uncompressedSize")).pipe(f.compressWorker(h)).pipe(new c("compressedSize")).withStreamInfo("compression",f)},r.exports=u},{"./external":6,"./stream/Crc32Probe":25,"./stream/DataLengthProbe":26,"./stream/DataWorker":27}],3:[function(n,r,o){var s=n("./stream/GenericWorker");o.STORE={magic:"\0\0",compressWorker:function(){return new s("STORE compression")},uncompressWorker:function(){return new s("STORE decompression")}},o.DEFLATE=n("./flate")},{"./flate":7,"./stream/GenericWorker":28}],4:[function(n,r,o){var s=n("./utils"),i=(function(){for(var l,c=[],u=0;u<256;u++){l=u;for(var d=0;d<8;d++)l=1&l?3988292384^l>>>1:l>>>1;c[u]=l}return c})();r.exports=function(l,c){return l!==void 0&&l.length?s.getTypeOf(l)!=="string"?(function(u,d,f,h){var p=i,y=h+f;u^=-1;for(var m=h;m<y;m++)u=u>>>8^p[255&(u^d[m])];return-1^u})(0|c,l,l.length,0):(function(u,d,f,h){var p=i,y=h+f;u^=-1;for(var m=h;m<y;m++)u=u>>>8^p[255&(u^d.charCodeAt(m))];return-1^u})(0|c,l,l.length,0):0}},{"./utils":32}],5:[function(n,r,o){o.base64=!1,o.binary=!1,o.dir=!1,o.createFolders=!0,o.date=null,o.compression=null,o.compressionOptions=null,o.comment=null,o.unixPermissions=null,o.dosPermissions=null},{}],6:[function(n,r,o){var s=null;s=typeof Promise<"u"?Promise:n("lie"),r.exports={Promise:s}},{lie:37}],7:[function(n,r,o){var s=typeof Uint8Array<"u"&&typeof Uint16Array<"u"&&typeof Uint32Array<"u",i=n("pako"),l=n("./utils"),c=n("./stream/GenericWorker"),u=s?"uint8array":"array";function d(f,h){c.call(this,"FlateWorker/"+f),this._pako=null,this._pakoAction=f,this._pakoOptions=h,this.meta={}}o.magic="\b\0",l.inherits(d,c),d.prototype.processChunk=function(f){this.meta=f.meta,this._pako===null&&this._createPako(),this._pako.push(l.transformTo(u,f.data),!1)},d.prototype.flush=function(){c.prototype.flush.call(this),this._pako===null&&this._createPako(),this._pako.push([],!0)},d.prototype.cleanUp=function(){c.prototype.cleanUp.call(this),this._pako=null},d.prototype._createPako=function(){this._pako=new i[this._pakoAction]({raw:!0,level:this._pakoOptions.level||-1});var f=this;this._pako.onData=function(h){f.push({data:h,meta:f.meta})}},o.compressWorker=function(f){return new d("Deflate",f)},o.uncompressWorker=function(){return new d("Inflate",{})}},{"./stream/GenericWorker":28,"./utils":32,pako:38}],8:[function(n,r,o){function s(p,y){var m,g="";for(m=0;m<y;m++)g+=String.fromCharCode(255&p),p>>>=8;return g}function i(p,y,m,g,b,v){var k,S,C=p.file,j=p.compression,E=v!==u.utf8encode,T=l.transformTo("string",v(C.name)),z=l.transformTo("string",u.utf8encode(C.name)),O=C.comment,B=l.transformTo("string",v(O)),N=l.transformTo("string",u.utf8encode(O)),D=z.length!==C.name.length,w=N.length!==O.length,L="",W="",U="",F=C.dir,K=C.date,I={crc32:0,compressedSize:0,uncompressedSize:0};y&&!m||(I.crc32=p.crc32,I.compressedSize=p.compressedSize,I.uncompressedSize=p.uncompressedSize);var H=0;y&&(H|=8),E||!D&&!w||(H|=2048);var G=0,R=0;F&&(G|=16),b==="UNIX"?(R=798,G|=(function(re,fe){var le=re;return re||(le=fe?16893:33204),(65535&le)<<16})(C.unixPermissions,F)):(R=20,G|=(function(re){return 63&(re||0)})(C.dosPermissions)),k=K.getUTCHours(),k<<=6,k|=K.getUTCMinutes(),k<<=5,k|=K.getUTCSeconds()/2,S=K.getUTCFullYear()-1980,S<<=4,S|=K.getUTCMonth()+1,S<<=5,S|=K.getUTCDate(),D&&(W=s(1,1)+s(d(T),4)+z,L+="up"+s(W.length,2)+W),w&&(U=s(1,1)+s(d(B),4)+N,L+="uc"+s(U.length,2)+U);var ae="";return ae+=`
|
|
41
|
+
\0`,ae+=s(H,2),ae+=j.magic,ae+=s(k,2),ae+=s(S,2),ae+=s(I.crc32,4),ae+=s(I.compressedSize,4),ae+=s(I.uncompressedSize,4),ae+=s(T.length,2),ae+=s(L.length,2),{fileRecord:f.LOCAL_FILE_HEADER+ae+T+L,dirRecord:f.CENTRAL_FILE_HEADER+s(R,2)+ae+s(B.length,2)+"\0\0\0\0"+s(G,4)+s(g,4)+T+L+B}}var l=n("../utils"),c=n("../stream/GenericWorker"),u=n("../utf8"),d=n("../crc32"),f=n("../signature");function h(p,y,m,g){c.call(this,"ZipFileWorker"),this.bytesWritten=0,this.zipComment=y,this.zipPlatform=m,this.encodeFileName=g,this.streamFiles=p,this.accumulate=!1,this.contentBuffer=[],this.dirRecords=[],this.currentSourceOffset=0,this.entriesCount=0,this.currentFile=null,this._sources=[]}l.inherits(h,c),h.prototype.push=function(p){var y=p.meta.percent||0,m=this.entriesCount,g=this._sources.length;this.accumulate?this.contentBuffer.push(p):(this.bytesWritten+=p.data.length,c.prototype.push.call(this,{data:p.data,meta:{currentFile:this.currentFile,percent:m?(y+100*(m-g-1))/m:100}}))},h.prototype.openedSource=function(p){this.currentSourceOffset=this.bytesWritten,this.currentFile=p.file.name;var y=this.streamFiles&&!p.file.dir;if(y){var m=i(p,y,!1,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);this.push({data:m.fileRecord,meta:{percent:0}})}else this.accumulate=!0},h.prototype.closedSource=function(p){this.accumulate=!1;var y=this.streamFiles&&!p.file.dir,m=i(p,y,!0,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);if(this.dirRecords.push(m.dirRecord),y)this.push({data:(function(g){return f.DATA_DESCRIPTOR+s(g.crc32,4)+s(g.compressedSize,4)+s(g.uncompressedSize,4)})(p),meta:{percent:100}});else for(this.push({data:m.fileRecord,meta:{percent:0}});this.contentBuffer.length;)this.push(this.contentBuffer.shift());this.currentFile=null},h.prototype.flush=function(){for(var p=this.bytesWritten,y=0;y<this.dirRecords.length;y++)this.push({data:this.dirRecords[y],meta:{percent:100}});var m=this.bytesWritten-p,g=(function(b,v,k,S,C){var j=l.transformTo("string",C(S));return f.CENTRAL_DIRECTORY_END+"\0\0\0\0"+s(b,2)+s(b,2)+s(v,4)+s(k,4)+s(j.length,2)+j})(this.dirRecords.length,m,p,this.zipComment,this.encodeFileName);this.push({data:g,meta:{percent:100}})},h.prototype.prepareNextSource=function(){this.previous=this._sources.shift(),this.openedSource(this.previous.streamInfo),this.isPaused?this.previous.pause():this.previous.resume()},h.prototype.registerPrevious=function(p){this._sources.push(p);var y=this;return p.on("data",function(m){y.processChunk(m)}),p.on("end",function(){y.closedSource(y.previous.streamInfo),y._sources.length?y.prepareNextSource():y.end()}),p.on("error",function(m){y.error(m)}),this},h.prototype.resume=function(){return!!c.prototype.resume.call(this)&&(!this.previous&&this._sources.length?(this.prepareNextSource(),!0):this.previous||this._sources.length||this.generatedError?void 0:(this.end(),!0))},h.prototype.error=function(p){var y=this._sources;if(!c.prototype.error.call(this,p))return!1;for(var m=0;m<y.length;m++)try{y[m].error(p)}catch{}return!0},h.prototype.lock=function(){c.prototype.lock.call(this);for(var p=this._sources,y=0;y<p.length;y++)p[y].lock()},r.exports=h},{"../crc32":4,"../signature":23,"../stream/GenericWorker":28,"../utf8":31,"../utils":32}],9:[function(n,r,o){var s=n("../compressions"),i=n("./ZipFileWorker");o.generateWorker=function(l,c,u){var d=new i(c.streamFiles,u,c.platform,c.encodeFileName),f=0;try{l.forEach(function(h,p){f++;var y=(function(v,k){var S=v||k,C=s[S];if(!C)throw new Error(S+" is not a valid compression method !");return C})(p.options.compression,c.compression),m=p.options.compressionOptions||c.compressionOptions||{},g=p.dir,b=p.date;p._compressWorker(y,m).withStreamInfo("file",{name:h,dir:g,date:b,comment:p.comment||"",unixPermissions:p.unixPermissions,dosPermissions:p.dosPermissions}).pipe(d)}),d.entriesCount=f}catch(h){d.error(h)}return d}},{"../compressions":3,"./ZipFileWorker":8}],10:[function(n,r,o){function s(){if(!(this instanceof s))return new s;if(arguments.length)throw new Error("The constructor with parameters has been removed in JSZip 3.0, please check the upgrade guide.");this.files=Object.create(null),this.comment=null,this.root="",this.clone=function(){var i=new s;for(var l in this)typeof this[l]!="function"&&(i[l]=this[l]);return i}}(s.prototype=n("./object")).loadAsync=n("./load"),s.support=n("./support"),s.defaults=n("./defaults"),s.version="3.10.1",s.loadAsync=function(i,l){return new s().loadAsync(i,l)},s.external=n("./external"),r.exports=s},{"./defaults":5,"./external":6,"./load":11,"./object":15,"./support":30}],11:[function(n,r,o){var s=n("./utils"),i=n("./external"),l=n("./utf8"),c=n("./zipEntries"),u=n("./stream/Crc32Probe"),d=n("./nodejsUtils");function f(h){return new i.Promise(function(p,y){var m=h.decompressed.getContentWorker().pipe(new u);m.on("error",function(g){y(g)}).on("end",function(){m.streamInfo.crc32!==h.decompressed.crc32?y(new Error("Corrupted zip : CRC32 mismatch")):p()}).resume()})}r.exports=function(h,p){var y=this;return p=s.extend(p||{},{base64:!1,checkCRC32:!1,optimizedBinaryString:!1,createFolders:!1,decodeFileName:l.utf8decode}),d.isNode&&d.isStream(h)?i.Promise.reject(new Error("JSZip can't accept a stream when loading a zip file.")):s.prepareContent("the loaded zip file",h,!0,p.optimizedBinaryString,p.base64).then(function(m){var g=new c(p);return g.load(m),g}).then(function(m){var g=[i.Promise.resolve(m)],b=m.files;if(p.checkCRC32)for(var v=0;v<b.length;v++)g.push(f(b[v]));return i.Promise.all(g)}).then(function(m){for(var g=m.shift(),b=g.files,v=0;v<b.length;v++){var k=b[v],S=k.fileNameStr,C=s.resolve(k.fileNameStr);y.file(C,k.decompressed,{binary:!0,optimizedBinaryString:!0,date:k.date,dir:k.dir,comment:k.fileCommentStr.length?k.fileCommentStr:null,unixPermissions:k.unixPermissions,dosPermissions:k.dosPermissions,createFolders:p.createFolders}),k.dir||(y.file(C).unsafeOriginalName=S)}return g.zipComment.length&&(y.comment=g.zipComment),y})}},{"./external":6,"./nodejsUtils":14,"./stream/Crc32Probe":25,"./utf8":31,"./utils":32,"./zipEntries":33}],12:[function(n,r,o){var s=n("../utils"),i=n("../stream/GenericWorker");function l(c,u){i.call(this,"Nodejs stream input adapter for "+c),this._upstreamEnded=!1,this._bindStream(u)}s.inherits(l,i),l.prototype._bindStream=function(c){var u=this;(this._stream=c).pause(),c.on("data",function(d){u.push({data:d,meta:{percent:0}})}).on("error",function(d){u.isPaused?this.generatedError=d:u.error(d)}).on("end",function(){u.isPaused?u._upstreamEnded=!0:u.end()})},l.prototype.pause=function(){return!!i.prototype.pause.call(this)&&(this._stream.pause(),!0)},l.prototype.resume=function(){return!!i.prototype.resume.call(this)&&(this._upstreamEnded?this.end():this._stream.resume(),!0)},r.exports=l},{"../stream/GenericWorker":28,"../utils":32}],13:[function(n,r,o){var s=n("readable-stream").Readable;function i(l,c,u){s.call(this,c),this._helper=l;var d=this;l.on("data",function(f,h){d.push(f)||d._helper.pause(),u&&u(h)}).on("error",function(f){d.emit("error",f)}).on("end",function(){d.push(null)})}n("../utils").inherits(i,s),i.prototype._read=function(){this._helper.resume()},r.exports=i},{"../utils":32,"readable-stream":16}],14:[function(n,r,o){r.exports={isNode:typeof Buffer<"u",newBufferFrom:function(s,i){if(Buffer.from&&Buffer.from!==Uint8Array.from)return Buffer.from(s,i);if(typeof s=="number")throw new Error('The "data" argument must not be a number');return new Buffer(s,i)},allocBuffer:function(s){if(Buffer.alloc)return Buffer.alloc(s);var i=new Buffer(s);return i.fill(0),i},isBuffer:function(s){return Buffer.isBuffer(s)},isStream:function(s){return s&&typeof s.on=="function"&&typeof s.pause=="function"&&typeof s.resume=="function"}}},{}],15:[function(n,r,o){function s(C,j,E){var T,z=l.getTypeOf(j),O=l.extend(E||{},d);O.date=O.date||new Date,O.compression!==null&&(O.compression=O.compression.toUpperCase()),typeof O.unixPermissions=="string"&&(O.unixPermissions=parseInt(O.unixPermissions,8)),O.unixPermissions&&16384&O.unixPermissions&&(O.dir=!0),O.dosPermissions&&16&O.dosPermissions&&(O.dir=!0),O.dir&&(C=b(C)),O.createFolders&&(T=g(C))&&v.call(this,T,!0);var B=z==="string"&&O.binary===!1&&O.base64===!1;E&&E.binary!==void 0||(O.binary=!B),(j instanceof f&&j.uncompressedSize===0||O.dir||!j||j.length===0)&&(O.base64=!1,O.binary=!0,j="",O.compression="STORE",z="string");var N=null;N=j instanceof f||j instanceof c?j:y.isNode&&y.isStream(j)?new m(C,j):l.prepareContent(C,j,O.binary,O.optimizedBinaryString,O.base64);var D=new h(C,N,O);this.files[C]=D}var i=n("./utf8"),l=n("./utils"),c=n("./stream/GenericWorker"),u=n("./stream/StreamHelper"),d=n("./defaults"),f=n("./compressedObject"),h=n("./zipObject"),p=n("./generate"),y=n("./nodejsUtils"),m=n("./nodejs/NodejsStreamInputAdapter"),g=function(C){C.slice(-1)==="/"&&(C=C.substring(0,C.length-1));var j=C.lastIndexOf("/");return 0<j?C.substring(0,j):""},b=function(C){return C.slice(-1)!=="/"&&(C+="/"),C},v=function(C,j){return j=j!==void 0?j:d.createFolders,C=b(C),this.files[C]||s.call(this,C,null,{dir:!0,createFolders:j}),this.files[C]};function k(C){return Object.prototype.toString.call(C)==="[object RegExp]"}var S={load:function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},forEach:function(C){var j,E,T;for(j in this.files)T=this.files[j],(E=j.slice(this.root.length,j.length))&&j.slice(0,this.root.length)===this.root&&C(E,T)},filter:function(C){var j=[];return this.forEach(function(E,T){C(E,T)&&j.push(T)}),j},file:function(C,j,E){if(arguments.length!==1)return C=this.root+C,s.call(this,C,j,E),this;if(k(C)){var T=C;return this.filter(function(O,B){return!B.dir&&T.test(O)})}var z=this.files[this.root+C];return z&&!z.dir?z:null},folder:function(C){if(!C)return this;if(k(C))return this.filter(function(z,O){return O.dir&&C.test(z)});var j=this.root+C,E=v.call(this,j),T=this.clone();return T.root=E.name,T},remove:function(C){C=this.root+C;var j=this.files[C];if(j||(C.slice(-1)!=="/"&&(C+="/"),j=this.files[C]),j&&!j.dir)delete this.files[C];else for(var E=this.filter(function(z,O){return O.name.slice(0,C.length)===C}),T=0;T<E.length;T++)delete this.files[E[T].name];return this},generate:function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},generateInternalStream:function(C){var j,E={};try{if((E=l.extend(C||{},{streamFiles:!1,compression:"STORE",compressionOptions:null,type:"",platform:"DOS",comment:null,mimeType:"application/zip",encodeFileName:i.utf8encode})).type=E.type.toLowerCase(),E.compression=E.compression.toUpperCase(),E.type==="binarystring"&&(E.type="string"),!E.type)throw new Error("No output type specified.");l.checkSupport(E.type),E.platform!=="darwin"&&E.platform!=="freebsd"&&E.platform!=="linux"&&E.platform!=="sunos"||(E.platform="UNIX"),E.platform==="win32"&&(E.platform="DOS");var T=E.comment||this.comment||"";j=p.generateWorker(this,E,T)}catch(z){(j=new c("error")).error(z)}return new u(j,E.type||"string",E.mimeType)},generateAsync:function(C,j){return this.generateInternalStream(C).accumulate(j)},generateNodeStream:function(C,j){return(C=C||{}).type||(C.type="nodebuffer"),this.generateInternalStream(C).toNodejsStream(j)}};r.exports=S},{"./compressedObject":2,"./defaults":5,"./generate":9,"./nodejs/NodejsStreamInputAdapter":12,"./nodejsUtils":14,"./stream/GenericWorker":28,"./stream/StreamHelper":29,"./utf8":31,"./utils":32,"./zipObject":35}],16:[function(n,r,o){r.exports=n("stream")},{stream:void 0}],17:[function(n,r,o){var s=n("./DataReader");function i(l){s.call(this,l);for(var c=0;c<this.data.length;c++)l[c]=255&l[c]}n("../utils").inherits(i,s),i.prototype.byteAt=function(l){return this.data[this.zero+l]},i.prototype.lastIndexOfSignature=function(l){for(var c=l.charCodeAt(0),u=l.charCodeAt(1),d=l.charCodeAt(2),f=l.charCodeAt(3),h=this.length-4;0<=h;--h)if(this.data[h]===c&&this.data[h+1]===u&&this.data[h+2]===d&&this.data[h+3]===f)return h-this.zero;return-1},i.prototype.readAndCheckSignature=function(l){var c=l.charCodeAt(0),u=l.charCodeAt(1),d=l.charCodeAt(2),f=l.charCodeAt(3),h=this.readData(4);return c===h[0]&&u===h[1]&&d===h[2]&&f===h[3]},i.prototype.readData=function(l){if(this.checkOffset(l),l===0)return[];var c=this.data.slice(this.zero+this.index,this.zero+this.index+l);return this.index+=l,c},r.exports=i},{"../utils":32,"./DataReader":18}],18:[function(n,r,o){var s=n("../utils");function i(l){this.data=l,this.length=l.length,this.index=0,this.zero=0}i.prototype={checkOffset:function(l){this.checkIndex(this.index+l)},checkIndex:function(l){if(this.length<this.zero+l||l<0)throw new Error("End of data reached (data length = "+this.length+", asked index = "+l+"). Corrupted zip ?")},setIndex:function(l){this.checkIndex(l),this.index=l},skip:function(l){this.setIndex(this.index+l)},byteAt:function(){},readInt:function(l){var c,u=0;for(this.checkOffset(l),c=this.index+l-1;c>=this.index;c--)u=(u<<8)+this.byteAt(c);return this.index+=l,u},readString:function(l){return s.transformTo("string",this.readData(l))},readData:function(){},lastIndexOfSignature:function(){},readAndCheckSignature:function(){},readDate:function(){var l=this.readInt(4);return new Date(Date.UTC(1980+(l>>25&127),(l>>21&15)-1,l>>16&31,l>>11&31,l>>5&63,(31&l)<<1))}},r.exports=i},{"../utils":32}],19:[function(n,r,o){var s=n("./Uint8ArrayReader");function i(l){s.call(this,l)}n("../utils").inherits(i,s),i.prototype.readData=function(l){this.checkOffset(l);var c=this.data.slice(this.zero+this.index,this.zero+this.index+l);return this.index+=l,c},r.exports=i},{"../utils":32,"./Uint8ArrayReader":21}],20:[function(n,r,o){var s=n("./DataReader");function i(l){s.call(this,l)}n("../utils").inherits(i,s),i.prototype.byteAt=function(l){return this.data.charCodeAt(this.zero+l)},i.prototype.lastIndexOfSignature=function(l){return this.data.lastIndexOf(l)-this.zero},i.prototype.readAndCheckSignature=function(l){return l===this.readData(4)},i.prototype.readData=function(l){this.checkOffset(l);var c=this.data.slice(this.zero+this.index,this.zero+this.index+l);return this.index+=l,c},r.exports=i},{"../utils":32,"./DataReader":18}],21:[function(n,r,o){var s=n("./ArrayReader");function i(l){s.call(this,l)}n("../utils").inherits(i,s),i.prototype.readData=function(l){if(this.checkOffset(l),l===0)return new Uint8Array(0);var c=this.data.subarray(this.zero+this.index,this.zero+this.index+l);return this.index+=l,c},r.exports=i},{"../utils":32,"./ArrayReader":17}],22:[function(n,r,o){var s=n("../utils"),i=n("../support"),l=n("./ArrayReader"),c=n("./StringReader"),u=n("./NodeBufferReader"),d=n("./Uint8ArrayReader");r.exports=function(f){var h=s.getTypeOf(f);return s.checkSupport(h),h!=="string"||i.uint8array?h==="nodebuffer"?new u(f):i.uint8array?new d(s.transformTo("uint8array",f)):new l(s.transformTo("array",f)):new c(f)}},{"../support":30,"../utils":32,"./ArrayReader":17,"./NodeBufferReader":19,"./StringReader":20,"./Uint8ArrayReader":21}],23:[function(n,r,o){o.LOCAL_FILE_HEADER="PK",o.CENTRAL_FILE_HEADER="PK",o.CENTRAL_DIRECTORY_END="PK",o.ZIP64_CENTRAL_DIRECTORY_LOCATOR="PK\x07",o.ZIP64_CENTRAL_DIRECTORY_END="PK",o.DATA_DESCRIPTOR="PK\x07\b"},{}],24:[function(n,r,o){var s=n("./GenericWorker"),i=n("../utils");function l(c){s.call(this,"ConvertWorker to "+c),this.destType=c}i.inherits(l,s),l.prototype.processChunk=function(c){this.push({data:i.transformTo(this.destType,c.data),meta:c.meta})},r.exports=l},{"../utils":32,"./GenericWorker":28}],25:[function(n,r,o){var s=n("./GenericWorker"),i=n("../crc32");function l(){s.call(this,"Crc32Probe"),this.withStreamInfo("crc32",0)}n("../utils").inherits(l,s),l.prototype.processChunk=function(c){this.streamInfo.crc32=i(c.data,this.streamInfo.crc32||0),this.push(c)},r.exports=l},{"../crc32":4,"../utils":32,"./GenericWorker":28}],26:[function(n,r,o){var s=n("../utils"),i=n("./GenericWorker");function l(c){i.call(this,"DataLengthProbe for "+c),this.propName=c,this.withStreamInfo(c,0)}s.inherits(l,i),l.prototype.processChunk=function(c){if(c){var u=this.streamInfo[this.propName]||0;this.streamInfo[this.propName]=u+c.data.length}i.prototype.processChunk.call(this,c)},r.exports=l},{"../utils":32,"./GenericWorker":28}],27:[function(n,r,o){var s=n("../utils"),i=n("./GenericWorker");function l(c){i.call(this,"DataWorker");var u=this;this.dataIsReady=!1,this.index=0,this.max=0,this.data=null,this.type="",this._tickScheduled=!1,c.then(function(d){u.dataIsReady=!0,u.data=d,u.max=d&&d.length||0,u.type=s.getTypeOf(d),u.isPaused||u._tickAndRepeat()},function(d){u.error(d)})}s.inherits(l,i),l.prototype.cleanUp=function(){i.prototype.cleanUp.call(this),this.data=null},l.prototype.resume=function(){return!!i.prototype.resume.call(this)&&(!this._tickScheduled&&this.dataIsReady&&(this._tickScheduled=!0,s.delay(this._tickAndRepeat,[],this)),!0)},l.prototype._tickAndRepeat=function(){this._tickScheduled=!1,this.isPaused||this.isFinished||(this._tick(),this.isFinished||(s.delay(this._tickAndRepeat,[],this),this._tickScheduled=!0))},l.prototype._tick=function(){if(this.isPaused||this.isFinished)return!1;var c=null,u=Math.min(this.max,this.index+16384);if(this.index>=this.max)return this.end();switch(this.type){case"string":c=this.data.substring(this.index,u);break;case"uint8array":c=this.data.subarray(this.index,u);break;case"array":case"nodebuffer":c=this.data.slice(this.index,u)}return this.index=u,this.push({data:c,meta:{percent:this.max?this.index/this.max*100:0}})},r.exports=l},{"../utils":32,"./GenericWorker":28}],28:[function(n,r,o){function s(i){this.name=i||"default",this.streamInfo={},this.generatedError=null,this.extraStreamInfo={},this.isPaused=!0,this.isFinished=!1,this.isLocked=!1,this._listeners={data:[],end:[],error:[]},this.previous=null}s.prototype={push:function(i){this.emit("data",i)},end:function(){if(this.isFinished)return!1;this.flush();try{this.emit("end"),this.cleanUp(),this.isFinished=!0}catch(i){this.emit("error",i)}return!0},error:function(i){return!this.isFinished&&(this.isPaused?this.generatedError=i:(this.isFinished=!0,this.emit("error",i),this.previous&&this.previous.error(i),this.cleanUp()),!0)},on:function(i,l){return this._listeners[i].push(l),this},cleanUp:function(){this.streamInfo=this.generatedError=this.extraStreamInfo=null,this._listeners=[]},emit:function(i,l){if(this._listeners[i])for(var c=0;c<this._listeners[i].length;c++)this._listeners[i][c].call(this,l)},pipe:function(i){return i.registerPrevious(this)},registerPrevious:function(i){if(this.isLocked)throw new Error("The stream '"+this+"' has already been used.");this.streamInfo=i.streamInfo,this.mergeStreamInfo(),this.previous=i;var l=this;return i.on("data",function(c){l.processChunk(c)}),i.on("end",function(){l.end()}),i.on("error",function(c){l.error(c)}),this},pause:function(){return!this.isPaused&&!this.isFinished&&(this.isPaused=!0,this.previous&&this.previous.pause(),!0)},resume:function(){if(!this.isPaused||this.isFinished)return!1;var i=this.isPaused=!1;return this.generatedError&&(this.error(this.generatedError),i=!0),this.previous&&this.previous.resume(),!i},flush:function(){},processChunk:function(i){this.push(i)},withStreamInfo:function(i,l){return this.extraStreamInfo[i]=l,this.mergeStreamInfo(),this},mergeStreamInfo:function(){for(var i in this.extraStreamInfo)Object.prototype.hasOwnProperty.call(this.extraStreamInfo,i)&&(this.streamInfo[i]=this.extraStreamInfo[i])},lock:function(){if(this.isLocked)throw new Error("The stream '"+this+"' has already been used.");this.isLocked=!0,this.previous&&this.previous.lock()},toString:function(){var i="Worker "+this.name;return this.previous?this.previous+" -> "+i:i}},r.exports=s},{}],29:[function(n,r,o){var s=n("../utils"),i=n("./ConvertWorker"),l=n("./GenericWorker"),c=n("../base64"),u=n("../support"),d=n("../external"),f=null;if(u.nodestream)try{f=n("../nodejs/NodejsStreamOutputAdapter")}catch{}function h(y,m){return new d.Promise(function(g,b){var v=[],k=y._internalType,S=y._outputType,C=y._mimeType;y.on("data",function(j,E){v.push(j),m&&m(E)}).on("error",function(j){v=[],b(j)}).on("end",function(){try{var j=(function(E,T,z){switch(E){case"blob":return s.newBlob(s.transformTo("arraybuffer",T),z);case"base64":return c.encode(T);default:return s.transformTo(E,T)}})(S,(function(E,T){var z,O=0,B=null,N=0;for(z=0;z<T.length;z++)N+=T[z].length;switch(E){case"string":return T.join("");case"array":return Array.prototype.concat.apply([],T);case"uint8array":for(B=new Uint8Array(N),z=0;z<T.length;z++)B.set(T[z],O),O+=T[z].length;return B;case"nodebuffer":return Buffer.concat(T);default:throw new Error("concat : unsupported type '"+E+"'")}})(k,v),C);g(j)}catch(E){b(E)}v=[]}).resume()})}function p(y,m,g){var b=m;switch(m){case"blob":case"arraybuffer":b="uint8array";break;case"base64":b="string"}try{this._internalType=b,this._outputType=m,this._mimeType=g,s.checkSupport(b),this._worker=y.pipe(new i(b)),y.lock()}catch(v){this._worker=new l("error"),this._worker.error(v)}}p.prototype={accumulate:function(y){return h(this,y)},on:function(y,m){var g=this;return y==="data"?this._worker.on(y,function(b){m.call(g,b.data,b.meta)}):this._worker.on(y,function(){s.delay(m,arguments,g)}),this},resume:function(){return s.delay(this._worker.resume,[],this._worker),this},pause:function(){return this._worker.pause(),this},toNodejsStream:function(y){if(s.checkSupport("nodestream"),this._outputType!=="nodebuffer")throw new Error(this._outputType+" is not supported by this method");return new f(this,{objectMode:this._outputType!=="nodebuffer"},y)}},r.exports=p},{"../base64":1,"../external":6,"../nodejs/NodejsStreamOutputAdapter":13,"../support":30,"../utils":32,"./ConvertWorker":24,"./GenericWorker":28}],30:[function(n,r,o){if(o.base64=!0,o.array=!0,o.string=!0,o.arraybuffer=typeof ArrayBuffer<"u"&&typeof Uint8Array<"u",o.nodebuffer=typeof Buffer<"u",o.uint8array=typeof Uint8Array<"u",typeof ArrayBuffer>"u")o.blob=!1;else{var s=new ArrayBuffer(0);try{o.blob=new Blob([s],{type:"application/zip"}).size===0}catch{try{var i=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);i.append(s),o.blob=i.getBlob("application/zip").size===0}catch{o.blob=!1}}}try{o.nodestream=!!n("readable-stream").Readable}catch{o.nodestream=!1}},{"readable-stream":16}],31:[function(n,r,o){for(var s=n("./utils"),i=n("./support"),l=n("./nodejsUtils"),c=n("./stream/GenericWorker"),u=new Array(256),d=0;d<256;d++)u[d]=252<=d?6:248<=d?5:240<=d?4:224<=d?3:192<=d?2:1;u[254]=u[254]=1;function f(){c.call(this,"utf-8 decode"),this.leftOver=null}function h(){c.call(this,"utf-8 encode")}o.utf8encode=function(p){return i.nodebuffer?l.newBufferFrom(p,"utf-8"):(function(y){var m,g,b,v,k,S=y.length,C=0;for(v=0;v<S;v++)(64512&(g=y.charCodeAt(v)))==55296&&v+1<S&&(64512&(b=y.charCodeAt(v+1)))==56320&&(g=65536+(g-55296<<10)+(b-56320),v++),C+=g<128?1:g<2048?2:g<65536?3:4;for(m=i.uint8array?new Uint8Array(C):new Array(C),v=k=0;k<C;v++)(64512&(g=y.charCodeAt(v)))==55296&&v+1<S&&(64512&(b=y.charCodeAt(v+1)))==56320&&(g=65536+(g-55296<<10)+(b-56320),v++),g<128?m[k++]=g:(g<2048?m[k++]=192|g>>>6:(g<65536?m[k++]=224|g>>>12:(m[k++]=240|g>>>18,m[k++]=128|g>>>12&63),m[k++]=128|g>>>6&63),m[k++]=128|63&g);return m})(p)},o.utf8decode=function(p){return i.nodebuffer?s.transformTo("nodebuffer",p).toString("utf-8"):(function(y){var m,g,b,v,k=y.length,S=new Array(2*k);for(m=g=0;m<k;)if((b=y[m++])<128)S[g++]=b;else if(4<(v=u[b]))S[g++]=65533,m+=v-1;else{for(b&=v===2?31:v===3?15:7;1<v&&m<k;)b=b<<6|63&y[m++],v--;1<v?S[g++]=65533:b<65536?S[g++]=b:(b-=65536,S[g++]=55296|b>>10&1023,S[g++]=56320|1023&b)}return S.length!==g&&(S.subarray?S=S.subarray(0,g):S.length=g),s.applyFromCharCode(S)})(p=s.transformTo(i.uint8array?"uint8array":"array",p))},s.inherits(f,c),f.prototype.processChunk=function(p){var y=s.transformTo(i.uint8array?"uint8array":"array",p.data);if(this.leftOver&&this.leftOver.length){if(i.uint8array){var m=y;(y=new Uint8Array(m.length+this.leftOver.length)).set(this.leftOver,0),y.set(m,this.leftOver.length)}else y=this.leftOver.concat(y);this.leftOver=null}var g=(function(v,k){var S;for((k=k||v.length)>v.length&&(k=v.length),S=k-1;0<=S&&(192&v[S])==128;)S--;return S<0||S===0?k:S+u[v[S]]>k?S:k})(y),b=y;g!==y.length&&(i.uint8array?(b=y.subarray(0,g),this.leftOver=y.subarray(g,y.length)):(b=y.slice(0,g),this.leftOver=y.slice(g,y.length))),this.push({data:o.utf8decode(b),meta:p.meta})},f.prototype.flush=function(){this.leftOver&&this.leftOver.length&&(this.push({data:o.utf8decode(this.leftOver),meta:{}}),this.leftOver=null)},o.Utf8DecodeWorker=f,s.inherits(h,c),h.prototype.processChunk=function(p){this.push({data:o.utf8encode(p.data),meta:p.meta})},o.Utf8EncodeWorker=h},{"./nodejsUtils":14,"./stream/GenericWorker":28,"./support":30,"./utils":32}],32:[function(n,r,o){var s=n("./support"),i=n("./base64"),l=n("./nodejsUtils"),c=n("./external");function u(m){return m}function d(m,g){for(var b=0;b<m.length;++b)g[b]=255&m.charCodeAt(b);return g}n("setimmediate"),o.newBlob=function(m,g){o.checkSupport("blob");try{return new Blob([m],{type:g})}catch{try{var b=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);return b.append(m),b.getBlob(g)}catch{throw new Error("Bug : can't construct the Blob.")}}};var f={stringifyByChunk:function(m,g,b){var v=[],k=0,S=m.length;if(S<=b)return String.fromCharCode.apply(null,m);for(;k<S;)g==="array"||g==="nodebuffer"?v.push(String.fromCharCode.apply(null,m.slice(k,Math.min(k+b,S)))):v.push(String.fromCharCode.apply(null,m.subarray(k,Math.min(k+b,S)))),k+=b;return v.join("")},stringifyByChar:function(m){for(var g="",b=0;b<m.length;b++)g+=String.fromCharCode(m[b]);return g},applyCanBeUsed:{uint8array:(function(){try{return s.uint8array&&String.fromCharCode.apply(null,new Uint8Array(1)).length===1}catch{return!1}})(),nodebuffer:(function(){try{return s.nodebuffer&&String.fromCharCode.apply(null,l.allocBuffer(1)).length===1}catch{return!1}})()}};function h(m){var g=65536,b=o.getTypeOf(m),v=!0;if(b==="uint8array"?v=f.applyCanBeUsed.uint8array:b==="nodebuffer"&&(v=f.applyCanBeUsed.nodebuffer),v)for(;1<g;)try{return f.stringifyByChunk(m,b,g)}catch{g=Math.floor(g/2)}return f.stringifyByChar(m)}function p(m,g){for(var b=0;b<m.length;b++)g[b]=m[b];return g}o.applyFromCharCode=h;var y={};y.string={string:u,array:function(m){return d(m,new Array(m.length))},arraybuffer:function(m){return y.string.uint8array(m).buffer},uint8array:function(m){return d(m,new Uint8Array(m.length))},nodebuffer:function(m){return d(m,l.allocBuffer(m.length))}},y.array={string:h,array:u,arraybuffer:function(m){return new Uint8Array(m).buffer},uint8array:function(m){return new Uint8Array(m)},nodebuffer:function(m){return l.newBufferFrom(m)}},y.arraybuffer={string:function(m){return h(new Uint8Array(m))},array:function(m){return p(new Uint8Array(m),new Array(m.byteLength))},arraybuffer:u,uint8array:function(m){return new Uint8Array(m)},nodebuffer:function(m){return l.newBufferFrom(new Uint8Array(m))}},y.uint8array={string:h,array:function(m){return p(m,new Array(m.length))},arraybuffer:function(m){return m.buffer},uint8array:u,nodebuffer:function(m){return l.newBufferFrom(m)}},y.nodebuffer={string:h,array:function(m){return p(m,new Array(m.length))},arraybuffer:function(m){return y.nodebuffer.uint8array(m).buffer},uint8array:function(m){return p(m,new Uint8Array(m.length))},nodebuffer:u},o.transformTo=function(m,g){if(g=g||"",!m)return g;o.checkSupport(m);var b=o.getTypeOf(g);return y[b][m](g)},o.resolve=function(m){for(var g=m.split("/"),b=[],v=0;v<g.length;v++){var k=g[v];k==="."||k===""&&v!==0&&v!==g.length-1||(k===".."?b.pop():b.push(k))}return b.join("/")},o.getTypeOf=function(m){return typeof m=="string"?"string":Object.prototype.toString.call(m)==="[object Array]"?"array":s.nodebuffer&&l.isBuffer(m)?"nodebuffer":s.uint8array&&m instanceof Uint8Array?"uint8array":s.arraybuffer&&m instanceof ArrayBuffer?"arraybuffer":void 0},o.checkSupport=function(m){if(!s[m.toLowerCase()])throw new Error(m+" is not supported by this platform")},o.MAX_VALUE_16BITS=65535,o.MAX_VALUE_32BITS=-1,o.pretty=function(m){var g,b,v="";for(b=0;b<(m||"").length;b++)v+="\\x"+((g=m.charCodeAt(b))<16?"0":"")+g.toString(16).toUpperCase();return v},o.delay=function(m,g,b){setImmediate(function(){m.apply(b||null,g||[])})},o.inherits=function(m,g){function b(){}b.prototype=g.prototype,m.prototype=new b},o.extend=function(){var m,g,b={};for(m=0;m<arguments.length;m++)for(g in arguments[m])Object.prototype.hasOwnProperty.call(arguments[m],g)&&b[g]===void 0&&(b[g]=arguments[m][g]);return b},o.prepareContent=function(m,g,b,v,k){return c.Promise.resolve(g).then(function(S){return s.blob&&(S instanceof Blob||["[object File]","[object Blob]"].indexOf(Object.prototype.toString.call(S))!==-1)&&typeof FileReader<"u"?new c.Promise(function(C,j){var E=new FileReader;E.onload=function(T){C(T.target.result)},E.onerror=function(T){j(T.target.error)},E.readAsArrayBuffer(S)}):S}).then(function(S){var C=o.getTypeOf(S);return C?(C==="arraybuffer"?S=o.transformTo("uint8array",S):C==="string"&&(k?S=i.decode(S):b&&v!==!0&&(S=(function(j){return d(j,s.uint8array?new Uint8Array(j.length):new Array(j.length))})(S))),S):c.Promise.reject(new Error("Can't read the data of '"+m+"'. Is it in a supported JavaScript type (String, Blob, ArrayBuffer, etc) ?"))})}},{"./base64":1,"./external":6,"./nodejsUtils":14,"./support":30,setimmediate:54}],33:[function(n,r,o){var s=n("./reader/readerFor"),i=n("./utils"),l=n("./signature"),c=n("./zipEntry"),u=n("./support");function d(f){this.files=[],this.loadOptions=f}d.prototype={checkSignature:function(f){if(!this.reader.readAndCheckSignature(f)){this.reader.index-=4;var h=this.reader.readString(4);throw new Error("Corrupted zip or bug: unexpected signature ("+i.pretty(h)+", expected "+i.pretty(f)+")")}},isSignature:function(f,h){var p=this.reader.index;this.reader.setIndex(f);var y=this.reader.readString(4)===h;return this.reader.setIndex(p),y},readBlockEndOfCentral:function(){this.diskNumber=this.reader.readInt(2),this.diskWithCentralDirStart=this.reader.readInt(2),this.centralDirRecordsOnThisDisk=this.reader.readInt(2),this.centralDirRecords=this.reader.readInt(2),this.centralDirSize=this.reader.readInt(4),this.centralDirOffset=this.reader.readInt(4),this.zipCommentLength=this.reader.readInt(2);var f=this.reader.readData(this.zipCommentLength),h=u.uint8array?"uint8array":"array",p=i.transformTo(h,f);this.zipComment=this.loadOptions.decodeFileName(p)},readBlockZip64EndOfCentral:function(){this.zip64EndOfCentralSize=this.reader.readInt(8),this.reader.skip(4),this.diskNumber=this.reader.readInt(4),this.diskWithCentralDirStart=this.reader.readInt(4),this.centralDirRecordsOnThisDisk=this.reader.readInt(8),this.centralDirRecords=this.reader.readInt(8),this.centralDirSize=this.reader.readInt(8),this.centralDirOffset=this.reader.readInt(8),this.zip64ExtensibleData={};for(var f,h,p,y=this.zip64EndOfCentralSize-44;0<y;)f=this.reader.readInt(2),h=this.reader.readInt(4),p=this.reader.readData(h),this.zip64ExtensibleData[f]={id:f,length:h,value:p}},readBlockZip64EndOfCentralLocator:function(){if(this.diskWithZip64CentralDirStart=this.reader.readInt(4),this.relativeOffsetEndOfZip64CentralDir=this.reader.readInt(8),this.disksCount=this.reader.readInt(4),1<this.disksCount)throw new Error("Multi-volumes zip are not supported")},readLocalFiles:function(){var f,h;for(f=0;f<this.files.length;f++)h=this.files[f],this.reader.setIndex(h.localHeaderOffset),this.checkSignature(l.LOCAL_FILE_HEADER),h.readLocalPart(this.reader),h.handleUTF8(),h.processAttributes()},readCentralDir:function(){var f;for(this.reader.setIndex(this.centralDirOffset);this.reader.readAndCheckSignature(l.CENTRAL_FILE_HEADER);)(f=new c({zip64:this.zip64},this.loadOptions)).readCentralPart(this.reader),this.files.push(f);if(this.centralDirRecords!==this.files.length&&this.centralDirRecords!==0&&this.files.length===0)throw new Error("Corrupted zip or bug: expected "+this.centralDirRecords+" records in central dir, got "+this.files.length)},readEndOfCentral:function(){var f=this.reader.lastIndexOfSignature(l.CENTRAL_DIRECTORY_END);if(f<0)throw this.isSignature(0,l.LOCAL_FILE_HEADER)?new Error("Corrupted zip: can't find end of central directory"):new Error("Can't find end of central directory : is this a zip file ? If it is, see https://stuk.github.io/jszip/documentation/howto/read_zip.html");this.reader.setIndex(f);var h=f;if(this.checkSignature(l.CENTRAL_DIRECTORY_END),this.readBlockEndOfCentral(),this.diskNumber===i.MAX_VALUE_16BITS||this.diskWithCentralDirStart===i.MAX_VALUE_16BITS||this.centralDirRecordsOnThisDisk===i.MAX_VALUE_16BITS||this.centralDirRecords===i.MAX_VALUE_16BITS||this.centralDirSize===i.MAX_VALUE_32BITS||this.centralDirOffset===i.MAX_VALUE_32BITS){if(this.zip64=!0,(f=this.reader.lastIndexOfSignature(l.ZIP64_CENTRAL_DIRECTORY_LOCATOR))<0)throw new Error("Corrupted zip: can't find the ZIP64 end of central directory locator");if(this.reader.setIndex(f),this.checkSignature(l.ZIP64_CENTRAL_DIRECTORY_LOCATOR),this.readBlockZip64EndOfCentralLocator(),!this.isSignature(this.relativeOffsetEndOfZip64CentralDir,l.ZIP64_CENTRAL_DIRECTORY_END)&&(this.relativeOffsetEndOfZip64CentralDir=this.reader.lastIndexOfSignature(l.ZIP64_CENTRAL_DIRECTORY_END),this.relativeOffsetEndOfZip64CentralDir<0))throw new Error("Corrupted zip: can't find the ZIP64 end of central directory");this.reader.setIndex(this.relativeOffsetEndOfZip64CentralDir),this.checkSignature(l.ZIP64_CENTRAL_DIRECTORY_END),this.readBlockZip64EndOfCentral()}var p=this.centralDirOffset+this.centralDirSize;this.zip64&&(p+=20,p+=12+this.zip64EndOfCentralSize);var y=h-p;if(0<y)this.isSignature(h,l.CENTRAL_FILE_HEADER)||(this.reader.zero=y);else if(y<0)throw new Error("Corrupted zip: missing "+Math.abs(y)+" bytes.")},prepareReader:function(f){this.reader=s(f)},load:function(f){this.prepareReader(f),this.readEndOfCentral(),this.readCentralDir(),this.readLocalFiles()}},r.exports=d},{"./reader/readerFor":22,"./signature":23,"./support":30,"./utils":32,"./zipEntry":34}],34:[function(n,r,o){var s=n("./reader/readerFor"),i=n("./utils"),l=n("./compressedObject"),c=n("./crc32"),u=n("./utf8"),d=n("./compressions"),f=n("./support");function h(p,y){this.options=p,this.loadOptions=y}h.prototype={isEncrypted:function(){return(1&this.bitFlag)==1},useUTF8:function(){return(2048&this.bitFlag)==2048},readLocalPart:function(p){var y,m;if(p.skip(22),this.fileNameLength=p.readInt(2),m=p.readInt(2),this.fileName=p.readData(this.fileNameLength),p.skip(m),this.compressedSize===-1||this.uncompressedSize===-1)throw new Error("Bug or corrupted zip : didn't get enough information from the central directory (compressedSize === -1 || uncompressedSize === -1)");if((y=(function(g){for(var b in d)if(Object.prototype.hasOwnProperty.call(d,b)&&d[b].magic===g)return d[b];return null})(this.compressionMethod))===null)throw new Error("Corrupted zip : compression "+i.pretty(this.compressionMethod)+" unknown (inner file : "+i.transformTo("string",this.fileName)+")");this.decompressed=new l(this.compressedSize,this.uncompressedSize,this.crc32,y,p.readData(this.compressedSize))},readCentralPart:function(p){this.versionMadeBy=p.readInt(2),p.skip(2),this.bitFlag=p.readInt(2),this.compressionMethod=p.readString(2),this.date=p.readDate(),this.crc32=p.readInt(4),this.compressedSize=p.readInt(4),this.uncompressedSize=p.readInt(4);var y=p.readInt(2);if(this.extraFieldsLength=p.readInt(2),this.fileCommentLength=p.readInt(2),this.diskNumberStart=p.readInt(2),this.internalFileAttributes=p.readInt(2),this.externalFileAttributes=p.readInt(4),this.localHeaderOffset=p.readInt(4),this.isEncrypted())throw new Error("Encrypted zip are not supported");p.skip(y),this.readExtraFields(p),this.parseZIP64ExtraField(p),this.fileComment=p.readData(this.fileCommentLength)},processAttributes:function(){this.unixPermissions=null,this.dosPermissions=null;var p=this.versionMadeBy>>8;this.dir=!!(16&this.externalFileAttributes),p==0&&(this.dosPermissions=63&this.externalFileAttributes),p==3&&(this.unixPermissions=this.externalFileAttributes>>16&65535),this.dir||this.fileNameStr.slice(-1)!=="/"||(this.dir=!0)},parseZIP64ExtraField:function(){if(this.extraFields[1]){var p=s(this.extraFields[1].value);this.uncompressedSize===i.MAX_VALUE_32BITS&&(this.uncompressedSize=p.readInt(8)),this.compressedSize===i.MAX_VALUE_32BITS&&(this.compressedSize=p.readInt(8)),this.localHeaderOffset===i.MAX_VALUE_32BITS&&(this.localHeaderOffset=p.readInt(8)),this.diskNumberStart===i.MAX_VALUE_32BITS&&(this.diskNumberStart=p.readInt(4))}},readExtraFields:function(p){var y,m,g,b=p.index+this.extraFieldsLength;for(this.extraFields||(this.extraFields={});p.index+4<b;)y=p.readInt(2),m=p.readInt(2),g=p.readData(m),this.extraFields[y]={id:y,length:m,value:g};p.setIndex(b)},handleUTF8:function(){var p=f.uint8array?"uint8array":"array";if(this.useUTF8())this.fileNameStr=u.utf8decode(this.fileName),this.fileCommentStr=u.utf8decode(this.fileComment);else{var y=this.findExtraFieldUnicodePath();if(y!==null)this.fileNameStr=y;else{var m=i.transformTo(p,this.fileName);this.fileNameStr=this.loadOptions.decodeFileName(m)}var g=this.findExtraFieldUnicodeComment();if(g!==null)this.fileCommentStr=g;else{var b=i.transformTo(p,this.fileComment);this.fileCommentStr=this.loadOptions.decodeFileName(b)}}},findExtraFieldUnicodePath:function(){var p=this.extraFields[28789];if(p){var y=s(p.value);return y.readInt(1)!==1||c(this.fileName)!==y.readInt(4)?null:u.utf8decode(y.readData(p.length-5))}return null},findExtraFieldUnicodeComment:function(){var p=this.extraFields[25461];if(p){var y=s(p.value);return y.readInt(1)!==1||c(this.fileComment)!==y.readInt(4)?null:u.utf8decode(y.readData(p.length-5))}return null}},r.exports=h},{"./compressedObject":2,"./compressions":3,"./crc32":4,"./reader/readerFor":22,"./support":30,"./utf8":31,"./utils":32}],35:[function(n,r,o){function s(y,m,g){this.name=y,this.dir=g.dir,this.date=g.date,this.comment=g.comment,this.unixPermissions=g.unixPermissions,this.dosPermissions=g.dosPermissions,this._data=m,this._dataBinary=g.binary,this.options={compression:g.compression,compressionOptions:g.compressionOptions}}var i=n("./stream/StreamHelper"),l=n("./stream/DataWorker"),c=n("./utf8"),u=n("./compressedObject"),d=n("./stream/GenericWorker");s.prototype={internalStream:function(y){var m=null,g="string";try{if(!y)throw new Error("No output type specified.");var b=(g=y.toLowerCase())==="string"||g==="text";g!=="binarystring"&&g!=="text"||(g="string"),m=this._decompressWorker();var v=!this._dataBinary;v&&!b&&(m=m.pipe(new c.Utf8EncodeWorker)),!v&&b&&(m=m.pipe(new c.Utf8DecodeWorker))}catch(k){(m=new d("error")).error(k)}return new i(m,g,"")},async:function(y,m){return this.internalStream(y).accumulate(m)},nodeStream:function(y,m){return this.internalStream(y||"nodebuffer").toNodejsStream(m)},_compressWorker:function(y,m){if(this._data instanceof u&&this._data.compression.magic===y.magic)return this._data.getCompressedWorker();var g=this._decompressWorker();return this._dataBinary||(g=g.pipe(new c.Utf8EncodeWorker)),u.createWorkerFrom(g,y,m)},_decompressWorker:function(){return this._data instanceof u?this._data.getContentWorker():this._data instanceof d?this._data:new l(this._data)}};for(var f=["asText","asBinary","asNodeBuffer","asUint8Array","asArrayBuffer"],h=function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},p=0;p<f.length;p++)s.prototype[f[p]]=h;r.exports=s},{"./compressedObject":2,"./stream/DataWorker":27,"./stream/GenericWorker":28,"./stream/StreamHelper":29,"./utf8":31}],36:[function(n,r,o){(function(s){var i,l,c=s.MutationObserver||s.WebKitMutationObserver;if(c){var u=0,d=new c(y),f=s.document.createTextNode("");d.observe(f,{characterData:!0}),i=function(){f.data=u=++u%2}}else if(s.setImmediate||s.MessageChannel===void 0)i="document"in s&&"onreadystatechange"in s.document.createElement("script")?function(){var m=s.document.createElement("script");m.onreadystatechange=function(){y(),m.onreadystatechange=null,m.parentNode.removeChild(m),m=null},s.document.documentElement.appendChild(m)}:function(){setTimeout(y,0)};else{var h=new s.MessageChannel;h.port1.onmessage=y,i=function(){h.port2.postMessage(0)}}var p=[];function y(){var m,g;l=!0;for(var b=p.length;b;){for(g=p,p=[],m=-1;++m<b;)g[m]();b=p.length}l=!1}r.exports=function(m){p.push(m)!==1||l||i()}}).call(this,typeof no<"u"?no:typeof self<"u"?self:typeof window<"u"?window:{})},{}],37:[function(n,r,o){var s=n("immediate");function i(){}var l={},c=["REJECTED"],u=["FULFILLED"],d=["PENDING"];function f(b){if(typeof b!="function")throw new TypeError("resolver must be a function");this.state=d,this.queue=[],this.outcome=void 0,b!==i&&m(this,b)}function h(b,v,k){this.promise=b,typeof v=="function"&&(this.onFulfilled=v,this.callFulfilled=this.otherCallFulfilled),typeof k=="function"&&(this.onRejected=k,this.callRejected=this.otherCallRejected)}function p(b,v,k){s(function(){var S;try{S=v(k)}catch(C){return l.reject(b,C)}S===b?l.reject(b,new TypeError("Cannot resolve promise with itself")):l.resolve(b,S)})}function y(b){var v=b&&b.then;if(b&&(typeof b=="object"||typeof b=="function")&&typeof v=="function")return function(){v.apply(b,arguments)}}function m(b,v){var k=!1;function S(E){k||(k=!0,l.reject(b,E))}function C(E){k||(k=!0,l.resolve(b,E))}var j=g(function(){v(C,S)});j.status==="error"&&S(j.value)}function g(b,v){var k={};try{k.value=b(v),k.status="success"}catch(S){k.status="error",k.value=S}return k}(r.exports=f).prototype.finally=function(b){if(typeof b!="function")return this;var v=this.constructor;return this.then(function(k){return v.resolve(b()).then(function(){return k})},function(k){return v.resolve(b()).then(function(){throw k})})},f.prototype.catch=function(b){return this.then(null,b)},f.prototype.then=function(b,v){if(typeof b!="function"&&this.state===u||typeof v!="function"&&this.state===c)return this;var k=new this.constructor(i);return this.state!==d?p(k,this.state===u?b:v,this.outcome):this.queue.push(new h(k,b,v)),k},h.prototype.callFulfilled=function(b){l.resolve(this.promise,b)},h.prototype.otherCallFulfilled=function(b){p(this.promise,this.onFulfilled,b)},h.prototype.callRejected=function(b){l.reject(this.promise,b)},h.prototype.otherCallRejected=function(b){p(this.promise,this.onRejected,b)},l.resolve=function(b,v){var k=g(y,v);if(k.status==="error")return l.reject(b,k.value);var S=k.value;if(S)m(b,S);else{b.state=u,b.outcome=v;for(var C=-1,j=b.queue.length;++C<j;)b.queue[C].callFulfilled(v)}return b},l.reject=function(b,v){b.state=c,b.outcome=v;for(var k=-1,S=b.queue.length;++k<S;)b.queue[k].callRejected(v);return b},f.resolve=function(b){return b instanceof this?b:l.resolve(new this(i),b)},f.reject=function(b){var v=new this(i);return l.reject(v,b)},f.all=function(b){var v=this;if(Object.prototype.toString.call(b)!=="[object Array]")return this.reject(new TypeError("must be an array"));var k=b.length,S=!1;if(!k)return this.resolve([]);for(var C=new Array(k),j=0,E=-1,T=new this(i);++E<k;)z(b[E],E);return T;function z(O,B){v.resolve(O).then(function(N){C[B]=N,++j!==k||S||(S=!0,l.resolve(T,C))},function(N){S||(S=!0,l.reject(T,N))})}},f.race=function(b){var v=this;if(Object.prototype.toString.call(b)!=="[object Array]")return this.reject(new TypeError("must be an array"));var k=b.length,S=!1;if(!k)return this.resolve([]);for(var C=-1,j=new this(i);++C<k;)E=b[C],v.resolve(E).then(function(T){S||(S=!0,l.resolve(j,T))},function(T){S||(S=!0,l.reject(j,T))});var E;return j}},{immediate:36}],38:[function(n,r,o){var s={};(0,n("./lib/utils/common").assign)(s,n("./lib/deflate"),n("./lib/inflate"),n("./lib/zlib/constants")),r.exports=s},{"./lib/deflate":39,"./lib/inflate":40,"./lib/utils/common":41,"./lib/zlib/constants":44}],39:[function(n,r,o){var s=n("./zlib/deflate"),i=n("./utils/common"),l=n("./utils/strings"),c=n("./zlib/messages"),u=n("./zlib/zstream"),d=Object.prototype.toString,f=0,h=-1,p=0,y=8;function m(b){if(!(this instanceof m))return new m(b);this.options=i.assign({level:h,method:y,chunkSize:16384,windowBits:15,memLevel:8,strategy:p,to:""},b||{});var v=this.options;v.raw&&0<v.windowBits?v.windowBits=-v.windowBits:v.gzip&&0<v.windowBits&&v.windowBits<16&&(v.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new u,this.strm.avail_out=0;var k=s.deflateInit2(this.strm,v.level,v.method,v.windowBits,v.memLevel,v.strategy);if(k!==f)throw new Error(c[k]);if(v.header&&s.deflateSetHeader(this.strm,v.header),v.dictionary){var S;if(S=typeof v.dictionary=="string"?l.string2buf(v.dictionary):d.call(v.dictionary)==="[object ArrayBuffer]"?new Uint8Array(v.dictionary):v.dictionary,(k=s.deflateSetDictionary(this.strm,S))!==f)throw new Error(c[k]);this._dict_set=!0}}function g(b,v){var k=new m(v);if(k.push(b,!0),k.err)throw k.msg||c[k.err];return k.result}m.prototype.push=function(b,v){var k,S,C=this.strm,j=this.options.chunkSize;if(this.ended)return!1;S=v===~~v?v:v===!0?4:0,typeof b=="string"?C.input=l.string2buf(b):d.call(b)==="[object ArrayBuffer]"?C.input=new Uint8Array(b):C.input=b,C.next_in=0,C.avail_in=C.input.length;do{if(C.avail_out===0&&(C.output=new i.Buf8(j),C.next_out=0,C.avail_out=j),(k=s.deflate(C,S))!==1&&k!==f)return this.onEnd(k),!(this.ended=!0);C.avail_out!==0&&(C.avail_in!==0||S!==4&&S!==2)||(this.options.to==="string"?this.onData(l.buf2binstring(i.shrinkBuf(C.output,C.next_out))):this.onData(i.shrinkBuf(C.output,C.next_out)))}while((0<C.avail_in||C.avail_out===0)&&k!==1);return S===4?(k=s.deflateEnd(this.strm),this.onEnd(k),this.ended=!0,k===f):S!==2||(this.onEnd(f),!(C.avail_out=0))},m.prototype.onData=function(b){this.chunks.push(b)},m.prototype.onEnd=function(b){b===f&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=i.flattenChunks(this.chunks)),this.chunks=[],this.err=b,this.msg=this.strm.msg},o.Deflate=m,o.deflate=g,o.deflateRaw=function(b,v){return(v=v||{}).raw=!0,g(b,v)},o.gzip=function(b,v){return(v=v||{}).gzip=!0,g(b,v)}},{"./utils/common":41,"./utils/strings":42,"./zlib/deflate":46,"./zlib/messages":51,"./zlib/zstream":53}],40:[function(n,r,o){var s=n("./zlib/inflate"),i=n("./utils/common"),l=n("./utils/strings"),c=n("./zlib/constants"),u=n("./zlib/messages"),d=n("./zlib/zstream"),f=n("./zlib/gzheader"),h=Object.prototype.toString;function p(m){if(!(this instanceof p))return new p(m);this.options=i.assign({chunkSize:16384,windowBits:0,to:""},m||{});var g=this.options;g.raw&&0<=g.windowBits&&g.windowBits<16&&(g.windowBits=-g.windowBits,g.windowBits===0&&(g.windowBits=-15)),!(0<=g.windowBits&&g.windowBits<16)||m&&m.windowBits||(g.windowBits+=32),15<g.windowBits&&g.windowBits<48&&(15&g.windowBits)==0&&(g.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new d,this.strm.avail_out=0;var b=s.inflateInit2(this.strm,g.windowBits);if(b!==c.Z_OK)throw new Error(u[b]);this.header=new f,s.inflateGetHeader(this.strm,this.header)}function y(m,g){var b=new p(g);if(b.push(m,!0),b.err)throw b.msg||u[b.err];return b.result}p.prototype.push=function(m,g){var b,v,k,S,C,j,E=this.strm,T=this.options.chunkSize,z=this.options.dictionary,O=!1;if(this.ended)return!1;v=g===~~g?g:g===!0?c.Z_FINISH:c.Z_NO_FLUSH,typeof m=="string"?E.input=l.binstring2buf(m):h.call(m)==="[object ArrayBuffer]"?E.input=new Uint8Array(m):E.input=m,E.next_in=0,E.avail_in=E.input.length;do{if(E.avail_out===0&&(E.output=new i.Buf8(T),E.next_out=0,E.avail_out=T),(b=s.inflate(E,c.Z_NO_FLUSH))===c.Z_NEED_DICT&&z&&(j=typeof z=="string"?l.string2buf(z):h.call(z)==="[object ArrayBuffer]"?new Uint8Array(z):z,b=s.inflateSetDictionary(this.strm,j)),b===c.Z_BUF_ERROR&&O===!0&&(b=c.Z_OK,O=!1),b!==c.Z_STREAM_END&&b!==c.Z_OK)return this.onEnd(b),!(this.ended=!0);E.next_out&&(E.avail_out!==0&&b!==c.Z_STREAM_END&&(E.avail_in!==0||v!==c.Z_FINISH&&v!==c.Z_SYNC_FLUSH)||(this.options.to==="string"?(k=l.utf8border(E.output,E.next_out),S=E.next_out-k,C=l.buf2string(E.output,k),E.next_out=S,E.avail_out=T-S,S&&i.arraySet(E.output,E.output,k,S,0),this.onData(C)):this.onData(i.shrinkBuf(E.output,E.next_out)))),E.avail_in===0&&E.avail_out===0&&(O=!0)}while((0<E.avail_in||E.avail_out===0)&&b!==c.Z_STREAM_END);return b===c.Z_STREAM_END&&(v=c.Z_FINISH),v===c.Z_FINISH?(b=s.inflateEnd(this.strm),this.onEnd(b),this.ended=!0,b===c.Z_OK):v!==c.Z_SYNC_FLUSH||(this.onEnd(c.Z_OK),!(E.avail_out=0))},p.prototype.onData=function(m){this.chunks.push(m)},p.prototype.onEnd=function(m){m===c.Z_OK&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=i.flattenChunks(this.chunks)),this.chunks=[],this.err=m,this.msg=this.strm.msg},o.Inflate=p,o.inflate=y,o.inflateRaw=function(m,g){return(g=g||{}).raw=!0,y(m,g)},o.ungzip=y},{"./utils/common":41,"./utils/strings":42,"./zlib/constants":44,"./zlib/gzheader":47,"./zlib/inflate":49,"./zlib/messages":51,"./zlib/zstream":53}],41:[function(n,r,o){var s=typeof Uint8Array<"u"&&typeof Uint16Array<"u"&&typeof Int32Array<"u";o.assign=function(c){for(var u=Array.prototype.slice.call(arguments,1);u.length;){var d=u.shift();if(d){if(typeof d!="object")throw new TypeError(d+"must be non-object");for(var f in d)d.hasOwnProperty(f)&&(c[f]=d[f])}}return c},o.shrinkBuf=function(c,u){return c.length===u?c:c.subarray?c.subarray(0,u):(c.length=u,c)};var i={arraySet:function(c,u,d,f,h){if(u.subarray&&c.subarray)c.set(u.subarray(d,d+f),h);else for(var p=0;p<f;p++)c[h+p]=u[d+p]},flattenChunks:function(c){var u,d,f,h,p,y;for(u=f=0,d=c.length;u<d;u++)f+=c[u].length;for(y=new Uint8Array(f),u=h=0,d=c.length;u<d;u++)p=c[u],y.set(p,h),h+=p.length;return y}},l={arraySet:function(c,u,d,f,h){for(var p=0;p<f;p++)c[h+p]=u[d+p]},flattenChunks:function(c){return[].concat.apply([],c)}};o.setTyped=function(c){c?(o.Buf8=Uint8Array,o.Buf16=Uint16Array,o.Buf32=Int32Array,o.assign(o,i)):(o.Buf8=Array,o.Buf16=Array,o.Buf32=Array,o.assign(o,l))},o.setTyped(s)},{}],42:[function(n,r,o){var s=n("./common"),i=!0,l=!0;try{String.fromCharCode.apply(null,[0])}catch{i=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch{l=!1}for(var c=new s.Buf8(256),u=0;u<256;u++)c[u]=252<=u?6:248<=u?5:240<=u?4:224<=u?3:192<=u?2:1;function d(f,h){if(h<65537&&(f.subarray&&l||!f.subarray&&i))return String.fromCharCode.apply(null,s.shrinkBuf(f,h));for(var p="",y=0;y<h;y++)p+=String.fromCharCode(f[y]);return p}c[254]=c[254]=1,o.string2buf=function(f){var h,p,y,m,g,b=f.length,v=0;for(m=0;m<b;m++)(64512&(p=f.charCodeAt(m)))==55296&&m+1<b&&(64512&(y=f.charCodeAt(m+1)))==56320&&(p=65536+(p-55296<<10)+(y-56320),m++),v+=p<128?1:p<2048?2:p<65536?3:4;for(h=new s.Buf8(v),m=g=0;g<v;m++)(64512&(p=f.charCodeAt(m)))==55296&&m+1<b&&(64512&(y=f.charCodeAt(m+1)))==56320&&(p=65536+(p-55296<<10)+(y-56320),m++),p<128?h[g++]=p:(p<2048?h[g++]=192|p>>>6:(p<65536?h[g++]=224|p>>>12:(h[g++]=240|p>>>18,h[g++]=128|p>>>12&63),h[g++]=128|p>>>6&63),h[g++]=128|63&p);return h},o.buf2binstring=function(f){return d(f,f.length)},o.binstring2buf=function(f){for(var h=new s.Buf8(f.length),p=0,y=h.length;p<y;p++)h[p]=f.charCodeAt(p);return h},o.buf2string=function(f,h){var p,y,m,g,b=h||f.length,v=new Array(2*b);for(p=y=0;p<b;)if((m=f[p++])<128)v[y++]=m;else if(4<(g=c[m]))v[y++]=65533,p+=g-1;else{for(m&=g===2?31:g===3?15:7;1<g&&p<b;)m=m<<6|63&f[p++],g--;1<g?v[y++]=65533:m<65536?v[y++]=m:(m-=65536,v[y++]=55296|m>>10&1023,v[y++]=56320|1023&m)}return d(v,y)},o.utf8border=function(f,h){var p;for((h=h||f.length)>f.length&&(h=f.length),p=h-1;0<=p&&(192&f[p])==128;)p--;return p<0||p===0?h:p+c[f[p]]>h?p:h}},{"./common":41}],43:[function(n,r,o){r.exports=function(s,i,l,c){for(var u=65535&s|0,d=s>>>16&65535|0,f=0;l!==0;){for(l-=f=2e3<l?2e3:l;d=d+(u=u+i[c++]|0)|0,--f;);u%=65521,d%=65521}return u|d<<16|0}},{}],44:[function(n,r,o){r.exports={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8}},{}],45:[function(n,r,o){var s=(function(){for(var i,l=[],c=0;c<256;c++){i=c;for(var u=0;u<8;u++)i=1&i?3988292384^i>>>1:i>>>1;l[c]=i}return l})();r.exports=function(i,l,c,u){var d=s,f=u+c;i^=-1;for(var h=u;h<f;h++)i=i>>>8^d[255&(i^l[h])];return-1^i}},{}],46:[function(n,r,o){var s,i=n("../utils/common"),l=n("./trees"),c=n("./adler32"),u=n("./crc32"),d=n("./messages"),f=0,h=4,p=0,y=-2,m=-1,g=4,b=2,v=8,k=9,S=286,C=30,j=19,E=2*S+1,T=15,z=3,O=258,B=O+z+1,N=42,D=113,w=1,L=2,W=3,U=4;function F(_,ne){return _.msg=d[ne],ne}function K(_){return(_<<1)-(4<_?9:0)}function I(_){for(var ne=_.length;0<=--ne;)_[ne]=0}function H(_){var ne=_.state,Q=ne.pending;Q>_.avail_out&&(Q=_.avail_out),Q!==0&&(i.arraySet(_.output,ne.pending_buf,ne.pending_out,Q,_.next_out),_.next_out+=Q,ne.pending_out+=Q,_.total_out+=Q,_.avail_out-=Q,ne.pending-=Q,ne.pending===0&&(ne.pending_out=0))}function G(_,ne){l._tr_flush_block(_,0<=_.block_start?_.block_start:-1,_.strstart-_.block_start,ne),_.block_start=_.strstart,H(_.strm)}function R(_,ne){_.pending_buf[_.pending++]=ne}function ae(_,ne){_.pending_buf[_.pending++]=ne>>>8&255,_.pending_buf[_.pending++]=255&ne}function re(_,ne){var Q,M,P=_.max_chain_length,q=_.strstart,Z=_.prev_length,J=_.nice_match,V=_.strstart>_.w_size-B?_.strstart-(_.w_size-B):0,se=_.window,Y=_.w_mask,ee=_.prev,$=_.strstart+O,X=se[q+Z-1],ce=se[q+Z];_.prev_length>=_.good_match&&(P>>=2),J>_.lookahead&&(J=_.lookahead);do if(se[(Q=ne)+Z]===ce&&se[Q+Z-1]===X&&se[Q]===se[q]&&se[++Q]===se[q+1]){q+=2,Q++;do;while(se[++q]===se[++Q]&&se[++q]===se[++Q]&&se[++q]===se[++Q]&&se[++q]===se[++Q]&&se[++q]===se[++Q]&&se[++q]===se[++Q]&&se[++q]===se[++Q]&&se[++q]===se[++Q]&&q<$);if(M=O-($-q),q=$-O,Z<M){if(_.match_start=ne,J<=(Z=M))break;X=se[q+Z-1],ce=se[q+Z]}}while((ne=ee[ne&Y])>V&&--P!=0);return Z<=_.lookahead?Z:_.lookahead}function fe(_){var ne,Q,M,P,q,Z,J,V,se,Y,ee=_.w_size;do{if(P=_.window_size-_.lookahead-_.strstart,_.strstart>=ee+(ee-B)){for(i.arraySet(_.window,_.window,ee,ee,0),_.match_start-=ee,_.strstart-=ee,_.block_start-=ee,ne=Q=_.hash_size;M=_.head[--ne],_.head[ne]=ee<=M?M-ee:0,--Q;);for(ne=Q=ee;M=_.prev[--ne],_.prev[ne]=ee<=M?M-ee:0,--Q;);P+=ee}if(_.strm.avail_in===0)break;if(Z=_.strm,J=_.window,V=_.strstart+_.lookahead,se=P,Y=void 0,Y=Z.avail_in,se<Y&&(Y=se),Q=Y===0?0:(Z.avail_in-=Y,i.arraySet(J,Z.input,Z.next_in,Y,V),Z.state.wrap===1?Z.adler=c(Z.adler,J,Y,V):Z.state.wrap===2&&(Z.adler=u(Z.adler,J,Y,V)),Z.next_in+=Y,Z.total_in+=Y,Y),_.lookahead+=Q,_.lookahead+_.insert>=z)for(q=_.strstart-_.insert,_.ins_h=_.window[q],_.ins_h=(_.ins_h<<_.hash_shift^_.window[q+1])&_.hash_mask;_.insert&&(_.ins_h=(_.ins_h<<_.hash_shift^_.window[q+z-1])&_.hash_mask,_.prev[q&_.w_mask]=_.head[_.ins_h],_.head[_.ins_h]=q,q++,_.insert--,!(_.lookahead+_.insert<z)););}while(_.lookahead<B&&_.strm.avail_in!==0)}function le(_,ne){for(var Q,M;;){if(_.lookahead<B){if(fe(_),_.lookahead<B&&ne===f)return w;if(_.lookahead===0)break}if(Q=0,_.lookahead>=z&&(_.ins_h=(_.ins_h<<_.hash_shift^_.window[_.strstart+z-1])&_.hash_mask,Q=_.prev[_.strstart&_.w_mask]=_.head[_.ins_h],_.head[_.ins_h]=_.strstart),Q!==0&&_.strstart-Q<=_.w_size-B&&(_.match_length=re(_,Q)),_.match_length>=z)if(M=l._tr_tally(_,_.strstart-_.match_start,_.match_length-z),_.lookahead-=_.match_length,_.match_length<=_.max_lazy_match&&_.lookahead>=z){for(_.match_length--;_.strstart++,_.ins_h=(_.ins_h<<_.hash_shift^_.window[_.strstart+z-1])&_.hash_mask,Q=_.prev[_.strstart&_.w_mask]=_.head[_.ins_h],_.head[_.ins_h]=_.strstart,--_.match_length!=0;);_.strstart++}else _.strstart+=_.match_length,_.match_length=0,_.ins_h=_.window[_.strstart],_.ins_h=(_.ins_h<<_.hash_shift^_.window[_.strstart+1])&_.hash_mask;else M=l._tr_tally(_,0,_.window[_.strstart]),_.lookahead--,_.strstart++;if(M&&(G(_,!1),_.strm.avail_out===0))return w}return _.insert=_.strstart<z-1?_.strstart:z-1,ne===h?(G(_,!0),_.strm.avail_out===0?W:U):_.last_lit&&(G(_,!1),_.strm.avail_out===0)?w:L}function de(_,ne){for(var Q,M,P;;){if(_.lookahead<B){if(fe(_),_.lookahead<B&&ne===f)return w;if(_.lookahead===0)break}if(Q=0,_.lookahead>=z&&(_.ins_h=(_.ins_h<<_.hash_shift^_.window[_.strstart+z-1])&_.hash_mask,Q=_.prev[_.strstart&_.w_mask]=_.head[_.ins_h],_.head[_.ins_h]=_.strstart),_.prev_length=_.match_length,_.prev_match=_.match_start,_.match_length=z-1,Q!==0&&_.prev_length<_.max_lazy_match&&_.strstart-Q<=_.w_size-B&&(_.match_length=re(_,Q),_.match_length<=5&&(_.strategy===1||_.match_length===z&&4096<_.strstart-_.match_start)&&(_.match_length=z-1)),_.prev_length>=z&&_.match_length<=_.prev_length){for(P=_.strstart+_.lookahead-z,M=l._tr_tally(_,_.strstart-1-_.prev_match,_.prev_length-z),_.lookahead-=_.prev_length-1,_.prev_length-=2;++_.strstart<=P&&(_.ins_h=(_.ins_h<<_.hash_shift^_.window[_.strstart+z-1])&_.hash_mask,Q=_.prev[_.strstart&_.w_mask]=_.head[_.ins_h],_.head[_.ins_h]=_.strstart),--_.prev_length!=0;);if(_.match_available=0,_.match_length=z-1,_.strstart++,M&&(G(_,!1),_.strm.avail_out===0))return w}else if(_.match_available){if((M=l._tr_tally(_,0,_.window[_.strstart-1]))&&G(_,!1),_.strstart++,_.lookahead--,_.strm.avail_out===0)return w}else _.match_available=1,_.strstart++,_.lookahead--}return _.match_available&&(M=l._tr_tally(_,0,_.window[_.strstart-1]),_.match_available=0),_.insert=_.strstart<z-1?_.strstart:z-1,ne===h?(G(_,!0),_.strm.avail_out===0?W:U):_.last_lit&&(G(_,!1),_.strm.avail_out===0)?w:L}function pe(_,ne,Q,M,P){this.good_length=_,this.max_lazy=ne,this.nice_length=Q,this.max_chain=M,this.func=P}function he(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=v,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new i.Buf16(2*E),this.dyn_dtree=new i.Buf16(2*(2*C+1)),this.bl_tree=new i.Buf16(2*(2*j+1)),I(this.dyn_ltree),I(this.dyn_dtree),I(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new i.Buf16(T+1),this.heap=new i.Buf16(2*S+1),I(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new i.Buf16(2*S+1),I(this.depth),this.l_buf=0,this.lit_bufsize=0,this.last_lit=0,this.d_buf=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}function me(_){var ne;return _&&_.state?(_.total_in=_.total_out=0,_.data_type=b,(ne=_.state).pending=0,ne.pending_out=0,ne.wrap<0&&(ne.wrap=-ne.wrap),ne.status=ne.wrap?N:D,_.adler=ne.wrap===2?0:1,ne.last_flush=f,l._tr_init(ne),p):F(_,y)}function _e(_){var ne=me(_);return ne===p&&(function(Q){Q.window_size=2*Q.w_size,I(Q.head),Q.max_lazy_match=s[Q.level].max_lazy,Q.good_match=s[Q.level].good_length,Q.nice_match=s[Q.level].nice_length,Q.max_chain_length=s[Q.level].max_chain,Q.strstart=0,Q.block_start=0,Q.lookahead=0,Q.insert=0,Q.match_length=Q.prev_length=z-1,Q.match_available=0,Q.ins_h=0})(_.state),ne}function Pe(_,ne,Q,M,P,q){if(!_)return y;var Z=1;if(ne===m&&(ne=6),M<0?(Z=0,M=-M):15<M&&(Z=2,M-=16),P<1||k<P||Q!==v||M<8||15<M||ne<0||9<ne||q<0||g<q)return F(_,y);M===8&&(M=9);var J=new he;return(_.state=J).strm=_,J.wrap=Z,J.gzhead=null,J.w_bits=M,J.w_size=1<<J.w_bits,J.w_mask=J.w_size-1,J.hash_bits=P+7,J.hash_size=1<<J.hash_bits,J.hash_mask=J.hash_size-1,J.hash_shift=~~((J.hash_bits+z-1)/z),J.window=new i.Buf8(2*J.w_size),J.head=new i.Buf16(J.hash_size),J.prev=new i.Buf16(J.w_size),J.lit_bufsize=1<<P+6,J.pending_buf_size=4*J.lit_bufsize,J.pending_buf=new i.Buf8(J.pending_buf_size),J.d_buf=1*J.lit_bufsize,J.l_buf=3*J.lit_bufsize,J.level=ne,J.strategy=q,J.method=Q,_e(_)}s=[new pe(0,0,0,0,function(_,ne){var Q=65535;for(Q>_.pending_buf_size-5&&(Q=_.pending_buf_size-5);;){if(_.lookahead<=1){if(fe(_),_.lookahead===0&&ne===f)return w;if(_.lookahead===0)break}_.strstart+=_.lookahead,_.lookahead=0;var M=_.block_start+Q;if((_.strstart===0||_.strstart>=M)&&(_.lookahead=_.strstart-M,_.strstart=M,G(_,!1),_.strm.avail_out===0)||_.strstart-_.block_start>=_.w_size-B&&(G(_,!1),_.strm.avail_out===0))return w}return _.insert=0,ne===h?(G(_,!0),_.strm.avail_out===0?W:U):(_.strstart>_.block_start&&(G(_,!1),_.strm.avail_out),w)}),new pe(4,4,8,4,le),new pe(4,5,16,8,le),new pe(4,6,32,32,le),new pe(4,4,16,16,de),new pe(8,16,32,32,de),new pe(8,16,128,128,de),new pe(8,32,128,256,de),new pe(32,128,258,1024,de),new pe(32,258,258,4096,de)],o.deflateInit=function(_,ne){return Pe(_,ne,v,15,8,0)},o.deflateInit2=Pe,o.deflateReset=_e,o.deflateResetKeep=me,o.deflateSetHeader=function(_,ne){return _&&_.state?_.state.wrap!==2?y:(_.state.gzhead=ne,p):y},o.deflate=function(_,ne){var Q,M,P,q;if(!_||!_.state||5<ne||ne<0)return _?F(_,y):y;if(M=_.state,!_.output||!_.input&&_.avail_in!==0||M.status===666&&ne!==h)return F(_,_.avail_out===0?-5:y);if(M.strm=_,Q=M.last_flush,M.last_flush=ne,M.status===N)if(M.wrap===2)_.adler=0,R(M,31),R(M,139),R(M,8),M.gzhead?(R(M,(M.gzhead.text?1:0)+(M.gzhead.hcrc?2:0)+(M.gzhead.extra?4:0)+(M.gzhead.name?8:0)+(M.gzhead.comment?16:0)),R(M,255&M.gzhead.time),R(M,M.gzhead.time>>8&255),R(M,M.gzhead.time>>16&255),R(M,M.gzhead.time>>24&255),R(M,M.level===9?2:2<=M.strategy||M.level<2?4:0),R(M,255&M.gzhead.os),M.gzhead.extra&&M.gzhead.extra.length&&(R(M,255&M.gzhead.extra.length),R(M,M.gzhead.extra.length>>8&255)),M.gzhead.hcrc&&(_.adler=u(_.adler,M.pending_buf,M.pending,0)),M.gzindex=0,M.status=69):(R(M,0),R(M,0),R(M,0),R(M,0),R(M,0),R(M,M.level===9?2:2<=M.strategy||M.level<2?4:0),R(M,3),M.status=D);else{var Z=v+(M.w_bits-8<<4)<<8;Z|=(2<=M.strategy||M.level<2?0:M.level<6?1:M.level===6?2:3)<<6,M.strstart!==0&&(Z|=32),Z+=31-Z%31,M.status=D,ae(M,Z),M.strstart!==0&&(ae(M,_.adler>>>16),ae(M,65535&_.adler)),_.adler=1}if(M.status===69)if(M.gzhead.extra){for(P=M.pending;M.gzindex<(65535&M.gzhead.extra.length)&&(M.pending!==M.pending_buf_size||(M.gzhead.hcrc&&M.pending>P&&(_.adler=u(_.adler,M.pending_buf,M.pending-P,P)),H(_),P=M.pending,M.pending!==M.pending_buf_size));)R(M,255&M.gzhead.extra[M.gzindex]),M.gzindex++;M.gzhead.hcrc&&M.pending>P&&(_.adler=u(_.adler,M.pending_buf,M.pending-P,P)),M.gzindex===M.gzhead.extra.length&&(M.gzindex=0,M.status=73)}else M.status=73;if(M.status===73)if(M.gzhead.name){P=M.pending;do{if(M.pending===M.pending_buf_size&&(M.gzhead.hcrc&&M.pending>P&&(_.adler=u(_.adler,M.pending_buf,M.pending-P,P)),H(_),P=M.pending,M.pending===M.pending_buf_size)){q=1;break}q=M.gzindex<M.gzhead.name.length?255&M.gzhead.name.charCodeAt(M.gzindex++):0,R(M,q)}while(q!==0);M.gzhead.hcrc&&M.pending>P&&(_.adler=u(_.adler,M.pending_buf,M.pending-P,P)),q===0&&(M.gzindex=0,M.status=91)}else M.status=91;if(M.status===91)if(M.gzhead.comment){P=M.pending;do{if(M.pending===M.pending_buf_size&&(M.gzhead.hcrc&&M.pending>P&&(_.adler=u(_.adler,M.pending_buf,M.pending-P,P)),H(_),P=M.pending,M.pending===M.pending_buf_size)){q=1;break}q=M.gzindex<M.gzhead.comment.length?255&M.gzhead.comment.charCodeAt(M.gzindex++):0,R(M,q)}while(q!==0);M.gzhead.hcrc&&M.pending>P&&(_.adler=u(_.adler,M.pending_buf,M.pending-P,P)),q===0&&(M.status=103)}else M.status=103;if(M.status===103&&(M.gzhead.hcrc?(M.pending+2>M.pending_buf_size&&H(_),M.pending+2<=M.pending_buf_size&&(R(M,255&_.adler),R(M,_.adler>>8&255),_.adler=0,M.status=D)):M.status=D),M.pending!==0){if(H(_),_.avail_out===0)return M.last_flush=-1,p}else if(_.avail_in===0&&K(ne)<=K(Q)&&ne!==h)return F(_,-5);if(M.status===666&&_.avail_in!==0)return F(_,-5);if(_.avail_in!==0||M.lookahead!==0||ne!==f&&M.status!==666){var J=M.strategy===2?(function(V,se){for(var Y;;){if(V.lookahead===0&&(fe(V),V.lookahead===0)){if(se===f)return w;break}if(V.match_length=0,Y=l._tr_tally(V,0,V.window[V.strstart]),V.lookahead--,V.strstart++,Y&&(G(V,!1),V.strm.avail_out===0))return w}return V.insert=0,se===h?(G(V,!0),V.strm.avail_out===0?W:U):V.last_lit&&(G(V,!1),V.strm.avail_out===0)?w:L})(M,ne):M.strategy===3?(function(V,se){for(var Y,ee,$,X,ce=V.window;;){if(V.lookahead<=O){if(fe(V),V.lookahead<=O&&se===f)return w;if(V.lookahead===0)break}if(V.match_length=0,V.lookahead>=z&&0<V.strstart&&(ee=ce[$=V.strstart-1])===ce[++$]&&ee===ce[++$]&&ee===ce[++$]){X=V.strstart+O;do;while(ee===ce[++$]&&ee===ce[++$]&&ee===ce[++$]&&ee===ce[++$]&&ee===ce[++$]&&ee===ce[++$]&&ee===ce[++$]&&ee===ce[++$]&&$<X);V.match_length=O-(X-$),V.match_length>V.lookahead&&(V.match_length=V.lookahead)}if(V.match_length>=z?(Y=l._tr_tally(V,1,V.match_length-z),V.lookahead-=V.match_length,V.strstart+=V.match_length,V.match_length=0):(Y=l._tr_tally(V,0,V.window[V.strstart]),V.lookahead--,V.strstart++),Y&&(G(V,!1),V.strm.avail_out===0))return w}return V.insert=0,se===h?(G(V,!0),V.strm.avail_out===0?W:U):V.last_lit&&(G(V,!1),V.strm.avail_out===0)?w:L})(M,ne):s[M.level].func(M,ne);if(J!==W&&J!==U||(M.status=666),J===w||J===W)return _.avail_out===0&&(M.last_flush=-1),p;if(J===L&&(ne===1?l._tr_align(M):ne!==5&&(l._tr_stored_block(M,0,0,!1),ne===3&&(I(M.head),M.lookahead===0&&(M.strstart=0,M.block_start=0,M.insert=0))),H(_),_.avail_out===0))return M.last_flush=-1,p}return ne!==h?p:M.wrap<=0?1:(M.wrap===2?(R(M,255&_.adler),R(M,_.adler>>8&255),R(M,_.adler>>16&255),R(M,_.adler>>24&255),R(M,255&_.total_in),R(M,_.total_in>>8&255),R(M,_.total_in>>16&255),R(M,_.total_in>>24&255)):(ae(M,_.adler>>>16),ae(M,65535&_.adler)),H(_),0<M.wrap&&(M.wrap=-M.wrap),M.pending!==0?p:1)},o.deflateEnd=function(_){var ne;return _&&_.state?(ne=_.state.status)!==N&&ne!==69&&ne!==73&&ne!==91&&ne!==103&&ne!==D&&ne!==666?F(_,y):(_.state=null,ne===D?F(_,-3):p):y},o.deflateSetDictionary=function(_,ne){var Q,M,P,q,Z,J,V,se,Y=ne.length;if(!_||!_.state||(q=(Q=_.state).wrap)===2||q===1&&Q.status!==N||Q.lookahead)return y;for(q===1&&(_.adler=c(_.adler,ne,Y,0)),Q.wrap=0,Y>=Q.w_size&&(q===0&&(I(Q.head),Q.strstart=0,Q.block_start=0,Q.insert=0),se=new i.Buf8(Q.w_size),i.arraySet(se,ne,Y-Q.w_size,Q.w_size,0),ne=se,Y=Q.w_size),Z=_.avail_in,J=_.next_in,V=_.input,_.avail_in=Y,_.next_in=0,_.input=ne,fe(Q);Q.lookahead>=z;){for(M=Q.strstart,P=Q.lookahead-(z-1);Q.ins_h=(Q.ins_h<<Q.hash_shift^Q.window[M+z-1])&Q.hash_mask,Q.prev[M&Q.w_mask]=Q.head[Q.ins_h],Q.head[Q.ins_h]=M,M++,--P;);Q.strstart=M,Q.lookahead=z-1,fe(Q)}return Q.strstart+=Q.lookahead,Q.block_start=Q.strstart,Q.insert=Q.lookahead,Q.lookahead=0,Q.match_length=Q.prev_length=z-1,Q.match_available=0,_.next_in=J,_.input=V,_.avail_in=Z,Q.wrap=q,p},o.deflateInfo="pako deflate (from Nodeca project)"},{"../utils/common":41,"./adler32":43,"./crc32":45,"./messages":51,"./trees":52}],47:[function(n,r,o){r.exports=function(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1}},{}],48:[function(n,r,o){r.exports=function(s,i){var l,c,u,d,f,h,p,y,m,g,b,v,k,S,C,j,E,T,z,O,B,N,D,w,L;l=s.state,c=s.next_in,w=s.input,u=c+(s.avail_in-5),d=s.next_out,L=s.output,f=d-(i-s.avail_out),h=d+(s.avail_out-257),p=l.dmax,y=l.wsize,m=l.whave,g=l.wnext,b=l.window,v=l.hold,k=l.bits,S=l.lencode,C=l.distcode,j=(1<<l.lenbits)-1,E=(1<<l.distbits)-1;e:do{k<15&&(v+=w[c++]<<k,k+=8,v+=w[c++]<<k,k+=8),T=S[v&j];t:for(;;){if(v>>>=z=T>>>24,k-=z,(z=T>>>16&255)===0)L[d++]=65535&T;else{if(!(16&z)){if((64&z)==0){T=S[(65535&T)+(v&(1<<z)-1)];continue t}if(32&z){l.mode=12;break e}s.msg="invalid literal/length code",l.mode=30;break e}O=65535&T,(z&=15)&&(k<z&&(v+=w[c++]<<k,k+=8),O+=v&(1<<z)-1,v>>>=z,k-=z),k<15&&(v+=w[c++]<<k,k+=8,v+=w[c++]<<k,k+=8),T=C[v&E];n:for(;;){if(v>>>=z=T>>>24,k-=z,!(16&(z=T>>>16&255))){if((64&z)==0){T=C[(65535&T)+(v&(1<<z)-1)];continue n}s.msg="invalid distance code",l.mode=30;break e}if(B=65535&T,k<(z&=15)&&(v+=w[c++]<<k,(k+=8)<z&&(v+=w[c++]<<k,k+=8)),p<(B+=v&(1<<z)-1)){s.msg="invalid distance too far back",l.mode=30;break e}if(v>>>=z,k-=z,(z=d-f)<B){if(m<(z=B-z)&&l.sane){s.msg="invalid distance too far back",l.mode=30;break e}if(D=b,(N=0)===g){if(N+=y-z,z<O){for(O-=z;L[d++]=b[N++],--z;);N=d-B,D=L}}else if(g<z){if(N+=y+g-z,(z-=g)<O){for(O-=z;L[d++]=b[N++],--z;);if(N=0,g<O){for(O-=z=g;L[d++]=b[N++],--z;);N=d-B,D=L}}}else if(N+=g-z,z<O){for(O-=z;L[d++]=b[N++],--z;);N=d-B,D=L}for(;2<O;)L[d++]=D[N++],L[d++]=D[N++],L[d++]=D[N++],O-=3;O&&(L[d++]=D[N++],1<O&&(L[d++]=D[N++]))}else{for(N=d-B;L[d++]=L[N++],L[d++]=L[N++],L[d++]=L[N++],2<(O-=3););O&&(L[d++]=L[N++],1<O&&(L[d++]=L[N++]))}break}}break}}while(c<u&&d<h);c-=O=k>>3,v&=(1<<(k-=O<<3))-1,s.next_in=c,s.next_out=d,s.avail_in=c<u?u-c+5:5-(c-u),s.avail_out=d<h?h-d+257:257-(d-h),l.hold=v,l.bits=k}},{}],49:[function(n,r,o){var s=n("../utils/common"),i=n("./adler32"),l=n("./crc32"),c=n("./inffast"),u=n("./inftrees"),d=1,f=2,h=0,p=-2,y=1,m=852,g=592;function b(N){return(N>>>24&255)+(N>>>8&65280)+((65280&N)<<8)+((255&N)<<24)}function v(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new s.Buf16(320),this.work=new s.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function k(N){var D;return N&&N.state?(D=N.state,N.total_in=N.total_out=D.total=0,N.msg="",D.wrap&&(N.adler=1&D.wrap),D.mode=y,D.last=0,D.havedict=0,D.dmax=32768,D.head=null,D.hold=0,D.bits=0,D.lencode=D.lendyn=new s.Buf32(m),D.distcode=D.distdyn=new s.Buf32(g),D.sane=1,D.back=-1,h):p}function S(N){var D;return N&&N.state?((D=N.state).wsize=0,D.whave=0,D.wnext=0,k(N)):p}function C(N,D){var w,L;return N&&N.state?(L=N.state,D<0?(w=0,D=-D):(w=1+(D>>4),D<48&&(D&=15)),D&&(D<8||15<D)?p:(L.window!==null&&L.wbits!==D&&(L.window=null),L.wrap=w,L.wbits=D,S(N))):p}function j(N,D){var w,L;return N?(L=new v,(N.state=L).window=null,(w=C(N,D))!==h&&(N.state=null),w):p}var E,T,z=!0;function O(N){if(z){var D;for(E=new s.Buf32(512),T=new s.Buf32(32),D=0;D<144;)N.lens[D++]=8;for(;D<256;)N.lens[D++]=9;for(;D<280;)N.lens[D++]=7;for(;D<288;)N.lens[D++]=8;for(u(d,N.lens,0,288,E,0,N.work,{bits:9}),D=0;D<32;)N.lens[D++]=5;u(f,N.lens,0,32,T,0,N.work,{bits:5}),z=!1}N.lencode=E,N.lenbits=9,N.distcode=T,N.distbits=5}function B(N,D,w,L){var W,U=N.state;return U.window===null&&(U.wsize=1<<U.wbits,U.wnext=0,U.whave=0,U.window=new s.Buf8(U.wsize)),L>=U.wsize?(s.arraySet(U.window,D,w-U.wsize,U.wsize,0),U.wnext=0,U.whave=U.wsize):(L<(W=U.wsize-U.wnext)&&(W=L),s.arraySet(U.window,D,w-L,W,U.wnext),(L-=W)?(s.arraySet(U.window,D,w-L,L,0),U.wnext=L,U.whave=U.wsize):(U.wnext+=W,U.wnext===U.wsize&&(U.wnext=0),U.whave<U.wsize&&(U.whave+=W))),0}o.inflateReset=S,o.inflateReset2=C,o.inflateResetKeep=k,o.inflateInit=function(N){return j(N,15)},o.inflateInit2=j,o.inflate=function(N,D){var w,L,W,U,F,K,I,H,G,R,ae,re,fe,le,de,pe,he,me,_e,Pe,_,ne,Q,M,P=0,q=new s.Buf8(4),Z=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];if(!N||!N.state||!N.output||!N.input&&N.avail_in!==0)return p;(w=N.state).mode===12&&(w.mode=13),F=N.next_out,W=N.output,I=N.avail_out,U=N.next_in,L=N.input,K=N.avail_in,H=w.hold,G=w.bits,R=K,ae=I,ne=h;e:for(;;)switch(w.mode){case y:if(w.wrap===0){w.mode=13;break}for(;G<16;){if(K===0)break e;K--,H+=L[U++]<<G,G+=8}if(2&w.wrap&&H===35615){q[w.check=0]=255&H,q[1]=H>>>8&255,w.check=l(w.check,q,2,0),G=H=0,w.mode=2;break}if(w.flags=0,w.head&&(w.head.done=!1),!(1&w.wrap)||(((255&H)<<8)+(H>>8))%31){N.msg="incorrect header check",w.mode=30;break}if((15&H)!=8){N.msg="unknown compression method",w.mode=30;break}if(G-=4,_=8+(15&(H>>>=4)),w.wbits===0)w.wbits=_;else if(_>w.wbits){N.msg="invalid window size",w.mode=30;break}w.dmax=1<<_,N.adler=w.check=1,w.mode=512&H?10:12,G=H=0;break;case 2:for(;G<16;){if(K===0)break e;K--,H+=L[U++]<<G,G+=8}if(w.flags=H,(255&w.flags)!=8){N.msg="unknown compression method",w.mode=30;break}if(57344&w.flags){N.msg="unknown header flags set",w.mode=30;break}w.head&&(w.head.text=H>>8&1),512&w.flags&&(q[0]=255&H,q[1]=H>>>8&255,w.check=l(w.check,q,2,0)),G=H=0,w.mode=3;case 3:for(;G<32;){if(K===0)break e;K--,H+=L[U++]<<G,G+=8}w.head&&(w.head.time=H),512&w.flags&&(q[0]=255&H,q[1]=H>>>8&255,q[2]=H>>>16&255,q[3]=H>>>24&255,w.check=l(w.check,q,4,0)),G=H=0,w.mode=4;case 4:for(;G<16;){if(K===0)break e;K--,H+=L[U++]<<G,G+=8}w.head&&(w.head.xflags=255&H,w.head.os=H>>8),512&w.flags&&(q[0]=255&H,q[1]=H>>>8&255,w.check=l(w.check,q,2,0)),G=H=0,w.mode=5;case 5:if(1024&w.flags){for(;G<16;){if(K===0)break e;K--,H+=L[U++]<<G,G+=8}w.length=H,w.head&&(w.head.extra_len=H),512&w.flags&&(q[0]=255&H,q[1]=H>>>8&255,w.check=l(w.check,q,2,0)),G=H=0}else w.head&&(w.head.extra=null);w.mode=6;case 6:if(1024&w.flags&&(K<(re=w.length)&&(re=K),re&&(w.head&&(_=w.head.extra_len-w.length,w.head.extra||(w.head.extra=new Array(w.head.extra_len)),s.arraySet(w.head.extra,L,U,re,_)),512&w.flags&&(w.check=l(w.check,L,re,U)),K-=re,U+=re,w.length-=re),w.length))break e;w.length=0,w.mode=7;case 7:if(2048&w.flags){if(K===0)break e;for(re=0;_=L[U+re++],w.head&&_&&w.length<65536&&(w.head.name+=String.fromCharCode(_)),_&&re<K;);if(512&w.flags&&(w.check=l(w.check,L,re,U)),K-=re,U+=re,_)break e}else w.head&&(w.head.name=null);w.length=0,w.mode=8;case 8:if(4096&w.flags){if(K===0)break e;for(re=0;_=L[U+re++],w.head&&_&&w.length<65536&&(w.head.comment+=String.fromCharCode(_)),_&&re<K;);if(512&w.flags&&(w.check=l(w.check,L,re,U)),K-=re,U+=re,_)break e}else w.head&&(w.head.comment=null);w.mode=9;case 9:if(512&w.flags){for(;G<16;){if(K===0)break e;K--,H+=L[U++]<<G,G+=8}if(H!==(65535&w.check)){N.msg="header crc mismatch",w.mode=30;break}G=H=0}w.head&&(w.head.hcrc=w.flags>>9&1,w.head.done=!0),N.adler=w.check=0,w.mode=12;break;case 10:for(;G<32;){if(K===0)break e;K--,H+=L[U++]<<G,G+=8}N.adler=w.check=b(H),G=H=0,w.mode=11;case 11:if(w.havedict===0)return N.next_out=F,N.avail_out=I,N.next_in=U,N.avail_in=K,w.hold=H,w.bits=G,2;N.adler=w.check=1,w.mode=12;case 12:if(D===5||D===6)break e;case 13:if(w.last){H>>>=7&G,G-=7&G,w.mode=27;break}for(;G<3;){if(K===0)break e;K--,H+=L[U++]<<G,G+=8}switch(w.last=1&H,G-=1,3&(H>>>=1)){case 0:w.mode=14;break;case 1:if(O(w),w.mode=20,D!==6)break;H>>>=2,G-=2;break e;case 2:w.mode=17;break;case 3:N.msg="invalid block type",w.mode=30}H>>>=2,G-=2;break;case 14:for(H>>>=7&G,G-=7&G;G<32;){if(K===0)break e;K--,H+=L[U++]<<G,G+=8}if((65535&H)!=(H>>>16^65535)){N.msg="invalid stored block lengths",w.mode=30;break}if(w.length=65535&H,G=H=0,w.mode=15,D===6)break e;case 15:w.mode=16;case 16:if(re=w.length){if(K<re&&(re=K),I<re&&(re=I),re===0)break e;s.arraySet(W,L,U,re,F),K-=re,U+=re,I-=re,F+=re,w.length-=re;break}w.mode=12;break;case 17:for(;G<14;){if(K===0)break e;K--,H+=L[U++]<<G,G+=8}if(w.nlen=257+(31&H),H>>>=5,G-=5,w.ndist=1+(31&H),H>>>=5,G-=5,w.ncode=4+(15&H),H>>>=4,G-=4,286<w.nlen||30<w.ndist){N.msg="too many length or distance symbols",w.mode=30;break}w.have=0,w.mode=18;case 18:for(;w.have<w.ncode;){for(;G<3;){if(K===0)break e;K--,H+=L[U++]<<G,G+=8}w.lens[Z[w.have++]]=7&H,H>>>=3,G-=3}for(;w.have<19;)w.lens[Z[w.have++]]=0;if(w.lencode=w.lendyn,w.lenbits=7,Q={bits:w.lenbits},ne=u(0,w.lens,0,19,w.lencode,0,w.work,Q),w.lenbits=Q.bits,ne){N.msg="invalid code lengths set",w.mode=30;break}w.have=0,w.mode=19;case 19:for(;w.have<w.nlen+w.ndist;){for(;pe=(P=w.lencode[H&(1<<w.lenbits)-1])>>>16&255,he=65535&P,!((de=P>>>24)<=G);){if(K===0)break e;K--,H+=L[U++]<<G,G+=8}if(he<16)H>>>=de,G-=de,w.lens[w.have++]=he;else{if(he===16){for(M=de+2;G<M;){if(K===0)break e;K--,H+=L[U++]<<G,G+=8}if(H>>>=de,G-=de,w.have===0){N.msg="invalid bit length repeat",w.mode=30;break}_=w.lens[w.have-1],re=3+(3&H),H>>>=2,G-=2}else if(he===17){for(M=de+3;G<M;){if(K===0)break e;K--,H+=L[U++]<<G,G+=8}G-=de,_=0,re=3+(7&(H>>>=de)),H>>>=3,G-=3}else{for(M=de+7;G<M;){if(K===0)break e;K--,H+=L[U++]<<G,G+=8}G-=de,_=0,re=11+(127&(H>>>=de)),H>>>=7,G-=7}if(w.have+re>w.nlen+w.ndist){N.msg="invalid bit length repeat",w.mode=30;break}for(;re--;)w.lens[w.have++]=_}}if(w.mode===30)break;if(w.lens[256]===0){N.msg="invalid code -- missing end-of-block",w.mode=30;break}if(w.lenbits=9,Q={bits:w.lenbits},ne=u(d,w.lens,0,w.nlen,w.lencode,0,w.work,Q),w.lenbits=Q.bits,ne){N.msg="invalid literal/lengths set",w.mode=30;break}if(w.distbits=6,w.distcode=w.distdyn,Q={bits:w.distbits},ne=u(f,w.lens,w.nlen,w.ndist,w.distcode,0,w.work,Q),w.distbits=Q.bits,ne){N.msg="invalid distances set",w.mode=30;break}if(w.mode=20,D===6)break e;case 20:w.mode=21;case 21:if(6<=K&&258<=I){N.next_out=F,N.avail_out=I,N.next_in=U,N.avail_in=K,w.hold=H,w.bits=G,c(N,ae),F=N.next_out,W=N.output,I=N.avail_out,U=N.next_in,L=N.input,K=N.avail_in,H=w.hold,G=w.bits,w.mode===12&&(w.back=-1);break}for(w.back=0;pe=(P=w.lencode[H&(1<<w.lenbits)-1])>>>16&255,he=65535&P,!((de=P>>>24)<=G);){if(K===0)break e;K--,H+=L[U++]<<G,G+=8}if(pe&&(240&pe)==0){for(me=de,_e=pe,Pe=he;pe=(P=w.lencode[Pe+((H&(1<<me+_e)-1)>>me)])>>>16&255,he=65535&P,!(me+(de=P>>>24)<=G);){if(K===0)break e;K--,H+=L[U++]<<G,G+=8}H>>>=me,G-=me,w.back+=me}if(H>>>=de,G-=de,w.back+=de,w.length=he,pe===0){w.mode=26;break}if(32&pe){w.back=-1,w.mode=12;break}if(64&pe){N.msg="invalid literal/length code",w.mode=30;break}w.extra=15&pe,w.mode=22;case 22:if(w.extra){for(M=w.extra;G<M;){if(K===0)break e;K--,H+=L[U++]<<G,G+=8}w.length+=H&(1<<w.extra)-1,H>>>=w.extra,G-=w.extra,w.back+=w.extra}w.was=w.length,w.mode=23;case 23:for(;pe=(P=w.distcode[H&(1<<w.distbits)-1])>>>16&255,he=65535&P,!((de=P>>>24)<=G);){if(K===0)break e;K--,H+=L[U++]<<G,G+=8}if((240&pe)==0){for(me=de,_e=pe,Pe=he;pe=(P=w.distcode[Pe+((H&(1<<me+_e)-1)>>me)])>>>16&255,he=65535&P,!(me+(de=P>>>24)<=G);){if(K===0)break e;K--,H+=L[U++]<<G,G+=8}H>>>=me,G-=me,w.back+=me}if(H>>>=de,G-=de,w.back+=de,64&pe){N.msg="invalid distance code",w.mode=30;break}w.offset=he,w.extra=15&pe,w.mode=24;case 24:if(w.extra){for(M=w.extra;G<M;){if(K===0)break e;K--,H+=L[U++]<<G,G+=8}w.offset+=H&(1<<w.extra)-1,H>>>=w.extra,G-=w.extra,w.back+=w.extra}if(w.offset>w.dmax){N.msg="invalid distance too far back",w.mode=30;break}w.mode=25;case 25:if(I===0)break e;if(re=ae-I,w.offset>re){if((re=w.offset-re)>w.whave&&w.sane){N.msg="invalid distance too far back",w.mode=30;break}fe=re>w.wnext?(re-=w.wnext,w.wsize-re):w.wnext-re,re>w.length&&(re=w.length),le=w.window}else le=W,fe=F-w.offset,re=w.length;for(I<re&&(re=I),I-=re,w.length-=re;W[F++]=le[fe++],--re;);w.length===0&&(w.mode=21);break;case 26:if(I===0)break e;W[F++]=w.length,I--,w.mode=21;break;case 27:if(w.wrap){for(;G<32;){if(K===0)break e;K--,H|=L[U++]<<G,G+=8}if(ae-=I,N.total_out+=ae,w.total+=ae,ae&&(N.adler=w.check=w.flags?l(w.check,W,ae,F-ae):i(w.check,W,ae,F-ae)),ae=I,(w.flags?H:b(H))!==w.check){N.msg="incorrect data check",w.mode=30;break}G=H=0}w.mode=28;case 28:if(w.wrap&&w.flags){for(;G<32;){if(K===0)break e;K--,H+=L[U++]<<G,G+=8}if(H!==(4294967295&w.total)){N.msg="incorrect length check",w.mode=30;break}G=H=0}w.mode=29;case 29:ne=1;break e;case 30:ne=-3;break e;case 31:return-4;default:return p}return N.next_out=F,N.avail_out=I,N.next_in=U,N.avail_in=K,w.hold=H,w.bits=G,(w.wsize||ae!==N.avail_out&&w.mode<30&&(w.mode<27||D!==4))&&B(N,N.output,N.next_out,ae-N.avail_out)?(w.mode=31,-4):(R-=N.avail_in,ae-=N.avail_out,N.total_in+=R,N.total_out+=ae,w.total+=ae,w.wrap&&ae&&(N.adler=w.check=w.flags?l(w.check,W,ae,N.next_out-ae):i(w.check,W,ae,N.next_out-ae)),N.data_type=w.bits+(w.last?64:0)+(w.mode===12?128:0)+(w.mode===20||w.mode===15?256:0),(R==0&&ae===0||D===4)&&ne===h&&(ne=-5),ne)},o.inflateEnd=function(N){if(!N||!N.state)return p;var D=N.state;return D.window&&(D.window=null),N.state=null,h},o.inflateGetHeader=function(N,D){var w;return N&&N.state?(2&(w=N.state).wrap)==0?p:((w.head=D).done=!1,h):p},o.inflateSetDictionary=function(N,D){var w,L=D.length;return N&&N.state?(w=N.state).wrap!==0&&w.mode!==11?p:w.mode===11&&i(1,D,L,0)!==w.check?-3:B(N,D,L,L)?(w.mode=31,-4):(w.havedict=1,h):p},o.inflateInfo="pako inflate (from Nodeca project)"},{"../utils/common":41,"./adler32":43,"./crc32":45,"./inffast":48,"./inftrees":50}],50:[function(n,r,o){var s=n("../utils/common"),i=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0],l=[16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78],c=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0],u=[16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64];r.exports=function(d,f,h,p,y,m,g,b){var v,k,S,C,j,E,T,z,O,B=b.bits,N=0,D=0,w=0,L=0,W=0,U=0,F=0,K=0,I=0,H=0,G=null,R=0,ae=new s.Buf16(16),re=new s.Buf16(16),fe=null,le=0;for(N=0;N<=15;N++)ae[N]=0;for(D=0;D<p;D++)ae[f[h+D]]++;for(W=B,L=15;1<=L&&ae[L]===0;L--);if(L<W&&(W=L),L===0)return y[m++]=20971520,y[m++]=20971520,b.bits=1,0;for(w=1;w<L&&ae[w]===0;w++);for(W<w&&(W=w),N=K=1;N<=15;N++)if(K<<=1,(K-=ae[N])<0)return-1;if(0<K&&(d===0||L!==1))return-1;for(re[1]=0,N=1;N<15;N++)re[N+1]=re[N]+ae[N];for(D=0;D<p;D++)f[h+D]!==0&&(g[re[f[h+D]]++]=D);if(E=d===0?(G=fe=g,19):d===1?(G=i,R-=257,fe=l,le-=257,256):(G=c,fe=u,-1),N=w,j=m,F=D=H=0,S=-1,C=(I=1<<(U=W))-1,d===1&&852<I||d===2&&592<I)return 1;for(;;){for(T=N-F,O=g[D]<E?(z=0,g[D]):g[D]>E?(z=fe[le+g[D]],G[R+g[D]]):(z=96,0),v=1<<N-F,w=k=1<<U;y[j+(H>>F)+(k-=v)]=T<<24|z<<16|O|0,k!==0;);for(v=1<<N-1;H&v;)v>>=1;if(v!==0?(H&=v-1,H+=v):H=0,D++,--ae[N]==0){if(N===L)break;N=f[h+g[D]]}if(W<N&&(H&C)!==S){for(F===0&&(F=W),j+=w,K=1<<(U=N-F);U+F<L&&!((K-=ae[U+F])<=0);)U++,K<<=1;if(I+=1<<U,d===1&&852<I||d===2&&592<I)return 1;y[S=H&C]=W<<24|U<<16|j-m|0}}return H!==0&&(y[j+H]=N-F<<24|64<<16|0),b.bits=W,0}},{"../utils/common":41}],51:[function(n,r,o){r.exports={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"}},{}],52:[function(n,r,o){var s=n("../utils/common"),i=0,l=1;function c(P){for(var q=P.length;0<=--q;)P[q]=0}var u=0,d=29,f=256,h=f+1+d,p=30,y=19,m=2*h+1,g=15,b=16,v=7,k=256,S=16,C=17,j=18,E=[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0],T=[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13],z=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],O=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],B=new Array(2*(h+2));c(B);var N=new Array(2*p);c(N);var D=new Array(512);c(D);var w=new Array(256);c(w);var L=new Array(d);c(L);var W,U,F,K=new Array(p);function I(P,q,Z,J,V){this.static_tree=P,this.extra_bits=q,this.extra_base=Z,this.elems=J,this.max_length=V,this.has_stree=P&&P.length}function H(P,q){this.dyn_tree=P,this.max_code=0,this.stat_desc=q}function G(P){return P<256?D[P]:D[256+(P>>>7)]}function R(P,q){P.pending_buf[P.pending++]=255&q,P.pending_buf[P.pending++]=q>>>8&255}function ae(P,q,Z){P.bi_valid>b-Z?(P.bi_buf|=q<<P.bi_valid&65535,R(P,P.bi_buf),P.bi_buf=q>>b-P.bi_valid,P.bi_valid+=Z-b):(P.bi_buf|=q<<P.bi_valid&65535,P.bi_valid+=Z)}function re(P,q,Z){ae(P,Z[2*q],Z[2*q+1])}function fe(P,q){for(var Z=0;Z|=1&P,P>>>=1,Z<<=1,0<--q;);return Z>>>1}function le(P,q,Z){var J,V,se=new Array(g+1),Y=0;for(J=1;J<=g;J++)se[J]=Y=Y+Z[J-1]<<1;for(V=0;V<=q;V++){var ee=P[2*V+1];ee!==0&&(P[2*V]=fe(se[ee]++,ee))}}function de(P){var q;for(q=0;q<h;q++)P.dyn_ltree[2*q]=0;for(q=0;q<p;q++)P.dyn_dtree[2*q]=0;for(q=0;q<y;q++)P.bl_tree[2*q]=0;P.dyn_ltree[2*k]=1,P.opt_len=P.static_len=0,P.last_lit=P.matches=0}function pe(P){8<P.bi_valid?R(P,P.bi_buf):0<P.bi_valid&&(P.pending_buf[P.pending++]=P.bi_buf),P.bi_buf=0,P.bi_valid=0}function he(P,q,Z,J){var V=2*q,se=2*Z;return P[V]<P[se]||P[V]===P[se]&&J[q]<=J[Z]}function me(P,q,Z){for(var J=P.heap[Z],V=Z<<1;V<=P.heap_len&&(V<P.heap_len&&he(q,P.heap[V+1],P.heap[V],P.depth)&&V++,!he(q,J,P.heap[V],P.depth));)P.heap[Z]=P.heap[V],Z=V,V<<=1;P.heap[Z]=J}function _e(P,q,Z){var J,V,se,Y,ee=0;if(P.last_lit!==0)for(;J=P.pending_buf[P.d_buf+2*ee]<<8|P.pending_buf[P.d_buf+2*ee+1],V=P.pending_buf[P.l_buf+ee],ee++,J===0?re(P,V,q):(re(P,(se=w[V])+f+1,q),(Y=E[se])!==0&&ae(P,V-=L[se],Y),re(P,se=G(--J),Z),(Y=T[se])!==0&&ae(P,J-=K[se],Y)),ee<P.last_lit;);re(P,k,q)}function Pe(P,q){var Z,J,V,se=q.dyn_tree,Y=q.stat_desc.static_tree,ee=q.stat_desc.has_stree,$=q.stat_desc.elems,X=-1;for(P.heap_len=0,P.heap_max=m,Z=0;Z<$;Z++)se[2*Z]!==0?(P.heap[++P.heap_len]=X=Z,P.depth[Z]=0):se[2*Z+1]=0;for(;P.heap_len<2;)se[2*(V=P.heap[++P.heap_len]=X<2?++X:0)]=1,P.depth[V]=0,P.opt_len--,ee&&(P.static_len-=Y[2*V+1]);for(q.max_code=X,Z=P.heap_len>>1;1<=Z;Z--)me(P,se,Z);for(V=$;Z=P.heap[1],P.heap[1]=P.heap[P.heap_len--],me(P,se,1),J=P.heap[1],P.heap[--P.heap_max]=Z,P.heap[--P.heap_max]=J,se[2*V]=se[2*Z]+se[2*J],P.depth[V]=(P.depth[Z]>=P.depth[J]?P.depth[Z]:P.depth[J])+1,se[2*Z+1]=se[2*J+1]=V,P.heap[1]=V++,me(P,se,1),2<=P.heap_len;);P.heap[--P.heap_max]=P.heap[1],(function(ce,xe){var Ne,Ue,mt,Oe,Ot,Gt,Je=xe.dyn_tree,Jt=xe.max_code,Nt=xe.stat_desc.static_tree,ex=xe.stat_desc.has_stree,tx=xe.stat_desc.extra_bits,Bl=xe.stat_desc.extra_base,yr=xe.stat_desc.max_length,to=0;for(Oe=0;Oe<=g;Oe++)ce.bl_count[Oe]=0;for(Je[2*ce.heap[ce.heap_max]+1]=0,Ne=ce.heap_max+1;Ne<m;Ne++)yr<(Oe=Je[2*Je[2*(Ue=ce.heap[Ne])+1]+1]+1)&&(Oe=yr,to++),Je[2*Ue+1]=Oe,Jt<Ue||(ce.bl_count[Oe]++,Ot=0,Bl<=Ue&&(Ot=tx[Ue-Bl]),Gt=Je[2*Ue],ce.opt_len+=Gt*(Oe+Ot),ex&&(ce.static_len+=Gt*(Nt[2*Ue+1]+Ot)));if(to!==0){do{for(Oe=yr-1;ce.bl_count[Oe]===0;)Oe--;ce.bl_count[Oe]--,ce.bl_count[Oe+1]+=2,ce.bl_count[yr]--,to-=2}while(0<to);for(Oe=yr;Oe!==0;Oe--)for(Ue=ce.bl_count[Oe];Ue!==0;)Jt<(mt=ce.heap[--Ne])||(Je[2*mt+1]!==Oe&&(ce.opt_len+=(Oe-Je[2*mt+1])*Je[2*mt],Je[2*mt+1]=Oe),Ue--)}})(P,q),le(se,X,P.bl_count)}function _(P,q,Z){var J,V,se=-1,Y=q[1],ee=0,$=7,X=4;for(Y===0&&($=138,X=3),q[2*(Z+1)+1]=65535,J=0;J<=Z;J++)V=Y,Y=q[2*(J+1)+1],++ee<$&&V===Y||(ee<X?P.bl_tree[2*V]+=ee:V!==0?(V!==se&&P.bl_tree[2*V]++,P.bl_tree[2*S]++):ee<=10?P.bl_tree[2*C]++:P.bl_tree[2*j]++,se=V,X=(ee=0)===Y?($=138,3):V===Y?($=6,3):($=7,4))}function ne(P,q,Z){var J,V,se=-1,Y=q[1],ee=0,$=7,X=4;for(Y===0&&($=138,X=3),J=0;J<=Z;J++)if(V=Y,Y=q[2*(J+1)+1],!(++ee<$&&V===Y)){if(ee<X)for(;re(P,V,P.bl_tree),--ee!=0;);else V!==0?(V!==se&&(re(P,V,P.bl_tree),ee--),re(P,S,P.bl_tree),ae(P,ee-3,2)):ee<=10?(re(P,C,P.bl_tree),ae(P,ee-3,3)):(re(P,j,P.bl_tree),ae(P,ee-11,7));se=V,X=(ee=0)===Y?($=138,3):V===Y?($=6,3):($=7,4)}}c(K);var Q=!1;function M(P,q,Z,J){ae(P,(u<<1)+(J?1:0),3),(function(V,se,Y,ee){pe(V),R(V,Y),R(V,~Y),s.arraySet(V.pending_buf,V.window,se,Y,V.pending),V.pending+=Y})(P,q,Z)}o._tr_init=function(P){Q||((function(){var q,Z,J,V,se,Y=new Array(g+1);for(V=J=0;V<d-1;V++)for(L[V]=J,q=0;q<1<<E[V];q++)w[J++]=V;for(w[J-1]=V,V=se=0;V<16;V++)for(K[V]=se,q=0;q<1<<T[V];q++)D[se++]=V;for(se>>=7;V<p;V++)for(K[V]=se<<7,q=0;q<1<<T[V]-7;q++)D[256+se++]=V;for(Z=0;Z<=g;Z++)Y[Z]=0;for(q=0;q<=143;)B[2*q+1]=8,q++,Y[8]++;for(;q<=255;)B[2*q+1]=9,q++,Y[9]++;for(;q<=279;)B[2*q+1]=7,q++,Y[7]++;for(;q<=287;)B[2*q+1]=8,q++,Y[8]++;for(le(B,h+1,Y),q=0;q<p;q++)N[2*q+1]=5,N[2*q]=fe(q,5);W=new I(B,E,f+1,h,g),U=new I(N,T,0,p,g),F=new I(new Array(0),z,0,y,v)})(),Q=!0),P.l_desc=new H(P.dyn_ltree,W),P.d_desc=new H(P.dyn_dtree,U),P.bl_desc=new H(P.bl_tree,F),P.bi_buf=0,P.bi_valid=0,de(P)},o._tr_stored_block=M,o._tr_flush_block=function(P,q,Z,J){var V,se,Y=0;0<P.level?(P.strm.data_type===2&&(P.strm.data_type=(function(ee){var $,X=4093624447;for($=0;$<=31;$++,X>>>=1)if(1&X&&ee.dyn_ltree[2*$]!==0)return i;if(ee.dyn_ltree[18]!==0||ee.dyn_ltree[20]!==0||ee.dyn_ltree[26]!==0)return l;for($=32;$<f;$++)if(ee.dyn_ltree[2*$]!==0)return l;return i})(P)),Pe(P,P.l_desc),Pe(P,P.d_desc),Y=(function(ee){var $;for(_(ee,ee.dyn_ltree,ee.l_desc.max_code),_(ee,ee.dyn_dtree,ee.d_desc.max_code),Pe(ee,ee.bl_desc),$=y-1;3<=$&&ee.bl_tree[2*O[$]+1]===0;$--);return ee.opt_len+=3*($+1)+5+5+4,$})(P),V=P.opt_len+3+7>>>3,(se=P.static_len+3+7>>>3)<=V&&(V=se)):V=se=Z+5,Z+4<=V&&q!==-1?M(P,q,Z,J):P.strategy===4||se===V?(ae(P,2+(J?1:0),3),_e(P,B,N)):(ae(P,4+(J?1:0),3),(function(ee,$,X,ce){var xe;for(ae(ee,$-257,5),ae(ee,X-1,5),ae(ee,ce-4,4),xe=0;xe<ce;xe++)ae(ee,ee.bl_tree[2*O[xe]+1],3);ne(ee,ee.dyn_ltree,$-1),ne(ee,ee.dyn_dtree,X-1)})(P,P.l_desc.max_code+1,P.d_desc.max_code+1,Y+1),_e(P,P.dyn_ltree,P.dyn_dtree)),de(P),J&&pe(P)},o._tr_tally=function(P,q,Z){return P.pending_buf[P.d_buf+2*P.last_lit]=q>>>8&255,P.pending_buf[P.d_buf+2*P.last_lit+1]=255&q,P.pending_buf[P.l_buf+P.last_lit]=255&Z,P.last_lit++,q===0?P.dyn_ltree[2*Z]++:(P.matches++,q--,P.dyn_ltree[2*(w[Z]+f+1)]++,P.dyn_dtree[2*G(q)]++),P.last_lit===P.lit_bufsize-1},o._tr_align=function(P){ae(P,2,3),re(P,k,B),(function(q){q.bi_valid===16?(R(q,q.bi_buf),q.bi_buf=0,q.bi_valid=0):8<=q.bi_valid&&(q.pending_buf[q.pending++]=255&q.bi_buf,q.bi_buf>>=8,q.bi_valid-=8)})(P)}},{"../utils/common":41}],53:[function(n,r,o){r.exports=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}},{}],54:[function(n,r,o){(function(s){(function(i,l){if(!i.setImmediate){var c,u,d,f,h=1,p={},y=!1,m=i.document,g=Object.getPrototypeOf&&Object.getPrototypeOf(i);g=g&&g.setTimeout?g:i,c={}.toString.call(i.process)==="[object process]"?function(S){process.nextTick(function(){v(S)})}:(function(){if(i.postMessage&&!i.importScripts){var S=!0,C=i.onmessage;return i.onmessage=function(){S=!1},i.postMessage("","*"),i.onmessage=C,S}})()?(f="setImmediate$"+Math.random()+"$",i.addEventListener?i.addEventListener("message",k,!1):i.attachEvent("onmessage",k),function(S){i.postMessage(f+S,"*")}):i.MessageChannel?((d=new MessageChannel).port1.onmessage=function(S){v(S.data)},function(S){d.port2.postMessage(S)}):m&&"onreadystatechange"in m.createElement("script")?(u=m.documentElement,function(S){var C=m.createElement("script");C.onreadystatechange=function(){v(S),C.onreadystatechange=null,u.removeChild(C),C=null},u.appendChild(C)}):function(S){setTimeout(v,0,S)},g.setImmediate=function(S){typeof S!="function"&&(S=new Function(""+S));for(var C=new Array(arguments.length-1),j=0;j<C.length;j++)C[j]=arguments[j+1];var E={callback:S,args:C};return p[h]=E,c(h),h++},g.clearImmediate=b}function b(S){delete p[S]}function v(S){if(y)setTimeout(v,0,S);else{var C=p[S];if(C){y=!0;try{(function(j){var E=j.callback,T=j.args;switch(T.length){case 0:E();break;case 1:E(T[0]);break;case 2:E(T[0],T[1]);break;case 3:E(T[0],T[1],T[2]);break;default:E.apply(l,T)}})(C)}finally{b(S),y=!1}}}}function k(S){S.source===i&&typeof S.data=="string"&&S.data.indexOf(f)===0&&v(+S.data.slice(f.length))}})(typeof self>"u"?s===void 0?this:s:self)}).call(this,typeof no<"u"?no:typeof self<"u"?self:typeof window<"u"?window:{})},{}]},{},[10])(10)})})(Vs)),Vs.exports}var Aw=Tw();const Iw=ka(Aw),Pf="[REDACTED]",zw=/(^|[-_])(api[-_]?key|authorization|cookie|token|secret|password|access[-_]?token|refresh[-_]?token)([-_]|$)/i,Rw=[/Bearer\s+[A-Za-z0-9._~+/=-]{12,}/gi,/\bsk-[A-Za-z0-9_-]{12,}\b/g,/\bsk-ant-[A-Za-z0-9_-]{12,}\b/g,/\bghp_[A-Za-z0-9_]{12,}\b/g,/\bglpat-[A-Za-z0-9_-]{12,}\b/g],gc=200,Pw=25e6,xc=50;function Ow(e){return e<1024?`${e} chars`:e<1024*1024?`${Math.ceil(e/1024)} KB`:`${Math.ceil(e/(1024*1024))} MB`}function Mw(e){let t=0;for(const n of e)t+=n.rawRequestBody?.length??0,t+=n.responseText?.length??0;return t}function Lw(e){if(e.length>gc)return`Export is limited to ${gc} logs at once. Narrow the filter and try again.`;const t=Mw(e);return t>Pw?`Export is too large (${Ow(t)} of text). Narrow the filter and try again.`:null}async function Dw(e){try{const t=await fetch(`/api/logs/${e}/chunks`);if(!t.ok)return null;const n=await t.json();return JSON.stringify(n,null,2)}catch{return null}}function Fw(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function Li(e){if(Array.isArray(e))return e.map(n=>Li(n));if(!Fw(e))return e;const t={};for(const[n,r]of Object.entries(e))t[n]=zw.test(n)?Pf:Li(r);return t}function $w(e){const t=n=>{let r=n;for(const o of Rw)r=r.replace(o,Pf);return r};try{const n=JSON.parse(e);return t(JSON.stringify(Li(n),null,2))}catch{return t(e)}}function Hs(e,t){return t==="redacted"?$w(e):e}async function Bw(e,t="redacted"){const n=Lw(e);if(n!==null)return{ok:!1,message:n};const r=new Iw,o=t==="redacted"?"redacted":"raw",s=e.filter(u=>u.streaming).slice(0,xc);r.file("manifest.json",JSON.stringify({exportedAt:new Date().toISOString(),mode:t,redacted:t==="redacted",logCount:e.length,logIds:e.map(u=>u.id),streamingChunkExportLimit:xc,streamingChunkLogIds:s.map(u=>u.id)},null,2));for(const u of e)u.rawRequestBody!==null&&r.file(`#${u.id}.Request.json`,Hs(u.rawRequestBody,t)),u.responseText!==null&&r.file(`#${u.id}.Response.json`,Hs(u.responseText,t));for(const u of s){const d=await Dw(u.id);d!==null&&r.file(`#${u.id}.SSE.Response.json`,Hs(d,t))}const i=await r.generateAsync({type:"blob"}),l=URL.createObjectURL(i),c=document.createElement("a");return c.href=l,c.download=`agent-inspector-export-${o}-${new Date().toISOString().slice(0,10)}.zip`,document.body.appendChild(c),c.click(),document.body.removeChild(c),URL.revokeObjectURL(l),{ok:!0}}function Di(e,t){switch(t){case"full":return e;case"time":return new Date(e).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",second:"2-digit"})}}function Da(e,t,n){return`${Di(e,n)} - ${Di(t,n)}`}function Of(e){var t,n,r="";if(typeof e=="string"||typeof e=="number")r+=e;else if(typeof e=="object")if(Array.isArray(e)){var o=e.length;for(t=0;t<o;t++)e[t]&&(n=Of(e[t]))&&(r&&(r+=" "),r+=n)}else for(n in e)e[n]&&(r&&(r+=" "),r+=n);return r}function Mf(){for(var e,t,n=0,r="",o=arguments.length;n<o;n++)(e=arguments[n])&&(t=Of(e))&&(r&&(r+=" "),r+=t);return r}const Uw=(e,t)=>{const n=new Array(e.length+t.length);for(let r=0;r<e.length;r++)n[r]=e[r];for(let r=0;r<t.length;r++)n[e.length+r]=t[r];return n},Ww=(e,t)=>({classGroupId:e,validator:t}),Lf=(e=new Map,t=null,n)=>({nextPart:e,validators:t,classGroupId:n}),Do="-",bc=[],Vw="arbitrary..",Hw=e=>{const t=qw(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=e;return{getClassGroupId:i=>{if(i.startsWith("[")&&i.endsWith("]"))return Zw(i);const l=i.split(Do),c=l[0]===""&&l.length>1?1:0;return Df(l,c,t)},getConflictingClassGroupIds:(i,l)=>{if(l){const c=r[i],u=n[i];return c?u?Uw(u,c):c:u||bc}return n[i]||bc}}},Df=(e,t,n)=>{if(e.length-t===0)return n.classGroupId;const o=e[t],s=n.nextPart.get(o);if(s){const u=Df(e,t+1,s);if(u)return u}const i=n.validators;if(i===null)return;const l=t===0?e.join(Do):e.slice(t).join(Do),c=i.length;for(let u=0;u<c;u++){const d=i[u];if(d.validator(l))return d.classGroupId}},Zw=e=>e.slice(1,-1).indexOf(":")===-1?void 0:(()=>{const t=e.slice(1,-1),n=t.indexOf(":"),r=t.slice(0,n);return r?Vw+r:void 0})(),qw=e=>{const{theme:t,classGroups:n}=e;return Kw(n,t)},Kw=(e,t)=>{const n=Lf();for(const r in e){const o=e[r];Fa(o,n,r,t)}return n},Fa=(e,t,n,r)=>{const o=e.length;for(let s=0;s<o;s++){const i=e[s];Gw(i,t,n,r)}},Gw=(e,t,n,r)=>{if(typeof e=="string"){Jw(e,t,n);return}if(typeof e=="function"){Yw(e,t,n,r);return}Xw(e,t,n,r)},Jw=(e,t,n)=>{const r=e===""?t:Ff(t,e);r.classGroupId=n},Yw=(e,t,n,r)=>{if(Qw(e)){Fa(e(r),t,n,r);return}t.validators===null&&(t.validators=[]),t.validators.push(Ww(n,e))},Xw=(e,t,n,r)=>{const o=Object.entries(e),s=o.length;for(let i=0;i<s;i++){const[l,c]=o[i];Fa(c,Ff(t,l),n,r)}},Ff=(e,t)=>{let n=e;const r=t.split(Do),o=r.length;for(let s=0;s<o;s++){const i=r[s];let l=n.nextPart.get(i);l||(l=Lf(),n.nextPart.set(i,l)),n=l}return n},Qw=e=>"isThemeGetter"in e&&e.isThemeGetter===!0,ek=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,n=Object.create(null),r=Object.create(null);const o=(s,i)=>{n[s]=i,t++,t>e&&(t=0,r=n,n=Object.create(null))};return{get(s){let i=n[s];if(i!==void 0)return i;if((i=r[s])!==void 0)return o(s,i),i},set(s,i){s in n?n[s]=i:o(s,i)}}},Fi="!",yc=":",tk=[],vc=(e,t,n,r,o)=>({modifiers:e,hasImportantModifier:t,baseClassName:n,maybePostfixModifierPosition:r,isExternal:o}),nk=e=>{const{prefix:t,experimentalParseClassName:n}=e;let r=o=>{const s=[];let i=0,l=0,c=0,u;const d=o.length;for(let m=0;m<d;m++){const g=o[m];if(i===0&&l===0){if(g===yc){s.push(o.slice(c,m)),c=m+1;continue}if(g==="/"){u=m;continue}}g==="["?i++:g==="]"?i--:g==="("?l++:g===")"&&l--}const f=s.length===0?o:o.slice(c);let h=f,p=!1;f.endsWith(Fi)?(h=f.slice(0,-1),p=!0):f.startsWith(Fi)&&(h=f.slice(1),p=!0);const y=u&&u>c?u-c:void 0;return vc(s,p,h,y)};if(t){const o=t+yc,s=r;r=i=>i.startsWith(o)?s(i.slice(o.length)):vc(tk,!1,i,void 0,!0)}if(n){const o=r;r=s=>n({className:s,parseClassName:o})}return r},rk=e=>{const t=new Map;return e.orderSensitiveModifiers.forEach((n,r)=>{t.set(n,1e6+r)}),n=>{const r=[];let o=[];for(let s=0;s<n.length;s++){const i=n[s],l=i[0]==="[",c=t.has(i);l||c?(o.length>0&&(o.sort(),r.push(...o),o=[]),r.push(i)):o.push(i)}return o.length>0&&(o.sort(),r.push(...o)),r}},ok=e=>({cache:ek(e.cacheSize),parseClassName:nk(e),sortModifiers:rk(e),...Hw(e)}),sk=/\s+/,ik=(e,t)=>{const{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:o,sortModifiers:s}=t,i=[],l=e.trim().split(sk);let c="";for(let u=l.length-1;u>=0;u-=1){const d=l[u],{isExternal:f,modifiers:h,hasImportantModifier:p,baseClassName:y,maybePostfixModifierPosition:m}=n(d);if(f){c=d+(c.length>0?" "+c:c);continue}let g=!!m,b=r(g?y.substring(0,m):y);if(!b){if(!g){c=d+(c.length>0?" "+c:c);continue}if(b=r(y),!b){c=d+(c.length>0?" "+c:c);continue}g=!1}const v=h.length===0?"":h.length===1?h[0]:s(h).join(":"),k=p?v+Fi:v,S=k+b;if(i.indexOf(S)>-1)continue;i.push(S);const C=o(b,g);for(let j=0;j<C.length;++j){const E=C[j];i.push(k+E)}c=d+(c.length>0?" "+c:c)}return c},ak=(...e)=>{let t=0,n,r,o="";for(;t<e.length;)(n=e[t++])&&(r=$f(n))&&(o&&(o+=" "),o+=r);return o},$f=e=>{if(typeof e=="string")return e;let t,n="";for(let r=0;r<e.length;r++)e[r]&&(t=$f(e[r]))&&(n&&(n+=" "),n+=t);return n},lk=(e,...t)=>{let n,r,o,s;const i=c=>{const u=t.reduce((d,f)=>f(d),e());return n=ok(u),r=n.cache.get,o=n.cache.set,s=l,l(c)},l=c=>{const u=r(c);if(u)return u;const d=ik(c,n);return o(c,d),d};return s=i,(...c)=>s(ak(...c))},ck=[],et=e=>{const t=n=>n[e]||ck;return t.isThemeGetter=!0,t},Bf=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,Uf=/^\((?:(\w[\w-]*):)?(.+)\)$/i,uk=/^\d+\/\d+$/,dk=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,fk=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,pk=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,hk=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,mk=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Dn=e=>uk.test(e),Ie=e=>!!e&&!Number.isNaN(Number(e)),an=e=>!!e&&Number.isInteger(Number(e)),Zs=e=>e.endsWith("%")&&Ie(e.slice(0,-1)),Yt=e=>dk.test(e),gk=()=>!0,xk=e=>fk.test(e)&&!pk.test(e),Wf=()=>!1,bk=e=>hk.test(e),yk=e=>mk.test(e),vk=e=>!be(e)&&!ye(e),wk=e=>dr(e,Zf,Wf),be=e=>Bf.test(e),_n=e=>dr(e,qf,xk),qs=e=>dr(e,jk,Ie),wc=e=>dr(e,Vf,Wf),kk=e=>dr(e,Hf,yk),lo=e=>dr(e,Kf,bk),ye=e=>Uf.test(e),vr=e=>fr(e,qf),_k=e=>fr(e,Nk),kc=e=>fr(e,Vf),Sk=e=>fr(e,Zf),Ck=e=>fr(e,Hf),co=e=>fr(e,Kf,!0),dr=(e,t,n)=>{const r=Bf.exec(e);return r?r[1]?t(r[1]):n(r[2]):!1},fr=(e,t,n=!1)=>{const r=Uf.exec(e);return r?r[1]?t(r[1]):n:!1},Vf=e=>e==="position"||e==="percentage",Hf=e=>e==="image"||e==="url",Zf=e=>e==="length"||e==="size"||e==="bg-size",qf=e=>e==="length",jk=e=>e==="number",Nk=e=>e==="family-name",Kf=e=>e==="shadow",Ek=()=>{const e=et("color"),t=et("font"),n=et("text"),r=et("font-weight"),o=et("tracking"),s=et("leading"),i=et("breakpoint"),l=et("container"),c=et("spacing"),u=et("radius"),d=et("shadow"),f=et("inset-shadow"),h=et("text-shadow"),p=et("drop-shadow"),y=et("blur"),m=et("perspective"),g=et("aspect"),b=et("ease"),v=et("animate"),k=()=>["auto","avoid","all","avoid-page","page","left","right","column"],S=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],C=()=>[...S(),ye,be],j=()=>["auto","hidden","clip","visible","scroll"],E=()=>["auto","contain","none"],T=()=>[ye,be,c],z=()=>[Dn,"full","auto",...T()],O=()=>[an,"none","subgrid",ye,be],B=()=>["auto",{span:["full",an,ye,be]},an,ye,be],N=()=>[an,"auto",ye,be],D=()=>["auto","min","max","fr",ye,be],w=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],L=()=>["start","end","center","stretch","center-safe","end-safe"],W=()=>["auto",...T()],U=()=>[Dn,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...T()],F=()=>[e,ye,be],K=()=>[...S(),kc,wc,{position:[ye,be]}],I=()=>["no-repeat",{repeat:["","x","y","space","round"]}],H=()=>["auto","cover","contain",Sk,wk,{size:[ye,be]}],G=()=>[Zs,vr,_n],R=()=>["","none","full",u,ye,be],ae=()=>["",Ie,vr,_n],re=()=>["solid","dashed","dotted","double"],fe=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],le=()=>[Ie,Zs,kc,wc],de=()=>["","none",y,ye,be],pe=()=>["none",Ie,ye,be],he=()=>["none",Ie,ye,be],me=()=>[Ie,ye,be],_e=()=>[Dn,"full",...T()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[Yt],breakpoint:[Yt],color:[gk],container:[Yt],"drop-shadow":[Yt],ease:["in","out","in-out"],font:[vk],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[Yt],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[Yt],shadow:[Yt],spacing:["px",Ie],text:[Yt],"text-shadow":[Yt],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",Dn,be,ye,g]}],container:["container"],columns:[{columns:[Ie,be,ye,l]}],"break-after":[{"break-after":k()}],"break-before":[{"break-before":k()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:C()}],overflow:[{overflow:j()}],"overflow-x":[{"overflow-x":j()}],"overflow-y":[{"overflow-y":j()}],overscroll:[{overscroll:E()}],"overscroll-x":[{"overscroll-x":E()}],"overscroll-y":[{"overscroll-y":E()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:z()}],"inset-x":[{"inset-x":z()}],"inset-y":[{"inset-y":z()}],start:[{start:z()}],end:[{end:z()}],top:[{top:z()}],right:[{right:z()}],bottom:[{bottom:z()}],left:[{left:z()}],visibility:["visible","invisible","collapse"],z:[{z:[an,"auto",ye,be]}],basis:[{basis:[Dn,"full","auto",l,...T()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[Ie,Dn,"auto","initial","none",be]}],grow:[{grow:["",Ie,ye,be]}],shrink:[{shrink:["",Ie,ye,be]}],order:[{order:[an,"first","last","none",ye,be]}],"grid-cols":[{"grid-cols":O()}],"col-start-end":[{col:B()}],"col-start":[{"col-start":N()}],"col-end":[{"col-end":N()}],"grid-rows":[{"grid-rows":O()}],"row-start-end":[{row:B()}],"row-start":[{"row-start":N()}],"row-end":[{"row-end":N()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":D()}],"auto-rows":[{"auto-rows":D()}],gap:[{gap:T()}],"gap-x":[{"gap-x":T()}],"gap-y":[{"gap-y":T()}],"justify-content":[{justify:[...w(),"normal"]}],"justify-items":[{"justify-items":[...L(),"normal"]}],"justify-self":[{"justify-self":["auto",...L()]}],"align-content":[{content:["normal",...w()]}],"align-items":[{items:[...L(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...L(),{baseline:["","last"]}]}],"place-content":[{"place-content":w()}],"place-items":[{"place-items":[...L(),"baseline"]}],"place-self":[{"place-self":["auto",...L()]}],p:[{p:T()}],px:[{px:T()}],py:[{py:T()}],ps:[{ps:T()}],pe:[{pe:T()}],pt:[{pt:T()}],pr:[{pr:T()}],pb:[{pb:T()}],pl:[{pl:T()}],m:[{m:W()}],mx:[{mx:W()}],my:[{my:W()}],ms:[{ms:W()}],me:[{me:W()}],mt:[{mt:W()}],mr:[{mr:W()}],mb:[{mb:W()}],ml:[{ml:W()}],"space-x":[{"space-x":T()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":T()}],"space-y-reverse":["space-y-reverse"],size:[{size:U()}],w:[{w:[l,"screen",...U()]}],"min-w":[{"min-w":[l,"screen","none",...U()]}],"max-w":[{"max-w":[l,"screen","none","prose",{screen:[i]},...U()]}],h:[{h:["screen","lh",...U()]}],"min-h":[{"min-h":["screen","lh","none",...U()]}],"max-h":[{"max-h":["screen","lh",...U()]}],"font-size":[{text:["base",n,vr,_n]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[r,ye,qs]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",Zs,be]}],"font-family":[{font:[_k,be,t]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:[o,ye,be]}],"line-clamp":[{"line-clamp":[Ie,"none",ye,qs]}],leading:[{leading:[s,...T()]}],"list-image":[{"list-image":["none",ye,be]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",ye,be]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:F()}],"text-color":[{text:F()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...re(),"wavy"]}],"text-decoration-thickness":[{decoration:[Ie,"from-font","auto",ye,_n]}],"text-decoration-color":[{decoration:F()}],"underline-offset":[{"underline-offset":[Ie,"auto",ye,be]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:T()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",ye,be]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",ye,be]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:K()}],"bg-repeat":[{bg:I()}],"bg-size":[{bg:H()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},an,ye,be],radial:["",ye,be],conic:[an,ye,be]},Ck,kk]}],"bg-color":[{bg:F()}],"gradient-from-pos":[{from:G()}],"gradient-via-pos":[{via:G()}],"gradient-to-pos":[{to:G()}],"gradient-from":[{from:F()}],"gradient-via":[{via:F()}],"gradient-to":[{to:F()}],rounded:[{rounded:R()}],"rounded-s":[{"rounded-s":R()}],"rounded-e":[{"rounded-e":R()}],"rounded-t":[{"rounded-t":R()}],"rounded-r":[{"rounded-r":R()}],"rounded-b":[{"rounded-b":R()}],"rounded-l":[{"rounded-l":R()}],"rounded-ss":[{"rounded-ss":R()}],"rounded-se":[{"rounded-se":R()}],"rounded-ee":[{"rounded-ee":R()}],"rounded-es":[{"rounded-es":R()}],"rounded-tl":[{"rounded-tl":R()}],"rounded-tr":[{"rounded-tr":R()}],"rounded-br":[{"rounded-br":R()}],"rounded-bl":[{"rounded-bl":R()}],"border-w":[{border:ae()}],"border-w-x":[{"border-x":ae()}],"border-w-y":[{"border-y":ae()}],"border-w-s":[{"border-s":ae()}],"border-w-e":[{"border-e":ae()}],"border-w-t":[{"border-t":ae()}],"border-w-r":[{"border-r":ae()}],"border-w-b":[{"border-b":ae()}],"border-w-l":[{"border-l":ae()}],"divide-x":[{"divide-x":ae()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":ae()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...re(),"hidden","none"]}],"divide-style":[{divide:[...re(),"hidden","none"]}],"border-color":[{border:F()}],"border-color-x":[{"border-x":F()}],"border-color-y":[{"border-y":F()}],"border-color-s":[{"border-s":F()}],"border-color-e":[{"border-e":F()}],"border-color-t":[{"border-t":F()}],"border-color-r":[{"border-r":F()}],"border-color-b":[{"border-b":F()}],"border-color-l":[{"border-l":F()}],"divide-color":[{divide:F()}],"outline-style":[{outline:[...re(),"none","hidden"]}],"outline-offset":[{"outline-offset":[Ie,ye,be]}],"outline-w":[{outline:["",Ie,vr,_n]}],"outline-color":[{outline:F()}],shadow:[{shadow:["","none",d,co,lo]}],"shadow-color":[{shadow:F()}],"inset-shadow":[{"inset-shadow":["none",f,co,lo]}],"inset-shadow-color":[{"inset-shadow":F()}],"ring-w":[{ring:ae()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:F()}],"ring-offset-w":[{"ring-offset":[Ie,_n]}],"ring-offset-color":[{"ring-offset":F()}],"inset-ring-w":[{"inset-ring":ae()}],"inset-ring-color":[{"inset-ring":F()}],"text-shadow":[{"text-shadow":["none",h,co,lo]}],"text-shadow-color":[{"text-shadow":F()}],opacity:[{opacity:[Ie,ye,be]}],"mix-blend":[{"mix-blend":[...fe(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":fe()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[Ie]}],"mask-image-linear-from-pos":[{"mask-linear-from":le()}],"mask-image-linear-to-pos":[{"mask-linear-to":le()}],"mask-image-linear-from-color":[{"mask-linear-from":F()}],"mask-image-linear-to-color":[{"mask-linear-to":F()}],"mask-image-t-from-pos":[{"mask-t-from":le()}],"mask-image-t-to-pos":[{"mask-t-to":le()}],"mask-image-t-from-color":[{"mask-t-from":F()}],"mask-image-t-to-color":[{"mask-t-to":F()}],"mask-image-r-from-pos":[{"mask-r-from":le()}],"mask-image-r-to-pos":[{"mask-r-to":le()}],"mask-image-r-from-color":[{"mask-r-from":F()}],"mask-image-r-to-color":[{"mask-r-to":F()}],"mask-image-b-from-pos":[{"mask-b-from":le()}],"mask-image-b-to-pos":[{"mask-b-to":le()}],"mask-image-b-from-color":[{"mask-b-from":F()}],"mask-image-b-to-color":[{"mask-b-to":F()}],"mask-image-l-from-pos":[{"mask-l-from":le()}],"mask-image-l-to-pos":[{"mask-l-to":le()}],"mask-image-l-from-color":[{"mask-l-from":F()}],"mask-image-l-to-color":[{"mask-l-to":F()}],"mask-image-x-from-pos":[{"mask-x-from":le()}],"mask-image-x-to-pos":[{"mask-x-to":le()}],"mask-image-x-from-color":[{"mask-x-from":F()}],"mask-image-x-to-color":[{"mask-x-to":F()}],"mask-image-y-from-pos":[{"mask-y-from":le()}],"mask-image-y-to-pos":[{"mask-y-to":le()}],"mask-image-y-from-color":[{"mask-y-from":F()}],"mask-image-y-to-color":[{"mask-y-to":F()}],"mask-image-radial":[{"mask-radial":[ye,be]}],"mask-image-radial-from-pos":[{"mask-radial-from":le()}],"mask-image-radial-to-pos":[{"mask-radial-to":le()}],"mask-image-radial-from-color":[{"mask-radial-from":F()}],"mask-image-radial-to-color":[{"mask-radial-to":F()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":S()}],"mask-image-conic-pos":[{"mask-conic":[Ie]}],"mask-image-conic-from-pos":[{"mask-conic-from":le()}],"mask-image-conic-to-pos":[{"mask-conic-to":le()}],"mask-image-conic-from-color":[{"mask-conic-from":F()}],"mask-image-conic-to-color":[{"mask-conic-to":F()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:K()}],"mask-repeat":[{mask:I()}],"mask-size":[{mask:H()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",ye,be]}],filter:[{filter:["","none",ye,be]}],blur:[{blur:de()}],brightness:[{brightness:[Ie,ye,be]}],contrast:[{contrast:[Ie,ye,be]}],"drop-shadow":[{"drop-shadow":["","none",p,co,lo]}],"drop-shadow-color":[{"drop-shadow":F()}],grayscale:[{grayscale:["",Ie,ye,be]}],"hue-rotate":[{"hue-rotate":[Ie,ye,be]}],invert:[{invert:["",Ie,ye,be]}],saturate:[{saturate:[Ie,ye,be]}],sepia:[{sepia:["",Ie,ye,be]}],"backdrop-filter":[{"backdrop-filter":["","none",ye,be]}],"backdrop-blur":[{"backdrop-blur":de()}],"backdrop-brightness":[{"backdrop-brightness":[Ie,ye,be]}],"backdrop-contrast":[{"backdrop-contrast":[Ie,ye,be]}],"backdrop-grayscale":[{"backdrop-grayscale":["",Ie,ye,be]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[Ie,ye,be]}],"backdrop-invert":[{"backdrop-invert":["",Ie,ye,be]}],"backdrop-opacity":[{"backdrop-opacity":[Ie,ye,be]}],"backdrop-saturate":[{"backdrop-saturate":[Ie,ye,be]}],"backdrop-sepia":[{"backdrop-sepia":["",Ie,ye,be]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":T()}],"border-spacing-x":[{"border-spacing-x":T()}],"border-spacing-y":[{"border-spacing-y":T()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",ye,be]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[Ie,"initial",ye,be]}],ease:[{ease:["linear","initial",b,ye,be]}],delay:[{delay:[Ie,ye,be]}],animate:[{animate:["none",v,ye,be]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[m,ye,be]}],"perspective-origin":[{"perspective-origin":C()}],rotate:[{rotate:pe()}],"rotate-x":[{"rotate-x":pe()}],"rotate-y":[{"rotate-y":pe()}],"rotate-z":[{"rotate-z":pe()}],scale:[{scale:he()}],"scale-x":[{"scale-x":he()}],"scale-y":[{"scale-y":he()}],"scale-z":[{"scale-z":he()}],"scale-3d":["scale-3d"],skew:[{skew:me()}],"skew-x":[{"skew-x":me()}],"skew-y":[{"skew-y":me()}],transform:[{transform:[ye,be,"","none","gpu","cpu"]}],"transform-origin":[{origin:C()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:_e()}],"translate-x":[{"translate-x":_e()}],"translate-y":[{"translate-y":_e()}],"translate-z":[{"translate-z":_e()}],"translate-none":["translate-none"],accent:[{accent:F()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:F()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",ye,be]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":T()}],"scroll-mx":[{"scroll-mx":T()}],"scroll-my":[{"scroll-my":T()}],"scroll-ms":[{"scroll-ms":T()}],"scroll-me":[{"scroll-me":T()}],"scroll-mt":[{"scroll-mt":T()}],"scroll-mr":[{"scroll-mr":T()}],"scroll-mb":[{"scroll-mb":T()}],"scroll-ml":[{"scroll-ml":T()}],"scroll-p":[{"scroll-p":T()}],"scroll-px":[{"scroll-px":T()}],"scroll-py":[{"scroll-py":T()}],"scroll-ps":[{"scroll-ps":T()}],"scroll-pe":[{"scroll-pe":T()}],"scroll-pt":[{"scroll-pt":T()}],"scroll-pr":[{"scroll-pr":T()}],"scroll-pb":[{"scroll-pb":T()}],"scroll-pl":[{"scroll-pl":T()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",ye,be]}],fill:[{fill:["none",...F()]}],"stroke-w":[{stroke:[Ie,vr,_n,qs]}],stroke:[{stroke:["none",...F()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}},Tk=lk(Ek);function ve(...e){return Tk(Mf(e))}function He(e){return e>=1e6?(e/1e6).toFixed(1).replace(/\.0$/,"")+"M":(e/1e3).toFixed(1).replace(/\.0$/,"")+"K"}function Gf(e){return e>=1024*1024?(e/(1024*1024)).toFixed(1).replace(/\.0$/,"")+"M":(e/1024).toFixed(1).replace(/\.0$/,"")+"K"}function _c(e,t,n){const r=e*10;return!Number.isSafeInteger(r)||r%t!==0?null:(r/t/10).toFixed(1).replace(/\.0$/,"")+n}function Ak(e){if(!Number.isSafeInteger(e)||e<=0)return e.toString();if(e>=1024*1024){const n=_c(e,1048576,"M");if(n!==null)return n}const t=_c(e,1024,"K");return t!==null?t:e.toString()}function Ik(e){if(e===void 0||e==="")return 1;switch(e.toLowerCase()){case"k":return 1024;case"m":return 1024*1024;default:return null}}function Fo(e){const t=e.trim().replaceAll(",","");if(t==="")return null;const n=/^(\d+(?:\.\d+)?)\s*([kKmM])?$/.exec(t);if(n===null)return null;const r=n[1];if(r===void 0)return null;const o=Number(r),s=n[2],i=Ik(s);if(!Number.isFinite(o)||o<=0||i===null||(s===void 0||s==="")&&!Number.isInteger(o))return null;const l=Math.round(o*i);return!Number.isSafeInteger(l)||l<=0?null:l}function zk(e){return e===null?"pending":e>=200&&e<300?"success":e>=400&&e<500?"client_error":e>=500?"server_error":"pending"}const Rk=te({model:A().min(1),contextWindow:ie().int().positive().optional(),outputLimit:ie().int().positive().optional(),source:Re(["manual","registry"]).optional(),sourceUrl:A().optional(),updatedAt:A().optional()}),$o=te({id:A(),name:A(),apiKey:A(),model:A().optional(),models:we(A()).min(1),format:Re(["anthropic","openai"]).optional(),baseUrl:A().optional(),anthropicBaseUrl:A().optional(),openaiBaseUrl:A().optional(),authHeader:Re(["bearer","x-api-key"]).optional().default("bearer"),apiDocsUrl:A().optional(),modelMetadataUrl:A().optional(),modelMetadata:we(Rk).optional(),source:Re(["company","personal"]).optional(),createdAt:A(),updatedAt:A()});async function Pk(e){return On(e,$o.array(),void 0,t=>`Failed to fetch ${e}: ${t.status}`)}function Jf(){const e=Hr("/api/providers?includeSecrets=1",Pk,{revalidateOnFocus:!1,revalidateIfStale:!1});return{providers:e.data??[],isLoading:e.isLoading,isError:e.error,mutate:e.mutate}}const Ok="2.0.37",Mk={version:Ok},Sc=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,Cc=Mf,$a=(e,t)=>n=>{var r;if(t?.variants==null)return Cc(e,n?.class,n?.className);const{variants:o,defaultVariants:s}=t,i=Object.keys(o).map(u=>{const d=n?.[u],f=s?.[u];if(d===null)return null;const h=Sc(d)||Sc(f);return o[u][h]}),l=n&&Object.entries(n).reduce((u,d)=>{let[f,h]=d;return h===void 0||(u[f]=h),u},{}),c=t==null||(r=t.compoundVariants)===null||r===void 0?void 0:r.reduce((u,d)=>{let{class:f,className:h,...p}=d;return Object.entries(p).every(y=>{let[m,g]=y;return Array.isArray(g)?g.includes({...s,...l}[m]):{...s,...l}[m]===g})?[...u,f,h]:u},[]);return Cc(e,i,c,n?.class,n?.className)};function jc(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function Yf(...e){return t=>{let n=!1;const r=e.map(o=>{const s=jc(o,t);return!n&&typeof s=="function"&&(n=!0),s});if(n)return()=>{for(let o=0;o<r.length;o++){const s=r[o];typeof s=="function"?s():jc(e[o],null)}}}}function De(...e){return x.useCallback(Yf(...e),e)}function ir(e){const t=Dk(e),n=x.forwardRef((r,o)=>{const{children:s,...i}=r,l=x.Children.toArray(s),c=l.find($k);if(c){const u=c.props.children,d=l.map(f=>f===c?x.Children.count(u)>1?x.Children.only(null):x.isValidElement(u)?u.props.children:null:f);return a.jsx(t,{...i,ref:o,children:x.isValidElement(u)?x.cloneElement(u,void 0,d):null})}return a.jsx(t,{...i,ref:o,children:s})});return n.displayName=`${e}.Slot`,n}var Lk=ir("Slot");function Dk(e){const t=x.forwardRef((n,r)=>{const{children:o,...s}=n;if(x.isValidElement(o)){const i=Uk(o),l=Bk(s,o.props);return o.type!==x.Fragment&&(l.ref=r?Yf(r,i):i),x.cloneElement(o,l)}return x.Children.count(o)>1?x.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var Xf=Symbol("radix.slottable");function Fk(e){const t=({children:n})=>a.jsx(a.Fragment,{children:n});return t.displayName=`${e}.Slottable`,t.__radixId=Xf,t}function $k(e){return x.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===Xf}function Bk(e,t){const n={...t};for(const r in t){const o=e[r],s=t[r];/^on[A-Z]/.test(r)?o&&s?n[r]=(...l)=>{const c=s(...l);return o(...l),c}:o&&(n[r]=o):r==="style"?n[r]={...o,...s}:r==="className"&&(n[r]=[o,s].filter(Boolean).join(" "))}return{...e,...n}}function Uk(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var Wk=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Te=Wk.reduce((e,t)=>{const n=ir(`Primitive.${t}`),r=x.forwardRef((o,s)=>{const{asChild:i,...l}=o,c=i?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),a.jsx(c,{...l,ref:s})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{});function Vk(e,t){e&&Zr.flushSync(()=>e.dispatchEvent(t))}var Qf=Object.freeze({position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal"}),Hk="VisuallyHidden",ep=x.forwardRef((e,t)=>a.jsx(Te.span,{...e,ref:t,style:{...Qf,...e.style}}));ep.displayName=Hk;var Zk=ep;function qk(e,t){const n=x.createContext(t),r=s=>{const{children:i,...l}=s,c=x.useMemo(()=>l,Object.values(l));return a.jsx(n.Provider,{value:c,children:i})};r.displayName=e+"Provider";function o(s){const i=x.useContext(n);if(i)return i;if(t!==void 0)return t;throw new Error(`\`${s}\` must be used within \`${e}\``)}return[r,o]}function sn(e,t=[]){let n=[];function r(s,i){const l=x.createContext(i),c=n.length;n=[...n,i];const u=f=>{const{scope:h,children:p,...y}=f,m=h?.[e]?.[c]||l,g=x.useMemo(()=>y,Object.values(y));return a.jsx(m.Provider,{value:g,children:p})};u.displayName=s+"Provider";function d(f,h){const p=h?.[e]?.[c]||l,y=x.useContext(p);if(y)return y;if(i!==void 0)return i;throw new Error(`\`${f}\` must be used within \`${s}\``)}return[u,d]}const o=()=>{const s=n.map(i=>x.createContext(i));return function(l){const c=l?.[e]||s;return x.useMemo(()=>({[`__scope${e}`]:{...l,[e]:c}}),[l,c])}};return o.scopeName=e,[r,Kk(o,...t)]}function Kk(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const r=e.map(o=>({useScope:o(),scopeName:o.scopeName}));return function(s){const i=r.reduce((l,{useScope:c,scopeName:u})=>{const f=c(s)[`__scope${u}`];return{...l,...f}},{});return x.useMemo(()=>({[`__scope${t.scopeName}`]:i}),[i])}};return n.scopeName=t.scopeName,n}function tp(e){const t=e+"CollectionProvider",[n,r]=sn(t),[o,s]=n(t,{collectionRef:{current:null},itemMap:new Map}),i=m=>{const{scope:g,children:b}=m,v=ut.useRef(null),k=ut.useRef(new Map).current;return a.jsx(o,{scope:g,itemMap:k,collectionRef:v,children:b})};i.displayName=t;const l=e+"CollectionSlot",c=ir(l),u=ut.forwardRef((m,g)=>{const{scope:b,children:v}=m,k=s(l,b),S=De(g,k.collectionRef);return a.jsx(c,{ref:S,children:v})});u.displayName=l;const d=e+"CollectionItemSlot",f="data-radix-collection-item",h=ir(d),p=ut.forwardRef((m,g)=>{const{scope:b,children:v,...k}=m,S=ut.useRef(null),C=De(g,S),j=s(d,b);return ut.useEffect(()=>(j.itemMap.set(S,{ref:S,...k}),()=>{j.itemMap.delete(S)})),a.jsx(h,{[f]:"",ref:C,children:v})});p.displayName=d;function y(m){const g=s(e+"CollectionConsumer",m);return ut.useCallback(()=>{const v=g.collectionRef.current;if(!v)return[];const k=Array.from(v.querySelectorAll(`[${f}]`));return Array.from(g.itemMap.values()).sort((j,E)=>k.indexOf(j.ref.current)-k.indexOf(E.ref.current))},[g.collectionRef,g.itemMap])}return[{Provider:i,Slot:u,ItemSlot:p},y,r]}function Se(e,t,{checkForDefaultPrevented:n=!0}={}){return function(o){if(e?.(o),n===!1||!o.defaultPrevented)return t?.(o)}}var ot=globalThis?.document?x.useLayoutEffect:()=>{},Gk=Rd[" useInsertionEffect ".trim().toString()]||ot;function jn({prop:e,defaultProp:t,onChange:n=()=>{},caller:r}){const[o,s,i]=Jk({defaultProp:t,onChange:n}),l=e!==void 0,c=l?e:o;{const d=x.useRef(e!==void 0);x.useEffect(()=>{const f=d.current;f!==l&&console.warn(`${r} is changing from ${f?"controlled":"uncontrolled"} to ${l?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),d.current=l},[l,r])}const u=x.useCallback(d=>{if(l){const f=Yk(d)?d(e):d;f!==e&&i.current?.(f)}else s(d)},[l,e,s,i]);return[c,u]}function Jk({defaultProp:e,onChange:t}){const[n,r]=x.useState(e),o=x.useRef(n),s=x.useRef(t);return Gk(()=>{s.current=t},[t]),x.useEffect(()=>{o.current!==n&&(s.current?.(n),o.current=n)},[n,o]),[n,r,s]}function Yk(e){return typeof e=="function"}function Xk(e,t){return x.useReducer((n,r)=>t[n][r]??n,e)}var St=e=>{const{present:t,children:n}=e,r=Qk(t),o=typeof n=="function"?n({present:r.isPresent}):x.Children.only(n),s=De(r.ref,e_(o));return typeof n=="function"||r.isPresent?x.cloneElement(o,{ref:s}):null};St.displayName="Presence";function Qk(e){const[t,n]=x.useState(),r=x.useRef(null),o=x.useRef(e),s=x.useRef("none"),i=e?"mounted":"unmounted",[l,c]=Xk(i,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return x.useEffect(()=>{const u=uo(r.current);s.current=l==="mounted"?u:"none"},[l]),ot(()=>{const u=r.current,d=o.current;if(d!==e){const h=s.current,p=uo(u);e?c("MOUNT"):p==="none"||u?.display==="none"?c("UNMOUNT"):c(d&&h!==p?"ANIMATION_OUT":"UNMOUNT"),o.current=e}},[e,c]),ot(()=>{if(t){let u;const d=t.ownerDocument.defaultView??window,f=p=>{const m=uo(r.current).includes(CSS.escape(p.animationName));if(p.target===t&&m&&(c("ANIMATION_END"),!o.current)){const g=t.style.animationFillMode;t.style.animationFillMode="forwards",u=d.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=g)})}},h=p=>{p.target===t&&(s.current=uo(r.current))};return t.addEventListener("animationstart",h),t.addEventListener("animationcancel",f),t.addEventListener("animationend",f),()=>{d.clearTimeout(u),t.removeEventListener("animationstart",h),t.removeEventListener("animationcancel",f),t.removeEventListener("animationend",f)}}else c("ANIMATION_END")},[t,c]),{isPresent:["mounted","unmountSuspended"].includes(l),ref:x.useCallback(u=>{r.current=u?getComputedStyle(u):null,n(u)},[])}}function uo(e){return e?.animationName||"none"}function e_(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var t_=Rd[" useId ".trim().toString()]||(()=>{}),n_=0;function Bt(e){const[t,n]=x.useState(t_());return ot(()=>{n(r=>r??String(n_++))},[e]),e||(t?`radix-${t}`:"")}var ps="Collapsible",[r_]=sn(ps),[o_,Ba]=r_(ps),np=x.forwardRef((e,t)=>{const{__scopeCollapsible:n,open:r,defaultOpen:o,disabled:s,onOpenChange:i,...l}=e,[c,u]=jn({prop:r,defaultProp:o??!1,onChange:i,caller:ps});return a.jsx(o_,{scope:n,disabled:s,contentId:Bt(),open:c,onOpenToggle:x.useCallback(()=>u(d=>!d),[u]),children:a.jsx(Te.div,{"data-state":Wa(c),"data-disabled":s?"":void 0,...l,ref:t})})});np.displayName=ps;var rp="CollapsibleTrigger",op=x.forwardRef((e,t)=>{const{__scopeCollapsible:n,...r}=e,o=Ba(rp,n);return a.jsx(Te.button,{type:"button","aria-controls":o.contentId,"aria-expanded":o.open||!1,"data-state":Wa(o.open),"data-disabled":o.disabled?"":void 0,disabled:o.disabled,...r,ref:t,onClick:Se(e.onClick,o.onOpenToggle)})});op.displayName=rp;var Ua="CollapsibleContent",sp=x.forwardRef((e,t)=>{const{forceMount:n,...r}=e,o=Ba(Ua,e.__scopeCollapsible);return a.jsx(St,{present:n||o.open,children:({present:s})=>a.jsx(s_,{...r,ref:t,present:s})})});sp.displayName=Ua;var s_=x.forwardRef((e,t)=>{const{__scopeCollapsible:n,present:r,children:o,...s}=e,i=Ba(Ua,n),[l,c]=x.useState(r),u=x.useRef(null),d=De(t,u),f=x.useRef(0),h=f.current,p=x.useRef(0),y=p.current,m=i.open||l,g=x.useRef(m),b=x.useRef(void 0);return x.useEffect(()=>{const v=requestAnimationFrame(()=>g.current=!1);return()=>cancelAnimationFrame(v)},[]),ot(()=>{const v=u.current;if(v){b.current=b.current||{transitionDuration:v.style.transitionDuration,animationName:v.style.animationName},v.style.transitionDuration="0s",v.style.animationName="none";const k=v.getBoundingClientRect();f.current=k.height,p.current=k.width,g.current||(v.style.transitionDuration=b.current.transitionDuration,v.style.animationName=b.current.animationName),c(r)}},[i.open,r]),a.jsx(Te.div,{"data-state":Wa(i.open),"data-disabled":i.disabled?"":void 0,id:i.contentId,hidden:!m,...s,ref:d,style:{"--radix-collapsible-content-height":h?`${h}px`:void 0,"--radix-collapsible-content-width":y?`${y}px`:void 0,...e.style},children:m&&o})});function Wa(e){return e?"open":"closed"}var i_=np,a_=x.createContext(void 0);function hs(e){const t=x.useContext(a_);return e||t||"ltr"}function lt(e){const t=x.useRef(e);return x.useEffect(()=>{t.current=e}),x.useMemo(()=>(...n)=>t.current?.(...n),[])}function l_(e,t=globalThis?.document){const n=lt(e);x.useEffect(()=>{const r=o=>{o.key==="Escape"&&n(o)};return t.addEventListener("keydown",r,{capture:!0}),()=>t.removeEventListener("keydown",r,{capture:!0})},[n,t])}var c_="DismissableLayer",$i="dismissableLayer.update",u_="dismissableLayer.pointerDownOutside",d_="dismissableLayer.focusOutside",Nc,ip=x.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),ms=x.forwardRef((e,t)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:r,onPointerDownOutside:o,onFocusOutside:s,onInteractOutside:i,onDismiss:l,...c}=e,u=x.useContext(ip),[d,f]=x.useState(null),h=d?.ownerDocument??globalThis?.document,[,p]=x.useState({}),y=De(t,E=>f(E)),m=Array.from(u.layers),[g]=[...u.layersWithOutsidePointerEventsDisabled].slice(-1),b=m.indexOf(g),v=d?m.indexOf(d):-1,k=u.layersWithOutsidePointerEventsDisabled.size>0,S=v>=b,C=h_(E=>{const T=E.target,z=[...u.branches].some(O=>O.contains(T));!S||z||(o?.(E),i?.(E),E.defaultPrevented||l?.())},h),j=m_(E=>{const T=E.target;[...u.branches].some(O=>O.contains(T))||(s?.(E),i?.(E),E.defaultPrevented||l?.())},h);return l_(E=>{v===u.layers.size-1&&(r?.(E),!E.defaultPrevented&&l&&(E.preventDefault(),l()))},h),x.useEffect(()=>{if(d)return n&&(u.layersWithOutsidePointerEventsDisabled.size===0&&(Nc=h.body.style.pointerEvents,h.body.style.pointerEvents="none"),u.layersWithOutsidePointerEventsDisabled.add(d)),u.layers.add(d),Ec(),()=>{n&&u.layersWithOutsidePointerEventsDisabled.size===1&&(h.body.style.pointerEvents=Nc)}},[d,h,n,u]),x.useEffect(()=>()=>{d&&(u.layers.delete(d),u.layersWithOutsidePointerEventsDisabled.delete(d),Ec())},[d,u]),x.useEffect(()=>{const E=()=>p({});return document.addEventListener($i,E),()=>document.removeEventListener($i,E)},[]),a.jsx(Te.div,{...c,ref:y,style:{pointerEvents:k?S?"auto":"none":void 0,...e.style},onFocusCapture:Se(e.onFocusCapture,j.onFocusCapture),onBlurCapture:Se(e.onBlurCapture,j.onBlurCapture),onPointerDownCapture:Se(e.onPointerDownCapture,C.onPointerDownCapture)})});ms.displayName=c_;var f_="DismissableLayerBranch",p_=x.forwardRef((e,t)=>{const n=x.useContext(ip),r=x.useRef(null),o=De(t,r);return x.useEffect(()=>{const s=r.current;if(s)return n.branches.add(s),()=>{n.branches.delete(s)}},[n.branches]),a.jsx(Te.div,{...e,ref:o})});p_.displayName=f_;function h_(e,t=globalThis?.document){const n=lt(e),r=x.useRef(!1),o=x.useRef(()=>{});return x.useEffect(()=>{const s=l=>{if(l.target&&!r.current){let c=function(){ap(u_,n,u,{discrete:!0})};const u={originalEvent:l};l.pointerType==="touch"?(t.removeEventListener("click",o.current),o.current=c,t.addEventListener("click",o.current,{once:!0})):c()}else t.removeEventListener("click",o.current);r.current=!1},i=window.setTimeout(()=>{t.addEventListener("pointerdown",s)},0);return()=>{window.clearTimeout(i),t.removeEventListener("pointerdown",s),t.removeEventListener("click",o.current)}},[t,n]),{onPointerDownCapture:()=>r.current=!0}}function m_(e,t=globalThis?.document){const n=lt(e),r=x.useRef(!1);return x.useEffect(()=>{const o=s=>{s.target&&!r.current&&ap(d_,n,{originalEvent:s},{discrete:!1})};return t.addEventListener("focusin",o),()=>t.removeEventListener("focusin",o)},[t,n]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}function Ec(){const e=new CustomEvent($i);document.dispatchEvent(e)}function ap(e,t,n,{discrete:r}){const o=n.originalEvent.target,s=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&o.addEventListener(e,t,{once:!0}),r?Vk(o,s):o.dispatchEvent(s)}var Ks="focusScope.autoFocusOnMount",Gs="focusScope.autoFocusOnUnmount",Tc={bubbles:!1,cancelable:!0},g_="FocusScope",Va=x.forwardRef((e,t)=>{const{loop:n=!1,trapped:r=!1,onMountAutoFocus:o,onUnmountAutoFocus:s,...i}=e,[l,c]=x.useState(null),u=lt(o),d=lt(s),f=x.useRef(null),h=De(t,m=>c(m)),p=x.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;x.useEffect(()=>{if(r){let m=function(k){if(p.paused||!l)return;const S=k.target;l.contains(S)?f.current=S:dn(f.current,{select:!0})},g=function(k){if(p.paused||!l)return;const S=k.relatedTarget;S!==null&&(l.contains(S)||dn(f.current,{select:!0}))},b=function(k){if(document.activeElement===document.body)for(const C of k)C.removedNodes.length>0&&dn(l)};document.addEventListener("focusin",m),document.addEventListener("focusout",g);const v=new MutationObserver(b);return l&&v.observe(l,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",m),document.removeEventListener("focusout",g),v.disconnect()}}},[r,l,p.paused]),x.useEffect(()=>{if(l){Ic.add(p);const m=document.activeElement;if(!l.contains(m)){const b=new CustomEvent(Ks,Tc);l.addEventListener(Ks,u),l.dispatchEvent(b),b.defaultPrevented||(x_(k_(lp(l)),{select:!0}),document.activeElement===m&&dn(l))}return()=>{l.removeEventListener(Ks,u),setTimeout(()=>{const b=new CustomEvent(Gs,Tc);l.addEventListener(Gs,d),l.dispatchEvent(b),b.defaultPrevented||dn(m??document.body,{select:!0}),l.removeEventListener(Gs,d),Ic.remove(p)},0)}}},[l,u,d,p]);const y=x.useCallback(m=>{if(!n&&!r||p.paused)return;const g=m.key==="Tab"&&!m.altKey&&!m.ctrlKey&&!m.metaKey,b=document.activeElement;if(g&&b){const v=m.currentTarget,[k,S]=b_(v);k&&S?!m.shiftKey&&b===S?(m.preventDefault(),n&&dn(k,{select:!0})):m.shiftKey&&b===k&&(m.preventDefault(),n&&dn(S,{select:!0})):b===v&&m.preventDefault()}},[n,r,p.paused]);return a.jsx(Te.div,{tabIndex:-1,...i,ref:h,onKeyDown:y})});Va.displayName=g_;function x_(e,{select:t=!1}={}){const n=document.activeElement;for(const r of e)if(dn(r,{select:t}),document.activeElement!==n)return}function b_(e){const t=lp(e),n=Ac(t,e),r=Ac(t.reverse(),e);return[n,r]}function lp(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:r=>{const o=r.tagName==="INPUT"&&r.type==="hidden";return r.disabled||r.hidden||o?NodeFilter.FILTER_SKIP:r.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function Ac(e,t){for(const n of e)if(!y_(n,{upTo:t}))return n}function y_(e,{upTo:t}){if(getComputedStyle(e).visibility==="hidden")return!0;for(;e;){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display==="none")return!0;e=e.parentElement}return!1}function v_(e){return e instanceof HTMLInputElement&&"select"in e}function dn(e,{select:t=!1}={}){if(e&&e.focus){const n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&v_(e)&&t&&e.select()}}var Ic=w_();function w_(){let e=[];return{add(t){const n=e[0];t!==n&&n?.pause(),e=zc(e,t),e.unshift(t)},remove(t){e=zc(e,t),e[0]?.resume()}}}function zc(e,t){const n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}function k_(e){return e.filter(t=>t.tagName!=="A")}var __="Portal",gs=x.forwardRef((e,t)=>{const{container:n,...r}=e,[o,s]=x.useState(!1);ot(()=>s(!0),[]);const i=n||o&&globalThis?.document?.body;return i?nx.createPortal(a.jsx(Te.div,{...r,ref:t}),i):null});gs.displayName=__;var Js=0;function cp(){x.useEffect(()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??Rc()),document.body.insertAdjacentElement("beforeend",e[1]??Rc()),Js++,()=>{Js===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(t=>t.remove()),Js--}},[])}function Rc(){const e=document.createElement("span");return e.setAttribute("data-radix-focus-guard",""),e.tabIndex=0,e.style.outline="none",e.style.opacity="0",e.style.position="fixed",e.style.pointerEvents="none",e}var Dt=function(){return Dt=Object.assign||function(t){for(var n,r=1,o=arguments.length;r<o;r++){n=arguments[r];for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(t[s]=n[s])}return t},Dt.apply(this,arguments)};function up(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var o=0,r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]]);return n}function S_(e,t,n){if(n||arguments.length===2)for(var r=0,o=t.length,s;r<o;r++)(s||!(r in t))&&(s||(s=Array.prototype.slice.call(t,0,r)),s[r]=t[r]);return e.concat(s||Array.prototype.slice.call(t))}var jo="right-scroll-bar-position",No="width-before-scroll-bar",C_="with-scroll-bars-hidden",j_="--removed-body-scroll-bar-size";function Ys(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}function N_(e,t){var n=x.useState(function(){return{value:e,callback:t,facade:{get current(){return n.value},set current(r){var o=n.value;o!==r&&(n.value=r,n.callback(r,o))}}}})[0];return n.callback=t,n.facade}var E_=typeof window<"u"?x.useLayoutEffect:x.useEffect,Pc=new WeakMap;function T_(e,t){var n=N_(null,function(r){return e.forEach(function(o){return Ys(o,r)})});return E_(function(){var r=Pc.get(n);if(r){var o=new Set(r),s=new Set(e),i=n.current;o.forEach(function(l){s.has(l)||Ys(l,null)}),s.forEach(function(l){o.has(l)||Ys(l,i)})}Pc.set(n,e)},[e]),n}function A_(e){return e}function I_(e,t){t===void 0&&(t=A_);var n=[],r=!1,o={read:function(){if(r)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return n.length?n[n.length-1]:e},useMedium:function(s){var i=t(s,r);return n.push(i),function(){n=n.filter(function(l){return l!==i})}},assignSyncMedium:function(s){for(r=!0;n.length;){var i=n;n=[],i.forEach(s)}n={push:function(l){return s(l)},filter:function(){return n}}},assignMedium:function(s){r=!0;var i=[];if(n.length){var l=n;n=[],l.forEach(s),i=n}var c=function(){var d=i;i=[],d.forEach(s)},u=function(){return Promise.resolve().then(c)};u(),n={push:function(d){i.push(d),u()},filter:function(d){return i=i.filter(d),n}}}};return o}function z_(e){e===void 0&&(e={});var t=I_(null);return t.options=Dt({async:!0,ssr:!1},e),t}var dp=function(e){var t=e.sideCar,n=up(e,["sideCar"]);if(!t)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var r=t.read();if(!r)throw new Error("Sidecar medium not found");return x.createElement(r,Dt({},n))};dp.isSideCarExport=!0;function R_(e,t){return e.useMedium(t),dp}var fp=z_(),Xs=function(){},xs=x.forwardRef(function(e,t){var n=x.useRef(null),r=x.useState({onScrollCapture:Xs,onWheelCapture:Xs,onTouchMoveCapture:Xs}),o=r[0],s=r[1],i=e.forwardProps,l=e.children,c=e.className,u=e.removeScrollBar,d=e.enabled,f=e.shards,h=e.sideCar,p=e.noRelative,y=e.noIsolation,m=e.inert,g=e.allowPinchZoom,b=e.as,v=b===void 0?"div":b,k=e.gapMode,S=up(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),C=h,j=T_([n,t]),E=Dt(Dt({},S),o);return x.createElement(x.Fragment,null,d&&x.createElement(C,{sideCar:fp,removeScrollBar:u,shards:f,noRelative:p,noIsolation:y,inert:m,setCallbacks:s,allowPinchZoom:!!g,lockRef:n,gapMode:k}),i?x.cloneElement(x.Children.only(l),Dt(Dt({},E),{ref:j})):x.createElement(v,Dt({},E,{className:c,ref:j}),l))});xs.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};xs.classNames={fullWidth:No,zeroRight:jo};var P_=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function O_(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=P_();return t&&e.setAttribute("nonce",t),e}function M_(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function L_(e){var t=document.head||document.getElementsByTagName("head")[0];t.appendChild(e)}var D_=function(){var e=0,t=null;return{add:function(n){e==0&&(t=O_())&&(M_(t,n),L_(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},F_=function(){var e=D_();return function(t,n){x.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},pp=function(){var e=F_(),t=function(n){var r=n.styles,o=n.dynamic;return e(r,o),null};return t},$_={left:0,top:0,right:0,gap:0},Qs=function(e){return parseInt(e||"",10)||0},B_=function(e){var t=window.getComputedStyle(document.body),n=t[e==="padding"?"paddingLeft":"marginLeft"],r=t[e==="padding"?"paddingTop":"marginTop"],o=t[e==="padding"?"paddingRight":"marginRight"];return[Qs(n),Qs(r),Qs(o)]},U_=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return $_;var t=B_(e),n=document.documentElement.clientWidth,r=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,r-n+t[2]-t[0])}},W_=pp(),Yn="data-scroll-locked",V_=function(e,t,n,r){var o=e.left,s=e.top,i=e.right,l=e.gap;return n===void 0&&(n="margin"),`
|
|
42
|
+
.`.concat(C_,` {
|
|
43
43
|
overflow: hidden `).concat(r,`;
|
|
44
44
|
padding-right: `).concat(l,"px ").concat(r,`;
|
|
45
45
|
}
|
|
46
|
-
body[`).concat(
|
|
46
|
+
body[`).concat(Yn,`] {
|
|
47
47
|
overflow: hidden `).concat(r,`;
|
|
48
48
|
overscroll-behavior: contain;
|
|
49
49
|
`).concat([t&&"position: relative ".concat(r,";"),n==="margin"&&`
|
|
@@ -72,44 +72,44 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
72
72
|
margin-right: 0 `).concat(r,`;
|
|
73
73
|
}
|
|
74
74
|
|
|
75
|
-
body[`).concat(
|
|
76
|
-
`).concat(
|
|
75
|
+
body[`).concat(Yn,`] {
|
|
76
|
+
`).concat(j_,": ").concat(l,`px;
|
|
77
77
|
}
|
|
78
|
-
`)},Oc=function(){var e=parseInt(document.body.getAttribute(
|
|
78
|
+
`)},Oc=function(){var e=parseInt(document.body.getAttribute(Yn)||"0",10);return isFinite(e)?e:0},H_=function(){x.useEffect(function(){return document.body.setAttribute(Yn,(Oc()+1).toString()),function(){var e=Oc()-1;e<=0?document.body.removeAttribute(Yn):document.body.setAttribute(Yn,e.toString())}},[])},Z_=function(e){var t=e.noRelative,n=e.noImportant,r=e.gapMode,o=r===void 0?"margin":r;H_();var s=x.useMemo(function(){return U_(o)},[o]);return x.createElement(W_,{styles:V_(s,!t,o,n?"":"!important")})},Bi=!1;if(typeof window<"u")try{var fo=Object.defineProperty({},"passive",{get:function(){return Bi=!0,!0}});window.addEventListener("test",fo,fo),window.removeEventListener("test",fo,fo)}catch{Bi=!1}var Fn=Bi?{passive:!1}:!1,q_=function(e){return e.tagName==="TEXTAREA"},hp=function(e,t){if(!(e instanceof Element))return!1;var n=window.getComputedStyle(e);return n[t]!=="hidden"&&!(n.overflowY===n.overflowX&&!q_(e)&&n[t]==="visible")},K_=function(e){return hp(e,"overflowY")},G_=function(e){return hp(e,"overflowX")},Mc=function(e,t){var n=t.ownerDocument,r=t;do{typeof ShadowRoot<"u"&&r instanceof ShadowRoot&&(r=r.host);var o=mp(e,r);if(o){var s=gp(e,r),i=s[1],l=s[2];if(i>l)return!0}r=r.parentNode}while(r&&r!==n.body);return!1},J_=function(e){var t=e.scrollTop,n=e.scrollHeight,r=e.clientHeight;return[t,n,r]},Y_=function(e){var t=e.scrollLeft,n=e.scrollWidth,r=e.clientWidth;return[t,n,r]},mp=function(e,t){return e==="v"?K_(t):G_(t)},gp=function(e,t){return e==="v"?J_(t):Y_(t)},X_=function(e,t){return e==="h"&&t==="rtl"?-1:1},Q_=function(e,t,n,r,o){var s=X_(e,window.getComputedStyle(t).direction),i=s*r,l=n.target,c=t.contains(l),u=!1,d=i>0,f=0,h=0;do{if(!l)break;var p=gp(e,l),y=p[0],m=p[1],g=p[2],b=m-g-s*y;(y||b)&&mp(e,l)&&(f+=b,h+=y);var v=l.parentNode;l=v&&v.nodeType===Node.DOCUMENT_FRAGMENT_NODE?v.host:v}while(!c&&l!==document.body||c&&(t.contains(l)||t===l));return(d&&Math.abs(f)<1||!d&&Math.abs(h)<1)&&(u=!0),u},po=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},Lc=function(e){return[e.deltaX,e.deltaY]},Dc=function(e){return e&&"current"in e?e.current:e},eS=function(e,t){return e[0]===t[0]&&e[1]===t[1]},tS=function(e){return`
|
|
79
79
|
.block-interactivity-`.concat(e,` {pointer-events: none;}
|
|
80
80
|
.allow-interactivity-`).concat(e,` {pointer-events: all;}
|
|
81
|
-
`)},
|
|
81
|
+
`)},nS=0,$n=[];function rS(e){var t=x.useRef([]),n=x.useRef([0,0]),r=x.useRef(),o=x.useState(nS++)[0],s=x.useState(pp)[0],i=x.useRef(e);x.useEffect(function(){i.current=e},[e]),x.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(o));var m=S_([e.lockRef.current],(e.shards||[]).map(Dc),!0).filter(Boolean);return m.forEach(function(g){return g.classList.add("allow-interactivity-".concat(o))}),function(){document.body.classList.remove("block-interactivity-".concat(o)),m.forEach(function(g){return g.classList.remove("allow-interactivity-".concat(o))})}}},[e.inert,e.lockRef.current,e.shards]);var l=x.useCallback(function(m,g){if("touches"in m&&m.touches.length===2||m.type==="wheel"&&m.ctrlKey)return!i.current.allowPinchZoom;var b=po(m),v=n.current,k="deltaX"in m?m.deltaX:v[0]-b[0],S="deltaY"in m?m.deltaY:v[1]-b[1],C,j=m.target,E=Math.abs(k)>Math.abs(S)?"h":"v";if("touches"in m&&E==="h"&&j.type==="range")return!1;var T=window.getSelection(),z=T&&T.anchorNode,O=z?z===j||z.contains(j):!1;if(O)return!1;var B=Mc(E,j);if(!B)return!0;if(B?C=E:(C=E==="v"?"h":"v",B=Mc(E,j)),!B)return!1;if(!r.current&&"changedTouches"in m&&(k||S)&&(r.current=C),!C)return!0;var N=r.current||C;return Q_(N,g,m,N==="h"?k:S)},[]),c=x.useCallback(function(m){var g=m;if(!(!$n.length||$n[$n.length-1]!==s)){var b="deltaY"in g?Lc(g):po(g),v=t.current.filter(function(C){return C.name===g.type&&(C.target===g.target||g.target===C.shadowParent)&&eS(C.delta,b)})[0];if(v&&v.should){g.cancelable&&g.preventDefault();return}if(!v){var k=(i.current.shards||[]).map(Dc).filter(Boolean).filter(function(C){return C.contains(g.target)}),S=k.length>0?l(g,k[0]):!i.current.noIsolation;S&&g.cancelable&&g.preventDefault()}}},[]),u=x.useCallback(function(m,g,b,v){var k={name:m,delta:g,target:b,should:v,shadowParent:oS(b)};t.current.push(k),setTimeout(function(){t.current=t.current.filter(function(S){return S!==k})},1)},[]),d=x.useCallback(function(m){n.current=po(m),r.current=void 0},[]),f=x.useCallback(function(m){u(m.type,Lc(m),m.target,l(m,e.lockRef.current))},[]),h=x.useCallback(function(m){u(m.type,po(m),m.target,l(m,e.lockRef.current))},[]);x.useEffect(function(){return $n.push(s),e.setCallbacks({onScrollCapture:f,onWheelCapture:f,onTouchMoveCapture:h}),document.addEventListener("wheel",c,Fn),document.addEventListener("touchmove",c,Fn),document.addEventListener("touchstart",d,Fn),function(){$n=$n.filter(function(m){return m!==s}),document.removeEventListener("wheel",c,Fn),document.removeEventListener("touchmove",c,Fn),document.removeEventListener("touchstart",d,Fn)}},[]);var p=e.removeScrollBar,y=e.inert;return x.createElement(x.Fragment,null,y?x.createElement(s,{styles:tS(o)}):null,p?x.createElement(Z_,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function oS(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const sS=R_(fp,rS);var Ha=x.forwardRef(function(e,t){return x.createElement(xs,Dt({},e,{ref:t,sideCar:sS}))});Ha.classNames=xs.classNames;var iS=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},Bn=new WeakMap,ho=new WeakMap,mo={},ei=0,xp=function(e){return e&&(e.host||xp(e.parentNode))},aS=function(e,t){return t.map(function(n){if(e.contains(n))return n;var r=xp(n);return r&&e.contains(r)?r:(console.error("aria-hidden",n,"in not contained inside",e,". Doing nothing"),null)}).filter(function(n){return!!n})},lS=function(e,t,n,r){var o=aS(t,Array.isArray(e)?e:[e]);mo[n]||(mo[n]=new WeakMap);var s=mo[n],i=[],l=new Set,c=new Set(o),u=function(f){!f||l.has(f)||(l.add(f),u(f.parentNode))};o.forEach(u);var d=function(f){!f||c.has(f)||Array.prototype.forEach.call(f.children,function(h){if(l.has(h))d(h);else try{var p=h.getAttribute(r),y=p!==null&&p!=="false",m=(Bn.get(h)||0)+1,g=(s.get(h)||0)+1;Bn.set(h,m),s.set(h,g),i.push(h),m===1&&y&&ho.set(h,!0),g===1&&h.setAttribute(n,"true"),y||h.setAttribute(r,"true")}catch(b){console.error("aria-hidden: cannot operate on ",h,b)}})};return d(t),l.clear(),ei++,function(){i.forEach(function(f){var h=Bn.get(f)-1,p=s.get(f)-1;Bn.set(f,h),s.set(f,p),h||(ho.has(f)||f.removeAttribute(r),ho.delete(f)),p||f.removeAttribute(n)}),ei--,ei||(Bn=new WeakMap,Bn=new WeakMap,ho=new WeakMap,mo={})}},bp=function(e,t,n){n===void 0&&(n="data-aria-hidden");var r=Array.from(Array.isArray(e)?e:[e]),o=iS(e);return o?(r.push.apply(r,Array.from(o.querySelectorAll("[aria-live], script"))),lS(r,o,n,"aria-hidden")):function(){return null}},bs="Dialog",[yp]=sn(bs),[cS,Pt]=yp(bs),vp=e=>{const{__scopeDialog:t,children:n,open:r,defaultOpen:o,onOpenChange:s,modal:i=!0}=e,l=x.useRef(null),c=x.useRef(null),[u,d]=jn({prop:r,defaultProp:o??!1,onChange:s,caller:bs});return a.jsx(cS,{scope:t,triggerRef:l,contentRef:c,contentId:Bt(),titleId:Bt(),descriptionId:Bt(),open:u,onOpenChange:d,onOpenToggle:x.useCallback(()=>d(f=>!f),[d]),modal:i,children:n})};vp.displayName=bs;var wp="DialogTrigger",kp=x.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=Pt(wp,n),s=De(t,o.triggerRef);return a.jsx(Te.button,{type:"button","aria-haspopup":"dialog","aria-expanded":o.open,"aria-controls":o.contentId,"data-state":Ka(o.open),...r,ref:s,onClick:Se(e.onClick,o.onOpenToggle)})});kp.displayName=wp;var Za="DialogPortal",[uS,_p]=yp(Za,{forceMount:void 0}),Sp=e=>{const{__scopeDialog:t,forceMount:n,children:r,container:o}=e,s=Pt(Za,t);return a.jsx(uS,{scope:t,forceMount:n,children:x.Children.map(r,i=>a.jsx(St,{present:n||s.open,children:a.jsx(gs,{asChild:!0,container:o,children:i})}))})};Sp.displayName=Za;var Bo="DialogOverlay",Cp=x.forwardRef((e,t)=>{const n=_p(Bo,e.__scopeDialog),{forceMount:r=n.forceMount,...o}=e,s=Pt(Bo,e.__scopeDialog);return s.modal?a.jsx(St,{present:r||s.open,children:a.jsx(fS,{...o,ref:t})}):null});Cp.displayName=Bo;var dS=ir("DialogOverlay.RemoveScroll"),fS=x.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=Pt(Bo,n);return a.jsx(Ha,{as:dS,allowPinchZoom:!0,shards:[o.contentRef],children:a.jsx(Te.div,{"data-state":Ka(o.open),...r,ref:t,style:{pointerEvents:"auto",...r.style}})})}),Nn="DialogContent",jp=x.forwardRef((e,t)=>{const n=_p(Nn,e.__scopeDialog),{forceMount:r=n.forceMount,...o}=e,s=Pt(Nn,e.__scopeDialog);return a.jsx(St,{present:r||s.open,children:s.modal?a.jsx(pS,{...o,ref:t}):a.jsx(hS,{...o,ref:t})})});jp.displayName=Nn;var pS=x.forwardRef((e,t)=>{const n=Pt(Nn,e.__scopeDialog),r=x.useRef(null),o=De(t,n.contentRef,r);return x.useEffect(()=>{const s=r.current;if(s)return bp(s)},[]),a.jsx(Np,{...e,ref:o,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:Se(e.onCloseAutoFocus,s=>{s.preventDefault(),n.triggerRef.current?.focus()}),onPointerDownOutside:Se(e.onPointerDownOutside,s=>{const i=s.detail.originalEvent,l=i.button===0&&i.ctrlKey===!0;(i.button===2||l)&&s.preventDefault()}),onFocusOutside:Se(e.onFocusOutside,s=>s.preventDefault())})}),hS=x.forwardRef((e,t)=>{const n=Pt(Nn,e.__scopeDialog),r=x.useRef(!1),o=x.useRef(!1);return a.jsx(Np,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:s=>{e.onCloseAutoFocus?.(s),s.defaultPrevented||(r.current||n.triggerRef.current?.focus(),s.preventDefault()),r.current=!1,o.current=!1},onInteractOutside:s=>{e.onInteractOutside?.(s),s.defaultPrevented||(r.current=!0,s.detail.originalEvent.type==="pointerdown"&&(o.current=!0));const i=s.target;n.triggerRef.current?.contains(i)&&s.preventDefault(),s.detail.originalEvent.type==="focusin"&&o.current&&s.preventDefault()}})}),Np=x.forwardRef((e,t)=>{const{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:o,onCloseAutoFocus:s,...i}=e,l=Pt(Nn,n),c=x.useRef(null),u=De(t,c);return cp(),a.jsxs(a.Fragment,{children:[a.jsx(Va,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:o,onUnmountAutoFocus:s,children:a.jsx(ms,{role:"dialog",id:l.contentId,"aria-describedby":l.descriptionId,"aria-labelledby":l.titleId,"data-state":Ka(l.open),...i,ref:u,onDismiss:()=>l.onOpenChange(!1)})}),a.jsxs(a.Fragment,{children:[a.jsx(gS,{titleId:l.titleId}),a.jsx(bS,{contentRef:c,descriptionId:l.descriptionId})]})]})}),qa="DialogTitle",Ep=x.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=Pt(qa,n);return a.jsx(Te.h2,{id:o.titleId,...r,ref:t})});Ep.displayName=qa;var Tp="DialogDescription",mS=x.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=Pt(Tp,n);return a.jsx(Te.p,{id:o.descriptionId,...r,ref:t})});mS.displayName=Tp;var Ap="DialogClose",Ip=x.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=Pt(Ap,n);return a.jsx(Te.button,{type:"button",...r,ref:t,onClick:Se(e.onClick,()=>o.onOpenChange(!1))})});Ip.displayName=Ap;function Ka(e){return e?"open":"closed"}var zp="DialogTitleWarning",[AO,Rp]=qk(zp,{contentName:Nn,titleName:qa,docsSlug:"dialog"}),gS=({titleId:e})=>{const t=Rp(zp),n=`\`${t.contentName}\` requires a \`${t.titleName}\` for the component to be accessible for screen reader users.
|
|
82
82
|
|
|
83
83
|
If you want to hide the \`${t.titleName}\`, you can wrap it with our VisuallyHidden component.
|
|
84
84
|
|
|
85
|
-
For more information, see https://radix-ui.com/primitives/docs/components/${t.docsSlug}`;return x.useEffect(()=>{e&&(document.getElementById(e)||console.error(n))},[n,e]),null},mS="DialogDescriptionWarning",gS=({contentRef:e,descriptionId:t})=>{const r=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${Rp(mS).contentName}}.`;return x.useEffect(()=>{const o=e.current?.getAttribute("aria-describedby");t&&o&&(document.getElementById(t)||console.warn(r))},[r,e,t]),null},xS=vp,bS=kp,yS=Sp,vS=Cp,wS=jp,kS=Ep,_S=Ip;function SS(e){const t=x.useRef({value:e,previous:e});return x.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}function CS(e){const[t,n]=x.useState(void 0);return ot(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});const r=new ResizeObserver(o=>{if(!Array.isArray(o)||!o.length)return;const s=o[0];let i,l;if("borderBoxSize"in s){const c=s.borderBoxSize,u=Array.isArray(c)?c[0]:c;i=u.inlineSize,l=u.blockSize}else i=e.offsetWidth,l=e.offsetHeight;n({width:i,height:l})});return r.observe(e,{box:"border-box"}),()=>r.unobserve(e)}else n(void 0)},[e]),t}const jS=["top","right","bottom","left"],mn=Math.min,bt=Math.max,Uo=Math.round,go=Math.floor,Ut=e=>({x:e,y:e}),NS={left:"right",right:"left",bottom:"top",top:"bottom"},ES={start:"end",end:"start"};function Ui(e,t,n){return bt(e,mn(t,n))}function en(e,t){return typeof e=="function"?e(t):e}function tn(e){return e.split("-")[0]}function dr(e){return e.split("-")[1]}function Ga(e){return e==="x"?"y":"x"}function Ja(e){return e==="y"?"height":"width"}const TS=new Set(["top","bottom"]);function $t(e){return TS.has(tn(e))?"y":"x"}function Ya(e){return Ga($t(e))}function AS(e,t,n){n===void 0&&(n=!1);const r=dr(e),o=Ya(e),s=Ja(o);let i=o==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[s]>t.floating[s]&&(i=Wo(i)),[i,Wo(i)]}function IS(e){const t=Wo(e);return[Wi(e),t,Wi(t)]}function Wi(e){return e.replace(/start|end/g,t=>ES[t])}const Fc=["left","right"],$c=["right","left"],zS=["top","bottom"],RS=["bottom","top"];function PS(e,t,n){switch(e){case"top":case"bottom":return n?t?$c:Fc:t?Fc:$c;case"left":case"right":return t?zS:RS;default:return[]}}function OS(e,t,n,r){const o=dr(e);let s=PS(tn(e),n==="start",r);return o&&(s=s.map(i=>i+"-"+o),t&&(s=s.concat(s.map(Wi)))),s}function Wo(e){return e.replace(/left|right|bottom|top/g,t=>NS[t])}function MS(e){return{top:0,right:0,bottom:0,left:0,...e}}function Pp(e){return typeof e!="number"?MS(e):{top:e,right:e,bottom:e,left:e}}function Ho(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 Bc(e,t,n){let{reference:r,floating:o}=e;const s=$t(t),i=Ya(t),l=Ja(i),c=tn(t),u=s==="y",d=r.x+r.width/2-o.width/2,f=r.y+r.height/2-o.height/2,h=r[l]/2-o[l]/2;let p;switch(c){case"top":p={x:d,y:r.y-o.height};break;case"bottom":p={x:d,y:r.y+r.height};break;case"right":p={x:r.x+r.width,y:f};break;case"left":p={x:r.x-o.width,y:f};break;default:p={x:r.x,y:r.y}}switch(dr(t)){case"start":p[i]-=h*(n&&u?-1:1);break;case"end":p[i]+=h*(n&&u?-1:1);break}return p}async function LS(e,t){var n;t===void 0&&(t={});const{x:r,y:o,platform:s,rects:i,elements:l,strategy:c}=e,{boundary:u="clippingAncestors",rootBoundary:d="viewport",elementContext:f="floating",altBoundary:h=!1,padding:p=0}=en(t,e),y=Pp(p),g=l[h?f==="floating"?"reference":"floating":f],b=Ho(await s.getClippingRect({element:(n=await(s.isElement==null?void 0:s.isElement(g)))==null||n?g:g.contextElement||await(s.getDocumentElement==null?void 0:s.getDocumentElement(l.floating)),boundary:u,rootBoundary:d,strategy:c})),v=f==="floating"?{x:r,y:o,width:i.floating.width,height:i.floating.height}:i.reference,k=await(s.getOffsetParent==null?void 0:s.getOffsetParent(l.floating)),S=await(s.isElement==null?void 0:s.isElement(k))?await(s.getScale==null?void 0:s.getScale(k))||{x:1,y:1}:{x:1,y:1},C=Ho(s.convertOffsetParentRelativeRectToViewportRelativeRect?await s.convertOffsetParentRelativeRectToViewportRelativeRect({elements:l,rect:v,offsetParent:k,strategy:c}):v);return{top:(b.top-C.top+y.top)/S.y,bottom:(C.bottom-b.bottom+y.bottom)/S.y,left:(b.left-C.left+y.left)/S.x,right:(C.right-b.right+y.right)/S.x}}const DS=async(e,t,n)=>{const{placement:r="bottom",strategy:o="absolute",middleware:s=[],platform:i}=n,l=s.filter(Boolean),c=await(i.isRTL==null?void 0:i.isRTL(t));let u=await i.getElementRects({reference:e,floating:t,strategy:o}),{x:d,y:f}=Bc(u,r,c),h=r,p={},y=0;for(let g=0;g<l.length;g++){var m;const{name:b,fn:v}=l[g],{x:k,y:S,data:C,reset:j}=await v({x:d,y:f,initialPlacement:r,placement:h,strategy:o,middlewareData:p,rects:u,platform:{...i,detectOverflow:(m=i.detectOverflow)!=null?m:LS},elements:{reference:e,floating:t}});d=k??d,f=S??f,p={...p,[b]:{...p[b],...C}},j&&y<=50&&(y++,typeof j=="object"&&(j.placement&&(h=j.placement),j.rects&&(u=j.rects===!0?await i.getElementRects({reference:e,floating:t,strategy:o}):j.rects),{x:d,y:f}=Bc(u,h,c)),g=-1)}return{x:d,y:f,placement:h,strategy:o,middlewareData:p}},FS=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:r,placement:o,rects:s,platform:i,elements:l,middlewareData:c}=t,{element:u,padding:d=0}=en(e,t)||{};if(u==null)return{};const f=Pp(d),h={x:n,y:r},p=Ya(o),y=Ja(p),m=await i.getDimensions(u),g=p==="y",b=g?"top":"left",v=g?"bottom":"right",k=g?"clientHeight":"clientWidth",S=s.reference[y]+s.reference[p]-h[p]-s.floating[y],C=h[p]-s.reference[p],j=await(i.getOffsetParent==null?void 0:i.getOffsetParent(u));let E=j?j[k]:0;(!E||!await(i.isElement==null?void 0:i.isElement(j)))&&(E=l.floating[k]||s.floating[y]);const T=S/2-C/2,z=E/2-m[y]/2-1,O=mn(f[b],z),B=mn(f[v],z),N=O,D=E-m[y]-B,w=E/2-m[y]/2+T,L=Ui(N,w,D),W=!c.arrow&&dr(o)!=null&&w!==L&&s.reference[y]/2-(w<N?O:B)-m[y]/2<0,U=W?w<N?w-N:w-D:0;return{[p]:h[p]+U,data:{[p]:L,centerOffset:w-L-U,...W&&{alignmentOffset:U}},reset:W}}}),$S=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,r;const{placement:o,middlewareData:s,rects:i,initialPlacement:l,platform:c,elements:u}=t,{mainAxis:d=!0,crossAxis:f=!0,fallbackPlacements:h,fallbackStrategy:p="bestFit",fallbackAxisSideDirection:y="none",flipAlignment:m=!0,...g}=en(e,t);if((n=s.arrow)!=null&&n.alignmentOffset)return{};const b=tn(o),v=$t(l),k=tn(l)===l,S=await(c.isRTL==null?void 0:c.isRTL(u.floating)),C=h||(k||!m?[Wo(l)]:IS(l)),j=y!=="none";!h&&j&&C.push(...OS(l,m,y,S));const E=[l,...C],T=await c.detectOverflow(t,g),z=[];let O=((r=s.flip)==null?void 0:r.overflows)||[];if(d&&z.push(T[b]),f){const w=AS(o,i,S);z.push(T[w[0]],T[w[1]])}if(O=[...O,{placement:o,overflows:z}],!z.every(w=>w<=0)){var B,N;const w=(((B=s.flip)==null?void 0:B.index)||0)+1,L=E[w];if(L&&(!(f==="alignment"?v!==$t(L):!1)||O.every(F=>$t(F.placement)===v?F.overflows[0]>0:!0)))return{data:{index:w,overflows:O},reset:{placement:L}};let W=(N=O.filter(U=>U.overflows[0]<=0).sort((U,F)=>U.overflows[1]-F.overflows[1])[0])==null?void 0:N.placement;if(!W)switch(p){case"bestFit":{var D;const U=(D=O.filter(F=>{if(j){const K=$t(F.placement);return K===v||K==="y"}return!0}).map(F=>[F.placement,F.overflows.filter(K=>K>0).reduce((K,I)=>K+I,0)]).sort((F,K)=>F[1]-K[1])[0])==null?void 0:D[0];U&&(W=U);break}case"initialPlacement":W=l;break}if(o!==W)return{reset:{placement:W}}}return{}}}};function Uc(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function Wc(e){return jS.some(t=>e[t]>=0)}const BS=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n,platform:r}=t,{strategy:o="referenceHidden",...s}=en(e,t);switch(o){case"referenceHidden":{const i=await r.detectOverflow(t,{...s,elementContext:"reference"}),l=Uc(i,n.reference);return{data:{referenceHiddenOffsets:l,referenceHidden:Wc(l)}}}case"escaped":{const i=await r.detectOverflow(t,{...s,altBoundary:!0}),l=Uc(i,n.floating);return{data:{escapedOffsets:l,escaped:Wc(l)}}}default:return{}}}}},Op=new Set(["left","top"]);async function US(e,t){const{placement:n,platform:r,elements:o}=e,s=await(r.isRTL==null?void 0:r.isRTL(o.floating)),i=tn(n),l=dr(n),c=$t(n)==="y",u=Op.has(i)?-1:1,d=s&&c?-1:1,f=en(t,e);let{mainAxis:h,crossAxis:p,alignmentAxis:y}=typeof f=="number"?{mainAxis:f,crossAxis:0,alignmentAxis:null}:{mainAxis:f.mainAxis||0,crossAxis:f.crossAxis||0,alignmentAxis:f.alignmentAxis};return l&&typeof y=="number"&&(p=l==="end"?y*-1:y),c?{x:p*d,y:h*u}:{x:h*u,y:p*d}}const WS=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,r;const{x:o,y:s,placement:i,middlewareData:l}=t,c=await US(t,e);return i===((n=l.offset)==null?void 0:n.placement)&&(r=l.arrow)!=null&&r.alignmentOffset?{}:{x:o+c.x,y:s+c.y,data:{...c,placement:i}}}}},HS=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:r,placement:o,platform:s}=t,{mainAxis:i=!0,crossAxis:l=!1,limiter:c={fn:b=>{let{x:v,y:k}=b;return{x:v,y:k}}},...u}=en(e,t),d={x:n,y:r},f=await s.detectOverflow(t,u),h=$t(tn(o)),p=Ga(h);let y=d[p],m=d[h];if(i){const b=p==="y"?"top":"left",v=p==="y"?"bottom":"right",k=y+f[b],S=y-f[v];y=Ui(k,y,S)}if(l){const b=h==="y"?"top":"left",v=h==="y"?"bottom":"right",k=m+f[b],S=m-f[v];m=Ui(k,m,S)}const g=c.fn({...t,[p]:y,[h]:m});return{...g,data:{x:g.x-n,y:g.y-r,enabled:{[p]:i,[h]:l}}}}}},VS=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:n,y:r,placement:o,rects:s,middlewareData:i}=t,{offset:l=0,mainAxis:c=!0,crossAxis:u=!0}=en(e,t),d={x:n,y:r},f=$t(o),h=Ga(f);let p=d[h],y=d[f];const m=en(l,t),g=typeof m=="number"?{mainAxis:m,crossAxis:0}:{mainAxis:0,crossAxis:0,...m};if(c){const k=h==="y"?"height":"width",S=s.reference[h]-s.floating[k]+g.mainAxis,C=s.reference[h]+s.reference[k]-g.mainAxis;p<S?p=S:p>C&&(p=C)}if(u){var b,v;const k=h==="y"?"width":"height",S=Op.has(tn(o)),C=s.reference[f]-s.floating[k]+(S&&((b=i.offset)==null?void 0:b[f])||0)+(S?0:g.crossAxis),j=s.reference[f]+s.reference[k]+(S?0:((v=i.offset)==null?void 0:v[f])||0)-(S?g.crossAxis:0);y<C?y=C:y>j&&(y=j)}return{[h]:p,[f]:y}}}},ZS=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var n,r;const{placement:o,rects:s,platform:i,elements:l}=t,{apply:c=()=>{},...u}=en(e,t),d=await i.detectOverflow(t,u),f=tn(o),h=dr(o),p=$t(o)==="y",{width:y,height:m}=s.floating;let g,b;f==="top"||f==="bottom"?(g=f,b=h===(await(i.isRTL==null?void 0:i.isRTL(l.floating))?"start":"end")?"left":"right"):(b=f,g=h==="end"?"top":"bottom");const v=m-d.top-d.bottom,k=y-d.left-d.right,S=mn(m-d[g],v),C=mn(y-d[b],k),j=!t.middlewareData.shift;let E=S,T=C;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(T=k),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(E=v),j&&!h){const O=bt(d.left,0),B=bt(d.right,0),N=bt(d.top,0),D=bt(d.bottom,0);p?T=y-2*(O!==0||B!==0?O+B:bt(d.left,d.right)):E=m-2*(N!==0||D!==0?N+D:bt(d.top,d.bottom))}await c({...t,availableWidth:T,availableHeight:E});const z=await i.getDimensions(l.floating);return y!==z.width||m!==z.height?{reset:{rects:!0}}:{}}}};function ys(){return typeof window<"u"}function fr(e){return Mp(e)?(e.nodeName||"").toLowerCase():"#document"}function vt(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function qt(e){var t;return(t=(Mp(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function Mp(e){return ys()?e instanceof Node||e instanceof vt(e).Node:!1}function zt(e){return ys()?e instanceof Element||e instanceof vt(e).Element:!1}function Ht(e){return ys()?e instanceof HTMLElement||e instanceof vt(e).HTMLElement:!1}function Hc(e){return!ys()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof vt(e).ShadowRoot}const qS=new Set(["inline","contents"]);function Kr(e){const{overflow:t,overflowX:n,overflowY:r,display:o}=Rt(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&!qS.has(o)}const KS=new Set(["table","td","th"]);function GS(e){return KS.has(fr(e))}const JS=[":popover-open",":modal"];function vs(e){return JS.some(t=>{try{return e.matches(t)}catch{return!1}})}const YS=["transform","translate","scale","rotate","perspective"],XS=["transform","translate","scale","rotate","perspective","filter"],QS=["paint","layout","strict","content"];function Xa(e){const t=Qa(),n=zt(e)?Rt(e):e;return YS.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)||XS.some(r=>(n.willChange||"").includes(r))||QS.some(r=>(n.contain||"").includes(r))}function eC(e){let t=gn(e);for(;Ht(t)&&!sr(t);){if(Xa(t))return t;if(vs(t))return null;t=gn(t)}return null}function Qa(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const tC=new Set(["html","body","#document"]);function sr(e){return tC.has(fr(e))}function Rt(e){return vt(e).getComputedStyle(e)}function ws(e){return zt(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function gn(e){if(fr(e)==="html")return e;const t=e.assignedSlot||e.parentNode||Hc(e)&&e.host||qt(e);return Hc(t)?t.host:t}function Lp(e){const t=gn(e);return sr(t)?e.ownerDocument?e.ownerDocument.body:e.body:Ht(t)&&Kr(t)?t:Lp(t)}function Fr(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);const o=Lp(e),s=o===((r=e.ownerDocument)==null?void 0:r.body),i=vt(o);if(s){const l=Hi(i);return t.concat(i,i.visualViewport||[],Kr(o)?o:[],l&&n?Fr(l):[])}return t.concat(o,Fr(o,[],n))}function Hi(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function Dp(e){const t=Rt(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const o=Ht(e),s=o?e.offsetWidth:n,i=o?e.offsetHeight:r,l=Uo(n)!==s||Uo(r)!==i;return l&&(n=s,r=i),{width:n,height:r,$:l}}function el(e){return zt(e)?e:e.contextElement}function Yn(e){const t=el(e);if(!Ht(t))return Ut(1);const n=t.getBoundingClientRect(),{width:r,height:o,$:s}=Dp(t);let i=(s?Uo(n.width):n.width)/r,l=(s?Uo(n.height):n.height)/o;return(!i||!Number.isFinite(i))&&(i=1),(!l||!Number.isFinite(l))&&(l=1),{x:i,y:l}}const nC=Ut(0);function Fp(e){const t=vt(e);return!Qa()||!t.visualViewport?nC:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function rC(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==vt(e)?!1:t}function En(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const o=e.getBoundingClientRect(),s=el(e);let i=Ut(1);t&&(r?zt(r)&&(i=Yn(r)):i=Yn(e));const l=rC(s,n,r)?Fp(s):Ut(0);let c=(o.left+l.x)/i.x,u=(o.top+l.y)/i.y,d=o.width/i.x,f=o.height/i.y;if(s){const h=vt(s),p=r&&zt(r)?vt(r):r;let y=h,m=Hi(y);for(;m&&r&&p!==y;){const g=Yn(m),b=m.getBoundingClientRect(),v=Rt(m),k=b.left+(m.clientLeft+parseFloat(v.paddingLeft))*g.x,S=b.top+(m.clientTop+parseFloat(v.paddingTop))*g.y;c*=g.x,u*=g.y,d*=g.x,f*=g.y,c+=k,u+=S,y=vt(m),m=Hi(y)}}return Ho({width:d,height:f,x:c,y:u})}function ks(e,t){const n=ws(e).scrollLeft;return t?t.left+n:En(qt(e)).left+n}function $p(e,t){const n=e.getBoundingClientRect(),r=n.left+t.scrollLeft-ks(e,n),o=n.top+t.scrollTop;return{x:r,y:o}}function oC(e){let{elements:t,rect:n,offsetParent:r,strategy:o}=e;const s=o==="fixed",i=qt(r),l=t?vs(t.floating):!1;if(r===i||l&&s)return n;let c={scrollLeft:0,scrollTop:0},u=Ut(1);const d=Ut(0),f=Ht(r);if((f||!f&&!s)&&((fr(r)!=="body"||Kr(i))&&(c=ws(r)),Ht(r))){const p=En(r);u=Yn(r),d.x=p.x+r.clientLeft,d.y=p.y+r.clientTop}const h=i&&!f&&!s?$p(i,c):Ut(0);return{width:n.width*u.x,height:n.height*u.y,x:n.x*u.x-c.scrollLeft*u.x+d.x+h.x,y:n.y*u.y-c.scrollTop*u.y+d.y+h.y}}function sC(e){return Array.from(e.getClientRects())}function iC(e){const t=qt(e),n=ws(e),r=e.ownerDocument.body,o=bt(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),s=bt(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let i=-n.scrollLeft+ks(e);const l=-n.scrollTop;return Rt(r).direction==="rtl"&&(i+=bt(t.clientWidth,r.clientWidth)-o),{width:o,height:s,x:i,y:l}}const Vc=25;function aC(e,t){const n=vt(e),r=qt(e),o=n.visualViewport;let s=r.clientWidth,i=r.clientHeight,l=0,c=0;if(o){s=o.width,i=o.height;const d=Qa();(!d||d&&t==="fixed")&&(l=o.offsetLeft,c=o.offsetTop)}const u=ks(r);if(u<=0){const d=r.ownerDocument,f=d.body,h=getComputedStyle(f),p=d.compatMode==="CSS1Compat"&&parseFloat(h.marginLeft)+parseFloat(h.marginRight)||0,y=Math.abs(r.clientWidth-f.clientWidth-p);y<=Vc&&(s-=y)}else u<=Vc&&(s+=u);return{width:s,height:i,x:l,y:c}}const lC=new Set(["absolute","fixed"]);function cC(e,t){const n=En(e,!0,t==="fixed"),r=n.top+e.clientTop,o=n.left+e.clientLeft,s=Ht(e)?Yn(e):Ut(1),i=e.clientWidth*s.x,l=e.clientHeight*s.y,c=o*s.x,u=r*s.y;return{width:i,height:l,x:c,y:u}}function Zc(e,t,n){let r;if(t==="viewport")r=aC(e,n);else if(t==="document")r=iC(qt(e));else if(zt(t))r=cC(t,n);else{const o=Fp(e);r={x:t.x-o.x,y:t.y-o.y,width:t.width,height:t.height}}return Ho(r)}function Bp(e,t){const n=gn(e);return n===t||!zt(n)||sr(n)?!1:Rt(n).position==="fixed"||Bp(n,t)}function uC(e,t){const n=t.get(e);if(n)return n;let r=Fr(e,[],!1).filter(l=>zt(l)&&fr(l)!=="body"),o=null;const s=Rt(e).position==="fixed";let i=s?gn(e):e;for(;zt(i)&&!sr(i);){const l=Rt(i),c=Xa(i);!c&&l.position==="fixed"&&(o=null),(s?!c&&!o:!c&&l.position==="static"&&!!o&&lC.has(o.position)||Kr(i)&&!c&&Bp(e,i))?r=r.filter(d=>d!==i):o=l,i=gn(i)}return t.set(e,r),r}function dC(e){let{element:t,boundary:n,rootBoundary:r,strategy:o}=e;const i=[...n==="clippingAncestors"?vs(t)?[]:uC(t,this._c):[].concat(n),r],l=i[0],c=i.reduce((u,d)=>{const f=Zc(t,d,o);return u.top=bt(f.top,u.top),u.right=mn(f.right,u.right),u.bottom=mn(f.bottom,u.bottom),u.left=bt(f.left,u.left),u},Zc(t,l,o));return{width:c.right-c.left,height:c.bottom-c.top,x:c.left,y:c.top}}function fC(e){const{width:t,height:n}=Dp(e);return{width:t,height:n}}function pC(e,t,n){const r=Ht(t),o=qt(t),s=n==="fixed",i=En(e,!0,s,t);let l={scrollLeft:0,scrollTop:0};const c=Ut(0);function u(){c.x=ks(o)}if(r||!r&&!s)if((fr(t)!=="body"||Kr(o))&&(l=ws(t)),r){const p=En(t,!0,s,t);c.x=p.x+t.clientLeft,c.y=p.y+t.clientTop}else o&&u();s&&!r&&o&&u();const d=o&&!r&&!s?$p(o,l):Ut(0),f=i.left+l.scrollLeft-c.x-d.x,h=i.top+l.scrollTop-c.y-d.y;return{x:f,y:h,width:i.width,height:i.height}}function ti(e){return Rt(e).position==="static"}function qc(e,t){if(!Ht(e)||Rt(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return qt(e)===n&&(n=n.ownerDocument.body),n}function Up(e,t){const n=vt(e);if(vs(e))return n;if(!Ht(e)){let o=gn(e);for(;o&&!sr(o);){if(zt(o)&&!ti(o))return o;o=gn(o)}return n}let r=qc(e,t);for(;r&&GS(r)&&ti(r);)r=qc(r,t);return r&&sr(r)&&ti(r)&&!Xa(r)?n:r||eC(e)||n}const hC=async function(e){const t=this.getOffsetParent||Up,n=this.getDimensions,r=await n(e.floating);return{reference:pC(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function mC(e){return Rt(e).direction==="rtl"}const gC={convertOffsetParentRelativeRectToViewportRelativeRect:oC,getDocumentElement:qt,getClippingRect:dC,getOffsetParent:Up,getElementRects:hC,getClientRects:sC,getDimensions:fC,getScale:Yn,isElement:zt,isRTL:mC};function Wp(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function xC(e,t){let n=null,r;const o=qt(e);function s(){var l;clearTimeout(r),(l=n)==null||l.disconnect(),n=null}function i(l,c){l===void 0&&(l=!1),c===void 0&&(c=1),s();const u=e.getBoundingClientRect(),{left:d,top:f,width:h,height:p}=u;if(l||t(),!h||!p)return;const y=go(f),m=go(o.clientWidth-(d+h)),g=go(o.clientHeight-(f+p)),b=go(d),k={rootMargin:-y+"px "+-m+"px "+-g+"px "+-b+"px",threshold:bt(0,mn(1,c))||1};let S=!0;function C(j){const E=j[0].intersectionRatio;if(E!==c){if(!S)return i();E?i(!1,E):r=setTimeout(()=>{i(!1,1e-7)},1e3)}E===1&&!Wp(u,e.getBoundingClientRect())&&i(),S=!1}try{n=new IntersectionObserver(C,{...k,root:o.ownerDocument})}catch{n=new IntersectionObserver(C,k)}n.observe(e)}return i(!0),s}function bC(e,t,n,r){r===void 0&&(r={});const{ancestorScroll:o=!0,ancestorResize:s=!0,elementResize:i=typeof ResizeObserver=="function",layoutShift:l=typeof IntersectionObserver=="function",animationFrame:c=!1}=r,u=el(e),d=o||s?[...u?Fr(u):[],...Fr(t)]:[];d.forEach(b=>{o&&b.addEventListener("scroll",n,{passive:!0}),s&&b.addEventListener("resize",n)});const f=u&&l?xC(u,n):null;let h=-1,p=null;i&&(p=new ResizeObserver(b=>{let[v]=b;v&&v.target===u&&p&&(p.unobserve(t),cancelAnimationFrame(h),h=requestAnimationFrame(()=>{var k;(k=p)==null||k.observe(t)})),n()}),u&&!c&&p.observe(u),p.observe(t));let y,m=c?En(e):null;c&&g();function g(){const b=En(e);m&&!Wp(m,b)&&n(),m=b,y=requestAnimationFrame(g)}return n(),()=>{var b;d.forEach(v=>{o&&v.removeEventListener("scroll",n),s&&v.removeEventListener("resize",n)}),f?.(),(b=p)==null||b.disconnect(),p=null,c&&cancelAnimationFrame(y)}}const yC=WS,vC=HS,wC=$S,kC=ZS,_C=BS,Kc=FS,SC=VS,CC=(e,t,n)=>{const r=new Map,o={platform:gC,...n},s={...o.platform,_c:r};return DS(e,t,{...o,platform:s})};var jC=typeof document<"u",NC=function(){},Eo=jC?x.useLayoutEffect:NC;function Vo(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(!Vo(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 s=o[r];if(!(s==="_owner"&&e.$$typeof)&&!Vo(e[s],t[s]))return!1}return!0}return e!==e&&t!==t}function Hp(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function Gc(e,t){const n=Hp(e);return Math.round(t*n)/n}function ni(e){const t=x.useRef(e);return Eo(()=>{t.current=e}),t}function EC(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:r=[],platform:o,elements:{reference:s,floating:i}={},transform:l=!0,whileElementsMounted:c,open:u}=e,[d,f]=x.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[h,p]=x.useState(r);Vo(h,r)||p(r);const[y,m]=x.useState(null),[g,b]=x.useState(null),v=x.useCallback(F=>{F!==j.current&&(j.current=F,m(F))},[]),k=x.useCallback(F=>{F!==E.current&&(E.current=F,b(F))},[]),S=s||y,C=i||g,j=x.useRef(null),E=x.useRef(null),T=x.useRef(d),z=c!=null,O=ni(c),B=ni(o),N=ni(u),D=x.useCallback(()=>{if(!j.current||!E.current)return;const F={placement:t,strategy:n,middleware:h};B.current&&(F.platform=B.current),CC(j.current,E.current,F).then(K=>{const I={...K,isPositioned:N.current!==!1};w.current&&!Vo(T.current,I)&&(T.current=I,Zr.flushSync(()=>{f(I)}))})},[h,t,n,B,N]);Eo(()=>{u===!1&&T.current.isPositioned&&(T.current.isPositioned=!1,f(F=>({...F,isPositioned:!1})))},[u]);const w=x.useRef(!1);Eo(()=>(w.current=!0,()=>{w.current=!1}),[]),Eo(()=>{if(S&&(j.current=S),C&&(E.current=C),S&&C){if(O.current)return O.current(S,C,D);D()}},[S,C,D,O,z]);const L=x.useMemo(()=>({reference:j,floating:E,setReference:v,setFloating:k}),[v,k]),W=x.useMemo(()=>({reference:S,floating:C}),[S,C]),U=x.useMemo(()=>{const F={position:n,left:0,top:0};if(!W.floating)return F;const K=Gc(W.floating,d.x),I=Gc(W.floating,d.y);return l?{...F,transform:"translate("+K+"px, "+I+"px)",...Hp(W.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:K,top:I}},[n,l,W.floating,d.x,d.y]);return x.useMemo(()=>({...d,update:D,refs:L,elements:W,floatingStyles:U}),[d,D,L,W,U])}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?Kc({element:r.current,padding:o}).fn(n):{}:r?Kc({element:r,padding:o}).fn(n):{}}}},AC=(e,t)=>({...yC(e),options:[e,t]}),IC=(e,t)=>({...vC(e),options:[e,t]}),zC=(e,t)=>({...SC(e),options:[e,t]}),RC=(e,t)=>({...wC(e),options:[e,t]}),PC=(e,t)=>({...kC(e),options:[e,t]}),OC=(e,t)=>({..._C(e),options:[e,t]}),MC=(e,t)=>({...TC(e),options:[e,t]});var LC="Arrow",Vp=x.forwardRef((e,t)=>{const{children:n,width:r=10,height:o=5,...s}=e;return a.jsx(Te.svg,{...s,ref:t,width:r,height:o,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?n:a.jsx("polygon",{points:"0,0 30,0 15,10"})})});Vp.displayName=LC;var DC=Vp,tl="Popper",[Zp,_s]=sn(tl),[FC,qp]=Zp(tl),Kp=e=>{const{__scopePopper:t,children:n}=e,[r,o]=x.useState(null);return a.jsx(FC,{scope:t,anchor:r,onAnchorChange:o,children:n})};Kp.displayName=tl;var Gp="PopperAnchor",Jp=x.forwardRef((e,t)=>{const{__scopePopper:n,virtualRef:r,...o}=e,s=qp(Gp,n),i=x.useRef(null),l=De(t,i),c=x.useRef(null);return x.useEffect(()=>{const u=c.current;c.current=r?.current||i.current,u!==c.current&&s.onAnchorChange(c.current)}),r?null:a.jsx(Te.div,{...o,ref:l})});Jp.displayName=Gp;var nl="PopperContent",[$C,BC]=Zp(nl),Yp=x.forwardRef((e,t)=>{const{__scopePopper:n,side:r="bottom",sideOffset:o=0,align:s="center",alignOffset:i=0,arrowPadding:l=0,avoidCollisions:c=!0,collisionBoundary:u=[],collisionPadding:d=0,sticky:f="partial",hideWhenDetached:h=!1,updatePositionStrategy:p="optimized",onPlaced:y,...m}=e,g=qp(nl,n),[b,v]=x.useState(null),k=De(t,le=>v(le)),[S,C]=x.useState(null),j=CS(S),E=j?.width??0,T=j?.height??0,z=r+(s!=="center"?"-"+s:""),O=typeof d=="number"?d:{top:0,right:0,bottom:0,left:0,...d},B=Array.isArray(u)?u:[u],N=B.length>0,D={padding:O,boundary:B.filter(WC),altBoundary:N},{refs:w,floatingStyles:L,placement:W,isPositioned:U,middlewareData:F}=EC({strategy:"fixed",placement:z,whileElementsMounted:(...le)=>bC(...le,{animationFrame:p==="always"}),elements:{reference:g.anchor},middleware:[AC({mainAxis:o+T,alignmentAxis:i}),c&&IC({mainAxis:!0,crossAxis:!1,limiter:f==="partial"?zC():void 0,...D}),c&&RC({...D}),PC({...D,apply:({elements:le,rects:de,availableWidth:pe,availableHeight:he})=>{const{width:me,height:_e}=de.reference,Pe=le.floating.style;Pe.setProperty("--radix-popper-available-width",`${pe}px`),Pe.setProperty("--radix-popper-available-height",`${he}px`),Pe.setProperty("--radix-popper-anchor-width",`${me}px`),Pe.setProperty("--radix-popper-anchor-height",`${_e}px`)}}),S&&MC({element:S,padding:l}),HC({arrowWidth:E,arrowHeight:T}),h&&OC({strategy:"referenceHidden",...D})]}),[K,I]=eh(W),V=lt(y);ot(()=>{U&&V?.()},[U,V]);const G=F.arrow?.x,R=F.arrow?.y,ae=F.arrow?.centerOffset!==0,[oe,fe]=x.useState();return ot(()=>{b&&fe(window.getComputedStyle(b).zIndex)},[b]),a.jsx("div",{ref:w.setFloating,"data-radix-popper-content-wrapper":"",style:{...L,transform:U?L.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:oe,"--radix-popper-transform-origin":[F.transformOrigin?.x,F.transformOrigin?.y].join(" "),...F.hide?.referenceHidden&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:a.jsx($C,{scope:n,placedSide:K,onArrowChange:C,arrowX:G,arrowY:R,shouldHideArrow:ae,children:a.jsx(Te.div,{"data-side":K,"data-align":I,...m,ref:k,style:{...m.style,animation:U?void 0:"none"}})})})});Yp.displayName=nl;var Xp="PopperArrow",UC={top:"bottom",right:"left",bottom:"top",left:"right"},Qp=x.forwardRef(function(t,n){const{__scopePopper:r,...o}=t,s=BC(Xp,r),i=UC[s.placedSide];return a.jsx("span",{ref:s.onArrowChange,style:{position:"absolute",left:s.arrowX,top:s.arrowY,[i]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[s.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[s.placedSide],visibility:s.shouldHideArrow?"hidden":void 0},children:a.jsx(DC,{...o,ref:n,style:{...o.style,display:"block"}})})});Qp.displayName=Xp;function WC(e){return e!==null}var HC=e=>({name:"transformOrigin",options:e,fn(t){const{placement:n,rects:r,middlewareData:o}=t,i=o.arrow?.centerOffset!==0,l=i?0:e.arrowWidth,c=i?0:e.arrowHeight,[u,d]=eh(n),f={start:"0%",center:"50%",end:"100%"}[d],h=(o.arrow?.x??0)+l/2,p=(o.arrow?.y??0)+c/2;let y="",m="";return u==="bottom"?(y=i?f:`${h}px`,m=`${-c}px`):u==="top"?(y=i?f:`${h}px`,m=`${r.floating.height+c}px`):u==="right"?(y=`${-c}px`,m=i?f:`${p}px`):u==="left"&&(y=`${r.floating.width+c}px`,m=i?f:`${p}px`),{data:{x:y,y:m}}}});function eh(e){const[t,n="center"]=e.split("-");return[t,n]}var th=Kp,nh=Jp,rh=Yp,oh=Qp,ri="rovingFocusGroup.onEntryFocus",VC={bubbles:!1,cancelable:!0},Gr="RovingFocusGroup",[Vi,sh,ZC]=tp(Gr),[qC,ih]=sn(Gr,[ZC]),[KC,GC]=qC(Gr),ah=x.forwardRef((e,t)=>a.jsx(Vi.Provider,{scope:e.__scopeRovingFocusGroup,children:a.jsx(Vi.Slot,{scope:e.__scopeRovingFocusGroup,children:a.jsx(JC,{...e,ref:t})})}));ah.displayName=Gr;var JC=x.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,orientation:r,loop:o=!1,dir:s,currentTabStopId:i,defaultCurrentTabStopId:l,onCurrentTabStopIdChange:c,onEntryFocus:u,preventScrollOnEntryFocus:d=!1,...f}=e,h=x.useRef(null),p=De(t,h),y=hs(s),[m,g]=jn({prop:i,defaultProp:l??null,onChange:c,caller:Gr}),[b,v]=x.useState(!1),k=lt(u),S=sh(n),C=x.useRef(!1),[j,E]=x.useState(0);return x.useEffect(()=>{const T=h.current;if(T)return T.addEventListener(ri,k),()=>T.removeEventListener(ri,k)},[k]),a.jsx(KC,{scope:n,orientation:r,dir:y,loop:o,currentTabStopId:m,onItemFocus:x.useCallback(T=>g(T),[g]),onItemShiftTab:x.useCallback(()=>v(!0),[]),onFocusableItemAdd:x.useCallback(()=>E(T=>T+1),[]),onFocusableItemRemove:x.useCallback(()=>E(T=>T-1),[]),children:a.jsx(Te.div,{tabIndex:b||j===0?-1:0,"data-orientation":r,...f,ref:p,style:{outline:"none",...e.style},onMouseDown:Se(e.onMouseDown,()=>{C.current=!0}),onFocus:Se(e.onFocus,T=>{const z=!C.current;if(T.target===T.currentTarget&&z&&!b){const O=new CustomEvent(ri,VC);if(T.currentTarget.dispatchEvent(O),!O.defaultPrevented){const B=S().filter(W=>W.focusable),N=B.find(W=>W.active),D=B.find(W=>W.id===m),L=[N,D,...B].filter(Boolean).map(W=>W.ref.current);uh(L,d)}}C.current=!1}),onBlur:Se(e.onBlur,()=>v(!1))})})}),lh="RovingFocusGroupItem",ch=x.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,focusable:r=!0,active:o=!1,tabStopId:s,children:i,...l}=e,c=Bt(),u=s||c,d=GC(lh,n),f=d.currentTabStopId===u,h=sh(n),{onFocusableItemAdd:p,onFocusableItemRemove:y,currentTabStopId:m}=d;return x.useEffect(()=>{if(r)return p(),()=>y()},[r,p,y]),a.jsx(Vi.ItemSlot,{scope:n,id:u,focusable:r,active:o,children:a.jsx(Te.span,{tabIndex:f?0:-1,"data-orientation":d.orientation,...l,ref:t,onMouseDown:Se(e.onMouseDown,g=>{r?d.onItemFocus(u):g.preventDefault()}),onFocus:Se(e.onFocus,()=>d.onItemFocus(u)),onKeyDown:Se(e.onKeyDown,g=>{if(g.key==="Tab"&&g.shiftKey){d.onItemShiftTab();return}if(g.target!==g.currentTarget)return;const b=QC(g,d.orientation,d.dir);if(b!==void 0){if(g.metaKey||g.ctrlKey||g.altKey||g.shiftKey)return;g.preventDefault();let k=h().filter(S=>S.focusable).map(S=>S.ref.current);if(b==="last")k.reverse();else if(b==="prev"||b==="next"){b==="prev"&&k.reverse();const S=k.indexOf(g.currentTarget);k=d.loop?ej(k,S+1):k.slice(S+1)}setTimeout(()=>uh(k))}}),children:typeof i=="function"?i({isCurrentTabStop:f,hasTabStop:m!=null}):i})})});ch.displayName=lh;var YC={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function XC(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function QC(e,t,n){const r=XC(e.key,n);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(r))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(r)))return YC[r]}function uh(e,t=!1){const n=document.activeElement;for(const r of e)if(r===n||(r.focus({preventScroll:t}),document.activeElement!==n))return}function ej(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var tj=ah,nj=ch;function Zi(e,[t,n]){return Math.min(n,Math.max(t,e))}function rj(e,t){return x.useReducer((n,r)=>t[n][r]??n,e)}var rl="ScrollArea",[dh]=sn(rl),[oj,Ct]=dh(rl),fh=x.forwardRef((e,t)=>{const{__scopeScrollArea:n,type:r="hover",dir:o,scrollHideDelay:s=600,...i}=e,[l,c]=x.useState(null),[u,d]=x.useState(null),[f,h]=x.useState(null),[p,y]=x.useState(null),[m,g]=x.useState(null),[b,v]=x.useState(0),[k,S]=x.useState(0),[C,j]=x.useState(!1),[E,T]=x.useState(!1),z=De(t,B=>c(B)),O=hs(o);return a.jsx(oj,{scope:n,type:r,dir:O,scrollHideDelay:s,scrollArea:l,viewport:u,onViewportChange:d,content:f,onContentChange:h,scrollbarX:p,onScrollbarXChange:y,scrollbarXEnabled:C,onScrollbarXEnabledChange:j,scrollbarY:m,onScrollbarYChange:g,scrollbarYEnabled:E,onScrollbarYEnabledChange:T,onCornerWidthChange:v,onCornerHeightChange:S,children:a.jsx(Te.div,{dir:O,...i,ref:z,style:{position:"relative","--radix-scroll-area-corner-width":b+"px","--radix-scroll-area-corner-height":k+"px",...e.style}})})});fh.displayName=rl;var ph="ScrollAreaViewport",hh=x.forwardRef((e,t)=>{const{__scopeScrollArea:n,children:r,nonce:o,...s}=e,i=Ct(ph,n),l=x.useRef(null),c=De(t,l,i.onViewportChange);return a.jsxs(a.Fragment,{children:[a.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}),a.jsx(Te.div,{"data-radix-scroll-area-viewport":"",...s,ref:c,style:{overflowX:i.scrollbarXEnabled?"scroll":"hidden",overflowY:i.scrollbarYEnabled?"scroll":"hidden",...e.style},children:a.jsx("div",{ref:i.onContentChange,style:{minWidth:"100%",display:"table"},children:r})})]})});hh.displayName=ph;var Kt="ScrollAreaScrollbar",mh=x.forwardRef((e,t)=>{const{forceMount:n,...r}=e,o=Ct(Kt,e.__scopeScrollArea),{onScrollbarXEnabledChange:s,onScrollbarYEnabledChange:i}=o,l=e.orientation==="horizontal";return x.useEffect(()=>(l?s(!0):i(!0),()=>{l?s(!1):i(!1)}),[l,s,i]),o.type==="hover"?a.jsx(sj,{...r,ref:t,forceMount:n}):o.type==="scroll"?a.jsx(ij,{...r,ref:t,forceMount:n}):o.type==="auto"?a.jsx(gh,{...r,ref:t,forceMount:n}):o.type==="always"?a.jsx(ol,{...r,ref:t}):null});mh.displayName=Kt;var sj=x.forwardRef((e,t)=>{const{forceMount:n,...r}=e,o=Ct(Kt,e.__scopeScrollArea),[s,i]=x.useState(!1);return x.useEffect(()=>{const l=o.scrollArea;let c=0;if(l){const u=()=>{window.clearTimeout(c),i(!0)},d=()=>{c=window.setTimeout(()=>i(!1),o.scrollHideDelay)};return l.addEventListener("pointerenter",u),l.addEventListener("pointerleave",d),()=>{window.clearTimeout(c),l.removeEventListener("pointerenter",u),l.removeEventListener("pointerleave",d)}}},[o.scrollArea,o.scrollHideDelay]),a.jsx(St,{present:n||s,children:a.jsx(gh,{"data-state":s?"visible":"hidden",...r,ref:t})})}),ij=x.forwardRef((e,t)=>{const{forceMount:n,...r}=e,o=Ct(Kt,e.__scopeScrollArea),s=e.orientation==="horizontal",i=Cs(()=>c("SCROLL_END"),100),[l,c]=rj("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 x.useEffect(()=>{if(l==="idle"){const u=window.setTimeout(()=>c("HIDE"),o.scrollHideDelay);return()=>window.clearTimeout(u)}},[l,o.scrollHideDelay,c]),x.useEffect(()=>{const u=o.viewport,d=s?"scrollLeft":"scrollTop";if(u){let f=u[d];const h=()=>{const p=u[d];f!==p&&(c("SCROLL"),i()),f=p};return u.addEventListener("scroll",h),()=>u.removeEventListener("scroll",h)}},[o.viewport,s,c,i]),a.jsx(St,{present:n||l!=="hidden",children:a.jsx(ol,{"data-state":l==="hidden"?"hidden":"visible",...r,ref:t,onPointerEnter:Se(e.onPointerEnter,()=>c("POINTER_ENTER")),onPointerLeave:Se(e.onPointerLeave,()=>c("POINTER_LEAVE"))})})}),gh=x.forwardRef((e,t)=>{const n=Ct(Kt,e.__scopeScrollArea),{forceMount:r,...o}=e,[s,i]=x.useState(!1),l=e.orientation==="horizontal",c=Cs(()=>{if(n.viewport){const u=n.viewport.offsetWidth<n.viewport.scrollWidth,d=n.viewport.offsetHeight<n.viewport.scrollHeight;i(l?u:d)}},10);return ir(n.viewport,c),ir(n.content,c),a.jsx(St,{present:r||s,children:a.jsx(ol,{"data-state":s?"visible":"hidden",...o,ref:t})})}),ol=x.forwardRef((e,t)=>{const{orientation:n="vertical",...r}=e,o=Ct(Kt,e.__scopeScrollArea),s=x.useRef(null),i=x.useRef(0),[l,c]=x.useState({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),u=wh(l.viewport,l.content),d={...r,sizes:l,onSizesChange:c,hasThumb:u>0&&u<1,onThumbChange:h=>s.current=h,onThumbPointerUp:()=>i.current=0,onThumbPointerDown:h=>i.current=h};function f(h,p){return fj(h,i.current,l,p)}return n==="horizontal"?a.jsx(aj,{...d,ref:t,onThumbPositionChange:()=>{if(o.viewport&&s.current){const h=o.viewport.scrollLeft,p=Jc(h,l,o.dir);s.current.style.transform=`translate3d(${p}px, 0, 0)`}},onWheelScroll:h=>{o.viewport&&(o.viewport.scrollLeft=h)},onDragScroll:h=>{o.viewport&&(o.viewport.scrollLeft=f(h,o.dir))}}):n==="vertical"?a.jsx(lj,{...d,ref:t,onThumbPositionChange:()=>{if(o.viewport&&s.current){const h=o.viewport.scrollTop,p=Jc(h,l);s.current.style.transform=`translate3d(0, ${p}px, 0)`}},onWheelScroll:h=>{o.viewport&&(o.viewport.scrollTop=h)},onDragScroll:h=>{o.viewport&&(o.viewport.scrollTop=f(h))}}):null}),aj=x.forwardRef((e,t)=>{const{sizes:n,onSizesChange:r,...o}=e,s=Ct(Kt,e.__scopeScrollArea),[i,l]=x.useState(),c=x.useRef(null),u=De(t,c,s.onScrollbarXChange);return x.useEffect(()=>{c.current&&l(getComputedStyle(c.current))},[c]),a.jsx(bh,{"data-orientation":"horizontal",...o,ref:u,sizes:n,style:{bottom:0,left:s.dir==="rtl"?"var(--radix-scroll-area-corner-width)":0,right:s.dir==="ltr"?"var(--radix-scroll-area-corner-width)":0,"--radix-scroll-area-thumb-width":Ss(n)+"px",...e.style},onThumbPointerDown:d=>e.onThumbPointerDown(d.x),onDragScroll:d=>e.onDragScroll(d.x),onWheelScroll:(d,f)=>{if(s.viewport){const h=s.viewport.scrollLeft+d.deltaX;e.onWheelScroll(h),_h(h,f)&&d.preventDefault()}},onResize:()=>{c.current&&s.viewport&&i&&r({content:s.viewport.scrollWidth,viewport:s.viewport.offsetWidth,scrollbar:{size:c.current.clientWidth,paddingStart:qo(i.paddingLeft),paddingEnd:qo(i.paddingRight)}})}})}),lj=x.forwardRef((e,t)=>{const{sizes:n,onSizesChange:r,...o}=e,s=Ct(Kt,e.__scopeScrollArea),[i,l]=x.useState(),c=x.useRef(null),u=De(t,c,s.onScrollbarYChange);return x.useEffect(()=>{c.current&&l(getComputedStyle(c.current))},[c]),a.jsx(bh,{"data-orientation":"vertical",...o,ref:u,sizes:n,style:{top:0,right:s.dir==="ltr"?0:void 0,left:s.dir==="rtl"?0:void 0,bottom:"var(--radix-scroll-area-corner-height)","--radix-scroll-area-thumb-height":Ss(n)+"px",...e.style},onThumbPointerDown:d=>e.onThumbPointerDown(d.y),onDragScroll:d=>e.onDragScroll(d.y),onWheelScroll:(d,f)=>{if(s.viewport){const h=s.viewport.scrollTop+d.deltaY;e.onWheelScroll(h),_h(h,f)&&d.preventDefault()}},onResize:()=>{c.current&&s.viewport&&i&&r({content:s.viewport.scrollHeight,viewport:s.viewport.offsetHeight,scrollbar:{size:c.current.clientHeight,paddingStart:qo(i.paddingTop),paddingEnd:qo(i.paddingBottom)}})}})}),[cj,xh]=dh(Kt),bh=x.forwardRef((e,t)=>{const{__scopeScrollArea:n,sizes:r,hasThumb:o,onThumbChange:s,onThumbPointerUp:i,onThumbPointerDown:l,onThumbPositionChange:c,onDragScroll:u,onWheelScroll:d,onResize:f,...h}=e,p=Ct(Kt,n),[y,m]=x.useState(null),g=De(t,z=>m(z)),b=x.useRef(null),v=x.useRef(""),k=p.viewport,S=r.content-r.viewport,C=lt(d),j=lt(c),E=Cs(f,10);function T(z){if(b.current){const O=z.clientX-b.current.left,B=z.clientY-b.current.top;u({x:O,y:B})}}return x.useEffect(()=>{const z=O=>{const B=O.target;y?.contains(B)&&C(O,S)};return document.addEventListener("wheel",z,{passive:!1}),()=>document.removeEventListener("wheel",z,{passive:!1})},[k,y,S,C]),x.useEffect(j,[r,j]),ir(y,E),ir(p.content,E),a.jsx(cj,{scope:n,scrollbar:y,hasThumb:o,onThumbChange:lt(s),onThumbPointerUp:lt(i),onThumbPositionChange:j,onThumbPointerDown:lt(l),children:a.jsx(Te.div,{...h,ref:g,style:{position:"absolute",...h.style},onPointerDown:Se(e.onPointerDown,z=>{z.button===0&&(z.target.setPointerCapture(z.pointerId),b.current=y.getBoundingClientRect(),v.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect="none",p.viewport&&(p.viewport.style.scrollBehavior="auto"),T(z))}),onPointerMove:Se(e.onPointerMove,T),onPointerUp:Se(e.onPointerUp,z=>{const O=z.target;O.hasPointerCapture(z.pointerId)&&O.releasePointerCapture(z.pointerId),document.body.style.webkitUserSelect=v.current,p.viewport&&(p.viewport.style.scrollBehavior=""),b.current=null})})})}),Zo="ScrollAreaThumb",yh=x.forwardRef((e,t)=>{const{forceMount:n,...r}=e,o=xh(Zo,e.__scopeScrollArea);return a.jsx(St,{present:n||o.hasThumb,children:a.jsx(uj,{ref:t,...r})})}),uj=x.forwardRef((e,t)=>{const{__scopeScrollArea:n,style:r,...o}=e,s=Ct(Zo,n),i=xh(Zo,n),{onThumbPositionChange:l}=i,c=De(t,f=>i.onThumbChange(f)),u=x.useRef(void 0),d=Cs(()=>{u.current&&(u.current(),u.current=void 0)},100);return x.useEffect(()=>{const f=s.viewport;if(f){const h=()=>{if(d(),!u.current){const p=pj(f,l);u.current=p,l()}};return l(),f.addEventListener("scroll",h),()=>f.removeEventListener("scroll",h)}},[s.viewport,d,l]),a.jsx(Te.div,{"data-state":i.hasThumb?"visible":"hidden",...o,ref:c,style:{width:"var(--radix-scroll-area-thumb-width)",height:"var(--radix-scroll-area-thumb-height)",...r},onPointerDownCapture:Se(e.onPointerDownCapture,f=>{const p=f.target.getBoundingClientRect(),y=f.clientX-p.left,m=f.clientY-p.top;i.onThumbPointerDown({x:y,y:m})}),onPointerUp:Se(e.onPointerUp,i.onThumbPointerUp)})});yh.displayName=Zo;var sl="ScrollAreaCorner",vh=x.forwardRef((e,t)=>{const n=Ct(sl,e.__scopeScrollArea),r=!!(n.scrollbarX&&n.scrollbarY);return n.type!=="scroll"&&r?a.jsx(dj,{...e,ref:t}):null});vh.displayName=sl;var dj=x.forwardRef((e,t)=>{const{__scopeScrollArea:n,...r}=e,o=Ct(sl,n),[s,i]=x.useState(0),[l,c]=x.useState(0),u=!!(s&&l);return ir(o.scrollbarX,()=>{const d=o.scrollbarX?.offsetHeight||0;o.onCornerHeightChange(d),c(d)}),ir(o.scrollbarY,()=>{const d=o.scrollbarY?.offsetWidth||0;o.onCornerWidthChange(d),i(d)}),u?a.jsx(Te.div,{...r,ref:t,style:{width:s,height:l,position:"absolute",right:o.dir==="ltr"?0:void 0,left:o.dir==="rtl"?0:void 0,bottom:0,...e.style}}):null});function qo(e){return e?parseInt(e,10):0}function wh(e,t){const n=e/t;return isNaN(n)?0:n}function Ss(e){const t=wh(e.viewport,e.content),n=e.scrollbar.paddingStart+e.scrollbar.paddingEnd,r=(e.scrollbar.size-n)*t;return Math.max(r,18)}function fj(e,t,n,r="ltr"){const o=Ss(n),s=o/2,i=t||s,l=o-i,c=n.scrollbar.paddingStart+i,u=n.scrollbar.size-n.scrollbar.paddingEnd-l,d=n.content-n.viewport,f=r==="ltr"?[0,d]:[d*-1,0];return kh([c,u],f)(e)}function Jc(e,t,n="ltr"){const r=Ss(t),o=t.scrollbar.paddingStart+t.scrollbar.paddingEnd,s=t.scrollbar.size-o,i=t.content-t.viewport,l=s-r,c=n==="ltr"?[0,i]:[i*-1,0],u=Zi(e,c);return kh([0,i],[0,l])(u)}function kh(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 _h(e,t){return e>0&&e<t}var pj=(e,t=()=>{})=>{let n={left:e.scrollLeft,top:e.scrollTop},r=0;return(function o(){const s={left:e.scrollLeft,top:e.scrollTop},i=n.left!==s.left,l=n.top!==s.top;(i||l)&&t(),n=s,r=window.requestAnimationFrame(o)})(),()=>window.cancelAnimationFrame(r)};function Cs(e,t){const n=lt(e),r=x.useRef(0);return x.useEffect(()=>()=>window.clearTimeout(r.current),[]),x.useCallback(()=>{window.clearTimeout(r.current),r.current=window.setTimeout(n,t)},[n,t])}function ir(e,t){const n=lt(t);ot(()=>{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 hj=fh,mj=hh,gj=vh,xj=[" ","Enter","ArrowUp","ArrowDown"],bj=[" ","Enter"],Tn="Select",[js,Ns,yj]=tp(Tn),[pr]=sn(Tn,[yj,_s]),Es=_s(),[vj,yn]=pr(Tn),[wj,kj]=pr(Tn),Sh=e=>{const{__scopeSelect:t,children:n,open:r,defaultOpen:o,onOpenChange:s,value:i,defaultValue:l,onValueChange:c,dir:u,name:d,autoComplete:f,disabled:h,required:p,form:y}=e,m=Es(t),[g,b]=x.useState(null),[v,k]=x.useState(null),[S,C]=x.useState(!1),j=hs(u),[E,T]=jn({prop:r,defaultProp:o??!1,onChange:s,caller:Tn}),[z,O]=jn({prop:i,defaultProp:l,onChange:c,caller:Tn}),B=x.useRef(null),N=g?y||!!g.closest("form"):!0,[D,w]=x.useState(new Set),L=Array.from(D).map(W=>W.props.value).join(";");return a.jsx(th,{...m,children:a.jsxs(vj,{required:p,scope:t,trigger:g,onTriggerChange:b,valueNode:v,onValueNodeChange:k,valueNodeHasChildren:S,onValueNodeHasChildrenChange:C,contentId:Bt(),value:z,onValueChange:O,open:E,onOpenChange:T,dir:j,triggerPointerDownPosRef:B,disabled:h,children:[a.jsx(js.Provider,{scope:t,children:a.jsx(wj,{scope:e.__scopeSelect,onNativeOptionAdd:x.useCallback(W=>{w(U=>new Set(U).add(W))},[]),onNativeOptionRemove:x.useCallback(W=>{w(U=>{const F=new Set(U);return F.delete(W),F})},[]),children:n})}),N?a.jsxs(Zh,{"aria-hidden":!0,required:p,tabIndex:-1,name:d,autoComplete:f,value:z,onChange:W=>O(W.target.value),disabled:h,form:y,children:[z===void 0?a.jsx("option",{value:""}):null,Array.from(D)]},L):null]})})};Sh.displayName=Tn;var Ch="SelectTrigger",jh=x.forwardRef((e,t)=>{const{__scopeSelect:n,disabled:r=!1,...o}=e,s=Es(n),i=yn(Ch,n),l=i.disabled||r,c=De(t,i.onTriggerChange),u=Ns(n),d=x.useRef("touch"),[f,h,p]=Kh(m=>{const g=u().filter(k=>!k.disabled),b=g.find(k=>k.value===i.value),v=Gh(g,m,b);v!==void 0&&i.onValueChange(v.value)}),y=m=>{l||(i.onOpenChange(!0),p()),m&&(i.triggerPointerDownPosRef.current={x:Math.round(m.pageX),y:Math.round(m.pageY)})};return a.jsx(nh,{asChild:!0,...s,children:a.jsx(Te.button,{type:"button",role:"combobox","aria-controls":i.contentId,"aria-expanded":i.open,"aria-required":i.required,"aria-autocomplete":"none",dir:i.dir,"data-state":i.open?"open":"closed",disabled:l,"data-disabled":l?"":void 0,"data-placeholder":qh(i.value)?"":void 0,...o,ref:c,onClick:Se(o.onClick,m=>{m.currentTarget.focus(),d.current!=="mouse"&&y(m)}),onPointerDown:Se(o.onPointerDown,m=>{d.current=m.pointerType;const g=m.target;g.hasPointerCapture(m.pointerId)&&g.releasePointerCapture(m.pointerId),m.button===0&&m.ctrlKey===!1&&m.pointerType==="mouse"&&(y(m),m.preventDefault())}),onKeyDown:Se(o.onKeyDown,m=>{const g=f.current!=="";!(m.ctrlKey||m.altKey||m.metaKey)&&m.key.length===1&&h(m.key),!(g&&m.key===" ")&&xj.includes(m.key)&&(y(),m.preventDefault())})})})});jh.displayName=Ch;var Nh="SelectValue",Eh=x.forwardRef((e,t)=>{const{__scopeSelect:n,className:r,style:o,children:s,placeholder:i="",...l}=e,c=yn(Nh,n),{onValueNodeHasChildrenChange:u}=c,d=s!==void 0,f=De(t,c.onValueNodeChange);return ot(()=>{u(d)},[u,d]),a.jsx(Te.span,{...l,ref:f,style:{pointerEvents:"none"},children:qh(c.value)?a.jsx(a.Fragment,{children:i}):s})});Eh.displayName=Nh;var _j="SelectIcon",Th=x.forwardRef((e,t)=>{const{__scopeSelect:n,children:r,...o}=e;return a.jsx(Te.span,{"aria-hidden":!0,...o,ref:t,children:r||"▼"})});Th.displayName=_j;var Sj="SelectPortal",Ah=e=>a.jsx(gs,{asChild:!0,...e});Ah.displayName=Sj;var An="SelectContent",Ih=x.forwardRef((e,t)=>{const n=yn(An,e.__scopeSelect),[r,o]=x.useState();if(ot(()=>{o(new DocumentFragment)},[]),!n.open){const s=r;return s?Zr.createPortal(a.jsx(zh,{scope:e.__scopeSelect,children:a.jsx(js.Slot,{scope:e.__scopeSelect,children:a.jsx("div",{children:e.children})})}),s):null}return a.jsx(Rh,{...e,ref:t})});Ih.displayName=An;var Et=10,[zh,vn]=pr(An),Cj="SelectContentImpl",jj=or("SelectContent.RemoveScroll"),Rh=x.forwardRef((e,t)=>{const{__scopeSelect:n,position:r="item-aligned",onCloseAutoFocus:o,onEscapeKeyDown:s,onPointerDownOutside:i,side:l,sideOffset:c,align:u,alignOffset:d,arrowPadding:f,collisionBoundary:h,collisionPadding:p,sticky:y,hideWhenDetached:m,avoidCollisions:g,...b}=e,v=yn(An,n),[k,S]=x.useState(null),[C,j]=x.useState(null),E=De(t,le=>S(le)),[T,z]=x.useState(null),[O,B]=x.useState(null),N=Ns(n),[D,w]=x.useState(!1),L=x.useRef(!1);x.useEffect(()=>{if(k)return bp(k)},[k]),cp();const W=x.useCallback(le=>{const[de,...pe]=N().map(_e=>_e.ref.current),[he]=pe.slice(-1),me=document.activeElement;for(const _e of le)if(_e===me||(_e?.scrollIntoView({block:"nearest"}),_e===de&&C&&(C.scrollTop=0),_e===he&&C&&(C.scrollTop=C.scrollHeight),_e?.focus(),document.activeElement!==me))return},[N,C]),U=x.useCallback(()=>W([T,k]),[W,T,k]);x.useEffect(()=>{D&&U()},[D,U]);const{onOpenChange:F,triggerPointerDownPosRef:K}=v;x.useEffect(()=>{if(k){let le={x:0,y:0};const de=he=>{le={x:Math.abs(Math.round(he.pageX)-(K.current?.x??0)),y:Math.abs(Math.round(he.pageY)-(K.current?.y??0))}},pe=he=>{le.x<=10&&le.y<=10?he.preventDefault():k.contains(he.target)||F(!1),document.removeEventListener("pointermove",de),K.current=null};return K.current!==null&&(document.addEventListener("pointermove",de),document.addEventListener("pointerup",pe,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",de),document.removeEventListener("pointerup",pe,{capture:!0})}}},[k,F,K]),x.useEffect(()=>{const le=()=>F(!1);return window.addEventListener("blur",le),window.addEventListener("resize",le),()=>{window.removeEventListener("blur",le),window.removeEventListener("resize",le)}},[F]);const[I,V]=Kh(le=>{const de=N().filter(me=>!me.disabled),pe=de.find(me=>me.ref.current===document.activeElement),he=Gh(de,le,pe);he&&setTimeout(()=>he.ref.current.focus())}),G=x.useCallback((le,de,pe)=>{const he=!L.current&&!pe;(v.value!==void 0&&v.value===de||he)&&(z(le),he&&(L.current=!0))},[v.value]),R=x.useCallback(()=>k?.focus(),[k]),ae=x.useCallback((le,de,pe)=>{const he=!L.current&&!pe;(v.value!==void 0&&v.value===de||he)&&B(le)},[v.value]),oe=r==="popper"?qi:Ph,fe=oe===qi?{side:l,sideOffset:c,align:u,alignOffset:d,arrowPadding:f,collisionBoundary:h,collisionPadding:p,sticky:y,hideWhenDetached:m,avoidCollisions:g}:{};return a.jsx(zh,{scope:n,content:k,viewport:C,onViewportChange:j,itemRefCallback:G,selectedItem:T,onItemLeave:R,itemTextRefCallback:ae,focusSelectedItem:U,selectedItemText:O,position:r,isPositioned:D,searchRef:I,children:a.jsx(Va,{as:jj,allowPinchZoom:!0,children:a.jsx(Ha,{asChild:!0,trapped:v.open,onMountAutoFocus:le=>{le.preventDefault()},onUnmountAutoFocus:Se(o,le=>{v.trigger?.focus({preventScroll:!0}),le.preventDefault()}),children:a.jsx(ms,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:s,onPointerDownOutside:i,onFocusOutside:le=>le.preventDefault(),onDismiss:()=>v.onOpenChange(!1),children:a.jsx(oe,{role:"listbox",id:v.contentId,"data-state":v.open?"open":"closed",dir:v.dir,onContextMenu:le=>le.preventDefault(),...b,...fe,onPlaced:()=>w(!0),ref:E,style:{display:"flex",flexDirection:"column",outline:"none",...b.style},onKeyDown:Se(b.onKeyDown,le=>{const de=le.ctrlKey||le.altKey||le.metaKey;if(le.key==="Tab"&&le.preventDefault(),!de&&le.key.length===1&&V(le.key),["ArrowUp","ArrowDown","Home","End"].includes(le.key)){let he=N().filter(me=>!me.disabled).map(me=>me.ref.current);if(["ArrowUp","End"].includes(le.key)&&(he=he.slice().reverse()),["ArrowUp","ArrowDown"].includes(le.key)){const me=le.target,_e=he.indexOf(me);he=he.slice(_e+1)}setTimeout(()=>W(he)),le.preventDefault()}})})})})})})});Rh.displayName=Cj;var Nj="SelectItemAlignedPosition",Ph=x.forwardRef((e,t)=>{const{__scopeSelect:n,onPlaced:r,...o}=e,s=yn(An,n),i=vn(An,n),[l,c]=x.useState(null),[u,d]=x.useState(null),f=De(t,E=>d(E)),h=Ns(n),p=x.useRef(!1),y=x.useRef(!0),{viewport:m,selectedItem:g,selectedItemText:b,focusSelectedItem:v}=i,k=x.useCallback(()=>{if(s.trigger&&s.valueNode&&l&&u&&m&&g&&b){const E=s.trigger.getBoundingClientRect(),T=u.getBoundingClientRect(),z=s.valueNode.getBoundingClientRect(),O=b.getBoundingClientRect();if(s.dir!=="rtl"){const me=O.left-T.left,_e=z.left-me,Pe=E.left-_e,_=E.width+Pe,ne=Math.max(_,T.width),Q=window.innerWidth-Et,M=Zi(_e,[Et,Math.max(Et,Q-ne)]);l.style.minWidth=_+"px",l.style.left=M+"px"}else{const me=T.right-O.right,_e=window.innerWidth-z.right-me,Pe=window.innerWidth-E.right-_e,_=E.width+Pe,ne=Math.max(_,T.width),Q=window.innerWidth-Et,M=Zi(_e,[Et,Math.max(Et,Q-ne)]);l.style.minWidth=_+"px",l.style.right=M+"px"}const B=h(),N=window.innerHeight-Et*2,D=m.scrollHeight,w=window.getComputedStyle(u),L=parseInt(w.borderTopWidth,10),W=parseInt(w.paddingTop,10),U=parseInt(w.borderBottomWidth,10),F=parseInt(w.paddingBottom,10),K=L+W+D+F+U,I=Math.min(g.offsetHeight*5,K),V=window.getComputedStyle(m),G=parseInt(V.paddingTop,10),R=parseInt(V.paddingBottom,10),ae=E.top+E.height/2-Et,oe=N-ae,fe=g.offsetHeight/2,le=g.offsetTop+fe,de=L+W+le,pe=K-de;if(de<=ae){const me=B.length>0&&g===B[B.length-1].ref.current;l.style.bottom="0px";const _e=u.clientHeight-m.offsetTop-m.offsetHeight,Pe=Math.max(oe,fe+(me?R:0)+_e+U),_=de+Pe;l.style.height=_+"px"}else{const me=B.length>0&&g===B[0].ref.current;l.style.top="0px";const Pe=Math.max(ae,L+m.offsetTop+(me?G:0)+fe)+pe;l.style.height=Pe+"px",m.scrollTop=de-ae+m.offsetTop}l.style.margin=`${Et}px 0`,l.style.minHeight=I+"px",l.style.maxHeight=N+"px",r?.(),requestAnimationFrame(()=>p.current=!0)}},[h,s.trigger,s.valueNode,l,u,m,g,b,s.dir,r]);ot(()=>k(),[k]);const[S,C]=x.useState();ot(()=>{u&&C(window.getComputedStyle(u).zIndex)},[u]);const j=x.useCallback(E=>{E&&y.current===!0&&(k(),v?.(),y.current=!1)},[k,v]);return a.jsx(Tj,{scope:n,contentWrapper:l,shouldExpandOnScrollRef:p,onScrollButtonChange:j,children:a.jsx("div",{ref:c,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:S},children:a.jsx(Te.div,{...o,ref:f,style:{boxSizing:"border-box",maxHeight:"100%",...o.style}})})})});Ph.displayName=Nj;var Ej="SelectPopperPosition",qi=x.forwardRef((e,t)=>{const{__scopeSelect:n,align:r="start",collisionPadding:o=Et,...s}=e,i=Es(n);return a.jsx(rh,{...i,...s,ref:t,align:r,collisionPadding:o,style:{boxSizing:"border-box",...s.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)"}})});qi.displayName=Ej;var[Tj,il]=pr(An,{}),Ki="SelectViewport",Oh=x.forwardRef((e,t)=>{const{__scopeSelect:n,nonce:r,...o}=e,s=vn(Ki,n),i=il(Ki,n),l=De(t,s.onViewportChange),c=x.useRef(0);return a.jsxs(a.Fragment,{children:[a.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}),a.jsx(js.Slot,{scope:n,children:a.jsx(Te.div,{"data-radix-select-viewport":"",role:"presentation",...o,ref:l,style:{position:"relative",flex:1,overflow:"hidden auto",...o.style},onScroll:Se(o.onScroll,u=>{const d=u.currentTarget,{contentWrapper:f,shouldExpandOnScrollRef:h}=i;if(h?.current&&f){const p=Math.abs(c.current-d.scrollTop);if(p>0){const y=window.innerHeight-Et*2,m=parseFloat(f.style.minHeight),g=parseFloat(f.style.height),b=Math.max(m,g);if(b<y){const v=b+p,k=Math.min(y,v),S=v-k;f.style.height=k+"px",f.style.bottom==="0px"&&(d.scrollTop=S>0?S:0,f.style.justifyContent="flex-end")}}}c.current=d.scrollTop})})})]})});Oh.displayName=Ki;var Mh="SelectGroup",[Aj,Ij]=pr(Mh),zj=x.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,o=Bt();return a.jsx(Aj,{scope:n,id:o,children:a.jsx(Te.div,{role:"group","aria-labelledby":o,...r,ref:t})})});zj.displayName=Mh;var Lh="SelectLabel",Rj=x.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,o=Ij(Lh,n);return a.jsx(Te.div,{id:o.id,...r,ref:t})});Rj.displayName=Lh;var Ko="SelectItem",[Pj,Dh]=pr(Ko),Fh=x.forwardRef((e,t)=>{const{__scopeSelect:n,value:r,disabled:o=!1,textValue:s,...i}=e,l=yn(Ko,n),c=vn(Ko,n),u=l.value===r,[d,f]=x.useState(s??""),[h,p]=x.useState(!1),y=De(t,v=>c.itemRefCallback?.(v,r,o)),m=Bt(),g=x.useRef("touch"),b=()=>{o||(l.onValueChange(r),l.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 a.jsx(Pj,{scope:n,value:r,disabled:o,textId:m,isSelected:u,onItemTextChange:x.useCallback(v=>{f(k=>k||(v?.textContent??"").trim())},[]),children:a.jsx(js.ItemSlot,{scope:n,value:r,disabled:o,textValue:d,children:a.jsx(Te.div,{role:"option","aria-labelledby":m,"data-highlighted":h?"":void 0,"aria-selected":u&&h,"data-state":u?"checked":"unchecked","aria-disabled":o||void 0,"data-disabled":o?"":void 0,tabIndex:o?void 0:-1,...i,ref:y,onFocus:Se(i.onFocus,()=>p(!0)),onBlur:Se(i.onBlur,()=>p(!1)),onClick:Se(i.onClick,()=>{g.current!=="mouse"&&b()}),onPointerUp:Se(i.onPointerUp,()=>{g.current==="mouse"&&b()}),onPointerDown:Se(i.onPointerDown,v=>{g.current=v.pointerType}),onPointerMove:Se(i.onPointerMove,v=>{g.current=v.pointerType,o?c.onItemLeave?.():g.current==="mouse"&&v.currentTarget.focus({preventScroll:!0})}),onPointerLeave:Se(i.onPointerLeave,v=>{v.currentTarget===document.activeElement&&c.onItemLeave?.()}),onKeyDown:Se(i.onKeyDown,v=>{c.searchRef?.current!==""&&v.key===" "||(bj.includes(v.key)&&b(),v.key===" "&&v.preventDefault())})})})})});Fh.displayName=Ko;var Er="SelectItemText",$h=x.forwardRef((e,t)=>{const{__scopeSelect:n,className:r,style:o,...s}=e,i=yn(Er,n),l=vn(Er,n),c=Dh(Er,n),u=kj(Er,n),[d,f]=x.useState(null),h=De(t,b=>f(b),c.onItemTextChange,b=>l.itemTextRefCallback?.(b,c.value,c.disabled)),p=d?.textContent,y=x.useMemo(()=>a.jsx("option",{value:c.value,disabled:c.disabled,children:p},c.value),[c.disabled,c.value,p]),{onNativeOptionAdd:m,onNativeOptionRemove:g}=u;return ot(()=>(m(y),()=>g(y)),[m,g,y]),a.jsxs(a.Fragment,{children:[a.jsx(Te.span,{id:c.textId,...s,ref:h}),c.isSelected&&i.valueNode&&!i.valueNodeHasChildren?Zr.createPortal(s.children,i.valueNode):null]})});$h.displayName=Er;var Bh="SelectItemIndicator",Uh=x.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e;return Dh(Bh,n).isSelected?a.jsx(Te.span,{"aria-hidden":!0,...r,ref:t}):null});Uh.displayName=Bh;var Gi="SelectScrollUpButton",Wh=x.forwardRef((e,t)=>{const n=vn(Gi,e.__scopeSelect),r=il(Gi,e.__scopeSelect),[o,s]=x.useState(!1),i=De(t,r.onScrollButtonChange);return ot(()=>{if(n.viewport&&n.isPositioned){let l=function(){const u=c.scrollTop>0;s(u)};const c=n.viewport;return l(),c.addEventListener("scroll",l),()=>c.removeEventListener("scroll",l)}},[n.viewport,n.isPositioned]),o?a.jsx(Vh,{...e,ref:i,onAutoScroll:()=>{const{viewport:l,selectedItem:c}=n;l&&c&&(l.scrollTop=l.scrollTop-c.offsetHeight)}}):null});Wh.displayName=Gi;var Ji="SelectScrollDownButton",Hh=x.forwardRef((e,t)=>{const n=vn(Ji,e.__scopeSelect),r=il(Ji,e.__scopeSelect),[o,s]=x.useState(!1),i=De(t,r.onScrollButtonChange);return ot(()=>{if(n.viewport&&n.isPositioned){let l=function(){const u=c.scrollHeight-c.clientHeight,d=Math.ceil(c.scrollTop)<u;s(d)};const c=n.viewport;return l(),c.addEventListener("scroll",l),()=>c.removeEventListener("scroll",l)}},[n.viewport,n.isPositioned]),o?a.jsx(Vh,{...e,ref:i,onAutoScroll:()=>{const{viewport:l,selectedItem:c}=n;l&&c&&(l.scrollTop=l.scrollTop+c.offsetHeight)}}):null});Hh.displayName=Ji;var Vh=x.forwardRef((e,t)=>{const{__scopeSelect:n,onAutoScroll:r,...o}=e,s=vn("SelectScrollButton",n),i=x.useRef(null),l=Ns(n),c=x.useCallback(()=>{i.current!==null&&(window.clearInterval(i.current),i.current=null)},[]);return x.useEffect(()=>()=>c(),[c]),ot(()=>{l().find(d=>d.ref.current===document.activeElement)?.ref.current?.scrollIntoView({block:"nearest"})},[l]),a.jsx(Te.div,{"aria-hidden":!0,...o,ref:t,style:{flexShrink:0,...o.style},onPointerDown:Se(o.onPointerDown,()=>{i.current===null&&(i.current=window.setInterval(r,50))}),onPointerMove:Se(o.onPointerMove,()=>{s.onItemLeave?.(),i.current===null&&(i.current=window.setInterval(r,50))}),onPointerLeave:Se(o.onPointerLeave,()=>{c()})})}),Oj="SelectSeparator",Mj=x.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e;return a.jsx(Te.div,{"aria-hidden":!0,...r,ref:t})});Mj.displayName=Oj;var Yi="SelectArrow",Lj=x.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,o=Es(n),s=yn(Yi,n),i=vn(Yi,n);return s.open&&i.position==="popper"?a.jsx(oh,{...o,...r,ref:t}):null});Lj.displayName=Yi;var Dj="SelectBubbleInput",Zh=x.forwardRef(({__scopeSelect:e,value:t,...n},r)=>{const o=x.useRef(null),s=De(r,o),i=SS(t);return x.useEffect(()=>{const l=o.current;if(!l)return;const c=window.HTMLSelectElement.prototype,d=Object.getOwnPropertyDescriptor(c,"value").set;if(i!==t&&d){const f=new Event("change",{bubbles:!0});d.call(l,t),l.dispatchEvent(f)}},[i,t]),a.jsx(Te.select,{...n,style:{...Qf,...n.style},ref:s,defaultValue:t})});Zh.displayName=Dj;function qh(e){return e===""||e===void 0}function Kh(e){const t=lt(e),n=x.useRef(""),r=x.useRef(0),o=x.useCallback(i=>{const l=n.current+i;t(l),(function c(u){n.current=u,window.clearTimeout(r.current),u!==""&&(r.current=window.setTimeout(()=>c(""),1e3))})(l)},[t]),s=x.useCallback(()=>{n.current="",window.clearTimeout(r.current)},[]);return x.useEffect(()=>()=>window.clearTimeout(r.current),[]),[n,o,s]}function Gh(e,t,n){const o=t.length>1&&Array.from(t).every(u=>u===t[0])?t[0]:t,s=n?e.indexOf(n):-1;let i=Fj(e,Math.max(s,0));o.length===1&&(i=i.filter(u=>u!==n));const c=i.find(u=>u.textValue.toLowerCase().startsWith(o.toLowerCase()));return c!==n?c:void 0}function Fj(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var $j=Sh,Bj=jh,Uj=Eh,Wj=Th,Hj=Ah,Vj=Ih,Zj=Oh,qj=Fh,Kj=$h,Gj=Uh,Jj=Wh,Yj=Hh,Ts="Tabs",[Xj]=sn(Ts,[ih]),Jh=ih(),[Qj,al]=Xj(Ts),Yh=x.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,onValueChange:o,defaultValue:s,orientation:i="horizontal",dir:l,activationMode:c="automatic",...u}=e,d=hs(l),[f,h]=jn({prop:r,onChange:o,defaultProp:s??"",caller:Ts});return a.jsx(Qj,{scope:n,baseId:Bt(),value:f,onValueChange:h,orientation:i,dir:d,activationMode:c,children:a.jsx(Te.div,{dir:d,"data-orientation":i,...u,ref:t})})});Yh.displayName=Ts;var Xh="TabsList",Qh=x.forwardRef((e,t)=>{const{__scopeTabs:n,loop:r=!0,...o}=e,s=al(Xh,n),i=Jh(n);return a.jsx(tj,{asChild:!0,...i,orientation:s.orientation,dir:s.dir,loop:r,children:a.jsx(Te.div,{role:"tablist","aria-orientation":s.orientation,...o,ref:t})})});Qh.displayName=Xh;var em="TabsTrigger",tm=x.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,disabled:o=!1,...s}=e,i=al(em,n),l=Jh(n),c=om(i.baseId,r),u=sm(i.baseId,r),d=r===i.value;return a.jsx(nj,{asChild:!0,...l,focusable:!o,active:d,children:a.jsx(Te.button,{type:"button",role:"tab","aria-selected":d,"aria-controls":u,"data-state":d?"active":"inactive","data-disabled":o?"":void 0,disabled:o,id:c,...s,ref:t,onMouseDown:Se(e.onMouseDown,f=>{!o&&f.button===0&&f.ctrlKey===!1?i.onValueChange(r):f.preventDefault()}),onKeyDown:Se(e.onKeyDown,f=>{[" ","Enter"].includes(f.key)&&i.onValueChange(r)}),onFocus:Se(e.onFocus,()=>{const f=i.activationMode!=="manual";!d&&!o&&f&&i.onValueChange(r)})})})});tm.displayName=em;var nm="TabsContent",rm=x.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,forceMount:o,children:s,...i}=e,l=al(nm,n),c=om(l.baseId,r),u=sm(l.baseId,r),d=r===l.value,f=x.useRef(d);return x.useEffect(()=>{const h=requestAnimationFrame(()=>f.current=!1);return()=>cancelAnimationFrame(h)},[]),a.jsx(St,{present:o||d,children:({present:h})=>a.jsx(Te.div,{"data-state":d?"active":"inactive","data-orientation":l.orientation,role:"tabpanel","aria-labelledby":c,hidden:!h,id:u,tabIndex:0,...i,ref:t,style:{...e.style,animationDuration:f.current?"0s":void 0},children:h&&s})})});rm.displayName=nm;function om(e,t){return`${e}-trigger-${t}`}function sm(e,t){return`${e}-content-${t}`}var e5=Yh,t5=Qh,n5=tm,r5=rm,[As]=sn("Tooltip",[_s]),Is=_s(),im="TooltipProvider",o5=700,Xi="tooltip.open",[s5,ll]=As(im),am=e=>{const{__scopeTooltip:t,delayDuration:n=o5,skipDelayDuration:r=300,disableHoverableContent:o=!1,children:s}=e,i=x.useRef(!0),l=x.useRef(!1),c=x.useRef(0);return x.useEffect(()=>{const u=c.current;return()=>window.clearTimeout(u)},[]),a.jsx(s5,{scope:t,isOpenDelayedRef:i,delayDuration:n,onOpen:x.useCallback(()=>{window.clearTimeout(c.current),i.current=!1},[]),onClose:x.useCallback(()=>{window.clearTimeout(c.current),c.current=window.setTimeout(()=>i.current=!0,r)},[r]),isPointerInTransitRef:l,onPointerInTransitChange:x.useCallback(u=>{l.current=u},[]),disableHoverableContent:o,children:s})};am.displayName=im;var $r="Tooltip",[i5,Jr]=As($r),lm=e=>{const{__scopeTooltip:t,children:n,open:r,defaultOpen:o,onOpenChange:s,disableHoverableContent:i,delayDuration:l}=e,c=ll($r,e.__scopeTooltip),u=Is(t),[d,f]=x.useState(null),h=Bt(),p=x.useRef(0),y=i??c.disableHoverableContent,m=l??c.delayDuration,g=x.useRef(!1),[b,v]=jn({prop:r,defaultProp:o??!1,onChange:E=>{E?(c.onOpen(),document.dispatchEvent(new CustomEvent(Xi))):c.onClose(),s?.(E)},caller:$r}),k=x.useMemo(()=>b?g.current?"delayed-open":"instant-open":"closed",[b]),S=x.useCallback(()=>{window.clearTimeout(p.current),p.current=0,g.current=!1,v(!0)},[v]),C=x.useCallback(()=>{window.clearTimeout(p.current),p.current=0,v(!1)},[v]),j=x.useCallback(()=>{window.clearTimeout(p.current),p.current=window.setTimeout(()=>{g.current=!0,v(!0),p.current=0},m)},[m,v]);return x.useEffect(()=>()=>{p.current&&(window.clearTimeout(p.current),p.current=0)},[]),a.jsx(th,{...u,children:a.jsx(i5,{scope:t,contentId:h,open:b,stateAttribute:k,trigger:d,onTriggerChange:f,onTriggerEnter:x.useCallback(()=>{c.isOpenDelayedRef.current?j():S()},[c.isOpenDelayedRef,j,S]),onTriggerLeave:x.useCallback(()=>{y?C():(window.clearTimeout(p.current),p.current=0)},[C,y]),onOpen:S,onClose:C,disableHoverableContent:y,children:n})})};lm.displayName=$r;var Qi="TooltipTrigger",cm=x.forwardRef((e,t)=>{const{__scopeTooltip:n,...r}=e,o=Jr(Qi,n),s=ll(Qi,n),i=Is(n),l=x.useRef(null),c=De(t,l,o.onTriggerChange),u=x.useRef(!1),d=x.useRef(!1),f=x.useCallback(()=>u.current=!1,[]);return x.useEffect(()=>()=>document.removeEventListener("pointerup",f),[f]),a.jsx(nh,{asChild:!0,...i,children:a.jsx(Te.button,{"aria-describedby":o.open?o.contentId:void 0,"data-state":o.stateAttribute,...r,ref:c,onPointerMove:Se(e.onPointerMove,h=>{h.pointerType!=="touch"&&!d.current&&!s.isPointerInTransitRef.current&&(o.onTriggerEnter(),d.current=!0)}),onPointerLeave:Se(e.onPointerLeave,()=>{o.onTriggerLeave(),d.current=!1}),onPointerDown:Se(e.onPointerDown,()=>{o.open&&o.onClose(),u.current=!0,document.addEventListener("pointerup",f,{once:!0})}),onFocus:Se(e.onFocus,()=>{u.current||o.onOpen()}),onBlur:Se(e.onBlur,o.onClose),onClick:Se(e.onClick,o.onClose)})})});cm.displayName=Qi;var cl="TooltipPortal",[a5,l5]=As(cl,{forceMount:void 0}),um=e=>{const{__scopeTooltip:t,forceMount:n,children:r,container:o}=e,s=Jr(cl,t);return a.jsx(a5,{scope:t,forceMount:n,children:a.jsx(St,{present:n||s.open,children:a.jsx(gs,{asChild:!0,container:o,children:r})})})};um.displayName=cl;var ar="TooltipContent",dm=x.forwardRef((e,t)=>{const n=l5(ar,e.__scopeTooltip),{forceMount:r=n.forceMount,side:o="top",...s}=e,i=Jr(ar,e.__scopeTooltip);return a.jsx(St,{present:r||i.open,children:i.disableHoverableContent?a.jsx(fm,{side:o,...s,ref:t}):a.jsx(c5,{side:o,...s,ref:t})})}),c5=x.forwardRef((e,t)=>{const n=Jr(ar,e.__scopeTooltip),r=ll(ar,e.__scopeTooltip),o=x.useRef(null),s=De(t,o),[i,l]=x.useState(null),{trigger:c,onClose:u}=n,d=o.current,{onPointerInTransitChange:f}=r,h=x.useCallback(()=>{l(null),f(!1)},[f]),p=x.useCallback((y,m)=>{const g=y.currentTarget,b={x:y.clientX,y:y.clientY},v=p5(b,g.getBoundingClientRect()),k=h5(b,v),S=m5(m.getBoundingClientRect()),C=x5([...k,...S]);l(C),f(!0)},[f]);return x.useEffect(()=>()=>h(),[h]),x.useEffect(()=>{if(c&&d){const y=g=>p(g,d),m=g=>p(g,c);return c.addEventListener("pointerleave",y),d.addEventListener("pointerleave",m),()=>{c.removeEventListener("pointerleave",y),d.removeEventListener("pointerleave",m)}}},[c,d,p,h]),x.useEffect(()=>{if(i){const y=m=>{const g=m.target,b={x:m.clientX,y:m.clientY},v=c?.contains(g)||d?.contains(g),k=!g5(b,i);v?h():k&&(h(),u())};return document.addEventListener("pointermove",y),()=>document.removeEventListener("pointermove",y)}},[c,d,i,u,h]),a.jsx(fm,{...e,ref:s})}),[u5,d5]=As($r,{isInside:!1}),f5=Lk("TooltipContent"),fm=x.forwardRef((e,t)=>{const{__scopeTooltip:n,children:r,"aria-label":o,onEscapeKeyDown:s,onPointerDownOutside:i,...l}=e,c=Jr(ar,n),u=Is(n),{onClose:d}=c;return x.useEffect(()=>(document.addEventListener(Xi,d),()=>document.removeEventListener(Xi,d)),[d]),x.useEffect(()=>{if(c.trigger){const f=h=>{h.target?.contains(c.trigger)&&d()};return window.addEventListener("scroll",f,{capture:!0}),()=>window.removeEventListener("scroll",f,{capture:!0})}},[c.trigger,d]),a.jsx(ms,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:s,onPointerDownOutside:i,onFocusOutside:f=>f.preventDefault(),onDismiss:d,children:a.jsxs(rh,{"data-state":c.stateAttribute,...u,...l,ref:t,style:{...l.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:[a.jsx(f5,{children:r}),a.jsx(u5,{scope:n,isInside:!0,children:a.jsx(Hk,{id:c.contentId,role:"tooltip",children:o||r})})]})})});dm.displayName=ar;var pm="TooltipArrow",hm=x.forwardRef((e,t)=>{const{__scopeTooltip:n,...r}=e,o=Is(n);return d5(pm,n).isInside?null:a.jsx(oh,{...o,...r,ref:t})});hm.displayName=pm;function p5(e,t){const n=Math.abs(t.top-e.y),r=Math.abs(t.bottom-e.y),o=Math.abs(t.right-e.x),s=Math.abs(t.left-e.x);switch(Math.min(n,r,o,s)){case s:return"left";case o:return"right";case n:return"top";case r:return"bottom";default:throw new Error("unreachable")}}function h5(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 m5(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 g5(e,t){const{x:n,y:r}=e;let o=!1;for(let s=0,i=t.length-1;s<t.length;i=s++){const l=t[s],c=t[i],u=l.x,d=l.y,f=c.x,h=c.y;d>r!=h>r&&n<(f-u)*(r-d)/(h-d)+u&&(o=!o)}return o}function x5(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),b5(t)}function b5(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 s=t[t.length-1],i=t[t.length-2];if((s.x-i.x)*(o.y-i.y)>=(s.y-i.y)*(o.x-i.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 s=n[n.length-1],i=n[n.length-2];if((s.x-i.x)*(o.y-i.y)>=(s.y-i.y)*(o.x-i.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 y5=am,v5=lm,w5=cm,k5=um,_5=dm,S5=hm;const C5=$a("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 st({className:e,variant:t="default",asChild:n=!1,...r}){const o=n?Ok:"span";return a.jsx(o,{"data-slot":"badge","data-variant":t,className:ve(C5({variant:t}),e),...r})}function zs({...e}){return a.jsx(xS,{"data-slot":"dialog",...e})}function mm({...e}){return a.jsx(bS,{"data-slot":"dialog-trigger",...e})}function j5({...e}){return a.jsx(yS,{"data-slot":"dialog-portal",...e})}function N5({className:e,...t}){return a.jsx(vS,{"data-slot":"dialog-overlay",className:ve("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 Rs({className:e,children:t,...n}){return a.jsxs(j5,{children:[a.jsx(N5,{}),a.jsxs(wS,{"data-slot":"dialog-content",className:ve("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,a.jsxs(_S,{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:[a.jsx(La,{className:"size-4"}),a.jsx("span",{className:"sr-only",children:"Close"})]})]})]})}function Ps({className:e,...t}){return a.jsx("div",{"data-slot":"dialog-header",className:ve("flex flex-col space-y-1.5 text-center sm:text-left",e),...t})}function Os({className:e,...t}){return a.jsx(kS,{"data-slot":"dialog-title",className:ve("text-lg font-semibold leading-none tracking-tight",e),...t})}const E5=$a("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-colors focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:outline-ring focus-visible:ring-[3px] disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/90",destructive:"bg-destructive text-white hover:bg-destructive/90",outline:"border border-input bg-background hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-9 px-4 py-2",sm:"h-8 rounded-md px-3 text-xs",lg:"h-10 rounded-md px-8",icon:"size-9"}},defaultVariants:{variant:"default",size:"default"}});function Ae({className:e,variant:t,size:n,...r}){return a.jsx("button",{"data-slot":"button",className:ve(E5({variant:t,size:n,className:e})),...r})}function gm({open:e,onOpenChange:t,title:n,description:r,confirmLabel:o="Confirm",variant:s="default",onConfirm:i}){return a.jsx(zs,{open:e,onOpenChange:t,children:a.jsxs(Rs,{children:[a.jsx(Ps,{children:a.jsx(Os,{children:n})}),a.jsx("p",{className:"text-sm text-muted-foreground",children:r}),a.jsxs("div",{className:"flex justify-end gap-2 pt-2",children:[a.jsx(Ae,{variant:"outline",size:"sm",onClick:()=>t(!1),children:"Cancel"}),a.jsx(Ae,{variant:s,size:"sm",onClick:()=>{i(),t(!1)},children:o})]})]})})}const T5={anthropic:"Anthropic",openai:"OpenAI",unknown:"Unknown"};function A5({conversationId:e,startTime:t,endTime:n,totalCalls:r,totalInputTokens:o,totalOutputTokens:s,apiFormat:i,expanded:l,onToggle:c,hideApiFormat:u=!1,isLoading:d=!1,userAgent:f,timeDisplayFormat:h,onClear:p}){const[y,m]=x.useState(!1),g=v=>{v.stopPropagation(),p!==void 0&&m(!0)},b=x.useCallback(v=>{v.stopPropagation(),window.open(Pd(e),"_blank","noopener,noreferrer")},[e]);return a.jsxs("div",{role:"button",tabIndex:0,"data-nav-id":`conv-${e}`,"data-nav-action":l?"collapse":"expand",className:ve("flex items-center gap-3 px-3 py-2 cursor-pointer transition-colors","hover:bg-muted/50","select-none","border border-border rounded-lg mb-2 bg-background sticky top-0 z-10","focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1 focus-visible:outline-none"),onClick:c,onKeyDown:v=>{v.target===v.currentTarget&&(v.key==="Enter"||v.key===" ")&&(v.preventDefault(),c())},children:[l?a.jsx(Zt,{className:"size-4 text-muted-foreground shrink-0"}):d?a.jsx(Wt,{className:"size-4 animate-spin text-muted-foreground shrink-0"}):a.jsx(on,{className:"size-4 text-muted-foreground shrink-0"}),a.jsx("span",{className:"text-purple-400/90 font-mono text-xs font-semibold shrink-0",title:e,children:e.startsWith("PID:")||e.includes("|")?e:e.length>24?e.slice(0,12)+"..."+e.slice(-12):e}),f!=null&&f!==""&&a.jsxs("span",{className:"flex items-center gap-1 text-muted-foreground text-xs shrink-0",title:f,children:[a.jsx(mw,{className:"size-3"}),a.jsx("span",{className:"font-mono tabular-nums truncate max-w-[120px]",children:f})]}),!u&&a.jsx(st,{variant:"outline",className:ve("text-[10px] px-1.5 py-0 h-5 font-mono shrink-0",i==="openai"&&"border-blue-500/40 text-blue-400",i==="anthropic"&&"border-orange-500/40 text-orange-400",i==="unknown"&&"border-muted text-muted-foreground"),children:T5[i]}),a.jsxs("span",{className:"flex items-center gap-1 text-muted-foreground text-xs shrink-0",children:[a.jsx(hn,{className:"size-3"}),a.jsx("span",{className:"font-mono tabular-nums",children:Da(t,n,h)})]}),a.jsxs("span",{className:"flex items-center gap-1 text-muted-foreground text-xs shrink-0",children:[a.jsx(fs,{className:"size-3"}),a.jsxs("span",{className:"font-mono tabular-nums",children:[r," call",r!==1?"s":""]})]}),a.jsxs("span",{className:"flex items-center gap-1 text-xs shrink-0",children:[a.jsx(Dr,{className:"size-3 text-muted-foreground"}),a.jsxs("span",{className:"font-mono tabular-nums",children:[a.jsx("span",{className:"text-blue-400",children:Ve(o)})," / ",a.jsx("span",{className:"text-amber-400",children:Ve(s)})]})]}),a.jsx("span",{className:"flex-1 min-w-0"}),a.jsx("button",{type:"button",onClick:b,onKeyDown:v=>{(v.key==="Enter"||v.key===" ")&&b(v)},"aria-label":`Open session ${e} in a new tab`,title:"Open this session in a new tab",className:"text-muted-foreground hover:text-foreground transition-colors shrink-0 inline-flex items-center justify-center size-8 rounded hover:bg-muted cursor-pointer",children:a.jsx(Pa,{className:"size-3.5"})}),p!==void 0&&a.jsx("button",{type:"button",onClick:g,"aria-label":`Clear group (${r} request${r!==1?"s":""})`,title:"Clear this group",className:"text-muted-foreground hover:text-foreground transition-colors shrink-0 inline-flex items-center justify-center size-8 rounded hover:bg-muted cursor-pointer",children:a.jsx(Lr,{className:"size-3.5"})}),a.jsx(gm,{open:y,onOpenChange:m,title:"Clear this group?",description:`This will remove ${r} request${r!==1?"s":""} from this conversation. This action cannot be undone.`,confirmLabel:"Clear",variant:"destructive",onConfirm:()=>{p?.()}})]})}function I5(e){const t=e.find(n=>n.apiFormat!=="unknown");return t!==void 0?t.apiFormat:e[0]?.apiFormat??"unknown"}function z5(e){let t=!1,n=!1;for(const r of e)if(r.apiFormat==="anthropic"?t=!0:r.apiFormat==="openai"&&(n=!0),t&&n)return!0;return!1}function R5(e){if(e.isTest===!0)return"provider-test";if(e.sessionId!==null&&e.sessionId!==""&&e.sessionId!==void 0)return e.sessionId;const t=e.clientPid!==null&&e.clientPid!==void 0,n=e.clientProjectFolder!==null&&e.clientProjectFolder!==void 0;if(!t&&!n)return"default";const r=t?`PID:${e.clientPid}`:"unknown",o=n?e.clientProjectFolder:"no-folder";return`${r}|${o}`}function P5(e){const t=new Map;for(const r of e){const o=R5(r),s=t.get(o);s!==void 0?s.push(r):t.set(o,[r])}const n=[];for(const[r,o]of t){const s=[...o].sort((i,l)=>i.timestamp.localeCompare(l.timestamp));n.push({id:r,conversationId:r,logs:s})}return n.sort((r,o)=>(r.logs[0]?.timestamp??"").localeCompare(o.logs[0]?.timestamp??"")),n}function Yc(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function O5(e){if(e.responseText===null)return null;try{let t=JSON.parse(e.responseText);return typeof t=="string"&&(t=JSON.parse(t)),Yc(t)?typeof t.stop_reason=="string"?t.stop_reason==="end_turn"||t.stop_reason==="tool_use"?t.stop_reason:null:Array.isArray(t.choices)&&t.choices.length>0&&Yc(t.choices[0])&&typeof t.choices[0].finish_reason=="string"&&t.choices[0].finish_reason==="stop"?"stop":null:null}catch{return null}}function xm(e){return e==="end_turn"||e==="stop"}function jt({className:e,style:t,d:n,eyeStalks:r,eyes:o,legs:s,extras:i}){return a.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",style:t,className:ve("inline-block size-5",e),children:[a.jsx("path",{d:n}),r,o,s,i]})}const wn=a.jsxs(a.Fragment,{children:[a.jsx("line",{x1:"6.5",y1:"16",x2:"4.5",y2:"19.5"}),a.jsx("line",{x1:"9",y1:"17.5",x2:"8",y2:"20.5"}),a.jsx("line",{x1:"15",y1:"17.5",x2:"16",y2:"20.5"}),a.jsx("line",{x1:"17.5",y1:"16",x2:"19.5",y2:"19.5"})]}),bm=a.jsxs(a.Fragment,{children:[a.jsx("line",{x1:"7",y1:"16",x2:"5.5",y2:"18.5"}),a.jsx("line",{x1:"9.5",y1:"17",x2:"8.5",y2:"19.5"}),a.jsx("line",{x1:"14.5",y1:"17",x2:"15.5",y2:"19.5"}),a.jsx("line",{x1:"17",y1:"16",x2:"18.5",y2:"18.5"})]});function ym({className:e}){return a.jsx(jt,{className:e,d:"M5 13 C5 9 8 7 12 7 C16 7 19 9 19 13 C19 16 16 18 12 18 C8 18 5 16 5 13 Z",eyeStalks:a.jsxs(a.Fragment,{children:[a.jsx("line",{x1:"10",y1:"7",x2:"9.5",y2:"5"}),a.jsx("line",{x1:"14",y1:"7",x2:"14.5",y2:"5"})]}),eyes:a.jsxs(a.Fragment,{children:[a.jsx("circle",{cx:"9.5",cy:"4.5",r:"0.9",fill:"currentColor",stroke:"none"}),a.jsx("circle",{cx:"14.5",cy:"4.5",r:"0.9",fill:"currentColor",stroke:"none"})]}),legs:wn,extras:a.jsxs(a.Fragment,{children:[a.jsx("path",{d:"M5 11 C3.5 9.5 1.5 10 2 12.5 C2.5 14 4 13.5 5 12.5"}),a.jsx("path",{d:"M19 11 C20.5 9.5 22.5 10 22 12.5 C21.5 14 20 13.5 19 12.5"})]})})}function M5({className:e}){return a.jsx(jt,{className:e,d:"M4 13 C4 7 7.5 5.5 12 5.5 C16.5 5.5 20 7 20 13 C20 17.5 16.5 19 12 19 C7.5 19 4 17.5 4 13 Z",eyeStalks:a.jsxs(a.Fragment,{children:[a.jsx("line",{x1:"9.5",y1:"6.5",x2:"9.5",y2:"4.5"}),a.jsx("line",{x1:"14.5",y1:"6.5",x2:"14.5",y2:"4.5"})]}),eyes:a.jsxs(a.Fragment,{children:[a.jsx("circle",{cx:"9.5",cy:"4",r:"1.1",fill:"currentColor",stroke:"none"}),a.jsx("circle",{cx:"14.5",cy:"4",r:"1.1",fill:"currentColor",stroke:"none"})]}),legs:bm,extras:a.jsxs(a.Fragment,{children:[a.jsx("path",{d:"M5 11 C4 9.5 2.5 10 3 12 C3.5 13.5 4.5 13 5 12"}),a.jsx("path",{d:"M19 11 C20 9.5 21.5 10 21 12 C20.5 13.5 19.5 13 19 12"})]})})}function L5({className:e}){return a.jsx(jt,{className:e,d:"M3 13.5 C3 8 7 6 12 6 C17 6 21 8 21 13.5 C21 17 17 19 12 19 C7 19 3 17 3 13.5 Z",eyeStalks:a.jsxs(a.Fragment,{children:[a.jsx("line",{x1:"7",y1:"7",x2:"6.5",y2:"4.5"}),a.jsx("line",{x1:"17",y1:"7",x2:"17.5",y2:"4.5"})]}),eyes:a.jsxs(a.Fragment,{children:[a.jsx("circle",{cx:"6.5",cy:"4",r:"0.8",fill:"currentColor",stroke:"none"}),a.jsx("circle",{cx:"17.5",cy:"4",r:"0.8",fill:"currentColor",stroke:"none"})]}),legs:wn,extras:a.jsxs(a.Fragment,{children:[a.jsx("path",{d:"M4 12 C2.5 10.5 1 11 1.5 13 C2 14.5 3.5 14 4.5 13"}),a.jsx("path",{d:"M20 12 C21.5 10.5 23 11 22.5 13 C22 14.5 20.5 14 19.5 13"})]})})}function D5({className:e}){return a.jsx(jt,{className:e,d:"M6 14 C6 8 9 5.5 12 5.5 C15 5.5 18 8 18 14 C18 18 15 20 12 20 C9 20 6 18 6 14 Z",eyeStalks:a.jsxs(a.Fragment,{children:[a.jsx("line",{x1:"10",y1:"6.5",x2:"10",y2:"3.5"}),a.jsx("line",{x1:"14",y1:"6.5",x2:"14",y2:"3.5"})]}),eyes:a.jsxs(a.Fragment,{children:[a.jsx("circle",{cx:"10",cy:"3",r:"0.7",fill:"currentColor",stroke:"none"}),a.jsx("circle",{cx:"14",cy:"3",r:"0.7",fill:"currentColor",stroke:"none"})]}),legs:a.jsxs(a.Fragment,{children:[a.jsx("line",{x1:"7",y1:"17",x2:"5",y2:"20.5"}),a.jsx("line",{x1:"9.5",y1:"18.5",x2:"8.5",y2:"21.5"}),a.jsx("line",{x1:"14.5",y1:"18.5",x2:"15.5",y2:"21.5"}),a.jsx("line",{x1:"17",y1:"17",x2:"19",y2:"20.5"})]}),extras:a.jsxs(a.Fragment,{children:[a.jsx("path",{d:"M6.5 11 C5 8.5 3 9 3.5 11.5 C4 13.5 5 13 6 12"}),a.jsx("path",{d:"M17.5 11 C19 8.5 21 9 20.5 11.5 C20 13.5 19 13 18 12"})]})})}function F5({className:e}){return a.jsx(jt,{className:e,d:"M5 13 C5 9 8 7 12 7 L13 4 L14 7 C16 7 19 9 19 13 C19 16 16 18 13 18 L12 21 L11 18 C8 18 5 16 5 13 Z",eyeStalks:a.jsxs(a.Fragment,{children:[a.jsx("line",{x1:"10",y1:"7",x2:"9.5",y2:"5"}),a.jsx("line",{x1:"14",y1:"7",x2:"14.5",y2:"5"})]}),eyes:a.jsxs(a.Fragment,{children:[a.jsx("circle",{cx:"9.5",cy:"4.5",r:"0.8",fill:"currentColor",stroke:"none"}),a.jsx("circle",{cx:"14.5",cy:"4.5",r:"0.8",fill:"currentColor",stroke:"none"})]}),legs:wn,extras:a.jsxs(a.Fragment,{children:[a.jsx("path",{d:"M5 11 C3.5 9.5 1.5 10 2 12.5 C2.5 14 4 13.5 5 12.5"}),a.jsx("path",{d:"M19 11 C20.5 9.5 22.5 10 22 12.5 C21.5 14 20 13.5 19 12.5"})]})})}function $5({className:e}){return a.jsx(jt,{className:e,d:"M5 13 C5 9 8 7 12 7 C16 7 19 9 19 13 C19 16 16 18 12 18 C8 18 5 16 5 13 Z",eyeStalks:a.jsxs(a.Fragment,{children:[a.jsx("line",{x1:"10",y1:"7",x2:"9.5",y2:"5"}),a.jsx("line",{x1:"14",y1:"7",x2:"14.5",y2:"5"})]}),eyes:a.jsxs(a.Fragment,{children:[a.jsx("circle",{cx:"9.5",cy:"4.5",r:"0.9",fill:"currentColor",stroke:"none"}),a.jsx("line",{x1:"13.5",y1:"4",x2:"15.5",y2:"5"})]}),legs:wn,extras:a.jsxs(a.Fragment,{children:[a.jsx("path",{d:"M5 11 C3.5 9.5 1.5 10 2 12.5 C2.5 14 4 13.5 5 12.5"}),a.jsx("path",{d:"M19 11 C20.5 9.5 22.5 10 22 12.5 C21.5 14 20 13.5 19 12.5"})]})})}function B5({className:e}){return a.jsx(jt,{className:e,d:"M5.5 13.5 C5.5 10 8.5 8 12 8 C15.5 8 18.5 10 18.5 13.5 C18.5 16 15.5 17.5 12 17.5 C8.5 17.5 5.5 16 5.5 13.5 Z",eyeStalks:a.jsxs(a.Fragment,{children:[a.jsx("line",{x1:"10",y1:"8",x2:"10",y2:"6"}),a.jsx("line",{x1:"14",y1:"8",x2:"14",y2:"6"})]}),eyes:a.jsxs(a.Fragment,{children:[a.jsx("line",{x1:"9",y1:"6",x2:"11",y2:"6.5"}),a.jsx("line",{x1:"13",y1:"6",x2:"15",y2:"6.5"})]}),legs:bm,extras:a.jsxs(a.Fragment,{children:[a.jsx("path",{d:"M6 11.5 C4.5 10.5 3 11 3.5 12.5 C4 13.5 5 13 5.5 12.5"}),a.jsx("path",{d:"M18 11.5 C19.5 10.5 21 11 20.5 12.5 C20 13.5 19 13 18.5 12.5"})]})})}function U5({className:e}){return a.jsx(jt,{className:e,d:"M5 13 C5 9 8 7 12 7 C16 7 19 9 19 13 C19 16 16 18 12 18 C8 18 5 16 5 13 Z",eyeStalks:a.jsxs(a.Fragment,{children:[a.jsx("line",{x1:"10",y1:"7",x2:"9.5",y2:"5"}),a.jsx("line",{x1:"14",y1:"7",x2:"14.5",y2:"5"})]}),eyes:a.jsxs(a.Fragment,{children:[a.jsx("circle",{cx:"9.5",cy:"4.5",r:"0.7",fill:"currentColor",stroke:"none"}),a.jsx("circle",{cx:"14.5",cy:"4.5",r:"0.7",fill:"currentColor",stroke:"none"})]}),legs:wn,extras:a.jsxs(a.Fragment,{children:[a.jsx("path",{d:"M5 11 C3.5 9.5 1.5 10 2 12.5 C2.5 14 4 13.5 5 12.5"}),a.jsx("path",{d:"M19 11 C20.5 9.5 22.5 10 22 12.5 C21.5 14 20 13.5 19 12.5"}),a.jsx("line",{x1:"8.5",y1:"4",x2:"10.5",y2:"4.5"}),a.jsx("line",{x1:"15.5",y1:"4",x2:"13.5",y2:"4.5"}),a.jsx("path",{d:"M9 15.5 C10 14.5 14 14.5 15 15.5"})]})})}function W5({className:e}){return a.jsx(jt,{className:e,d:"M5 13 C5 9 8 7 12 7 C16 7 19 9 19 13 C19 16 16 18 12 18 C8 18 5 16 5 13 Z",eyeStalks:a.jsxs(a.Fragment,{children:[a.jsx("line",{x1:"10",y1:"7",x2:"9.5",y2:"5"}),a.jsx("line",{x1:"14",y1:"7",x2:"14.5",y2:"5"})]}),eyes:a.jsxs(a.Fragment,{children:[a.jsx("circle",{cx:"9.5",cy:"4.5",r:"1.2",fill:"none",stroke:"currentColor"}),a.jsx("circle",{cx:"14.5",cy:"4.5",r:"1.2",fill:"none",stroke:"currentColor"})]}),legs:wn,extras:a.jsxs(a.Fragment,{children:[a.jsx("path",{d:"M5 11 C3.5 9.5 1.5 10 2 12.5 C2.5 14 4 13.5 5 12.5"}),a.jsx("path",{d:"M19 11 C20.5 9.5 22.5 10 22 12.5 C21.5 14 20 13.5 19 12.5"}),a.jsx("ellipse",{cx:"12",cy:"15",rx:"2",ry:"1.5",fill:"currentColor",stroke:"none"})]})})}function H5({className:e}){return a.jsx(jt,{className:e,d:"M4.5 13 C4.5 8 7.5 6 12 6 C16.5 6 19.5 8 19.5 13 C19.5 17 16.5 18.5 12 18.5 C7.5 18.5 4.5 17 4.5 13 Z",eyeStalks:a.jsxs(a.Fragment,{children:[a.jsx("line",{x1:"9.5",y1:"7",x2:"9",y2:"5"}),a.jsx("line",{x1:"14.5",y1:"7",x2:"15",y2:"5"})]}),eyes:a.jsxs(a.Fragment,{children:[a.jsx("circle",{cx:"9",cy:"4.5",r:"1",fill:"currentColor",stroke:"none"}),a.jsx("circle",{cx:"15",cy:"4.5",r:"1",fill:"currentColor",stroke:"none"})]}),legs:wn,extras:a.jsxs(a.Fragment,{children:[a.jsx("path",{d:"M5 11 C3.5 9 2 9.5 2.5 12 C3 14 4 13 5 12"}),a.jsx("path",{d:"M19 11 C20.5 9 22 9.5 21.5 12 C21 14 20 13 19 12"}),a.jsx("path",{d:"M9 14.5 C10 16 14 16 15 14.5"}),a.jsx("circle",{cx:"7",cy:"13",r:"1",fill:"currentColor",stroke:"none",opacity:"0.3"}),a.jsx("circle",{cx:"17",cy:"13",r:"1",fill:"currentColor",stroke:"none",opacity:"0.3"})]})})}function V5({className:e}){return a.jsx(jt,{className:e,d:"M5 13 C5 9 8 7 12 7 C16 7 19 9 19 13 C19 16 16 18 12 18 C8 18 5 16 5 13 Z",eyeStalks:a.jsxs(a.Fragment,{children:[a.jsx("line",{x1:"10",y1:"7",x2:"9.5",y2:"5.5"}),a.jsx("line",{x1:"14",y1:"7",x2:"14.5",y2:"5.5"})]}),eyes:a.jsxs(a.Fragment,{children:[a.jsx("line",{x1:"7.5",y1:"5.5",x2:"16.5",y2:"5.5"}),a.jsx("rect",{x:"7",y:"5",width:"4",height:"2",rx:"0.5",fill:"currentColor",stroke:"none"}),a.jsx("rect",{x:"13",y:"5",width:"4",height:"2",rx:"0.5",fill:"currentColor",stroke:"none"})]}),legs:wn,extras:a.jsxs(a.Fragment,{children:[a.jsx("path",{d:"M5 11 C3.5 9.5 1.5 10 2 12.5 C2.5 14 4 13.5 5 12.5"}),a.jsx("path",{d:"M19 11 C20.5 9.5 22.5 10 22 12.5 C21.5 14 20 13.5 19 12.5"}),a.jsx("path",{d:"M9.5 15 C10.5 16 13.5 16 14.5 15"})]})})}function Z5({className:e}){return a.jsx(jt,{className:e,d:"M7 13.5 C7 10.5 9.5 9 12 9 C14.5 9 17 10.5 17 13.5 C17 16 14.5 17.5 12 17.5 C9.5 17.5 7 16 7 13.5 Z",eyeStalks:a.jsxs(a.Fragment,{children:[a.jsx("line",{x1:"10.5",y1:"9.5",x2:"10.5",y2:"8"}),a.jsx("line",{x1:"13.5",y1:"9.5",x2:"13.5",y2:"8"})]}),eyes:a.jsxs(a.Fragment,{children:[a.jsx("circle",{cx:"10.5",cy:"7.5",r:"0.8",fill:"currentColor",stroke:"none"}),a.jsx("circle",{cx:"13.5",cy:"7.5",r:"0.8",fill:"currentColor",stroke:"none"})]}),legs:a.jsxs(a.Fragment,{children:[a.jsx("line",{x1:"8",y1:"16",x2:"6.5",y2:"18"}),a.jsx("line",{x1:"10",y1:"17",x2:"9.5",y2:"19"}),a.jsx("line",{x1:"14",y1:"17",x2:"14.5",y2:"19"}),a.jsx("line",{x1:"16",y1:"16",x2:"17.5",y2:"18"})]}),extras:a.jsxs(a.Fragment,{children:[a.jsx("path",{d:"M7.5 12 C6.5 11 5.5 11.5 6 13 C6.5 14 7 13.5 7.5 13"}),a.jsx("path",{d:"M16.5 12 C17.5 11 18.5 11.5 18 13 C17.5 14 17 13.5 16.5 13"})]})})}const Br=[ym,M5,L5,D5,F5,$5,B5,U5,W5,H5,V5,Z5];function Go(e){return Br[Math.abs(e)%Br.length]??ym}function q5(e){const t=Br.length-2;return t<=0?0:1+((Number.isFinite(e)?Math.trunc(e):0)%t+t)%t}function K5(e){return Go(q5(e))}const G5="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",J5="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",Y5="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",X5="/assets/minimax-BPMzvuL-.jpeg",Q5="/assets/alibaba-TTwafVwX.svg",eN="/assets/qwen-CONDcHqt.png",tN="/assets/zhipuai-BPNAnxo-.svg",nN={"claude-":"anthropic","gpt-":"openai","o1-":"openai","o3-":"openai","deepseek-":"deepseek",MiniMax:"minimax",qwen:"qwen","glm-":"zhipuai"};function vm(e){if(e===null)return"unknown";const t=e.toLowerCase();for(const[n,r]of Object.entries(nN))if(t.startsWith(n.toLowerCase()))return r;return"unknown"}const On={width:24,height:24,objectFit:"contain"},rN=ut.memo(({className:e})=>a.jsx("img",{src:G5,alt:"Anthropic",className:e,style:On})),oN=ut.memo(({className:e})=>a.jsx("img",{src:J5,alt:"OpenAI",className:e,style:{...On,background:"white",borderRadius:"4px"}})),sN=ut.memo(({className:e})=>a.jsx("img",{src:Y5,alt:"DeepSeek",className:e,style:On})),iN=ut.memo(({className:e})=>a.jsx("img",{src:X5,alt:"MiniMax",className:e,style:On})),aN=ut.memo(({className:e})=>a.jsx("img",{src:Q5,alt:"Alibaba",className:e,style:On})),lN=ut.memo(({className:e})=>a.jsx("img",{src:eN,alt:"Qwen",className:e,style:On})),cN=ut.memo(({className:e})=>a.jsx("img",{src:tN,alt:"ZhipuAI",className:e,style:On}));function wm({provider:e,className:t}){switch(e){case"anthropic":return a.jsx(rN,{className:t});case"openai":return a.jsx(oN,{className:t});case"deepseek":return a.jsx(sN,{className:t});case"minimax":return a.jsx(iN,{className:t});case"alibaba":return a.jsx(aN,{className:t});case"qwen":return a.jsx(lN,{className:t});case"zhipuai":return a.jsx(cN,{className:t});case"unknown":return null}}function tt({delayDuration:e=0,...t}){return a.jsx(y5,{"data-slot":"tooltip-provider",delayDuration:e,...t})}function Fe({...e}){return a.jsx(v5,{"data-slot":"tooltip",...e})}function $e({...e}){return a.jsx(w5,{"data-slot":"tooltip-trigger",...e})}function Be({className:e,sideOffset:t=0,children:n,...r}){return a.jsx(k5,{children:a.jsxs(_5,{"data-slot":"tooltip-content",sideOffset:t,className:ve("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,a.jsx(S5,{className:"bg-foreground fill-foreground z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px]"})]})})}function ul(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function Me(e,t){return e===null||typeof e!="object"||Array.isArray(e)?void 0:Object.getOwnPropertyDescriptor(e,t)?.value}const uN="x-anthropic-billing-header:";function dN(e){return e.trimStart().toLowerCase().startsWith(uN)}function fN(e){return ul(e)?Object.prototype.hasOwnProperty.call(e,"system"):!1}function pN(e){if(!ul(e))return!1;const t=Me(e,"type"),n=Me(e,"text");return typeof t!="string"||t!=="text"||typeof n!="string"?!1:dN(n)}function hN(e){let t;try{t=JSON.parse(e)}catch{return{body:e,removed:0}}if(!fN(t))return{body:e,removed:0};const n=t.system;if(!Array.isArray(n)||n.length===0)return{body:e,removed:0};const r=[];let o=0;for(const s of n){if(pN(s)){o+=1;continue}r.push(s)}return o===0?{body:e,removed:0}:(r.length===0?delete t.system:t.system=r,{body:JSON.stringify(t),removed:o})}function mN(e){return{depth:Number.POSITIVE_INFINITY}}function km(e){try{const t=JSON.parse(e);return{kind:"json",data:Jo(t)}}catch{return{kind:"text"}}}function oi(e){const t=x.useMemo(()=>e===null?null:km(e),[e]),n=t?.kind==="json"?t.data:null,r=x.useMemo(()=>n===null?null:mN(),[n]),[o,s]=x.useState(!1),[i,l]=x.useState(0),[c,u]=x.useState(0),[d,f]=x.useTransition(),h=x.useCallback(()=>{const p=!o,y=p&&r!==null?r.depth:0;f(()=>{s(p),l(y),u(m=>m+1)})},[o,r]);return{parsedData:n,policy:r,isExpanded:o,toggle:h,isPending:d,bulkDepth:i,bulkRevision:c}}function Jo(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=>Jo(n));const t={};for(const n of Object.keys(e)){const r=Object.getOwnPropertyDescriptor(e,n);t[n]=Jo(r?.value)}return t}case"bigint":case"symbol":case"function":case"undefined":return String(e)}return null}function _m({className:e,orientation:t="horizontal",...n}){return a.jsx(e5,{"data-slot":"tabs","data-orientation":t,orientation:t,className:ve("group/tabs flex gap-2 data-[orientation=horizontal]:flex-col",e),...n})}const gN=$a("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 Sm({className:e,variant:t="default",...n}){return a.jsx(t5,{"data-slot":"tabs-list","data-variant":t,className:ve(gN({variant:t}),e),...n})}function Tt({className:e,...t}){return a.jsx(n5,{"data-slot":"tabs-trigger",className:ve("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 At({className:e,...t}){return a.jsx(r5,{"data-slot":"tabs-content",className:ve("flex-1 outline-none",e),...t})}function Xt(e){const[t,n]=x.useState(!1),r=x.useRef(null);x.useEffect(()=>()=>{r.current!==null&&clearTimeout(r.current)},[]);const o=x.useCallback(s=>{s.stopPropagation(),e!==null&&window.navigator.clipboard.writeText(e).then(()=>{n(!0),r.current!==null&&clearTimeout(r.current),r.current=setTimeout(()=>n(!1),2e3)})},[e]);return{copied:t,copy:o}}const xN=x.lazy(()=>In(()=>import("./CompareDrawer-Bg2mo0NZ.js"),__vite__mapDeps([0,1])).then(e=>({default:e.CompareDrawer}))),bN=x.lazy(()=>In(()=>import("./ReplayDialog-Bns-ayOg.js"),__vite__mapDeps([2,1,3])).then(e=>({default:e.ReplayDialog}))),yN=x.lazy(()=>In(()=>import("./RequestAnatomy-BBcPAIWx.js"),__vite__mapDeps([4,1])).then(e=>({default:e.RequestAnatomy}))),vN=x.lazy(()=>In(()=>import("./ResponseView-DSRS3rHt.js"),__vite__mapDeps([3,1])).then(e=>({default:e.ResponseView}))),wN=x.lazy(()=>In(()=>import("./StreamingChunkSequence-CzZxKE5-.js"),__vite__mapDeps([5,1])).then(e=>({default:e.StreamingChunkSequence}))),Xc=x.lazy(()=>In(()=>Promise.resolve().then(()=>xg),void 0).then(e=>({default:e.JsonViewer}))),kN=x.lazy(()=>In(()=>Promise.resolve().then(()=>xg),void 0).then(e=>({default:e.JsonViewerFromString}))),_N=1200,SN=12;function CN(e){const{containerRef:t,setExpandToPath:n,ensureTabActive:r,highlightMs:o}=e,s=x.useRef(null);return x.useCallback(i=>{r?.(),n(i.path);const l=f=>{f.scrollIntoView({behavior:"smooth",block:"center"}),f.classList.add("ring-2","ring-primary/60","ring-offset-1","ring-offset-background","rounded-sm","transition-shadow"),s.current!==null&&clearTimeout(s.current),s.current=setTimeout(()=>{f.classList.remove("ring-2","ring-primary/60","ring-offset-1","ring-offset-background","rounded-sm","transition-shadow"),n(null)},o??_N)},u=`[data-anatomy-path="${(f=>typeof CSS<"u"&&typeof CSS.escape=="function"?CSS.escape(f):f.replace(/(["'\\[\](){}])/g,"\\$1"))(i.path)}"]`,d=f=>{const h=t.current;if(h!==null){const p=h.querySelector(u);if(p!==null){l(p);return}}f>0?window.requestAnimationFrame(()=>d(f-1)):n(null)};window.requestAnimationFrame(()=>d(SN))},[t,r,o,n])}class Cm{diff(t,n,r={}){let o;typeof r=="function"?(o=r,r={}):"callback"in r&&(o=r.callback);const s=this.castInput(t,r),i=this.castInput(n,r),l=this.removeEmpty(this.tokenize(s,r)),c=this.removeEmpty(this.tokenize(i,r));return this.diffWithOptionsObj(l,c,r,o)}diffWithOptionsObj(t,n,r,o){var s;const i=v=>{if(v=this.postProcess(v,r),o){setTimeout(function(){o(v)},0);return}else return v},l=n.length,c=t.length;let u=1,d=l+c;r.maxEditLength!=null&&(d=Math.min(d,r.maxEditLength));const f=(s=r.timeout)!==null&&s!==void 0?s:1/0,h=Date.now()+f,p=[{oldPos:-1,lastComponent:void 0}];let y=this.extractCommon(p[0],n,t,0,r);if(p[0].oldPos+1>=c&&y+1>=l)return i(this.buildValues(p[0].lastComponent,n,t));let m=-1/0,g=1/0;const b=()=>{for(let v=Math.max(m,-u);v<=Math.min(g,u);v+=2){let k;const S=p[v-1],C=p[v+1];S&&(p[v-1]=void 0);let j=!1;if(C){const T=C.oldPos-v;j=C&&0<=T&&T<l}const E=S&&S.oldPos+1<c;if(!j&&!E){p[v]=void 0;continue}if(!E||j&&S.oldPos<C.oldPos?k=this.addToPath(C,!0,!1,0,r):k=this.addToPath(S,!1,!0,1,r),y=this.extractCommon(k,n,t,v,r),k.oldPos+1>=c&&y+1>=l)return i(this.buildValues(k.lastComponent,n,t))||!0;p[v]=k,k.oldPos+1>=c&&(g=Math.min(g,v-1)),y+1>=l&&(m=Math.max(m,v+1))}u++};if(o)(function v(){setTimeout(function(){if(u>d||Date.now()>h)return o(void 0);b()||v()},0)})();else for(;u<=d&&Date.now()<=h;){const v=b();if(v)return v}}addToPath(t,n,r,o,s){const i=t.lastComponent;return i&&!s.oneChangePerToken&&i.added===n&&i.removed===r?{oldPos:t.oldPos+o,lastComponent:{count:i.count+1,added:n,removed:r,previousComponent:i.previousComponent}}:{oldPos:t.oldPos+o,lastComponent:{count:1,added:n,removed:r,previousComponent:i}}}extractCommon(t,n,r,o,s){const i=n.length,l=r.length;let c=t.oldPos,u=c-o,d=0;for(;u+1<i&&c+1<l&&this.equals(r[c+1],n[u+1],s);)u++,c++,d++,s.oneChangePerToken&&(t.lastComponent={count:1,previousComponent:t.lastComponent,added:!1,removed:!1});return d&&!s.oneChangePerToken&&(t.lastComponent={count:d,previousComponent:t.lastComponent,added:!1,removed:!1}),t.oldPos=c,u}equals(t,n,r){return r.comparator?r.comparator(t,n):t===n||!!r.ignoreCase&&t.toLowerCase()===n.toLowerCase()}removeEmpty(t){const n=[];for(let r=0;r<t.length;r++)t[r]&&n.push(t[r]);return n}castInput(t,n){return t}tokenize(t,n){return Array.from(t)}join(t){return t.join("")}postProcess(t,n){return t}get useLongestToken(){return!1}buildValues(t,n,r){const o=[];let s;for(;t;)o.push(t),s=t.previousComponent,delete t.previousComponent,t=s;o.reverse();const i=o.length;let l=0,c=0,u=0;for(;l<i;l++){const d=o[l];if(d.removed)d.value=this.join(r.slice(u,u+d.count)),u+=d.count;else{if(!d.added&&this.useLongestToken){let f=n.slice(c,c+d.count);f=f.map(function(h,p){const y=r[u+p];return y.length>h.length?y:h}),d.value=this.join(f)}else d.value=this.join(n.slice(c,c+d.count));c+=d.count,d.added||(u+=d.count)}}return o}}class jN extends Cm{constructor(){super(...arguments),this.tokenize=Nm}equals(t,n,r){return r.ignoreWhitespace?((!r.newlineIsToken||!t.includes(`
|
|
85
|
+
For more information, see https://radix-ui.com/primitives/docs/components/${t.docsSlug}`;return x.useEffect(()=>{e&&(document.getElementById(e)||console.error(n))},[n,e]),null},xS="DialogDescriptionWarning",bS=({contentRef:e,descriptionId:t})=>{const r=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${Rp(xS).contentName}}.`;return x.useEffect(()=>{const o=e.current?.getAttribute("aria-describedby");t&&o&&(document.getElementById(t)||console.warn(r))},[r,e,t]),null},yS=vp,vS=kp,wS=Sp,kS=Cp,_S=jp,SS=Ep,CS=Ip;function jS(e){const t=x.useRef({value:e,previous:e});return x.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}function NS(e){const[t,n]=x.useState(void 0);return ot(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});const r=new ResizeObserver(o=>{if(!Array.isArray(o)||!o.length)return;const s=o[0];let i,l;if("borderBoxSize"in s){const c=s.borderBoxSize,u=Array.isArray(c)?c[0]:c;i=u.inlineSize,l=u.blockSize}else i=e.offsetWidth,l=e.offsetHeight;n({width:i,height:l})});return r.observe(e,{box:"border-box"}),()=>r.unobserve(e)}else n(void 0)},[e]),t}const ES=["top","right","bottom","left"],mn=Math.min,bt=Math.max,Uo=Math.round,go=Math.floor,Ut=e=>({x:e,y:e}),TS={left:"right",right:"left",bottom:"top",top:"bottom"},AS={start:"end",end:"start"};function Ui(e,t,n){return bt(e,mn(t,n))}function en(e,t){return typeof e=="function"?e(t):e}function tn(e){return e.split("-")[0]}function pr(e){return e.split("-")[1]}function Ga(e){return e==="x"?"y":"x"}function Ja(e){return e==="y"?"height":"width"}const IS=new Set(["top","bottom"]);function $t(e){return IS.has(tn(e))?"y":"x"}function Ya(e){return Ga($t(e))}function zS(e,t,n){n===void 0&&(n=!1);const r=pr(e),o=Ya(e),s=Ja(o);let i=o==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[s]>t.floating[s]&&(i=Wo(i)),[i,Wo(i)]}function RS(e){const t=Wo(e);return[Wi(e),t,Wi(t)]}function Wi(e){return e.replace(/start|end/g,t=>AS[t])}const Fc=["left","right"],$c=["right","left"],PS=["top","bottom"],OS=["bottom","top"];function MS(e,t,n){switch(e){case"top":case"bottom":return n?t?$c:Fc:t?Fc:$c;case"left":case"right":return t?PS:OS;default:return[]}}function LS(e,t,n,r){const o=pr(e);let s=MS(tn(e),n==="start",r);return o&&(s=s.map(i=>i+"-"+o),t&&(s=s.concat(s.map(Wi)))),s}function Wo(e){return e.replace(/left|right|bottom|top/g,t=>TS[t])}function DS(e){return{top:0,right:0,bottom:0,left:0,...e}}function Pp(e){return typeof e!="number"?DS(e):{top:e,right:e,bottom:e,left:e}}function Vo(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 Bc(e,t,n){let{reference:r,floating:o}=e;const s=$t(t),i=Ya(t),l=Ja(i),c=tn(t),u=s==="y",d=r.x+r.width/2-o.width/2,f=r.y+r.height/2-o.height/2,h=r[l]/2-o[l]/2;let p;switch(c){case"top":p={x:d,y:r.y-o.height};break;case"bottom":p={x:d,y:r.y+r.height};break;case"right":p={x:r.x+r.width,y:f};break;case"left":p={x:r.x-o.width,y:f};break;default:p={x:r.x,y:r.y}}switch(pr(t)){case"start":p[i]-=h*(n&&u?-1:1);break;case"end":p[i]+=h*(n&&u?-1:1);break}return p}async function FS(e,t){var n;t===void 0&&(t={});const{x:r,y:o,platform:s,rects:i,elements:l,strategy:c}=e,{boundary:u="clippingAncestors",rootBoundary:d="viewport",elementContext:f="floating",altBoundary:h=!1,padding:p=0}=en(t,e),y=Pp(p),g=l[h?f==="floating"?"reference":"floating":f],b=Vo(await s.getClippingRect({element:(n=await(s.isElement==null?void 0:s.isElement(g)))==null||n?g:g.contextElement||await(s.getDocumentElement==null?void 0:s.getDocumentElement(l.floating)),boundary:u,rootBoundary:d,strategy:c})),v=f==="floating"?{x:r,y:o,width:i.floating.width,height:i.floating.height}:i.reference,k=await(s.getOffsetParent==null?void 0:s.getOffsetParent(l.floating)),S=await(s.isElement==null?void 0:s.isElement(k))?await(s.getScale==null?void 0:s.getScale(k))||{x:1,y:1}:{x:1,y:1},C=Vo(s.convertOffsetParentRelativeRectToViewportRelativeRect?await s.convertOffsetParentRelativeRectToViewportRelativeRect({elements:l,rect:v,offsetParent:k,strategy:c}):v);return{top:(b.top-C.top+y.top)/S.y,bottom:(C.bottom-b.bottom+y.bottom)/S.y,left:(b.left-C.left+y.left)/S.x,right:(C.right-b.right+y.right)/S.x}}const $S=async(e,t,n)=>{const{placement:r="bottom",strategy:o="absolute",middleware:s=[],platform:i}=n,l=s.filter(Boolean),c=await(i.isRTL==null?void 0:i.isRTL(t));let u=await i.getElementRects({reference:e,floating:t,strategy:o}),{x:d,y:f}=Bc(u,r,c),h=r,p={},y=0;for(let g=0;g<l.length;g++){var m;const{name:b,fn:v}=l[g],{x:k,y:S,data:C,reset:j}=await v({x:d,y:f,initialPlacement:r,placement:h,strategy:o,middlewareData:p,rects:u,platform:{...i,detectOverflow:(m=i.detectOverflow)!=null?m:FS},elements:{reference:e,floating:t}});d=k??d,f=S??f,p={...p,[b]:{...p[b],...C}},j&&y<=50&&(y++,typeof j=="object"&&(j.placement&&(h=j.placement),j.rects&&(u=j.rects===!0?await i.getElementRects({reference:e,floating:t,strategy:o}):j.rects),{x:d,y:f}=Bc(u,h,c)),g=-1)}return{x:d,y:f,placement:h,strategy:o,middlewareData:p}},BS=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:r,placement:o,rects:s,platform:i,elements:l,middlewareData:c}=t,{element:u,padding:d=0}=en(e,t)||{};if(u==null)return{};const f=Pp(d),h={x:n,y:r},p=Ya(o),y=Ja(p),m=await i.getDimensions(u),g=p==="y",b=g?"top":"left",v=g?"bottom":"right",k=g?"clientHeight":"clientWidth",S=s.reference[y]+s.reference[p]-h[p]-s.floating[y],C=h[p]-s.reference[p],j=await(i.getOffsetParent==null?void 0:i.getOffsetParent(u));let E=j?j[k]:0;(!E||!await(i.isElement==null?void 0:i.isElement(j)))&&(E=l.floating[k]||s.floating[y]);const T=S/2-C/2,z=E/2-m[y]/2-1,O=mn(f[b],z),B=mn(f[v],z),N=O,D=E-m[y]-B,w=E/2-m[y]/2+T,L=Ui(N,w,D),W=!c.arrow&&pr(o)!=null&&w!==L&&s.reference[y]/2-(w<N?O:B)-m[y]/2<0,U=W?w<N?w-N:w-D:0;return{[p]:h[p]+U,data:{[p]:L,centerOffset:w-L-U,...W&&{alignmentOffset:U}},reset:W}}}),US=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,r;const{placement:o,middlewareData:s,rects:i,initialPlacement:l,platform:c,elements:u}=t,{mainAxis:d=!0,crossAxis:f=!0,fallbackPlacements:h,fallbackStrategy:p="bestFit",fallbackAxisSideDirection:y="none",flipAlignment:m=!0,...g}=en(e,t);if((n=s.arrow)!=null&&n.alignmentOffset)return{};const b=tn(o),v=$t(l),k=tn(l)===l,S=await(c.isRTL==null?void 0:c.isRTL(u.floating)),C=h||(k||!m?[Wo(l)]:RS(l)),j=y!=="none";!h&&j&&C.push(...LS(l,m,y,S));const E=[l,...C],T=await c.detectOverflow(t,g),z=[];let O=((r=s.flip)==null?void 0:r.overflows)||[];if(d&&z.push(T[b]),f){const w=zS(o,i,S);z.push(T[w[0]],T[w[1]])}if(O=[...O,{placement:o,overflows:z}],!z.every(w=>w<=0)){var B,N;const w=(((B=s.flip)==null?void 0:B.index)||0)+1,L=E[w];if(L&&(!(f==="alignment"?v!==$t(L):!1)||O.every(F=>$t(F.placement)===v?F.overflows[0]>0:!0)))return{data:{index:w,overflows:O},reset:{placement:L}};let W=(N=O.filter(U=>U.overflows[0]<=0).sort((U,F)=>U.overflows[1]-F.overflows[1])[0])==null?void 0:N.placement;if(!W)switch(p){case"bestFit":{var D;const U=(D=O.filter(F=>{if(j){const K=$t(F.placement);return K===v||K==="y"}return!0}).map(F=>[F.placement,F.overflows.filter(K=>K>0).reduce((K,I)=>K+I,0)]).sort((F,K)=>F[1]-K[1])[0])==null?void 0:D[0];U&&(W=U);break}case"initialPlacement":W=l;break}if(o!==W)return{reset:{placement:W}}}return{}}}};function Uc(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function Wc(e){return ES.some(t=>e[t]>=0)}const WS=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n,platform:r}=t,{strategy:o="referenceHidden",...s}=en(e,t);switch(o){case"referenceHidden":{const i=await r.detectOverflow(t,{...s,elementContext:"reference"}),l=Uc(i,n.reference);return{data:{referenceHiddenOffsets:l,referenceHidden:Wc(l)}}}case"escaped":{const i=await r.detectOverflow(t,{...s,altBoundary:!0}),l=Uc(i,n.floating);return{data:{escapedOffsets:l,escaped:Wc(l)}}}default:return{}}}}},Op=new Set(["left","top"]);async function VS(e,t){const{placement:n,platform:r,elements:o}=e,s=await(r.isRTL==null?void 0:r.isRTL(o.floating)),i=tn(n),l=pr(n),c=$t(n)==="y",u=Op.has(i)?-1:1,d=s&&c?-1:1,f=en(t,e);let{mainAxis:h,crossAxis:p,alignmentAxis:y}=typeof f=="number"?{mainAxis:f,crossAxis:0,alignmentAxis:null}:{mainAxis:f.mainAxis||0,crossAxis:f.crossAxis||0,alignmentAxis:f.alignmentAxis};return l&&typeof y=="number"&&(p=l==="end"?y*-1:y),c?{x:p*d,y:h*u}:{x:h*u,y:p*d}}const HS=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,r;const{x:o,y:s,placement:i,middlewareData:l}=t,c=await VS(t,e);return i===((n=l.offset)==null?void 0:n.placement)&&(r=l.arrow)!=null&&r.alignmentOffset?{}:{x:o+c.x,y:s+c.y,data:{...c,placement:i}}}}},ZS=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:r,placement:o,platform:s}=t,{mainAxis:i=!0,crossAxis:l=!1,limiter:c={fn:b=>{let{x:v,y:k}=b;return{x:v,y:k}}},...u}=en(e,t),d={x:n,y:r},f=await s.detectOverflow(t,u),h=$t(tn(o)),p=Ga(h);let y=d[p],m=d[h];if(i){const b=p==="y"?"top":"left",v=p==="y"?"bottom":"right",k=y+f[b],S=y-f[v];y=Ui(k,y,S)}if(l){const b=h==="y"?"top":"left",v=h==="y"?"bottom":"right",k=m+f[b],S=m-f[v];m=Ui(k,m,S)}const g=c.fn({...t,[p]:y,[h]:m});return{...g,data:{x:g.x-n,y:g.y-r,enabled:{[p]:i,[h]:l}}}}}},qS=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:n,y:r,placement:o,rects:s,middlewareData:i}=t,{offset:l=0,mainAxis:c=!0,crossAxis:u=!0}=en(e,t),d={x:n,y:r},f=$t(o),h=Ga(f);let p=d[h],y=d[f];const m=en(l,t),g=typeof m=="number"?{mainAxis:m,crossAxis:0}:{mainAxis:0,crossAxis:0,...m};if(c){const k=h==="y"?"height":"width",S=s.reference[h]-s.floating[k]+g.mainAxis,C=s.reference[h]+s.reference[k]-g.mainAxis;p<S?p=S:p>C&&(p=C)}if(u){var b,v;const k=h==="y"?"width":"height",S=Op.has(tn(o)),C=s.reference[f]-s.floating[k]+(S&&((b=i.offset)==null?void 0:b[f])||0)+(S?0:g.crossAxis),j=s.reference[f]+s.reference[k]+(S?0:((v=i.offset)==null?void 0:v[f])||0)-(S?g.crossAxis:0);y<C?y=C:y>j&&(y=j)}return{[h]:p,[f]:y}}}},KS=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var n,r;const{placement:o,rects:s,platform:i,elements:l}=t,{apply:c=()=>{},...u}=en(e,t),d=await i.detectOverflow(t,u),f=tn(o),h=pr(o),p=$t(o)==="y",{width:y,height:m}=s.floating;let g,b;f==="top"||f==="bottom"?(g=f,b=h===(await(i.isRTL==null?void 0:i.isRTL(l.floating))?"start":"end")?"left":"right"):(b=f,g=h==="end"?"top":"bottom");const v=m-d.top-d.bottom,k=y-d.left-d.right,S=mn(m-d[g],v),C=mn(y-d[b],k),j=!t.middlewareData.shift;let E=S,T=C;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(T=k),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(E=v),j&&!h){const O=bt(d.left,0),B=bt(d.right,0),N=bt(d.top,0),D=bt(d.bottom,0);p?T=y-2*(O!==0||B!==0?O+B:bt(d.left,d.right)):E=m-2*(N!==0||D!==0?N+D:bt(d.top,d.bottom))}await c({...t,availableWidth:T,availableHeight:E});const z=await i.getDimensions(l.floating);return y!==z.width||m!==z.height?{reset:{rects:!0}}:{}}}};function ys(){return typeof window<"u"}function hr(e){return Mp(e)?(e.nodeName||"").toLowerCase():"#document"}function vt(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function qt(e){var t;return(t=(Mp(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function Mp(e){return ys()?e instanceof Node||e instanceof vt(e).Node:!1}function zt(e){return ys()?e instanceof Element||e instanceof vt(e).Element:!1}function Vt(e){return ys()?e instanceof HTMLElement||e instanceof vt(e).HTMLElement:!1}function Vc(e){return!ys()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof vt(e).ShadowRoot}const GS=new Set(["inline","contents"]);function Kr(e){const{overflow:t,overflowX:n,overflowY:r,display:o}=Rt(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&!GS.has(o)}const JS=new Set(["table","td","th"]);function YS(e){return JS.has(hr(e))}const XS=[":popover-open",":modal"];function vs(e){return XS.some(t=>{try{return e.matches(t)}catch{return!1}})}const QS=["transform","translate","scale","rotate","perspective"],eC=["transform","translate","scale","rotate","perspective","filter"],tC=["paint","layout","strict","content"];function Xa(e){const t=Qa(),n=zt(e)?Rt(e):e;return QS.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)||eC.some(r=>(n.willChange||"").includes(r))||tC.some(r=>(n.contain||"").includes(r))}function nC(e){let t=gn(e);for(;Vt(t)&&!ar(t);){if(Xa(t))return t;if(vs(t))return null;t=gn(t)}return null}function Qa(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const rC=new Set(["html","body","#document"]);function ar(e){return rC.has(hr(e))}function Rt(e){return vt(e).getComputedStyle(e)}function ws(e){return zt(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function gn(e){if(hr(e)==="html")return e;const t=e.assignedSlot||e.parentNode||Vc(e)&&e.host||qt(e);return Vc(t)?t.host:t}function Lp(e){const t=gn(e);return ar(t)?e.ownerDocument?e.ownerDocument.body:e.body:Vt(t)&&Kr(t)?t:Lp(t)}function $r(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);const o=Lp(e),s=o===((r=e.ownerDocument)==null?void 0:r.body),i=vt(o);if(s){const l=Vi(i);return t.concat(i,i.visualViewport||[],Kr(o)?o:[],l&&n?$r(l):[])}return t.concat(o,$r(o,[],n))}function Vi(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function Dp(e){const t=Rt(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const o=Vt(e),s=o?e.offsetWidth:n,i=o?e.offsetHeight:r,l=Uo(n)!==s||Uo(r)!==i;return l&&(n=s,r=i),{width:n,height:r,$:l}}function el(e){return zt(e)?e:e.contextElement}function Xn(e){const t=el(e);if(!Vt(t))return Ut(1);const n=t.getBoundingClientRect(),{width:r,height:o,$:s}=Dp(t);let i=(s?Uo(n.width):n.width)/r,l=(s?Uo(n.height):n.height)/o;return(!i||!Number.isFinite(i))&&(i=1),(!l||!Number.isFinite(l))&&(l=1),{x:i,y:l}}const oC=Ut(0);function Fp(e){const t=vt(e);return!Qa()||!t.visualViewport?oC:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function sC(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==vt(e)?!1:t}function En(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const o=e.getBoundingClientRect(),s=el(e);let i=Ut(1);t&&(r?zt(r)&&(i=Xn(r)):i=Xn(e));const l=sC(s,n,r)?Fp(s):Ut(0);let c=(o.left+l.x)/i.x,u=(o.top+l.y)/i.y,d=o.width/i.x,f=o.height/i.y;if(s){const h=vt(s),p=r&&zt(r)?vt(r):r;let y=h,m=Vi(y);for(;m&&r&&p!==y;){const g=Xn(m),b=m.getBoundingClientRect(),v=Rt(m),k=b.left+(m.clientLeft+parseFloat(v.paddingLeft))*g.x,S=b.top+(m.clientTop+parseFloat(v.paddingTop))*g.y;c*=g.x,u*=g.y,d*=g.x,f*=g.y,c+=k,u+=S,y=vt(m),m=Vi(y)}}return Vo({width:d,height:f,x:c,y:u})}function ks(e,t){const n=ws(e).scrollLeft;return t?t.left+n:En(qt(e)).left+n}function $p(e,t){const n=e.getBoundingClientRect(),r=n.left+t.scrollLeft-ks(e,n),o=n.top+t.scrollTop;return{x:r,y:o}}function iC(e){let{elements:t,rect:n,offsetParent:r,strategy:o}=e;const s=o==="fixed",i=qt(r),l=t?vs(t.floating):!1;if(r===i||l&&s)return n;let c={scrollLeft:0,scrollTop:0},u=Ut(1);const d=Ut(0),f=Vt(r);if((f||!f&&!s)&&((hr(r)!=="body"||Kr(i))&&(c=ws(r)),Vt(r))){const p=En(r);u=Xn(r),d.x=p.x+r.clientLeft,d.y=p.y+r.clientTop}const h=i&&!f&&!s?$p(i,c):Ut(0);return{width:n.width*u.x,height:n.height*u.y,x:n.x*u.x-c.scrollLeft*u.x+d.x+h.x,y:n.y*u.y-c.scrollTop*u.y+d.y+h.y}}function aC(e){return Array.from(e.getClientRects())}function lC(e){const t=qt(e),n=ws(e),r=e.ownerDocument.body,o=bt(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),s=bt(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let i=-n.scrollLeft+ks(e);const l=-n.scrollTop;return Rt(r).direction==="rtl"&&(i+=bt(t.clientWidth,r.clientWidth)-o),{width:o,height:s,x:i,y:l}}const Hc=25;function cC(e,t){const n=vt(e),r=qt(e),o=n.visualViewport;let s=r.clientWidth,i=r.clientHeight,l=0,c=0;if(o){s=o.width,i=o.height;const d=Qa();(!d||d&&t==="fixed")&&(l=o.offsetLeft,c=o.offsetTop)}const u=ks(r);if(u<=0){const d=r.ownerDocument,f=d.body,h=getComputedStyle(f),p=d.compatMode==="CSS1Compat"&&parseFloat(h.marginLeft)+parseFloat(h.marginRight)||0,y=Math.abs(r.clientWidth-f.clientWidth-p);y<=Hc&&(s-=y)}else u<=Hc&&(s+=u);return{width:s,height:i,x:l,y:c}}const uC=new Set(["absolute","fixed"]);function dC(e,t){const n=En(e,!0,t==="fixed"),r=n.top+e.clientTop,o=n.left+e.clientLeft,s=Vt(e)?Xn(e):Ut(1),i=e.clientWidth*s.x,l=e.clientHeight*s.y,c=o*s.x,u=r*s.y;return{width:i,height:l,x:c,y:u}}function Zc(e,t,n){let r;if(t==="viewport")r=cC(e,n);else if(t==="document")r=lC(qt(e));else if(zt(t))r=dC(t,n);else{const o=Fp(e);r={x:t.x-o.x,y:t.y-o.y,width:t.width,height:t.height}}return Vo(r)}function Bp(e,t){const n=gn(e);return n===t||!zt(n)||ar(n)?!1:Rt(n).position==="fixed"||Bp(n,t)}function fC(e,t){const n=t.get(e);if(n)return n;let r=$r(e,[],!1).filter(l=>zt(l)&&hr(l)!=="body"),o=null;const s=Rt(e).position==="fixed";let i=s?gn(e):e;for(;zt(i)&&!ar(i);){const l=Rt(i),c=Xa(i);!c&&l.position==="fixed"&&(o=null),(s?!c&&!o:!c&&l.position==="static"&&!!o&&uC.has(o.position)||Kr(i)&&!c&&Bp(e,i))?r=r.filter(d=>d!==i):o=l,i=gn(i)}return t.set(e,r),r}function pC(e){let{element:t,boundary:n,rootBoundary:r,strategy:o}=e;const i=[...n==="clippingAncestors"?vs(t)?[]:fC(t,this._c):[].concat(n),r],l=i[0],c=i.reduce((u,d)=>{const f=Zc(t,d,o);return u.top=bt(f.top,u.top),u.right=mn(f.right,u.right),u.bottom=mn(f.bottom,u.bottom),u.left=bt(f.left,u.left),u},Zc(t,l,o));return{width:c.right-c.left,height:c.bottom-c.top,x:c.left,y:c.top}}function hC(e){const{width:t,height:n}=Dp(e);return{width:t,height:n}}function mC(e,t,n){const r=Vt(t),o=qt(t),s=n==="fixed",i=En(e,!0,s,t);let l={scrollLeft:0,scrollTop:0};const c=Ut(0);function u(){c.x=ks(o)}if(r||!r&&!s)if((hr(t)!=="body"||Kr(o))&&(l=ws(t)),r){const p=En(t,!0,s,t);c.x=p.x+t.clientLeft,c.y=p.y+t.clientTop}else o&&u();s&&!r&&o&&u();const d=o&&!r&&!s?$p(o,l):Ut(0),f=i.left+l.scrollLeft-c.x-d.x,h=i.top+l.scrollTop-c.y-d.y;return{x:f,y:h,width:i.width,height:i.height}}function ti(e){return Rt(e).position==="static"}function qc(e,t){if(!Vt(e)||Rt(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return qt(e)===n&&(n=n.ownerDocument.body),n}function Up(e,t){const n=vt(e);if(vs(e))return n;if(!Vt(e)){let o=gn(e);for(;o&&!ar(o);){if(zt(o)&&!ti(o))return o;o=gn(o)}return n}let r=qc(e,t);for(;r&&YS(r)&&ti(r);)r=qc(r,t);return r&&ar(r)&&ti(r)&&!Xa(r)?n:r||nC(e)||n}const gC=async function(e){const t=this.getOffsetParent||Up,n=this.getDimensions,r=await n(e.floating);return{reference:mC(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function xC(e){return Rt(e).direction==="rtl"}const bC={convertOffsetParentRelativeRectToViewportRelativeRect:iC,getDocumentElement:qt,getClippingRect:pC,getOffsetParent:Up,getElementRects:gC,getClientRects:aC,getDimensions:hC,getScale:Xn,isElement:zt,isRTL:xC};function Wp(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function yC(e,t){let n=null,r;const o=qt(e);function s(){var l;clearTimeout(r),(l=n)==null||l.disconnect(),n=null}function i(l,c){l===void 0&&(l=!1),c===void 0&&(c=1),s();const u=e.getBoundingClientRect(),{left:d,top:f,width:h,height:p}=u;if(l||t(),!h||!p)return;const y=go(f),m=go(o.clientWidth-(d+h)),g=go(o.clientHeight-(f+p)),b=go(d),k={rootMargin:-y+"px "+-m+"px "+-g+"px "+-b+"px",threshold:bt(0,mn(1,c))||1};let S=!0;function C(j){const E=j[0].intersectionRatio;if(E!==c){if(!S)return i();E?i(!1,E):r=setTimeout(()=>{i(!1,1e-7)},1e3)}E===1&&!Wp(u,e.getBoundingClientRect())&&i(),S=!1}try{n=new IntersectionObserver(C,{...k,root:o.ownerDocument})}catch{n=new IntersectionObserver(C,k)}n.observe(e)}return i(!0),s}function vC(e,t,n,r){r===void 0&&(r={});const{ancestorScroll:o=!0,ancestorResize:s=!0,elementResize:i=typeof ResizeObserver=="function",layoutShift:l=typeof IntersectionObserver=="function",animationFrame:c=!1}=r,u=el(e),d=o||s?[...u?$r(u):[],...$r(t)]:[];d.forEach(b=>{o&&b.addEventListener("scroll",n,{passive:!0}),s&&b.addEventListener("resize",n)});const f=u&&l?yC(u,n):null;let h=-1,p=null;i&&(p=new ResizeObserver(b=>{let[v]=b;v&&v.target===u&&p&&(p.unobserve(t),cancelAnimationFrame(h),h=requestAnimationFrame(()=>{var k;(k=p)==null||k.observe(t)})),n()}),u&&!c&&p.observe(u),p.observe(t));let y,m=c?En(e):null;c&&g();function g(){const b=En(e);m&&!Wp(m,b)&&n(),m=b,y=requestAnimationFrame(g)}return n(),()=>{var b;d.forEach(v=>{o&&v.removeEventListener("scroll",n),s&&v.removeEventListener("resize",n)}),f?.(),(b=p)==null||b.disconnect(),p=null,c&&cancelAnimationFrame(y)}}const wC=HS,kC=ZS,_C=US,SC=KS,CC=WS,Kc=BS,jC=qS,NC=(e,t,n)=>{const r=new Map,o={platform:bC,...n},s={...o.platform,_c:r};return $S(e,t,{...o,platform:s})};var EC=typeof document<"u",TC=function(){},Eo=EC?x.useLayoutEffect:TC;function Ho(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(!Ho(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 s=o[r];if(!(s==="_owner"&&e.$$typeof)&&!Ho(e[s],t[s]))return!1}return!0}return e!==e&&t!==t}function Vp(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function Gc(e,t){const n=Vp(e);return Math.round(t*n)/n}function ni(e){const t=x.useRef(e);return Eo(()=>{t.current=e}),t}function AC(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:r=[],platform:o,elements:{reference:s,floating:i}={},transform:l=!0,whileElementsMounted:c,open:u}=e,[d,f]=x.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[h,p]=x.useState(r);Ho(h,r)||p(r);const[y,m]=x.useState(null),[g,b]=x.useState(null),v=x.useCallback(F=>{F!==j.current&&(j.current=F,m(F))},[]),k=x.useCallback(F=>{F!==E.current&&(E.current=F,b(F))},[]),S=s||y,C=i||g,j=x.useRef(null),E=x.useRef(null),T=x.useRef(d),z=c!=null,O=ni(c),B=ni(o),N=ni(u),D=x.useCallback(()=>{if(!j.current||!E.current)return;const F={placement:t,strategy:n,middleware:h};B.current&&(F.platform=B.current),NC(j.current,E.current,F).then(K=>{const I={...K,isPositioned:N.current!==!1};w.current&&!Ho(T.current,I)&&(T.current=I,Zr.flushSync(()=>{f(I)}))})},[h,t,n,B,N]);Eo(()=>{u===!1&&T.current.isPositioned&&(T.current.isPositioned=!1,f(F=>({...F,isPositioned:!1})))},[u]);const w=x.useRef(!1);Eo(()=>(w.current=!0,()=>{w.current=!1}),[]),Eo(()=>{if(S&&(j.current=S),C&&(E.current=C),S&&C){if(O.current)return O.current(S,C,D);D()}},[S,C,D,O,z]);const L=x.useMemo(()=>({reference:j,floating:E,setReference:v,setFloating:k}),[v,k]),W=x.useMemo(()=>({reference:S,floating:C}),[S,C]),U=x.useMemo(()=>{const F={position:n,left:0,top:0};if(!W.floating)return F;const K=Gc(W.floating,d.x),I=Gc(W.floating,d.y);return l?{...F,transform:"translate("+K+"px, "+I+"px)",...Vp(W.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:K,top:I}},[n,l,W.floating,d.x,d.y]);return x.useMemo(()=>({...d,update:D,refs:L,elements:W,floatingStyles:U}),[d,D,L,W,U])}const IC=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?Kc({element:r.current,padding:o}).fn(n):{}:r?Kc({element:r,padding:o}).fn(n):{}}}},zC=(e,t)=>({...wC(e),options:[e,t]}),RC=(e,t)=>({...kC(e),options:[e,t]}),PC=(e,t)=>({...jC(e),options:[e,t]}),OC=(e,t)=>({..._C(e),options:[e,t]}),MC=(e,t)=>({...SC(e),options:[e,t]}),LC=(e,t)=>({...CC(e),options:[e,t]}),DC=(e,t)=>({...IC(e),options:[e,t]});var FC="Arrow",Hp=x.forwardRef((e,t)=>{const{children:n,width:r=10,height:o=5,...s}=e;return a.jsx(Te.svg,{...s,ref:t,width:r,height:o,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?n:a.jsx("polygon",{points:"0,0 30,0 15,10"})})});Hp.displayName=FC;var $C=Hp,tl="Popper",[Zp,_s]=sn(tl),[BC,qp]=Zp(tl),Kp=e=>{const{__scopePopper:t,children:n}=e,[r,o]=x.useState(null);return a.jsx(BC,{scope:t,anchor:r,onAnchorChange:o,children:n})};Kp.displayName=tl;var Gp="PopperAnchor",Jp=x.forwardRef((e,t)=>{const{__scopePopper:n,virtualRef:r,...o}=e,s=qp(Gp,n),i=x.useRef(null),l=De(t,i),c=x.useRef(null);return x.useEffect(()=>{const u=c.current;c.current=r?.current||i.current,u!==c.current&&s.onAnchorChange(c.current)}),r?null:a.jsx(Te.div,{...o,ref:l})});Jp.displayName=Gp;var nl="PopperContent",[UC,WC]=Zp(nl),Yp=x.forwardRef((e,t)=>{const{__scopePopper:n,side:r="bottom",sideOffset:o=0,align:s="center",alignOffset:i=0,arrowPadding:l=0,avoidCollisions:c=!0,collisionBoundary:u=[],collisionPadding:d=0,sticky:f="partial",hideWhenDetached:h=!1,updatePositionStrategy:p="optimized",onPlaced:y,...m}=e,g=qp(nl,n),[b,v]=x.useState(null),k=De(t,le=>v(le)),[S,C]=x.useState(null),j=NS(S),E=j?.width??0,T=j?.height??0,z=r+(s!=="center"?"-"+s:""),O=typeof d=="number"?d:{top:0,right:0,bottom:0,left:0,...d},B=Array.isArray(u)?u:[u],N=B.length>0,D={padding:O,boundary:B.filter(HC),altBoundary:N},{refs:w,floatingStyles:L,placement:W,isPositioned:U,middlewareData:F}=AC({strategy:"fixed",placement:z,whileElementsMounted:(...le)=>vC(...le,{animationFrame:p==="always"}),elements:{reference:g.anchor},middleware:[zC({mainAxis:o+T,alignmentAxis:i}),c&&RC({mainAxis:!0,crossAxis:!1,limiter:f==="partial"?PC():void 0,...D}),c&&OC({...D}),MC({...D,apply:({elements:le,rects:de,availableWidth:pe,availableHeight:he})=>{const{width:me,height:_e}=de.reference,Pe=le.floating.style;Pe.setProperty("--radix-popper-available-width",`${pe}px`),Pe.setProperty("--radix-popper-available-height",`${he}px`),Pe.setProperty("--radix-popper-anchor-width",`${me}px`),Pe.setProperty("--radix-popper-anchor-height",`${_e}px`)}}),S&&DC({element:S,padding:l}),ZC({arrowWidth:E,arrowHeight:T}),h&&LC({strategy:"referenceHidden",...D})]}),[K,I]=eh(W),H=lt(y);ot(()=>{U&&H?.()},[U,H]);const G=F.arrow?.x,R=F.arrow?.y,ae=F.arrow?.centerOffset!==0,[re,fe]=x.useState();return ot(()=>{b&&fe(window.getComputedStyle(b).zIndex)},[b]),a.jsx("div",{ref:w.setFloating,"data-radix-popper-content-wrapper":"",style:{...L,transform:U?L.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:re,"--radix-popper-transform-origin":[F.transformOrigin?.x,F.transformOrigin?.y].join(" "),...F.hide?.referenceHidden&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:a.jsx(UC,{scope:n,placedSide:K,onArrowChange:C,arrowX:G,arrowY:R,shouldHideArrow:ae,children:a.jsx(Te.div,{"data-side":K,"data-align":I,...m,ref:k,style:{...m.style,animation:U?void 0:"none"}})})})});Yp.displayName=nl;var Xp="PopperArrow",VC={top:"bottom",right:"left",bottom:"top",left:"right"},Qp=x.forwardRef(function(t,n){const{__scopePopper:r,...o}=t,s=WC(Xp,r),i=VC[s.placedSide];return a.jsx("span",{ref:s.onArrowChange,style:{position:"absolute",left:s.arrowX,top:s.arrowY,[i]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[s.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[s.placedSide],visibility:s.shouldHideArrow?"hidden":void 0},children:a.jsx($C,{...o,ref:n,style:{...o.style,display:"block"}})})});Qp.displayName=Xp;function HC(e){return e!==null}var ZC=e=>({name:"transformOrigin",options:e,fn(t){const{placement:n,rects:r,middlewareData:o}=t,i=o.arrow?.centerOffset!==0,l=i?0:e.arrowWidth,c=i?0:e.arrowHeight,[u,d]=eh(n),f={start:"0%",center:"50%",end:"100%"}[d],h=(o.arrow?.x??0)+l/2,p=(o.arrow?.y??0)+c/2;let y="",m="";return u==="bottom"?(y=i?f:`${h}px`,m=`${-c}px`):u==="top"?(y=i?f:`${h}px`,m=`${r.floating.height+c}px`):u==="right"?(y=`${-c}px`,m=i?f:`${p}px`):u==="left"&&(y=`${r.floating.width+c}px`,m=i?f:`${p}px`),{data:{x:y,y:m}}}});function eh(e){const[t,n="center"]=e.split("-");return[t,n]}var th=Kp,nh=Jp,rh=Yp,oh=Qp,ri="rovingFocusGroup.onEntryFocus",qC={bubbles:!1,cancelable:!0},Gr="RovingFocusGroup",[Hi,sh,KC]=tp(Gr),[GC,ih]=sn(Gr,[KC]),[JC,YC]=GC(Gr),ah=x.forwardRef((e,t)=>a.jsx(Hi.Provider,{scope:e.__scopeRovingFocusGroup,children:a.jsx(Hi.Slot,{scope:e.__scopeRovingFocusGroup,children:a.jsx(XC,{...e,ref:t})})}));ah.displayName=Gr;var XC=x.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,orientation:r,loop:o=!1,dir:s,currentTabStopId:i,defaultCurrentTabStopId:l,onCurrentTabStopIdChange:c,onEntryFocus:u,preventScrollOnEntryFocus:d=!1,...f}=e,h=x.useRef(null),p=De(t,h),y=hs(s),[m,g]=jn({prop:i,defaultProp:l??null,onChange:c,caller:Gr}),[b,v]=x.useState(!1),k=lt(u),S=sh(n),C=x.useRef(!1),[j,E]=x.useState(0);return x.useEffect(()=>{const T=h.current;if(T)return T.addEventListener(ri,k),()=>T.removeEventListener(ri,k)},[k]),a.jsx(JC,{scope:n,orientation:r,dir:y,loop:o,currentTabStopId:m,onItemFocus:x.useCallback(T=>g(T),[g]),onItemShiftTab:x.useCallback(()=>v(!0),[]),onFocusableItemAdd:x.useCallback(()=>E(T=>T+1),[]),onFocusableItemRemove:x.useCallback(()=>E(T=>T-1),[]),children:a.jsx(Te.div,{tabIndex:b||j===0?-1:0,"data-orientation":r,...f,ref:p,style:{outline:"none",...e.style},onMouseDown:Se(e.onMouseDown,()=>{C.current=!0}),onFocus:Se(e.onFocus,T=>{const z=!C.current;if(T.target===T.currentTarget&&z&&!b){const O=new CustomEvent(ri,qC);if(T.currentTarget.dispatchEvent(O),!O.defaultPrevented){const B=S().filter(W=>W.focusable),N=B.find(W=>W.active),D=B.find(W=>W.id===m),L=[N,D,...B].filter(Boolean).map(W=>W.ref.current);uh(L,d)}}C.current=!1}),onBlur:Se(e.onBlur,()=>v(!1))})})}),lh="RovingFocusGroupItem",ch=x.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,focusable:r=!0,active:o=!1,tabStopId:s,children:i,...l}=e,c=Bt(),u=s||c,d=YC(lh,n),f=d.currentTabStopId===u,h=sh(n),{onFocusableItemAdd:p,onFocusableItemRemove:y,currentTabStopId:m}=d;return x.useEffect(()=>{if(r)return p(),()=>y()},[r,p,y]),a.jsx(Hi.ItemSlot,{scope:n,id:u,focusable:r,active:o,children:a.jsx(Te.span,{tabIndex:f?0:-1,"data-orientation":d.orientation,...l,ref:t,onMouseDown:Se(e.onMouseDown,g=>{r?d.onItemFocus(u):g.preventDefault()}),onFocus:Se(e.onFocus,()=>d.onItemFocus(u)),onKeyDown:Se(e.onKeyDown,g=>{if(g.key==="Tab"&&g.shiftKey){d.onItemShiftTab();return}if(g.target!==g.currentTarget)return;const b=tj(g,d.orientation,d.dir);if(b!==void 0){if(g.metaKey||g.ctrlKey||g.altKey||g.shiftKey)return;g.preventDefault();let k=h().filter(S=>S.focusable).map(S=>S.ref.current);if(b==="last")k.reverse();else if(b==="prev"||b==="next"){b==="prev"&&k.reverse();const S=k.indexOf(g.currentTarget);k=d.loop?nj(k,S+1):k.slice(S+1)}setTimeout(()=>uh(k))}}),children:typeof i=="function"?i({isCurrentTabStop:f,hasTabStop:m!=null}):i})})});ch.displayName=lh;var QC={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function ej(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function tj(e,t,n){const r=ej(e.key,n);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(r))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(r)))return QC[r]}function uh(e,t=!1){const n=document.activeElement;for(const r of e)if(r===n||(r.focus({preventScroll:t}),document.activeElement!==n))return}function nj(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var rj=ah,oj=ch;function Zi(e,[t,n]){return Math.min(n,Math.max(t,e))}function sj(e,t){return x.useReducer((n,r)=>t[n][r]??n,e)}var rl="ScrollArea",[dh]=sn(rl),[ij,Ct]=dh(rl),fh=x.forwardRef((e,t)=>{const{__scopeScrollArea:n,type:r="hover",dir:o,scrollHideDelay:s=600,...i}=e,[l,c]=x.useState(null),[u,d]=x.useState(null),[f,h]=x.useState(null),[p,y]=x.useState(null),[m,g]=x.useState(null),[b,v]=x.useState(0),[k,S]=x.useState(0),[C,j]=x.useState(!1),[E,T]=x.useState(!1),z=De(t,B=>c(B)),O=hs(o);return a.jsx(ij,{scope:n,type:r,dir:O,scrollHideDelay:s,scrollArea:l,viewport:u,onViewportChange:d,content:f,onContentChange:h,scrollbarX:p,onScrollbarXChange:y,scrollbarXEnabled:C,onScrollbarXEnabledChange:j,scrollbarY:m,onScrollbarYChange:g,scrollbarYEnabled:E,onScrollbarYEnabledChange:T,onCornerWidthChange:v,onCornerHeightChange:S,children:a.jsx(Te.div,{dir:O,...i,ref:z,style:{position:"relative","--radix-scroll-area-corner-width":b+"px","--radix-scroll-area-corner-height":k+"px",...e.style}})})});fh.displayName=rl;var ph="ScrollAreaViewport",hh=x.forwardRef((e,t)=>{const{__scopeScrollArea:n,children:r,nonce:o,...s}=e,i=Ct(ph,n),l=x.useRef(null),c=De(t,l,i.onViewportChange);return a.jsxs(a.Fragment,{children:[a.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}),a.jsx(Te.div,{"data-radix-scroll-area-viewport":"",...s,ref:c,style:{overflowX:i.scrollbarXEnabled?"scroll":"hidden",overflowY:i.scrollbarYEnabled?"scroll":"hidden",...e.style},children:a.jsx("div",{ref:i.onContentChange,style:{minWidth:"100%",display:"table"},children:r})})]})});hh.displayName=ph;var Kt="ScrollAreaScrollbar",mh=x.forwardRef((e,t)=>{const{forceMount:n,...r}=e,o=Ct(Kt,e.__scopeScrollArea),{onScrollbarXEnabledChange:s,onScrollbarYEnabledChange:i}=o,l=e.orientation==="horizontal";return x.useEffect(()=>(l?s(!0):i(!0),()=>{l?s(!1):i(!1)}),[l,s,i]),o.type==="hover"?a.jsx(aj,{...r,ref:t,forceMount:n}):o.type==="scroll"?a.jsx(lj,{...r,ref:t,forceMount:n}):o.type==="auto"?a.jsx(gh,{...r,ref:t,forceMount:n}):o.type==="always"?a.jsx(ol,{...r,ref:t}):null});mh.displayName=Kt;var aj=x.forwardRef((e,t)=>{const{forceMount:n,...r}=e,o=Ct(Kt,e.__scopeScrollArea),[s,i]=x.useState(!1);return x.useEffect(()=>{const l=o.scrollArea;let c=0;if(l){const u=()=>{window.clearTimeout(c),i(!0)},d=()=>{c=window.setTimeout(()=>i(!1),o.scrollHideDelay)};return l.addEventListener("pointerenter",u),l.addEventListener("pointerleave",d),()=>{window.clearTimeout(c),l.removeEventListener("pointerenter",u),l.removeEventListener("pointerleave",d)}}},[o.scrollArea,o.scrollHideDelay]),a.jsx(St,{present:n||s,children:a.jsx(gh,{"data-state":s?"visible":"hidden",...r,ref:t})})}),lj=x.forwardRef((e,t)=>{const{forceMount:n,...r}=e,o=Ct(Kt,e.__scopeScrollArea),s=e.orientation==="horizontal",i=Cs(()=>c("SCROLL_END"),100),[l,c]=sj("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 x.useEffect(()=>{if(l==="idle"){const u=window.setTimeout(()=>c("HIDE"),o.scrollHideDelay);return()=>window.clearTimeout(u)}},[l,o.scrollHideDelay,c]),x.useEffect(()=>{const u=o.viewport,d=s?"scrollLeft":"scrollTop";if(u){let f=u[d];const h=()=>{const p=u[d];f!==p&&(c("SCROLL"),i()),f=p};return u.addEventListener("scroll",h),()=>u.removeEventListener("scroll",h)}},[o.viewport,s,c,i]),a.jsx(St,{present:n||l!=="hidden",children:a.jsx(ol,{"data-state":l==="hidden"?"hidden":"visible",...r,ref:t,onPointerEnter:Se(e.onPointerEnter,()=>c("POINTER_ENTER")),onPointerLeave:Se(e.onPointerLeave,()=>c("POINTER_LEAVE"))})})}),gh=x.forwardRef((e,t)=>{const n=Ct(Kt,e.__scopeScrollArea),{forceMount:r,...o}=e,[s,i]=x.useState(!1),l=e.orientation==="horizontal",c=Cs(()=>{if(n.viewport){const u=n.viewport.offsetWidth<n.viewport.scrollWidth,d=n.viewport.offsetHeight<n.viewport.scrollHeight;i(l?u:d)}},10);return lr(n.viewport,c),lr(n.content,c),a.jsx(St,{present:r||s,children:a.jsx(ol,{"data-state":s?"visible":"hidden",...o,ref:t})})}),ol=x.forwardRef((e,t)=>{const{orientation:n="vertical",...r}=e,o=Ct(Kt,e.__scopeScrollArea),s=x.useRef(null),i=x.useRef(0),[l,c]=x.useState({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),u=wh(l.viewport,l.content),d={...r,sizes:l,onSizesChange:c,hasThumb:u>0&&u<1,onThumbChange:h=>s.current=h,onThumbPointerUp:()=>i.current=0,onThumbPointerDown:h=>i.current=h};function f(h,p){return hj(h,i.current,l,p)}return n==="horizontal"?a.jsx(cj,{...d,ref:t,onThumbPositionChange:()=>{if(o.viewport&&s.current){const h=o.viewport.scrollLeft,p=Jc(h,l,o.dir);s.current.style.transform=`translate3d(${p}px, 0, 0)`}},onWheelScroll:h=>{o.viewport&&(o.viewport.scrollLeft=h)},onDragScroll:h=>{o.viewport&&(o.viewport.scrollLeft=f(h,o.dir))}}):n==="vertical"?a.jsx(uj,{...d,ref:t,onThumbPositionChange:()=>{if(o.viewport&&s.current){const h=o.viewport.scrollTop,p=Jc(h,l);s.current.style.transform=`translate3d(0, ${p}px, 0)`}},onWheelScroll:h=>{o.viewport&&(o.viewport.scrollTop=h)},onDragScroll:h=>{o.viewport&&(o.viewport.scrollTop=f(h))}}):null}),cj=x.forwardRef((e,t)=>{const{sizes:n,onSizesChange:r,...o}=e,s=Ct(Kt,e.__scopeScrollArea),[i,l]=x.useState(),c=x.useRef(null),u=De(t,c,s.onScrollbarXChange);return x.useEffect(()=>{c.current&&l(getComputedStyle(c.current))},[c]),a.jsx(bh,{"data-orientation":"horizontal",...o,ref:u,sizes:n,style:{bottom:0,left:s.dir==="rtl"?"var(--radix-scroll-area-corner-width)":0,right:s.dir==="ltr"?"var(--radix-scroll-area-corner-width)":0,"--radix-scroll-area-thumb-width":Ss(n)+"px",...e.style},onThumbPointerDown:d=>e.onThumbPointerDown(d.x),onDragScroll:d=>e.onDragScroll(d.x),onWheelScroll:(d,f)=>{if(s.viewport){const h=s.viewport.scrollLeft+d.deltaX;e.onWheelScroll(h),_h(h,f)&&d.preventDefault()}},onResize:()=>{c.current&&s.viewport&&i&&r({content:s.viewport.scrollWidth,viewport:s.viewport.offsetWidth,scrollbar:{size:c.current.clientWidth,paddingStart:qo(i.paddingLeft),paddingEnd:qo(i.paddingRight)}})}})}),uj=x.forwardRef((e,t)=>{const{sizes:n,onSizesChange:r,...o}=e,s=Ct(Kt,e.__scopeScrollArea),[i,l]=x.useState(),c=x.useRef(null),u=De(t,c,s.onScrollbarYChange);return x.useEffect(()=>{c.current&&l(getComputedStyle(c.current))},[c]),a.jsx(bh,{"data-orientation":"vertical",...o,ref:u,sizes:n,style:{top:0,right:s.dir==="ltr"?0:void 0,left:s.dir==="rtl"?0:void 0,bottom:"var(--radix-scroll-area-corner-height)","--radix-scroll-area-thumb-height":Ss(n)+"px",...e.style},onThumbPointerDown:d=>e.onThumbPointerDown(d.y),onDragScroll:d=>e.onDragScroll(d.y),onWheelScroll:(d,f)=>{if(s.viewport){const h=s.viewport.scrollTop+d.deltaY;e.onWheelScroll(h),_h(h,f)&&d.preventDefault()}},onResize:()=>{c.current&&s.viewport&&i&&r({content:s.viewport.scrollHeight,viewport:s.viewport.offsetHeight,scrollbar:{size:c.current.clientHeight,paddingStart:qo(i.paddingTop),paddingEnd:qo(i.paddingBottom)}})}})}),[dj,xh]=dh(Kt),bh=x.forwardRef((e,t)=>{const{__scopeScrollArea:n,sizes:r,hasThumb:o,onThumbChange:s,onThumbPointerUp:i,onThumbPointerDown:l,onThumbPositionChange:c,onDragScroll:u,onWheelScroll:d,onResize:f,...h}=e,p=Ct(Kt,n),[y,m]=x.useState(null),g=De(t,z=>m(z)),b=x.useRef(null),v=x.useRef(""),k=p.viewport,S=r.content-r.viewport,C=lt(d),j=lt(c),E=Cs(f,10);function T(z){if(b.current){const O=z.clientX-b.current.left,B=z.clientY-b.current.top;u({x:O,y:B})}}return x.useEffect(()=>{const z=O=>{const B=O.target;y?.contains(B)&&C(O,S)};return document.addEventListener("wheel",z,{passive:!1}),()=>document.removeEventListener("wheel",z,{passive:!1})},[k,y,S,C]),x.useEffect(j,[r,j]),lr(y,E),lr(p.content,E),a.jsx(dj,{scope:n,scrollbar:y,hasThumb:o,onThumbChange:lt(s),onThumbPointerUp:lt(i),onThumbPositionChange:j,onThumbPointerDown:lt(l),children:a.jsx(Te.div,{...h,ref:g,style:{position:"absolute",...h.style},onPointerDown:Se(e.onPointerDown,z=>{z.button===0&&(z.target.setPointerCapture(z.pointerId),b.current=y.getBoundingClientRect(),v.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect="none",p.viewport&&(p.viewport.style.scrollBehavior="auto"),T(z))}),onPointerMove:Se(e.onPointerMove,T),onPointerUp:Se(e.onPointerUp,z=>{const O=z.target;O.hasPointerCapture(z.pointerId)&&O.releasePointerCapture(z.pointerId),document.body.style.webkitUserSelect=v.current,p.viewport&&(p.viewport.style.scrollBehavior=""),b.current=null})})})}),Zo="ScrollAreaThumb",yh=x.forwardRef((e,t)=>{const{forceMount:n,...r}=e,o=xh(Zo,e.__scopeScrollArea);return a.jsx(St,{present:n||o.hasThumb,children:a.jsx(fj,{ref:t,...r})})}),fj=x.forwardRef((e,t)=>{const{__scopeScrollArea:n,style:r,...o}=e,s=Ct(Zo,n),i=xh(Zo,n),{onThumbPositionChange:l}=i,c=De(t,f=>i.onThumbChange(f)),u=x.useRef(void 0),d=Cs(()=>{u.current&&(u.current(),u.current=void 0)},100);return x.useEffect(()=>{const f=s.viewport;if(f){const h=()=>{if(d(),!u.current){const p=mj(f,l);u.current=p,l()}};return l(),f.addEventListener("scroll",h),()=>f.removeEventListener("scroll",h)}},[s.viewport,d,l]),a.jsx(Te.div,{"data-state":i.hasThumb?"visible":"hidden",...o,ref:c,style:{width:"var(--radix-scroll-area-thumb-width)",height:"var(--radix-scroll-area-thumb-height)",...r},onPointerDownCapture:Se(e.onPointerDownCapture,f=>{const p=f.target.getBoundingClientRect(),y=f.clientX-p.left,m=f.clientY-p.top;i.onThumbPointerDown({x:y,y:m})}),onPointerUp:Se(e.onPointerUp,i.onThumbPointerUp)})});yh.displayName=Zo;var sl="ScrollAreaCorner",vh=x.forwardRef((e,t)=>{const n=Ct(sl,e.__scopeScrollArea),r=!!(n.scrollbarX&&n.scrollbarY);return n.type!=="scroll"&&r?a.jsx(pj,{...e,ref:t}):null});vh.displayName=sl;var pj=x.forwardRef((e,t)=>{const{__scopeScrollArea:n,...r}=e,o=Ct(sl,n),[s,i]=x.useState(0),[l,c]=x.useState(0),u=!!(s&&l);return lr(o.scrollbarX,()=>{const d=o.scrollbarX?.offsetHeight||0;o.onCornerHeightChange(d),c(d)}),lr(o.scrollbarY,()=>{const d=o.scrollbarY?.offsetWidth||0;o.onCornerWidthChange(d),i(d)}),u?a.jsx(Te.div,{...r,ref:t,style:{width:s,height:l,position:"absolute",right:o.dir==="ltr"?0:void 0,left:o.dir==="rtl"?0:void 0,bottom:0,...e.style}}):null});function qo(e){return e?parseInt(e,10):0}function wh(e,t){const n=e/t;return isNaN(n)?0:n}function Ss(e){const t=wh(e.viewport,e.content),n=e.scrollbar.paddingStart+e.scrollbar.paddingEnd,r=(e.scrollbar.size-n)*t;return Math.max(r,18)}function hj(e,t,n,r="ltr"){const o=Ss(n),s=o/2,i=t||s,l=o-i,c=n.scrollbar.paddingStart+i,u=n.scrollbar.size-n.scrollbar.paddingEnd-l,d=n.content-n.viewport,f=r==="ltr"?[0,d]:[d*-1,0];return kh([c,u],f)(e)}function Jc(e,t,n="ltr"){const r=Ss(t),o=t.scrollbar.paddingStart+t.scrollbar.paddingEnd,s=t.scrollbar.size-o,i=t.content-t.viewport,l=s-r,c=n==="ltr"?[0,i]:[i*-1,0],u=Zi(e,c);return kh([0,i],[0,l])(u)}function kh(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 _h(e,t){return e>0&&e<t}var mj=(e,t=()=>{})=>{let n={left:e.scrollLeft,top:e.scrollTop},r=0;return(function o(){const s={left:e.scrollLeft,top:e.scrollTop},i=n.left!==s.left,l=n.top!==s.top;(i||l)&&t(),n=s,r=window.requestAnimationFrame(o)})(),()=>window.cancelAnimationFrame(r)};function Cs(e,t){const n=lt(e),r=x.useRef(0);return x.useEffect(()=>()=>window.clearTimeout(r.current),[]),x.useCallback(()=>{window.clearTimeout(r.current),r.current=window.setTimeout(n,t)},[n,t])}function lr(e,t){const n=lt(t);ot(()=>{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 gj=fh,xj=hh,bj=vh,yj=[" ","Enter","ArrowUp","ArrowDown"],vj=[" ","Enter"],Tn="Select",[js,Ns,wj]=tp(Tn),[mr]=sn(Tn,[wj,_s]),Es=_s(),[kj,yn]=mr(Tn),[_j,Sj]=mr(Tn),Sh=e=>{const{__scopeSelect:t,children:n,open:r,defaultOpen:o,onOpenChange:s,value:i,defaultValue:l,onValueChange:c,dir:u,name:d,autoComplete:f,disabled:h,required:p,form:y}=e,m=Es(t),[g,b]=x.useState(null),[v,k]=x.useState(null),[S,C]=x.useState(!1),j=hs(u),[E,T]=jn({prop:r,defaultProp:o??!1,onChange:s,caller:Tn}),[z,O]=jn({prop:i,defaultProp:l,onChange:c,caller:Tn}),B=x.useRef(null),N=g?y||!!g.closest("form"):!0,[D,w]=x.useState(new Set),L=Array.from(D).map(W=>W.props.value).join(";");return a.jsx(th,{...m,children:a.jsxs(kj,{required:p,scope:t,trigger:g,onTriggerChange:b,valueNode:v,onValueNodeChange:k,valueNodeHasChildren:S,onValueNodeHasChildrenChange:C,contentId:Bt(),value:z,onValueChange:O,open:E,onOpenChange:T,dir:j,triggerPointerDownPosRef:B,disabled:h,children:[a.jsx(js.Provider,{scope:t,children:a.jsx(_j,{scope:e.__scopeSelect,onNativeOptionAdd:x.useCallback(W=>{w(U=>new Set(U).add(W))},[]),onNativeOptionRemove:x.useCallback(W=>{w(U=>{const F=new Set(U);return F.delete(W),F})},[]),children:n})}),N?a.jsxs(Zh,{"aria-hidden":!0,required:p,tabIndex:-1,name:d,autoComplete:f,value:z,onChange:W=>O(W.target.value),disabled:h,form:y,children:[z===void 0?a.jsx("option",{value:""}):null,Array.from(D)]},L):null]})})};Sh.displayName=Tn;var Ch="SelectTrigger",jh=x.forwardRef((e,t)=>{const{__scopeSelect:n,disabled:r=!1,...o}=e,s=Es(n),i=yn(Ch,n),l=i.disabled||r,c=De(t,i.onTriggerChange),u=Ns(n),d=x.useRef("touch"),[f,h,p]=Kh(m=>{const g=u().filter(k=>!k.disabled),b=g.find(k=>k.value===i.value),v=Gh(g,m,b);v!==void 0&&i.onValueChange(v.value)}),y=m=>{l||(i.onOpenChange(!0),p()),m&&(i.triggerPointerDownPosRef.current={x:Math.round(m.pageX),y:Math.round(m.pageY)})};return a.jsx(nh,{asChild:!0,...s,children:a.jsx(Te.button,{type:"button",role:"combobox","aria-controls":i.contentId,"aria-expanded":i.open,"aria-required":i.required,"aria-autocomplete":"none",dir:i.dir,"data-state":i.open?"open":"closed",disabled:l,"data-disabled":l?"":void 0,"data-placeholder":qh(i.value)?"":void 0,...o,ref:c,onClick:Se(o.onClick,m=>{m.currentTarget.focus(),d.current!=="mouse"&&y(m)}),onPointerDown:Se(o.onPointerDown,m=>{d.current=m.pointerType;const g=m.target;g.hasPointerCapture(m.pointerId)&&g.releasePointerCapture(m.pointerId),m.button===0&&m.ctrlKey===!1&&m.pointerType==="mouse"&&(y(m),m.preventDefault())}),onKeyDown:Se(o.onKeyDown,m=>{const g=f.current!=="";!(m.ctrlKey||m.altKey||m.metaKey)&&m.key.length===1&&h(m.key),!(g&&m.key===" ")&&yj.includes(m.key)&&(y(),m.preventDefault())})})})});jh.displayName=Ch;var Nh="SelectValue",Eh=x.forwardRef((e,t)=>{const{__scopeSelect:n,className:r,style:o,children:s,placeholder:i="",...l}=e,c=yn(Nh,n),{onValueNodeHasChildrenChange:u}=c,d=s!==void 0,f=De(t,c.onValueNodeChange);return ot(()=>{u(d)},[u,d]),a.jsx(Te.span,{...l,ref:f,style:{pointerEvents:"none"},children:qh(c.value)?a.jsx(a.Fragment,{children:i}):s})});Eh.displayName=Nh;var Cj="SelectIcon",Th=x.forwardRef((e,t)=>{const{__scopeSelect:n,children:r,...o}=e;return a.jsx(Te.span,{"aria-hidden":!0,...o,ref:t,children:r||"▼"})});Th.displayName=Cj;var jj="SelectPortal",Ah=e=>a.jsx(gs,{asChild:!0,...e});Ah.displayName=jj;var An="SelectContent",Ih=x.forwardRef((e,t)=>{const n=yn(An,e.__scopeSelect),[r,o]=x.useState();if(ot(()=>{o(new DocumentFragment)},[]),!n.open){const s=r;return s?Zr.createPortal(a.jsx(zh,{scope:e.__scopeSelect,children:a.jsx(js.Slot,{scope:e.__scopeSelect,children:a.jsx("div",{children:e.children})})}),s):null}return a.jsx(Rh,{...e,ref:t})});Ih.displayName=An;var Et=10,[zh,vn]=mr(An),Nj="SelectContentImpl",Ej=ir("SelectContent.RemoveScroll"),Rh=x.forwardRef((e,t)=>{const{__scopeSelect:n,position:r="item-aligned",onCloseAutoFocus:o,onEscapeKeyDown:s,onPointerDownOutside:i,side:l,sideOffset:c,align:u,alignOffset:d,arrowPadding:f,collisionBoundary:h,collisionPadding:p,sticky:y,hideWhenDetached:m,avoidCollisions:g,...b}=e,v=yn(An,n),[k,S]=x.useState(null),[C,j]=x.useState(null),E=De(t,le=>S(le)),[T,z]=x.useState(null),[O,B]=x.useState(null),N=Ns(n),[D,w]=x.useState(!1),L=x.useRef(!1);x.useEffect(()=>{if(k)return bp(k)},[k]),cp();const W=x.useCallback(le=>{const[de,...pe]=N().map(_e=>_e.ref.current),[he]=pe.slice(-1),me=document.activeElement;for(const _e of le)if(_e===me||(_e?.scrollIntoView({block:"nearest"}),_e===de&&C&&(C.scrollTop=0),_e===he&&C&&(C.scrollTop=C.scrollHeight),_e?.focus(),document.activeElement!==me))return},[N,C]),U=x.useCallback(()=>W([T,k]),[W,T,k]);x.useEffect(()=>{D&&U()},[D,U]);const{onOpenChange:F,triggerPointerDownPosRef:K}=v;x.useEffect(()=>{if(k){let le={x:0,y:0};const de=he=>{le={x:Math.abs(Math.round(he.pageX)-(K.current?.x??0)),y:Math.abs(Math.round(he.pageY)-(K.current?.y??0))}},pe=he=>{le.x<=10&&le.y<=10?he.preventDefault():k.contains(he.target)||F(!1),document.removeEventListener("pointermove",de),K.current=null};return K.current!==null&&(document.addEventListener("pointermove",de),document.addEventListener("pointerup",pe,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",de),document.removeEventListener("pointerup",pe,{capture:!0})}}},[k,F,K]),x.useEffect(()=>{const le=()=>F(!1);return window.addEventListener("blur",le),window.addEventListener("resize",le),()=>{window.removeEventListener("blur",le),window.removeEventListener("resize",le)}},[F]);const[I,H]=Kh(le=>{const de=N().filter(me=>!me.disabled),pe=de.find(me=>me.ref.current===document.activeElement),he=Gh(de,le,pe);he&&setTimeout(()=>he.ref.current.focus())}),G=x.useCallback((le,de,pe)=>{const he=!L.current&&!pe;(v.value!==void 0&&v.value===de||he)&&(z(le),he&&(L.current=!0))},[v.value]),R=x.useCallback(()=>k?.focus(),[k]),ae=x.useCallback((le,de,pe)=>{const he=!L.current&&!pe;(v.value!==void 0&&v.value===de||he)&&B(le)},[v.value]),re=r==="popper"?qi:Ph,fe=re===qi?{side:l,sideOffset:c,align:u,alignOffset:d,arrowPadding:f,collisionBoundary:h,collisionPadding:p,sticky:y,hideWhenDetached:m,avoidCollisions:g}:{};return a.jsx(zh,{scope:n,content:k,viewport:C,onViewportChange:j,itemRefCallback:G,selectedItem:T,onItemLeave:R,itemTextRefCallback:ae,focusSelectedItem:U,selectedItemText:O,position:r,isPositioned:D,searchRef:I,children:a.jsx(Ha,{as:Ej,allowPinchZoom:!0,children:a.jsx(Va,{asChild:!0,trapped:v.open,onMountAutoFocus:le=>{le.preventDefault()},onUnmountAutoFocus:Se(o,le=>{v.trigger?.focus({preventScroll:!0}),le.preventDefault()}),children:a.jsx(ms,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:s,onPointerDownOutside:i,onFocusOutside:le=>le.preventDefault(),onDismiss:()=>v.onOpenChange(!1),children:a.jsx(re,{role:"listbox",id:v.contentId,"data-state":v.open?"open":"closed",dir:v.dir,onContextMenu:le=>le.preventDefault(),...b,...fe,onPlaced:()=>w(!0),ref:E,style:{display:"flex",flexDirection:"column",outline:"none",...b.style},onKeyDown:Se(b.onKeyDown,le=>{const de=le.ctrlKey||le.altKey||le.metaKey;if(le.key==="Tab"&&le.preventDefault(),!de&&le.key.length===1&&H(le.key),["ArrowUp","ArrowDown","Home","End"].includes(le.key)){let he=N().filter(me=>!me.disabled).map(me=>me.ref.current);if(["ArrowUp","End"].includes(le.key)&&(he=he.slice().reverse()),["ArrowUp","ArrowDown"].includes(le.key)){const me=le.target,_e=he.indexOf(me);he=he.slice(_e+1)}setTimeout(()=>W(he)),le.preventDefault()}})})})})})})});Rh.displayName=Nj;var Tj="SelectItemAlignedPosition",Ph=x.forwardRef((e,t)=>{const{__scopeSelect:n,onPlaced:r,...o}=e,s=yn(An,n),i=vn(An,n),[l,c]=x.useState(null),[u,d]=x.useState(null),f=De(t,E=>d(E)),h=Ns(n),p=x.useRef(!1),y=x.useRef(!0),{viewport:m,selectedItem:g,selectedItemText:b,focusSelectedItem:v}=i,k=x.useCallback(()=>{if(s.trigger&&s.valueNode&&l&&u&&m&&g&&b){const E=s.trigger.getBoundingClientRect(),T=u.getBoundingClientRect(),z=s.valueNode.getBoundingClientRect(),O=b.getBoundingClientRect();if(s.dir!=="rtl"){const me=O.left-T.left,_e=z.left-me,Pe=E.left-_e,_=E.width+Pe,ne=Math.max(_,T.width),Q=window.innerWidth-Et,M=Zi(_e,[Et,Math.max(Et,Q-ne)]);l.style.minWidth=_+"px",l.style.left=M+"px"}else{const me=T.right-O.right,_e=window.innerWidth-z.right-me,Pe=window.innerWidth-E.right-_e,_=E.width+Pe,ne=Math.max(_,T.width),Q=window.innerWidth-Et,M=Zi(_e,[Et,Math.max(Et,Q-ne)]);l.style.minWidth=_+"px",l.style.right=M+"px"}const B=h(),N=window.innerHeight-Et*2,D=m.scrollHeight,w=window.getComputedStyle(u),L=parseInt(w.borderTopWidth,10),W=parseInt(w.paddingTop,10),U=parseInt(w.borderBottomWidth,10),F=parseInt(w.paddingBottom,10),K=L+W+D+F+U,I=Math.min(g.offsetHeight*5,K),H=window.getComputedStyle(m),G=parseInt(H.paddingTop,10),R=parseInt(H.paddingBottom,10),ae=E.top+E.height/2-Et,re=N-ae,fe=g.offsetHeight/2,le=g.offsetTop+fe,de=L+W+le,pe=K-de;if(de<=ae){const me=B.length>0&&g===B[B.length-1].ref.current;l.style.bottom="0px";const _e=u.clientHeight-m.offsetTop-m.offsetHeight,Pe=Math.max(re,fe+(me?R:0)+_e+U),_=de+Pe;l.style.height=_+"px"}else{const me=B.length>0&&g===B[0].ref.current;l.style.top="0px";const Pe=Math.max(ae,L+m.offsetTop+(me?G:0)+fe)+pe;l.style.height=Pe+"px",m.scrollTop=de-ae+m.offsetTop}l.style.margin=`${Et}px 0`,l.style.minHeight=I+"px",l.style.maxHeight=N+"px",r?.(),requestAnimationFrame(()=>p.current=!0)}},[h,s.trigger,s.valueNode,l,u,m,g,b,s.dir,r]);ot(()=>k(),[k]);const[S,C]=x.useState();ot(()=>{u&&C(window.getComputedStyle(u).zIndex)},[u]);const j=x.useCallback(E=>{E&&y.current===!0&&(k(),v?.(),y.current=!1)},[k,v]);return a.jsx(Ij,{scope:n,contentWrapper:l,shouldExpandOnScrollRef:p,onScrollButtonChange:j,children:a.jsx("div",{ref:c,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:S},children:a.jsx(Te.div,{...o,ref:f,style:{boxSizing:"border-box",maxHeight:"100%",...o.style}})})})});Ph.displayName=Tj;var Aj="SelectPopperPosition",qi=x.forwardRef((e,t)=>{const{__scopeSelect:n,align:r="start",collisionPadding:o=Et,...s}=e,i=Es(n);return a.jsx(rh,{...i,...s,ref:t,align:r,collisionPadding:o,style:{boxSizing:"border-box",...s.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)"}})});qi.displayName=Aj;var[Ij,il]=mr(An,{}),Ki="SelectViewport",Oh=x.forwardRef((e,t)=>{const{__scopeSelect:n,nonce:r,...o}=e,s=vn(Ki,n),i=il(Ki,n),l=De(t,s.onViewportChange),c=x.useRef(0);return a.jsxs(a.Fragment,{children:[a.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}),a.jsx(js.Slot,{scope:n,children:a.jsx(Te.div,{"data-radix-select-viewport":"",role:"presentation",...o,ref:l,style:{position:"relative",flex:1,overflow:"hidden auto",...o.style},onScroll:Se(o.onScroll,u=>{const d=u.currentTarget,{contentWrapper:f,shouldExpandOnScrollRef:h}=i;if(h?.current&&f){const p=Math.abs(c.current-d.scrollTop);if(p>0){const y=window.innerHeight-Et*2,m=parseFloat(f.style.minHeight),g=parseFloat(f.style.height),b=Math.max(m,g);if(b<y){const v=b+p,k=Math.min(y,v),S=v-k;f.style.height=k+"px",f.style.bottom==="0px"&&(d.scrollTop=S>0?S:0,f.style.justifyContent="flex-end")}}}c.current=d.scrollTop})})})]})});Oh.displayName=Ki;var Mh="SelectGroup",[zj,Rj]=mr(Mh),Pj=x.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,o=Bt();return a.jsx(zj,{scope:n,id:o,children:a.jsx(Te.div,{role:"group","aria-labelledby":o,...r,ref:t})})});Pj.displayName=Mh;var Lh="SelectLabel",Oj=x.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,o=Rj(Lh,n);return a.jsx(Te.div,{id:o.id,...r,ref:t})});Oj.displayName=Lh;var Ko="SelectItem",[Mj,Dh]=mr(Ko),Fh=x.forwardRef((e,t)=>{const{__scopeSelect:n,value:r,disabled:o=!1,textValue:s,...i}=e,l=yn(Ko,n),c=vn(Ko,n),u=l.value===r,[d,f]=x.useState(s??""),[h,p]=x.useState(!1),y=De(t,v=>c.itemRefCallback?.(v,r,o)),m=Bt(),g=x.useRef("touch"),b=()=>{o||(l.onValueChange(r),l.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 a.jsx(Mj,{scope:n,value:r,disabled:o,textId:m,isSelected:u,onItemTextChange:x.useCallback(v=>{f(k=>k||(v?.textContent??"").trim())},[]),children:a.jsx(js.ItemSlot,{scope:n,value:r,disabled:o,textValue:d,children:a.jsx(Te.div,{role:"option","aria-labelledby":m,"data-highlighted":h?"":void 0,"aria-selected":u&&h,"data-state":u?"checked":"unchecked","aria-disabled":o||void 0,"data-disabled":o?"":void 0,tabIndex:o?void 0:-1,...i,ref:y,onFocus:Se(i.onFocus,()=>p(!0)),onBlur:Se(i.onBlur,()=>p(!1)),onClick:Se(i.onClick,()=>{g.current!=="mouse"&&b()}),onPointerUp:Se(i.onPointerUp,()=>{g.current==="mouse"&&b()}),onPointerDown:Se(i.onPointerDown,v=>{g.current=v.pointerType}),onPointerMove:Se(i.onPointerMove,v=>{g.current=v.pointerType,o?c.onItemLeave?.():g.current==="mouse"&&v.currentTarget.focus({preventScroll:!0})}),onPointerLeave:Se(i.onPointerLeave,v=>{v.currentTarget===document.activeElement&&c.onItemLeave?.()}),onKeyDown:Se(i.onKeyDown,v=>{c.searchRef?.current!==""&&v.key===" "||(vj.includes(v.key)&&b(),v.key===" "&&v.preventDefault())})})})})});Fh.displayName=Ko;var Ar="SelectItemText",$h=x.forwardRef((e,t)=>{const{__scopeSelect:n,className:r,style:o,...s}=e,i=yn(Ar,n),l=vn(Ar,n),c=Dh(Ar,n),u=Sj(Ar,n),[d,f]=x.useState(null),h=De(t,b=>f(b),c.onItemTextChange,b=>l.itemTextRefCallback?.(b,c.value,c.disabled)),p=d?.textContent,y=x.useMemo(()=>a.jsx("option",{value:c.value,disabled:c.disabled,children:p},c.value),[c.disabled,c.value,p]),{onNativeOptionAdd:m,onNativeOptionRemove:g}=u;return ot(()=>(m(y),()=>g(y)),[m,g,y]),a.jsxs(a.Fragment,{children:[a.jsx(Te.span,{id:c.textId,...s,ref:h}),c.isSelected&&i.valueNode&&!i.valueNodeHasChildren?Zr.createPortal(s.children,i.valueNode):null]})});$h.displayName=Ar;var Bh="SelectItemIndicator",Uh=x.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e;return Dh(Bh,n).isSelected?a.jsx(Te.span,{"aria-hidden":!0,...r,ref:t}):null});Uh.displayName=Bh;var Gi="SelectScrollUpButton",Wh=x.forwardRef((e,t)=>{const n=vn(Gi,e.__scopeSelect),r=il(Gi,e.__scopeSelect),[o,s]=x.useState(!1),i=De(t,r.onScrollButtonChange);return ot(()=>{if(n.viewport&&n.isPositioned){let l=function(){const u=c.scrollTop>0;s(u)};const c=n.viewport;return l(),c.addEventListener("scroll",l),()=>c.removeEventListener("scroll",l)}},[n.viewport,n.isPositioned]),o?a.jsx(Hh,{...e,ref:i,onAutoScroll:()=>{const{viewport:l,selectedItem:c}=n;l&&c&&(l.scrollTop=l.scrollTop-c.offsetHeight)}}):null});Wh.displayName=Gi;var Ji="SelectScrollDownButton",Vh=x.forwardRef((e,t)=>{const n=vn(Ji,e.__scopeSelect),r=il(Ji,e.__scopeSelect),[o,s]=x.useState(!1),i=De(t,r.onScrollButtonChange);return ot(()=>{if(n.viewport&&n.isPositioned){let l=function(){const u=c.scrollHeight-c.clientHeight,d=Math.ceil(c.scrollTop)<u;s(d)};const c=n.viewport;return l(),c.addEventListener("scroll",l),()=>c.removeEventListener("scroll",l)}},[n.viewport,n.isPositioned]),o?a.jsx(Hh,{...e,ref:i,onAutoScroll:()=>{const{viewport:l,selectedItem:c}=n;l&&c&&(l.scrollTop=l.scrollTop+c.offsetHeight)}}):null});Vh.displayName=Ji;var Hh=x.forwardRef((e,t)=>{const{__scopeSelect:n,onAutoScroll:r,...o}=e,s=vn("SelectScrollButton",n),i=x.useRef(null),l=Ns(n),c=x.useCallback(()=>{i.current!==null&&(window.clearInterval(i.current),i.current=null)},[]);return x.useEffect(()=>()=>c(),[c]),ot(()=>{l().find(d=>d.ref.current===document.activeElement)?.ref.current?.scrollIntoView({block:"nearest"})},[l]),a.jsx(Te.div,{"aria-hidden":!0,...o,ref:t,style:{flexShrink:0,...o.style},onPointerDown:Se(o.onPointerDown,()=>{i.current===null&&(i.current=window.setInterval(r,50))}),onPointerMove:Se(o.onPointerMove,()=>{s.onItemLeave?.(),i.current===null&&(i.current=window.setInterval(r,50))}),onPointerLeave:Se(o.onPointerLeave,()=>{c()})})}),Lj="SelectSeparator",Dj=x.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e;return a.jsx(Te.div,{"aria-hidden":!0,...r,ref:t})});Dj.displayName=Lj;var Yi="SelectArrow",Fj=x.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,o=Es(n),s=yn(Yi,n),i=vn(Yi,n);return s.open&&i.position==="popper"?a.jsx(oh,{...o,...r,ref:t}):null});Fj.displayName=Yi;var $j="SelectBubbleInput",Zh=x.forwardRef(({__scopeSelect:e,value:t,...n},r)=>{const o=x.useRef(null),s=De(r,o),i=jS(t);return x.useEffect(()=>{const l=o.current;if(!l)return;const c=window.HTMLSelectElement.prototype,d=Object.getOwnPropertyDescriptor(c,"value").set;if(i!==t&&d){const f=new Event("change",{bubbles:!0});d.call(l,t),l.dispatchEvent(f)}},[i,t]),a.jsx(Te.select,{...n,style:{...Qf,...n.style},ref:s,defaultValue:t})});Zh.displayName=$j;function qh(e){return e===""||e===void 0}function Kh(e){const t=lt(e),n=x.useRef(""),r=x.useRef(0),o=x.useCallback(i=>{const l=n.current+i;t(l),(function c(u){n.current=u,window.clearTimeout(r.current),u!==""&&(r.current=window.setTimeout(()=>c(""),1e3))})(l)},[t]),s=x.useCallback(()=>{n.current="",window.clearTimeout(r.current)},[]);return x.useEffect(()=>()=>window.clearTimeout(r.current),[]),[n,o,s]}function Gh(e,t,n){const o=t.length>1&&Array.from(t).every(u=>u===t[0])?t[0]:t,s=n?e.indexOf(n):-1;let i=Bj(e,Math.max(s,0));o.length===1&&(i=i.filter(u=>u!==n));const c=i.find(u=>u.textValue.toLowerCase().startsWith(o.toLowerCase()));return c!==n?c:void 0}function Bj(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var Uj=Sh,Wj=jh,Vj=Eh,Hj=Th,Zj=Ah,qj=Ih,Kj=Oh,Gj=Fh,Jj=$h,Yj=Uh,Xj=Wh,Qj=Vh,Ts="Tabs",[e5]=sn(Ts,[ih]),Jh=ih(),[t5,al]=e5(Ts),Yh=x.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,onValueChange:o,defaultValue:s,orientation:i="horizontal",dir:l,activationMode:c="automatic",...u}=e,d=hs(l),[f,h]=jn({prop:r,onChange:o,defaultProp:s??"",caller:Ts});return a.jsx(t5,{scope:n,baseId:Bt(),value:f,onValueChange:h,orientation:i,dir:d,activationMode:c,children:a.jsx(Te.div,{dir:d,"data-orientation":i,...u,ref:t})})});Yh.displayName=Ts;var Xh="TabsList",Qh=x.forwardRef((e,t)=>{const{__scopeTabs:n,loop:r=!0,...o}=e,s=al(Xh,n),i=Jh(n);return a.jsx(rj,{asChild:!0,...i,orientation:s.orientation,dir:s.dir,loop:r,children:a.jsx(Te.div,{role:"tablist","aria-orientation":s.orientation,...o,ref:t})})});Qh.displayName=Xh;var em="TabsTrigger",tm=x.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,disabled:o=!1,...s}=e,i=al(em,n),l=Jh(n),c=om(i.baseId,r),u=sm(i.baseId,r),d=r===i.value;return a.jsx(oj,{asChild:!0,...l,focusable:!o,active:d,children:a.jsx(Te.button,{type:"button",role:"tab","aria-selected":d,"aria-controls":u,"data-state":d?"active":"inactive","data-disabled":o?"":void 0,disabled:o,id:c,...s,ref:t,onMouseDown:Se(e.onMouseDown,f=>{!o&&f.button===0&&f.ctrlKey===!1?i.onValueChange(r):f.preventDefault()}),onKeyDown:Se(e.onKeyDown,f=>{[" ","Enter"].includes(f.key)&&i.onValueChange(r)}),onFocus:Se(e.onFocus,()=>{const f=i.activationMode!=="manual";!d&&!o&&f&&i.onValueChange(r)})})})});tm.displayName=em;var nm="TabsContent",rm=x.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,forceMount:o,children:s,...i}=e,l=al(nm,n),c=om(l.baseId,r),u=sm(l.baseId,r),d=r===l.value,f=x.useRef(d);return x.useEffect(()=>{const h=requestAnimationFrame(()=>f.current=!1);return()=>cancelAnimationFrame(h)},[]),a.jsx(St,{present:o||d,children:({present:h})=>a.jsx(Te.div,{"data-state":d?"active":"inactive","data-orientation":l.orientation,role:"tabpanel","aria-labelledby":c,hidden:!h,id:u,tabIndex:0,...i,ref:t,style:{...e.style,animationDuration:f.current?"0s":void 0},children:h&&s})})});rm.displayName=nm;function om(e,t){return`${e}-trigger-${t}`}function sm(e,t){return`${e}-content-${t}`}var n5=Yh,r5=Qh,o5=tm,s5=rm,[As]=sn("Tooltip",[_s]),Is=_s(),im="TooltipProvider",i5=700,Xi="tooltip.open",[a5,ll]=As(im),am=e=>{const{__scopeTooltip:t,delayDuration:n=i5,skipDelayDuration:r=300,disableHoverableContent:o=!1,children:s}=e,i=x.useRef(!0),l=x.useRef(!1),c=x.useRef(0);return x.useEffect(()=>{const u=c.current;return()=>window.clearTimeout(u)},[]),a.jsx(a5,{scope:t,isOpenDelayedRef:i,delayDuration:n,onOpen:x.useCallback(()=>{window.clearTimeout(c.current),i.current=!1},[]),onClose:x.useCallback(()=>{window.clearTimeout(c.current),c.current=window.setTimeout(()=>i.current=!0,r)},[r]),isPointerInTransitRef:l,onPointerInTransitChange:x.useCallback(u=>{l.current=u},[]),disableHoverableContent:o,children:s})};am.displayName=im;var Br="Tooltip",[l5,Jr]=As(Br),lm=e=>{const{__scopeTooltip:t,children:n,open:r,defaultOpen:o,onOpenChange:s,disableHoverableContent:i,delayDuration:l}=e,c=ll(Br,e.__scopeTooltip),u=Is(t),[d,f]=x.useState(null),h=Bt(),p=x.useRef(0),y=i??c.disableHoverableContent,m=l??c.delayDuration,g=x.useRef(!1),[b,v]=jn({prop:r,defaultProp:o??!1,onChange:E=>{E?(c.onOpen(),document.dispatchEvent(new CustomEvent(Xi))):c.onClose(),s?.(E)},caller:Br}),k=x.useMemo(()=>b?g.current?"delayed-open":"instant-open":"closed",[b]),S=x.useCallback(()=>{window.clearTimeout(p.current),p.current=0,g.current=!1,v(!0)},[v]),C=x.useCallback(()=>{window.clearTimeout(p.current),p.current=0,v(!1)},[v]),j=x.useCallback(()=>{window.clearTimeout(p.current),p.current=window.setTimeout(()=>{g.current=!0,v(!0),p.current=0},m)},[m,v]);return x.useEffect(()=>()=>{p.current&&(window.clearTimeout(p.current),p.current=0)},[]),a.jsx(th,{...u,children:a.jsx(l5,{scope:t,contentId:h,open:b,stateAttribute:k,trigger:d,onTriggerChange:f,onTriggerEnter:x.useCallback(()=>{c.isOpenDelayedRef.current?j():S()},[c.isOpenDelayedRef,j,S]),onTriggerLeave:x.useCallback(()=>{y?C():(window.clearTimeout(p.current),p.current=0)},[C,y]),onOpen:S,onClose:C,disableHoverableContent:y,children:n})})};lm.displayName=Br;var Qi="TooltipTrigger",cm=x.forwardRef((e,t)=>{const{__scopeTooltip:n,...r}=e,o=Jr(Qi,n),s=ll(Qi,n),i=Is(n),l=x.useRef(null),c=De(t,l,o.onTriggerChange),u=x.useRef(!1),d=x.useRef(!1),f=x.useCallback(()=>u.current=!1,[]);return x.useEffect(()=>()=>document.removeEventListener("pointerup",f),[f]),a.jsx(nh,{asChild:!0,...i,children:a.jsx(Te.button,{"aria-describedby":o.open?o.contentId:void 0,"data-state":o.stateAttribute,...r,ref:c,onPointerMove:Se(e.onPointerMove,h=>{h.pointerType!=="touch"&&!d.current&&!s.isPointerInTransitRef.current&&(o.onTriggerEnter(),d.current=!0)}),onPointerLeave:Se(e.onPointerLeave,()=>{o.onTriggerLeave(),d.current=!1}),onPointerDown:Se(e.onPointerDown,()=>{o.open&&o.onClose(),u.current=!0,document.addEventListener("pointerup",f,{once:!0})}),onFocus:Se(e.onFocus,()=>{u.current||o.onOpen()}),onBlur:Se(e.onBlur,o.onClose),onClick:Se(e.onClick,o.onClose)})})});cm.displayName=Qi;var cl="TooltipPortal",[c5,u5]=As(cl,{forceMount:void 0}),um=e=>{const{__scopeTooltip:t,forceMount:n,children:r,container:o}=e,s=Jr(cl,t);return a.jsx(c5,{scope:t,forceMount:n,children:a.jsx(St,{present:n||s.open,children:a.jsx(gs,{asChild:!0,container:o,children:r})})})};um.displayName=cl;var cr="TooltipContent",dm=x.forwardRef((e,t)=>{const n=u5(cr,e.__scopeTooltip),{forceMount:r=n.forceMount,side:o="top",...s}=e,i=Jr(cr,e.__scopeTooltip);return a.jsx(St,{present:r||i.open,children:i.disableHoverableContent?a.jsx(fm,{side:o,...s,ref:t}):a.jsx(d5,{side:o,...s,ref:t})})}),d5=x.forwardRef((e,t)=>{const n=Jr(cr,e.__scopeTooltip),r=ll(cr,e.__scopeTooltip),o=x.useRef(null),s=De(t,o),[i,l]=x.useState(null),{trigger:c,onClose:u}=n,d=o.current,{onPointerInTransitChange:f}=r,h=x.useCallback(()=>{l(null),f(!1)},[f]),p=x.useCallback((y,m)=>{const g=y.currentTarget,b={x:y.clientX,y:y.clientY},v=m5(b,g.getBoundingClientRect()),k=g5(b,v),S=x5(m.getBoundingClientRect()),C=y5([...k,...S]);l(C),f(!0)},[f]);return x.useEffect(()=>()=>h(),[h]),x.useEffect(()=>{if(c&&d){const y=g=>p(g,d),m=g=>p(g,c);return c.addEventListener("pointerleave",y),d.addEventListener("pointerleave",m),()=>{c.removeEventListener("pointerleave",y),d.removeEventListener("pointerleave",m)}}},[c,d,p,h]),x.useEffect(()=>{if(i){const y=m=>{const g=m.target,b={x:m.clientX,y:m.clientY},v=c?.contains(g)||d?.contains(g),k=!b5(b,i);v?h():k&&(h(),u())};return document.addEventListener("pointermove",y),()=>document.removeEventListener("pointermove",y)}},[c,d,i,u,h]),a.jsx(fm,{...e,ref:s})}),[f5,p5]=As(Br,{isInside:!1}),h5=Fk("TooltipContent"),fm=x.forwardRef((e,t)=>{const{__scopeTooltip:n,children:r,"aria-label":o,onEscapeKeyDown:s,onPointerDownOutside:i,...l}=e,c=Jr(cr,n),u=Is(n),{onClose:d}=c;return x.useEffect(()=>(document.addEventListener(Xi,d),()=>document.removeEventListener(Xi,d)),[d]),x.useEffect(()=>{if(c.trigger){const f=h=>{h.target?.contains(c.trigger)&&d()};return window.addEventListener("scroll",f,{capture:!0}),()=>window.removeEventListener("scroll",f,{capture:!0})}},[c.trigger,d]),a.jsx(ms,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:s,onPointerDownOutside:i,onFocusOutside:f=>f.preventDefault(),onDismiss:d,children:a.jsxs(rh,{"data-state":c.stateAttribute,...u,...l,ref:t,style:{...l.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:[a.jsx(h5,{children:r}),a.jsx(f5,{scope:n,isInside:!0,children:a.jsx(Zk,{id:c.contentId,role:"tooltip",children:o||r})})]})})});dm.displayName=cr;var pm="TooltipArrow",hm=x.forwardRef((e,t)=>{const{__scopeTooltip:n,...r}=e,o=Is(n);return p5(pm,n).isInside?null:a.jsx(oh,{...o,...r,ref:t})});hm.displayName=pm;function m5(e,t){const n=Math.abs(t.top-e.y),r=Math.abs(t.bottom-e.y),o=Math.abs(t.right-e.x),s=Math.abs(t.left-e.x);switch(Math.min(n,r,o,s)){case s:return"left";case o:return"right";case n:return"top";case r:return"bottom";default:throw new Error("unreachable")}}function g5(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 x5(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 b5(e,t){const{x:n,y:r}=e;let o=!1;for(let s=0,i=t.length-1;s<t.length;i=s++){const l=t[s],c=t[i],u=l.x,d=l.y,f=c.x,h=c.y;d>r!=h>r&&n<(f-u)*(r-d)/(h-d)+u&&(o=!o)}return o}function y5(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),v5(t)}function v5(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 s=t[t.length-1],i=t[t.length-2];if((s.x-i.x)*(o.y-i.y)>=(s.y-i.y)*(o.x-i.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 s=n[n.length-1],i=n[n.length-2];if((s.x-i.x)*(o.y-i.y)>=(s.y-i.y)*(o.x-i.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 w5=am,k5=lm,_5=cm,S5=um,C5=dm,j5=hm;const N5=$a("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 st({className:e,variant:t="default",asChild:n=!1,...r}){const o=n?Lk:"span";return a.jsx(o,{"data-slot":"badge","data-variant":t,className:ve(N5({variant:t}),e),...r})}function zs({...e}){return a.jsx(yS,{"data-slot":"dialog",...e})}function mm({...e}){return a.jsx(vS,{"data-slot":"dialog-trigger",...e})}function E5({...e}){return a.jsx(wS,{"data-slot":"dialog-portal",...e})}function T5({className:e,...t}){return a.jsx(kS,{"data-slot":"dialog-overlay",className:ve("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 Rs({className:e,children:t,...n}){return a.jsxs(E5,{children:[a.jsx(T5,{}),a.jsxs(_S,{"data-slot":"dialog-content",className:ve("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,a.jsxs(CS,{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:[a.jsx(La,{className:"size-4"}),a.jsx("span",{className:"sr-only",children:"Close"})]})]})]})}function Ps({className:e,...t}){return a.jsx("div",{"data-slot":"dialog-header",className:ve("flex flex-col space-y-1.5 text-center sm:text-left",e),...t})}function Os({className:e,...t}){return a.jsx(SS,{"data-slot":"dialog-title",className:ve("text-lg font-semibold leading-none tracking-tight",e),...t})}const A5=$a("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-colors focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:outline-ring focus-visible:ring-[3px] disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/90",destructive:"bg-destructive text-white hover:bg-destructive/90",outline:"border border-input bg-background hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-9 px-4 py-2",sm:"h-8 rounded-md px-3 text-xs",lg:"h-10 rounded-md px-8",icon:"size-9"}},defaultVariants:{variant:"default",size:"default"}});function Ae({className:e,variant:t,size:n,...r}){return a.jsx("button",{"data-slot":"button",className:ve(A5({variant:t,size:n,className:e})),...r})}function gm({open:e,onOpenChange:t,title:n,description:r,confirmLabel:o="Confirm",variant:s="default",onConfirm:i}){return a.jsx(zs,{open:e,onOpenChange:t,children:a.jsxs(Rs,{children:[a.jsx(Ps,{children:a.jsx(Os,{children:n})}),a.jsx("p",{className:"text-sm text-muted-foreground",children:r}),a.jsxs("div",{className:"flex justify-end gap-2 pt-2",children:[a.jsx(Ae,{variant:"outline",size:"sm",onClick:()=>t(!1),children:"Cancel"}),a.jsx(Ae,{variant:s,size:"sm",onClick:()=>{i(),t(!1)},children:o})]})]})})}const I5="/v1/chat/completions",z5="/chat/completions",R5="/v1/messages";class P5{handlers=new Map;pathMap=new Map;register(t){this.handlers.set(t.format,t)}registerPath(t,n){this.pathMap.set(t,n)}get(t){return this.handlers.get(t)}getByPath(t){const n=t.split("?")[0]??"",r=this.pathMap.get(n);return r===void 0?void 0:this.handlers.get(r)}getFormatByPath(t){const n=t.split("?")[0]??"";return this.pathMap.get(n)}detectFormat(t){if(t===null)return"unknown";for(const n of this.handlers.values())if(n.detectFormat(t))return n.format;return"unknown"}}const gr=new P5;function O5(e){return gr.getFormatByPath(e)??"unknown"}gr.registerPath(R5,"anthropic");gr.registerPath(I5,"openai");gr.registerPath(z5,"openai");function M5(e){if(e==="")return{};try{const t=JSON.parse(e);return t!==null&&typeof t=="object"&&!Array.isArray(t)?{...t}:{}}catch{return{}}}function L5(e){switch(e.type){case"text":return{type:"text",text:e.text};case"thinking":{const t={type:"thinking",thinking:e.thinking};return e.signature!==""&&(t.signature=e.signature),t}case"think":{const t={type:"think",thinking:e.thinking};return e.signature!==""&&(t.signature=e.signature),t}case"tool_use":return{type:"tool_use",id:e.id,name:e.name,input:M5(e.inputJson)}}}function xm(e,t,n,r){const o=new Map;let s="",i="",l=null,c=null,u=0,d=0;const f=1e3;let h=0,p=0;const y=[];for(const g of e.split(`
|
|
86
|
+
`)){const b=g.trim();if(b.startsWith("data: "))try{const v=JSON.parse(b.slice(6)),k=hv.safeParse(v);if(!k.success)continue;const S=k.data;switch(h===0&&(p=Date.now()),r===!0&&y.length<f&&y.push({index:h,timestamp:Date.now()-p,type:S.type,data:S}),h++,S.type){case"message_start":s=S.message.id,i=S.message.model,u=S.message.usage.input_tokens,t.inputTokens=u,t.cacheCreationInputTokens=S.message.usage.cache_creation_input_tokens??null,t.cacheReadInputTokens=S.message.usage.cache_read_input_tokens??null,t.model===null&&(t.model=i);break;case"content_block_start":{const C=S.content_block;switch(C.type){case"text":o.set(S.index,{type:"text",text:C.text??""});break;case"thinking":o.set(S.index,{type:"thinking",thinking:C.thinking??"",signature:C.signature??""});break;case"think":o.set(S.index,{type:"think",thinking:C.thinking??"",signature:C.signature??""});break;case"tool_use":o.set(S.index,{type:"tool_use",id:C.id,name:C.name,inputJson:""});break}break}case"content_block_delta":{const C=o.get(S.index);if(C===void 0)break;const j=S.delta;j.type==="text_delta"&&C.type==="text"?C.text+=j.text:j.type==="thinking_delta"&&(C.type==="thinking"||C.type==="think")?C.thinking+=j.thinking:j.type==="signature_delta"&&(C.type==="thinking"||C.type==="think")?C.signature+=j.signature:j.type==="input_json_delta"&&C.type==="tool_use"&&(C.inputJson+=j.partial_json);break}case"message_delta":l=S.delta.stop_reason,c=S.delta.stop_sequence??null,d=S.usage.output_tokens,t.outputTokens=d,S.usage.cache_creation_input_tokens!==void 0&&(t.cacheCreationInputTokens=S.usage.cache_creation_input_tokens),S.usage.cache_read_input_tokens!==void 0&&(t.cacheReadInputTokens=S.usage.cache_read_input_tokens);break;case"error":t.error=S.error.message;break;case"content_block_stop":case"message_stop":case"ping":break}}catch{}}r===!0&&(t.streamingChunks={chunks:y,truncated:h>f});const m=[...o.entries()].sort(([g],[b])=>g-b).map(([,g])=>L5(g));return JSON.stringify({id:s,type:"message",model:i!==""?i:n??"",role:"assistant",content:m,stop_reason:l,stop_sequence:c,usage:{input_tokens:u,output_tokens:d}})}const D5={format:"anthropic",parseRequest(e,t){try{const n=JSON.parse(e),r=xf.safeParse(n);return r.success?{model:r.data.model,sessionId:r.data.metadata?.user_id??t?.get("x-session-affinity")??null}:null}catch{return null}},extractTokens(e){try{const t=JSON.parse(e),n=bf.safeParse(t);if(n.success)return{inputTokens:n.data.usage.input_tokens??null,outputTokens:n.data.usage.output_tokens??null,cacheCreationInputTokens:n.data.usage.cache_creation_input_tokens??null,cacheReadInputTokens:n.data.usage.cache_read_input_tokens??null}}catch{}return{inputTokens:null,outputTokens:null,cacheCreationInputTokens:null,cacheReadInputTokens:null}},extractStream(e,t,n,r){return xm(e,t,n,r)},detectFormat(e){if(e===null)return!1;try{const t=JSON.parse(e);if(typeof t=="object"&&t!==null&&!Array.isArray(t)){const n=Object.keys(t);return n.includes("model")&&n.includes("messages")&&n.includes("system")}return!1}catch{return!1}}};gr.register(D5);class F5{providers=[];register(t){this.providers.push(t)}findProvider(t){let n=null;for(const r of this.providers)if(r.matches(t)){if(r.name!=="anthropic")return r;n=r}return n}getAll(){return[...this.providers]}}const Ms=new F5,$5="https://api.anthropic.com",B5={MiniMax:"https://api.minimaxi.com/anthropic"},U5={name:"anthropic",matches(e){const t=e.toLowerCase();if(t.startsWith("openai-"))return!1;if(t.includes("claude")||t.includes("anthropic"))return!0;for(const n of Object.keys(B5))if(t.startsWith(n.toLowerCase()))return!0;return!0},getUpstreamBase(e,t){return t?.baseUrl!==void 0?t.baseUrl:$5},extractStream(e,t,n,r){return xm(e,t,n,r)}};Ms.register(U5);function Ls(e,t,n,r=!0){let o="",s="",i="",l="",c=null,u=0,d=0,f=!1,h=!1;const p=new Map,y=1e3;let m=0,g=0;const b=[];for(const k of e.split(`
|
|
87
|
+
`)){const S=k.trim();if(!S.startsWith("data: "))continue;const C=S.slice(6);if(C==="[DONE]")break;try{const j=JSON.parse(C);if(typeof j=="object"&&j!==null&&!Array.isArray(j)){const z=Object.getOwnPropertyDescriptor(j,"error");if(z!==void 0&&typeof z.value=="object"&&z.value!==null){const O=Object.getOwnPropertyDescriptor(z.value,"message");O!==void 0&&typeof O.value=="string"&&(t.error=O.value);continue}}const E=vv.safeParse(j);if(!E.success)continue;const T=E.data;if(m===0&&(g=Date.now()),r===!0&&b.length<y&&b.push({index:m,timestamp:Date.now()-g,type:"chat.completion.chunk",data:T}),m++,h||(o=T.id,s=T.model,h=!0),!f&&T.usage!==void 0&&T.usage!==null){if(u=T.usage.prompt_tokens??0,d=T.usage.completion_tokens??0,t.inputTokens=u,typeof j=="object"&&j!==null&&!Array.isArray(j)){const z=Object.getOwnPropertyDescriptor(j,"usage");if(z!==void 0&&typeof z.value=="object"&&z.value!==null){const O=Object.getOwnPropertyDescriptor(z.value,"prompt_tokens_details");if(O!==void 0&&typeof O.value=="object"&&O.value!==null){const B=Object.getOwnPropertyDescriptor(O.value,"cached_tokens");B!==void 0&&typeof B.value=="number"&&(t.cacheReadInputTokens=B.value)}}}f=!0}for(const z of T.choices){const O=z.delta;O.content!==void 0&&O.content!==null&&(i+=O.content),O.reasoning_content!==void 0&&O.reasoning_content!==null&&(l+=O.reasoning_content),O.thinking!==void 0&&O.thinking!==null&&(l+=O.thinking);const B=O.think;if(B!=null&&(l+=B),z.finish_reason!==void 0&&z.finish_reason!==null&&(c=z.finish_reason),O.tool_calls!==void 0&&O.tool_calls!==null)for(const N of O.tool_calls){let D=p.get(N.index);D===void 0&&(D={index:N.index,type:"function",function:{name:"",arguments:""}},p.set(N.index,D)),N.id!==void 0&&(D.id=N.id),N.function?.name!==void 0&&(D.function.name+=N.function.name),N.function?.arguments!==void 0&&(D.function.arguments+=N.function.arguments)}}}catch{}}r===!0&&(t.streamingChunks={chunks:b,truncated:m>y}),f||(d=Math.ceil(i.length/4)),t.outputTokens=d;const v={role:"assistant",content:i};return l&&(v.reasoning_content=l),p.size>0&&(v.tool_calls=[...p.values()]),JSON.stringify({id:o,object:"chat.completion",created:Math.floor(Date.now()/1e3),model:s!==""?s:n??"",choices:[{index:0,message:v,finish_reason:c}],usage:{prompt_tokens:u,completion_tokens:d,total_tokens:u+d}})}const W5={format:"openai",parseRequest(e,t){try{const n=JSON.parse(e),r=wf.safeParse(n);return r.success?{model:r.data.model,sessionId:t?.get("x-session-affinity")??null}:null}catch{return null}},extractTokens(e){const t=_f(e);if(t){let n=null;try{const r=JSON.parse(e);if(r!==null&&typeof r=="object"&&!Array.isArray(r)){const o=Object.getOwnPropertyDescriptor(r,"usage");if(o!==void 0&&typeof o.value=="object"&&o.value!==null){const s=Object.getOwnPropertyDescriptor(o.value,"prompt_tokens_details");if(s!==void 0&&typeof s.value=="object"&&s.value!==null){const i=Object.getOwnPropertyDescriptor(s.value,"cached_tokens");i!==void 0&&typeof i.value=="number"&&(n=i.value)}}}}catch{}return{inputTokens:t.usage.prompt_tokens??null,outputTokens:t.usage.completion_tokens??null,cacheCreationInputTokens:null,cacheReadInputTokens:n}}return{inputTokens:null,outputTokens:null,cacheCreationInputTokens:null,cacheReadInputTokens:null}},extractStream(e,t,n,r){return Ls(e,t,n,r)},detectFormat(e){if(e===null)return!1;try{const t=JSON.parse(e);if(typeof t=="object"&&t!==null&&!Array.isArray(t)){const n=Object.keys(t);return n.includes("model")&&n.includes("messages")&&!n.includes("system")}return!1}catch{return!1}}};gr.register(W5);const V5="https://api.openai.com/v1",H5={name:"openai",matches(e){const t=e.toLowerCase();return!!(t.startsWith("openai-")||t.includes("gpt-")||t.includes("o1")||t.includes("o2")||t.includes("o3"))},getUpstreamBase(e,t){return t?.baseUrl!==void 0?t.baseUrl:V5},extractStream(e,t,n,r){return Ls(e,t,n,r)}};Ms.register(H5);const Z5="https://open.bigmodel.cn/api/paas/v4",q5=["glm-","charglm-","cogview-","embedding-","rerank-"],K5={name:"zhipu",matches(e){const t=e.toLowerCase().replace(/\s+/g,"-");return q5.some(n=>t.startsWith(n))},getUpstreamBase(e,t){return t?.baseUrl??Z5},extractStream(e,t,n,r){return Ls(e,t,n,r)}};Ms.register(K5);const G5="https://dashscope.aliyuncs.com/compatible-mode/v1",J5={name:"alibaba",matches(e){const t=e.toLowerCase().replace(/\s+/g,"-");return!!(t.startsWith("glm-5")||t.startsWith("qwen"))},getUpstreamBase(e,t){return G5},extractStream(e,t,n){return Ls(e,t,n)}};Ms.register(J5);function bm(e,t){for(const n of Array.from(e))t(n)}const Y5=/[\u3000-\u9FFF\uAC00-\uD7FF\uF900-\uFAFF\uFF00-\uFFEF\u{1F300}-\u{1FAFF}]/u;function ul(e){if(e.length===0)return 0;let t=0,n=0;return bm(e,r=>{Y5.test(r)?t+=1:n+=1}),Math.ceil(t*1)+Math.ceil(n/4)}function dl(e){if(e.length===0)return 0;let t=0;return bm(e,()=>{t+=1}),t}function Cn(e){return{parsed:null,comparisonValue:e,messageCount:null,toolCount:null}}const Qn={parsed:null,toolNames:null};function X5(e){if(typeof e=="string")return e;if(!Array.isArray(e))return"";const t=[];for(const n of e){if(n===null||typeof n!="object")continue;const r=n;switch(r.type){case"text":typeof r.text=="string"&&t.push(r.text);break;case"thinking":case"think":typeof r.thinking=="string"&&t.push(r.thinking);break;case"tool_use":{const s=typeof r.name=="string"?r.name:"",i=r.input!==void 0?JSON.stringify(r.input):"";t.push(`${s} ${i}`.trim());break}case"tool_result":{const s=r.content;if(typeof s=="string")t.push(s);else if(Array.isArray(s)){for(const i of s)if(i!==null&&typeof i=="object"){const l=i.text;typeof l=="string"&&t.push(l)}}break}case"image":t.push("[image]");break}}return t.join(`
|
|
88
|
+
`)}function Q5(e){if(typeof e=="string")return e;if(!Array.isArray(e))return"";const t=[];for(const n of e)if(n!==null&&typeof n=="object"){const r=n.text;n.type==="text"&&typeof r=="string"&&t.push(r)}return t.join(`
|
|
89
|
+
`)}function eN(e){if(!Array.isArray(e))return"";const t=[];for(const n of e){if(n===null||typeof n!="object")continue;const r=n;typeof r.name=="string"&&t.push(r.name),typeof r.description=="string"&&t.push(r.description),r.input_schema!==void 0&&t.push(JSON.stringify(r.input_schema))}return t.join(`
|
|
90
|
+
`)}function oi(e,t,n,r){return{role:e,label:t,text:n,size:ul(n),characters:dl(n),path:r}}const tN={format:"anthropic",analyzeRequest(e){if(e===null)return Cn(e);try{const t=xf.safeParse(JSON.parse(e));return t.success?{parsed:t.data,comparisonValue:t.data,messageCount:t.data.messages.length,toolCount:t.data.tools!==void 0&&t.data.tools.length>0?t.data.tools.length:null}:Cn(e)}catch{return Cn(e)}},analyzeResponse(e){if(e===null)return Qn;try{let t=JSON.parse(e);typeof t=="string"&&(t=JSON.parse(t));const n=bf.safeParse(t);if(!n.success)return Qn;const r=n.data.content.filter(o=>o.type==="tool_use").map(o=>o.name);return{parsed:n.data,toolNames:r.length>0?r:null}}catch{return Qn}},anatomySegments(e){if(e===null||typeof e!="object")return null;const t=e,n=[];if(t.system!==void 0){const r=Q5(t.system);r.length>0&&n.push(oi("system","system",r,"/system"))}if(Array.isArray(t.messages)&&t.messages.forEach((r,o)=>{if(r===null||typeof r!="object")return;const s=r,i=s.role==="user"||s.role==="assistant"?s.role:"user",l=X5(s.content);n.push(oi(i,`[${o}] ${i}`,l,`/messages/${o}`))}),Array.isArray(t.tools)&&t.tools.length>0){const r=eN(t.tools);n.push(oi("tools","tools",r,"/tools"))}return n.length>0?n:null}};function nN(e){if(typeof e=="string")return e;if(!Array.isArray(e))return"";const t=[];for(const n of e){if(n===null||typeof n!="object")continue;const r=n,o=r.type;o==="text"&&typeof r.text=="string"?t.push(r.text):o==="image_url"&&t.push("[image]")}return t.join(`
|
|
91
|
+
`)}function rN(e){const t=[],n=nN(e.content);n.length>0&&t.push(n);const r=typeof e.reasoning_content=="string"?e.reasoning_content:typeof e.thinking=="string"?e.thinking:typeof e.think=="string"?e.think:"";r.length>0&&t.push(r);const o=e.tool_calls;if(Array.isArray(o))for(const s of o){if(s===null||typeof s!="object")continue;const i=s.function;if(i===void 0)continue;const l=typeof i.name=="string"?i.name:"",c=typeof i.arguments=="string"?i.arguments:"";t.push(`${l} ${c}`.trim())}return t.join(`
|
|
92
|
+
`)}function oN(e){if(!Array.isArray(e))return"";const t=[];for(const n of e){if(n===null||typeof n!="object")continue;const o=n.function;o!==void 0&&(typeof o.name=="string"&&t.push(o.name),typeof o.description=="string"&&t.push(o.description),o.parameters!==void 0&&t.push(JSON.stringify(o.parameters)))}return t.join(`
|
|
93
|
+
`)}function Yc(e,t,n,r){return{role:e,label:t,text:n,size:ul(n),characters:dl(n),path:r}}const sN={format:"openai",analyzeRequest(e){if(e===null)return Cn(e);try{const t=wf.safeParse(JSON.parse(e));return t.success?{parsed:t.data,comparisonValue:t.data,messageCount:t.data.messages.length,toolCount:t.data.tools!==void 0&&t.data.tools.length>0?t.data.tools.length:null}:Cn(e)}catch{return Cn(e)}},analyzeResponse(e){if(e===null)return Qn;const t=_f(e);if(t===null)return Qn;const n=t.choices[0]?.message?.tool_calls?.map(r=>r.function?.name??"").filter(r=>r!=="")??[];return{parsed:t,toolNames:n.length>0?n:null}},anatomySegments(e){if(e===null||typeof e!="object")return null;const t=e,n=[];if(Array.isArray(t.messages)&&t.messages.forEach((r,o)=>{if(r===null||typeof r!="object")return;const s=r,i=s.role==="user"||s.role==="assistant"||s.role==="system"||s.role==="tool"?s.role:"user",l=rN(s);n.push(Yc(i,`[${o}] ${i}`,l,`/messages/${o}`))}),Array.isArray(t.tools)&&t.tools.length>0){const r=oN(t.tools);n.push(Yc("tools","tools",r,"/tools"))}return n.length>0?n:null}},iN={format:"unknown",analyzeRequest(e){return Cn(e)},analyzeResponse(){return Qn},anatomySegments(){return null}},aN={anthropic:tN,openai:sN,unknown:iN};function ym(e){return aN[e]}function In(e){const t=O5(e.path);return t==="unknown"?e.apiFormat:t}const lN={anthropic:"Anthropic",openai:"OpenAI",unknown:"Unknown"};function cN({conversationId:e,startTime:t,endTime:n,totalCalls:r,totalInputTokens:o,totalOutputTokens:s,apiFormat:i,expanded:l,onToggle:c,hideApiFormat:u=!1,isLoading:d=!1,userAgent:f,timeDisplayFormat:h,onClear:p}){const[y,m]=x.useState(!1),g=v=>{v.stopPropagation(),p!==void 0&&m(!0)},b=x.useCallback(v=>{v.stopPropagation(),window.open(Pd(e),"_blank","noopener,noreferrer")},[e]);return a.jsxs("div",{role:"button",tabIndex:0,"data-nav-id":`conv-${e}`,"data-nav-action":l?"collapse":"expand",className:ve("flex items-center gap-3 px-3 py-2 cursor-pointer transition-colors","hover:bg-muted/50","select-none","border border-border rounded-lg mb-2 bg-background sticky top-0 z-10","focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1 focus-visible:outline-none"),onClick:c,onKeyDown:v=>{v.target===v.currentTarget&&(v.key==="Enter"||v.key===" ")&&(v.preventDefault(),c())},children:[l?a.jsx(Zt,{className:"size-4 text-muted-foreground shrink-0"}):d?a.jsx(Wt,{className:"size-4 animate-spin text-muted-foreground shrink-0"}):a.jsx(on,{className:"size-4 text-muted-foreground shrink-0"}),a.jsx("span",{className:"text-purple-400/90 font-mono text-xs font-semibold shrink-0",title:e,children:e.startsWith("PID:")||e.includes("|")?e:e.length>24?e.slice(0,12)+"..."+e.slice(-12):e}),f!=null&&f!==""&&a.jsxs("span",{className:"flex items-center gap-1 text-muted-foreground text-xs shrink-0",title:f,children:[a.jsx(xw,{className:"size-3"}),a.jsx("span",{className:"font-mono tabular-nums truncate max-w-[120px]",children:f})]}),!u&&a.jsx(st,{variant:"outline",className:ve("text-[10px] px-1.5 py-0 h-5 font-mono shrink-0",i==="openai"&&"border-blue-500/40 text-blue-400",i==="anthropic"&&"border-orange-500/40 text-orange-400",i==="unknown"&&"border-muted text-muted-foreground"),children:lN[i]}),a.jsxs("span",{className:"flex items-center gap-1 text-muted-foreground text-xs shrink-0",children:[a.jsx(hn,{className:"size-3"}),a.jsx("span",{className:"font-mono tabular-nums",children:Da(t,n,h)})]}),a.jsxs("span",{className:"flex items-center gap-1 text-muted-foreground text-xs shrink-0",children:[a.jsx(fs,{className:"size-3"}),a.jsxs("span",{className:"font-mono tabular-nums",children:[r," call",r!==1?"s":""]})]}),a.jsxs("span",{className:"flex items-center gap-1 text-xs shrink-0",children:[a.jsx(Fr,{className:"size-3 text-muted-foreground"}),a.jsxs("span",{className:"font-mono tabular-nums",children:[a.jsx("span",{className:"text-blue-400",children:He(o)})," / ",a.jsx("span",{className:"text-amber-400",children:He(s)})]})]}),a.jsx("span",{className:"flex-1 min-w-0"}),a.jsx("button",{type:"button",onClick:b,onKeyDown:v=>{(v.key==="Enter"||v.key===" ")&&b(v)},"aria-label":`Open session ${e} in a new tab`,title:"Open this session in a new tab",className:"text-muted-foreground hover:text-foreground transition-colors shrink-0 inline-flex items-center justify-center size-8 rounded hover:bg-muted cursor-pointer",children:a.jsx(Pa,{className:"size-3.5"})}),p!==void 0&&a.jsx("button",{type:"button",onClick:g,"aria-label":`Clear group (${r} request${r!==1?"s":""})`,title:"Clear this group",className:"text-muted-foreground hover:text-foreground transition-colors shrink-0 inline-flex items-center justify-center size-8 rounded hover:bg-muted cursor-pointer",children:a.jsx(sr,{className:"size-3.5"})}),a.jsx(gm,{open:y,onOpenChange:m,title:"Clear this group?",description:`This will remove ${r} request${r!==1?"s":""} from this conversation. This action cannot be undone.`,confirmLabel:"Clear",variant:"destructive",onConfirm:()=>{p?.()}})]})}function uN(e){for(const t of e){const n=In(t);if(n!=="unknown")return n}return"unknown"}function dN(e){let t=!1,n=!1;for(const r of e){const o=In(r);if(o==="anthropic"?t=!0:o==="openai"&&(n=!0),t&&n)return!0}return!1}function fN(e){if(e.isTest===!0)return"provider-test";if(e.sessionId!==null&&e.sessionId!==""&&e.sessionId!==void 0)return e.sessionId;const t=e.clientPid!==null&&e.clientPid!==void 0,n=e.clientProjectFolder!==null&&e.clientProjectFolder!==void 0;if(!t&&!n)return"default";const r=t?`PID:${e.clientPid}`:"unknown",o=n?e.clientProjectFolder:"no-folder";return`${r}|${o}`}function pN(e){const t=new Map;for(const r of e){const o=fN(r),s=t.get(o);s!==void 0?s.push(r):t.set(o,[r])}const n=[];for(const[r,o]of t){const s=[...o].sort((i,l)=>i.timestamp.localeCompare(l.timestamp));n.push({id:r,conversationId:r,logs:s})}return n.sort((r,o)=>(r.logs[0]?.timestamp??"").localeCompare(o.logs[0]?.timestamp??"")),n}function Xc(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function hN(e){if(e.responseText===null)return null;try{let t=JSON.parse(e.responseText);return typeof t=="string"&&(t=JSON.parse(t)),Xc(t)?typeof t.stop_reason=="string"?t.stop_reason==="end_turn"||t.stop_reason==="tool_use"?t.stop_reason:null:Array.isArray(t.choices)&&t.choices.length>0&&Xc(t.choices[0])&&typeof t.choices[0].finish_reason=="string"&&t.choices[0].finish_reason==="stop"?"stop":null:null}catch{return null}}function vm(e){return e==="end_turn"||e==="stop"}function jt({className:e,style:t,d:n,eyeStalks:r,eyes:o,legs:s,extras:i}){return a.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",style:t,className:ve("inline-block size-5",e),children:[a.jsx("path",{d:n}),r,o,s,i]})}const wn=a.jsxs(a.Fragment,{children:[a.jsx("line",{x1:"6.5",y1:"16",x2:"4.5",y2:"19.5"}),a.jsx("line",{x1:"9",y1:"17.5",x2:"8",y2:"20.5"}),a.jsx("line",{x1:"15",y1:"17.5",x2:"16",y2:"20.5"}),a.jsx("line",{x1:"17.5",y1:"16",x2:"19.5",y2:"19.5"})]}),wm=a.jsxs(a.Fragment,{children:[a.jsx("line",{x1:"7",y1:"16",x2:"5.5",y2:"18.5"}),a.jsx("line",{x1:"9.5",y1:"17",x2:"8.5",y2:"19.5"}),a.jsx("line",{x1:"14.5",y1:"17",x2:"15.5",y2:"19.5"}),a.jsx("line",{x1:"17",y1:"16",x2:"18.5",y2:"18.5"})]});function km({className:e}){return a.jsx(jt,{className:e,d:"M5 13 C5 9 8 7 12 7 C16 7 19 9 19 13 C19 16 16 18 12 18 C8 18 5 16 5 13 Z",eyeStalks:a.jsxs(a.Fragment,{children:[a.jsx("line",{x1:"10",y1:"7",x2:"9.5",y2:"5"}),a.jsx("line",{x1:"14",y1:"7",x2:"14.5",y2:"5"})]}),eyes:a.jsxs(a.Fragment,{children:[a.jsx("circle",{cx:"9.5",cy:"4.5",r:"0.9",fill:"currentColor",stroke:"none"}),a.jsx("circle",{cx:"14.5",cy:"4.5",r:"0.9",fill:"currentColor",stroke:"none"})]}),legs:wn,extras:a.jsxs(a.Fragment,{children:[a.jsx("path",{d:"M5 11 C3.5 9.5 1.5 10 2 12.5 C2.5 14 4 13.5 5 12.5"}),a.jsx("path",{d:"M19 11 C20.5 9.5 22.5 10 22 12.5 C21.5 14 20 13.5 19 12.5"})]})})}function mN({className:e}){return a.jsx(jt,{className:e,d:"M4 13 C4 7 7.5 5.5 12 5.5 C16.5 5.5 20 7 20 13 C20 17.5 16.5 19 12 19 C7.5 19 4 17.5 4 13 Z",eyeStalks:a.jsxs(a.Fragment,{children:[a.jsx("line",{x1:"9.5",y1:"6.5",x2:"9.5",y2:"4.5"}),a.jsx("line",{x1:"14.5",y1:"6.5",x2:"14.5",y2:"4.5"})]}),eyes:a.jsxs(a.Fragment,{children:[a.jsx("circle",{cx:"9.5",cy:"4",r:"1.1",fill:"currentColor",stroke:"none"}),a.jsx("circle",{cx:"14.5",cy:"4",r:"1.1",fill:"currentColor",stroke:"none"})]}),legs:wm,extras:a.jsxs(a.Fragment,{children:[a.jsx("path",{d:"M5 11 C4 9.5 2.5 10 3 12 C3.5 13.5 4.5 13 5 12"}),a.jsx("path",{d:"M19 11 C20 9.5 21.5 10 21 12 C20.5 13.5 19.5 13 19 12"})]})})}function gN({className:e}){return a.jsx(jt,{className:e,d:"M3 13.5 C3 8 7 6 12 6 C17 6 21 8 21 13.5 C21 17 17 19 12 19 C7 19 3 17 3 13.5 Z",eyeStalks:a.jsxs(a.Fragment,{children:[a.jsx("line",{x1:"7",y1:"7",x2:"6.5",y2:"4.5"}),a.jsx("line",{x1:"17",y1:"7",x2:"17.5",y2:"4.5"})]}),eyes:a.jsxs(a.Fragment,{children:[a.jsx("circle",{cx:"6.5",cy:"4",r:"0.8",fill:"currentColor",stroke:"none"}),a.jsx("circle",{cx:"17.5",cy:"4",r:"0.8",fill:"currentColor",stroke:"none"})]}),legs:wn,extras:a.jsxs(a.Fragment,{children:[a.jsx("path",{d:"M4 12 C2.5 10.5 1 11 1.5 13 C2 14.5 3.5 14 4.5 13"}),a.jsx("path",{d:"M20 12 C21.5 10.5 23 11 22.5 13 C22 14.5 20.5 14 19.5 13"})]})})}function xN({className:e}){return a.jsx(jt,{className:e,d:"M6 14 C6 8 9 5.5 12 5.5 C15 5.5 18 8 18 14 C18 18 15 20 12 20 C9 20 6 18 6 14 Z",eyeStalks:a.jsxs(a.Fragment,{children:[a.jsx("line",{x1:"10",y1:"6.5",x2:"10",y2:"3.5"}),a.jsx("line",{x1:"14",y1:"6.5",x2:"14",y2:"3.5"})]}),eyes:a.jsxs(a.Fragment,{children:[a.jsx("circle",{cx:"10",cy:"3",r:"0.7",fill:"currentColor",stroke:"none"}),a.jsx("circle",{cx:"14",cy:"3",r:"0.7",fill:"currentColor",stroke:"none"})]}),legs:a.jsxs(a.Fragment,{children:[a.jsx("line",{x1:"7",y1:"17",x2:"5",y2:"20.5"}),a.jsx("line",{x1:"9.5",y1:"18.5",x2:"8.5",y2:"21.5"}),a.jsx("line",{x1:"14.5",y1:"18.5",x2:"15.5",y2:"21.5"}),a.jsx("line",{x1:"17",y1:"17",x2:"19",y2:"20.5"})]}),extras:a.jsxs(a.Fragment,{children:[a.jsx("path",{d:"M6.5 11 C5 8.5 3 9 3.5 11.5 C4 13.5 5 13 6 12"}),a.jsx("path",{d:"M17.5 11 C19 8.5 21 9 20.5 11.5 C20 13.5 19 13 18 12"})]})})}function bN({className:e}){return a.jsx(jt,{className:e,d:"M5 13 C5 9 8 7 12 7 L13 4 L14 7 C16 7 19 9 19 13 C19 16 16 18 13 18 L12 21 L11 18 C8 18 5 16 5 13 Z",eyeStalks:a.jsxs(a.Fragment,{children:[a.jsx("line",{x1:"10",y1:"7",x2:"9.5",y2:"5"}),a.jsx("line",{x1:"14",y1:"7",x2:"14.5",y2:"5"})]}),eyes:a.jsxs(a.Fragment,{children:[a.jsx("circle",{cx:"9.5",cy:"4.5",r:"0.8",fill:"currentColor",stroke:"none"}),a.jsx("circle",{cx:"14.5",cy:"4.5",r:"0.8",fill:"currentColor",stroke:"none"})]}),legs:wn,extras:a.jsxs(a.Fragment,{children:[a.jsx("path",{d:"M5 11 C3.5 9.5 1.5 10 2 12.5 C2.5 14 4 13.5 5 12.5"}),a.jsx("path",{d:"M19 11 C20.5 9.5 22.5 10 22 12.5 C21.5 14 20 13.5 19 12.5"})]})})}function yN({className:e}){return a.jsx(jt,{className:e,d:"M5 13 C5 9 8 7 12 7 C16 7 19 9 19 13 C19 16 16 18 12 18 C8 18 5 16 5 13 Z",eyeStalks:a.jsxs(a.Fragment,{children:[a.jsx("line",{x1:"10",y1:"7",x2:"9.5",y2:"5"}),a.jsx("line",{x1:"14",y1:"7",x2:"14.5",y2:"5"})]}),eyes:a.jsxs(a.Fragment,{children:[a.jsx("circle",{cx:"9.5",cy:"4.5",r:"0.9",fill:"currentColor",stroke:"none"}),a.jsx("line",{x1:"13.5",y1:"4",x2:"15.5",y2:"5"})]}),legs:wn,extras:a.jsxs(a.Fragment,{children:[a.jsx("path",{d:"M5 11 C3.5 9.5 1.5 10 2 12.5 C2.5 14 4 13.5 5 12.5"}),a.jsx("path",{d:"M19 11 C20.5 9.5 22.5 10 22 12.5 C21.5 14 20 13.5 19 12.5"})]})})}function vN({className:e}){return a.jsx(jt,{className:e,d:"M5.5 13.5 C5.5 10 8.5 8 12 8 C15.5 8 18.5 10 18.5 13.5 C18.5 16 15.5 17.5 12 17.5 C8.5 17.5 5.5 16 5.5 13.5 Z",eyeStalks:a.jsxs(a.Fragment,{children:[a.jsx("line",{x1:"10",y1:"8",x2:"10",y2:"6"}),a.jsx("line",{x1:"14",y1:"8",x2:"14",y2:"6"})]}),eyes:a.jsxs(a.Fragment,{children:[a.jsx("line",{x1:"9",y1:"6",x2:"11",y2:"6.5"}),a.jsx("line",{x1:"13",y1:"6",x2:"15",y2:"6.5"})]}),legs:wm,extras:a.jsxs(a.Fragment,{children:[a.jsx("path",{d:"M6 11.5 C4.5 10.5 3 11 3.5 12.5 C4 13.5 5 13 5.5 12.5"}),a.jsx("path",{d:"M18 11.5 C19.5 10.5 21 11 20.5 12.5 C20 13.5 19 13 18.5 12.5"})]})})}function wN({className:e}){return a.jsx(jt,{className:e,d:"M5 13 C5 9 8 7 12 7 C16 7 19 9 19 13 C19 16 16 18 12 18 C8 18 5 16 5 13 Z",eyeStalks:a.jsxs(a.Fragment,{children:[a.jsx("line",{x1:"10",y1:"7",x2:"9.5",y2:"5"}),a.jsx("line",{x1:"14",y1:"7",x2:"14.5",y2:"5"})]}),eyes:a.jsxs(a.Fragment,{children:[a.jsx("circle",{cx:"9.5",cy:"4.5",r:"0.7",fill:"currentColor",stroke:"none"}),a.jsx("circle",{cx:"14.5",cy:"4.5",r:"0.7",fill:"currentColor",stroke:"none"})]}),legs:wn,extras:a.jsxs(a.Fragment,{children:[a.jsx("path",{d:"M5 11 C3.5 9.5 1.5 10 2 12.5 C2.5 14 4 13.5 5 12.5"}),a.jsx("path",{d:"M19 11 C20.5 9.5 22.5 10 22 12.5 C21.5 14 20 13.5 19 12.5"}),a.jsx("line",{x1:"8.5",y1:"4",x2:"10.5",y2:"4.5"}),a.jsx("line",{x1:"15.5",y1:"4",x2:"13.5",y2:"4.5"}),a.jsx("path",{d:"M9 15.5 C10 14.5 14 14.5 15 15.5"})]})})}function kN({className:e}){return a.jsx(jt,{className:e,d:"M5 13 C5 9 8 7 12 7 C16 7 19 9 19 13 C19 16 16 18 12 18 C8 18 5 16 5 13 Z",eyeStalks:a.jsxs(a.Fragment,{children:[a.jsx("line",{x1:"10",y1:"7",x2:"9.5",y2:"5"}),a.jsx("line",{x1:"14",y1:"7",x2:"14.5",y2:"5"})]}),eyes:a.jsxs(a.Fragment,{children:[a.jsx("circle",{cx:"9.5",cy:"4.5",r:"1.2",fill:"none",stroke:"currentColor"}),a.jsx("circle",{cx:"14.5",cy:"4.5",r:"1.2",fill:"none",stroke:"currentColor"})]}),legs:wn,extras:a.jsxs(a.Fragment,{children:[a.jsx("path",{d:"M5 11 C3.5 9.5 1.5 10 2 12.5 C2.5 14 4 13.5 5 12.5"}),a.jsx("path",{d:"M19 11 C20.5 9.5 22.5 10 22 12.5 C21.5 14 20 13.5 19 12.5"}),a.jsx("ellipse",{cx:"12",cy:"15",rx:"2",ry:"1.5",fill:"currentColor",stroke:"none"})]})})}function _N({className:e}){return a.jsx(jt,{className:e,d:"M4.5 13 C4.5 8 7.5 6 12 6 C16.5 6 19.5 8 19.5 13 C19.5 17 16.5 18.5 12 18.5 C7.5 18.5 4.5 17 4.5 13 Z",eyeStalks:a.jsxs(a.Fragment,{children:[a.jsx("line",{x1:"9.5",y1:"7",x2:"9",y2:"5"}),a.jsx("line",{x1:"14.5",y1:"7",x2:"15",y2:"5"})]}),eyes:a.jsxs(a.Fragment,{children:[a.jsx("circle",{cx:"9",cy:"4.5",r:"1",fill:"currentColor",stroke:"none"}),a.jsx("circle",{cx:"15",cy:"4.5",r:"1",fill:"currentColor",stroke:"none"})]}),legs:wn,extras:a.jsxs(a.Fragment,{children:[a.jsx("path",{d:"M5 11 C3.5 9 2 9.5 2.5 12 C3 14 4 13 5 12"}),a.jsx("path",{d:"M19 11 C20.5 9 22 9.5 21.5 12 C21 14 20 13 19 12"}),a.jsx("path",{d:"M9 14.5 C10 16 14 16 15 14.5"}),a.jsx("circle",{cx:"7",cy:"13",r:"1",fill:"currentColor",stroke:"none",opacity:"0.3"}),a.jsx("circle",{cx:"17",cy:"13",r:"1",fill:"currentColor",stroke:"none",opacity:"0.3"})]})})}function SN({className:e}){return a.jsx(jt,{className:e,d:"M5 13 C5 9 8 7 12 7 C16 7 19 9 19 13 C19 16 16 18 12 18 C8 18 5 16 5 13 Z",eyeStalks:a.jsxs(a.Fragment,{children:[a.jsx("line",{x1:"10",y1:"7",x2:"9.5",y2:"5.5"}),a.jsx("line",{x1:"14",y1:"7",x2:"14.5",y2:"5.5"})]}),eyes:a.jsxs(a.Fragment,{children:[a.jsx("line",{x1:"7.5",y1:"5.5",x2:"16.5",y2:"5.5"}),a.jsx("rect",{x:"7",y:"5",width:"4",height:"2",rx:"0.5",fill:"currentColor",stroke:"none"}),a.jsx("rect",{x:"13",y:"5",width:"4",height:"2",rx:"0.5",fill:"currentColor",stroke:"none"})]}),legs:wn,extras:a.jsxs(a.Fragment,{children:[a.jsx("path",{d:"M5 11 C3.5 9.5 1.5 10 2 12.5 C2.5 14 4 13.5 5 12.5"}),a.jsx("path",{d:"M19 11 C20.5 9.5 22.5 10 22 12.5 C21.5 14 20 13.5 19 12.5"}),a.jsx("path",{d:"M9.5 15 C10.5 16 13.5 16 14.5 15"})]})})}function CN({className:e}){return a.jsx(jt,{className:e,d:"M7 13.5 C7 10.5 9.5 9 12 9 C14.5 9 17 10.5 17 13.5 C17 16 14.5 17.5 12 17.5 C9.5 17.5 7 16 7 13.5 Z",eyeStalks:a.jsxs(a.Fragment,{children:[a.jsx("line",{x1:"10.5",y1:"9.5",x2:"10.5",y2:"8"}),a.jsx("line",{x1:"13.5",y1:"9.5",x2:"13.5",y2:"8"})]}),eyes:a.jsxs(a.Fragment,{children:[a.jsx("circle",{cx:"10.5",cy:"7.5",r:"0.8",fill:"currentColor",stroke:"none"}),a.jsx("circle",{cx:"13.5",cy:"7.5",r:"0.8",fill:"currentColor",stroke:"none"})]}),legs:a.jsxs(a.Fragment,{children:[a.jsx("line",{x1:"8",y1:"16",x2:"6.5",y2:"18"}),a.jsx("line",{x1:"10",y1:"17",x2:"9.5",y2:"19"}),a.jsx("line",{x1:"14",y1:"17",x2:"14.5",y2:"19"}),a.jsx("line",{x1:"16",y1:"16",x2:"17.5",y2:"18"})]}),extras:a.jsxs(a.Fragment,{children:[a.jsx("path",{d:"M7.5 12 C6.5 11 5.5 11.5 6 13 C6.5 14 7 13.5 7.5 13"}),a.jsx("path",{d:"M16.5 12 C17.5 11 18.5 11.5 18 13 C17.5 14 17 13.5 16.5 13"})]})})}const Ur=[km,mN,gN,xN,bN,yN,vN,wN,kN,_N,SN,CN];function Go(e){return Ur[Math.abs(e)%Ur.length]??km}function jN(e){const t=Ur.length-2;return t<=0?0:1+((Number.isFinite(e)?Math.trunc(e):0)%t+t)%t}function NN(e){return Go(jN(e))}const EN="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",TN="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",AN="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",IN="/assets/minimax-BPMzvuL-.jpeg",zN="/assets/alibaba-TTwafVwX.svg",RN="/assets/qwen-CONDcHqt.png",PN="/assets/zhipuai-BPNAnxo-.svg",ON={"claude-":"anthropic","gpt-":"openai","o1-":"openai","o3-":"openai","deepseek-":"deepseek",MiniMax:"minimax",qwen:"qwen","glm-":"zhipuai"};function _m(e){if(e===null)return"unknown";const t=e.toLowerCase();for(const[n,r]of Object.entries(ON))if(t.startsWith(n.toLowerCase()))return r;return"unknown"}const Mn={width:24,height:24,objectFit:"contain"},MN=ut.memo(({className:e})=>a.jsx("img",{src:EN,alt:"Anthropic",className:e,style:Mn})),LN=ut.memo(({className:e})=>a.jsx("img",{src:TN,alt:"OpenAI",className:e,style:{...Mn,background:"white",borderRadius:"4px"}})),DN=ut.memo(({className:e})=>a.jsx("img",{src:AN,alt:"DeepSeek",className:e,style:Mn})),FN=ut.memo(({className:e})=>a.jsx("img",{src:IN,alt:"MiniMax",className:e,style:Mn})),$N=ut.memo(({className:e})=>a.jsx("img",{src:zN,alt:"Alibaba",className:e,style:Mn})),BN=ut.memo(({className:e})=>a.jsx("img",{src:RN,alt:"Qwen",className:e,style:Mn})),UN=ut.memo(({className:e})=>a.jsx("img",{src:PN,alt:"ZhipuAI",className:e,style:Mn}));function Sm({provider:e,className:t}){switch(e){case"anthropic":return a.jsx(MN,{className:t});case"openai":return a.jsx(LN,{className:t});case"deepseek":return a.jsx(DN,{className:t});case"minimax":return a.jsx(FN,{className:t});case"alibaba":return a.jsx($N,{className:t});case"qwen":return a.jsx(BN,{className:t});case"zhipuai":return a.jsx(UN,{className:t});case"unknown":return null}}function tt({delayDuration:e=0,...t}){return a.jsx(w5,{"data-slot":"tooltip-provider",delayDuration:e,...t})}function Fe({...e}){return a.jsx(k5,{"data-slot":"tooltip",...e})}function $e({...e}){return a.jsx(_5,{"data-slot":"tooltip-trigger",...e})}function Be({className:e,sideOffset:t=0,children:n,...r}){return a.jsx(S5,{children:a.jsxs(C5,{"data-slot":"tooltip-content",sideOffset:t,className:ve("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,a.jsx(j5,{className:"bg-foreground fill-foreground z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px]"})]})})}function fl(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function Me(e,t){return e===null||typeof e!="object"||Array.isArray(e)?void 0:Object.getOwnPropertyDescriptor(e,t)?.value}const WN="x-anthropic-billing-header:";function VN(e){return e.trimStart().toLowerCase().startsWith(WN)}function HN(e){return fl(e)?Object.prototype.hasOwnProperty.call(e,"system"):!1}function ZN(e){if(!fl(e))return!1;const t=Me(e,"type"),n=Me(e,"text");return typeof t!="string"||t!=="text"||typeof n!="string"?!1:VN(n)}function qN(e){let t;try{t=JSON.parse(e)}catch{return{body:e,removed:0}}if(!HN(t))return{body:e,removed:0};const n=t.system;if(!Array.isArray(n)||n.length===0)return{body:e,removed:0};const r=[];let o=0;for(const s of n){if(ZN(s)){o+=1;continue}r.push(s)}return o===0?{body:e,removed:0}:(r.length===0?delete t.system:t.system=r,{body:JSON.stringify(t),removed:o})}function KN(e){return{depth:Number.POSITIVE_INFINITY}}function Cm(e){try{const t=JSON.parse(e);return{kind:"json",data:Jo(t)}}catch{return{kind:"text"}}}function si(e){const t=x.useMemo(()=>e===null?null:Cm(e),[e]),n=t?.kind==="json"?t.data:null,r=x.useMemo(()=>n===null?null:KN(),[n]),[o,s]=x.useState(!1),[i,l]=x.useState(0),[c,u]=x.useState(0),[d,f]=x.useTransition(),h=x.useCallback(()=>{const p=!o,y=p&&r!==null?r.depth:0;f(()=>{s(p),l(y),u(m=>m+1)})},[o,r]);return{parsedData:n,policy:r,isExpanded:o,toggle:h,isPending:d,bulkDepth:i,bulkRevision:c}}function Jo(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=>Jo(n));const t={};for(const n of Object.keys(e)){const r=Object.getOwnPropertyDescriptor(e,n);t[n]=Jo(r?.value)}return t}case"bigint":case"symbol":case"function":case"undefined":return String(e)}return null}function jm({className:e,orientation:t="horizontal",...n}){return a.jsx(n5,{"data-slot":"tabs","data-orientation":t,orientation:t,className:ve("group/tabs flex gap-2 data-[orientation=horizontal]:flex-col",e),...n})}const GN=$a("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 Nm({className:e,variant:t="default",...n}){return a.jsx(r5,{"data-slot":"tabs-list","data-variant":t,className:ve(GN({variant:t}),e),...n})}function Tt({className:e,...t}){return a.jsx(o5,{"data-slot":"tabs-trigger",className:ve("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 At({className:e,...t}){return a.jsx(s5,{"data-slot":"tabs-content",className:ve("flex-1 outline-none",e),...t})}function Xt(e){const[t,n]=x.useState(!1),r=x.useRef(null);x.useEffect(()=>()=>{r.current!==null&&clearTimeout(r.current)},[]);const o=x.useCallback(s=>{s.stopPropagation(),e!==null&&window.navigator.clipboard.writeText(e).then(()=>{n(!0),r.current!==null&&clearTimeout(r.current),r.current=setTimeout(()=>n(!1),2e3)})},[e]);return{copied:t,copy:o}}const JN=x.lazy(()=>zn(()=>import("./CompareDrawer-nEHCEVP4.js"),__vite__mapDeps([0,1])).then(e=>({default:e.CompareDrawer}))),YN=x.lazy(()=>zn(()=>import("./ReplayDialog-CUnBdt1Q.js"),__vite__mapDeps([2,1,3])).then(e=>({default:e.ReplayDialog}))),XN=x.lazy(()=>zn(()=>import("./RequestAnatomy-BU9VT2Sw.js"),__vite__mapDeps([4,1])).then(e=>({default:e.RequestAnatomy}))),QN=x.lazy(()=>zn(()=>import("./ResponseView-amxuKPKY.js"),__vite__mapDeps([3,1])).then(e=>({default:e.ResponseView}))),eE=x.lazy(()=>zn(()=>import("./StreamingChunkSequence-DpscrQM2.js"),__vite__mapDeps([5,1])).then(e=>({default:e.StreamingChunkSequence}))),Qc=x.lazy(()=>zn(()=>Promise.resolve().then(()=>vg),void 0).then(e=>({default:e.JsonViewer}))),tE=x.lazy(()=>zn(()=>Promise.resolve().then(()=>vg),void 0).then(e=>({default:e.JsonViewerFromString}))),nE=1200,rE=12;function oE(e){const{containerRef:t,setExpandToPath:n,ensureTabActive:r,highlightMs:o}=e,s=x.useRef(null);return x.useCallback(i=>{r?.(),n(i.path);const l=f=>{f.scrollIntoView({behavior:"smooth",block:"center"}),f.classList.add("ring-2","ring-primary/60","ring-offset-1","ring-offset-background","rounded-sm","transition-shadow"),s.current!==null&&clearTimeout(s.current),s.current=setTimeout(()=>{f.classList.remove("ring-2","ring-primary/60","ring-offset-1","ring-offset-background","rounded-sm","transition-shadow"),n(null)},o??nE)},u=`[data-anatomy-path="${(f=>typeof CSS<"u"&&typeof CSS.escape=="function"?CSS.escape(f):f.replace(/(["'\\[\](){}])/g,"\\$1"))(i.path)}"]`,d=f=>{const h=t.current;if(h!==null){const p=h.querySelector(u);if(p!==null){l(p);return}}f>0?window.requestAnimationFrame(()=>d(f-1)):n(null)};window.requestAnimationFrame(()=>d(rE))},[t,r,o,n])}class Em{diff(t,n,r={}){let o;typeof r=="function"?(o=r,r={}):"callback"in r&&(o=r.callback);const s=this.castInput(t,r),i=this.castInput(n,r),l=this.removeEmpty(this.tokenize(s,r)),c=this.removeEmpty(this.tokenize(i,r));return this.diffWithOptionsObj(l,c,r,o)}diffWithOptionsObj(t,n,r,o){var s;const i=v=>{if(v=this.postProcess(v,r),o){setTimeout(function(){o(v)},0);return}else return v},l=n.length,c=t.length;let u=1,d=l+c;r.maxEditLength!=null&&(d=Math.min(d,r.maxEditLength));const f=(s=r.timeout)!==null&&s!==void 0?s:1/0,h=Date.now()+f,p=[{oldPos:-1,lastComponent:void 0}];let y=this.extractCommon(p[0],n,t,0,r);if(p[0].oldPos+1>=c&&y+1>=l)return i(this.buildValues(p[0].lastComponent,n,t));let m=-1/0,g=1/0;const b=()=>{for(let v=Math.max(m,-u);v<=Math.min(g,u);v+=2){let k;const S=p[v-1],C=p[v+1];S&&(p[v-1]=void 0);let j=!1;if(C){const T=C.oldPos-v;j=C&&0<=T&&T<l}const E=S&&S.oldPos+1<c;if(!j&&!E){p[v]=void 0;continue}if(!E||j&&S.oldPos<C.oldPos?k=this.addToPath(C,!0,!1,0,r):k=this.addToPath(S,!1,!0,1,r),y=this.extractCommon(k,n,t,v,r),k.oldPos+1>=c&&y+1>=l)return i(this.buildValues(k.lastComponent,n,t))||!0;p[v]=k,k.oldPos+1>=c&&(g=Math.min(g,v-1)),y+1>=l&&(m=Math.max(m,v+1))}u++};if(o)(function v(){setTimeout(function(){if(u>d||Date.now()>h)return o(void 0);b()||v()},0)})();else for(;u<=d&&Date.now()<=h;){const v=b();if(v)return v}}addToPath(t,n,r,o,s){const i=t.lastComponent;return i&&!s.oneChangePerToken&&i.added===n&&i.removed===r?{oldPos:t.oldPos+o,lastComponent:{count:i.count+1,added:n,removed:r,previousComponent:i.previousComponent}}:{oldPos:t.oldPos+o,lastComponent:{count:1,added:n,removed:r,previousComponent:i}}}extractCommon(t,n,r,o,s){const i=n.length,l=r.length;let c=t.oldPos,u=c-o,d=0;for(;u+1<i&&c+1<l&&this.equals(r[c+1],n[u+1],s);)u++,c++,d++,s.oneChangePerToken&&(t.lastComponent={count:1,previousComponent:t.lastComponent,added:!1,removed:!1});return d&&!s.oneChangePerToken&&(t.lastComponent={count:d,previousComponent:t.lastComponent,added:!1,removed:!1}),t.oldPos=c,u}equals(t,n,r){return r.comparator?r.comparator(t,n):t===n||!!r.ignoreCase&&t.toLowerCase()===n.toLowerCase()}removeEmpty(t){const n=[];for(let r=0;r<t.length;r++)t[r]&&n.push(t[r]);return n}castInput(t,n){return t}tokenize(t,n){return Array.from(t)}join(t){return t.join("")}postProcess(t,n){return t}get useLongestToken(){return!1}buildValues(t,n,r){const o=[];let s;for(;t;)o.push(t),s=t.previousComponent,delete t.previousComponent,t=s;o.reverse();const i=o.length;let l=0,c=0,u=0;for(;l<i;l++){const d=o[l];if(d.removed)d.value=this.join(r.slice(u,u+d.count)),u+=d.count;else{if(!d.added&&this.useLongestToken){let f=n.slice(c,c+d.count);f=f.map(function(h,p){const y=r[u+p];return y.length>h.length?y:h}),d.value=this.join(f)}else d.value=this.join(n.slice(c,c+d.count));c+=d.count,d.added||(u+=d.count)}}return o}}class sE extends Em{constructor(){super(...arguments),this.tokenize=Am}equals(t,n,r){return r.ignoreWhitespace?((!r.newlineIsToken||!t.includes(`
|
|
86
94
|
`))&&(t=t.trim()),(!r.newlineIsToken||!n.includes(`
|
|
87
95
|
`))&&(n=n.trim())):r.ignoreNewlineAtEof&&!r.newlineIsToken&&(t.endsWith(`
|
|
88
96
|
`)&&(t=t.slice(0,-1)),n.endsWith(`
|
|
89
|
-
`)&&(n=n.slice(0,-1))),super.equals(t,n,r)}}const
|
|
90
|
-
`));const n=[],r=e.split(/(\n|\r\n)/);r[r.length-1]||r.pop();for(let o=0;o<r.length;o++){const s=r[o];o%2&&!t.newlineIsToken?n[n.length-1]+=s:n.push(s)}return n}class
|
|
91
|
-
`);s.length>0&&s[s.length-1]===""&&s.pop();for(const i of s)o.added?(r+=1,t.push({kind:"added",text:i,oldLineNumber:null,newLineNumber:r})):o.removed?(n+=1,t.push({kind:"removed",text:i,oldLineNumber:n,newLineNumber:null})):(n+=1,r+=1,t.push({kind:"context",text:i,oldLineNumber:n,newLineNumber:r}))}return t}function
|
|
92
|
-
`),r=
|
|
93
|
-
`);if(n===r)return{lines:[],isEmpty:!0};const o=jm(n,r);return{lines:ta(o),isEmpty:!1}}function tu(e){try{const t=JSON.parse(e);return t===null||typeof t=="string"||typeof t=="object"?t:null}catch{return null}}function zN(e,t){const n=e??"",r=t??"";if(n===r)return{lines:[],isEmpty:!0};const o=tu(n),s=tu(r);if(o!==null&&s!==null){const l=AN(o,s)??[];if(l.length===1){const c=l[0];if(c!==void 0&&!c.added&&!c.removed)return{lines:[],isEmpty:!0}}return{lines:ta(l),isEmpty:!1}}const i=jm(n,r);return{lines:ta(i),isEmpty:!1}}function RN(e,t,n){const r=new Array(e);return new Proxy(r,{get(o,s,i){if(typeof s=="string"){const l=s.charCodeAt(0);if(l>=48&&l<=57){const c=+s;if(Number.isInteger(c)&&c>=0&&c<e){let u=o[c];if(!u){const d=t[c*2];u=o[c]={index:c,key:n(c),start:d,size:t[c*2+1],end:d+t[c*2+1],lane:0}}return u}}if(s==="length")return e}return Reflect.get(o,s,i)}})}function Bn(e,t,n){let r=n.initialDeps??[],o,s=!0;function i(){const l=e();return(l.length!==r.length||l.some((u,d)=>r[d]!==u))&&(r=l,o=t(...l),n?.onChange&&!(s&&n.skipInitialOnChange)&&n.onChange(o),s=!1),o}return i.updateDeps=l=>{r=l},i}function nu(e,t){if(e===void 0)throw new Error("Unexpected undefined");return e}const ru=(e,t)=>Math.abs(e-t)<1.01,PN=(e,t,n)=>{let r;return function(...o){e.clearTimeout(r),r=e.setTimeout(()=>t.apply(this,o),n)}};let yr;const ou=()=>{if(yr!==void 0)return yr;if(typeof navigator>"u")return yr=!1;if(/iP(hone|od|ad)/.test(navigator.userAgent))return yr=!0;const e=navigator.maxTouchPoints;return yr=navigator.platform==="MacIntel"&&e!==void 0&&e>0},su=e=>{const{offsetWidth:t,offsetHeight:n}=e;return{width:t,height:n}},ON=e=>e,MN=e=>{const t=Math.max(e.startIndex-e.overscan,0),r=Math.min(e.endIndex+e.overscan,e.count-1)-t+1,o=new Array(r);for(let s=0;s<r;s++)o[s]=t+s;return o},LN=(e,t)=>{const n=e.scrollElement;if(!n)return;const r=e.targetWindow;if(!r)return;const o=i=>{const{width:l,height:c}=i;t({width:Math.round(l),height:Math.round(c)})};if(o(su(n)),!r.ResizeObserver)return()=>{};const s=new r.ResizeObserver(i=>{const l=()=>{const c=i[0];if(c?.borderBoxSize){const u=c.borderBoxSize[0];if(u){o({width:u.inlineSize,height:u.blockSize});return}}o(su(n))};e.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(l):l()});return s.observe(n,{box:"border-box"}),()=>{s.unobserve(n)}},Ur={passive:!0},DN=(e,t)=>{const n=e.scrollElement;if(!n)return;const r=()=>{t({width:n.innerWidth,height:n.innerHeight})};return r(),n.addEventListener("resize",r,Ur),()=>{n.removeEventListener("resize",r)}},FN=typeof window>"u"?!0:"onscrollend"in window,Em=(e,t,n)=>{const r=e.scrollElement;if(!r)return;const o=e.targetWindow;if(!o)return;const s=e.options.useScrollendEvent&&FN;let i=0;const l=s?null:PN(o,()=>t(i,!1),e.options.isScrollingResetDelay),c=f=>()=>{i=n(r),l?.(),t(i,f)},u=c(!0),d=c(!1);return r.addEventListener("scroll",u,Ur),s&&r.addEventListener("scrollend",d,Ur),()=>{r.removeEventListener("scroll",u),s&&r.removeEventListener("scrollend",d)}},$N=(e,t)=>Em(e,t,n=>{const{horizontal:r,isRtl:o}=e.options;return r?n.scrollLeft*(o&&-1||1):n.scrollTop}),BN=(e,t)=>Em(e,t,n=>e.options.horizontal?n.scrollX:n.scrollY),UN=(e,t,n)=>{if(t?.borderBoxSize){const r=t.borderBoxSize[0];if(r)return Math.round(r[n.options.horizontal?"inlineSize":"blockSize"])}return e[n.options.horizontal?"offsetWidth":"offsetHeight"]},Tm=(e,{adjustments:t=0,behavior:n},r)=>{var o,s;(s=(o=r.scrollElement)==null?void 0:o.scrollTo)==null||s.call(o,{[r.options.horizontal?"left":"top"]:e+t,behavior:n})},WN=Tm,HN=Tm;class VN{constructor(t){this.unsubs=[],this.scrollElement=null,this.targetWindow=null,this.isScrolling=!1,this.scrollState=null,this.measurementsCache=[],this._flatMeasurements=null,this.itemSizeCache=new Map,this.itemSizeCacheVersion=0,this.laneAssignments=new Map,this.pendingMin=null,this.prevLanes=void 0,this.lanesChangedFlag=!1,this.lanesSettling=!1,this.pendingScrollAnchor=null,this.scrollRect=null,this.scrollOffset=null,this.scrollDirection=null,this.scrollAdjustments=0,this._iosDeferredAdjustment=0,this._iosTouching=!1,this._iosJustTouchEnded=!1,this._iosTouchEndTimerId=null,this._intendedScrollOffset=null,this.elementsCache=new Map,this.now=()=>{var n,r,o;return((o=(r=(n=this.targetWindow)==null?void 0:n.performance)==null?void 0:r.now)==null?void 0:o.call(r))??Date.now()},this.observer=(()=>{let n=null;const r=()=>n||(!this.targetWindow||!this.targetWindow.ResizeObserver?null:n=new this.targetWindow.ResizeObserver(o=>{o.forEach(s=>{const i=()=>{const l=s.target,c=this.indexFromElement(l);if(!l.isConnected){this.observer.unobserve(l);for(const[u,d]of this.elementsCache)if(d===l){this.elementsCache.delete(u);break}return}this.shouldMeasureDuringScroll(c)&&this.resizeItem(c,this.options.measureElement(l,s,this))};this.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(i):i()})}));return{disconnect:()=>{var o;(o=r())==null||o.disconnect(),n=null},observe:o=>{var s;return(s=r())==null?void 0:s.observe(o,{box:"border-box"})},unobserve:o=>{var s;return(s=r())==null?void 0:s.unobserve(o)}}})(),this.range=null,this.setOptions=n=>{var r,o;const s={debug:!1,initialOffset:0,overscan:1,paddingStart:0,paddingEnd:0,scrollPaddingStart:0,scrollPaddingEnd:0,horizontal:!1,getItemKey:ON,rangeExtractor:MN,onChange:()=>{},measureElement:UN,initialRect:{width:0,height:0},scrollMargin:0,gap:0,indexAttribute:"data-index",initialMeasurementsCache:[],lanes:1,anchorTo:"start",followOnAppend:!1,scrollEndThreshold:1,isScrollingResetDelay:150,enabled:!0,isRtl:!1,useScrollendEvent:!1,useAnimationFrameWithResizeObserver:!1,laneAssignmentMode:"estimate"};for(const u in n){const d=n[u];d!==void 0&&(s[u]=d)}const i=this.options;let l=null,c=null;if(i!==void 0&&i.enabled&&s.enabled&&s.anchorTo==="end"&&this.scrollElement!==null){const u=i.count,d=s.count,f=this.getMeasurements(),h=u>0?((r=f[0])==null?void 0:r.key)??i.getItemKey(0):null,p=u>0?((o=f[u-1])==null?void 0:o.key)??i.getItemKey(u-1):null;if(d!==u||u>0&&d>0&&(s.getItemKey(0)!==h||s.getItemKey(d-1)!==p)){const g=u>0?this.getVirtualItemForOffset(this.getScrollOffset())??f[0]:null;g&&(l=[g.key,this.getScrollOffset()-g.start]);const b=s.followOnAppend===!0?"auto":s.followOnAppend||null;b&&d>u&&this.isAtEnd(i.scrollEndThreshold)&&(u===0||s.getItemKey(d-1)!==p)&&(c=b)}}this.options=s,(l||c)&&(this.pendingScrollAnchor=[l?.[0]??null,l?.[1]??0,c])},this.notify=n=>{var r,o;(o=(r=this.options).onChange)==null||o.call(r,this,n)},this.maybeNotify=Bn(()=>(this.calculateRange(),[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]),n=>{this.notify(n)},{key:!1,debug:()=>this.options.debug,initialDeps:[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]}),this.cleanup=()=>{this.unsubs.filter(Boolean).forEach(n=>n()),this.unsubs=[],this.observer.disconnect(),this.rafId!=null&&this.targetWindow&&(this.targetWindow.cancelAnimationFrame(this.rafId),this.rafId=null),this.scrollState=null,this.scrollElement=null,this.targetWindow=null},this._didMount=()=>()=>{this.cleanup()},this._willUpdate=()=>{var n;const r=this.options.enabled?this.options.getScrollElement():null;if(this.scrollElement!==r){if(this.cleanup(),!r){this.maybeNotify();return}if(this.scrollElement=r,this.scrollElement&&"ownerDocument"in this.scrollElement?this.targetWindow=this.scrollElement.ownerDocument.defaultView:this.targetWindow=((n=this.scrollElement)==null?void 0:n.window)??null,this.elementsCache.forEach(s=>{this.observer.observe(s)}),this.unsubs.push(this.options.observeElementRect(this,s=>{this.scrollRect=s,this.maybeNotify()})),this.unsubs.push(this.options.observeElementOffset(this,(s,i)=>{this._intendedScrollOffset!==null&&Math.abs(s-this._intendedScrollOffset)<1.5&&(s=this._intendedScrollOffset),this._intendedScrollOffset=null,this.scrollAdjustments=0,this.scrollDirection=i?this.getScrollOffset()<s?"forward":"backward":null,this.scrollOffset=s,this.isScrolling=i,this._flushIosDeferredIfReady(),this.scrollState&&this.scheduleScrollReconcile(),this.maybeNotify()})),"addEventListener"in this.scrollElement){const s=this.scrollElement,i=()=>{this._iosTouching=!0,this._iosJustTouchEnded=!1,this._iosTouchEndTimerId!==null&&this.targetWindow!=null&&(this.targetWindow.clearTimeout(this._iosTouchEndTimerId),this._iosTouchEndTimerId=null)},l=()=>{this._iosTouching=!1,!(!ou()||this.targetWindow==null)&&(this._iosJustTouchEnded=!0,this._iosTouchEndTimerId=this.targetWindow.setTimeout(()=>{this._iosJustTouchEnded=!1,this._iosTouchEndTimerId=null,this._flushIosDeferredIfReady()},150))};s.addEventListener("touchstart",i,Ur),s.addEventListener("touchend",l,Ur),this.unsubs.push(()=>{s.removeEventListener("touchstart",i),s.removeEventListener("touchend",l),this._iosTouchEndTimerId!==null&&this.targetWindow!=null&&(this.targetWindow.clearTimeout(this._iosTouchEndTimerId),this._iosTouchEndTimerId=null)})}this._scrollToOffset(this.getScrollOffset(),{adjustments:void 0,behavior:void 0})}const o=this.pendingScrollAnchor;if(this.pendingScrollAnchor=null,o&&this.scrollElement&&this.options.enabled){const[s,i,l]=o;if(s!==null){const{count:c,getItemKey:u}=this.options;let d=0;for(;d<c&&u(d)!==s;)d++;const f=d<c?this.getMeasurements()[d]:void 0;if(f){const h=f.start+i-this.getScrollOffset();ru(h,0)||this.applyScrollAdjustment(h)}}l&&this.scrollToEnd({behavior:l})}},this._flushIosDeferredIfReady=()=>{if(this._iosDeferredAdjustment===0||this.isScrolling||this._iosTouching||this._iosJustTouchEnded)return;const n=this.getScrollOffset(),r=this.getMaxScrollOffset();if(n<0||n>r)return;const o=this._iosDeferredAdjustment;this._iosDeferredAdjustment=0,this._scrollToOffset(n,{adjustments:this.scrollAdjustments+=o,behavior:void 0})},this.rafId=null,this.getSize=()=>this.options.enabled?(this.scrollRect=this.scrollRect??this.options.initialRect,this.scrollRect[this.options.horizontal?"width":"height"]):(this.scrollRect=null,0),this.getScrollOffset=()=>this.options.enabled?(this.scrollOffset=this.scrollOffset??(typeof this.options.initialOffset=="function"?this.options.initialOffset():this.options.initialOffset),this.scrollOffset):(this.scrollOffset=null,0),this.getFurthestMeasurement=(n,r)=>{const o=new Map,s=new Map;for(let i=r-1;i>=0;i--){const l=n[i];if(o.has(l.lane))continue;const c=s.get(l.lane);if(c==null||l.end>c.end?s.set(l.lane,l):l.end<c.end&&o.set(l.lane,!0),o.size===this.options.lanes)break}return s.size===this.options.lanes?Array.from(s.values()).sort((i,l)=>i.end===l.end?i.index-l.index:i.end-l.end)[0]:void 0},this.getMeasurementOptions=Bn(()=>[this.options.count,this.options.paddingStart,this.options.scrollMargin,this.options.getItemKey,this.options.enabled,this.options.lanes,this.options.laneAssignmentMode],(n,r,o,s,i,l,c)=>(this.prevLanes!==void 0&&this.prevLanes!==l&&(this.lanesChangedFlag=!0),this.prevLanes=l,this.pendingMin=null,{count:n,paddingStart:r,scrollMargin:o,getItemKey:s,enabled:i,lanes:l,laneAssignmentMode:c}),{key:!1}),this.getMeasurements=Bn(()=>[this.getMeasurementOptions(),this.itemSizeCacheVersion],({count:n,paddingStart:r,scrollMargin:o,getItemKey:s,enabled:i,lanes:l,laneAssignmentMode:c},u)=>{const d=this.itemSizeCache;if(!i)return this.measurementsCache=[],this.itemSizeCache.clear(),this.laneAssignments.clear(),[];if(this.laneAssignments.size>n)for(const y of this.laneAssignments.keys())y>=n&&this.laneAssignments.delete(y);this.lanesChangedFlag&&(this.lanesChangedFlag=!1,this.lanesSettling=!0,this.measurementsCache=[],this.itemSizeCache.clear(),this.laneAssignments.clear(),this.pendingMin=null),this.measurementsCache.length===0&&!this.lanesSettling&&(this.measurementsCache=this.options.initialMeasurementsCache,this.measurementsCache.forEach(y=>{this.itemSizeCache.set(y.key,y.size)}));const f=this.lanesSettling?0:this.pendingMin??0;if(this.pendingMin=null,this.lanesSettling&&this.measurementsCache.length===n&&(this.lanesSettling=!1),l===1){const y=this.options.gap,m=n*2;let g=this._flatMeasurements;if(!g||g.length<m){const k=new Float64Array(m);g&&f>0&&k.set(g.subarray(0,f*2)),g=k,this._flatMeasurements=g}let b;if(f===0)b=r+o;else{const k=f-1;b=g[k*2]+g[k*2+1]+y}for(let k=f;k<n;k++){const S=s(k),C=d.get(S),j=typeof C=="number"?C:this.options.estimateSize(k);g[k*2]=b,g[k*2+1]=j,b+=j+y}const v=RN(n,g,s);return this.measurementsCache=v,v}const h=this.measurementsCache.slice(0,f),p=new Array(l).fill(void 0);for(let y=0;y<f;y++){const m=h[y];m&&(p[m.lane]=y)}for(let y=f;y<n;y++){const m=s(y),g=this.laneAssignments.get(y);let b,v;const k=c==="estimate"||d.has(m);if(g!==void 0&&this.options.lanes>1){b=g;const E=p[b],T=E!==void 0?h[E]:void 0;v=T?T.end+this.options.gap:r+o}else{const E=this.options.lanes===1?h[y-1]:this.getFurthestMeasurement(h,y);v=E?E.end+this.options.gap:r+o,b=E?E.lane:y%this.options.lanes,this.options.lanes>1&&k&&this.laneAssignments.set(y,b)}const S=d.get(m),C=typeof S=="number"?S:this.options.estimateSize(y),j=v+C;h[y]={index:y,start:v,size:C,end:j,key:m,lane:b},p[b]=y}return this.measurementsCache=h,h},{key:!1,debug:()=>this.options.debug}),this.calculateRange=Bn(()=>[this.getMeasurements(),this.getSize(),this.getScrollOffset(),this.options.lanes],(n,r,o,s)=>this.range=n.length>0&&r>0?ZN({measurements:n,outerSize:r,scrollOffset:o,lanes:s,flat:s===1&&this._flatMeasurements!=null?this._flatMeasurements:null}):null,{key:!1,debug:()=>this.options.debug}),this.getVirtualIndexes=Bn(()=>{let n=null,r=null;const o=this.calculateRange();return o&&(n=o.startIndex,r=o.endIndex),this.maybeNotify.updateDeps([this.isScrolling,n,r]),[this.options.rangeExtractor,this.options.overscan,this.options.count,n,r]},(n,r,o,s,i)=>s===null||i===null?[]:n({startIndex:s,endIndex:i,overscan:r,count:o}),{key:!1,debug:()=>this.options.debug}),this.indexFromElement=n=>{const r=this.options.indexAttribute,o=n.getAttribute(r);return o?parseInt(o,10):(console.warn(`Missing attribute name '${r}={index}' on measured element.`),-1)},this.shouldMeasureDuringScroll=n=>{var r;if(!this.scrollState||this.scrollState.behavior!=="smooth")return!0;const o=this.scrollState.index??((r=this.getVirtualItemForOffset(this.scrollState.lastTargetOffset))==null?void 0:r.index);if(o!==void 0&&this.range){const s=Math.max(this.options.overscan,Math.ceil((this.range.endIndex-this.range.startIndex)/2)),i=Math.max(0,o-s),l=Math.min(this.options.count-1,o+s);return n>=i&&n<=l}return!0},this.measureElement=n=>{if(!n){this.elementsCache.forEach((i,l)=>{i.isConnected||(this.observer.unobserve(i),this.elementsCache.delete(l))});return}const r=this.indexFromElement(n),o=this.options.getItemKey(r),s=this.elementsCache.get(o);s!==n&&(s&&this.observer.unobserve(s),this.observer.observe(n),this.elementsCache.set(o,n)),(!this.isScrolling||this.scrollState)&&this.shouldMeasureDuringScroll(r)&&this.resizeItem(r,this.options.measureElement(n,void 0,this))},this.resizeItem=(n,r)=>{var o,s;if(n<0||n>=this.options.count)return;let i,l,c;const u=this._flatMeasurements;if(this.options.lanes===1&&u!==null)c=this.options.getItemKey(n),l=u[n*2],i=u[n*2+1];else{const h=this.measurementsCache[n];if(!h)return;c=h.key,l=h.start,i=h.size}const d=this.itemSizeCache.get(c)??i,f=r-d;if(f!==0){const h=this.options.anchorTo==="end"&&((o=this.scrollState)==null?void 0:o.behavior)!=="smooth"&&this.getVirtualDistanceFromEnd()<=this.options.scrollEndThreshold,p=h?this.getTotalSize():0,y=((s=this.scrollState)==null?void 0:s.behavior)!=="smooth"&&(this.shouldAdjustScrollPositionOnItemSizeChange!==void 0?this.shouldAdjustScrollPositionOnItemSizeChange(this.measurementsCache[n]??{index:n,key:c,start:l,size:i,end:l+i,lane:0},f,this):l<this.getScrollOffset()+this.scrollAdjustments&&this.scrollDirection!=="backward");(this.pendingMin===null||n<this.pendingMin)&&(this.pendingMin=n),this.itemSizeCache.set(c,r),this.itemSizeCacheVersion++,h?this.applyScrollAdjustment(this.getTotalSize()-p):y&&this.applyScrollAdjustment(f),this.notify(!1)}},this.getVirtualItems=Bn(()=>[this.getVirtualIndexes(),this.getMeasurements()],(n,r)=>{const o=[];for(let s=0,i=n.length;s<i;s++){const l=n[s],c=r[l];o.push(c)}return o},{key:!1,debug:()=>this.options.debug}),this.getVirtualItemForOffset=n=>{const r=this.getMeasurements();if(r.length===0)return;const o=this._flatMeasurements,s=this.options.lanes===1&&o!=null,i=Am(0,r.length-1,s?l=>o[l*2]:l=>nu(r[l]).start,n);return nu(r[i])},this.getMaxScrollOffset=()=>{if(!this.scrollElement)return 0;if("scrollHeight"in this.scrollElement)return this.options.horizontal?this.scrollElement.scrollWidth-this.scrollElement.clientWidth:this.scrollElement.scrollHeight-this.scrollElement.clientHeight;{const n=this.scrollElement.document.documentElement;return this.options.horizontal?n.scrollWidth-this.scrollElement.innerWidth:n.scrollHeight-this.scrollElement.innerHeight}},this.getVirtualDistanceFromEnd=()=>Math.max(this.getTotalSize()-this.getSize()-this.getScrollOffset(),0),this.getDistanceFromEnd=()=>Math.max(this.getMaxScrollOffset()-this.getScrollOffset(),0),this.isAtEnd=(n=this.options.scrollEndThreshold)=>this.getDistanceFromEnd()<=n,this.getOffsetForAlignment=(n,r,o=0)=>{if(!this.scrollElement)return 0;const s=this.getSize(),i=this.getScrollOffset();r==="auto"&&(r=n>=i+s?"end":"start"),r==="center"?n+=(o-s)/2:r==="end"&&(n-=s);const l=this.getMaxScrollOffset();return Math.max(Math.min(l,n),0)},this.getOffsetForIndex=(n,r="auto")=>{n=Math.max(0,Math.min(n,this.options.count-1));const o=this.getSize(),s=this.getScrollOffset(),i=this.measurementsCache[n];if(!i)return;if(r==="auto")if(i.end>=s+o-this.options.scrollPaddingEnd)r="end";else if(i.start<=s+this.options.scrollPaddingStart)r="start";else return[s,r];if(r==="end"&&n===this.options.count-1)return[this.getMaxScrollOffset(),r];const l=r==="end"?i.end+this.options.scrollPaddingEnd:i.start-this.options.scrollPaddingStart;return[this.getOffsetForAlignment(l,r,i.size),r]},this.scrollToOffset=(n,{align:r="start",behavior:o="auto"}={})=>{const s=this.getOffsetForAlignment(n,r),i=this.now();this.scrollState={index:null,align:r,behavior:o,startedAt:i,lastTargetOffset:s,stableFrames:0},this._scrollToOffset(s,{adjustments:void 0,behavior:o}),this.scheduleScrollReconcile()},this.scrollToIndex=(n,{align:r="auto",behavior:o="auto"}={})=>{n=Math.max(0,Math.min(n,this.options.count-1));const s=this.getOffsetForIndex(n,r);if(!s)return;const[i,l]=s,c=this.now();this.scrollState={index:n,align:l,behavior:o,startedAt:c,lastTargetOffset:i,stableFrames:0},this._scrollToOffset(i,{adjustments:void 0,behavior:o}),this.scheduleScrollReconcile()},this.scrollBy=(n,{behavior:r="auto"}={})=>{const o=this.getScrollOffset()+n,s=this.now();this.scrollState={index:null,align:"start",behavior:r,startedAt:s,lastTargetOffset:o,stableFrames:0},this._scrollToOffset(o,{adjustments:void 0,behavior:r}),this.scheduleScrollReconcile()},this.scrollToEnd=({behavior:n="auto"}={})=>{if(this.options.count>0){this.scrollToIndex(this.options.count-1,{align:"end",behavior:n});return}this.scrollToOffset(Math.max(this.getTotalSize()-this.getSize(),0),{behavior:n})},this.getTotalSize=()=>{var n;const r=this.getMeasurements();let o;if(r.length===0)o=this.options.paddingStart;else if(this.options.lanes===1){const s=r.length-1,i=this._flatMeasurements;i!=null?o=i[s*2]+i[s*2+1]:o=((n=r[s])==null?void 0:n.end)??0}else{const s=Array(this.options.lanes).fill(null);let i=r.length-1;for(;i>=0&&s.some(l=>l===null);){const l=r[i];s[l.lane]===null&&(s[l.lane]=l.end),i--}o=Math.max(...s.filter(l=>l!==null))}return Math.max(o-this.options.scrollMargin+this.options.paddingEnd,0)},this.takeSnapshot=()=>{const n=[];if(this.itemSizeCache.size===0)return n;const r=this.getMeasurements();for(const o of r)o&&this.itemSizeCache.has(o.key)&&n.push({index:o.index,key:o.key,start:o.start,size:o.size,end:o.end,lane:o.lane});return n},this._scrollToOffset=(n,{adjustments:r,behavior:o})=>{this._intendedScrollOffset=n+(r??0),this.options.scrollToFn(n,{behavior:o,adjustments:r},this)},this.measure=()=>{this.pendingMin=null,this.itemSizeCache.clear(),this.laneAssignments.clear(),this.itemSizeCacheVersion++,this.notify(!1)},this.setOptions(t)}applyScrollAdjustment(t,n){t!==0&&(ou()&&(this.isScrolling||this._iosTouching||this._iosJustTouchEnded)?this._iosDeferredAdjustment+=t:this._scrollToOffset(this.getScrollOffset(),{adjustments:this.scrollAdjustments+=t,behavior:n}))}scheduleScrollReconcile(){if(!this.targetWindow){this.scrollState=null;return}this.rafId==null&&(this.rafId=this.targetWindow.requestAnimationFrame(()=>{this.rafId=null,this.reconcileScroll()}))}reconcileScroll(){if(!this.scrollState||!this.scrollElement)return;if(this.now()-this.scrollState.startedAt>5e3){this.scrollState=null;return}const r=this.scrollState.index!=null?this.getOffsetForIndex(this.scrollState.index,this.scrollState.align):void 0,o=r?r[0]:this.scrollState.lastTargetOffset,s=1,i=o!==this.scrollState.lastTargetOffset;if(!i&&ru(o,this.getScrollOffset())){if(this.scrollState.stableFrames++,this.scrollState.stableFrames>=s){this.getScrollOffset()!==o&&this._scrollToOffset(o,{adjustments:void 0,behavior:"auto"}),this.scrollState=null;return}}else if(this.scrollState.stableFrames=0,i){const l=this.getSize()||600,c=Math.abs(o-this.getScrollOffset()),u=this.scrollState.behavior==="smooth"&&c>l;this.scrollState.lastTargetOffset=o,u||(this.scrollState.behavior="auto"),this._scrollToOffset(o,{adjustments:void 0,behavior:u?"smooth":"auto"})}this.scheduleScrollReconcile()}}const Am=(e,t,n,r)=>{for(;e<=t;){const o=(e+t)/2|0,s=n(o);if(s<r)e=o+1;else if(s>r)t=o-1;else return o}return e>0?e-1:0};function ZN({measurements:e,outerSize:t,scrollOffset:n,lanes:r,flat:o}){const s=e.length-1,i=o?d=>o[d*2]:d=>e[d].start,l=o?d=>o[d*2]+o[d*2+1]:d=>e[d].end;if(e.length<=r)return{startIndex:0,endIndex:s};let c=Am(0,s,i,n),u=c;if(r===1)for(;u<s&&l(u)<n+t;)u++;else if(r>1){const d=Array(r).fill(0);for(;u<s&&d.some(h=>h<n+t);){const h=e[u];d[h.lane]=h.end,u++}const f=Array(r).fill(n+t);for(;c>=0&&f.some(h=>h>=n);){const h=e[c];f[h.lane]=h.start,c--}c=Math.max(0,c-c%r),u=Math.min(s,u+(r-1-u%r))}return{startIndex:c,endIndex:u}}const iu=typeof document<"u"?x.useLayoutEffect:x.useEffect;function Im({useFlushSync:e=!0,...t}){const n=x.useReducer(s=>s+1,0)[1],r={...t,onChange:(s,i)=>{var l;e&&i?Zr.flushSync(n):n(),(l=t.onChange)==null||l.call(t,s,i)}},[o]=x.useState(()=>new VN(r));return o.setOptions(r),iu(()=>o._didMount(),[]),iu(()=>o._willUpdate()),o}function qN(e){return Im({observeElementRect:LN,observeElementOffset:$N,scrollToFn:HN,...e})}function KN(e){return Im({getScrollElement:()=>typeof document<"u"?window:null,observeElementRect:DN,observeElementOffset:BN,scrollToFn:WN,initialOffset:()=>typeof document<"u"?window.scrollY:0,...e})}const GN=22,si=1e4;function JN(e){return e==="added"?"+":e==="removed"?"-":" "}function YN(e){return e==="added"?"bg-green-500/10 text-green-700 dark:text-green-300":e==="removed"?"bg-red-500/10 text-red-700 dark:text-red-300":"text-foreground/80"}const XN=function({result:t,emptyLabel:n}){const[r,o]=x.useState("unified"),s=x.useRef(null),i=qN({count:t.lines.length,getScrollElement:()=>s.current,estimateSize:()=>GN,overscan:10});if(t.isEmpty)return a.jsx("div",{className:"rounded border border-dashed border-border bg-muted/30 px-4 py-6 text-center text-xs text-muted-foreground","data-testid":"diff-empty",children:n??"No transformation applied — raw and processed are identical."});const l=t.lines.length,c=l>si,u=c?t.lines.slice(0,si):t.lines;return a.jsxs("div",{className:"space-y-2",children:[a.jsxs("div",{className:"flex items-center justify-between text-xs text-muted-foreground",children:[a.jsxs("span",{children:[l.toLocaleString()," line",l===1?"":"s",c&&` (showing first ${si.toLocaleString()})`]}),a.jsxs("div",{className:"inline-flex rounded-md border border-border overflow-hidden",children:[a.jsxs("button",{type:"button",onClick:()=>o("unified"),"aria-pressed":r==="unified",className:ve("flex items-center gap-1 px-2 py-1 transition-colors",r==="unified"?"bg-muted text-foreground":"hover:bg-muted/50"),title:"Unified diff (single column)",children:[a.jsx(Y2,{className:"size-3"}),"Unified"]}),a.jsxs("button",{type:"button",onClick:()=>o("split"),"aria-pressed":r==="split",className:ve("flex items-center gap-1 px-2 py-1 transition-colors border-l border-border",r==="split"?"bg-muted text-foreground":"hover:bg-muted/50"),title:"Split diff (side by side)",children:[a.jsx(u2,{className:"size-3"}),"Split"]})]})]}),a.jsx("div",{ref:s,className:"max-h-[60vh] overflow-auto rounded border border-border bg-background font-mono text-xs","data-testid":"diff-viewport",children:r==="unified"?a.jsx(QN,{virtualizer:i,lines:u}):a.jsx(nE,{lines:u})})]})};function QN({virtualizer:e,lines:t}){return a.jsx("div",{style:{height:`${e.getTotalSize()}px`,width:"100%",position:"relative"},children:e.getVirtualItems().map(n=>{const r=t[n.index];return r===void 0?null:a.jsxs("div",{"data-index":n.index,ref:e.measureElement,className:ve("flex items-start gap-3 px-2",YN(r.kind)),style:{position:"absolute",top:0,left:0,width:"100%",transform:`translateY(${n.start}px)`},children:[a.jsx("span",{className:"select-none text-muted-foreground/60 w-10 text-right tabular-nums",children:r.oldLineNumber??""}),a.jsx("span",{className:"select-none text-muted-foreground/60 w-10 text-right tabular-nums",children:r.newLineNumber??""}),a.jsx("span",{className:ve("select-none w-3 text-right font-bold",r.kind==="added"&&"text-green-600 dark:text-green-400",r.kind==="removed"&&"text-red-600 dark:text-red-400"),children:JN(r.kind)}),a.jsx("span",{className:"whitespace-pre-wrap break-all flex-1",children:r.text})]},n.key)})})}function eE(e){const t=[];let n=0;for(;n<e.length;){const r=e[n];if(r===void 0)break;if(r.kind==="context"){t.push({left:{text:r.text,lineNumber:r.oldLineNumber},right:{text:r.text,lineNumber:r.newLineNumber},kind:"equal"}),n+=1;continue}const o=[],s=[];for(;n<e.length&&e[n]?.kind==="removed";){const l=e[n];l!==void 0&&o.push(l),n+=1}for(;n<e.length&&e[n]?.kind==="added";){const l=e[n];l!==void 0&&s.push(l),n+=1}const i=Math.max(o.length,s.length);for(let l=0;l<i;l+=1){const c=o[l],u=s[l];c!==void 0&&u!==void 0?t.push({left:{text:c.text,lineNumber:c.oldLineNumber},right:{text:u.text,lineNumber:u.newLineNumber},kind:"changed"}):c!==void 0?t.push({left:{text:c.text,lineNumber:c.oldLineNumber},right:null,kind:"removed"}):u!==void 0&&t.push({left:null,right:{text:u.text,lineNumber:u.newLineNumber},kind:"added"})}}return t}function tE(e){switch(e){case"changed":return"bg-amber-500/10";case"removed":return"bg-red-500/10";case"added":return"bg-green-500/10";case"equal":return""}}function nE({lines:e}){const t=eE(e);return a.jsx("div",{"data-testid":"diff-split",children:t.map((n,r)=>a.jsxs("div",{className:ve("grid grid-cols-2 font-mono text-xs",tE(n.kind)),children:[a.jsxs("div",{className:"flex items-start gap-2 px-2 border-r border-border/50",children:[a.jsx("span",{className:"select-none text-muted-foreground/60 w-8 text-right tabular-nums",children:n.left?.lineNumber??""}),a.jsx("span",{className:ve("select-none w-3 text-right font-bold",(n.kind==="removed"||n.kind==="changed")&&"text-red-600 dark:text-red-400"),children:n.left!==null?"-":" "}),a.jsx("span",{className:"whitespace-pre-wrap break-all flex-1",children:n.left?.text??""})]}),a.jsxs("div",{className:"flex items-start gap-2 px-2",children:[a.jsx("span",{className:"select-none text-muted-foreground/60 w-8 text-right tabular-nums",children:n.right?.lineNumber??""}),a.jsx("span",{className:ve("select-none w-3 text-right font-bold",(n.kind==="added"||n.kind==="changed")&&"text-green-600 dark:text-green-400"),children:n.right!==null?"+":" "}),a.jsx("span",{className:"whitespace-pre-wrap break-all flex-1",children:n.right?.text??""})]})]},r))})}const zm=x.memo(XN),rE={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:"bg-rose-500/15 text-rose-400 border-rose-500/25",pending:"bg-muted text-muted-foreground border-border"};function xo(e){return e<1e3?`${e}ms`:`${(e/1e3).toFixed(1)}s`}function oE(e){return e>=10?`${e.toFixed(0)}/s`:`${e.toFixed(1)}/s`}function au({trend:e}){if(e===null)return null;const t=e.direction==="up",n=t?Fv:Rv,r=t?"+":"-";return a.jsxs("span",{className:"flex items-center gap-0.5 text-muted-foreground tabular-nums",children:[a.jsx(n,{className:t?"size-3 text-emerald-400":"size-3 text-rose-400"}),a.jsxs("span",{className:"font-mono",children:[r,Ve(e.delta)]})]})}const sE=x.memo(function({log:e,messageCount:t=null,toolCount:n=null,expanded:r,onToggle:o,cacheTrend:s=null,activeTab:i,tabActions:l,onReplay:c,slowResponseThresholdSeconds:u=0,timeDisplayFormat:d}){const f=Ak(e.responseStatus),h=e.elapsedMs!==null&&u>0&&e.elapsedMs>u*1e3,p=e.inputTokens!==null||e.outputTokens!==null,y=e.firstChunkMs??null,m=e.tokensPerSecond??null,g=y===null?null:xo(y),b=m===null||m<=0?null:oE(m);return a.jsx(tt,{children:a.jsxs("div",{id:`log-${e.id}`,role:"button",tabIndex:0,"data-nav-id":`log-${e.id}`,"data-nav-action":r?"collapse":"expand",className:ve("flex items-center gap-2 px-3 py-1 cursor-pointer transition-colors","hover:bg-muted/50","select-none","focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1 focus-visible:outline-none"),onClick:o,onKeyDown:v=>{(v.key==="Enter"||v.key===" ")&&(v.preventDefault(),o())},children:[a.jsxs("span",{className:"text-blue-400/80 font-mono text-xs font-semibold tabular-nums shrink-0",children:["#",e.id]}),a.jsxs("span",{className:"flex items-center gap-1 text-muted-foreground text-xs shrink-0",children:[a.jsx(hn,{className:"size-3"}),a.jsx("span",{className:"font-mono tabular-nums",title:e.timestamp,children:Di(e.timestamp,d)})]}),e.model!==null&&a.jsxs(Fe,{children:[a.jsx($e,{asChild:!0,children:a.jsx("span",{className:"shrink-0",children:a.jsx(wm,{provider:vm(e.model),className:"size-4"})})}),a.jsx(Be,{children:e.model})]}),f!=="success"&&a.jsxs(st,{variant:"outline",className:ve("text-[10px] px-1.5 py-0 h-5 font-mono tabular-nums gap-1",rE[f]),children:[f==="server_error"?a.jsx(U2,{className:"size-3","aria-label":"Server error"}):f==="client_error"?a.jsx(Lo,{className:"size-3","aria-label":"Client error"}):f==="pending"?a.jsx(Wt,{className:"size-3 animate-spin","aria-label":"Pending"}):null,e.responseStatus]}),e.elapsedMs!==null&&a.jsxs(Fe,{children:[a.jsx($e,{asChild:!0,children:a.jsxs("span",{className:ve("flex items-center gap-1 text-xs shrink-0",h?"text-amber-400":"text-muted-foreground"),children:[a.jsx(hn,{className:"size-3"}),a.jsx("span",{className:"font-mono tabular-nums",children:xo(e.elapsedMs)}),h&&a.jsx(Lo,{className:"size-3","aria-label":"Slow response"})]})}),a.jsx(Be,{children:h?`Slow response: ${xo(e.elapsedMs)} exceeds ${xo(u*1e3)}`:e.streaming?"Total streaming response time":"Elapsed response time"})]}),e.streaming&&g!==null&&a.jsxs(Fe,{children:[a.jsx($e,{asChild:!0,children:a.jsxs("span",{className:"flex items-center gap-1 text-xs text-cyan-400 shrink-0",children:[a.jsx(pc,{className:"size-3"}),a.jsxs("span",{className:"font-mono tabular-nums",children:["first ",g]})]})}),a.jsx(Be,{children:"Time to first streaming chunk"})]}),e.streaming&&b!==null&&a.jsxs(Fe,{children:[a.jsx($e,{asChild:!0,children:a.jsxs("span",{className:"flex items-center gap-1 text-xs text-emerald-400 shrink-0",children:[a.jsx(Af,{className:"size-3"}),a.jsx("span",{className:"font-mono tabular-nums",children:b})]})}),a.jsx(Be,{children:"Output token throughput after first chunk"})]}),p&&a.jsxs("span",{className:"flex items-center gap-1 text-xs shrink-0",children:[a.jsx(Dr,{className:"size-3 text-muted-foreground"}),a.jsxs("span",{className:"font-mono tabular-nums",children:[a.jsxs("span",{className:e.inputTokens!==null?"text-blue-400":"text-muted-foreground",children:["IN ",e.inputTokens!==null?Ve(e.inputTokens):"—"]})," / ",a.jsxs("span",{className:e.outputTokens!==null?"text-amber-400":"text-muted-foreground",children:["OUT ",e.outputTokens!==null?Ve(e.outputTokens):"—"]})]})]}),e.cacheCreationInputTokens!==null&&e.cacheCreationInputTokens>0&&a.jsxs("span",{className:"flex items-center gap-1 text-xs shrink-0",children:[a.jsx(au,{trend:s?.creation??null}),a.jsxs("span",{className:"font-mono tabular-nums text-emerald-400",children:["KV Cache +",Ve(e.cacheCreationInputTokens)]})]}),e.cacheReadInputTokens!==null&&e.cacheReadInputTokens>0&&a.jsxs("span",{className:"flex items-center gap-1 text-xs shrink-0",children:[a.jsx(au,{trend:s?.read??null}),a.jsxs("span",{className:"font-mono tabular-nums text-purple-400",children:["KV Cache ~",Ve(e.cacheReadInputTokens)]})]}),t!==null&&a.jsxs("span",{className:"flex items-center gap-1 text-muted-foreground text-xs shrink-0",children:[a.jsx(fs,{className:"size-3"}),a.jsx("span",{className:"font-mono tabular-nums",children:t})]}),n!==null&&a.jsxs("span",{className:"flex items-center gap-1 text-muted-foreground text-xs shrink-0",children:[a.jsx(qr,{className:"size-3"}),a.jsx("span",{className:"font-mono tabular-nums",children:n})]}),e.origin!==null&&a.jsxs("span",{className:"hidden xl:flex items-center gap-1 text-muted-foreground text-xs shrink-0",title:`Origin: ${e.origin}`,children:[a.jsx(If,{className:"size-3"}),a.jsx("span",{className:"font-mono tabular-nums truncate max-w-[120px]",title:e.origin,children:e.origin})]}),(e.clientPid!==null||e.clientProjectFolder!==null)&&a.jsxs(Fe,{children:[a.jsx($e,{asChild:!0,children:a.jsxs("span",{className:"hidden xl:flex items-center gap-1 text-purple-400/80 text-xs shrink-0",children:[a.jsx(_2,{className:"size-3"}),e.clientProjectFolder!==null?a.jsx("span",{className:"font-mono tabular-nums",children:e.clientProjectFolder}):a.jsxs("span",{className:"font-mono tabular-nums",children:["PID ",e.clientPid]})]})}),a.jsx(Be,{children:e.clientCwd!==null?`PID: ${e.clientPid??"?"} CWD: ${e.clientCwd}`:`Process ID: ${e.clientPid??"?"}`})]}),e.streaming&&a.jsxs(Fe,{children:[a.jsx($e,{asChild:!0,children:a.jsx(pc,{className:"size-3 text-muted-foreground/60 shrink-0"})}),a.jsx(Be,{children:"Request used SSE streaming"})]}),a.jsx("span",{className:"flex-1 min-w-0"}),r&&a.jsxs("span",{className:"flex items-center gap-1.5 shrink-0",onClick:v=>v.stopPropagation(),onKeyDown:v=>v.stopPropagation(),children:[l!==void 0&&i!==void 0&&(()=>{const v=l[i];return v===void 0?null:a.jsxs(a.Fragment,{children:[v.expansion!==null&&a.jsxs(Fe,{children:[a.jsx($e,{asChild:!0,children:a.jsx(Ae,{variant:"outline",size:"icon",className:"size-8",onClick:v.expansion.onToggle,disabled:v.expansion.isPending,"aria-pressed":v.expansion.isExpanded,"aria-label":v.expansion.isExpanded?"Collapse all JSON":"Expand all JSON",children:v.expansion.isExpanded?a.jsx(Jv,{className:"size-3.5"}):a.jsx(Ef,{className:"size-3.5"})})}),a.jsx(Be,{children:v.expansion.isExpanded?"Collapse all JSON nodes":"Expand all JSON nodes"})]}),v.diffWithRaw!==void 0&&a.jsxs(Fe,{children:[a.jsx($e,{asChild:!0,children:a.jsx(Ae,{variant:"outline",size:"icon",className:ve("size-8",v.diffWithRaw.active&&"bg-accent text-accent-foreground"),onClick:v.diffWithRaw.onToggle,"aria-pressed":v.diffWithRaw.active,"aria-label":v.diffWithRaw.active?"Hide raw diff":"Diff with raw",children:a.jsx(y2,{className:"size-3.5"})})}),a.jsx(Be,{children:v.diffWithRaw.active?"Hide diff with raw request":"Show diff between displayed and raw request body"})]}),v.diffWithPrevious!==void 0&&a.jsxs(Fe,{children:[a.jsx($e,{asChild:!0,children:a.jsx(Ae,{variant:"outline",size:"icon",className:"size-8",onClick:v.diffWithPrevious,"aria-label":"Diff with previous",children:a.jsx(I2,{className:"size-3.5"})})}),a.jsx(Be,{children:"Compare this request with the immediately preceding one"})]}),v.copyText!==null&&a.jsxs(Fe,{children:[a.jsx($e,{asChild:!0,children:a.jsx(Ae,{variant:"outline",size:"icon",className:"size-8",onClick:v.onCopy,"aria-label":v.copyCopied?"Copied":v.copyLabel,children:v.copyCopied?a.jsx(rt,{className:"size-3.5 text-emerald-500"}):a.jsx(_t,{className:"size-3.5"})})}),a.jsx(Be,{children:v.copyCopied?"Copied to clipboard":v.copyLabel})]})]})})(),c!==void 0&&a.jsxs(Fe,{children:[a.jsx($e,{asChild:!0,children:a.jsx(Ae,{variant:"outline",size:"icon",className:"size-8",onClick:c,"aria-label":"Replay request",children:a.jsx(K2,{className:"size-3.5"})})}),a.jsx(Be,{children:"Re-send this request to the provider"})]})]}),r?a.jsx(Zt,{className:"size-4 text-muted-foreground shrink-0"}):a.jsx(on,{className:"size-4 text-muted-foreground shrink-0"})]})})});function iE({...e}){return a.jsx(o_,{"data-slot":"collapsible",...e})}function TO({...e}){return a.jsx(op,{"data-slot":"collapsible-trigger",...e})}function aE({...e}){return a.jsx(sp,{"data-slot":"collapsible-content",...e})}function lE(e,t){const n={};return(e[e.length-1]===""?[...e,""]:e).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const cE=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,uE=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,dE={};function lu(e,t){return(dE.jsx?uE:cE).test(e)}const fE=/[ \t\n\f\r]/g;function pE(e){return typeof e=="object"?e.type==="text"?cu(e.value):!1:cu(e)}function cu(e){return e.replace(fE,"")===""}class Yr{constructor(t,n,r){this.normal=n,this.property=t,r&&(this.space=r)}}Yr.prototype.normal={};Yr.prototype.property={};Yr.prototype.space=void 0;function Rm(e,t){const n={},r={};for(const o of e)Object.assign(n,o.property),Object.assign(r,o.normal);return new Yr(n,r,t)}function na(e){return e.toLowerCase()}class ht{constructor(t,n){this.attribute=n,this.property=t}}ht.prototype.attribute="";ht.prototype.booleanish=!1;ht.prototype.boolean=!1;ht.prototype.commaOrSpaceSeparated=!1;ht.prototype.commaSeparated=!1;ht.prototype.defined=!1;ht.prototype.mustUseProperty=!1;ht.prototype.number=!1;ht.prototype.overloadedBoolean=!1;ht.prototype.property="";ht.prototype.spaceSeparated=!1;ht.prototype.space=void 0;let hE=0;const Ee=Mn(),Qe=Mn(),ra=Mn(),ue=Mn(),We=Mn(),Xn=Mn(),gt=Mn();function Mn(){return 2**++hE}const oa=Object.freeze(Object.defineProperty({__proto__:null,boolean:Ee,booleanish:Qe,commaOrSpaceSeparated:gt,commaSeparated:Xn,number:ue,overloadedBoolean:ra,spaceSeparated:We},Symbol.toStringTag,{value:"Module"})),ii=Object.keys(oa);class dl extends ht{constructor(t,n,r,o){let s=-1;if(super(t,n),uu(this,"space",o),typeof r=="number")for(;++s<ii.length;){const i=ii[s];uu(this,ii[s],(r&oa[i])===oa[i])}}}dl.prototype.defined=!0;function uu(e,t,n){n&&(e[t]=n)}function hr(e){const t={},n={};for(const[r,o]of Object.entries(e.properties)){const s=new dl(r,e.transform(e.attributes||{},r),o,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(s.mustUseProperty=!0),t[r]=s,n[na(r)]=r,n[na(s.attribute)]=r}return new Yr(t,n,e.space)}const Pm=hr({properties:{ariaActiveDescendant:null,ariaAtomic:Qe,ariaAutoComplete:null,ariaBusy:Qe,ariaChecked:Qe,ariaColCount:ue,ariaColIndex:ue,ariaColSpan:ue,ariaControls:We,ariaCurrent:null,ariaDescribedBy:We,ariaDetails:null,ariaDisabled:Qe,ariaDropEffect:We,ariaErrorMessage:null,ariaExpanded:Qe,ariaFlowTo:We,ariaGrabbed:Qe,ariaHasPopup:null,ariaHidden:Qe,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:We,ariaLevel:ue,ariaLive:null,ariaModal:Qe,ariaMultiLine:Qe,ariaMultiSelectable:Qe,ariaOrientation:null,ariaOwns:We,ariaPlaceholder:null,ariaPosInSet:ue,ariaPressed:Qe,ariaReadOnly:Qe,ariaRelevant:null,ariaRequired:Qe,ariaRoleDescription:We,ariaRowCount:ue,ariaRowIndex:ue,ariaRowSpan:ue,ariaSelected:Qe,ariaSetSize:ue,ariaSort:null,ariaValueMax:ue,ariaValueMin:ue,ariaValueNow:ue,ariaValueText:null,role:null},transform(e,t){return t==="role"?t:"aria-"+t.slice(4).toLowerCase()}});function Om(e,t){return t in e?e[t]:t}function Mm(e,t){return Om(e,t.toLowerCase())}const mE=hr({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:Xn,acceptCharset:We,accessKey:We,action:null,allow:null,allowFullScreen:Ee,allowPaymentRequest:Ee,allowUserMedia:Ee,alt:null,as:null,async:Ee,autoCapitalize:null,autoComplete:We,autoFocus:Ee,autoPlay:Ee,blocking:We,capture:null,charSet:null,checked:Ee,cite:null,className:We,cols:ue,colSpan:null,content:null,contentEditable:Qe,controls:Ee,controlsList:We,coords:ue|Xn,crossOrigin:null,data:null,dateTime:null,decoding:null,default:Ee,defer:Ee,dir:null,dirName:null,disabled:Ee,download:ra,draggable:Qe,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:Ee,formTarget:null,headers:We,height:ue,hidden:ra,high:ue,href:null,hrefLang:null,htmlFor:We,httpEquiv:We,id:null,imageSizes:null,imageSrcSet:null,inert:Ee,inputMode:null,integrity:null,is:null,isMap:Ee,itemId:null,itemProp:We,itemRef:We,itemScope:Ee,itemType:We,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:Ee,low:ue,manifest:null,max:null,maxLength:ue,media:null,method:null,min:null,minLength:ue,multiple:Ee,muted:Ee,name:null,nonce:null,noModule:Ee,noValidate:Ee,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:Ee,optimum:ue,pattern:null,ping:We,placeholder:null,playsInline:Ee,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:Ee,referrerPolicy:null,rel:We,required:Ee,reversed:Ee,rows:ue,rowSpan:ue,sandbox:We,scope:null,scoped:Ee,seamless:Ee,selected:Ee,shadowRootClonable:Ee,shadowRootDelegatesFocus:Ee,shadowRootMode:null,shape:null,size:ue,sizes:null,slot:null,span:ue,spellCheck:Qe,src:null,srcDoc:null,srcLang:null,srcSet:null,start:ue,step:null,style:null,tabIndex:ue,target:null,title:null,translate:null,type:null,typeMustMatch:Ee,useMap:null,value:Qe,width:ue,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:We,axis:null,background:null,bgColor:null,border:ue,borderColor:null,bottomMargin:ue,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:Ee,declare:Ee,event:null,face:null,frame:null,frameBorder:null,hSpace:ue,leftMargin:ue,link:null,longDesc:null,lowSrc:null,marginHeight:ue,marginWidth:ue,noResize:Ee,noHref:Ee,noShade:Ee,noWrap:Ee,object:null,profile:null,prompt:null,rev:null,rightMargin:ue,rules:null,scheme:null,scrolling:Qe,standby:null,summary:null,text:null,topMargin:ue,valueType:null,version:null,vAlign:null,vLink:null,vSpace:ue,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:Ee,disableRemotePlayback:Ee,prefix:null,property:null,results:ue,security:null,unselectable:null},space:"html",transform:Mm}),gE=hr({attributes:{accentHeight:"accent-height",alignmentBaseline:"alignment-baseline",arabicForm:"arabic-form",baselineShift:"baseline-shift",capHeight:"cap-height",className:"class",clipPath:"clip-path",clipRule:"clip-rule",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorProfile:"color-profile",colorRendering:"color-rendering",crossOrigin:"crossorigin",dataType:"datatype",dominantBaseline:"dominant-baseline",enableBackground:"enable-background",fillOpacity:"fill-opacity",fillRule:"fill-rule",floodColor:"flood-color",floodOpacity:"flood-opacity",fontFamily:"font-family",fontSize:"font-size",fontSizeAdjust:"font-size-adjust",fontStretch:"font-stretch",fontStyle:"font-style",fontVariant:"font-variant",fontWeight:"font-weight",glyphName:"glyph-name",glyphOrientationHorizontal:"glyph-orientation-horizontal",glyphOrientationVertical:"glyph-orientation-vertical",hrefLang:"hreflang",horizAdvX:"horiz-adv-x",horizOriginX:"horiz-origin-x",horizOriginY:"horiz-origin-y",imageRendering:"image-rendering",letterSpacing:"letter-spacing",lightingColor:"lighting-color",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",navDown:"nav-down",navDownLeft:"nav-down-left",navDownRight:"nav-down-right",navLeft:"nav-left",navNext:"nav-next",navPrev:"nav-prev",navRight:"nav-right",navUp:"nav-up",navUpLeft:"nav-up-left",navUpRight:"nav-up-right",onAbort:"onabort",onActivate:"onactivate",onAfterPrint:"onafterprint",onBeforePrint:"onbeforeprint",onBegin:"onbegin",onCancel:"oncancel",onCanPlay:"oncanplay",onCanPlayThrough:"oncanplaythrough",onChange:"onchange",onClick:"onclick",onClose:"onclose",onCopy:"oncopy",onCueChange:"oncuechange",onCut:"oncut",onDblClick:"ondblclick",onDrag:"ondrag",onDragEnd:"ondragend",onDragEnter:"ondragenter",onDragExit:"ondragexit",onDragLeave:"ondragleave",onDragOver:"ondragover",onDragStart:"ondragstart",onDrop:"ondrop",onDurationChange:"ondurationchange",onEmptied:"onemptied",onEnd:"onend",onEnded:"onended",onError:"onerror",onFocus:"onfocus",onFocusIn:"onfocusin",onFocusOut:"onfocusout",onHashChange:"onhashchange",onInput:"oninput",onInvalid:"oninvalid",onKeyDown:"onkeydown",onKeyPress:"onkeypress",onKeyUp:"onkeyup",onLoad:"onload",onLoadedData:"onloadeddata",onLoadedMetadata:"onloadedmetadata",onLoadStart:"onloadstart",onMessage:"onmessage",onMouseDown:"onmousedown",onMouseEnter:"onmouseenter",onMouseLeave:"onmouseleave",onMouseMove:"onmousemove",onMouseOut:"onmouseout",onMouseOver:"onmouseover",onMouseUp:"onmouseup",onMouseWheel:"onmousewheel",onOffline:"onoffline",onOnline:"ononline",onPageHide:"onpagehide",onPageShow:"onpageshow",onPaste:"onpaste",onPause:"onpause",onPlay:"onplay",onPlaying:"onplaying",onPopState:"onpopstate",onProgress:"onprogress",onRateChange:"onratechange",onRepeat:"onrepeat",onReset:"onreset",onResize:"onresize",onScroll:"onscroll",onSeeked:"onseeked",onSeeking:"onseeking",onSelect:"onselect",onShow:"onshow",onStalled:"onstalled",onStorage:"onstorage",onSubmit:"onsubmit",onSuspend:"onsuspend",onTimeUpdate:"ontimeupdate",onToggle:"ontoggle",onUnload:"onunload",onVolumeChange:"onvolumechange",onWaiting:"onwaiting",onZoom:"onzoom",overlinePosition:"overline-position",overlineThickness:"overline-thickness",paintOrder:"paint-order",panose1:"panose-1",pointerEvents:"pointer-events",referrerPolicy:"referrerpolicy",renderingIntent:"rendering-intent",shapeRendering:"shape-rendering",stopColor:"stop-color",stopOpacity:"stop-opacity",strikethroughPosition:"strikethrough-position",strikethroughThickness:"strikethrough-thickness",strokeDashArray:"stroke-dasharray",strokeDashOffset:"stroke-dashoffset",strokeLineCap:"stroke-linecap",strokeLineJoin:"stroke-linejoin",strokeMiterLimit:"stroke-miterlimit",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",tabIndex:"tabindex",textAnchor:"text-anchor",textDecoration:"text-decoration",textRendering:"text-rendering",transformOrigin:"transform-origin",typeOf:"typeof",underlinePosition:"underline-position",underlineThickness:"underline-thickness",unicodeBidi:"unicode-bidi",unicodeRange:"unicode-range",unitsPerEm:"units-per-em",vAlphabetic:"v-alphabetic",vHanging:"v-hanging",vIdeographic:"v-ideographic",vMathematical:"v-mathematical",vectorEffect:"vector-effect",vertAdvY:"vert-adv-y",vertOriginX:"vert-origin-x",vertOriginY:"vert-origin-y",wordSpacing:"word-spacing",writingMode:"writing-mode",xHeight:"x-height",playbackOrder:"playbackorder",timelineBegin:"timelinebegin"},properties:{about:gt,accentHeight:ue,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:ue,amplitude:ue,arabicForm:null,ascent:ue,attributeName:null,attributeType:null,azimuth:ue,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:ue,by:null,calcMode:null,capHeight:ue,className:We,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:ue,diffuseConstant:ue,direction:null,display:null,dur:null,divisor:ue,dominantBaseline:null,download:Ee,dx:null,dy:null,edgeMode:null,editable:null,elevation:ue,enableBackground:null,end:null,event:null,exponent:ue,externalResourcesRequired:null,fill:null,fillOpacity:ue,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:Xn,g2:Xn,glyphName:Xn,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:ue,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:ue,horizOriginX:ue,horizOriginY:ue,id:null,ideographic:ue,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:ue,k:ue,k1:ue,k2:ue,k3:ue,k4:ue,kernelMatrix:gt,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:ue,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:ue,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:ue,overlineThickness:ue,paintOrder:null,panose1:null,path:null,pathLength:ue,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:We,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:ue,pointsAtY:ue,pointsAtZ:ue,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:gt,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:gt,rev:gt,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:gt,requiredFeatures:gt,requiredFonts:gt,requiredFormats:gt,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:ue,specularExponent:ue,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:ue,strikethroughThickness:ue,string:null,stroke:null,strokeDashArray:gt,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:ue,strokeOpacity:ue,strokeWidth:null,style:null,surfaceScale:ue,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:gt,tabIndex:ue,tableValues:null,target:null,targetX:ue,targetY:ue,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:gt,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:ue,underlineThickness:ue,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:ue,values:null,vAlphabetic:ue,vMathematical:ue,vectorEffect:null,vHanging:ue,vIdeographic:ue,version:null,vertAdvY:ue,vertOriginX:ue,vertOriginY:ue,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:ue,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:Om}),Lm=hr({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform(e,t){return"xlink:"+t.slice(5).toLowerCase()}}),Dm=hr({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:Mm}),Fm=hr({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,t){return"xml:"+t.slice(3).toLowerCase()}}),xE={classId:"classID",dataType:"datatype",itemId:"itemID",strokeDashArray:"strokeDasharray",strokeDashOffset:"strokeDashoffset",strokeLineCap:"strokeLinecap",strokeLineJoin:"strokeLinejoin",strokeMiterLimit:"strokeMiterlimit",typeOf:"typeof",xLinkActuate:"xlinkActuate",xLinkArcRole:"xlinkArcrole",xLinkHref:"xlinkHref",xLinkRole:"xlinkRole",xLinkShow:"xlinkShow",xLinkTitle:"xlinkTitle",xLinkType:"xlinkType",xmlnsXLink:"xmlnsXlink"},bE=/[A-Z]/g,du=/-[a-z]/g,yE=/^data[-\w.:]+$/i;function vE(e,t){const n=na(t);let r=t,o=ht;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)==="data"&&yE.test(t)){if(t.charAt(4)==="-"){const s=t.slice(5).replace(du,kE);r="data"+s.charAt(0).toUpperCase()+s.slice(1)}else{const s=t.slice(4);if(!du.test(s)){let i=s.replace(bE,wE);i.charAt(0)!=="-"&&(i="-"+i),t="data"+i}}o=dl}return new o(r,t)}function wE(e){return"-"+e.toLowerCase()}function kE(e){return e.charAt(1).toUpperCase()}const _E=Rm([Pm,mE,Lm,Dm,Fm],"html"),fl=Rm([Pm,gE,Lm,Dm,Fm],"svg");function SE(e){return e.join(" ").trim()}var Un={},ai,fu;function CE(){if(fu)return ai;fu=1;var e=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,t=/\n/g,n=/^\s*/,r=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,o=/^:\s*/,s=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,i=/^[;\s]*/,l=/^\s+|\s+$/g,c=`
|
|
94
|
-
`,u="/",d="*",f="",h="comment",p="declaration";function y(g,b){if(typeof g!="string")throw new TypeError("First argument must be a string");if(!g)return[];b=b||{};var v=1,k=1;function S(w){var L=w.match(t);L&&(v+=L.length);var W=w.lastIndexOf(c);k=~W?w.length-W:k+w.length}function C(){var w={line:v,column:k};return function(L){return L.position=new j(w),z(),L}}function j(w){this.start=w,this.end={line:v,column:k},this.source=b.source}j.prototype.content=g;function E(w){var L=new Error(b.source+":"+v+":"+k+": "+w);if(L.reason=w,L.filename=b.source,L.line=v,L.column=k,L.source=g,!b.silent)throw L}function T(w){var L=w.exec(g);if(L){var W=L[0];return S(W),g=g.slice(W.length),L}}function z(){T(n)}function O(w){var L;for(w=w||[];L=B();)L!==!1&&w.push(L);return w}function B(){var w=C();if(!(u!=g.charAt(0)||d!=g.charAt(1))){for(var L=2;f!=g.charAt(L)&&(d!=g.charAt(L)||u!=g.charAt(L+1));)++L;if(L+=2,f===g.charAt(L-1))return E("End of comment missing");var W=g.slice(2,L-2);return k+=2,S(W),g=g.slice(L),k+=2,w({type:h,comment:W})}}function N(){var w=C(),L=T(r);if(L){if(B(),!T(o))return E("property missing ':'");var W=T(s),U=w({type:p,property:m(L[0].replace(e,f)),value:W?m(W[0].replace(e,f)):f});return T(i),U}}function D(){var w=[];O(w);for(var L;L=N();)L!==!1&&(w.push(L),O(w));return w}return z(),D()}function m(g){return g?g.replace(l,f):f}return ai=y,ai}var pu;function jE(){if(pu)return Un;pu=1;var e=Un&&Un.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(Un,"__esModule",{value:!0}),Un.default=n;const t=e(CE());function n(r,o){let s=null;if(!r||typeof r!="string")return s;const i=(0,t.default)(r),l=typeof o=="function";return i.forEach(c=>{if(c.type!=="declaration")return;const{property:u,value:d}=c;l?o(u,d,c):d&&(s=s||{},s[u]=d)}),s}return Un}var vr={},hu;function NE(){if(hu)return vr;hu=1,Object.defineProperty(vr,"__esModule",{value:!0}),vr.camelCase=void 0;var e=/^--[a-zA-Z0-9_-]+$/,t=/-([a-z])/g,n=/^[^-]+$/,r=/^-(webkit|moz|ms|o|khtml)-/,o=/^-(ms)-/,s=function(u){return!u||n.test(u)||e.test(u)},i=function(u,d){return d.toUpperCase()},l=function(u,d){return"".concat(d,"-")},c=function(u,d){return d===void 0&&(d={}),s(u)?u:(u=u.toLowerCase(),d.reactCompat?u=u.replace(o,l):u=u.replace(r,l),u.replace(t,i))};return vr.camelCase=c,vr}var wr,mu;function EE(){if(mu)return wr;mu=1;var e=wr&&wr.__importDefault||function(o){return o&&o.__esModule?o:{default:o}},t=e(jE()),n=NE();function r(o,s){var i={};return!o||typeof o!="string"||(0,t.default)(o,function(l,c){l&&c&&(i[(0,n.camelCase)(l,s)]=c)}),i}return r.default=r,wr=r,wr}var TE=EE();const AE=ka(TE),$m=Bm("end"),pl=Bm("start");function Bm(e){return t;function t(n){const r=n&&n.position&&n.position[e]||{};if(typeof r.line=="number"&&r.line>0&&typeof r.column=="number"&&r.column>0)return{line:r.line,column:r.column,offset:typeof r.offset=="number"&&r.offset>-1?r.offset:void 0}}}function IE(e){const t=pl(e),n=$m(e);if(t&&n)return{start:t,end:n}}function Ar(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?gu(e.position):"start"in e||"end"in e?gu(e):"line"in e||"column"in e?sa(e):""}function sa(e){return xu(e&&e.line)+":"+xu(e&&e.column)}function gu(e){return sa(e&&e.start)+"-"+sa(e&&e.end)}function xu(e){return e&&typeof e=="number"?e:1}class it extends Error{constructor(t,n,r){super(),typeof n=="string"&&(r=n,n=void 0);let o="",s={},i=!1;if(n&&("line"in n&&"column"in n?s={place:n}:"start"in n&&"end"in n?s={place:n}:"type"in n?s={ancestors:[n],place:n.position}:s={...n}),typeof t=="string"?o=t:!s.cause&&t&&(i=!0,o=t.message,s.cause=t),!s.ruleId&&!s.source&&typeof r=="string"){const c=r.indexOf(":");c===-1?s.ruleId=r:(s.source=r.slice(0,c),s.ruleId=r.slice(c+1))}if(!s.place&&s.ancestors&&s.ancestors){const c=s.ancestors[s.ancestors.length-1];c&&(s.place=c.position)}const l=s.place&&"start"in s.place?s.place.start:s.place;this.ancestors=s.ancestors||void 0,this.cause=s.cause||void 0,this.column=l?l.column:void 0,this.fatal=void 0,this.file="",this.message=o,this.line=l?l.line:void 0,this.name=Ar(s.place)||"1:1",this.place=s.place||void 0,this.reason=this.message,this.ruleId=s.ruleId||void 0,this.source=s.source||void 0,this.stack=i&&s.cause&&typeof s.cause.stack=="string"?s.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}it.prototype.file="";it.prototype.name="";it.prototype.reason="";it.prototype.message="";it.prototype.stack="";it.prototype.column=void 0;it.prototype.line=void 0;it.prototype.ancestors=void 0;it.prototype.cause=void 0;it.prototype.fatal=void 0;it.prototype.place=void 0;it.prototype.ruleId=void 0;it.prototype.source=void 0;const hl={}.hasOwnProperty,zE=new Map,RE=/[A-Z]/g,PE=new Set(["table","tbody","thead","tfoot","tr"]),OE=new Set(["td","th"]),Um="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function ME(e,t){if(!t||t.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const n=t.filePath||void 0;let r;if(t.development){if(typeof t.jsxDEV!="function")throw new TypeError("Expected `jsxDEV` in options when `development: true`");r=HE(n,t.jsxDEV)}else{if(typeof t.jsx!="function")throw new TypeError("Expected `jsx` in production options");if(typeof t.jsxs!="function")throw new TypeError("Expected `jsxs` in production options");r=WE(n,t.jsx,t.jsxs)}const o={Fragment:t.Fragment,ancestors:[],components:t.components||{},create:r,elementAttributeNameCase:t.elementAttributeNameCase||"react",evaluater:t.createEvaluater?t.createEvaluater():void 0,filePath:n,ignoreInvalidStyle:t.ignoreInvalidStyle||!1,passKeys:t.passKeys!==!1,passNode:t.passNode||!1,schema:t.space==="svg"?fl:_E,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},s=Wm(o,e,void 0);return s&&typeof s!="string"?s:o.create(e,o.Fragment,{children:s||void 0},void 0)}function Wm(e,t,n){if(t.type==="element")return LE(e,t,n);if(t.type==="mdxFlowExpression"||t.type==="mdxTextExpression")return DE(e,t);if(t.type==="mdxJsxFlowElement"||t.type==="mdxJsxTextElement")return $E(e,t,n);if(t.type==="mdxjsEsm")return FE(e,t);if(t.type==="root")return BE(e,t,n);if(t.type==="text")return UE(e,t)}function LE(e,t,n){const r=e.schema;let o=r;t.tagName.toLowerCase()==="svg"&&r.space==="html"&&(o=fl,e.schema=o),e.ancestors.push(t);const s=Vm(e,t.tagName,!1),i=VE(e,t);let l=gl(e,t);return PE.has(t.tagName)&&(l=l.filter(function(c){return typeof c=="string"?!pE(c):!0})),Hm(e,i,s,t),ml(i,l),e.ancestors.pop(),e.schema=r,e.create(t,s,i,n)}function DE(e,t){if(t.data&&t.data.estree&&e.evaluater){const r=t.data.estree.body[0];return r.type,e.evaluater.evaluateExpression(r.expression)}Wr(e,t.position)}function FE(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);Wr(e,t.position)}function $E(e,t,n){const r=e.schema;let o=r;t.name==="svg"&&r.space==="html"&&(o=fl,e.schema=o),e.ancestors.push(t);const s=t.name===null?e.Fragment:Vm(e,t.name,!0),i=ZE(e,t),l=gl(e,t);return Hm(e,i,s,t),ml(i,l),e.ancestors.pop(),e.schema=r,e.create(t,s,i,n)}function BE(e,t,n){const r={};return ml(r,gl(e,t)),e.create(t,e.Fragment,r,n)}function UE(e,t){return t.value}function Hm(e,t,n,r){typeof n!="string"&&n!==e.Fragment&&e.passNode&&(t.node=r)}function ml(e,t){if(t.length>0){const n=t.length>1?t:t[0];n&&(e.children=n)}}function WE(e,t,n){return r;function r(o,s,i,l){const u=Array.isArray(i.children)?n:t;return l?u(s,i,l):u(s,i)}}function HE(e,t){return n;function n(r,o,s,i){const l=Array.isArray(s.children),c=pl(r);return t(o,s,i,l,{columnNumber:c?c.column-1:void 0,fileName:e,lineNumber:c?c.line:void 0},void 0)}}function VE(e,t){const n={};let r,o;for(o in t.properties)if(o!=="children"&&hl.call(t.properties,o)){const s=qE(e,o,t.properties[o]);if(s){const[i,l]=s;e.tableCellAlignToStyle&&i==="align"&&typeof l=="string"&&OE.has(t.tagName)?r=l:n[i]=l}}if(r){const s=n.style||(n.style={});s[e.stylePropertyNameCase==="css"?"text-align":"textAlign"]=r}return n}function ZE(e,t){const n={};for(const r of t.attributes)if(r.type==="mdxJsxExpressionAttribute")if(r.data&&r.data.estree&&e.evaluater){const s=r.data.estree.body[0];s.type;const i=s.expression;i.type;const l=i.properties[0];l.type,Object.assign(n,e.evaluater.evaluateExpression(l.argument))}else Wr(e,t.position);else{const o=r.name;let s;if(r.value&&typeof r.value=="object")if(r.value.data&&r.value.data.estree&&e.evaluater){const l=r.value.data.estree.body[0];l.type,s=e.evaluater.evaluateExpression(l.expression)}else Wr(e,t.position);else s=r.value===null?!0:r.value;n[o]=s}return n}function gl(e,t){const n=[];let r=-1;const o=e.passKeys?new Map:zE;for(;++r<t.children.length;){const s=t.children[r];let i;if(e.passKeys){const c=s.type==="element"?s.tagName:s.type==="mdxJsxFlowElement"||s.type==="mdxJsxTextElement"?s.name:void 0;if(c){const u=o.get(c)||0;i=c+"-"+u,o.set(c,u+1)}}const l=Wm(e,s,i);l!==void 0&&n.push(l)}return n}function qE(e,t,n){const r=vE(e.schema,t);if(!(n==null||typeof n=="number"&&Number.isNaN(n))){if(Array.isArray(n)&&(n=r.commaSeparated?lE(n):SE(n)),r.property==="style"){let o=typeof n=="object"?n:KE(e,String(n));return e.stylePropertyNameCase==="css"&&(o=GE(o)),["style",o]}return[e.elementAttributeNameCase==="react"&&r.space?xE[r.property]||r.property:r.attribute,n]}}function KE(e,t){try{return AE(t,{reactCompat:!0})}catch(n){if(e.ignoreInvalidStyle)return{};const r=n,o=new it("Cannot parse `style` attribute",{ancestors:e.ancestors,cause:r,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw o.file=e.filePath||void 0,o.url=Um+"#cannot-parse-style-attribute",o}}function Vm(e,t,n){let r;if(!n)r={type:"Literal",value:t};else if(t.includes(".")){const o=t.split(".");let s=-1,i;for(;++s<o.length;){const l=lu(o[s])?{type:"Identifier",name:o[s]}:{type:"Literal",value:o[s]};i=i?{type:"MemberExpression",object:i,property:l,computed:!!(s&&l.type==="Literal"),optional:!1}:l}r=i}else r=lu(t)&&!/^[a-z]/.test(t)?{type:"Identifier",name:t}:{type:"Literal",value:t};if(r.type==="Literal"){const o=r.value;return hl.call(e.components,o)?e.components[o]:o}if(e.evaluater)return e.evaluater.evaluateExpression(r);Wr(e)}function Wr(e,t){const n=new it("Cannot handle MDX estrees without `createEvaluater`",{ancestors:e.ancestors,place:t,ruleId:"mdx-estree",source:"hast-util-to-jsx-runtime"});throw n.file=e.filePath||void 0,n.url=Um+"#cannot-handle-mdx-estrees-without-createevaluater",n}function GE(e){const t={};let n;for(n in e)hl.call(e,n)&&(t[JE(n)]=e[n]);return t}function JE(e){let t=e.replace(RE,YE);return t.slice(0,3)==="ms-"&&(t="-"+t),t}function YE(e){return"-"+e.toLowerCase()}const li={action:["form"],cite:["blockquote","del","ins","q"],data:["object"],formAction:["button","input"],href:["a","area","base","link"],icon:["menuitem"],itemId:null,manifest:["html"],ping:["a","area"],poster:["video"],src:["audio","embed","iframe","img","input","script","source","track","video"]},XE={};function QE(e,t){const n=XE,r=typeof n.includeImageAlt=="boolean"?n.includeImageAlt:!0,o=typeof n.includeHtml=="boolean"?n.includeHtml:!0;return Zm(e,r,o)}function Zm(e,t,n){if(e3(e)){if("value"in e)return e.type==="html"&&!n?"":e.value;if(t&&"alt"in e&&e.alt)return e.alt;if("children"in e)return bu(e.children,t,n)}return Array.isArray(e)?bu(e,t,n):""}function bu(e,t,n){const r=[];let o=-1;for(;++o<e.length;)r[o]=Zm(e[o],t,n);return r.join("")}function e3(e){return!!(e&&typeof e=="object")}const yu=document.createElement("i");function xl(e){const t="&"+e+";";yu.innerHTML=t;const n=yu.textContent;return n.charCodeAt(n.length-1)===59&&e!=="semi"||n===t?!1:n}function Vt(e,t,n,r){const o=e.length;let s=0,i;if(t<0?t=-t>o?0:o+t:t=t>o?o:t,n=n>0?n:0,r.length<1e4)i=Array.from(r),i.unshift(t,n),e.splice(...i);else for(n&&e.splice(t,n);s<r.length;)i=r.slice(s,s+1e4),i.unshift(t,0),e.splice(...i),s+=1e4,t+=1e4}function wt(e,t){return e.length>0?(Vt(e,e.length,0,t),e):t}const vu={}.hasOwnProperty;function t3(e){const t={};let n=-1;for(;++n<e.length;)n3(t,e[n]);return t}function n3(e,t){let n;for(n in t){const o=(vu.call(e,n)?e[n]:void 0)||(e[n]={}),s=t[n];let i;if(s)for(i in s){vu.call(o,i)||(o[i]=[]);const l=s[i];r3(o[i],Array.isArray(l)?l:l?[l]:[])}}}function r3(e,t){let n=-1;const r=[];for(;++n<t.length;)(t[n].add==="after"?e:r).push(t[n]);Vt(e,0,0,r)}function qm(e,t){const n=Number.parseInt(e,t);return n<9||n===11||n>13&&n<32||n>126&&n<160||n>55295&&n<57344||n>64975&&n<65008||(n&65535)===65535||(n&65535)===65534||n>1114111?"�":String.fromCodePoint(n)}function Qn(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const Ft=kn(/[A-Za-z]/),yt=kn(/[\dA-Za-z]/),o3=kn(/[#-'*+\--9=?A-Z^-~]/);function ia(e){return e!==null&&(e<32||e===127)}const aa=kn(/\d/),s3=kn(/[\dA-Fa-f]/),i3=kn(/[!-/:-@[-`{-~]/);function Ce(e){return e!==null&&e<-2}function dt(e){return e!==null&&(e<0||e===32)}function Le(e){return e===-2||e===-1||e===32}const a3=kn(new RegExp("\\p{P}|\\p{S}","u")),l3=kn(/\s/);function kn(e){return t;function t(n){return n!==null&&n>-1&&e.test(String.fromCharCode(n))}}function mr(e){const t=[];let n=-1,r=0,o=0;for(;++n<e.length;){const s=e.charCodeAt(n);let i="";if(s===37&&yt(e.charCodeAt(n+1))&&yt(e.charCodeAt(n+2)))o=2;else if(s<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(s))||(i=String.fromCharCode(s));else if(s>55295&&s<57344){const l=e.charCodeAt(n+1);s<56320&&l>56319&&l<57344?(i=String.fromCharCode(s,l),o=1):i="�"}else i=String.fromCharCode(s);i&&(t.push(e.slice(r,n),encodeURIComponent(i)),r=n+o+1,i=""),o&&(n+=o,o=0)}return t.join("")+e.slice(r)}function He(e,t,n,r){const o=r?r-1:Number.POSITIVE_INFINITY;let s=0;return i;function i(c){return Le(c)?(e.enter(n),l(c)):t(c)}function l(c){return Le(c)&&s++<o?(e.consume(c),l):(e.exit(n),t(c))}}const c3={tokenize:u3};function u3(e){const t=e.attempt(this.parser.constructs.contentInitial,r,o);let n;return t;function r(l){if(l===null){e.consume(l);return}return e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),He(e,t,"linePrefix")}function o(l){return e.enter("paragraph"),s(l)}function s(l){const c=e.enter("chunkText",{contentType:"text",previous:n});return n&&(n.next=c),n=c,i(l)}function i(l){if(l===null){e.exit("chunkText"),e.exit("paragraph"),e.consume(l);return}return Ce(l)?(e.consume(l),e.exit("chunkText"),s):(e.consume(l),i)}}const d3={tokenize:f3},wu={tokenize:p3};function f3(e){const t=this,n=[];let r=0,o,s,i;return l;function l(k){if(r<n.length){const S=n[r];return t.containerState=S[1],e.attempt(S[0].continuation,c,u)(k)}return u(k)}function c(k){if(r++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,o&&v();const S=t.events.length;let C=S,j;for(;C--;)if(t.events[C][0]==="exit"&&t.events[C][1].type==="chunkFlow"){j=t.events[C][1].end;break}b(r);let E=S;for(;E<t.events.length;)t.events[E][1].end={...j},E++;return Vt(t.events,C+1,0,t.events.slice(S)),t.events.length=E,u(k)}return l(k)}function u(k){if(r===n.length){if(!o)return h(k);if(o.currentConstruct&&o.currentConstruct.concrete)return y(k);t.interrupt=!!(o.currentConstruct&&!o._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(wu,d,f)(k)}function d(k){return o&&v(),b(r),h(k)}function f(k){return t.parser.lazy[t.now().line]=r!==n.length,i=t.now().offset,y(k)}function h(k){return t.containerState={},e.attempt(wu,p,y)(k)}function p(k){return r++,n.push([t.currentConstruct,t.containerState]),h(k)}function y(k){if(k===null){o&&v(),b(0),e.consume(k);return}return o=o||t.parser.flow(t.now()),e.enter("chunkFlow",{_tokenizer:o,contentType:"flow",previous:s}),m(k)}function m(k){if(k===null){g(e.exit("chunkFlow"),!0),b(0),e.consume(k);return}return Ce(k)?(e.consume(k),g(e.exit("chunkFlow")),r=0,t.interrupt=void 0,l):(e.consume(k),m)}function g(k,S){const C=t.sliceStream(k);if(S&&C.push(null),k.previous=s,s&&(s.next=k),s=k,o.defineSkip(k.start),o.write(C),t.parser.lazy[k.start.line]){let j=o.events.length;for(;j--;)if(o.events[j][1].start.offset<i&&(!o.events[j][1].end||o.events[j][1].end.offset>i))return;const E=t.events.length;let T=E,z,O;for(;T--;)if(t.events[T][0]==="exit"&&t.events[T][1].type==="chunkFlow"){if(z){O=t.events[T][1].end;break}z=!0}for(b(r),j=E;j<t.events.length;)t.events[j][1].end={...O},j++;Vt(t.events,T+1,0,t.events.slice(E)),t.events.length=j}}function b(k){let S=n.length;for(;S-- >k;){const C=n[S];t.containerState=C[1],C[0].exit.call(t,e)}n.length=k}function v(){o.write([null]),s=void 0,o=void 0,t.containerState._closeFlow=void 0}}function p3(e,t,n){return He(e,e.attempt(this.parser.constructs.document,t,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function ku(e){if(e===null||dt(e)||l3(e))return 1;if(a3(e))return 2}function bl(e,t,n){const r=[];let o=-1;for(;++o<e.length;){const s=e[o].resolveAll;s&&!r.includes(s)&&(t=s(t,n),r.push(s))}return t}const la={name:"attention",resolveAll:h3,tokenize:m3};function h3(e,t){let n=-1,r,o,s,i,l,c,u,d;for(;++n<e.length;)if(e[n][0]==="enter"&&e[n][1].type==="attentionSequence"&&e[n][1]._close){for(r=n;r--;)if(e[r][0]==="exit"&&e[r][1].type==="attentionSequence"&&e[r][1]._open&&t.sliceSerialize(e[r][1]).charCodeAt(0)===t.sliceSerialize(e[n][1]).charCodeAt(0)){if((e[r][1]._close||e[n][1]._open)&&(e[n][1].end.offset-e[n][1].start.offset)%3&&!((e[r][1].end.offset-e[r][1].start.offset+e[n][1].end.offset-e[n][1].start.offset)%3))continue;c=e[r][1].end.offset-e[r][1].start.offset>1&&e[n][1].end.offset-e[n][1].start.offset>1?2:1;const f={...e[r][1].end},h={...e[n][1].start};_u(f,-c),_u(h,c),i={type:c>1?"strongSequence":"emphasisSequence",start:f,end:{...e[r][1].end}},l={type:c>1?"strongSequence":"emphasisSequence",start:{...e[n][1].start},end:h},s={type:c>1?"strongText":"emphasisText",start:{...e[r][1].end},end:{...e[n][1].start}},o={type:c>1?"strong":"emphasis",start:{...i.start},end:{...l.end}},e[r][1].end={...i.start},e[n][1].start={...l.end},u=[],e[r][1].end.offset-e[r][1].start.offset&&(u=wt(u,[["enter",e[r][1],t],["exit",e[r][1],t]])),u=wt(u,[["enter",o,t],["enter",i,t],["exit",i,t],["enter",s,t]]),u=wt(u,bl(t.parser.constructs.insideSpan.null,e.slice(r+1,n),t)),u=wt(u,[["exit",s,t],["enter",l,t],["exit",l,t],["exit",o,t]]),e[n][1].end.offset-e[n][1].start.offset?(d=2,u=wt(u,[["enter",e[n][1],t],["exit",e[n][1],t]])):d=0,Vt(e,r-1,n-r+3,u),n=r+u.length-d-2;break}}for(n=-1;++n<e.length;)e[n][1].type==="attentionSequence"&&(e[n][1].type="data");return e}function m3(e,t){const n=this.parser.constructs.attentionMarkers.null,r=this.previous,o=ku(r);let s;return i;function i(c){return s=c,e.enter("attentionSequence"),l(c)}function l(c){if(c===s)return e.consume(c),l;const u=e.exit("attentionSequence"),d=ku(c),f=!d||d===2&&o||n.includes(c),h=!o||o===2&&d||n.includes(r);return u._open=!!(s===42?f:f&&(o||!h)),u._close=!!(s===42?h:h&&(d||!f)),t(c)}}function _u(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}const g3={name:"autolink",tokenize:x3};function x3(e,t,n){let r=0;return o;function o(p){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(p),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),s}function s(p){return Ft(p)?(e.consume(p),i):p===64?n(p):u(p)}function i(p){return p===43||p===45||p===46||yt(p)?(r=1,l(p)):u(p)}function l(p){return p===58?(e.consume(p),r=0,c):(p===43||p===45||p===46||yt(p))&&r++<32?(e.consume(p),l):(r=0,u(p))}function c(p){return p===62?(e.exit("autolinkProtocol"),e.enter("autolinkMarker"),e.consume(p),e.exit("autolinkMarker"),e.exit("autolink"),t):p===null||p===32||p===60||ia(p)?n(p):(e.consume(p),c)}function u(p){return p===64?(e.consume(p),d):o3(p)?(e.consume(p),u):n(p)}function d(p){return yt(p)?f(p):n(p)}function f(p){return p===46?(e.consume(p),r=0,d):p===62?(e.exit("autolinkProtocol").type="autolinkEmail",e.enter("autolinkMarker"),e.consume(p),e.exit("autolinkMarker"),e.exit("autolink"),t):h(p)}function h(p){if((p===45||yt(p))&&r++<63){const y=p===45?h:f;return e.consume(p),y}return n(p)}}const Ms={partial:!0,tokenize:b3};function b3(e,t,n){return r;function r(s){return Le(s)?He(e,o,"linePrefix")(s):o(s)}function o(s){return s===null||Ce(s)?t(s):n(s)}}const Km={continuation:{tokenize:v3},exit:w3,name:"blockQuote",tokenize:y3};function y3(e,t,n){const r=this;return o;function o(i){if(i===62){const l=r.containerState;return l.open||(e.enter("blockQuote",{_container:!0}),l.open=!0),e.enter("blockQuotePrefix"),e.enter("blockQuoteMarker"),e.consume(i),e.exit("blockQuoteMarker"),s}return n(i)}function s(i){return Le(i)?(e.enter("blockQuotePrefixWhitespace"),e.consume(i),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),t):(e.exit("blockQuotePrefix"),t(i))}}function v3(e,t,n){const r=this;return o;function o(i){return Le(i)?He(e,s,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(i):s(i)}function s(i){return e.attempt(Km,t,n)(i)}}function w3(e){e.exit("blockQuote")}const Gm={name:"characterEscape",tokenize:k3};function k3(e,t,n){return r;function r(s){return e.enter("characterEscape"),e.enter("escapeMarker"),e.consume(s),e.exit("escapeMarker"),o}function o(s){return i3(s)?(e.enter("characterEscapeValue"),e.consume(s),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):n(s)}}const Jm={name:"characterReference",tokenize:_3};function _3(e,t,n){const r=this;let o=0,s,i;return l;function l(f){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(f),e.exit("characterReferenceMarker"),c}function c(f){return f===35?(e.enter("characterReferenceMarkerNumeric"),e.consume(f),e.exit("characterReferenceMarkerNumeric"),u):(e.enter("characterReferenceValue"),s=31,i=yt,d(f))}function u(f){return f===88||f===120?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(f),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),s=6,i=s3,d):(e.enter("characterReferenceValue"),s=7,i=aa,d(f))}function d(f){if(f===59&&o){const h=e.exit("characterReferenceValue");return i===yt&&!xl(r.sliceSerialize(h))?n(f):(e.enter("characterReferenceMarker"),e.consume(f),e.exit("characterReferenceMarker"),e.exit("characterReference"),t)}return i(f)&&o++<s?(e.consume(f),d):n(f)}}const Su={partial:!0,tokenize:C3},Cu={concrete:!0,name:"codeFenced",tokenize:S3};function S3(e,t,n){const r=this,o={partial:!0,tokenize:C};let s=0,i=0,l;return c;function c(j){return u(j)}function u(j){const E=r.events[r.events.length-1];return s=E&&E[1].type==="linePrefix"?E[2].sliceSerialize(E[1],!0).length:0,l=j,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),d(j)}function d(j){return j===l?(i++,e.consume(j),d):i<3?n(j):(e.exit("codeFencedFenceSequence"),Le(j)?He(e,f,"whitespace")(j):f(j))}function f(j){return j===null||Ce(j)?(e.exit("codeFencedFence"),r.interrupt?t(j):e.check(Su,m,S)(j)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),h(j))}function h(j){return j===null||Ce(j)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),f(j)):Le(j)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),He(e,p,"whitespace")(j)):j===96&&j===l?n(j):(e.consume(j),h)}function p(j){return j===null||Ce(j)?f(j):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),y(j))}function y(j){return j===null||Ce(j)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),f(j)):j===96&&j===l?n(j):(e.consume(j),y)}function m(j){return e.attempt(o,S,g)(j)}function g(j){return e.enter("lineEnding"),e.consume(j),e.exit("lineEnding"),b}function b(j){return s>0&&Le(j)?He(e,v,"linePrefix",s+1)(j):v(j)}function v(j){return j===null||Ce(j)?e.check(Su,m,S)(j):(e.enter("codeFlowValue"),k(j))}function k(j){return j===null||Ce(j)?(e.exit("codeFlowValue"),v(j)):(e.consume(j),k)}function S(j){return e.exit("codeFenced"),t(j)}function C(j,E,T){let z=0;return O;function O(L){return j.enter("lineEnding"),j.consume(L),j.exit("lineEnding"),B}function B(L){return j.enter("codeFencedFence"),Le(L)?He(j,N,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(L):N(L)}function N(L){return L===l?(j.enter("codeFencedFenceSequence"),D(L)):T(L)}function D(L){return L===l?(z++,j.consume(L),D):z>=i?(j.exit("codeFencedFenceSequence"),Le(L)?He(j,w,"whitespace")(L):w(L)):T(L)}function w(L){return L===null||Ce(L)?(j.exit("codeFencedFence"),E(L)):T(L)}}}function C3(e,t,n){const r=this;return o;function o(i){return i===null?n(i):(e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),s)}function s(i){return r.parser.lazy[r.now().line]?n(i):t(i)}}const ci={name:"codeIndented",tokenize:N3},j3={partial:!0,tokenize:E3};function N3(e,t,n){const r=this;return o;function o(u){return e.enter("codeIndented"),He(e,s,"linePrefix",5)(u)}function s(u){const d=r.events[r.events.length-1];return d&&d[1].type==="linePrefix"&&d[2].sliceSerialize(d[1],!0).length>=4?i(u):n(u)}function i(u){return u===null?c(u):Ce(u)?e.attempt(j3,i,c)(u):(e.enter("codeFlowValue"),l(u))}function l(u){return u===null||Ce(u)?(e.exit("codeFlowValue"),i(u)):(e.consume(u),l)}function c(u){return e.exit("codeIndented"),t(u)}}function E3(e,t,n){const r=this;return o;function o(i){return r.parser.lazy[r.now().line]?n(i):Ce(i)?(e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),o):He(e,s,"linePrefix",5)(i)}function s(i){const l=r.events[r.events.length-1];return l&&l[1].type==="linePrefix"&&l[2].sliceSerialize(l[1],!0).length>=4?t(i):Ce(i)?o(i):n(i)}}const T3={name:"codeText",previous:I3,resolve:A3,tokenize:z3};function A3(e){let t=e.length-4,n=3,r,o;if((e[n][1].type==="lineEnding"||e[n][1].type==="space")&&(e[t][1].type==="lineEnding"||e[t][1].type==="space")){for(r=n;++r<t;)if(e[r][1].type==="codeTextData"){e[n][1].type="codeTextPadding",e[t][1].type="codeTextPadding",n+=2,t-=2;break}}for(r=n-1,t++;++r<=t;)o===void 0?r!==t&&e[r][1].type!=="lineEnding"&&(o=r):(r===t||e[r][1].type==="lineEnding")&&(e[o][1].type="codeTextData",r!==o+2&&(e[o][1].end=e[r-1][1].end,e.splice(o+2,r-o-2),t-=r-o-2,r=o+2),o=void 0);return e}function I3(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function z3(e,t,n){let r=0,o,s;return i;function i(f){return e.enter("codeText"),e.enter("codeTextSequence"),l(f)}function l(f){return f===96?(e.consume(f),r++,l):(e.exit("codeTextSequence"),c(f))}function c(f){return f===null?n(f):f===32?(e.enter("space"),e.consume(f),e.exit("space"),c):f===96?(s=e.enter("codeTextSequence"),o=0,d(f)):Ce(f)?(e.enter("lineEnding"),e.consume(f),e.exit("lineEnding"),c):(e.enter("codeTextData"),u(f))}function u(f){return f===null||f===32||f===96||Ce(f)?(e.exit("codeTextData"),c(f)):(e.consume(f),u)}function d(f){return f===96?(e.consume(f),o++,d):o===r?(e.exit("codeTextSequence"),e.exit("codeText"),t(f)):(s.type="codeTextData",u(f))}}class R3{constructor(t){this.left=t?[...t]:[],this.right=[]}get(t){if(t<0||t>=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+t+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return t<this.left.length?this.left[t]:this.right[this.right.length-t+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(t,n){const r=n??Number.POSITIVE_INFINITY;return r<this.left.length?this.left.slice(t,r):t>this.left.length?this.right.slice(this.right.length-r+this.left.length,this.right.length-t+this.left.length).reverse():this.left.slice(t).concat(this.right.slice(this.right.length-r+this.left.length).reverse())}splice(t,n,r){const o=n||0;this.setCursor(Math.trunc(t));const s=this.right.splice(this.right.length-o,Number.POSITIVE_INFINITY);return r&&kr(this.left,r),s.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(t){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(t)}pushMany(t){this.setCursor(Number.POSITIVE_INFINITY),kr(this.left,t)}unshift(t){this.setCursor(0),this.right.push(t)}unshiftMany(t){this.setCursor(0),kr(this.right,t.reverse())}setCursor(t){if(!(t===this.left.length||t>this.left.length&&this.right.length===0||t<0&&this.left.length===0))if(t<this.left.length){const n=this.left.splice(t,Number.POSITIVE_INFINITY);kr(this.right,n.reverse())}else{const n=this.right.splice(this.left.length+this.right.length-t,Number.POSITIVE_INFINITY);kr(this.left,n.reverse())}}}function kr(e,t){let n=0;if(t.length<1e4)e.push(...t);else for(;n<t.length;)e.push(...t.slice(n,n+1e4)),n+=1e4}function Ym(e){const t={};let n=-1,r,o,s,i,l,c,u;const d=new R3(e);for(;++n<d.length;){for(;n in t;)n=t[n];if(r=d.get(n),n&&r[1].type==="chunkFlow"&&d.get(n-1)[1].type==="listItemPrefix"&&(c=r[1]._tokenizer.events,s=0,s<c.length&&c[s][1].type==="lineEndingBlank"&&(s+=2),s<c.length&&c[s][1].type==="content"))for(;++s<c.length&&c[s][1].type!=="content";)c[s][1].type==="chunkText"&&(c[s][1]._isInFirstContentOfListItem=!0,s++);if(r[0]==="enter")r[1].contentType&&(Object.assign(t,P3(d,n)),n=t[n],u=!0);else if(r[1]._container){for(s=n,o=void 0;s--;)if(i=d.get(s),i[1].type==="lineEnding"||i[1].type==="lineEndingBlank")i[0]==="enter"&&(o&&(d.get(o)[1].type="lineEndingBlank"),i[1].type="lineEnding",o=s);else if(!(i[1].type==="linePrefix"||i[1].type==="listItemIndent"))break;o&&(r[1].end={...d.get(o)[1].start},l=d.slice(o,n),l.unshift(r),d.splice(o,n-o+1,l))}}return Vt(e,0,Number.POSITIVE_INFINITY,d.slice(0)),!u}function P3(e,t){const n=e.get(t)[1],r=e.get(t)[2];let o=t-1;const s=[];let i=n._tokenizer;i||(i=r.parser[n.contentType](n.start),n._contentTypeTextTrailing&&(i._contentTypeTextTrailing=!0));const l=i.events,c=[],u={};let d,f,h=-1,p=n,y=0,m=0;const g=[m];for(;p;){for(;e.get(++o)[1]!==p;);s.push(o),p._tokenizer||(d=r.sliceStream(p),p.next||d.push(null),f&&i.defineSkip(p.start),p._isInFirstContentOfListItem&&(i._gfmTasklistFirstContentOfListItem=!0),i.write(d),p._isInFirstContentOfListItem&&(i._gfmTasklistFirstContentOfListItem=void 0)),f=p,p=p.next}for(p=n;++h<l.length;)l[h][0]==="exit"&&l[h-1][0]==="enter"&&l[h][1].type===l[h-1][1].type&&l[h][1].start.line!==l[h][1].end.line&&(m=h+1,g.push(m),p._tokenizer=void 0,p.previous=void 0,p=p.next);for(i.events=[],p?(p._tokenizer=void 0,p.previous=void 0):g.pop(),h=g.length;h--;){const b=l.slice(g[h],g[h+1]),v=s.pop();c.push([v,v+b.length-1]),e.splice(v,2,b)}for(c.reverse(),h=-1;++h<c.length;)u[y+c[h][0]]=y+c[h][1],y+=c[h][1]-c[h][0]-1;return u}const O3={resolve:L3,tokenize:D3},M3={partial:!0,tokenize:F3};function L3(e){return Ym(e),e}function D3(e,t){let n;return r;function r(l){return e.enter("content"),n=e.enter("chunkContent",{contentType:"content"}),o(l)}function o(l){return l===null?s(l):Ce(l)?e.check(M3,i,s)(l):(e.consume(l),o)}function s(l){return e.exit("chunkContent"),e.exit("content"),t(l)}function i(l){return e.consume(l),e.exit("chunkContent"),n.next=e.enter("chunkContent",{contentType:"content",previous:n}),n=n.next,o}}function F3(e,t,n){const r=this;return o;function o(i){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),He(e,s,"linePrefix")}function s(i){if(i===null||Ce(i))return n(i);const l=r.events[r.events.length-1];return!r.parser.constructs.disable.null.includes("codeIndented")&&l&&l[1].type==="linePrefix"&&l[2].sliceSerialize(l[1],!0).length>=4?t(i):e.interrupt(r.parser.constructs.flow,n,t)(i)}}function Xm(e,t,n,r,o,s,i,l,c){const u=c||Number.POSITIVE_INFINITY;let d=0;return f;function f(b){return b===60?(e.enter(r),e.enter(o),e.enter(s),e.consume(b),e.exit(s),h):b===null||b===32||b===41||ia(b)?n(b):(e.enter(r),e.enter(i),e.enter(l),e.enter("chunkString",{contentType:"string"}),m(b))}function h(b){return b===62?(e.enter(s),e.consume(b),e.exit(s),e.exit(o),e.exit(r),t):(e.enter(l),e.enter("chunkString",{contentType:"string"}),p(b))}function p(b){return b===62?(e.exit("chunkString"),e.exit(l),h(b)):b===null||b===60||Ce(b)?n(b):(e.consume(b),b===92?y:p)}function y(b){return b===60||b===62||b===92?(e.consume(b),p):p(b)}function m(b){return!d&&(b===null||b===41||dt(b))?(e.exit("chunkString"),e.exit(l),e.exit(i),e.exit(r),t(b)):d<u&&b===40?(e.consume(b),d++,m):b===41?(e.consume(b),d--,m):b===null||b===32||b===40||ia(b)?n(b):(e.consume(b),b===92?g:m)}function g(b){return b===40||b===41||b===92?(e.consume(b),m):m(b)}}function Qm(e,t,n,r,o,s){const i=this;let l=0,c;return u;function u(p){return e.enter(r),e.enter(o),e.consume(p),e.exit(o),e.enter(s),d}function d(p){return l>999||p===null||p===91||p===93&&!c||p===94&&!l&&"_hiddenFootnoteSupport"in i.parser.constructs?n(p):p===93?(e.exit(s),e.enter(o),e.consume(p),e.exit(o),e.exit(r),t):Ce(p)?(e.enter("lineEnding"),e.consume(p),e.exit("lineEnding"),d):(e.enter("chunkString",{contentType:"string"}),f(p))}function f(p){return p===null||p===91||p===93||Ce(p)||l++>999?(e.exit("chunkString"),d(p)):(e.consume(p),c||(c=!Le(p)),p===92?h:f)}function h(p){return p===91||p===92||p===93?(e.consume(p),l++,f):f(p)}}function eg(e,t,n,r,o,s){let i;return l;function l(h){return h===34||h===39||h===40?(e.enter(r),e.enter(o),e.consume(h),e.exit(o),i=h===40?41:h,c):n(h)}function c(h){return h===i?(e.enter(o),e.consume(h),e.exit(o),e.exit(r),t):(e.enter(s),u(h))}function u(h){return h===i?(e.exit(s),c(i)):h===null?n(h):Ce(h)?(e.enter("lineEnding"),e.consume(h),e.exit("lineEnding"),He(e,u,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),d(h))}function d(h){return h===i||h===null||Ce(h)?(e.exit("chunkString"),u(h)):(e.consume(h),h===92?f:d)}function f(h){return h===i||h===92?(e.consume(h),d):d(h)}}function Ir(e,t){let n;return r;function r(o){return Ce(o)?(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),n=!0,r):Le(o)?He(e,r,n?"linePrefix":"lineSuffix")(o):t(o)}}const $3={name:"definition",tokenize:U3},B3={partial:!0,tokenize:W3};function U3(e,t,n){const r=this;let o;return s;function s(p){return e.enter("definition"),i(p)}function i(p){return Qm.call(r,e,l,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(p)}function l(p){return o=Qn(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),p===58?(e.enter("definitionMarker"),e.consume(p),e.exit("definitionMarker"),c):n(p)}function c(p){return dt(p)?Ir(e,u)(p):u(p)}function u(p){return Xm(e,d,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(p)}function d(p){return e.attempt(B3,f,f)(p)}function f(p){return Le(p)?He(e,h,"whitespace")(p):h(p)}function h(p){return p===null||Ce(p)?(e.exit("definition"),r.parser.defined.push(o),t(p)):n(p)}}function W3(e,t,n){return r;function r(l){return dt(l)?Ir(e,o)(l):n(l)}function o(l){return eg(e,s,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(l)}function s(l){return Le(l)?He(e,i,"whitespace")(l):i(l)}function i(l){return l===null||Ce(l)?t(l):n(l)}}const H3={name:"hardBreakEscape",tokenize:V3};function V3(e,t,n){return r;function r(s){return e.enter("hardBreakEscape"),e.consume(s),o}function o(s){return Ce(s)?(e.exit("hardBreakEscape"),t(s)):n(s)}}const Z3={name:"headingAtx",resolve:q3,tokenize:K3};function q3(e,t){let n=e.length-2,r=3,o,s;return e[r][1].type==="whitespace"&&(r+=2),n-2>r&&e[n][1].type==="whitespace"&&(n-=2),e[n][1].type==="atxHeadingSequence"&&(r===n-1||n-4>r&&e[n-2][1].type==="whitespace")&&(n-=r+1===n?2:4),n>r&&(o={type:"atxHeadingText",start:e[r][1].start,end:e[n][1].end},s={type:"chunkText",start:e[r][1].start,end:e[n][1].end,contentType:"text"},Vt(e,r,n-r+1,[["enter",o,t],["enter",s,t],["exit",s,t],["exit",o,t]])),e}function K3(e,t,n){let r=0;return o;function o(d){return e.enter("atxHeading"),s(d)}function s(d){return e.enter("atxHeadingSequence"),i(d)}function i(d){return d===35&&r++<6?(e.consume(d),i):d===null||dt(d)?(e.exit("atxHeadingSequence"),l(d)):n(d)}function l(d){return d===35?(e.enter("atxHeadingSequence"),c(d)):d===null||Ce(d)?(e.exit("atxHeading"),t(d)):Le(d)?He(e,l,"whitespace")(d):(e.enter("atxHeadingText"),u(d))}function c(d){return d===35?(e.consume(d),c):(e.exit("atxHeadingSequence"),l(d))}function u(d){return d===null||d===35||dt(d)?(e.exit("atxHeadingText"),l(d)):(e.consume(d),u)}}const G3=["address","article","aside","base","basefont","blockquote","body","caption","center","col","colgroup","dd","details","dialog","dir","div","dl","dt","fieldset","figcaption","figure","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hr","html","iframe","legend","li","link","main","menu","menuitem","nav","noframes","ol","optgroup","option","p","param","search","section","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"],ju=["pre","script","style","textarea"],J3={concrete:!0,name:"htmlFlow",resolveTo:Q3,tokenize:eT},Y3={partial:!0,tokenize:nT},X3={partial:!0,tokenize:tT};function Q3(e){let t=e.length;for(;t--&&!(e[t][0]==="enter"&&e[t][1].type==="htmlFlow"););return t>1&&e[t-2][1].type==="linePrefix"&&(e[t][1].start=e[t-2][1].start,e[t+1][1].start=e[t-2][1].start,e.splice(t-2,2)),e}function eT(e,t,n){const r=this;let o,s,i,l,c;return u;function u(R){return d(R)}function d(R){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(R),f}function f(R){return R===33?(e.consume(R),h):R===47?(e.consume(R),s=!0,m):R===63?(e.consume(R),o=3,r.interrupt?t:I):Ft(R)?(e.consume(R),i=String.fromCharCode(R),g):n(R)}function h(R){return R===45?(e.consume(R),o=2,p):R===91?(e.consume(R),o=5,l=0,y):Ft(R)?(e.consume(R),o=4,r.interrupt?t:I):n(R)}function p(R){return R===45?(e.consume(R),r.interrupt?t:I):n(R)}function y(R){const ae="CDATA[";return R===ae.charCodeAt(l++)?(e.consume(R),l===ae.length?r.interrupt?t:N:y):n(R)}function m(R){return Ft(R)?(e.consume(R),i=String.fromCharCode(R),g):n(R)}function g(R){if(R===null||R===47||R===62||dt(R)){const ae=R===47,oe=i.toLowerCase();return!ae&&!s&&ju.includes(oe)?(o=1,r.interrupt?t(R):N(R)):G3.includes(i.toLowerCase())?(o=6,ae?(e.consume(R),b):r.interrupt?t(R):N(R)):(o=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(R):s?v(R):k(R))}return R===45||yt(R)?(e.consume(R),i+=String.fromCharCode(R),g):n(R)}function b(R){return R===62?(e.consume(R),r.interrupt?t:N):n(R)}function v(R){return Le(R)?(e.consume(R),v):O(R)}function k(R){return R===47?(e.consume(R),O):R===58||R===95||Ft(R)?(e.consume(R),S):Le(R)?(e.consume(R),k):O(R)}function S(R){return R===45||R===46||R===58||R===95||yt(R)?(e.consume(R),S):C(R)}function C(R){return R===61?(e.consume(R),j):Le(R)?(e.consume(R),C):k(R)}function j(R){return R===null||R===60||R===61||R===62||R===96?n(R):R===34||R===39?(e.consume(R),c=R,E):Le(R)?(e.consume(R),j):T(R)}function E(R){return R===c?(e.consume(R),c=null,z):R===null||Ce(R)?n(R):(e.consume(R),E)}function T(R){return R===null||R===34||R===39||R===47||R===60||R===61||R===62||R===96||dt(R)?C(R):(e.consume(R),T)}function z(R){return R===47||R===62||Le(R)?k(R):n(R)}function O(R){return R===62?(e.consume(R),B):n(R)}function B(R){return R===null||Ce(R)?N(R):Le(R)?(e.consume(R),B):n(R)}function N(R){return R===45&&o===2?(e.consume(R),W):R===60&&o===1?(e.consume(R),U):R===62&&o===4?(e.consume(R),V):R===63&&o===3?(e.consume(R),I):R===93&&o===5?(e.consume(R),K):Ce(R)&&(o===6||o===7)?(e.exit("htmlFlowData"),e.check(Y3,G,D)(R)):R===null||Ce(R)?(e.exit("htmlFlowData"),D(R)):(e.consume(R),N)}function D(R){return e.check(X3,w,G)(R)}function w(R){return e.enter("lineEnding"),e.consume(R),e.exit("lineEnding"),L}function L(R){return R===null||Ce(R)?D(R):(e.enter("htmlFlowData"),N(R))}function W(R){return R===45?(e.consume(R),I):N(R)}function U(R){return R===47?(e.consume(R),i="",F):N(R)}function F(R){if(R===62){const ae=i.toLowerCase();return ju.includes(ae)?(e.consume(R),V):N(R)}return Ft(R)&&i.length<8?(e.consume(R),i+=String.fromCharCode(R),F):N(R)}function K(R){return R===93?(e.consume(R),I):N(R)}function I(R){return R===62?(e.consume(R),V):R===45&&o===2?(e.consume(R),I):N(R)}function V(R){return R===null||Ce(R)?(e.exit("htmlFlowData"),G(R)):(e.consume(R),V)}function G(R){return e.exit("htmlFlow"),t(R)}}function tT(e,t,n){const r=this;return o;function o(i){return Ce(i)?(e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),s):n(i)}function s(i){return r.parser.lazy[r.now().line]?n(i):t(i)}}function nT(e,t,n){return r;function r(o){return e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),e.attempt(Ms,t,n)}}const rT={name:"htmlText",tokenize:oT};function oT(e,t,n){const r=this;let o,s,i;return l;function l(I){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(I),c}function c(I){return I===33?(e.consume(I),u):I===47?(e.consume(I),C):I===63?(e.consume(I),k):Ft(I)?(e.consume(I),T):n(I)}function u(I){return I===45?(e.consume(I),d):I===91?(e.consume(I),s=0,y):Ft(I)?(e.consume(I),v):n(I)}function d(I){return I===45?(e.consume(I),p):n(I)}function f(I){return I===null?n(I):I===45?(e.consume(I),h):Ce(I)?(i=f,U(I)):(e.consume(I),f)}function h(I){return I===45?(e.consume(I),p):f(I)}function p(I){return I===62?W(I):I===45?h(I):f(I)}function y(I){const V="CDATA[";return I===V.charCodeAt(s++)?(e.consume(I),s===V.length?m:y):n(I)}function m(I){return I===null?n(I):I===93?(e.consume(I),g):Ce(I)?(i=m,U(I)):(e.consume(I),m)}function g(I){return I===93?(e.consume(I),b):m(I)}function b(I){return I===62?W(I):I===93?(e.consume(I),b):m(I)}function v(I){return I===null||I===62?W(I):Ce(I)?(i=v,U(I)):(e.consume(I),v)}function k(I){return I===null?n(I):I===63?(e.consume(I),S):Ce(I)?(i=k,U(I)):(e.consume(I),k)}function S(I){return I===62?W(I):k(I)}function C(I){return Ft(I)?(e.consume(I),j):n(I)}function j(I){return I===45||yt(I)?(e.consume(I),j):E(I)}function E(I){return Ce(I)?(i=E,U(I)):Le(I)?(e.consume(I),E):W(I)}function T(I){return I===45||yt(I)?(e.consume(I),T):I===47||I===62||dt(I)?z(I):n(I)}function z(I){return I===47?(e.consume(I),W):I===58||I===95||Ft(I)?(e.consume(I),O):Ce(I)?(i=z,U(I)):Le(I)?(e.consume(I),z):W(I)}function O(I){return I===45||I===46||I===58||I===95||yt(I)?(e.consume(I),O):B(I)}function B(I){return I===61?(e.consume(I),N):Ce(I)?(i=B,U(I)):Le(I)?(e.consume(I),B):z(I)}function N(I){return I===null||I===60||I===61||I===62||I===96?n(I):I===34||I===39?(e.consume(I),o=I,D):Ce(I)?(i=N,U(I)):Le(I)?(e.consume(I),N):(e.consume(I),w)}function D(I){return I===o?(e.consume(I),o=void 0,L):I===null?n(I):Ce(I)?(i=D,U(I)):(e.consume(I),D)}function w(I){return I===null||I===34||I===39||I===60||I===61||I===96?n(I):I===47||I===62||dt(I)?z(I):(e.consume(I),w)}function L(I){return I===47||I===62||dt(I)?z(I):n(I)}function W(I){return I===62?(e.consume(I),e.exit("htmlTextData"),e.exit("htmlText"),t):n(I)}function U(I){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(I),e.exit("lineEnding"),F}function F(I){return Le(I)?He(e,K,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(I):K(I)}function K(I){return e.enter("htmlTextData"),i(I)}}const yl={name:"labelEnd",resolveAll:lT,resolveTo:cT,tokenize:uT},sT={tokenize:dT},iT={tokenize:fT},aT={tokenize:pT};function lT(e){let t=-1;const n=[];for(;++t<e.length;){const r=e[t][1];if(n.push(e[t]),r.type==="labelImage"||r.type==="labelLink"||r.type==="labelEnd"){const o=r.type==="labelImage"?4:2;r.type="data",t+=o}}return e.length!==n.length&&Vt(e,0,e.length,n),e}function cT(e,t){let n=e.length,r=0,o,s,i,l;for(;n--;)if(o=e[n][1],s){if(o.type==="link"||o.type==="labelLink"&&o._inactive)break;e[n][0]==="enter"&&o.type==="labelLink"&&(o._inactive=!0)}else if(i){if(e[n][0]==="enter"&&(o.type==="labelImage"||o.type==="labelLink")&&!o._balanced&&(s=n,o.type!=="labelLink")){r=2;break}}else o.type==="labelEnd"&&(i=n);const c={type:e[s][1].type==="labelLink"?"link":"image",start:{...e[s][1].start},end:{...e[e.length-1][1].end}},u={type:"label",start:{...e[s][1].start},end:{...e[i][1].end}},d={type:"labelText",start:{...e[s+r+2][1].end},end:{...e[i-2][1].start}};return l=[["enter",c,t],["enter",u,t]],l=wt(l,e.slice(s+1,s+r+3)),l=wt(l,[["enter",d,t]]),l=wt(l,bl(t.parser.constructs.insideSpan.null,e.slice(s+r+4,i-3),t)),l=wt(l,[["exit",d,t],e[i-2],e[i-1],["exit",u,t]]),l=wt(l,e.slice(i+1)),l=wt(l,[["exit",c,t]]),Vt(e,s,e.length,l),e}function uT(e,t,n){const r=this;let o=r.events.length,s,i;for(;o--;)if((r.events[o][1].type==="labelImage"||r.events[o][1].type==="labelLink")&&!r.events[o][1]._balanced){s=r.events[o][1];break}return l;function l(h){return s?s._inactive?f(h):(i=r.parser.defined.includes(Qn(r.sliceSerialize({start:s.end,end:r.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(h),e.exit("labelMarker"),e.exit("labelEnd"),c):n(h)}function c(h){return h===40?e.attempt(sT,d,i?d:f)(h):h===91?e.attempt(iT,d,i?u:f)(h):i?d(h):f(h)}function u(h){return e.attempt(aT,d,f)(h)}function d(h){return t(h)}function f(h){return s._balanced=!0,n(h)}}function dT(e,t,n){return r;function r(f){return e.enter("resource"),e.enter("resourceMarker"),e.consume(f),e.exit("resourceMarker"),o}function o(f){return dt(f)?Ir(e,s)(f):s(f)}function s(f){return f===41?d(f):Xm(e,i,l,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(f)}function i(f){return dt(f)?Ir(e,c)(f):d(f)}function l(f){return n(f)}function c(f){return f===34||f===39||f===40?eg(e,u,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(f):d(f)}function u(f){return dt(f)?Ir(e,d)(f):d(f)}function d(f){return f===41?(e.enter("resourceMarker"),e.consume(f),e.exit("resourceMarker"),e.exit("resource"),t):n(f)}}function fT(e,t,n){const r=this;return o;function o(l){return Qm.call(r,e,s,i,"reference","referenceMarker","referenceString")(l)}function s(l){return r.parser.defined.includes(Qn(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?t(l):n(l)}function i(l){return n(l)}}function pT(e,t,n){return r;function r(s){return e.enter("reference"),e.enter("referenceMarker"),e.consume(s),e.exit("referenceMarker"),o}function o(s){return s===93?(e.enter("referenceMarker"),e.consume(s),e.exit("referenceMarker"),e.exit("reference"),t):n(s)}}const hT={name:"labelStartImage",resolveAll:yl.resolveAll,tokenize:mT};function mT(e,t,n){const r=this;return o;function o(l){return e.enter("labelImage"),e.enter("labelImageMarker"),e.consume(l),e.exit("labelImageMarker"),s}function s(l){return l===91?(e.enter("labelMarker"),e.consume(l),e.exit("labelMarker"),e.exit("labelImage"),i):n(l)}function i(l){return l===94&&"_hiddenFootnoteSupport"in r.parser.constructs?n(l):t(l)}}const gT={name:"labelStartLink",resolveAll:yl.resolveAll,tokenize:xT};function xT(e,t,n){const r=this;return o;function o(i){return e.enter("labelLink"),e.enter("labelMarker"),e.consume(i),e.exit("labelMarker"),e.exit("labelLink"),s}function s(i){return i===94&&"_hiddenFootnoteSupport"in r.parser.constructs?n(i):t(i)}}const ui={name:"lineEnding",tokenize:bT};function bT(e,t){return n;function n(r){return e.enter("lineEnding"),e.consume(r),e.exit("lineEnding"),He(e,t,"linePrefix")}}const To={name:"thematicBreak",tokenize:yT};function yT(e,t,n){let r=0,o;return s;function s(u){return e.enter("thematicBreak"),i(u)}function i(u){return o=u,l(u)}function l(u){return u===o?(e.enter("thematicBreakSequence"),c(u)):r>=3&&(u===null||Ce(u))?(e.exit("thematicBreak"),t(u)):n(u)}function c(u){return u===o?(e.consume(u),r++,c):(e.exit("thematicBreakSequence"),Le(u)?He(e,l,"whitespace")(u):l(u))}}const ct={continuation:{tokenize:_T},exit:CT,name:"list",tokenize:kT},vT={partial:!0,tokenize:jT},wT={partial:!0,tokenize:ST};function kT(e,t,n){const r=this,o=r.events[r.events.length-1];let s=o&&o[1].type==="linePrefix"?o[2].sliceSerialize(o[1],!0).length:0,i=0;return l;function l(p){const y=r.containerState.type||(p===42||p===43||p===45?"listUnordered":"listOrdered");if(y==="listUnordered"?!r.containerState.marker||p===r.containerState.marker:aa(p)){if(r.containerState.type||(r.containerState.type=y,e.enter(y,{_container:!0})),y==="listUnordered")return e.enter("listItemPrefix"),p===42||p===45?e.check(To,n,u)(p):u(p);if(!r.interrupt||p===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),c(p)}return n(p)}function c(p){return aa(p)&&++i<10?(e.consume(p),c):(!r.interrupt||i<2)&&(r.containerState.marker?p===r.containerState.marker:p===41||p===46)?(e.exit("listItemValue"),u(p)):n(p)}function u(p){return e.enter("listItemMarker"),e.consume(p),e.exit("listItemMarker"),r.containerState.marker=r.containerState.marker||p,e.check(Ms,r.interrupt?n:d,e.attempt(vT,h,f))}function d(p){return r.containerState.initialBlankLine=!0,s++,h(p)}function f(p){return Le(p)?(e.enter("listItemPrefixWhitespace"),e.consume(p),e.exit("listItemPrefixWhitespace"),h):n(p)}function h(p){return r.containerState.size=s+r.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(p)}}function _T(e,t,n){const r=this;return r.containerState._closeFlow=void 0,e.check(Ms,o,s);function o(l){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,He(e,t,"listItemIndent",r.containerState.size+1)(l)}function s(l){return r.containerState.furtherBlankLines||!Le(l)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,i(l)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,e.attempt(wT,t,i)(l))}function i(l){return r.containerState._closeFlow=!0,r.interrupt=void 0,He(e,e.attempt(ct,t,n),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(l)}}function ST(e,t,n){const r=this;return He(e,o,"listItemIndent",r.containerState.size+1);function o(s){const i=r.events[r.events.length-1];return i&&i[1].type==="listItemIndent"&&i[2].sliceSerialize(i[1],!0).length===r.containerState.size?t(s):n(s)}}function CT(e){e.exit(this.containerState.type)}function jT(e,t,n){const r=this;return He(e,o,"listItemPrefixWhitespace",r.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function o(s){const i=r.events[r.events.length-1];return!Le(s)&&i&&i[1].type==="listItemPrefixWhitespace"?t(s):n(s)}}const Nu={name:"setextUnderline",resolveTo:NT,tokenize:ET};function NT(e,t){let n=e.length,r,o,s;for(;n--;)if(e[n][0]==="enter"){if(e[n][1].type==="content"){r=n;break}e[n][1].type==="paragraph"&&(o=n)}else e[n][1].type==="content"&&e.splice(n,1),!s&&e[n][1].type==="definition"&&(s=n);const i={type:"setextHeading",start:{...e[r][1].start},end:{...e[e.length-1][1].end}};return e[o][1].type="setextHeadingText",s?(e.splice(o,0,["enter",i,t]),e.splice(s+1,0,["exit",e[r][1],t]),e[r][1].end={...e[s][1].end}):e[r][1]=i,e.push(["exit",i,t]),e}function ET(e,t,n){const r=this;let o;return s;function s(u){let d=r.events.length,f;for(;d--;)if(r.events[d][1].type!=="lineEnding"&&r.events[d][1].type!=="linePrefix"&&r.events[d][1].type!=="content"){f=r.events[d][1].type==="paragraph";break}return!r.parser.lazy[r.now().line]&&(r.interrupt||f)?(e.enter("setextHeadingLine"),o=u,i(u)):n(u)}function i(u){return e.enter("setextHeadingLineSequence"),l(u)}function l(u){return u===o?(e.consume(u),l):(e.exit("setextHeadingLineSequence"),Le(u)?He(e,c,"lineSuffix")(u):c(u))}function c(u){return u===null||Ce(u)?(e.exit("setextHeadingLine"),t(u)):n(u)}}const TT={tokenize:AT};function AT(e){const t=this,n=e.attempt(Ms,r,e.attempt(this.parser.constructs.flowInitial,o,He(e,e.attempt(this.parser.constructs.flow,o,e.attempt(O3,o)),"linePrefix")));return n;function r(s){if(s===null){e.consume(s);return}return e.enter("lineEndingBlank"),e.consume(s),e.exit("lineEndingBlank"),t.currentConstruct=void 0,n}function o(s){if(s===null){e.consume(s);return}return e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),t.currentConstruct=void 0,n}}const IT={resolveAll:ng()},zT=tg("string"),RT=tg("text");function tg(e){return{resolveAll:ng(e==="text"?PT:void 0),tokenize:t};function t(n){const r=this,o=this.parser.constructs[e],s=n.attempt(o,i,l);return i;function i(d){return u(d)?s(d):l(d)}function l(d){if(d===null){n.consume(d);return}return n.enter("data"),n.consume(d),c}function c(d){return u(d)?(n.exit("data"),s(d)):(n.consume(d),c)}function u(d){if(d===null)return!0;const f=o[d];let h=-1;if(f)for(;++h<f.length;){const p=f[h];if(!p.previous||p.previous.call(r,r.previous))return!0}return!1}}}function ng(e){return t;function t(n,r){let o=-1,s;for(;++o<=n.length;)s===void 0?n[o]&&n[o][1].type==="data"&&(s=o,o++):(!n[o]||n[o][1].type!=="data")&&(o!==s+2&&(n[s][1].end=n[o-1][1].end,n.splice(s+2,o-s-2),o=s+2),s=void 0);return e?e(n,r):n}}function PT(e,t){let n=0;for(;++n<=e.length;)if((n===e.length||e[n][1].type==="lineEnding")&&e[n-1][1].type==="data"){const r=e[n-1][1],o=t.sliceStream(r);let s=o.length,i=-1,l=0,c;for(;s--;){const u=o[s];if(typeof u=="string"){for(i=u.length;u.charCodeAt(i-1)===32;)l++,i--;if(i)break;i=-1}else if(u===-2)c=!0,l++;else if(u!==-1){s++;break}}if(t._contentTypeTextTrailing&&n===e.length&&(l=0),l){const u={type:n===e.length||c||l<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:s?i:r.start._bufferIndex+i,_index:r.start._index+s,line:r.end.line,column:r.end.column-l,offset:r.end.offset-l},end:{...r.end}};r.end={...u.start},r.start.offset===r.end.offset?Object.assign(r,u):(e.splice(n,0,["enter",u,t],["exit",u,t]),n+=2)}n++}return e}const OT={42:ct,43:ct,45:ct,48:ct,49:ct,50:ct,51:ct,52:ct,53:ct,54:ct,55:ct,56:ct,57:ct,62:Km},MT={91:$3},LT={[-2]:ci,[-1]:ci,32:ci},DT={35:Z3,42:To,45:[Nu,To],60:J3,61:Nu,95:To,96:Cu,126:Cu},FT={38:Jm,92:Gm},$T={[-5]:ui,[-4]:ui,[-3]:ui,33:hT,38:Jm,42:la,60:[g3,rT],91:gT,92:[H3,Gm],93:yl,95:la,96:T3},BT={null:[la,IT]},UT={null:[42,95]},WT={null:[]},HT=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:UT,contentInitial:MT,disable:WT,document:OT,flow:DT,flowInitial:LT,insideSpan:BT,string:FT,text:$T},Symbol.toStringTag,{value:"Module"}));function VT(e,t,n){let r={_bufferIndex:-1,_index:0,line:n&&n.line||1,column:n&&n.column||1,offset:n&&n.offset||0};const o={},s=[];let i=[],l=[];const c={attempt:E(C),check:E(j),consume:v,enter:k,exit:S,interrupt:E(j,{interrupt:!0})},u={code:null,containerState:{},defineSkip:m,events:[],now:y,parser:e,previous:null,sliceSerialize:h,sliceStream:p,write:f};let d=t.tokenize.call(u,c);return t.resolveAll&&s.push(t),u;function f(B){return i=wt(i,B),g(),i[i.length-1]!==null?[]:(T(t,0),u.events=bl(s,u.events,u),u.events)}function h(B,N){return qT(p(B),N)}function p(B){return ZT(i,B)}function y(){const{_bufferIndex:B,_index:N,line:D,column:w,offset:L}=r;return{_bufferIndex:B,_index:N,line:D,column:w,offset:L}}function m(B){o[B.line]=B.column,O()}function g(){let B;for(;r._index<i.length;){const N=i[r._index];if(typeof N=="string")for(B=r._index,r._bufferIndex<0&&(r._bufferIndex=0);r._index===B&&r._bufferIndex<N.length;)b(N.charCodeAt(r._bufferIndex));else b(N)}}function b(B){d=d(B)}function v(B){Ce(B)?(r.line++,r.column=1,r.offset+=B===-3?2:1,O()):B!==-1&&(r.column++,r.offset++),r._bufferIndex<0?r._index++:(r._bufferIndex++,r._bufferIndex===i[r._index].length&&(r._bufferIndex=-1,r._index++)),u.previous=B}function k(B,N){const D=N||{};return D.type=B,D.start=y(),u.events.push(["enter",D,u]),l.push(D),D}function S(B){const N=l.pop();return N.end=y(),u.events.push(["exit",N,u]),N}function C(B,N){T(B,N.from)}function j(B,N){N.restore()}function E(B,N){return D;function D(w,L,W){let U,F,K,I;return Array.isArray(w)?G(w):"tokenize"in w?G([w]):V(w);function V(fe){return le;function le(de){const pe=de!==null&&fe[de],he=de!==null&&fe.null,me=[...Array.isArray(pe)?pe:pe?[pe]:[],...Array.isArray(he)?he:he?[he]:[]];return G(me)(de)}}function G(fe){return U=fe,F=0,fe.length===0?W:R(fe[F])}function R(fe){return le;function le(de){return I=z(),K=fe,fe.partial||(u.currentConstruct=fe),fe.name&&u.parser.constructs.disable.null.includes(fe.name)?oe():fe.tokenize.call(N?Object.assign(Object.create(u),N):u,c,ae,oe)(de)}}function ae(fe){return B(K,I),L}function oe(fe){return I.restore(),++F<U.length?R(U[F]):W}}}function T(B,N){B.resolveAll&&!s.includes(B)&&s.push(B),B.resolve&&Vt(u.events,N,u.events.length-N,B.resolve(u.events.slice(N),u)),B.resolveTo&&(u.events=B.resolveTo(u.events,u))}function z(){const B=y(),N=u.previous,D=u.currentConstruct,w=u.events.length,L=Array.from(l);return{from:w,restore:W};function W(){r=B,u.previous=N,u.currentConstruct=D,u.events.length=w,l=L,O()}}function O(){r.line in o&&r.column<2&&(r.column=o[r.line],r.offset+=o[r.line]-1)}}function ZT(e,t){const n=t.start._index,r=t.start._bufferIndex,o=t.end._index,s=t.end._bufferIndex;let i;if(n===o)i=[e[n].slice(r,s)];else{if(i=e.slice(n,o),r>-1){const l=i[0];typeof l=="string"?i[0]=l.slice(r):i.shift()}s>0&&i.push(e[o].slice(0,s))}return i}function qT(e,t){let n=-1;const r=[];let o;for(;++n<e.length;){const s=e[n];let i;if(typeof s=="string")i=s;else switch(s){case-5:{i="\r";break}case-4:{i=`
|
|
97
|
+
`)&&(n=n.slice(0,-1))),super.equals(t,n,r)}}const iE=new sE;function Tm(e,t,n){return iE.diff(e,t,n)}function Am(e,t){t.stripTrailingCr&&(e=e.replace(/\r\n/g,`
|
|
98
|
+
`));const n=[],r=e.split(/(\n|\r\n)/);r[r.length-1]||r.pop();for(let o=0;o<r.length;o++){const s=r[o];o%2&&!t.newlineIsToken?n[n.length-1]+=s:n.push(s)}return n}class aE extends Em{constructor(){super(...arguments),this.tokenize=Am}get useLongestToken(){return!0}castInput(t,n){const{undefinedReplacement:r,stringifyReplacer:o=(s,i)=>typeof i>"u"?r:i}=n;return typeof t=="string"?t:JSON.stringify(ea(t,null,null,o),null," ")}equals(t,n,r){return super.equals(t.replace(/,([\r\n])/g,"$1"),n.replace(/,([\r\n])/g,"$1"),r)}}const lE=new aE;function cE(e,t,n){return lE.diff(e,t,n)}function ea(e,t,n,r,o){t=t||[],n=n||[],r&&(e=r(o===void 0?"":o,e));let s;for(s=0;s<t.length;s+=1)if(t[s]===e)return n[s];let i;if(Object.prototype.toString.call(e)==="[object Array]"){for(t.push(e),i=new Array(e.length),n.push(i),s=0;s<e.length;s+=1)i[s]=ea(e[s],t,n,r,String(s));return t.pop(),n.pop(),i}if(e&&e.toJSON&&(e=e.toJSON()),typeof e=="object"&&e!==null){t.push(e),i={},n.push(i);const l=[];let c;for(c in e)Object.prototype.hasOwnProperty.call(e,c)&&l.push(c);for(l.sort(),s=0;s<l.length;s+=1)c=l[s],i[c]=ea(e[c],t,n,r,c);t.pop(),n.pop()}else i=e;return i}function eu(e){return e===void 0?[]:Object.entries(e).map(t=>[t[0].toLowerCase(),t[1]]).sort(([t],[n])=>t.localeCompare(n))}function tu([e,t]){return`${e}: ${t}`}function ta(e){const t=[];let n=0,r=0;for(const o of e){const s=o.value.split(`
|
|
99
|
+
`);s.length>0&&s[s.length-1]===""&&s.pop();for(const i of s)o.added?(r+=1,t.push({kind:"added",text:i,oldLineNumber:null,newLineNumber:r})):o.removed?(n+=1,t.push({kind:"removed",text:i,oldLineNumber:n,newLineNumber:null})):(n+=1,r+=1,t.push({kind:"context",text:i,oldLineNumber:n,newLineNumber:r}))}return t}function uE(e,t){const n=eu(e).map(tu).join(`
|
|
100
|
+
`),r=eu(t).map(tu).join(`
|
|
101
|
+
`);if(n===r)return{lines:[],isEmpty:!0};const o=Tm(n,r);return{lines:ta(o),isEmpty:!1}}function nu(e){try{const t=JSON.parse(e);return t===null||typeof t=="string"||typeof t=="object"?t:null}catch{return null}}function dE(e,t){const n=e??"",r=t??"";if(n===r)return{lines:[],isEmpty:!0};const o=nu(n),s=nu(r);if(o!==null&&s!==null){const l=cE(o,s)??[];if(l.length===1){const c=l[0];if(c!==void 0&&!c.added&&!c.removed)return{lines:[],isEmpty:!0}}return{lines:ta(l),isEmpty:!1}}const i=Tm(n,r);return{lines:ta(i),isEmpty:!1}}function fE(e,t,n){const r=new Array(e);return new Proxy(r,{get(o,s,i){if(typeof s=="string"){const l=s.charCodeAt(0);if(l>=48&&l<=57){const c=+s;if(Number.isInteger(c)&&c>=0&&c<e){let u=o[c];if(!u){const d=t[c*2];u=o[c]={index:c,key:n(c),start:d,size:t[c*2+1],end:d+t[c*2+1],lane:0}}return u}}if(s==="length")return e}return Reflect.get(o,s,i)}})}function Un(e,t,n){let r=n.initialDeps??[],o,s=!0;function i(){const l=e();return(l.length!==r.length||l.some((u,d)=>r[d]!==u))&&(r=l,o=t(...l),n?.onChange&&!(s&&n.skipInitialOnChange)&&n.onChange(o),s=!1),o}return i.updateDeps=l=>{r=l},i}function ru(e,t){if(e===void 0)throw new Error("Unexpected undefined");return e}const ou=(e,t)=>Math.abs(e-t)<1.01,pE=(e,t,n)=>{let r;return function(...o){e.clearTimeout(r),r=e.setTimeout(()=>t.apply(this,o),n)}};let wr;const su=()=>{if(wr!==void 0)return wr;if(typeof navigator>"u")return wr=!1;if(/iP(hone|od|ad)/.test(navigator.userAgent))return wr=!0;const e=navigator.maxTouchPoints;return wr=navigator.platform==="MacIntel"&&e!==void 0&&e>0},iu=e=>{const{offsetWidth:t,offsetHeight:n}=e;return{width:t,height:n}},hE=e=>e,mE=e=>{const t=Math.max(e.startIndex-e.overscan,0),r=Math.min(e.endIndex+e.overscan,e.count-1)-t+1,o=new Array(r);for(let s=0;s<r;s++)o[s]=t+s;return o},gE=(e,t)=>{const n=e.scrollElement;if(!n)return;const r=e.targetWindow;if(!r)return;const o=i=>{const{width:l,height:c}=i;t({width:Math.round(l),height:Math.round(c)})};if(o(iu(n)),!r.ResizeObserver)return()=>{};const s=new r.ResizeObserver(i=>{const l=()=>{const c=i[0];if(c?.borderBoxSize){const u=c.borderBoxSize[0];if(u){o({width:u.inlineSize,height:u.blockSize});return}}o(iu(n))};e.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(l):l()});return s.observe(n,{box:"border-box"}),()=>{s.unobserve(n)}},Wr={passive:!0},xE=(e,t)=>{const n=e.scrollElement;if(!n)return;const r=()=>{t({width:n.innerWidth,height:n.innerHeight})};return r(),n.addEventListener("resize",r,Wr),()=>{n.removeEventListener("resize",r)}},bE=typeof window>"u"?!0:"onscrollend"in window,Im=(e,t,n)=>{const r=e.scrollElement;if(!r)return;const o=e.targetWindow;if(!o)return;const s=e.options.useScrollendEvent&&bE;let i=0;const l=s?null:pE(o,()=>t(i,!1),e.options.isScrollingResetDelay),c=f=>()=>{i=n(r),l?.(),t(i,f)},u=c(!0),d=c(!1);return r.addEventListener("scroll",u,Wr),s&&r.addEventListener("scrollend",d,Wr),()=>{r.removeEventListener("scroll",u),s&&r.removeEventListener("scrollend",d)}},yE=(e,t)=>Im(e,t,n=>{const{horizontal:r,isRtl:o}=e.options;return r?n.scrollLeft*(o&&-1||1):n.scrollTop}),vE=(e,t)=>Im(e,t,n=>e.options.horizontal?n.scrollX:n.scrollY),wE=(e,t,n)=>{if(t?.borderBoxSize){const r=t.borderBoxSize[0];if(r)return Math.round(r[n.options.horizontal?"inlineSize":"blockSize"])}return e[n.options.horizontal?"offsetWidth":"offsetHeight"]},zm=(e,{adjustments:t=0,behavior:n},r)=>{var o,s;(s=(o=r.scrollElement)==null?void 0:o.scrollTo)==null||s.call(o,{[r.options.horizontal?"left":"top"]:e+t,behavior:n})},kE=zm,_E=zm;class SE{constructor(t){this.unsubs=[],this.scrollElement=null,this.targetWindow=null,this.isScrolling=!1,this.scrollState=null,this.measurementsCache=[],this._flatMeasurements=null,this.itemSizeCache=new Map,this.itemSizeCacheVersion=0,this.laneAssignments=new Map,this.pendingMin=null,this.prevLanes=void 0,this.lanesChangedFlag=!1,this.lanesSettling=!1,this.pendingScrollAnchor=null,this.scrollRect=null,this.scrollOffset=null,this.scrollDirection=null,this.scrollAdjustments=0,this._iosDeferredAdjustment=0,this._iosTouching=!1,this._iosJustTouchEnded=!1,this._iosTouchEndTimerId=null,this._intendedScrollOffset=null,this.elementsCache=new Map,this.now=()=>{var n,r,o;return((o=(r=(n=this.targetWindow)==null?void 0:n.performance)==null?void 0:r.now)==null?void 0:o.call(r))??Date.now()},this.observer=(()=>{let n=null;const r=()=>n||(!this.targetWindow||!this.targetWindow.ResizeObserver?null:n=new this.targetWindow.ResizeObserver(o=>{o.forEach(s=>{const i=()=>{const l=s.target,c=this.indexFromElement(l);if(!l.isConnected){this.observer.unobserve(l);for(const[u,d]of this.elementsCache)if(d===l){this.elementsCache.delete(u);break}return}this.shouldMeasureDuringScroll(c)&&this.resizeItem(c,this.options.measureElement(l,s,this))};this.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(i):i()})}));return{disconnect:()=>{var o;(o=r())==null||o.disconnect(),n=null},observe:o=>{var s;return(s=r())==null?void 0:s.observe(o,{box:"border-box"})},unobserve:o=>{var s;return(s=r())==null?void 0:s.unobserve(o)}}})(),this.range=null,this.setOptions=n=>{var r,o;const s={debug:!1,initialOffset:0,overscan:1,paddingStart:0,paddingEnd:0,scrollPaddingStart:0,scrollPaddingEnd:0,horizontal:!1,getItemKey:hE,rangeExtractor:mE,onChange:()=>{},measureElement:wE,initialRect:{width:0,height:0},scrollMargin:0,gap:0,indexAttribute:"data-index",initialMeasurementsCache:[],lanes:1,anchorTo:"start",followOnAppend:!1,scrollEndThreshold:1,isScrollingResetDelay:150,enabled:!0,isRtl:!1,useScrollendEvent:!1,useAnimationFrameWithResizeObserver:!1,laneAssignmentMode:"estimate"};for(const u in n){const d=n[u];d!==void 0&&(s[u]=d)}const i=this.options;let l=null,c=null;if(i!==void 0&&i.enabled&&s.enabled&&s.anchorTo==="end"&&this.scrollElement!==null){const u=i.count,d=s.count,f=this.getMeasurements(),h=u>0?((r=f[0])==null?void 0:r.key)??i.getItemKey(0):null,p=u>0?((o=f[u-1])==null?void 0:o.key)??i.getItemKey(u-1):null;if(d!==u||u>0&&d>0&&(s.getItemKey(0)!==h||s.getItemKey(d-1)!==p)){const g=u>0?this.getVirtualItemForOffset(this.getScrollOffset())??f[0]:null;g&&(l=[g.key,this.getScrollOffset()-g.start]);const b=s.followOnAppend===!0?"auto":s.followOnAppend||null;b&&d>u&&this.isAtEnd(i.scrollEndThreshold)&&(u===0||s.getItemKey(d-1)!==p)&&(c=b)}}this.options=s,(l||c)&&(this.pendingScrollAnchor=[l?.[0]??null,l?.[1]??0,c])},this.notify=n=>{var r,o;(o=(r=this.options).onChange)==null||o.call(r,this,n)},this.maybeNotify=Un(()=>(this.calculateRange(),[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]),n=>{this.notify(n)},{key:!1,debug:()=>this.options.debug,initialDeps:[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]}),this.cleanup=()=>{this.unsubs.filter(Boolean).forEach(n=>n()),this.unsubs=[],this.observer.disconnect(),this.rafId!=null&&this.targetWindow&&(this.targetWindow.cancelAnimationFrame(this.rafId),this.rafId=null),this.scrollState=null,this.scrollElement=null,this.targetWindow=null},this._didMount=()=>()=>{this.cleanup()},this._willUpdate=()=>{var n;const r=this.options.enabled?this.options.getScrollElement():null;if(this.scrollElement!==r){if(this.cleanup(),!r){this.maybeNotify();return}if(this.scrollElement=r,this.scrollElement&&"ownerDocument"in this.scrollElement?this.targetWindow=this.scrollElement.ownerDocument.defaultView:this.targetWindow=((n=this.scrollElement)==null?void 0:n.window)??null,this.elementsCache.forEach(s=>{this.observer.observe(s)}),this.unsubs.push(this.options.observeElementRect(this,s=>{this.scrollRect=s,this.maybeNotify()})),this.unsubs.push(this.options.observeElementOffset(this,(s,i)=>{this._intendedScrollOffset!==null&&Math.abs(s-this._intendedScrollOffset)<1.5&&(s=this._intendedScrollOffset),this._intendedScrollOffset=null,this.scrollAdjustments=0,this.scrollDirection=i?this.getScrollOffset()<s?"forward":"backward":null,this.scrollOffset=s,this.isScrolling=i,this._flushIosDeferredIfReady(),this.scrollState&&this.scheduleScrollReconcile(),this.maybeNotify()})),"addEventListener"in this.scrollElement){const s=this.scrollElement,i=()=>{this._iosTouching=!0,this._iosJustTouchEnded=!1,this._iosTouchEndTimerId!==null&&this.targetWindow!=null&&(this.targetWindow.clearTimeout(this._iosTouchEndTimerId),this._iosTouchEndTimerId=null)},l=()=>{this._iosTouching=!1,!(!su()||this.targetWindow==null)&&(this._iosJustTouchEnded=!0,this._iosTouchEndTimerId=this.targetWindow.setTimeout(()=>{this._iosJustTouchEnded=!1,this._iosTouchEndTimerId=null,this._flushIosDeferredIfReady()},150))};s.addEventListener("touchstart",i,Wr),s.addEventListener("touchend",l,Wr),this.unsubs.push(()=>{s.removeEventListener("touchstart",i),s.removeEventListener("touchend",l),this._iosTouchEndTimerId!==null&&this.targetWindow!=null&&(this.targetWindow.clearTimeout(this._iosTouchEndTimerId),this._iosTouchEndTimerId=null)})}this._scrollToOffset(this.getScrollOffset(),{adjustments:void 0,behavior:void 0})}const o=this.pendingScrollAnchor;if(this.pendingScrollAnchor=null,o&&this.scrollElement&&this.options.enabled){const[s,i,l]=o;if(s!==null){const{count:c,getItemKey:u}=this.options;let d=0;for(;d<c&&u(d)!==s;)d++;const f=d<c?this.getMeasurements()[d]:void 0;if(f){const h=f.start+i-this.getScrollOffset();ou(h,0)||this.applyScrollAdjustment(h)}}l&&this.scrollToEnd({behavior:l})}},this._flushIosDeferredIfReady=()=>{if(this._iosDeferredAdjustment===0||this.isScrolling||this._iosTouching||this._iosJustTouchEnded)return;const n=this.getScrollOffset(),r=this.getMaxScrollOffset();if(n<0||n>r)return;const o=this._iosDeferredAdjustment;this._iosDeferredAdjustment=0,this._scrollToOffset(n,{adjustments:this.scrollAdjustments+=o,behavior:void 0})},this.rafId=null,this.getSize=()=>this.options.enabled?(this.scrollRect=this.scrollRect??this.options.initialRect,this.scrollRect[this.options.horizontal?"width":"height"]):(this.scrollRect=null,0),this.getScrollOffset=()=>this.options.enabled?(this.scrollOffset=this.scrollOffset??(typeof this.options.initialOffset=="function"?this.options.initialOffset():this.options.initialOffset),this.scrollOffset):(this.scrollOffset=null,0),this.getFurthestMeasurement=(n,r)=>{const o=new Map,s=new Map;for(let i=r-1;i>=0;i--){const l=n[i];if(o.has(l.lane))continue;const c=s.get(l.lane);if(c==null||l.end>c.end?s.set(l.lane,l):l.end<c.end&&o.set(l.lane,!0),o.size===this.options.lanes)break}return s.size===this.options.lanes?Array.from(s.values()).sort((i,l)=>i.end===l.end?i.index-l.index:i.end-l.end)[0]:void 0},this.getMeasurementOptions=Un(()=>[this.options.count,this.options.paddingStart,this.options.scrollMargin,this.options.getItemKey,this.options.enabled,this.options.lanes,this.options.laneAssignmentMode],(n,r,o,s,i,l,c)=>(this.prevLanes!==void 0&&this.prevLanes!==l&&(this.lanesChangedFlag=!0),this.prevLanes=l,this.pendingMin=null,{count:n,paddingStart:r,scrollMargin:o,getItemKey:s,enabled:i,lanes:l,laneAssignmentMode:c}),{key:!1}),this.getMeasurements=Un(()=>[this.getMeasurementOptions(),this.itemSizeCacheVersion],({count:n,paddingStart:r,scrollMargin:o,getItemKey:s,enabled:i,lanes:l,laneAssignmentMode:c},u)=>{const d=this.itemSizeCache;if(!i)return this.measurementsCache=[],this.itemSizeCache.clear(),this.laneAssignments.clear(),[];if(this.laneAssignments.size>n)for(const y of this.laneAssignments.keys())y>=n&&this.laneAssignments.delete(y);this.lanesChangedFlag&&(this.lanesChangedFlag=!1,this.lanesSettling=!0,this.measurementsCache=[],this.itemSizeCache.clear(),this.laneAssignments.clear(),this.pendingMin=null),this.measurementsCache.length===0&&!this.lanesSettling&&(this.measurementsCache=this.options.initialMeasurementsCache,this.measurementsCache.forEach(y=>{this.itemSizeCache.set(y.key,y.size)}));const f=this.lanesSettling?0:this.pendingMin??0;if(this.pendingMin=null,this.lanesSettling&&this.measurementsCache.length===n&&(this.lanesSettling=!1),l===1){const y=this.options.gap,m=n*2;let g=this._flatMeasurements;if(!g||g.length<m){const k=new Float64Array(m);g&&f>0&&k.set(g.subarray(0,f*2)),g=k,this._flatMeasurements=g}let b;if(f===0)b=r+o;else{const k=f-1;b=g[k*2]+g[k*2+1]+y}for(let k=f;k<n;k++){const S=s(k),C=d.get(S),j=typeof C=="number"?C:this.options.estimateSize(k);g[k*2]=b,g[k*2+1]=j,b+=j+y}const v=fE(n,g,s);return this.measurementsCache=v,v}const h=this.measurementsCache.slice(0,f),p=new Array(l).fill(void 0);for(let y=0;y<f;y++){const m=h[y];m&&(p[m.lane]=y)}for(let y=f;y<n;y++){const m=s(y),g=this.laneAssignments.get(y);let b,v;const k=c==="estimate"||d.has(m);if(g!==void 0&&this.options.lanes>1){b=g;const E=p[b],T=E!==void 0?h[E]:void 0;v=T?T.end+this.options.gap:r+o}else{const E=this.options.lanes===1?h[y-1]:this.getFurthestMeasurement(h,y);v=E?E.end+this.options.gap:r+o,b=E?E.lane:y%this.options.lanes,this.options.lanes>1&&k&&this.laneAssignments.set(y,b)}const S=d.get(m),C=typeof S=="number"?S:this.options.estimateSize(y),j=v+C;h[y]={index:y,start:v,size:C,end:j,key:m,lane:b},p[b]=y}return this.measurementsCache=h,h},{key:!1,debug:()=>this.options.debug}),this.calculateRange=Un(()=>[this.getMeasurements(),this.getSize(),this.getScrollOffset(),this.options.lanes],(n,r,o,s)=>this.range=n.length>0&&r>0?CE({measurements:n,outerSize:r,scrollOffset:o,lanes:s,flat:s===1&&this._flatMeasurements!=null?this._flatMeasurements:null}):null,{key:!1,debug:()=>this.options.debug}),this.getVirtualIndexes=Un(()=>{let n=null,r=null;const o=this.calculateRange();return o&&(n=o.startIndex,r=o.endIndex),this.maybeNotify.updateDeps([this.isScrolling,n,r]),[this.options.rangeExtractor,this.options.overscan,this.options.count,n,r]},(n,r,o,s,i)=>s===null||i===null?[]:n({startIndex:s,endIndex:i,overscan:r,count:o}),{key:!1,debug:()=>this.options.debug}),this.indexFromElement=n=>{const r=this.options.indexAttribute,o=n.getAttribute(r);return o?parseInt(o,10):(console.warn(`Missing attribute name '${r}={index}' on measured element.`),-1)},this.shouldMeasureDuringScroll=n=>{var r;if(!this.scrollState||this.scrollState.behavior!=="smooth")return!0;const o=this.scrollState.index??((r=this.getVirtualItemForOffset(this.scrollState.lastTargetOffset))==null?void 0:r.index);if(o!==void 0&&this.range){const s=Math.max(this.options.overscan,Math.ceil((this.range.endIndex-this.range.startIndex)/2)),i=Math.max(0,o-s),l=Math.min(this.options.count-1,o+s);return n>=i&&n<=l}return!0},this.measureElement=n=>{if(!n){this.elementsCache.forEach((i,l)=>{i.isConnected||(this.observer.unobserve(i),this.elementsCache.delete(l))});return}const r=this.indexFromElement(n),o=this.options.getItemKey(r),s=this.elementsCache.get(o);s!==n&&(s&&this.observer.unobserve(s),this.observer.observe(n),this.elementsCache.set(o,n)),(!this.isScrolling||this.scrollState)&&this.shouldMeasureDuringScroll(r)&&this.resizeItem(r,this.options.measureElement(n,void 0,this))},this.resizeItem=(n,r)=>{var o,s;if(n<0||n>=this.options.count)return;let i,l,c;const u=this._flatMeasurements;if(this.options.lanes===1&&u!==null)c=this.options.getItemKey(n),l=u[n*2],i=u[n*2+1];else{const h=this.measurementsCache[n];if(!h)return;c=h.key,l=h.start,i=h.size}const d=this.itemSizeCache.get(c)??i,f=r-d;if(f!==0){const h=this.options.anchorTo==="end"&&((o=this.scrollState)==null?void 0:o.behavior)!=="smooth"&&this.getVirtualDistanceFromEnd()<=this.options.scrollEndThreshold,p=h?this.getTotalSize():0,y=((s=this.scrollState)==null?void 0:s.behavior)!=="smooth"&&(this.shouldAdjustScrollPositionOnItemSizeChange!==void 0?this.shouldAdjustScrollPositionOnItemSizeChange(this.measurementsCache[n]??{index:n,key:c,start:l,size:i,end:l+i,lane:0},f,this):l<this.getScrollOffset()+this.scrollAdjustments&&this.scrollDirection!=="backward");(this.pendingMin===null||n<this.pendingMin)&&(this.pendingMin=n),this.itemSizeCache.set(c,r),this.itemSizeCacheVersion++,h?this.applyScrollAdjustment(this.getTotalSize()-p):y&&this.applyScrollAdjustment(f),this.notify(!1)}},this.getVirtualItems=Un(()=>[this.getVirtualIndexes(),this.getMeasurements()],(n,r)=>{const o=[];for(let s=0,i=n.length;s<i;s++){const l=n[s],c=r[l];o.push(c)}return o},{key:!1,debug:()=>this.options.debug}),this.getVirtualItemForOffset=n=>{const r=this.getMeasurements();if(r.length===0)return;const o=this._flatMeasurements,s=this.options.lanes===1&&o!=null,i=Rm(0,r.length-1,s?l=>o[l*2]:l=>ru(r[l]).start,n);return ru(r[i])},this.getMaxScrollOffset=()=>{if(!this.scrollElement)return 0;if("scrollHeight"in this.scrollElement)return this.options.horizontal?this.scrollElement.scrollWidth-this.scrollElement.clientWidth:this.scrollElement.scrollHeight-this.scrollElement.clientHeight;{const n=this.scrollElement.document.documentElement;return this.options.horizontal?n.scrollWidth-this.scrollElement.innerWidth:n.scrollHeight-this.scrollElement.innerHeight}},this.getVirtualDistanceFromEnd=()=>Math.max(this.getTotalSize()-this.getSize()-this.getScrollOffset(),0),this.getDistanceFromEnd=()=>Math.max(this.getMaxScrollOffset()-this.getScrollOffset(),0),this.isAtEnd=(n=this.options.scrollEndThreshold)=>this.getDistanceFromEnd()<=n,this.getOffsetForAlignment=(n,r,o=0)=>{if(!this.scrollElement)return 0;const s=this.getSize(),i=this.getScrollOffset();r==="auto"&&(r=n>=i+s?"end":"start"),r==="center"?n+=(o-s)/2:r==="end"&&(n-=s);const l=this.getMaxScrollOffset();return Math.max(Math.min(l,n),0)},this.getOffsetForIndex=(n,r="auto")=>{n=Math.max(0,Math.min(n,this.options.count-1));const o=this.getSize(),s=this.getScrollOffset(),i=this.measurementsCache[n];if(!i)return;if(r==="auto")if(i.end>=s+o-this.options.scrollPaddingEnd)r="end";else if(i.start<=s+this.options.scrollPaddingStart)r="start";else return[s,r];if(r==="end"&&n===this.options.count-1)return[this.getMaxScrollOffset(),r];const l=r==="end"?i.end+this.options.scrollPaddingEnd:i.start-this.options.scrollPaddingStart;return[this.getOffsetForAlignment(l,r,i.size),r]},this.scrollToOffset=(n,{align:r="start",behavior:o="auto"}={})=>{const s=this.getOffsetForAlignment(n,r),i=this.now();this.scrollState={index:null,align:r,behavior:o,startedAt:i,lastTargetOffset:s,stableFrames:0},this._scrollToOffset(s,{adjustments:void 0,behavior:o}),this.scheduleScrollReconcile()},this.scrollToIndex=(n,{align:r="auto",behavior:o="auto"}={})=>{n=Math.max(0,Math.min(n,this.options.count-1));const s=this.getOffsetForIndex(n,r);if(!s)return;const[i,l]=s,c=this.now();this.scrollState={index:n,align:l,behavior:o,startedAt:c,lastTargetOffset:i,stableFrames:0},this._scrollToOffset(i,{adjustments:void 0,behavior:o}),this.scheduleScrollReconcile()},this.scrollBy=(n,{behavior:r="auto"}={})=>{const o=this.getScrollOffset()+n,s=this.now();this.scrollState={index:null,align:"start",behavior:r,startedAt:s,lastTargetOffset:o,stableFrames:0},this._scrollToOffset(o,{adjustments:void 0,behavior:r}),this.scheduleScrollReconcile()},this.scrollToEnd=({behavior:n="auto"}={})=>{if(this.options.count>0){this.scrollToIndex(this.options.count-1,{align:"end",behavior:n});return}this.scrollToOffset(Math.max(this.getTotalSize()-this.getSize(),0),{behavior:n})},this.getTotalSize=()=>{var n;const r=this.getMeasurements();let o;if(r.length===0)o=this.options.paddingStart;else if(this.options.lanes===1){const s=r.length-1,i=this._flatMeasurements;i!=null?o=i[s*2]+i[s*2+1]:o=((n=r[s])==null?void 0:n.end)??0}else{const s=Array(this.options.lanes).fill(null);let i=r.length-1;for(;i>=0&&s.some(l=>l===null);){const l=r[i];s[l.lane]===null&&(s[l.lane]=l.end),i--}o=Math.max(...s.filter(l=>l!==null))}return Math.max(o-this.options.scrollMargin+this.options.paddingEnd,0)},this.takeSnapshot=()=>{const n=[];if(this.itemSizeCache.size===0)return n;const r=this.getMeasurements();for(const o of r)o&&this.itemSizeCache.has(o.key)&&n.push({index:o.index,key:o.key,start:o.start,size:o.size,end:o.end,lane:o.lane});return n},this._scrollToOffset=(n,{adjustments:r,behavior:o})=>{this._intendedScrollOffset=n+(r??0),this.options.scrollToFn(n,{behavior:o,adjustments:r},this)},this.measure=()=>{this.pendingMin=null,this.itemSizeCache.clear(),this.laneAssignments.clear(),this.itemSizeCacheVersion++,this.notify(!1)},this.setOptions(t)}applyScrollAdjustment(t,n){t!==0&&(su()&&(this.isScrolling||this._iosTouching||this._iosJustTouchEnded)?this._iosDeferredAdjustment+=t:this._scrollToOffset(this.getScrollOffset(),{adjustments:this.scrollAdjustments+=t,behavior:n}))}scheduleScrollReconcile(){if(!this.targetWindow){this.scrollState=null;return}this.rafId==null&&(this.rafId=this.targetWindow.requestAnimationFrame(()=>{this.rafId=null,this.reconcileScroll()}))}reconcileScroll(){if(!this.scrollState||!this.scrollElement)return;if(this.now()-this.scrollState.startedAt>5e3){this.scrollState=null;return}const r=this.scrollState.index!=null?this.getOffsetForIndex(this.scrollState.index,this.scrollState.align):void 0,o=r?r[0]:this.scrollState.lastTargetOffset,s=1,i=o!==this.scrollState.lastTargetOffset;if(!i&&ou(o,this.getScrollOffset())){if(this.scrollState.stableFrames++,this.scrollState.stableFrames>=s){this.getScrollOffset()!==o&&this._scrollToOffset(o,{adjustments:void 0,behavior:"auto"}),this.scrollState=null;return}}else if(this.scrollState.stableFrames=0,i){const l=this.getSize()||600,c=Math.abs(o-this.getScrollOffset()),u=this.scrollState.behavior==="smooth"&&c>l;this.scrollState.lastTargetOffset=o,u||(this.scrollState.behavior="auto"),this._scrollToOffset(o,{adjustments:void 0,behavior:u?"smooth":"auto"})}this.scheduleScrollReconcile()}}const Rm=(e,t,n,r)=>{for(;e<=t;){const o=(e+t)/2|0,s=n(o);if(s<r)e=o+1;else if(s>r)t=o-1;else return o}return e>0?e-1:0};function CE({measurements:e,outerSize:t,scrollOffset:n,lanes:r,flat:o}){const s=e.length-1,i=o?d=>o[d*2]:d=>e[d].start,l=o?d=>o[d*2]+o[d*2+1]:d=>e[d].end;if(e.length<=r)return{startIndex:0,endIndex:s};let c=Rm(0,s,i,n),u=c;if(r===1)for(;u<s&&l(u)<n+t;)u++;else if(r>1){const d=Array(r).fill(0);for(;u<s&&d.some(h=>h<n+t);){const h=e[u];d[h.lane]=h.end,u++}const f=Array(r).fill(n+t);for(;c>=0&&f.some(h=>h>=n);){const h=e[c];f[h.lane]=h.start,c--}c=Math.max(0,c-c%r),u=Math.min(s,u+(r-1-u%r))}return{startIndex:c,endIndex:u}}const au=typeof document<"u"?x.useLayoutEffect:x.useEffect;function Pm({useFlushSync:e=!0,...t}){const n=x.useReducer(s=>s+1,0)[1],r={...t,onChange:(s,i)=>{var l;e&&i?Zr.flushSync(n):n(),(l=t.onChange)==null||l.call(t,s,i)}},[o]=x.useState(()=>new SE(r));return o.setOptions(r),au(()=>o._didMount(),[]),au(()=>o._willUpdate()),o}function jE(e){return Pm({observeElementRect:gE,observeElementOffset:yE,scrollToFn:_E,...e})}function NE(e){return Pm({getScrollElement:()=>typeof document<"u"?window:null,observeElementRect:xE,observeElementOffset:vE,scrollToFn:kE,initialOffset:()=>typeof document<"u"?window.scrollY:0,...e})}const EE=22,ii=1e4;function TE(e){return e==="added"?"+":e==="removed"?"-":" "}function AE(e){return e==="added"?"bg-green-500/10 text-green-700 dark:text-green-300":e==="removed"?"bg-red-500/10 text-red-700 dark:text-red-300":"text-foreground/80"}const IE=function({result:t,emptyLabel:n}){const[r,o]=x.useState("unified"),s=x.useRef(null),i=jE({count:t.lines.length,getScrollElement:()=>s.current,estimateSize:()=>EE,overscan:10});if(t.isEmpty)return a.jsx("div",{className:"rounded border border-dashed border-border bg-muted/30 px-4 py-6 text-center text-xs text-muted-foreground","data-testid":"diff-empty",children:n??"No transformation applied — raw and processed are identical."});const l=t.lines.length,c=l>ii,u=c?t.lines.slice(0,ii):t.lines;return a.jsxs("div",{className:"space-y-2",children:[a.jsxs("div",{className:"flex items-center justify-between text-xs text-muted-foreground",children:[a.jsxs("span",{children:[l.toLocaleString()," line",l===1?"":"s",c&&` (showing first ${ii.toLocaleString()})`]}),a.jsxs("div",{className:"inline-flex rounded-md border border-border overflow-hidden",children:[a.jsxs("button",{type:"button",onClick:()=>o("unified"),"aria-pressed":r==="unified",className:ve("flex items-center gap-1 px-2 py-1 transition-colors",r==="unified"?"bg-muted text-foreground":"hover:bg-muted/50"),title:"Unified diff (single column)",children:[a.jsx(Q2,{className:"size-3"}),"Unified"]}),a.jsxs("button",{type:"button",onClick:()=>o("split"),"aria-pressed":r==="split",className:ve("flex items-center gap-1 px-2 py-1 transition-colors border-l border-border",r==="split"?"bg-muted text-foreground":"hover:bg-muted/50"),title:"Split diff (side by side)",children:[a.jsx(u2,{className:"size-3"}),"Split"]})]})]}),a.jsx("div",{ref:s,className:"max-h-[60vh] overflow-auto rounded border border-border bg-background font-mono text-xs","data-testid":"diff-viewport",children:r==="unified"?a.jsx(zE,{virtualizer:i,lines:u}):a.jsx(OE,{lines:u})})]})};function zE({virtualizer:e,lines:t}){return a.jsx("div",{style:{height:`${e.getTotalSize()}px`,width:"100%",position:"relative"},children:e.getVirtualItems().map(n=>{const r=t[n.index];return r===void 0?null:a.jsxs("div",{"data-index":n.index,ref:e.measureElement,className:ve("flex items-start gap-3 px-2",AE(r.kind)),style:{position:"absolute",top:0,left:0,width:"100%",transform:`translateY(${n.start}px)`},children:[a.jsx("span",{className:"select-none text-muted-foreground/60 w-10 text-right tabular-nums",children:r.oldLineNumber??""}),a.jsx("span",{className:"select-none text-muted-foreground/60 w-10 text-right tabular-nums",children:r.newLineNumber??""}),a.jsx("span",{className:ve("select-none w-3 text-right font-bold",r.kind==="added"&&"text-green-600 dark:text-green-400",r.kind==="removed"&&"text-red-600 dark:text-red-400"),children:TE(r.kind)}),a.jsx("span",{className:"whitespace-pre-wrap break-all flex-1",children:r.text})]},n.key)})})}function RE(e){const t=[];let n=0;for(;n<e.length;){const r=e[n];if(r===void 0)break;if(r.kind==="context"){t.push({left:{text:r.text,lineNumber:r.oldLineNumber},right:{text:r.text,lineNumber:r.newLineNumber},kind:"equal"}),n+=1;continue}const o=[],s=[];for(;n<e.length&&e[n]?.kind==="removed";){const l=e[n];l!==void 0&&o.push(l),n+=1}for(;n<e.length&&e[n]?.kind==="added";){const l=e[n];l!==void 0&&s.push(l),n+=1}const i=Math.max(o.length,s.length);for(let l=0;l<i;l+=1){const c=o[l],u=s[l];c!==void 0&&u!==void 0?t.push({left:{text:c.text,lineNumber:c.oldLineNumber},right:{text:u.text,lineNumber:u.newLineNumber},kind:"changed"}):c!==void 0?t.push({left:{text:c.text,lineNumber:c.oldLineNumber},right:null,kind:"removed"}):u!==void 0&&t.push({left:null,right:{text:u.text,lineNumber:u.newLineNumber},kind:"added"})}}return t}function PE(e){switch(e){case"changed":return"bg-amber-500/10";case"removed":return"bg-red-500/10";case"added":return"bg-green-500/10";case"equal":return""}}function OE({lines:e}){const t=RE(e);return a.jsx("div",{"data-testid":"diff-split",children:t.map((n,r)=>a.jsxs("div",{className:ve("grid grid-cols-2 font-mono text-xs",PE(n.kind)),children:[a.jsxs("div",{className:"flex items-start gap-2 px-2 border-r border-border/50",children:[a.jsx("span",{className:"select-none text-muted-foreground/60 w-8 text-right tabular-nums",children:n.left?.lineNumber??""}),a.jsx("span",{className:ve("select-none w-3 text-right font-bold",(n.kind==="removed"||n.kind==="changed")&&"text-red-600 dark:text-red-400"),children:n.left!==null?"-":" "}),a.jsx("span",{className:"whitespace-pre-wrap break-all flex-1",children:n.left?.text??""})]}),a.jsxs("div",{className:"flex items-start gap-2 px-2",children:[a.jsx("span",{className:"select-none text-muted-foreground/60 w-8 text-right tabular-nums",children:n.right?.lineNumber??""}),a.jsx("span",{className:ve("select-none w-3 text-right font-bold",(n.kind==="added"||n.kind==="changed")&&"text-green-600 dark:text-green-400"),children:n.right!==null?"+":" "}),a.jsx("span",{className:"whitespace-pre-wrap break-all flex-1",children:n.right?.text??""})]})]},r))})}const Om=x.memo(IE),ME={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:"bg-rose-500/15 text-rose-400 border-rose-500/25",pending:"bg-muted text-muted-foreground border-border"};function xo(e){return e<1e3?`${e}ms`:`${(e/1e3).toFixed(1)}s`}function LE(e){return e>=10?`${e.toFixed(0)}/s`:`${e.toFixed(1)}/s`}function lu({trend:e}){if(e===null)return null;const t=e.direction==="up",n=t?Fv:Rv,r=t?"+":"-";return a.jsxs("span",{className:"flex items-center gap-0.5 text-muted-foreground tabular-nums",children:[a.jsx(n,{className:t?"size-3 text-emerald-400":"size-3 text-rose-400"}),a.jsxs("span",{className:"font-mono",children:[r,He(e.delta)]})]})}const DE=x.memo(function({log:e,messageCount:t=null,toolCount:n=null,expanded:r,onToggle:o,cacheTrend:s=null,activeTab:i,tabActions:l,onReplay:c,slowResponseThresholdSeconds:u=0,timeDisplayFormat:d}){const f=zk(e.responseStatus),h=e.elapsedMs!==null&&u>0&&e.elapsedMs>u*1e3,p=e.inputTokens!==null||e.outputTokens!==null,y=e.firstChunkMs??null,m=e.tokensPerSecond??null,g=y===null?null:xo(y),b=m===null||m<=0?null:LE(m);return a.jsx(tt,{children:a.jsxs("div",{id:`log-${e.id}`,role:"button",tabIndex:0,"data-nav-id":`log-${e.id}`,"data-nav-action":r?"collapse":"expand",className:ve("flex items-center gap-2 px-3 py-1 cursor-pointer transition-colors","hover:bg-muted/50","select-none","focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1 focus-visible:outline-none"),onClick:o,onKeyDown:v=>{(v.key==="Enter"||v.key===" ")&&(v.preventDefault(),o())},children:[a.jsxs("span",{className:"text-blue-400/80 font-mono text-xs font-semibold tabular-nums shrink-0",children:["#",e.id]}),a.jsxs("span",{className:"flex items-center gap-1 text-muted-foreground text-xs shrink-0",children:[a.jsx(hn,{className:"size-3"}),a.jsx("span",{className:"font-mono tabular-nums",title:e.timestamp,children:Di(e.timestamp,d)})]}),e.model!==null&&a.jsxs(Fe,{children:[a.jsx($e,{asChild:!0,children:a.jsx("span",{className:"shrink-0",children:a.jsx(Sm,{provider:_m(e.model),className:"size-4"})})}),a.jsx(Be,{children:e.model})]}),f!=="success"&&a.jsxs(st,{variant:"outline",className:ve("text-[10px] px-1.5 py-0 h-5 font-mono tabular-nums gap-1",ME[f]),children:[f==="server_error"?a.jsx(V2,{className:"size-3","aria-label":"Server error"}):f==="client_error"?a.jsx(Lo,{className:"size-3","aria-label":"Client error"}):f==="pending"?a.jsx(Wt,{className:"size-3 animate-spin","aria-label":"Pending"}):null,e.responseStatus]}),e.elapsedMs!==null&&a.jsxs(Fe,{children:[a.jsx($e,{asChild:!0,children:a.jsxs("span",{className:ve("flex items-center gap-1 text-xs shrink-0",h?"text-amber-400":"text-muted-foreground"),children:[a.jsx(hn,{className:"size-3"}),a.jsx("span",{className:"font-mono tabular-nums",children:xo(e.elapsedMs)}),h&&a.jsx(Lo,{className:"size-3","aria-label":"Slow response"})]})}),a.jsx(Be,{children:h?`Slow response: ${xo(e.elapsedMs)} exceeds ${xo(u*1e3)}`:e.streaming?"Total streaming response time":"Elapsed response time"})]}),e.streaming&&g!==null&&a.jsxs(Fe,{children:[a.jsx($e,{asChild:!0,children:a.jsxs("span",{className:"flex items-center gap-1 text-xs text-cyan-400 shrink-0",children:[a.jsx(pc,{className:"size-3"}),a.jsxs("span",{className:"font-mono tabular-nums",children:["first ",g]})]})}),a.jsx(Be,{children:"Time to first streaming chunk"})]}),e.streaming&&b!==null&&a.jsxs(Fe,{children:[a.jsx($e,{asChild:!0,children:a.jsxs("span",{className:"flex items-center gap-1 text-xs text-emerald-400 shrink-0",children:[a.jsx(Af,{className:"size-3"}),a.jsx("span",{className:"font-mono tabular-nums",children:b})]})}),a.jsx(Be,{children:"Output token throughput after first chunk"})]}),p&&a.jsxs("span",{className:"flex items-center gap-1 text-xs shrink-0",children:[a.jsx(Fr,{className:"size-3 text-muted-foreground"}),a.jsxs("span",{className:"font-mono tabular-nums",children:[a.jsxs("span",{className:e.inputTokens!==null?"text-blue-400":"text-muted-foreground",children:["IN ",e.inputTokens!==null?He(e.inputTokens):"—"]})," / ",a.jsxs("span",{className:e.outputTokens!==null?"text-amber-400":"text-muted-foreground",children:["OUT ",e.outputTokens!==null?He(e.outputTokens):"—"]})]})]}),e.cacheCreationInputTokens!==null&&e.cacheCreationInputTokens>0&&a.jsxs("span",{className:"flex items-center gap-1 text-xs shrink-0",children:[a.jsx(lu,{trend:s?.creation??null}),a.jsxs("span",{className:"font-mono tabular-nums text-emerald-400",children:["KV Cache +",He(e.cacheCreationInputTokens)]})]}),e.cacheReadInputTokens!==null&&e.cacheReadInputTokens>0&&a.jsxs("span",{className:"flex items-center gap-1 text-xs shrink-0",children:[a.jsx(lu,{trend:s?.read??null}),a.jsxs("span",{className:"font-mono tabular-nums text-purple-400",children:["KV Cache ~",He(e.cacheReadInputTokens)]})]}),t!==null&&a.jsxs("span",{className:"flex items-center gap-1 text-muted-foreground text-xs shrink-0",children:[a.jsx(fs,{className:"size-3"}),a.jsx("span",{className:"font-mono tabular-nums",children:t})]}),n!==null&&a.jsxs("span",{className:"flex items-center gap-1 text-muted-foreground text-xs shrink-0",children:[a.jsx(qr,{className:"size-3"}),a.jsx("span",{className:"font-mono tabular-nums",children:n})]}),e.origin!==null&&a.jsxs("span",{className:"hidden xl:flex items-center gap-1 text-muted-foreground text-xs shrink-0",title:`Origin: ${e.origin}`,children:[a.jsx(If,{className:"size-3"}),a.jsx("span",{className:"font-mono tabular-nums truncate max-w-[120px]",title:e.origin,children:e.origin})]}),(e.clientPid!==null||e.clientProjectFolder!==null)&&a.jsxs(Fe,{children:[a.jsx($e,{asChild:!0,children:a.jsxs("span",{className:"hidden xl:flex items-center gap-1 text-purple-400/80 text-xs shrink-0",children:[a.jsx(C2,{className:"size-3"}),e.clientProjectFolder!==null?a.jsx("span",{className:"font-mono tabular-nums",children:e.clientProjectFolder}):a.jsxs("span",{className:"font-mono tabular-nums",children:["PID ",e.clientPid]})]})}),a.jsx(Be,{children:e.clientCwd!==null?`PID: ${e.clientPid??"?"} CWD: ${e.clientCwd}`:`Process ID: ${e.clientPid??"?"}`})]}),e.streaming&&a.jsxs(Fe,{children:[a.jsx($e,{asChild:!0,children:a.jsx(pc,{className:"size-3 text-muted-foreground/60 shrink-0"})}),a.jsx(Be,{children:"Request used SSE streaming"})]}),a.jsx("span",{className:"flex-1 min-w-0"}),r&&a.jsxs("span",{className:"flex items-center gap-1.5 shrink-0",onClick:v=>v.stopPropagation(),onKeyDown:v=>v.stopPropagation(),children:[l!==void 0&&i!==void 0&&(()=>{const v=l[i];return v===void 0?null:a.jsxs(a.Fragment,{children:[v.expansion!==null&&a.jsxs(Fe,{children:[a.jsx($e,{asChild:!0,children:a.jsx(Ae,{variant:"outline",size:"icon",className:"size-8",onClick:v.expansion.onToggle,disabled:v.expansion.isPending,"aria-pressed":v.expansion.isExpanded,"aria-label":v.expansion.isExpanded?"Collapse all JSON":"Expand all JSON",children:v.expansion.isExpanded?a.jsx(Jv,{className:"size-3.5"}):a.jsx(Ef,{className:"size-3.5"})})}),a.jsx(Be,{children:v.expansion.isExpanded?"Collapse all JSON nodes":"Expand all JSON nodes"})]}),v.diffWithRaw!==void 0&&a.jsxs(Fe,{children:[a.jsx($e,{asChild:!0,children:a.jsx(Ae,{variant:"outline",size:"icon",className:ve("size-8",v.diffWithRaw.active&&"bg-accent text-accent-foreground"),onClick:v.diffWithRaw.onToggle,"aria-pressed":v.diffWithRaw.active,"aria-label":v.diffWithRaw.active?"Hide raw diff":"Diff with raw",children:a.jsx(w2,{className:"size-3.5"})})}),a.jsx(Be,{children:v.diffWithRaw.active?"Hide diff with raw request":"Show diff between displayed and raw request body"})]}),v.diffWithPrevious!==void 0&&a.jsxs(Fe,{children:[a.jsx($e,{asChild:!0,children:a.jsx(Ae,{variant:"outline",size:"icon",className:"size-8",onClick:v.diffWithPrevious,"aria-label":"Diff with previous",children:a.jsx(R2,{className:"size-3.5"})})}),a.jsx(Be,{children:"Compare this request with the immediately preceding one"})]}),v.copyText!==null&&a.jsxs(Fe,{children:[a.jsx($e,{asChild:!0,children:a.jsx(Ae,{variant:"outline",size:"icon",className:"size-8",onClick:v.onCopy,"aria-label":v.copyCopied?"Copied":v.copyLabel,children:v.copyCopied?a.jsx(rt,{className:"size-3.5 text-emerald-500"}):a.jsx(_t,{className:"size-3.5"})})}),a.jsx(Be,{children:v.copyCopied?"Copied to clipboard":v.copyLabel})]})]})})(),c!==void 0&&a.jsxs(Fe,{children:[a.jsx($e,{asChild:!0,children:a.jsx(Ae,{variant:"outline",size:"icon",className:"size-8",onClick:c,"aria-label":"Replay request",children:a.jsx(J2,{className:"size-3.5"})})}),a.jsx(Be,{children:"Re-send this request to the provider"})]})]}),r?a.jsx(Zt,{className:"size-4 text-muted-foreground shrink-0"}):a.jsx(on,{className:"size-4 text-muted-foreground shrink-0"})]})})});function FE({...e}){return a.jsx(i_,{"data-slot":"collapsible",...e})}function IO({...e}){return a.jsx(op,{"data-slot":"collapsible-trigger",...e})}function $E({...e}){return a.jsx(sp,{"data-slot":"collapsible-content",...e})}function BE(e,t){const n={};return(e[e.length-1]===""?[...e,""]:e).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const UE=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,WE=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,VE={};function cu(e,t){return(VE.jsx?WE:UE).test(e)}const HE=/[ \t\n\f\r]/g;function ZE(e){return typeof e=="object"?e.type==="text"?uu(e.value):!1:uu(e)}function uu(e){return e.replace(HE,"")===""}class Yr{constructor(t,n,r){this.normal=n,this.property=t,r&&(this.space=r)}}Yr.prototype.normal={};Yr.prototype.property={};Yr.prototype.space=void 0;function Mm(e,t){const n={},r={};for(const o of e)Object.assign(n,o.property),Object.assign(r,o.normal);return new Yr(n,r,t)}function na(e){return e.toLowerCase()}class ht{constructor(t,n){this.attribute=n,this.property=t}}ht.prototype.attribute="";ht.prototype.booleanish=!1;ht.prototype.boolean=!1;ht.prototype.commaOrSpaceSeparated=!1;ht.prototype.commaSeparated=!1;ht.prototype.defined=!1;ht.prototype.mustUseProperty=!1;ht.prototype.number=!1;ht.prototype.overloadedBoolean=!1;ht.prototype.property="";ht.prototype.spaceSeparated=!1;ht.prototype.space=void 0;let qE=0;const Ee=Ln(),Qe=Ln(),ra=Ln(),ue=Ln(),We=Ln(),er=Ln(),gt=Ln();function Ln(){return 2**++qE}const oa=Object.freeze(Object.defineProperty({__proto__:null,boolean:Ee,booleanish:Qe,commaOrSpaceSeparated:gt,commaSeparated:er,number:ue,overloadedBoolean:ra,spaceSeparated:We},Symbol.toStringTag,{value:"Module"})),ai=Object.keys(oa);class pl extends ht{constructor(t,n,r,o){let s=-1;if(super(t,n),du(this,"space",o),typeof r=="number")for(;++s<ai.length;){const i=ai[s];du(this,ai[s],(r&oa[i])===oa[i])}}}pl.prototype.defined=!0;function du(e,t,n){n&&(e[t]=n)}function xr(e){const t={},n={};for(const[r,o]of Object.entries(e.properties)){const s=new pl(r,e.transform(e.attributes||{},r),o,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(s.mustUseProperty=!0),t[r]=s,n[na(r)]=r,n[na(s.attribute)]=r}return new Yr(t,n,e.space)}const Lm=xr({properties:{ariaActiveDescendant:null,ariaAtomic:Qe,ariaAutoComplete:null,ariaBusy:Qe,ariaChecked:Qe,ariaColCount:ue,ariaColIndex:ue,ariaColSpan:ue,ariaControls:We,ariaCurrent:null,ariaDescribedBy:We,ariaDetails:null,ariaDisabled:Qe,ariaDropEffect:We,ariaErrorMessage:null,ariaExpanded:Qe,ariaFlowTo:We,ariaGrabbed:Qe,ariaHasPopup:null,ariaHidden:Qe,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:We,ariaLevel:ue,ariaLive:null,ariaModal:Qe,ariaMultiLine:Qe,ariaMultiSelectable:Qe,ariaOrientation:null,ariaOwns:We,ariaPlaceholder:null,ariaPosInSet:ue,ariaPressed:Qe,ariaReadOnly:Qe,ariaRelevant:null,ariaRequired:Qe,ariaRoleDescription:We,ariaRowCount:ue,ariaRowIndex:ue,ariaRowSpan:ue,ariaSelected:Qe,ariaSetSize:ue,ariaSort:null,ariaValueMax:ue,ariaValueMin:ue,ariaValueNow:ue,ariaValueText:null,role:null},transform(e,t){return t==="role"?t:"aria-"+t.slice(4).toLowerCase()}});function Dm(e,t){return t in e?e[t]:t}function Fm(e,t){return Dm(e,t.toLowerCase())}const KE=xr({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:er,acceptCharset:We,accessKey:We,action:null,allow:null,allowFullScreen:Ee,allowPaymentRequest:Ee,allowUserMedia:Ee,alt:null,as:null,async:Ee,autoCapitalize:null,autoComplete:We,autoFocus:Ee,autoPlay:Ee,blocking:We,capture:null,charSet:null,checked:Ee,cite:null,className:We,cols:ue,colSpan:null,content:null,contentEditable:Qe,controls:Ee,controlsList:We,coords:ue|er,crossOrigin:null,data:null,dateTime:null,decoding:null,default:Ee,defer:Ee,dir:null,dirName:null,disabled:Ee,download:ra,draggable:Qe,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:Ee,formTarget:null,headers:We,height:ue,hidden:ra,high:ue,href:null,hrefLang:null,htmlFor:We,httpEquiv:We,id:null,imageSizes:null,imageSrcSet:null,inert:Ee,inputMode:null,integrity:null,is:null,isMap:Ee,itemId:null,itemProp:We,itemRef:We,itemScope:Ee,itemType:We,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:Ee,low:ue,manifest:null,max:null,maxLength:ue,media:null,method:null,min:null,minLength:ue,multiple:Ee,muted:Ee,name:null,nonce:null,noModule:Ee,noValidate:Ee,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:Ee,optimum:ue,pattern:null,ping:We,placeholder:null,playsInline:Ee,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:Ee,referrerPolicy:null,rel:We,required:Ee,reversed:Ee,rows:ue,rowSpan:ue,sandbox:We,scope:null,scoped:Ee,seamless:Ee,selected:Ee,shadowRootClonable:Ee,shadowRootDelegatesFocus:Ee,shadowRootMode:null,shape:null,size:ue,sizes:null,slot:null,span:ue,spellCheck:Qe,src:null,srcDoc:null,srcLang:null,srcSet:null,start:ue,step:null,style:null,tabIndex:ue,target:null,title:null,translate:null,type:null,typeMustMatch:Ee,useMap:null,value:Qe,width:ue,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:We,axis:null,background:null,bgColor:null,border:ue,borderColor:null,bottomMargin:ue,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:Ee,declare:Ee,event:null,face:null,frame:null,frameBorder:null,hSpace:ue,leftMargin:ue,link:null,longDesc:null,lowSrc:null,marginHeight:ue,marginWidth:ue,noResize:Ee,noHref:Ee,noShade:Ee,noWrap:Ee,object:null,profile:null,prompt:null,rev:null,rightMargin:ue,rules:null,scheme:null,scrolling:Qe,standby:null,summary:null,text:null,topMargin:ue,valueType:null,version:null,vAlign:null,vLink:null,vSpace:ue,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:Ee,disableRemotePlayback:Ee,prefix:null,property:null,results:ue,security:null,unselectable:null},space:"html",transform:Fm}),GE=xr({attributes:{accentHeight:"accent-height",alignmentBaseline:"alignment-baseline",arabicForm:"arabic-form",baselineShift:"baseline-shift",capHeight:"cap-height",className:"class",clipPath:"clip-path",clipRule:"clip-rule",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorProfile:"color-profile",colorRendering:"color-rendering",crossOrigin:"crossorigin",dataType:"datatype",dominantBaseline:"dominant-baseline",enableBackground:"enable-background",fillOpacity:"fill-opacity",fillRule:"fill-rule",floodColor:"flood-color",floodOpacity:"flood-opacity",fontFamily:"font-family",fontSize:"font-size",fontSizeAdjust:"font-size-adjust",fontStretch:"font-stretch",fontStyle:"font-style",fontVariant:"font-variant",fontWeight:"font-weight",glyphName:"glyph-name",glyphOrientationHorizontal:"glyph-orientation-horizontal",glyphOrientationVertical:"glyph-orientation-vertical",hrefLang:"hreflang",horizAdvX:"horiz-adv-x",horizOriginX:"horiz-origin-x",horizOriginY:"horiz-origin-y",imageRendering:"image-rendering",letterSpacing:"letter-spacing",lightingColor:"lighting-color",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",navDown:"nav-down",navDownLeft:"nav-down-left",navDownRight:"nav-down-right",navLeft:"nav-left",navNext:"nav-next",navPrev:"nav-prev",navRight:"nav-right",navUp:"nav-up",navUpLeft:"nav-up-left",navUpRight:"nav-up-right",onAbort:"onabort",onActivate:"onactivate",onAfterPrint:"onafterprint",onBeforePrint:"onbeforeprint",onBegin:"onbegin",onCancel:"oncancel",onCanPlay:"oncanplay",onCanPlayThrough:"oncanplaythrough",onChange:"onchange",onClick:"onclick",onClose:"onclose",onCopy:"oncopy",onCueChange:"oncuechange",onCut:"oncut",onDblClick:"ondblclick",onDrag:"ondrag",onDragEnd:"ondragend",onDragEnter:"ondragenter",onDragExit:"ondragexit",onDragLeave:"ondragleave",onDragOver:"ondragover",onDragStart:"ondragstart",onDrop:"ondrop",onDurationChange:"ondurationchange",onEmptied:"onemptied",onEnd:"onend",onEnded:"onended",onError:"onerror",onFocus:"onfocus",onFocusIn:"onfocusin",onFocusOut:"onfocusout",onHashChange:"onhashchange",onInput:"oninput",onInvalid:"oninvalid",onKeyDown:"onkeydown",onKeyPress:"onkeypress",onKeyUp:"onkeyup",onLoad:"onload",onLoadedData:"onloadeddata",onLoadedMetadata:"onloadedmetadata",onLoadStart:"onloadstart",onMessage:"onmessage",onMouseDown:"onmousedown",onMouseEnter:"onmouseenter",onMouseLeave:"onmouseleave",onMouseMove:"onmousemove",onMouseOut:"onmouseout",onMouseOver:"onmouseover",onMouseUp:"onmouseup",onMouseWheel:"onmousewheel",onOffline:"onoffline",onOnline:"ononline",onPageHide:"onpagehide",onPageShow:"onpageshow",onPaste:"onpaste",onPause:"onpause",onPlay:"onplay",onPlaying:"onplaying",onPopState:"onpopstate",onProgress:"onprogress",onRateChange:"onratechange",onRepeat:"onrepeat",onReset:"onreset",onResize:"onresize",onScroll:"onscroll",onSeeked:"onseeked",onSeeking:"onseeking",onSelect:"onselect",onShow:"onshow",onStalled:"onstalled",onStorage:"onstorage",onSubmit:"onsubmit",onSuspend:"onsuspend",onTimeUpdate:"ontimeupdate",onToggle:"ontoggle",onUnload:"onunload",onVolumeChange:"onvolumechange",onWaiting:"onwaiting",onZoom:"onzoom",overlinePosition:"overline-position",overlineThickness:"overline-thickness",paintOrder:"paint-order",panose1:"panose-1",pointerEvents:"pointer-events",referrerPolicy:"referrerpolicy",renderingIntent:"rendering-intent",shapeRendering:"shape-rendering",stopColor:"stop-color",stopOpacity:"stop-opacity",strikethroughPosition:"strikethrough-position",strikethroughThickness:"strikethrough-thickness",strokeDashArray:"stroke-dasharray",strokeDashOffset:"stroke-dashoffset",strokeLineCap:"stroke-linecap",strokeLineJoin:"stroke-linejoin",strokeMiterLimit:"stroke-miterlimit",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",tabIndex:"tabindex",textAnchor:"text-anchor",textDecoration:"text-decoration",textRendering:"text-rendering",transformOrigin:"transform-origin",typeOf:"typeof",underlinePosition:"underline-position",underlineThickness:"underline-thickness",unicodeBidi:"unicode-bidi",unicodeRange:"unicode-range",unitsPerEm:"units-per-em",vAlphabetic:"v-alphabetic",vHanging:"v-hanging",vIdeographic:"v-ideographic",vMathematical:"v-mathematical",vectorEffect:"vector-effect",vertAdvY:"vert-adv-y",vertOriginX:"vert-origin-x",vertOriginY:"vert-origin-y",wordSpacing:"word-spacing",writingMode:"writing-mode",xHeight:"x-height",playbackOrder:"playbackorder",timelineBegin:"timelinebegin"},properties:{about:gt,accentHeight:ue,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:ue,amplitude:ue,arabicForm:null,ascent:ue,attributeName:null,attributeType:null,azimuth:ue,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:ue,by:null,calcMode:null,capHeight:ue,className:We,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:ue,diffuseConstant:ue,direction:null,display:null,dur:null,divisor:ue,dominantBaseline:null,download:Ee,dx:null,dy:null,edgeMode:null,editable:null,elevation:ue,enableBackground:null,end:null,event:null,exponent:ue,externalResourcesRequired:null,fill:null,fillOpacity:ue,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:er,g2:er,glyphName:er,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:ue,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:ue,horizOriginX:ue,horizOriginY:ue,id:null,ideographic:ue,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:ue,k:ue,k1:ue,k2:ue,k3:ue,k4:ue,kernelMatrix:gt,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:ue,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:ue,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:ue,overlineThickness:ue,paintOrder:null,panose1:null,path:null,pathLength:ue,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:We,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:ue,pointsAtY:ue,pointsAtZ:ue,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:gt,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:gt,rev:gt,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:gt,requiredFeatures:gt,requiredFonts:gt,requiredFormats:gt,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:ue,specularExponent:ue,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:ue,strikethroughThickness:ue,string:null,stroke:null,strokeDashArray:gt,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:ue,strokeOpacity:ue,strokeWidth:null,style:null,surfaceScale:ue,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:gt,tabIndex:ue,tableValues:null,target:null,targetX:ue,targetY:ue,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:gt,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:ue,underlineThickness:ue,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:ue,values:null,vAlphabetic:ue,vMathematical:ue,vectorEffect:null,vHanging:ue,vIdeographic:ue,version:null,vertAdvY:ue,vertOriginX:ue,vertOriginY:ue,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:ue,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:Dm}),$m=xr({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform(e,t){return"xlink:"+t.slice(5).toLowerCase()}}),Bm=xr({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:Fm}),Um=xr({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,t){return"xml:"+t.slice(3).toLowerCase()}}),JE={classId:"classID",dataType:"datatype",itemId:"itemID",strokeDashArray:"strokeDasharray",strokeDashOffset:"strokeDashoffset",strokeLineCap:"strokeLinecap",strokeLineJoin:"strokeLinejoin",strokeMiterLimit:"strokeMiterlimit",typeOf:"typeof",xLinkActuate:"xlinkActuate",xLinkArcRole:"xlinkArcrole",xLinkHref:"xlinkHref",xLinkRole:"xlinkRole",xLinkShow:"xlinkShow",xLinkTitle:"xlinkTitle",xLinkType:"xlinkType",xmlnsXLink:"xmlnsXlink"},YE=/[A-Z]/g,fu=/-[a-z]/g,XE=/^data[-\w.:]+$/i;function QE(e,t){const n=na(t);let r=t,o=ht;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)==="data"&&XE.test(t)){if(t.charAt(4)==="-"){const s=t.slice(5).replace(fu,t3);r="data"+s.charAt(0).toUpperCase()+s.slice(1)}else{const s=t.slice(4);if(!fu.test(s)){let i=s.replace(YE,e3);i.charAt(0)!=="-"&&(i="-"+i),t="data"+i}}o=pl}return new o(r,t)}function e3(e){return"-"+e.toLowerCase()}function t3(e){return e.charAt(1).toUpperCase()}const n3=Mm([Lm,KE,$m,Bm,Um],"html"),hl=Mm([Lm,GE,$m,Bm,Um],"svg");function r3(e){return e.join(" ").trim()}var Wn={},li,pu;function o3(){if(pu)return li;pu=1;var e=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,t=/\n/g,n=/^\s*/,r=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,o=/^:\s*/,s=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,i=/^[;\s]*/,l=/^\s+|\s+$/g,c=`
|
|
102
|
+
`,u="/",d="*",f="",h="comment",p="declaration";function y(g,b){if(typeof g!="string")throw new TypeError("First argument must be a string");if(!g)return[];b=b||{};var v=1,k=1;function S(w){var L=w.match(t);L&&(v+=L.length);var W=w.lastIndexOf(c);k=~W?w.length-W:k+w.length}function C(){var w={line:v,column:k};return function(L){return L.position=new j(w),z(),L}}function j(w){this.start=w,this.end={line:v,column:k},this.source=b.source}j.prototype.content=g;function E(w){var L=new Error(b.source+":"+v+":"+k+": "+w);if(L.reason=w,L.filename=b.source,L.line=v,L.column=k,L.source=g,!b.silent)throw L}function T(w){var L=w.exec(g);if(L){var W=L[0];return S(W),g=g.slice(W.length),L}}function z(){T(n)}function O(w){var L;for(w=w||[];L=B();)L!==!1&&w.push(L);return w}function B(){var w=C();if(!(u!=g.charAt(0)||d!=g.charAt(1))){for(var L=2;f!=g.charAt(L)&&(d!=g.charAt(L)||u!=g.charAt(L+1));)++L;if(L+=2,f===g.charAt(L-1))return E("End of comment missing");var W=g.slice(2,L-2);return k+=2,S(W),g=g.slice(L),k+=2,w({type:h,comment:W})}}function N(){var w=C(),L=T(r);if(L){if(B(),!T(o))return E("property missing ':'");var W=T(s),U=w({type:p,property:m(L[0].replace(e,f)),value:W?m(W[0].replace(e,f)):f});return T(i),U}}function D(){var w=[];O(w);for(var L;L=N();)L!==!1&&(w.push(L),O(w));return w}return z(),D()}function m(g){return g?g.replace(l,f):f}return li=y,li}var hu;function s3(){if(hu)return Wn;hu=1;var e=Wn&&Wn.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(Wn,"__esModule",{value:!0}),Wn.default=n;const t=e(o3());function n(r,o){let s=null;if(!r||typeof r!="string")return s;const i=(0,t.default)(r),l=typeof o=="function";return i.forEach(c=>{if(c.type!=="declaration")return;const{property:u,value:d}=c;l?o(u,d,c):d&&(s=s||{},s[u]=d)}),s}return Wn}var kr={},mu;function i3(){if(mu)return kr;mu=1,Object.defineProperty(kr,"__esModule",{value:!0}),kr.camelCase=void 0;var e=/^--[a-zA-Z0-9_-]+$/,t=/-([a-z])/g,n=/^[^-]+$/,r=/^-(webkit|moz|ms|o|khtml)-/,o=/^-(ms)-/,s=function(u){return!u||n.test(u)||e.test(u)},i=function(u,d){return d.toUpperCase()},l=function(u,d){return"".concat(d,"-")},c=function(u,d){return d===void 0&&(d={}),s(u)?u:(u=u.toLowerCase(),d.reactCompat?u=u.replace(o,l):u=u.replace(r,l),u.replace(t,i))};return kr.camelCase=c,kr}var _r,gu;function a3(){if(gu)return _r;gu=1;var e=_r&&_r.__importDefault||function(o){return o&&o.__esModule?o:{default:o}},t=e(s3()),n=i3();function r(o,s){var i={};return!o||typeof o!="string"||(0,t.default)(o,function(l,c){l&&c&&(i[(0,n.camelCase)(l,s)]=c)}),i}return r.default=r,_r=r,_r}var l3=a3();const c3=ka(l3),Wm=Vm("end"),ml=Vm("start");function Vm(e){return t;function t(n){const r=n&&n.position&&n.position[e]||{};if(typeof r.line=="number"&&r.line>0&&typeof r.column=="number"&&r.column>0)return{line:r.line,column:r.column,offset:typeof r.offset=="number"&&r.offset>-1?r.offset:void 0}}}function u3(e){const t=ml(e),n=Wm(e);if(t&&n)return{start:t,end:n}}function zr(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?xu(e.position):"start"in e||"end"in e?xu(e):"line"in e||"column"in e?sa(e):""}function sa(e){return bu(e&&e.line)+":"+bu(e&&e.column)}function xu(e){return sa(e&&e.start)+"-"+sa(e&&e.end)}function bu(e){return e&&typeof e=="number"?e:1}class it extends Error{constructor(t,n,r){super(),typeof n=="string"&&(r=n,n=void 0);let o="",s={},i=!1;if(n&&("line"in n&&"column"in n?s={place:n}:"start"in n&&"end"in n?s={place:n}:"type"in n?s={ancestors:[n],place:n.position}:s={...n}),typeof t=="string"?o=t:!s.cause&&t&&(i=!0,o=t.message,s.cause=t),!s.ruleId&&!s.source&&typeof r=="string"){const c=r.indexOf(":");c===-1?s.ruleId=r:(s.source=r.slice(0,c),s.ruleId=r.slice(c+1))}if(!s.place&&s.ancestors&&s.ancestors){const c=s.ancestors[s.ancestors.length-1];c&&(s.place=c.position)}const l=s.place&&"start"in s.place?s.place.start:s.place;this.ancestors=s.ancestors||void 0,this.cause=s.cause||void 0,this.column=l?l.column:void 0,this.fatal=void 0,this.file="",this.message=o,this.line=l?l.line:void 0,this.name=zr(s.place)||"1:1",this.place=s.place||void 0,this.reason=this.message,this.ruleId=s.ruleId||void 0,this.source=s.source||void 0,this.stack=i&&s.cause&&typeof s.cause.stack=="string"?s.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}it.prototype.file="";it.prototype.name="";it.prototype.reason="";it.prototype.message="";it.prototype.stack="";it.prototype.column=void 0;it.prototype.line=void 0;it.prototype.ancestors=void 0;it.prototype.cause=void 0;it.prototype.fatal=void 0;it.prototype.place=void 0;it.prototype.ruleId=void 0;it.prototype.source=void 0;const gl={}.hasOwnProperty,d3=new Map,f3=/[A-Z]/g,p3=new Set(["table","tbody","thead","tfoot","tr"]),h3=new Set(["td","th"]),Hm="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function m3(e,t){if(!t||t.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const n=t.filePath||void 0;let r;if(t.development){if(typeof t.jsxDEV!="function")throw new TypeError("Expected `jsxDEV` in options when `development: true`");r=_3(n,t.jsxDEV)}else{if(typeof t.jsx!="function")throw new TypeError("Expected `jsx` in production options");if(typeof t.jsxs!="function")throw new TypeError("Expected `jsxs` in production options");r=k3(n,t.jsx,t.jsxs)}const o={Fragment:t.Fragment,ancestors:[],components:t.components||{},create:r,elementAttributeNameCase:t.elementAttributeNameCase||"react",evaluater:t.createEvaluater?t.createEvaluater():void 0,filePath:n,ignoreInvalidStyle:t.ignoreInvalidStyle||!1,passKeys:t.passKeys!==!1,passNode:t.passNode||!1,schema:t.space==="svg"?hl:n3,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},s=Zm(o,e,void 0);return s&&typeof s!="string"?s:o.create(e,o.Fragment,{children:s||void 0},void 0)}function Zm(e,t,n){if(t.type==="element")return g3(e,t,n);if(t.type==="mdxFlowExpression"||t.type==="mdxTextExpression")return x3(e,t);if(t.type==="mdxJsxFlowElement"||t.type==="mdxJsxTextElement")return y3(e,t,n);if(t.type==="mdxjsEsm")return b3(e,t);if(t.type==="root")return v3(e,t,n);if(t.type==="text")return w3(e,t)}function g3(e,t,n){const r=e.schema;let o=r;t.tagName.toLowerCase()==="svg"&&r.space==="html"&&(o=hl,e.schema=o),e.ancestors.push(t);const s=Km(e,t.tagName,!1),i=S3(e,t);let l=bl(e,t);return p3.has(t.tagName)&&(l=l.filter(function(c){return typeof c=="string"?!ZE(c):!0})),qm(e,i,s,t),xl(i,l),e.ancestors.pop(),e.schema=r,e.create(t,s,i,n)}function x3(e,t){if(t.data&&t.data.estree&&e.evaluater){const r=t.data.estree.body[0];return r.type,e.evaluater.evaluateExpression(r.expression)}Vr(e,t.position)}function b3(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);Vr(e,t.position)}function y3(e,t,n){const r=e.schema;let o=r;t.name==="svg"&&r.space==="html"&&(o=hl,e.schema=o),e.ancestors.push(t);const s=t.name===null?e.Fragment:Km(e,t.name,!0),i=C3(e,t),l=bl(e,t);return qm(e,i,s,t),xl(i,l),e.ancestors.pop(),e.schema=r,e.create(t,s,i,n)}function v3(e,t,n){const r={};return xl(r,bl(e,t)),e.create(t,e.Fragment,r,n)}function w3(e,t){return t.value}function qm(e,t,n,r){typeof n!="string"&&n!==e.Fragment&&e.passNode&&(t.node=r)}function xl(e,t){if(t.length>0){const n=t.length>1?t:t[0];n&&(e.children=n)}}function k3(e,t,n){return r;function r(o,s,i,l){const u=Array.isArray(i.children)?n:t;return l?u(s,i,l):u(s,i)}}function _3(e,t){return n;function n(r,o,s,i){const l=Array.isArray(s.children),c=ml(r);return t(o,s,i,l,{columnNumber:c?c.column-1:void 0,fileName:e,lineNumber:c?c.line:void 0},void 0)}}function S3(e,t){const n={};let r,o;for(o in t.properties)if(o!=="children"&&gl.call(t.properties,o)){const s=j3(e,o,t.properties[o]);if(s){const[i,l]=s;e.tableCellAlignToStyle&&i==="align"&&typeof l=="string"&&h3.has(t.tagName)?r=l:n[i]=l}}if(r){const s=n.style||(n.style={});s[e.stylePropertyNameCase==="css"?"text-align":"textAlign"]=r}return n}function C3(e,t){const n={};for(const r of t.attributes)if(r.type==="mdxJsxExpressionAttribute")if(r.data&&r.data.estree&&e.evaluater){const s=r.data.estree.body[0];s.type;const i=s.expression;i.type;const l=i.properties[0];l.type,Object.assign(n,e.evaluater.evaluateExpression(l.argument))}else Vr(e,t.position);else{const o=r.name;let s;if(r.value&&typeof r.value=="object")if(r.value.data&&r.value.data.estree&&e.evaluater){const l=r.value.data.estree.body[0];l.type,s=e.evaluater.evaluateExpression(l.expression)}else Vr(e,t.position);else s=r.value===null?!0:r.value;n[o]=s}return n}function bl(e,t){const n=[];let r=-1;const o=e.passKeys?new Map:d3;for(;++r<t.children.length;){const s=t.children[r];let i;if(e.passKeys){const c=s.type==="element"?s.tagName:s.type==="mdxJsxFlowElement"||s.type==="mdxJsxTextElement"?s.name:void 0;if(c){const u=o.get(c)||0;i=c+"-"+u,o.set(c,u+1)}}const l=Zm(e,s,i);l!==void 0&&n.push(l)}return n}function j3(e,t,n){const r=QE(e.schema,t);if(!(n==null||typeof n=="number"&&Number.isNaN(n))){if(Array.isArray(n)&&(n=r.commaSeparated?BE(n):r3(n)),r.property==="style"){let o=typeof n=="object"?n:N3(e,String(n));return e.stylePropertyNameCase==="css"&&(o=E3(o)),["style",o]}return[e.elementAttributeNameCase==="react"&&r.space?JE[r.property]||r.property:r.attribute,n]}}function N3(e,t){try{return c3(t,{reactCompat:!0})}catch(n){if(e.ignoreInvalidStyle)return{};const r=n,o=new it("Cannot parse `style` attribute",{ancestors:e.ancestors,cause:r,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw o.file=e.filePath||void 0,o.url=Hm+"#cannot-parse-style-attribute",o}}function Km(e,t,n){let r;if(!n)r={type:"Literal",value:t};else if(t.includes(".")){const o=t.split(".");let s=-1,i;for(;++s<o.length;){const l=cu(o[s])?{type:"Identifier",name:o[s]}:{type:"Literal",value:o[s]};i=i?{type:"MemberExpression",object:i,property:l,computed:!!(s&&l.type==="Literal"),optional:!1}:l}r=i}else r=cu(t)&&!/^[a-z]/.test(t)?{type:"Identifier",name:t}:{type:"Literal",value:t};if(r.type==="Literal"){const o=r.value;return gl.call(e.components,o)?e.components[o]:o}if(e.evaluater)return e.evaluater.evaluateExpression(r);Vr(e)}function Vr(e,t){const n=new it("Cannot handle MDX estrees without `createEvaluater`",{ancestors:e.ancestors,place:t,ruleId:"mdx-estree",source:"hast-util-to-jsx-runtime"});throw n.file=e.filePath||void 0,n.url=Hm+"#cannot-handle-mdx-estrees-without-createevaluater",n}function E3(e){const t={};let n;for(n in e)gl.call(e,n)&&(t[T3(n)]=e[n]);return t}function T3(e){let t=e.replace(f3,A3);return t.slice(0,3)==="ms-"&&(t="-"+t),t}function A3(e){return"-"+e.toLowerCase()}const ci={action:["form"],cite:["blockquote","del","ins","q"],data:["object"],formAction:["button","input"],href:["a","area","base","link"],icon:["menuitem"],itemId:null,manifest:["html"],ping:["a","area"],poster:["video"],src:["audio","embed","iframe","img","input","script","source","track","video"]},I3={};function z3(e,t){const n=I3,r=typeof n.includeImageAlt=="boolean"?n.includeImageAlt:!0,o=typeof n.includeHtml=="boolean"?n.includeHtml:!0;return Gm(e,r,o)}function Gm(e,t,n){if(R3(e)){if("value"in e)return e.type==="html"&&!n?"":e.value;if(t&&"alt"in e&&e.alt)return e.alt;if("children"in e)return yu(e.children,t,n)}return Array.isArray(e)?yu(e,t,n):""}function yu(e,t,n){const r=[];let o=-1;for(;++o<e.length;)r[o]=Gm(e[o],t,n);return r.join("")}function R3(e){return!!(e&&typeof e=="object")}const vu=document.createElement("i");function yl(e){const t="&"+e+";";vu.innerHTML=t;const n=vu.textContent;return n.charCodeAt(n.length-1)===59&&e!=="semi"||n===t?!1:n}function Ht(e,t,n,r){const o=e.length;let s=0,i;if(t<0?t=-t>o?0:o+t:t=t>o?o:t,n=n>0?n:0,r.length<1e4)i=Array.from(r),i.unshift(t,n),e.splice(...i);else for(n&&e.splice(t,n);s<r.length;)i=r.slice(s,s+1e4),i.unshift(t,0),e.splice(...i),s+=1e4,t+=1e4}function wt(e,t){return e.length>0?(Ht(e,e.length,0,t),e):t}const wu={}.hasOwnProperty;function P3(e){const t={};let n=-1;for(;++n<e.length;)O3(t,e[n]);return t}function O3(e,t){let n;for(n in t){const o=(wu.call(e,n)?e[n]:void 0)||(e[n]={}),s=t[n];let i;if(s)for(i in s){wu.call(o,i)||(o[i]=[]);const l=s[i];M3(o[i],Array.isArray(l)?l:l?[l]:[])}}}function M3(e,t){let n=-1;const r=[];for(;++n<t.length;)(t[n].add==="after"?e:r).push(t[n]);Ht(e,0,0,r)}function Jm(e,t){const n=Number.parseInt(e,t);return n<9||n===11||n>13&&n<32||n>126&&n<160||n>55295&&n<57344||n>64975&&n<65008||(n&65535)===65535||(n&65535)===65534||n>1114111?"�":String.fromCodePoint(n)}function tr(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const Ft=kn(/[A-Za-z]/),yt=kn(/[\dA-Za-z]/),L3=kn(/[#-'*+\--9=?A-Z^-~]/);function ia(e){return e!==null&&(e<32||e===127)}const aa=kn(/\d/),D3=kn(/[\dA-Fa-f]/),F3=kn(/[!-/:-@[-`{-~]/);function Ce(e){return e!==null&&e<-2}function dt(e){return e!==null&&(e<0||e===32)}function Le(e){return e===-2||e===-1||e===32}const $3=kn(new RegExp("\\p{P}|\\p{S}","u")),B3=kn(/\s/);function kn(e){return t;function t(n){return n!==null&&n>-1&&e.test(String.fromCharCode(n))}}function br(e){const t=[];let n=-1,r=0,o=0;for(;++n<e.length;){const s=e.charCodeAt(n);let i="";if(s===37&&yt(e.charCodeAt(n+1))&&yt(e.charCodeAt(n+2)))o=2;else if(s<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(s))||(i=String.fromCharCode(s));else if(s>55295&&s<57344){const l=e.charCodeAt(n+1);s<56320&&l>56319&&l<57344?(i=String.fromCharCode(s,l),o=1):i="�"}else i=String.fromCharCode(s);i&&(t.push(e.slice(r,n),encodeURIComponent(i)),r=n+o+1,i=""),o&&(n+=o,o=0)}return t.join("")+e.slice(r)}function Ve(e,t,n,r){const o=r?r-1:Number.POSITIVE_INFINITY;let s=0;return i;function i(c){return Le(c)?(e.enter(n),l(c)):t(c)}function l(c){return Le(c)&&s++<o?(e.consume(c),l):(e.exit(n),t(c))}}const U3={tokenize:W3};function W3(e){const t=e.attempt(this.parser.constructs.contentInitial,r,o);let n;return t;function r(l){if(l===null){e.consume(l);return}return e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),Ve(e,t,"linePrefix")}function o(l){return e.enter("paragraph"),s(l)}function s(l){const c=e.enter("chunkText",{contentType:"text",previous:n});return n&&(n.next=c),n=c,i(l)}function i(l){if(l===null){e.exit("chunkText"),e.exit("paragraph"),e.consume(l);return}return Ce(l)?(e.consume(l),e.exit("chunkText"),s):(e.consume(l),i)}}const V3={tokenize:H3},ku={tokenize:Z3};function H3(e){const t=this,n=[];let r=0,o,s,i;return l;function l(k){if(r<n.length){const S=n[r];return t.containerState=S[1],e.attempt(S[0].continuation,c,u)(k)}return u(k)}function c(k){if(r++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,o&&v();const S=t.events.length;let C=S,j;for(;C--;)if(t.events[C][0]==="exit"&&t.events[C][1].type==="chunkFlow"){j=t.events[C][1].end;break}b(r);let E=S;for(;E<t.events.length;)t.events[E][1].end={...j},E++;return Ht(t.events,C+1,0,t.events.slice(S)),t.events.length=E,u(k)}return l(k)}function u(k){if(r===n.length){if(!o)return h(k);if(o.currentConstruct&&o.currentConstruct.concrete)return y(k);t.interrupt=!!(o.currentConstruct&&!o._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(ku,d,f)(k)}function d(k){return o&&v(),b(r),h(k)}function f(k){return t.parser.lazy[t.now().line]=r!==n.length,i=t.now().offset,y(k)}function h(k){return t.containerState={},e.attempt(ku,p,y)(k)}function p(k){return r++,n.push([t.currentConstruct,t.containerState]),h(k)}function y(k){if(k===null){o&&v(),b(0),e.consume(k);return}return o=o||t.parser.flow(t.now()),e.enter("chunkFlow",{_tokenizer:o,contentType:"flow",previous:s}),m(k)}function m(k){if(k===null){g(e.exit("chunkFlow"),!0),b(0),e.consume(k);return}return Ce(k)?(e.consume(k),g(e.exit("chunkFlow")),r=0,t.interrupt=void 0,l):(e.consume(k),m)}function g(k,S){const C=t.sliceStream(k);if(S&&C.push(null),k.previous=s,s&&(s.next=k),s=k,o.defineSkip(k.start),o.write(C),t.parser.lazy[k.start.line]){let j=o.events.length;for(;j--;)if(o.events[j][1].start.offset<i&&(!o.events[j][1].end||o.events[j][1].end.offset>i))return;const E=t.events.length;let T=E,z,O;for(;T--;)if(t.events[T][0]==="exit"&&t.events[T][1].type==="chunkFlow"){if(z){O=t.events[T][1].end;break}z=!0}for(b(r),j=E;j<t.events.length;)t.events[j][1].end={...O},j++;Ht(t.events,T+1,0,t.events.slice(E)),t.events.length=j}}function b(k){let S=n.length;for(;S-- >k;){const C=n[S];t.containerState=C[1],C[0].exit.call(t,e)}n.length=k}function v(){o.write([null]),s=void 0,o=void 0,t.containerState._closeFlow=void 0}}function Z3(e,t,n){return Ve(e,e.attempt(this.parser.constructs.document,t,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function _u(e){if(e===null||dt(e)||B3(e))return 1;if($3(e))return 2}function vl(e,t,n){const r=[];let o=-1;for(;++o<e.length;){const s=e[o].resolveAll;s&&!r.includes(s)&&(t=s(t,n),r.push(s))}return t}const la={name:"attention",resolveAll:q3,tokenize:K3};function q3(e,t){let n=-1,r,o,s,i,l,c,u,d;for(;++n<e.length;)if(e[n][0]==="enter"&&e[n][1].type==="attentionSequence"&&e[n][1]._close){for(r=n;r--;)if(e[r][0]==="exit"&&e[r][1].type==="attentionSequence"&&e[r][1]._open&&t.sliceSerialize(e[r][1]).charCodeAt(0)===t.sliceSerialize(e[n][1]).charCodeAt(0)){if((e[r][1]._close||e[n][1]._open)&&(e[n][1].end.offset-e[n][1].start.offset)%3&&!((e[r][1].end.offset-e[r][1].start.offset+e[n][1].end.offset-e[n][1].start.offset)%3))continue;c=e[r][1].end.offset-e[r][1].start.offset>1&&e[n][1].end.offset-e[n][1].start.offset>1?2:1;const f={...e[r][1].end},h={...e[n][1].start};Su(f,-c),Su(h,c),i={type:c>1?"strongSequence":"emphasisSequence",start:f,end:{...e[r][1].end}},l={type:c>1?"strongSequence":"emphasisSequence",start:{...e[n][1].start},end:h},s={type:c>1?"strongText":"emphasisText",start:{...e[r][1].end},end:{...e[n][1].start}},o={type:c>1?"strong":"emphasis",start:{...i.start},end:{...l.end}},e[r][1].end={...i.start},e[n][1].start={...l.end},u=[],e[r][1].end.offset-e[r][1].start.offset&&(u=wt(u,[["enter",e[r][1],t],["exit",e[r][1],t]])),u=wt(u,[["enter",o,t],["enter",i,t],["exit",i,t],["enter",s,t]]),u=wt(u,vl(t.parser.constructs.insideSpan.null,e.slice(r+1,n),t)),u=wt(u,[["exit",s,t],["enter",l,t],["exit",l,t],["exit",o,t]]),e[n][1].end.offset-e[n][1].start.offset?(d=2,u=wt(u,[["enter",e[n][1],t],["exit",e[n][1],t]])):d=0,Ht(e,r-1,n-r+3,u),n=r+u.length-d-2;break}}for(n=-1;++n<e.length;)e[n][1].type==="attentionSequence"&&(e[n][1].type="data");return e}function K3(e,t){const n=this.parser.constructs.attentionMarkers.null,r=this.previous,o=_u(r);let s;return i;function i(c){return s=c,e.enter("attentionSequence"),l(c)}function l(c){if(c===s)return e.consume(c),l;const u=e.exit("attentionSequence"),d=_u(c),f=!d||d===2&&o||n.includes(c),h=!o||o===2&&d||n.includes(r);return u._open=!!(s===42?f:f&&(o||!h)),u._close=!!(s===42?h:h&&(d||!f)),t(c)}}function Su(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}const G3={name:"autolink",tokenize:J3};function J3(e,t,n){let r=0;return o;function o(p){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(p),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),s}function s(p){return Ft(p)?(e.consume(p),i):p===64?n(p):u(p)}function i(p){return p===43||p===45||p===46||yt(p)?(r=1,l(p)):u(p)}function l(p){return p===58?(e.consume(p),r=0,c):(p===43||p===45||p===46||yt(p))&&r++<32?(e.consume(p),l):(r=0,u(p))}function c(p){return p===62?(e.exit("autolinkProtocol"),e.enter("autolinkMarker"),e.consume(p),e.exit("autolinkMarker"),e.exit("autolink"),t):p===null||p===32||p===60||ia(p)?n(p):(e.consume(p),c)}function u(p){return p===64?(e.consume(p),d):L3(p)?(e.consume(p),u):n(p)}function d(p){return yt(p)?f(p):n(p)}function f(p){return p===46?(e.consume(p),r=0,d):p===62?(e.exit("autolinkProtocol").type="autolinkEmail",e.enter("autolinkMarker"),e.consume(p),e.exit("autolinkMarker"),e.exit("autolink"),t):h(p)}function h(p){if((p===45||yt(p))&&r++<63){const y=p===45?h:f;return e.consume(p),y}return n(p)}}const Ds={partial:!0,tokenize:Y3};function Y3(e,t,n){return r;function r(s){return Le(s)?Ve(e,o,"linePrefix")(s):o(s)}function o(s){return s===null||Ce(s)?t(s):n(s)}}const Ym={continuation:{tokenize:Q3},exit:eT,name:"blockQuote",tokenize:X3};function X3(e,t,n){const r=this;return o;function o(i){if(i===62){const l=r.containerState;return l.open||(e.enter("blockQuote",{_container:!0}),l.open=!0),e.enter("blockQuotePrefix"),e.enter("blockQuoteMarker"),e.consume(i),e.exit("blockQuoteMarker"),s}return n(i)}function s(i){return Le(i)?(e.enter("blockQuotePrefixWhitespace"),e.consume(i),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),t):(e.exit("blockQuotePrefix"),t(i))}}function Q3(e,t,n){const r=this;return o;function o(i){return Le(i)?Ve(e,s,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(i):s(i)}function s(i){return e.attempt(Ym,t,n)(i)}}function eT(e){e.exit("blockQuote")}const Xm={name:"characterEscape",tokenize:tT};function tT(e,t,n){return r;function r(s){return e.enter("characterEscape"),e.enter("escapeMarker"),e.consume(s),e.exit("escapeMarker"),o}function o(s){return F3(s)?(e.enter("characterEscapeValue"),e.consume(s),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):n(s)}}const Qm={name:"characterReference",tokenize:nT};function nT(e,t,n){const r=this;let o=0,s,i;return l;function l(f){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(f),e.exit("characterReferenceMarker"),c}function c(f){return f===35?(e.enter("characterReferenceMarkerNumeric"),e.consume(f),e.exit("characterReferenceMarkerNumeric"),u):(e.enter("characterReferenceValue"),s=31,i=yt,d(f))}function u(f){return f===88||f===120?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(f),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),s=6,i=D3,d):(e.enter("characterReferenceValue"),s=7,i=aa,d(f))}function d(f){if(f===59&&o){const h=e.exit("characterReferenceValue");return i===yt&&!yl(r.sliceSerialize(h))?n(f):(e.enter("characterReferenceMarker"),e.consume(f),e.exit("characterReferenceMarker"),e.exit("characterReference"),t)}return i(f)&&o++<s?(e.consume(f),d):n(f)}}const Cu={partial:!0,tokenize:oT},ju={concrete:!0,name:"codeFenced",tokenize:rT};function rT(e,t,n){const r=this,o={partial:!0,tokenize:C};let s=0,i=0,l;return c;function c(j){return u(j)}function u(j){const E=r.events[r.events.length-1];return s=E&&E[1].type==="linePrefix"?E[2].sliceSerialize(E[1],!0).length:0,l=j,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),d(j)}function d(j){return j===l?(i++,e.consume(j),d):i<3?n(j):(e.exit("codeFencedFenceSequence"),Le(j)?Ve(e,f,"whitespace")(j):f(j))}function f(j){return j===null||Ce(j)?(e.exit("codeFencedFence"),r.interrupt?t(j):e.check(Cu,m,S)(j)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),h(j))}function h(j){return j===null||Ce(j)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),f(j)):Le(j)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),Ve(e,p,"whitespace")(j)):j===96&&j===l?n(j):(e.consume(j),h)}function p(j){return j===null||Ce(j)?f(j):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),y(j))}function y(j){return j===null||Ce(j)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),f(j)):j===96&&j===l?n(j):(e.consume(j),y)}function m(j){return e.attempt(o,S,g)(j)}function g(j){return e.enter("lineEnding"),e.consume(j),e.exit("lineEnding"),b}function b(j){return s>0&&Le(j)?Ve(e,v,"linePrefix",s+1)(j):v(j)}function v(j){return j===null||Ce(j)?e.check(Cu,m,S)(j):(e.enter("codeFlowValue"),k(j))}function k(j){return j===null||Ce(j)?(e.exit("codeFlowValue"),v(j)):(e.consume(j),k)}function S(j){return e.exit("codeFenced"),t(j)}function C(j,E,T){let z=0;return O;function O(L){return j.enter("lineEnding"),j.consume(L),j.exit("lineEnding"),B}function B(L){return j.enter("codeFencedFence"),Le(L)?Ve(j,N,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(L):N(L)}function N(L){return L===l?(j.enter("codeFencedFenceSequence"),D(L)):T(L)}function D(L){return L===l?(z++,j.consume(L),D):z>=i?(j.exit("codeFencedFenceSequence"),Le(L)?Ve(j,w,"whitespace")(L):w(L)):T(L)}function w(L){return L===null||Ce(L)?(j.exit("codeFencedFence"),E(L)):T(L)}}}function oT(e,t,n){const r=this;return o;function o(i){return i===null?n(i):(e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),s)}function s(i){return r.parser.lazy[r.now().line]?n(i):t(i)}}const ui={name:"codeIndented",tokenize:iT},sT={partial:!0,tokenize:aT};function iT(e,t,n){const r=this;return o;function o(u){return e.enter("codeIndented"),Ve(e,s,"linePrefix",5)(u)}function s(u){const d=r.events[r.events.length-1];return d&&d[1].type==="linePrefix"&&d[2].sliceSerialize(d[1],!0).length>=4?i(u):n(u)}function i(u){return u===null?c(u):Ce(u)?e.attempt(sT,i,c)(u):(e.enter("codeFlowValue"),l(u))}function l(u){return u===null||Ce(u)?(e.exit("codeFlowValue"),i(u)):(e.consume(u),l)}function c(u){return e.exit("codeIndented"),t(u)}}function aT(e,t,n){const r=this;return o;function o(i){return r.parser.lazy[r.now().line]?n(i):Ce(i)?(e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),o):Ve(e,s,"linePrefix",5)(i)}function s(i){const l=r.events[r.events.length-1];return l&&l[1].type==="linePrefix"&&l[2].sliceSerialize(l[1],!0).length>=4?t(i):Ce(i)?o(i):n(i)}}const lT={name:"codeText",previous:uT,resolve:cT,tokenize:dT};function cT(e){let t=e.length-4,n=3,r,o;if((e[n][1].type==="lineEnding"||e[n][1].type==="space")&&(e[t][1].type==="lineEnding"||e[t][1].type==="space")){for(r=n;++r<t;)if(e[r][1].type==="codeTextData"){e[n][1].type="codeTextPadding",e[t][1].type="codeTextPadding",n+=2,t-=2;break}}for(r=n-1,t++;++r<=t;)o===void 0?r!==t&&e[r][1].type!=="lineEnding"&&(o=r):(r===t||e[r][1].type==="lineEnding")&&(e[o][1].type="codeTextData",r!==o+2&&(e[o][1].end=e[r-1][1].end,e.splice(o+2,r-o-2),t-=r-o-2,r=o+2),o=void 0);return e}function uT(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function dT(e,t,n){let r=0,o,s;return i;function i(f){return e.enter("codeText"),e.enter("codeTextSequence"),l(f)}function l(f){return f===96?(e.consume(f),r++,l):(e.exit("codeTextSequence"),c(f))}function c(f){return f===null?n(f):f===32?(e.enter("space"),e.consume(f),e.exit("space"),c):f===96?(s=e.enter("codeTextSequence"),o=0,d(f)):Ce(f)?(e.enter("lineEnding"),e.consume(f),e.exit("lineEnding"),c):(e.enter("codeTextData"),u(f))}function u(f){return f===null||f===32||f===96||Ce(f)?(e.exit("codeTextData"),c(f)):(e.consume(f),u)}function d(f){return f===96?(e.consume(f),o++,d):o===r?(e.exit("codeTextSequence"),e.exit("codeText"),t(f)):(s.type="codeTextData",u(f))}}class fT{constructor(t){this.left=t?[...t]:[],this.right=[]}get(t){if(t<0||t>=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+t+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return t<this.left.length?this.left[t]:this.right[this.right.length-t+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(t,n){const r=n??Number.POSITIVE_INFINITY;return r<this.left.length?this.left.slice(t,r):t>this.left.length?this.right.slice(this.right.length-r+this.left.length,this.right.length-t+this.left.length).reverse():this.left.slice(t).concat(this.right.slice(this.right.length-r+this.left.length).reverse())}splice(t,n,r){const o=n||0;this.setCursor(Math.trunc(t));const s=this.right.splice(this.right.length-o,Number.POSITIVE_INFINITY);return r&&Sr(this.left,r),s.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(t){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(t)}pushMany(t){this.setCursor(Number.POSITIVE_INFINITY),Sr(this.left,t)}unshift(t){this.setCursor(0),this.right.push(t)}unshiftMany(t){this.setCursor(0),Sr(this.right,t.reverse())}setCursor(t){if(!(t===this.left.length||t>this.left.length&&this.right.length===0||t<0&&this.left.length===0))if(t<this.left.length){const n=this.left.splice(t,Number.POSITIVE_INFINITY);Sr(this.right,n.reverse())}else{const n=this.right.splice(this.left.length+this.right.length-t,Number.POSITIVE_INFINITY);Sr(this.left,n.reverse())}}}function Sr(e,t){let n=0;if(t.length<1e4)e.push(...t);else for(;n<t.length;)e.push(...t.slice(n,n+1e4)),n+=1e4}function eg(e){const t={};let n=-1,r,o,s,i,l,c,u;const d=new fT(e);for(;++n<d.length;){for(;n in t;)n=t[n];if(r=d.get(n),n&&r[1].type==="chunkFlow"&&d.get(n-1)[1].type==="listItemPrefix"&&(c=r[1]._tokenizer.events,s=0,s<c.length&&c[s][1].type==="lineEndingBlank"&&(s+=2),s<c.length&&c[s][1].type==="content"))for(;++s<c.length&&c[s][1].type!=="content";)c[s][1].type==="chunkText"&&(c[s][1]._isInFirstContentOfListItem=!0,s++);if(r[0]==="enter")r[1].contentType&&(Object.assign(t,pT(d,n)),n=t[n],u=!0);else if(r[1]._container){for(s=n,o=void 0;s--;)if(i=d.get(s),i[1].type==="lineEnding"||i[1].type==="lineEndingBlank")i[0]==="enter"&&(o&&(d.get(o)[1].type="lineEndingBlank"),i[1].type="lineEnding",o=s);else if(!(i[1].type==="linePrefix"||i[1].type==="listItemIndent"))break;o&&(r[1].end={...d.get(o)[1].start},l=d.slice(o,n),l.unshift(r),d.splice(o,n-o+1,l))}}return Ht(e,0,Number.POSITIVE_INFINITY,d.slice(0)),!u}function pT(e,t){const n=e.get(t)[1],r=e.get(t)[2];let o=t-1;const s=[];let i=n._tokenizer;i||(i=r.parser[n.contentType](n.start),n._contentTypeTextTrailing&&(i._contentTypeTextTrailing=!0));const l=i.events,c=[],u={};let d,f,h=-1,p=n,y=0,m=0;const g=[m];for(;p;){for(;e.get(++o)[1]!==p;);s.push(o),p._tokenizer||(d=r.sliceStream(p),p.next||d.push(null),f&&i.defineSkip(p.start),p._isInFirstContentOfListItem&&(i._gfmTasklistFirstContentOfListItem=!0),i.write(d),p._isInFirstContentOfListItem&&(i._gfmTasklistFirstContentOfListItem=void 0)),f=p,p=p.next}for(p=n;++h<l.length;)l[h][0]==="exit"&&l[h-1][0]==="enter"&&l[h][1].type===l[h-1][1].type&&l[h][1].start.line!==l[h][1].end.line&&(m=h+1,g.push(m),p._tokenizer=void 0,p.previous=void 0,p=p.next);for(i.events=[],p?(p._tokenizer=void 0,p.previous=void 0):g.pop(),h=g.length;h--;){const b=l.slice(g[h],g[h+1]),v=s.pop();c.push([v,v+b.length-1]),e.splice(v,2,b)}for(c.reverse(),h=-1;++h<c.length;)u[y+c[h][0]]=y+c[h][1],y+=c[h][1]-c[h][0]-1;return u}const hT={resolve:gT,tokenize:xT},mT={partial:!0,tokenize:bT};function gT(e){return eg(e),e}function xT(e,t){let n;return r;function r(l){return e.enter("content"),n=e.enter("chunkContent",{contentType:"content"}),o(l)}function o(l){return l===null?s(l):Ce(l)?e.check(mT,i,s)(l):(e.consume(l),o)}function s(l){return e.exit("chunkContent"),e.exit("content"),t(l)}function i(l){return e.consume(l),e.exit("chunkContent"),n.next=e.enter("chunkContent",{contentType:"content",previous:n}),n=n.next,o}}function bT(e,t,n){const r=this;return o;function o(i){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),Ve(e,s,"linePrefix")}function s(i){if(i===null||Ce(i))return n(i);const l=r.events[r.events.length-1];return!r.parser.constructs.disable.null.includes("codeIndented")&&l&&l[1].type==="linePrefix"&&l[2].sliceSerialize(l[1],!0).length>=4?t(i):e.interrupt(r.parser.constructs.flow,n,t)(i)}}function tg(e,t,n,r,o,s,i,l,c){const u=c||Number.POSITIVE_INFINITY;let d=0;return f;function f(b){return b===60?(e.enter(r),e.enter(o),e.enter(s),e.consume(b),e.exit(s),h):b===null||b===32||b===41||ia(b)?n(b):(e.enter(r),e.enter(i),e.enter(l),e.enter("chunkString",{contentType:"string"}),m(b))}function h(b){return b===62?(e.enter(s),e.consume(b),e.exit(s),e.exit(o),e.exit(r),t):(e.enter(l),e.enter("chunkString",{contentType:"string"}),p(b))}function p(b){return b===62?(e.exit("chunkString"),e.exit(l),h(b)):b===null||b===60||Ce(b)?n(b):(e.consume(b),b===92?y:p)}function y(b){return b===60||b===62||b===92?(e.consume(b),p):p(b)}function m(b){return!d&&(b===null||b===41||dt(b))?(e.exit("chunkString"),e.exit(l),e.exit(i),e.exit(r),t(b)):d<u&&b===40?(e.consume(b),d++,m):b===41?(e.consume(b),d--,m):b===null||b===32||b===40||ia(b)?n(b):(e.consume(b),b===92?g:m)}function g(b){return b===40||b===41||b===92?(e.consume(b),m):m(b)}}function ng(e,t,n,r,o,s){const i=this;let l=0,c;return u;function u(p){return e.enter(r),e.enter(o),e.consume(p),e.exit(o),e.enter(s),d}function d(p){return l>999||p===null||p===91||p===93&&!c||p===94&&!l&&"_hiddenFootnoteSupport"in i.parser.constructs?n(p):p===93?(e.exit(s),e.enter(o),e.consume(p),e.exit(o),e.exit(r),t):Ce(p)?(e.enter("lineEnding"),e.consume(p),e.exit("lineEnding"),d):(e.enter("chunkString",{contentType:"string"}),f(p))}function f(p){return p===null||p===91||p===93||Ce(p)||l++>999?(e.exit("chunkString"),d(p)):(e.consume(p),c||(c=!Le(p)),p===92?h:f)}function h(p){return p===91||p===92||p===93?(e.consume(p),l++,f):f(p)}}function rg(e,t,n,r,o,s){let i;return l;function l(h){return h===34||h===39||h===40?(e.enter(r),e.enter(o),e.consume(h),e.exit(o),i=h===40?41:h,c):n(h)}function c(h){return h===i?(e.enter(o),e.consume(h),e.exit(o),e.exit(r),t):(e.enter(s),u(h))}function u(h){return h===i?(e.exit(s),c(i)):h===null?n(h):Ce(h)?(e.enter("lineEnding"),e.consume(h),e.exit("lineEnding"),Ve(e,u,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),d(h))}function d(h){return h===i||h===null||Ce(h)?(e.exit("chunkString"),u(h)):(e.consume(h),h===92?f:d)}function f(h){return h===i||h===92?(e.consume(h),d):d(h)}}function Rr(e,t){let n;return r;function r(o){return Ce(o)?(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),n=!0,r):Le(o)?Ve(e,r,n?"linePrefix":"lineSuffix")(o):t(o)}}const yT={name:"definition",tokenize:wT},vT={partial:!0,tokenize:kT};function wT(e,t,n){const r=this;let o;return s;function s(p){return e.enter("definition"),i(p)}function i(p){return ng.call(r,e,l,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(p)}function l(p){return o=tr(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),p===58?(e.enter("definitionMarker"),e.consume(p),e.exit("definitionMarker"),c):n(p)}function c(p){return dt(p)?Rr(e,u)(p):u(p)}function u(p){return tg(e,d,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(p)}function d(p){return e.attempt(vT,f,f)(p)}function f(p){return Le(p)?Ve(e,h,"whitespace")(p):h(p)}function h(p){return p===null||Ce(p)?(e.exit("definition"),r.parser.defined.push(o),t(p)):n(p)}}function kT(e,t,n){return r;function r(l){return dt(l)?Rr(e,o)(l):n(l)}function o(l){return rg(e,s,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(l)}function s(l){return Le(l)?Ve(e,i,"whitespace")(l):i(l)}function i(l){return l===null||Ce(l)?t(l):n(l)}}const _T={name:"hardBreakEscape",tokenize:ST};function ST(e,t,n){return r;function r(s){return e.enter("hardBreakEscape"),e.consume(s),o}function o(s){return Ce(s)?(e.exit("hardBreakEscape"),t(s)):n(s)}}const CT={name:"headingAtx",resolve:jT,tokenize:NT};function jT(e,t){let n=e.length-2,r=3,o,s;return e[r][1].type==="whitespace"&&(r+=2),n-2>r&&e[n][1].type==="whitespace"&&(n-=2),e[n][1].type==="atxHeadingSequence"&&(r===n-1||n-4>r&&e[n-2][1].type==="whitespace")&&(n-=r+1===n?2:4),n>r&&(o={type:"atxHeadingText",start:e[r][1].start,end:e[n][1].end},s={type:"chunkText",start:e[r][1].start,end:e[n][1].end,contentType:"text"},Ht(e,r,n-r+1,[["enter",o,t],["enter",s,t],["exit",s,t],["exit",o,t]])),e}function NT(e,t,n){let r=0;return o;function o(d){return e.enter("atxHeading"),s(d)}function s(d){return e.enter("atxHeadingSequence"),i(d)}function i(d){return d===35&&r++<6?(e.consume(d),i):d===null||dt(d)?(e.exit("atxHeadingSequence"),l(d)):n(d)}function l(d){return d===35?(e.enter("atxHeadingSequence"),c(d)):d===null||Ce(d)?(e.exit("atxHeading"),t(d)):Le(d)?Ve(e,l,"whitespace")(d):(e.enter("atxHeadingText"),u(d))}function c(d){return d===35?(e.consume(d),c):(e.exit("atxHeadingSequence"),l(d))}function u(d){return d===null||d===35||dt(d)?(e.exit("atxHeadingText"),l(d)):(e.consume(d),u)}}const ET=["address","article","aside","base","basefont","blockquote","body","caption","center","col","colgroup","dd","details","dialog","dir","div","dl","dt","fieldset","figcaption","figure","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hr","html","iframe","legend","li","link","main","menu","menuitem","nav","noframes","ol","optgroup","option","p","param","search","section","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"],Nu=["pre","script","style","textarea"],TT={concrete:!0,name:"htmlFlow",resolveTo:zT,tokenize:RT},AT={partial:!0,tokenize:OT},IT={partial:!0,tokenize:PT};function zT(e){let t=e.length;for(;t--&&!(e[t][0]==="enter"&&e[t][1].type==="htmlFlow"););return t>1&&e[t-2][1].type==="linePrefix"&&(e[t][1].start=e[t-2][1].start,e[t+1][1].start=e[t-2][1].start,e.splice(t-2,2)),e}function RT(e,t,n){const r=this;let o,s,i,l,c;return u;function u(R){return d(R)}function d(R){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(R),f}function f(R){return R===33?(e.consume(R),h):R===47?(e.consume(R),s=!0,m):R===63?(e.consume(R),o=3,r.interrupt?t:I):Ft(R)?(e.consume(R),i=String.fromCharCode(R),g):n(R)}function h(R){return R===45?(e.consume(R),o=2,p):R===91?(e.consume(R),o=5,l=0,y):Ft(R)?(e.consume(R),o=4,r.interrupt?t:I):n(R)}function p(R){return R===45?(e.consume(R),r.interrupt?t:I):n(R)}function y(R){const ae="CDATA[";return R===ae.charCodeAt(l++)?(e.consume(R),l===ae.length?r.interrupt?t:N:y):n(R)}function m(R){return Ft(R)?(e.consume(R),i=String.fromCharCode(R),g):n(R)}function g(R){if(R===null||R===47||R===62||dt(R)){const ae=R===47,re=i.toLowerCase();return!ae&&!s&&Nu.includes(re)?(o=1,r.interrupt?t(R):N(R)):ET.includes(i.toLowerCase())?(o=6,ae?(e.consume(R),b):r.interrupt?t(R):N(R)):(o=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(R):s?v(R):k(R))}return R===45||yt(R)?(e.consume(R),i+=String.fromCharCode(R),g):n(R)}function b(R){return R===62?(e.consume(R),r.interrupt?t:N):n(R)}function v(R){return Le(R)?(e.consume(R),v):O(R)}function k(R){return R===47?(e.consume(R),O):R===58||R===95||Ft(R)?(e.consume(R),S):Le(R)?(e.consume(R),k):O(R)}function S(R){return R===45||R===46||R===58||R===95||yt(R)?(e.consume(R),S):C(R)}function C(R){return R===61?(e.consume(R),j):Le(R)?(e.consume(R),C):k(R)}function j(R){return R===null||R===60||R===61||R===62||R===96?n(R):R===34||R===39?(e.consume(R),c=R,E):Le(R)?(e.consume(R),j):T(R)}function E(R){return R===c?(e.consume(R),c=null,z):R===null||Ce(R)?n(R):(e.consume(R),E)}function T(R){return R===null||R===34||R===39||R===47||R===60||R===61||R===62||R===96||dt(R)?C(R):(e.consume(R),T)}function z(R){return R===47||R===62||Le(R)?k(R):n(R)}function O(R){return R===62?(e.consume(R),B):n(R)}function B(R){return R===null||Ce(R)?N(R):Le(R)?(e.consume(R),B):n(R)}function N(R){return R===45&&o===2?(e.consume(R),W):R===60&&o===1?(e.consume(R),U):R===62&&o===4?(e.consume(R),H):R===63&&o===3?(e.consume(R),I):R===93&&o===5?(e.consume(R),K):Ce(R)&&(o===6||o===7)?(e.exit("htmlFlowData"),e.check(AT,G,D)(R)):R===null||Ce(R)?(e.exit("htmlFlowData"),D(R)):(e.consume(R),N)}function D(R){return e.check(IT,w,G)(R)}function w(R){return e.enter("lineEnding"),e.consume(R),e.exit("lineEnding"),L}function L(R){return R===null||Ce(R)?D(R):(e.enter("htmlFlowData"),N(R))}function W(R){return R===45?(e.consume(R),I):N(R)}function U(R){return R===47?(e.consume(R),i="",F):N(R)}function F(R){if(R===62){const ae=i.toLowerCase();return Nu.includes(ae)?(e.consume(R),H):N(R)}return Ft(R)&&i.length<8?(e.consume(R),i+=String.fromCharCode(R),F):N(R)}function K(R){return R===93?(e.consume(R),I):N(R)}function I(R){return R===62?(e.consume(R),H):R===45&&o===2?(e.consume(R),I):N(R)}function H(R){return R===null||Ce(R)?(e.exit("htmlFlowData"),G(R)):(e.consume(R),H)}function G(R){return e.exit("htmlFlow"),t(R)}}function PT(e,t,n){const r=this;return o;function o(i){return Ce(i)?(e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),s):n(i)}function s(i){return r.parser.lazy[r.now().line]?n(i):t(i)}}function OT(e,t,n){return r;function r(o){return e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),e.attempt(Ds,t,n)}}const MT={name:"htmlText",tokenize:LT};function LT(e,t,n){const r=this;let o,s,i;return l;function l(I){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(I),c}function c(I){return I===33?(e.consume(I),u):I===47?(e.consume(I),C):I===63?(e.consume(I),k):Ft(I)?(e.consume(I),T):n(I)}function u(I){return I===45?(e.consume(I),d):I===91?(e.consume(I),s=0,y):Ft(I)?(e.consume(I),v):n(I)}function d(I){return I===45?(e.consume(I),p):n(I)}function f(I){return I===null?n(I):I===45?(e.consume(I),h):Ce(I)?(i=f,U(I)):(e.consume(I),f)}function h(I){return I===45?(e.consume(I),p):f(I)}function p(I){return I===62?W(I):I===45?h(I):f(I)}function y(I){const H="CDATA[";return I===H.charCodeAt(s++)?(e.consume(I),s===H.length?m:y):n(I)}function m(I){return I===null?n(I):I===93?(e.consume(I),g):Ce(I)?(i=m,U(I)):(e.consume(I),m)}function g(I){return I===93?(e.consume(I),b):m(I)}function b(I){return I===62?W(I):I===93?(e.consume(I),b):m(I)}function v(I){return I===null||I===62?W(I):Ce(I)?(i=v,U(I)):(e.consume(I),v)}function k(I){return I===null?n(I):I===63?(e.consume(I),S):Ce(I)?(i=k,U(I)):(e.consume(I),k)}function S(I){return I===62?W(I):k(I)}function C(I){return Ft(I)?(e.consume(I),j):n(I)}function j(I){return I===45||yt(I)?(e.consume(I),j):E(I)}function E(I){return Ce(I)?(i=E,U(I)):Le(I)?(e.consume(I),E):W(I)}function T(I){return I===45||yt(I)?(e.consume(I),T):I===47||I===62||dt(I)?z(I):n(I)}function z(I){return I===47?(e.consume(I),W):I===58||I===95||Ft(I)?(e.consume(I),O):Ce(I)?(i=z,U(I)):Le(I)?(e.consume(I),z):W(I)}function O(I){return I===45||I===46||I===58||I===95||yt(I)?(e.consume(I),O):B(I)}function B(I){return I===61?(e.consume(I),N):Ce(I)?(i=B,U(I)):Le(I)?(e.consume(I),B):z(I)}function N(I){return I===null||I===60||I===61||I===62||I===96?n(I):I===34||I===39?(e.consume(I),o=I,D):Ce(I)?(i=N,U(I)):Le(I)?(e.consume(I),N):(e.consume(I),w)}function D(I){return I===o?(e.consume(I),o=void 0,L):I===null?n(I):Ce(I)?(i=D,U(I)):(e.consume(I),D)}function w(I){return I===null||I===34||I===39||I===60||I===61||I===96?n(I):I===47||I===62||dt(I)?z(I):(e.consume(I),w)}function L(I){return I===47||I===62||dt(I)?z(I):n(I)}function W(I){return I===62?(e.consume(I),e.exit("htmlTextData"),e.exit("htmlText"),t):n(I)}function U(I){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(I),e.exit("lineEnding"),F}function F(I){return Le(I)?Ve(e,K,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(I):K(I)}function K(I){return e.enter("htmlTextData"),i(I)}}const wl={name:"labelEnd",resolveAll:BT,resolveTo:UT,tokenize:WT},DT={tokenize:VT},FT={tokenize:HT},$T={tokenize:ZT};function BT(e){let t=-1;const n=[];for(;++t<e.length;){const r=e[t][1];if(n.push(e[t]),r.type==="labelImage"||r.type==="labelLink"||r.type==="labelEnd"){const o=r.type==="labelImage"?4:2;r.type="data",t+=o}}return e.length!==n.length&&Ht(e,0,e.length,n),e}function UT(e,t){let n=e.length,r=0,o,s,i,l;for(;n--;)if(o=e[n][1],s){if(o.type==="link"||o.type==="labelLink"&&o._inactive)break;e[n][0]==="enter"&&o.type==="labelLink"&&(o._inactive=!0)}else if(i){if(e[n][0]==="enter"&&(o.type==="labelImage"||o.type==="labelLink")&&!o._balanced&&(s=n,o.type!=="labelLink")){r=2;break}}else o.type==="labelEnd"&&(i=n);const c={type:e[s][1].type==="labelLink"?"link":"image",start:{...e[s][1].start},end:{...e[e.length-1][1].end}},u={type:"label",start:{...e[s][1].start},end:{...e[i][1].end}},d={type:"labelText",start:{...e[s+r+2][1].end},end:{...e[i-2][1].start}};return l=[["enter",c,t],["enter",u,t]],l=wt(l,e.slice(s+1,s+r+3)),l=wt(l,[["enter",d,t]]),l=wt(l,vl(t.parser.constructs.insideSpan.null,e.slice(s+r+4,i-3),t)),l=wt(l,[["exit",d,t],e[i-2],e[i-1],["exit",u,t]]),l=wt(l,e.slice(i+1)),l=wt(l,[["exit",c,t]]),Ht(e,s,e.length,l),e}function WT(e,t,n){const r=this;let o=r.events.length,s,i;for(;o--;)if((r.events[o][1].type==="labelImage"||r.events[o][1].type==="labelLink")&&!r.events[o][1]._balanced){s=r.events[o][1];break}return l;function l(h){return s?s._inactive?f(h):(i=r.parser.defined.includes(tr(r.sliceSerialize({start:s.end,end:r.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(h),e.exit("labelMarker"),e.exit("labelEnd"),c):n(h)}function c(h){return h===40?e.attempt(DT,d,i?d:f)(h):h===91?e.attempt(FT,d,i?u:f)(h):i?d(h):f(h)}function u(h){return e.attempt($T,d,f)(h)}function d(h){return t(h)}function f(h){return s._balanced=!0,n(h)}}function VT(e,t,n){return r;function r(f){return e.enter("resource"),e.enter("resourceMarker"),e.consume(f),e.exit("resourceMarker"),o}function o(f){return dt(f)?Rr(e,s)(f):s(f)}function s(f){return f===41?d(f):tg(e,i,l,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(f)}function i(f){return dt(f)?Rr(e,c)(f):d(f)}function l(f){return n(f)}function c(f){return f===34||f===39||f===40?rg(e,u,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(f):d(f)}function u(f){return dt(f)?Rr(e,d)(f):d(f)}function d(f){return f===41?(e.enter("resourceMarker"),e.consume(f),e.exit("resourceMarker"),e.exit("resource"),t):n(f)}}function HT(e,t,n){const r=this;return o;function o(l){return ng.call(r,e,s,i,"reference","referenceMarker","referenceString")(l)}function s(l){return r.parser.defined.includes(tr(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?t(l):n(l)}function i(l){return n(l)}}function ZT(e,t,n){return r;function r(s){return e.enter("reference"),e.enter("referenceMarker"),e.consume(s),e.exit("referenceMarker"),o}function o(s){return s===93?(e.enter("referenceMarker"),e.consume(s),e.exit("referenceMarker"),e.exit("reference"),t):n(s)}}const qT={name:"labelStartImage",resolveAll:wl.resolveAll,tokenize:KT};function KT(e,t,n){const r=this;return o;function o(l){return e.enter("labelImage"),e.enter("labelImageMarker"),e.consume(l),e.exit("labelImageMarker"),s}function s(l){return l===91?(e.enter("labelMarker"),e.consume(l),e.exit("labelMarker"),e.exit("labelImage"),i):n(l)}function i(l){return l===94&&"_hiddenFootnoteSupport"in r.parser.constructs?n(l):t(l)}}const GT={name:"labelStartLink",resolveAll:wl.resolveAll,tokenize:JT};function JT(e,t,n){const r=this;return o;function o(i){return e.enter("labelLink"),e.enter("labelMarker"),e.consume(i),e.exit("labelMarker"),e.exit("labelLink"),s}function s(i){return i===94&&"_hiddenFootnoteSupport"in r.parser.constructs?n(i):t(i)}}const di={name:"lineEnding",tokenize:YT};function YT(e,t){return n;function n(r){return e.enter("lineEnding"),e.consume(r),e.exit("lineEnding"),Ve(e,t,"linePrefix")}}const To={name:"thematicBreak",tokenize:XT};function XT(e,t,n){let r=0,o;return s;function s(u){return e.enter("thematicBreak"),i(u)}function i(u){return o=u,l(u)}function l(u){return u===o?(e.enter("thematicBreakSequence"),c(u)):r>=3&&(u===null||Ce(u))?(e.exit("thematicBreak"),t(u)):n(u)}function c(u){return u===o?(e.consume(u),r++,c):(e.exit("thematicBreakSequence"),Le(u)?Ve(e,l,"whitespace")(u):l(u))}}const ct={continuation:{tokenize:n4},exit:o4,name:"list",tokenize:t4},QT={partial:!0,tokenize:s4},e4={partial:!0,tokenize:r4};function t4(e,t,n){const r=this,o=r.events[r.events.length-1];let s=o&&o[1].type==="linePrefix"?o[2].sliceSerialize(o[1],!0).length:0,i=0;return l;function l(p){const y=r.containerState.type||(p===42||p===43||p===45?"listUnordered":"listOrdered");if(y==="listUnordered"?!r.containerState.marker||p===r.containerState.marker:aa(p)){if(r.containerState.type||(r.containerState.type=y,e.enter(y,{_container:!0})),y==="listUnordered")return e.enter("listItemPrefix"),p===42||p===45?e.check(To,n,u)(p):u(p);if(!r.interrupt||p===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),c(p)}return n(p)}function c(p){return aa(p)&&++i<10?(e.consume(p),c):(!r.interrupt||i<2)&&(r.containerState.marker?p===r.containerState.marker:p===41||p===46)?(e.exit("listItemValue"),u(p)):n(p)}function u(p){return e.enter("listItemMarker"),e.consume(p),e.exit("listItemMarker"),r.containerState.marker=r.containerState.marker||p,e.check(Ds,r.interrupt?n:d,e.attempt(QT,h,f))}function d(p){return r.containerState.initialBlankLine=!0,s++,h(p)}function f(p){return Le(p)?(e.enter("listItemPrefixWhitespace"),e.consume(p),e.exit("listItemPrefixWhitespace"),h):n(p)}function h(p){return r.containerState.size=s+r.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(p)}}function n4(e,t,n){const r=this;return r.containerState._closeFlow=void 0,e.check(Ds,o,s);function o(l){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,Ve(e,t,"listItemIndent",r.containerState.size+1)(l)}function s(l){return r.containerState.furtherBlankLines||!Le(l)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,i(l)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,e.attempt(e4,t,i)(l))}function i(l){return r.containerState._closeFlow=!0,r.interrupt=void 0,Ve(e,e.attempt(ct,t,n),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(l)}}function r4(e,t,n){const r=this;return Ve(e,o,"listItemIndent",r.containerState.size+1);function o(s){const i=r.events[r.events.length-1];return i&&i[1].type==="listItemIndent"&&i[2].sliceSerialize(i[1],!0).length===r.containerState.size?t(s):n(s)}}function o4(e){e.exit(this.containerState.type)}function s4(e,t,n){const r=this;return Ve(e,o,"listItemPrefixWhitespace",r.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function o(s){const i=r.events[r.events.length-1];return!Le(s)&&i&&i[1].type==="listItemPrefixWhitespace"?t(s):n(s)}}const Eu={name:"setextUnderline",resolveTo:i4,tokenize:a4};function i4(e,t){let n=e.length,r,o,s;for(;n--;)if(e[n][0]==="enter"){if(e[n][1].type==="content"){r=n;break}e[n][1].type==="paragraph"&&(o=n)}else e[n][1].type==="content"&&e.splice(n,1),!s&&e[n][1].type==="definition"&&(s=n);const i={type:"setextHeading",start:{...e[r][1].start},end:{...e[e.length-1][1].end}};return e[o][1].type="setextHeadingText",s?(e.splice(o,0,["enter",i,t]),e.splice(s+1,0,["exit",e[r][1],t]),e[r][1].end={...e[s][1].end}):e[r][1]=i,e.push(["exit",i,t]),e}function a4(e,t,n){const r=this;let o;return s;function s(u){let d=r.events.length,f;for(;d--;)if(r.events[d][1].type!=="lineEnding"&&r.events[d][1].type!=="linePrefix"&&r.events[d][1].type!=="content"){f=r.events[d][1].type==="paragraph";break}return!r.parser.lazy[r.now().line]&&(r.interrupt||f)?(e.enter("setextHeadingLine"),o=u,i(u)):n(u)}function i(u){return e.enter("setextHeadingLineSequence"),l(u)}function l(u){return u===o?(e.consume(u),l):(e.exit("setextHeadingLineSequence"),Le(u)?Ve(e,c,"lineSuffix")(u):c(u))}function c(u){return u===null||Ce(u)?(e.exit("setextHeadingLine"),t(u)):n(u)}}const l4={tokenize:c4};function c4(e){const t=this,n=e.attempt(Ds,r,e.attempt(this.parser.constructs.flowInitial,o,Ve(e,e.attempt(this.parser.constructs.flow,o,e.attempt(hT,o)),"linePrefix")));return n;function r(s){if(s===null){e.consume(s);return}return e.enter("lineEndingBlank"),e.consume(s),e.exit("lineEndingBlank"),t.currentConstruct=void 0,n}function o(s){if(s===null){e.consume(s);return}return e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),t.currentConstruct=void 0,n}}const u4={resolveAll:sg()},d4=og("string"),f4=og("text");function og(e){return{resolveAll:sg(e==="text"?p4:void 0),tokenize:t};function t(n){const r=this,o=this.parser.constructs[e],s=n.attempt(o,i,l);return i;function i(d){return u(d)?s(d):l(d)}function l(d){if(d===null){n.consume(d);return}return n.enter("data"),n.consume(d),c}function c(d){return u(d)?(n.exit("data"),s(d)):(n.consume(d),c)}function u(d){if(d===null)return!0;const f=o[d];let h=-1;if(f)for(;++h<f.length;){const p=f[h];if(!p.previous||p.previous.call(r,r.previous))return!0}return!1}}}function sg(e){return t;function t(n,r){let o=-1,s;for(;++o<=n.length;)s===void 0?n[o]&&n[o][1].type==="data"&&(s=o,o++):(!n[o]||n[o][1].type!=="data")&&(o!==s+2&&(n[s][1].end=n[o-1][1].end,n.splice(s+2,o-s-2),o=s+2),s=void 0);return e?e(n,r):n}}function p4(e,t){let n=0;for(;++n<=e.length;)if((n===e.length||e[n][1].type==="lineEnding")&&e[n-1][1].type==="data"){const r=e[n-1][1],o=t.sliceStream(r);let s=o.length,i=-1,l=0,c;for(;s--;){const u=o[s];if(typeof u=="string"){for(i=u.length;u.charCodeAt(i-1)===32;)l++,i--;if(i)break;i=-1}else if(u===-2)c=!0,l++;else if(u!==-1){s++;break}}if(t._contentTypeTextTrailing&&n===e.length&&(l=0),l){const u={type:n===e.length||c||l<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:s?i:r.start._bufferIndex+i,_index:r.start._index+s,line:r.end.line,column:r.end.column-l,offset:r.end.offset-l},end:{...r.end}};r.end={...u.start},r.start.offset===r.end.offset?Object.assign(r,u):(e.splice(n,0,["enter",u,t],["exit",u,t]),n+=2)}n++}return e}const h4={42:ct,43:ct,45:ct,48:ct,49:ct,50:ct,51:ct,52:ct,53:ct,54:ct,55:ct,56:ct,57:ct,62:Ym},m4={91:yT},g4={[-2]:ui,[-1]:ui,32:ui},x4={35:CT,42:To,45:[Eu,To],60:TT,61:Eu,95:To,96:ju,126:ju},b4={38:Qm,92:Xm},y4={[-5]:di,[-4]:di,[-3]:di,33:qT,38:Qm,42:la,60:[G3,MT],91:GT,92:[_T,Xm],93:wl,95:la,96:lT},v4={null:[la,u4]},w4={null:[42,95]},k4={null:[]},_4=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:w4,contentInitial:m4,disable:k4,document:h4,flow:x4,flowInitial:g4,insideSpan:v4,string:b4,text:y4},Symbol.toStringTag,{value:"Module"}));function S4(e,t,n){let r={_bufferIndex:-1,_index:0,line:n&&n.line||1,column:n&&n.column||1,offset:n&&n.offset||0};const o={},s=[];let i=[],l=[];const c={attempt:E(C),check:E(j),consume:v,enter:k,exit:S,interrupt:E(j,{interrupt:!0})},u={code:null,containerState:{},defineSkip:m,events:[],now:y,parser:e,previous:null,sliceSerialize:h,sliceStream:p,write:f};let d=t.tokenize.call(u,c);return t.resolveAll&&s.push(t),u;function f(B){return i=wt(i,B),g(),i[i.length-1]!==null?[]:(T(t,0),u.events=vl(s,u.events,u),u.events)}function h(B,N){return j4(p(B),N)}function p(B){return C4(i,B)}function y(){const{_bufferIndex:B,_index:N,line:D,column:w,offset:L}=r;return{_bufferIndex:B,_index:N,line:D,column:w,offset:L}}function m(B){o[B.line]=B.column,O()}function g(){let B;for(;r._index<i.length;){const N=i[r._index];if(typeof N=="string")for(B=r._index,r._bufferIndex<0&&(r._bufferIndex=0);r._index===B&&r._bufferIndex<N.length;)b(N.charCodeAt(r._bufferIndex));else b(N)}}function b(B){d=d(B)}function v(B){Ce(B)?(r.line++,r.column=1,r.offset+=B===-3?2:1,O()):B!==-1&&(r.column++,r.offset++),r._bufferIndex<0?r._index++:(r._bufferIndex++,r._bufferIndex===i[r._index].length&&(r._bufferIndex=-1,r._index++)),u.previous=B}function k(B,N){const D=N||{};return D.type=B,D.start=y(),u.events.push(["enter",D,u]),l.push(D),D}function S(B){const N=l.pop();return N.end=y(),u.events.push(["exit",N,u]),N}function C(B,N){T(B,N.from)}function j(B,N){N.restore()}function E(B,N){return D;function D(w,L,W){let U,F,K,I;return Array.isArray(w)?G(w):"tokenize"in w?G([w]):H(w);function H(fe){return le;function le(de){const pe=de!==null&&fe[de],he=de!==null&&fe.null,me=[...Array.isArray(pe)?pe:pe?[pe]:[],...Array.isArray(he)?he:he?[he]:[]];return G(me)(de)}}function G(fe){return U=fe,F=0,fe.length===0?W:R(fe[F])}function R(fe){return le;function le(de){return I=z(),K=fe,fe.partial||(u.currentConstruct=fe),fe.name&&u.parser.constructs.disable.null.includes(fe.name)?re():fe.tokenize.call(N?Object.assign(Object.create(u),N):u,c,ae,re)(de)}}function ae(fe){return B(K,I),L}function re(fe){return I.restore(),++F<U.length?R(U[F]):W}}}function T(B,N){B.resolveAll&&!s.includes(B)&&s.push(B),B.resolve&&Ht(u.events,N,u.events.length-N,B.resolve(u.events.slice(N),u)),B.resolveTo&&(u.events=B.resolveTo(u.events,u))}function z(){const B=y(),N=u.previous,D=u.currentConstruct,w=u.events.length,L=Array.from(l);return{from:w,restore:W};function W(){r=B,u.previous=N,u.currentConstruct=D,u.events.length=w,l=L,O()}}function O(){r.line in o&&r.column<2&&(r.column=o[r.line],r.offset+=o[r.line]-1)}}function C4(e,t){const n=t.start._index,r=t.start._bufferIndex,o=t.end._index,s=t.end._bufferIndex;let i;if(n===o)i=[e[n].slice(r,s)];else{if(i=e.slice(n,o),r>-1){const l=i[0];typeof l=="string"?i[0]=l.slice(r):i.shift()}s>0&&i.push(e[o].slice(0,s))}return i}function j4(e,t){let n=-1;const r=[];let o;for(;++n<e.length;){const s=e[n];let i;if(typeof s=="string")i=s;else switch(s){case-5:{i="\r";break}case-4:{i=`
|
|
95
103
|
`;break}case-3:{i=`\r
|
|
96
|
-
`;break}case-2:{i=t?" ":" ";break}case-1:{if(!t&&o)continue;i=" ";break}default:i=String.fromCharCode(s)}o=s===-2,r.push(i)}return r.join("")}function KT(e){const r={constructs:t3([HT,...(e||{}).extensions||[]]),content:o(c3),defined:[],document:o(d3),flow:o(TT),lazy:{},string:o(zT),text:o(RT)};return r;function o(s){return i;function i(l){return VT(r,s,l)}}}function GT(e){for(;!Ym(e););return e}const Eu=/[\0\t\n\r]/g;function JT(){let e=1,t="",n=!0,r;return o;function o(s,i,l){const c=[];let u,d,f,h,p;for(s=t+(typeof s=="string"?s.toString():new TextDecoder(i||void 0).decode(s)),f=0,t="",n&&(s.charCodeAt(0)===65279&&f++,n=void 0);f<s.length;){if(Eu.lastIndex=f,u=Eu.exec(s),h=u&&u.index!==void 0?u.index:s.length,p=s.charCodeAt(h),!u){t=s.slice(f);break}if(p===10&&f===h&&r)c.push(-3),r=void 0;else switch(r&&(c.push(-5),r=void 0),f<h&&(c.push(s.slice(f,h)),e+=h-f),p){case 0:{c.push(65533),e++;break}case 9:{for(d=Math.ceil(e/4)*4,c.push(-2);e++<d;)c.push(-1);break}case 10:{c.push(-4),e=1;break}default:r=!0,e=1}f=h+1}return l&&(r&&c.push(-5),t&&c.push(t),c.push(null)),c}}const YT=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function XT(e){return e.replace(YT,QT)}function QT(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){const o=n.charCodeAt(1),s=o===120||o===88;return qm(n.slice(s?2:1),s?16:10)}return xl(n)||e}const rg={}.hasOwnProperty;function e4(e,t,n){return typeof t!="string"&&(n=t,t=void 0),t4(n)(GT(KT(n).document().write(JT()(e,t,!0))))}function t4(e){const t={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:s(q),autolinkProtocol:z,autolinkEmail:z,atxHeading:s(ne),blockQuote:s(he),characterEscape:z,characterReference:z,codeFenced:s(me),codeFencedFenceInfo:i,codeFencedFenceMeta:i,codeIndented:s(me,i),codeText:s(_e,i),codeTextData:z,data:z,codeFlowValue:z,definition:s(Pe),definitionDestinationString:i,definitionLabelString:i,definitionTitleString:i,emphasis:s(_),hardBreakEscape:s(Q),hardBreakTrailing:s(Q),htmlFlow:s(M,i),htmlFlowData:z,htmlText:s(M,i),htmlTextData:z,image:s(P),label:i,link:s(q),listItem:s(J),listItemValue:h,listOrdered:s(Z,f),listUnordered:s(Z),paragraph:s(H),reference:R,referenceString:i,resourceDestinationString:i,resourceTitleString:i,setextHeading:s(ne),strong:s(se),thematicBreak:s(ee)},exit:{atxHeading:c(),atxHeadingSequence:C,autolink:c(),autolinkEmail:pe,autolinkProtocol:de,blockQuote:c(),characterEscapeValue:O,characterReferenceMarkerHexadecimal:oe,characterReferenceMarkerNumeric:oe,characterReferenceValue:fe,characterReference:le,codeFenced:c(g),codeFencedFence:m,codeFencedFenceInfo:p,codeFencedFenceMeta:y,codeFlowValue:O,codeIndented:c(b),codeText:c(L),codeTextData:O,data:O,definition:c(),definitionDestinationString:S,definitionLabelString:v,definitionTitleString:k,emphasis:c(),hardBreakEscape:c(N),hardBreakTrailing:c(N),htmlFlow:c(D),htmlFlowData:O,htmlText:c(w),htmlTextData:O,image:c(U),label:K,labelText:F,lineEnding:B,link:c(W),listItem:c(),listOrdered:c(),listUnordered:c(),paragraph:c(),referenceString:ae,resourceDestinationString:I,resourceTitleString:V,resource:G,setextHeading:c(T),setextHeadingLineSequence:E,setextHeadingText:j,strong:c(),thematicBreak:c()}};og(t,(e||{}).mdastExtensions||[]);const n={};return r;function r($){let X={type:"root",children:[]};const ce={stack:[X],tokenStack:[],config:t,enter:l,exit:u,buffer:i,resume:d,data:n},xe=[];let Ne=-1;for(;++Ne<$.length;)if($[Ne][1].type==="listOrdered"||$[Ne][1].type==="listUnordered")if($[Ne][0]==="enter")xe.push(Ne);else{const Ue=xe.pop();Ne=o($,Ue,Ne)}for(Ne=-1;++Ne<$.length;){const Ue=t[$[Ne][0]];rg.call(Ue,$[Ne][1].type)&&Ue[$[Ne][1].type].call(Object.assign({sliceSerialize:$[Ne][2].sliceSerialize},ce),$[Ne][1])}if(ce.tokenStack.length>0){const Ue=ce.tokenStack[ce.tokenStack.length-1];(Ue[1]||Tu).call(ce,void 0,Ue[0])}for(X.position={start:ln($.length>0?$[0][1].start:{line:1,column:1,offset:0}),end:ln($.length>0?$[$.length-2][1].end:{line:1,column:1,offset:0})},Ne=-1;++Ne<t.transforms.length;)X=t.transforms[Ne](X)||X;return X}function o($,X,ce){let xe=X-1,Ne=-1,Ue=!1,mt,Oe,Ot,Gt;for(;++xe<=ce;){const Je=$[xe];switch(Je[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{Je[0]==="enter"?Ne++:Ne--,Gt=void 0;break}case"lineEndingBlank":{Je[0]==="enter"&&(mt&&!Gt&&!Ne&&!Ot&&(Ot=xe),Gt=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:Gt=void 0}if(!Ne&&Je[0]==="enter"&&Je[1].type==="listItemPrefix"||Ne===-1&&Je[0]==="exit"&&(Je[1].type==="listUnordered"||Je[1].type==="listOrdered")){if(mt){let Jt=xe;for(Oe=void 0;Jt--;){const Nt=$[Jt];if(Nt[1].type==="lineEnding"||Nt[1].type==="lineEndingBlank"){if(Nt[0]==="exit")continue;Oe&&($[Oe][1].type="lineEndingBlank",Ue=!0),Nt[1].type="lineEnding",Oe=Jt}else if(!(Nt[1].type==="linePrefix"||Nt[1].type==="blockQuotePrefix"||Nt[1].type==="blockQuotePrefixWhitespace"||Nt[1].type==="blockQuoteMarker"||Nt[1].type==="listItemIndent"))break}Ot&&(!Oe||Ot<Oe)&&(mt._spread=!0),mt.end=Object.assign({},Oe?$[Oe][1].start:Je[1].end),$.splice(Oe||xe,0,["exit",mt,Je[2]]),xe++,ce++}if(Je[1].type==="listItemPrefix"){const Jt={type:"listItem",_spread:!1,start:Object.assign({},Je[1].start),end:void 0};mt=Jt,$.splice(xe,0,["enter",Jt,Je[2]]),xe++,ce++,Ot=void 0,Gt=!0}}}return $[X][1]._spread=Ue,ce}function s($,X){return ce;function ce(xe){l.call(this,$(xe),xe),X&&X.call(this,xe)}}function i(){this.stack.push({type:"fragment",children:[]})}function l($,X,ce){this.stack[this.stack.length-1].children.push($),this.stack.push($),this.tokenStack.push([X,ce||void 0]),$.position={start:ln(X.start),end:void 0}}function c($){return X;function X(ce){$&&$.call(this,ce),u.call(this,ce)}}function u($,X){const ce=this.stack.pop(),xe=this.tokenStack.pop();if(xe)xe[0].type!==$.type&&(X?X.call(this,$,xe[0]):(xe[1]||Tu).call(this,$,xe[0]));else throw new Error("Cannot close `"+$.type+"` ("+Ar({start:$.start,end:$.end})+"): it’s not open");ce.position.end=ln($.end)}function d(){return QE(this.stack.pop())}function f(){this.data.expectingFirstListItemValue=!0}function h($){if(this.data.expectingFirstListItemValue){const X=this.stack[this.stack.length-2];X.start=Number.parseInt(this.sliceSerialize($),10),this.data.expectingFirstListItemValue=void 0}}function p(){const $=this.resume(),X=this.stack[this.stack.length-1];X.lang=$}function y(){const $=this.resume(),X=this.stack[this.stack.length-1];X.meta=$}function m(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function g(){const $=this.resume(),X=this.stack[this.stack.length-1];X.value=$.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function b(){const $=this.resume(),X=this.stack[this.stack.length-1];X.value=$.replace(/(\r?\n|\r)$/g,"")}function v($){const X=this.resume(),ce=this.stack[this.stack.length-1];ce.label=X,ce.identifier=Qn(this.sliceSerialize($)).toLowerCase()}function k(){const $=this.resume(),X=this.stack[this.stack.length-1];X.title=$}function S(){const $=this.resume(),X=this.stack[this.stack.length-1];X.url=$}function C($){const X=this.stack[this.stack.length-1];if(!X.depth){const ce=this.sliceSerialize($).length;X.depth=ce}}function j(){this.data.setextHeadingSlurpLineEnding=!0}function E($){const X=this.stack[this.stack.length-1];X.depth=this.sliceSerialize($).codePointAt(0)===61?1:2}function T(){this.data.setextHeadingSlurpLineEnding=void 0}function z($){const ce=this.stack[this.stack.length-1].children;let xe=ce[ce.length-1];(!xe||xe.type!=="text")&&(xe=Y(),xe.position={start:ln($.start),end:void 0},ce.push(xe)),this.stack.push(xe)}function O($){const X=this.stack.pop();X.value+=this.sliceSerialize($),X.position.end=ln($.end)}function B($){const X=this.stack[this.stack.length-1];if(this.data.atHardBreak){const ce=X.children[X.children.length-1];ce.position.end=ln($.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(X.type)&&(z.call(this,$),O.call(this,$))}function N(){this.data.atHardBreak=!0}function D(){const $=this.resume(),X=this.stack[this.stack.length-1];X.value=$}function w(){const $=this.resume(),X=this.stack[this.stack.length-1];X.value=$}function L(){const $=this.resume(),X=this.stack[this.stack.length-1];X.value=$}function W(){const $=this.stack[this.stack.length-1];if(this.data.inReference){const X=this.data.referenceType||"shortcut";$.type+="Reference",$.referenceType=X,delete $.url,delete $.title}else delete $.identifier,delete $.label;this.data.referenceType=void 0}function U(){const $=this.stack[this.stack.length-1];if(this.data.inReference){const X=this.data.referenceType||"shortcut";$.type+="Reference",$.referenceType=X,delete $.url,delete $.title}else delete $.identifier,delete $.label;this.data.referenceType=void 0}function F($){const X=this.sliceSerialize($),ce=this.stack[this.stack.length-2];ce.label=XT(X),ce.identifier=Qn(X).toLowerCase()}function K(){const $=this.stack[this.stack.length-1],X=this.resume(),ce=this.stack[this.stack.length-1];if(this.data.inReference=!0,ce.type==="link"){const xe=$.children;ce.children=xe}else ce.alt=X}function I(){const $=this.resume(),X=this.stack[this.stack.length-1];X.url=$}function V(){const $=this.resume(),X=this.stack[this.stack.length-1];X.title=$}function G(){this.data.inReference=void 0}function R(){this.data.referenceType="collapsed"}function ae($){const X=this.resume(),ce=this.stack[this.stack.length-1];ce.label=X,ce.identifier=Qn(this.sliceSerialize($)).toLowerCase(),this.data.referenceType="full"}function oe($){this.data.characterReferenceType=$.type}function fe($){const X=this.sliceSerialize($),ce=this.data.characterReferenceType;let xe;ce?(xe=qm(X,ce==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):xe=xl(X);const Ne=this.stack[this.stack.length-1];Ne.value+=xe}function le($){const X=this.stack.pop();X.position.end=ln($.end)}function de($){O.call(this,$);const X=this.stack[this.stack.length-1];X.url=this.sliceSerialize($)}function pe($){O.call(this,$);const X=this.stack[this.stack.length-1];X.url="mailto:"+this.sliceSerialize($)}function he(){return{type:"blockquote",children:[]}}function me(){return{type:"code",lang:null,meta:null,value:""}}function _e(){return{type:"inlineCode",value:""}}function Pe(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function _(){return{type:"emphasis",children:[]}}function ne(){return{type:"heading",depth:0,children:[]}}function Q(){return{type:"break"}}function M(){return{type:"html",value:""}}function P(){return{type:"image",title:null,url:"",alt:null}}function q(){return{type:"link",title:null,url:"",children:[]}}function Z($){return{type:"list",ordered:$.type==="listOrdered",start:null,spread:$._spread,children:[]}}function J($){return{type:"listItem",spread:$._spread,checked:null,children:[]}}function H(){return{type:"paragraph",children:[]}}function se(){return{type:"strong",children:[]}}function Y(){return{type:"text",value:""}}function ee(){return{type:"thematicBreak"}}}function ln(e){return{line:e.line,column:e.column,offset:e.offset}}function og(e,t){let n=-1;for(;++n<t.length;){const r=t[n];Array.isArray(r)?og(e,r):n4(e,r)}}function n4(e,t){let n;for(n in t)if(rg.call(t,n))switch(n){case"canContainEols":{const r=t[n];r&&e[n].push(...r);break}case"transforms":{const r=t[n];r&&e[n].push(...r);break}case"enter":case"exit":{const r=t[n];r&&Object.assign(e[n],r);break}}}function Tu(e,t){throw e?new Error("Cannot close `"+e.type+"` ("+Ar({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+Ar({start:t.start,end:t.end})+") is open"):new Error("Cannot close document, a token (`"+t.type+"`, "+Ar({start:t.start,end:t.end})+") is still open")}function r4(e){const t=this;t.parser=n;function n(r){return e4(r,{...t.data("settings"),...e,extensions:t.data("micromarkExtensions")||[],mdastExtensions:t.data("fromMarkdownExtensions")||[]})}}function o4(e,t){const n={type:"element",tagName:"blockquote",properties:{},children:e.wrap(e.all(t),!0)};return e.patch(t,n),e.applyData(t,n)}function s4(e,t){const n={type:"element",tagName:"br",properties:{},children:[]};return e.patch(t,n),[e.applyData(t,n),{type:"text",value:`
|
|
97
|
-
`}]}function
|
|
98
|
-
`:"",r={},o=t.lang?t.lang.split(/\s+/):[];o.length>0&&(r.className=["language-"+o[0]]);let s={type:"element",tagName:"code",properties:r,children:[{type:"text",value:n}]};return t.meta&&(s.data={meta:t.meta}),e.patch(t,s),s=e.applyData(t,s),s={type:"element",tagName:"pre",properties:{},children:[s]},e.patch(t,s),s}function
|
|
104
|
+
`;break}case-2:{i=t?" ":" ";break}case-1:{if(!t&&o)continue;i=" ";break}default:i=String.fromCharCode(s)}o=s===-2,r.push(i)}return r.join("")}function N4(e){const r={constructs:P3([_4,...(e||{}).extensions||[]]),content:o(U3),defined:[],document:o(V3),flow:o(l4),lazy:{},string:o(d4),text:o(f4)};return r;function o(s){return i;function i(l){return S4(r,s,l)}}}function E4(e){for(;!eg(e););return e}const Tu=/[\0\t\n\r]/g;function T4(){let e=1,t="",n=!0,r;return o;function o(s,i,l){const c=[];let u,d,f,h,p;for(s=t+(typeof s=="string"?s.toString():new TextDecoder(i||void 0).decode(s)),f=0,t="",n&&(s.charCodeAt(0)===65279&&f++,n=void 0);f<s.length;){if(Tu.lastIndex=f,u=Tu.exec(s),h=u&&u.index!==void 0?u.index:s.length,p=s.charCodeAt(h),!u){t=s.slice(f);break}if(p===10&&f===h&&r)c.push(-3),r=void 0;else switch(r&&(c.push(-5),r=void 0),f<h&&(c.push(s.slice(f,h)),e+=h-f),p){case 0:{c.push(65533),e++;break}case 9:{for(d=Math.ceil(e/4)*4,c.push(-2);e++<d;)c.push(-1);break}case 10:{c.push(-4),e=1;break}default:r=!0,e=1}f=h+1}return l&&(r&&c.push(-5),t&&c.push(t),c.push(null)),c}}const A4=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function I4(e){return e.replace(A4,z4)}function z4(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){const o=n.charCodeAt(1),s=o===120||o===88;return Jm(n.slice(s?2:1),s?16:10)}return yl(n)||e}const ig={}.hasOwnProperty;function R4(e,t,n){return typeof t!="string"&&(n=t,t=void 0),P4(n)(E4(N4(n).document().write(T4()(e,t,!0))))}function P4(e){const t={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:s(q),autolinkProtocol:z,autolinkEmail:z,atxHeading:s(ne),blockQuote:s(he),characterEscape:z,characterReference:z,codeFenced:s(me),codeFencedFenceInfo:i,codeFencedFenceMeta:i,codeIndented:s(me,i),codeText:s(_e,i),codeTextData:z,data:z,codeFlowValue:z,definition:s(Pe),definitionDestinationString:i,definitionLabelString:i,definitionTitleString:i,emphasis:s(_),hardBreakEscape:s(Q),hardBreakTrailing:s(Q),htmlFlow:s(M,i),htmlFlowData:z,htmlText:s(M,i),htmlTextData:z,image:s(P),label:i,link:s(q),listItem:s(J),listItemValue:h,listOrdered:s(Z,f),listUnordered:s(Z),paragraph:s(V),reference:R,referenceString:i,resourceDestinationString:i,resourceTitleString:i,setextHeading:s(ne),strong:s(se),thematicBreak:s(ee)},exit:{atxHeading:c(),atxHeadingSequence:C,autolink:c(),autolinkEmail:pe,autolinkProtocol:de,blockQuote:c(),characterEscapeValue:O,characterReferenceMarkerHexadecimal:re,characterReferenceMarkerNumeric:re,characterReferenceValue:fe,characterReference:le,codeFenced:c(g),codeFencedFence:m,codeFencedFenceInfo:p,codeFencedFenceMeta:y,codeFlowValue:O,codeIndented:c(b),codeText:c(L),codeTextData:O,data:O,definition:c(),definitionDestinationString:S,definitionLabelString:v,definitionTitleString:k,emphasis:c(),hardBreakEscape:c(N),hardBreakTrailing:c(N),htmlFlow:c(D),htmlFlowData:O,htmlText:c(w),htmlTextData:O,image:c(U),label:K,labelText:F,lineEnding:B,link:c(W),listItem:c(),listOrdered:c(),listUnordered:c(),paragraph:c(),referenceString:ae,resourceDestinationString:I,resourceTitleString:H,resource:G,setextHeading:c(T),setextHeadingLineSequence:E,setextHeadingText:j,strong:c(),thematicBreak:c()}};ag(t,(e||{}).mdastExtensions||[]);const n={};return r;function r($){let X={type:"root",children:[]};const ce={stack:[X],tokenStack:[],config:t,enter:l,exit:u,buffer:i,resume:d,data:n},xe=[];let Ne=-1;for(;++Ne<$.length;)if($[Ne][1].type==="listOrdered"||$[Ne][1].type==="listUnordered")if($[Ne][0]==="enter")xe.push(Ne);else{const Ue=xe.pop();Ne=o($,Ue,Ne)}for(Ne=-1;++Ne<$.length;){const Ue=t[$[Ne][0]];ig.call(Ue,$[Ne][1].type)&&Ue[$[Ne][1].type].call(Object.assign({sliceSerialize:$[Ne][2].sliceSerialize},ce),$[Ne][1])}if(ce.tokenStack.length>0){const Ue=ce.tokenStack[ce.tokenStack.length-1];(Ue[1]||Au).call(ce,void 0,Ue[0])}for(X.position={start:ln($.length>0?$[0][1].start:{line:1,column:1,offset:0}),end:ln($.length>0?$[$.length-2][1].end:{line:1,column:1,offset:0})},Ne=-1;++Ne<t.transforms.length;)X=t.transforms[Ne](X)||X;return X}function o($,X,ce){let xe=X-1,Ne=-1,Ue=!1,mt,Oe,Ot,Gt;for(;++xe<=ce;){const Je=$[xe];switch(Je[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{Je[0]==="enter"?Ne++:Ne--,Gt=void 0;break}case"lineEndingBlank":{Je[0]==="enter"&&(mt&&!Gt&&!Ne&&!Ot&&(Ot=xe),Gt=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:Gt=void 0}if(!Ne&&Je[0]==="enter"&&Je[1].type==="listItemPrefix"||Ne===-1&&Je[0]==="exit"&&(Je[1].type==="listUnordered"||Je[1].type==="listOrdered")){if(mt){let Jt=xe;for(Oe=void 0;Jt--;){const Nt=$[Jt];if(Nt[1].type==="lineEnding"||Nt[1].type==="lineEndingBlank"){if(Nt[0]==="exit")continue;Oe&&($[Oe][1].type="lineEndingBlank",Ue=!0),Nt[1].type="lineEnding",Oe=Jt}else if(!(Nt[1].type==="linePrefix"||Nt[1].type==="blockQuotePrefix"||Nt[1].type==="blockQuotePrefixWhitespace"||Nt[1].type==="blockQuoteMarker"||Nt[1].type==="listItemIndent"))break}Ot&&(!Oe||Ot<Oe)&&(mt._spread=!0),mt.end=Object.assign({},Oe?$[Oe][1].start:Je[1].end),$.splice(Oe||xe,0,["exit",mt,Je[2]]),xe++,ce++}if(Je[1].type==="listItemPrefix"){const Jt={type:"listItem",_spread:!1,start:Object.assign({},Je[1].start),end:void 0};mt=Jt,$.splice(xe,0,["enter",Jt,Je[2]]),xe++,ce++,Ot=void 0,Gt=!0}}}return $[X][1]._spread=Ue,ce}function s($,X){return ce;function ce(xe){l.call(this,$(xe),xe),X&&X.call(this,xe)}}function i(){this.stack.push({type:"fragment",children:[]})}function l($,X,ce){this.stack[this.stack.length-1].children.push($),this.stack.push($),this.tokenStack.push([X,ce||void 0]),$.position={start:ln(X.start),end:void 0}}function c($){return X;function X(ce){$&&$.call(this,ce),u.call(this,ce)}}function u($,X){const ce=this.stack.pop(),xe=this.tokenStack.pop();if(xe)xe[0].type!==$.type&&(X?X.call(this,$,xe[0]):(xe[1]||Au).call(this,$,xe[0]));else throw new Error("Cannot close `"+$.type+"` ("+zr({start:$.start,end:$.end})+"): it’s not open");ce.position.end=ln($.end)}function d(){return z3(this.stack.pop())}function f(){this.data.expectingFirstListItemValue=!0}function h($){if(this.data.expectingFirstListItemValue){const X=this.stack[this.stack.length-2];X.start=Number.parseInt(this.sliceSerialize($),10),this.data.expectingFirstListItemValue=void 0}}function p(){const $=this.resume(),X=this.stack[this.stack.length-1];X.lang=$}function y(){const $=this.resume(),X=this.stack[this.stack.length-1];X.meta=$}function m(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function g(){const $=this.resume(),X=this.stack[this.stack.length-1];X.value=$.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function b(){const $=this.resume(),X=this.stack[this.stack.length-1];X.value=$.replace(/(\r?\n|\r)$/g,"")}function v($){const X=this.resume(),ce=this.stack[this.stack.length-1];ce.label=X,ce.identifier=tr(this.sliceSerialize($)).toLowerCase()}function k(){const $=this.resume(),X=this.stack[this.stack.length-1];X.title=$}function S(){const $=this.resume(),X=this.stack[this.stack.length-1];X.url=$}function C($){const X=this.stack[this.stack.length-1];if(!X.depth){const ce=this.sliceSerialize($).length;X.depth=ce}}function j(){this.data.setextHeadingSlurpLineEnding=!0}function E($){const X=this.stack[this.stack.length-1];X.depth=this.sliceSerialize($).codePointAt(0)===61?1:2}function T(){this.data.setextHeadingSlurpLineEnding=void 0}function z($){const ce=this.stack[this.stack.length-1].children;let xe=ce[ce.length-1];(!xe||xe.type!=="text")&&(xe=Y(),xe.position={start:ln($.start),end:void 0},ce.push(xe)),this.stack.push(xe)}function O($){const X=this.stack.pop();X.value+=this.sliceSerialize($),X.position.end=ln($.end)}function B($){const X=this.stack[this.stack.length-1];if(this.data.atHardBreak){const ce=X.children[X.children.length-1];ce.position.end=ln($.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(X.type)&&(z.call(this,$),O.call(this,$))}function N(){this.data.atHardBreak=!0}function D(){const $=this.resume(),X=this.stack[this.stack.length-1];X.value=$}function w(){const $=this.resume(),X=this.stack[this.stack.length-1];X.value=$}function L(){const $=this.resume(),X=this.stack[this.stack.length-1];X.value=$}function W(){const $=this.stack[this.stack.length-1];if(this.data.inReference){const X=this.data.referenceType||"shortcut";$.type+="Reference",$.referenceType=X,delete $.url,delete $.title}else delete $.identifier,delete $.label;this.data.referenceType=void 0}function U(){const $=this.stack[this.stack.length-1];if(this.data.inReference){const X=this.data.referenceType||"shortcut";$.type+="Reference",$.referenceType=X,delete $.url,delete $.title}else delete $.identifier,delete $.label;this.data.referenceType=void 0}function F($){const X=this.sliceSerialize($),ce=this.stack[this.stack.length-2];ce.label=I4(X),ce.identifier=tr(X).toLowerCase()}function K(){const $=this.stack[this.stack.length-1],X=this.resume(),ce=this.stack[this.stack.length-1];if(this.data.inReference=!0,ce.type==="link"){const xe=$.children;ce.children=xe}else ce.alt=X}function I(){const $=this.resume(),X=this.stack[this.stack.length-1];X.url=$}function H(){const $=this.resume(),X=this.stack[this.stack.length-1];X.title=$}function G(){this.data.inReference=void 0}function R(){this.data.referenceType="collapsed"}function ae($){const X=this.resume(),ce=this.stack[this.stack.length-1];ce.label=X,ce.identifier=tr(this.sliceSerialize($)).toLowerCase(),this.data.referenceType="full"}function re($){this.data.characterReferenceType=$.type}function fe($){const X=this.sliceSerialize($),ce=this.data.characterReferenceType;let xe;ce?(xe=Jm(X,ce==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):xe=yl(X);const Ne=this.stack[this.stack.length-1];Ne.value+=xe}function le($){const X=this.stack.pop();X.position.end=ln($.end)}function de($){O.call(this,$);const X=this.stack[this.stack.length-1];X.url=this.sliceSerialize($)}function pe($){O.call(this,$);const X=this.stack[this.stack.length-1];X.url="mailto:"+this.sliceSerialize($)}function he(){return{type:"blockquote",children:[]}}function me(){return{type:"code",lang:null,meta:null,value:""}}function _e(){return{type:"inlineCode",value:""}}function Pe(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function _(){return{type:"emphasis",children:[]}}function ne(){return{type:"heading",depth:0,children:[]}}function Q(){return{type:"break"}}function M(){return{type:"html",value:""}}function P(){return{type:"image",title:null,url:"",alt:null}}function q(){return{type:"link",title:null,url:"",children:[]}}function Z($){return{type:"list",ordered:$.type==="listOrdered",start:null,spread:$._spread,children:[]}}function J($){return{type:"listItem",spread:$._spread,checked:null,children:[]}}function V(){return{type:"paragraph",children:[]}}function se(){return{type:"strong",children:[]}}function Y(){return{type:"text",value:""}}function ee(){return{type:"thematicBreak"}}}function ln(e){return{line:e.line,column:e.column,offset:e.offset}}function ag(e,t){let n=-1;for(;++n<t.length;){const r=t[n];Array.isArray(r)?ag(e,r):O4(e,r)}}function O4(e,t){let n;for(n in t)if(ig.call(t,n))switch(n){case"canContainEols":{const r=t[n];r&&e[n].push(...r);break}case"transforms":{const r=t[n];r&&e[n].push(...r);break}case"enter":case"exit":{const r=t[n];r&&Object.assign(e[n],r);break}}}function Au(e,t){throw e?new Error("Cannot close `"+e.type+"` ("+zr({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+zr({start:t.start,end:t.end})+") is open"):new Error("Cannot close document, a token (`"+t.type+"`, "+zr({start:t.start,end:t.end})+") is still open")}function M4(e){const t=this;t.parser=n;function n(r){return R4(r,{...t.data("settings"),...e,extensions:t.data("micromarkExtensions")||[],mdastExtensions:t.data("fromMarkdownExtensions")||[]})}}function L4(e,t){const n={type:"element",tagName:"blockquote",properties:{},children:e.wrap(e.all(t),!0)};return e.patch(t,n),e.applyData(t,n)}function D4(e,t){const n={type:"element",tagName:"br",properties:{},children:[]};return e.patch(t,n),[e.applyData(t,n),{type:"text",value:`
|
|
105
|
+
`}]}function F4(e,t){const n=t.value?t.value+`
|
|
106
|
+
`:"",r={},o=t.lang?t.lang.split(/\s+/):[];o.length>0&&(r.className=["language-"+o[0]]);let s={type:"element",tagName:"code",properties:r,children:[{type:"text",value:n}]};return t.meta&&(s.data={meta:t.meta}),e.patch(t,s),s=e.applyData(t,s),s={type:"element",tagName:"pre",properties:{},children:[s]},e.patch(t,s),s}function $4(e,t){const n={type:"element",tagName:"del",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function B4(e,t){const n={type:"element",tagName:"em",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function U4(e,t){const n=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",r=String(t.identifier).toUpperCase(),o=br(r.toLowerCase()),s=e.footnoteOrder.indexOf(r);let i,l=e.footnoteCounts.get(r);l===void 0?(l=0,e.footnoteOrder.push(r),i=e.footnoteOrder.length):i=s+1,l+=1,e.footnoteCounts.set(r,l);const c={type:"element",tagName:"a",properties:{href:"#"+n+"fn-"+o,id:n+"fnref-"+o+(l>1?"-"+l:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(i)}]};e.patch(t,c);const u={type:"element",tagName:"sup",properties:{},children:[c]};return e.patch(t,u),e.applyData(t,u)}function W4(e,t){const n={type:"element",tagName:"h"+t.depth,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function V4(e,t){if(e.options.allowDangerousHtml){const n={type:"raw",value:t.value};return e.patch(t,n),e.applyData(t,n)}}function lg(e,t){const n=t.referenceType;let r="]";if(n==="collapsed"?r+="[]":n==="full"&&(r+="["+(t.label||t.identifier)+"]"),t.type==="imageReference")return[{type:"text",value:"!["+t.alt+r}];const o=e.all(t),s=o[0];s&&s.type==="text"?s.value="["+s.value:o.unshift({type:"text",value:"["});const i=o[o.length-1];return i&&i.type==="text"?i.value+=r:o.push({type:"text",value:r}),o}function H4(e,t){const n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return lg(e,t);const o={src:br(r.url||""),alt:t.alt};r.title!==null&&r.title!==void 0&&(o.title=r.title);const s={type:"element",tagName:"img",properties:o,children:[]};return e.patch(t,s),e.applyData(t,s)}function Z4(e,t){const n={src:br(t.url)};t.alt!==null&&t.alt!==void 0&&(n.alt=t.alt),t.title!==null&&t.title!==void 0&&(n.title=t.title);const r={type:"element",tagName:"img",properties:n,children:[]};return e.patch(t,r),e.applyData(t,r)}function q4(e,t){const n={type:"text",value:t.value.replace(/\r?\n|\r/g," ")};e.patch(t,n);const r={type:"element",tagName:"code",properties:{},children:[n]};return e.patch(t,r),e.applyData(t,r)}function K4(e,t){const n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return lg(e,t);const o={href:br(r.url||"")};r.title!==null&&r.title!==void 0&&(o.title=r.title);const s={type:"element",tagName:"a",properties:o,children:e.all(t)};return e.patch(t,s),e.applyData(t,s)}function G4(e,t){const n={href:br(t.url)};t.title!==null&&t.title!==void 0&&(n.title=t.title);const r={type:"element",tagName:"a",properties:n,children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function J4(e,t,n){const r=e.all(t),o=n?Y4(n):cg(t),s={},i=[];if(typeof t.checked=="boolean"){const d=r[0];let f;d&&d.type==="element"&&d.tagName==="p"?f=d:(f={type:"element",tagName:"p",properties:{},children:[]},r.unshift(f)),f.children.length>0&&f.children.unshift({type:"text",value:" "}),f.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:t.checked,disabled:!0},children:[]}),s.className=["task-list-item"]}let l=-1;for(;++l<r.length;){const d=r[l];(o||l!==0||d.type!=="element"||d.tagName!=="p")&&i.push({type:"text",value:`
|
|
99
107
|
`}),d.type==="element"&&d.tagName==="p"&&!o?i.push(...d.children):i.push(d)}const c=r[r.length-1];c&&(o||c.type!=="element"||c.tagName!=="p")&&i.push({type:"text",value:`
|
|
100
|
-
`});const u={type:"element",tagName:"li",properties:s,children:i};return e.patch(t,u),e.applyData(t,u)}function
|
|
108
|
+
`});const u={type:"element",tagName:"li",properties:s,children:i};return e.patch(t,u),e.applyData(t,u)}function Y4(e){let t=!1;if(e.type==="list"){t=e.spread||!1;const n=e.children;let r=-1;for(;!t&&++r<n.length;)t=cg(n[r])}return t}function cg(e){const t=e.spread;return t??e.children.length>1}function X4(e,t){const n={},r=e.all(t);let o=-1;for(typeof t.start=="number"&&t.start!==1&&(n.start=t.start);++o<r.length;){const i=r[o];if(i.type==="element"&&i.tagName==="li"&&i.properties&&Array.isArray(i.properties.className)&&i.properties.className.includes("task-list-item")){n.className=["contains-task-list"];break}}const s={type:"element",tagName:t.ordered?"ol":"ul",properties:n,children:e.wrap(r,!0)};return e.patch(t,s),e.applyData(t,s)}function Q4(e,t){const n={type:"element",tagName:"p",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function eA(e,t){const n={type:"root",children:e.wrap(e.all(t))};return e.patch(t,n),e.applyData(t,n)}function tA(e,t){const n={type:"element",tagName:"strong",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function nA(e,t){const n=e.all(t),r=n.shift(),o=[];if(r){const i={type:"element",tagName:"thead",properties:{},children:e.wrap([r],!0)};e.patch(t.children[0],i),o.push(i)}if(n.length>0){const i={type:"element",tagName:"tbody",properties:{},children:e.wrap(n,!0)},l=ml(t.children[1]),c=Wm(t.children[t.children.length-1]);l&&c&&(i.position={start:l,end:c}),o.push(i)}const s={type:"element",tagName:"table",properties:{},children:e.wrap(o,!0)};return e.patch(t,s),e.applyData(t,s)}function rA(e,t,n){const r=n?n.children:void 0,s=(r?r.indexOf(t):1)===0?"th":"td",i=n&&n.type==="table"?n.align:void 0,l=i?i.length:t.children.length;let c=-1;const u=[];for(;++c<l;){const f=t.children[c],h={},p=i?i[c]:void 0;p&&(h.align=p);let y={type:"element",tagName:s,properties:h,children:[]};f&&(y.children=e.all(f),e.patch(f,y),y=e.applyData(f,y)),u.push(y)}const d={type:"element",tagName:"tr",properties:{},children:e.wrap(u,!0)};return e.patch(t,d),e.applyData(t,d)}function oA(e,t){const n={type:"element",tagName:"td",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}const Iu=9,zu=32;function sA(e){const t=String(e),n=/\r?\n|\r/g;let r=n.exec(t),o=0;const s=[];for(;r;)s.push(Ru(t.slice(o,r.index),o>0,!0),r[0]),o=r.index+r[0].length,r=n.exec(t);return s.push(Ru(t.slice(o),o>0,!1)),s.join("")}function Ru(e,t,n){let r=0,o=e.length;if(t){let s=e.codePointAt(r);for(;s===Iu||s===zu;)r++,s=e.codePointAt(r)}if(n){let s=e.codePointAt(o-1);for(;s===Iu||s===zu;)o--,s=e.codePointAt(o-1)}return o>r?e.slice(r,o):""}function iA(e,t){const n={type:"text",value:sA(String(t.value))};return e.patch(t,n),e.applyData(t,n)}function aA(e,t){const n={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(t,n),e.applyData(t,n)}const lA={blockquote:L4,break:D4,code:F4,delete:$4,emphasis:B4,footnoteReference:U4,heading:W4,html:V4,imageReference:H4,image:Z4,inlineCode:q4,linkReference:K4,link:G4,listItem:J4,list:X4,paragraph:Q4,root:eA,strong:tA,table:nA,tableCell:oA,tableRow:rA,text:iA,thematicBreak:aA,toml:bo,yaml:bo,definition:bo,footnoteDefinition:bo};function bo(){}const ug=-1,Fs=0,Pr=1,Yo=2,kl=3,_l=4,Sl=5,Cl=6,dg=7,fg=8,Pu=typeof self=="object"?self:globalThis,cA=(e,t)=>{const n=(o,s)=>(e.set(s,o),o),r=o=>{if(e.has(o))return e.get(o);const[s,i]=t[o];switch(s){case Fs:case ug:return n(i,o);case Pr:{const l=n([],o);for(const c of i)l.push(r(c));return l}case Yo:{const l=n({},o);for(const[c,u]of i)l[r(c)]=r(u);return l}case kl:return n(new Date(i),o);case _l:{const{source:l,flags:c}=i;return n(new RegExp(l,c),o)}case Sl:{const l=n(new Map,o);for(const[c,u]of i)l.set(r(c),r(u));return l}case Cl:{const l=n(new Set,o);for(const c of i)l.add(r(c));return l}case dg:{const{name:l,message:c}=i;return n(new Pu[l](c),o)}case fg:return n(BigInt(i),o);case"BigInt":return n(Object(BigInt(i)),o);case"ArrayBuffer":return n(new Uint8Array(i).buffer,i);case"DataView":{const{buffer:l}=new Uint8Array(i);return n(new DataView(l),i)}}return n(new Pu[s](i),o)};return r},Ou=e=>cA(new Map,e)(0),Vn="",{toString:uA}={},{keys:dA}=Object,Cr=e=>{const t=typeof e;if(t!=="object"||!e)return[Fs,t];const n=uA.call(e).slice(8,-1);switch(n){case"Array":return[Pr,Vn];case"Object":return[Yo,Vn];case"Date":return[kl,Vn];case"RegExp":return[_l,Vn];case"Map":return[Sl,Vn];case"Set":return[Cl,Vn];case"DataView":return[Pr,n]}return n.includes("Array")?[Pr,n]:n.includes("Error")?[dg,n]:[Yo,n]},yo=([e,t])=>e===Fs&&(t==="function"||t==="symbol"),fA=(e,t,n,r)=>{const o=(i,l)=>{const c=r.push(i)-1;return n.set(l,c),c},s=i=>{if(n.has(i))return n.get(i);let[l,c]=Cr(i);switch(l){case Fs:{let d=i;switch(c){case"bigint":l=fg,d=i.toString();break;case"function":case"symbol":if(e)throw new TypeError("unable to serialize "+c);d=null;break;case"undefined":return o([ug],i)}return o([l,d],i)}case Pr:{if(c){let h=i;return c==="DataView"?h=new Uint8Array(i.buffer):c==="ArrayBuffer"&&(h=new Uint8Array(i)),o([c,[...h]],i)}const d=[],f=o([l,d],i);for(const h of i)d.push(s(h));return f}case Yo:{if(c)switch(c){case"BigInt":return o([c,i.toString()],i);case"Boolean":case"Number":case"String":return o([c,i.valueOf()],i)}if(t&&"toJSON"in i)return s(i.toJSON());const d=[],f=o([l,d],i);for(const h of dA(i))(e||!yo(Cr(i[h])))&&d.push([s(h),s(i[h])]);return f}case kl:return o([l,i.toISOString()],i);case _l:{const{source:d,flags:f}=i;return o([l,{source:d,flags:f}],i)}case Sl:{const d=[],f=o([l,d],i);for(const[h,p]of i)(e||!(yo(Cr(h))||yo(Cr(p))))&&d.push([s(h),s(p)]);return f}case Cl:{const d=[],f=o([l,d],i);for(const h of i)(e||!yo(Cr(h)))&&d.push(s(h));return f}}const{message:u}=i;return o([l,{name:c,message:u}],i)};return s},Mu=(e,{json:t,lossy:n}={})=>{const r=[];return fA(!(t||n),!!t,new Map,r)(e),r},Xo=typeof structuredClone=="function"?(e,t)=>t&&("json"in t||"lossy"in t)?Ou(Mu(e,t)):structuredClone(e):(e,t)=>Ou(Mu(e,t));function pA(e,t){const n=[{type:"text",value:"↩"}];return t>1&&n.push({type:"element",tagName:"sup",properties:{},children:[{type:"text",value:String(t)}]}),n}function hA(e,t){return"Back to reference "+(e+1)+(t>1?"-"+t:"")}function mA(e){const t=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",n=e.options.footnoteBackContent||pA,r=e.options.footnoteBackLabel||hA,o=e.options.footnoteLabel||"Footnotes",s=e.options.footnoteLabelTagName||"h2",i=e.options.footnoteLabelProperties||{className:["sr-only"]},l=[];let c=-1;for(;++c<e.footnoteOrder.length;){const u=e.footnoteById.get(e.footnoteOrder[c]);if(!u)continue;const d=e.all(u),f=String(u.identifier).toUpperCase(),h=br(f.toLowerCase());let p=0;const y=[],m=e.footnoteCounts.get(f);for(;m!==void 0&&++p<=m;){y.length>0&&y.push({type:"text",value:" "});let v=typeof n=="string"?n:n(c,p);typeof v=="string"&&(v={type:"text",value:v}),y.push({type:"element",tagName:"a",properties:{href:"#"+t+"fnref-"+h+(p>1?"-"+p:""),dataFootnoteBackref:"",ariaLabel:typeof r=="string"?r:r(c,p),className:["data-footnote-backref"]},children:Array.isArray(v)?v:[v]})}const g=d[d.length-1];if(g&&g.type==="element"&&g.tagName==="p"){const v=g.children[g.children.length-1];v&&v.type==="text"?v.value+=" ":g.children.push({type:"text",value:" "}),g.children.push(...y)}else d.push(...y);const b={type:"element",tagName:"li",properties:{id:t+"fn-"+h},children:e.wrap(d,!0)};e.patch(u,b),l.push(b)}if(l.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:s,properties:{...Xo(i),id:"footnote-label"},children:[{type:"text",value:o}]},{type:"text",value:`
|
|
101
109
|
`},{type:"element",tagName:"ol",properties:{},children:e.wrap(l,!0)},{type:"text",value:`
|
|
102
|
-
`}]}}const
|
|
110
|
+
`}]}}const pg=(function(e){if(e==null)return yA;if(typeof e=="function")return $s(e);if(typeof e=="object")return Array.isArray(e)?gA(e):xA(e);if(typeof e=="string")return bA(e);throw new Error("Expected function, string, or object as test")});function gA(e){const t=[];let n=-1;for(;++n<e.length;)t[n]=pg(e[n]);return $s(r);function r(...o){let s=-1;for(;++s<t.length;)if(t[s].apply(this,o))return!0;return!1}}function xA(e){const t=e;return $s(n);function n(r){const o=r;let s;for(s in e)if(o[s]!==t[s])return!1;return!0}}function bA(e){return $s(t);function t(n){return n&&n.type===e}}function $s(e){return t;function t(n,r,o){return!!(vA(n)&&e.call(this,n,typeof r=="number"?r:void 0,o||void 0))}}function yA(){return!0}function vA(e){return e!==null&&typeof e=="object"&&"type"in e}const hg=[],wA=!0,Lu=!1,kA="skip";function _A(e,t,n,r){let o;typeof t=="function"&&typeof n!="function"?(r=n,n=t):o=t;const s=pg(o),i=r?-1:1;l(e,void 0,[])();function l(c,u,d){const f=c&&typeof c=="object"?c:{};if(typeof f.type=="string"){const p=typeof f.tagName=="string"?f.tagName:typeof f.name=="string"?f.name:void 0;Object.defineProperty(h,"name",{value:"node ("+(c.type+(p?"<"+p+">":""))+")"})}return h;function h(){let p=hg,y,m,g;if((!t||s(c,u,d[d.length-1]||void 0))&&(p=SA(n(c,d)),p[0]===Lu))return p;if("children"in c&&c.children){const b=c;if(b.children&&p[0]!==kA)for(m=(r?b.children.length:-1)+i,g=d.concat(b);m>-1&&m<b.children.length;){const v=b.children[m];if(y=l(v,m,g)(),y[0]===Lu)return y;m=typeof y[1]=="number"?y[1]:m+i}}return p}}}function SA(e){return Array.isArray(e)?e:typeof e=="number"?[wA,e]:e==null?hg:[e]}function mg(e,t,n,r){let o,s,i;typeof t=="function"&&typeof n!="function"?(s=void 0,i=t,o=n):(s=t,i=n,o=r),_A(e,s,l,o);function l(c,u){const d=u[u.length-1],f=d?d.children.indexOf(c):void 0;return i(c,f,d)}}const ca={}.hasOwnProperty,CA={};function jA(e,t){const n=t||CA,r=new Map,o=new Map,s=new Map,i={...lA,...n.handlers},l={all:u,applyData:EA,definitionById:r,footnoteById:o,footnoteCounts:s,footnoteOrder:[],handlers:i,one:c,options:n,patch:NA,wrap:AA};return mg(e,function(d){if(d.type==="definition"||d.type==="footnoteDefinition"){const f=d.type==="definition"?r:o,h=String(d.identifier).toUpperCase();f.has(h)||f.set(h,d)}}),l;function c(d,f){const h=d.type,p=l.handlers[h];if(ca.call(l.handlers,h)&&p)return p(l,d,f);if(l.options.passThrough&&l.options.passThrough.includes(h)){if("children"in d){const{children:m,...g}=d,b=Xo(g);return b.children=l.all(d),b}return Xo(d)}return(l.options.unknownHandler||TA)(l,d,f)}function u(d){const f=[];if("children"in d){const h=d.children;let p=-1;for(;++p<h.length;){const y=l.one(h[p],d);if(y){if(p&&h[p-1].type==="break"&&(!Array.isArray(y)&&y.type==="text"&&(y.value=Du(y.value)),!Array.isArray(y)&&y.type==="element")){const m=y.children[0];m&&m.type==="text"&&(m.value=Du(m.value))}Array.isArray(y)?f.push(...y):f.push(y)}}}return f}}function NA(e,t){e.position&&(t.position=u3(e))}function EA(e,t){let n=t;if(e&&e.data){const r=e.data.hName,o=e.data.hChildren,s=e.data.hProperties;if(typeof r=="string")if(n.type==="element")n.tagName=r;else{const i="children"in n?n.children:[n];n={type:"element",tagName:r,properties:{},children:i}}n.type==="element"&&s&&Object.assign(n.properties,Xo(s)),"children"in n&&n.children&&o!==null&&o!==void 0&&(n.children=o)}return n}function TA(e,t){const n=t.data||{},r="value"in t&&!(ca.call(n,"hProperties")||ca.call(n,"hChildren"))?{type:"text",value:t.value}:{type:"element",tagName:"div",properties:{},children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function AA(e,t){const n=[];let r=-1;for(t&&n.push({type:"text",value:`
|
|
103
111
|
`});++r<e.length;)r&&n.push({type:"text",value:`
|
|
104
112
|
`}),n.push(e[r]);return t&&e.length>0&&n.push({type:"text",value:`
|
|
105
|
-
`}),n}function
|
|
106
|
-
`},o),s}function X4(e,t){return e&&"run"in e?async function(n,r){const o=Du(n,{file:r,...t});await e.run(o,r)}:function(n,r){return Du(n,{file:r,...e||t})}}function Fu(e){if(e)throw e}var di,$u;function Q4(){if($u)return di;$u=1;var e=Object.prototype.hasOwnProperty,t=Object.prototype.toString,n=Object.defineProperty,r=Object.getOwnPropertyDescriptor,o=function(u){return typeof Array.isArray=="function"?Array.isArray(u):t.call(u)==="[object Array]"},s=function(u){if(!u||t.call(u)!=="[object Object]")return!1;var d=e.call(u,"constructor"),f=u.constructor&&u.constructor.prototype&&e.call(u.constructor.prototype,"isPrototypeOf");if(u.constructor&&!d&&!f)return!1;var h;for(h in u);return typeof h>"u"||e.call(u,h)},i=function(u,d){n&&d.name==="__proto__"?n(u,d.name,{enumerable:!0,configurable:!0,value:d.newValue,writable:!0}):u[d.name]=d.newValue},l=function(u,d){if(d==="__proto__")if(e.call(u,d)){if(r)return r(u,d).value}else return;return u[d]};return di=function c(){var u,d,f,h,p,y,m=arguments[0],g=1,b=arguments.length,v=!1;for(typeof m=="boolean"&&(v=m,m=arguments[1]||{},g=2),(m==null||typeof m!="object"&&typeof m!="function")&&(m={});g<b;++g)if(u=arguments[g],u!=null)for(d in u)f=l(m,d),h=l(u,d),m!==h&&(v&&h&&(s(h)||(p=o(h)))?(p?(p=!1,y=f&&o(f)?f:[]):y=f&&s(f)?f:{},i(m,{name:d,newValue:c(v,y,h)})):typeof h<"u"&&i(m,{name:d,newValue:h}));return m},di}var eA=Q4();const fi=ka(eA);function ua(e){if(typeof e!="object"||e===null)return!1;const t=Object.getPrototypeOf(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)}function tA(){const e=[],t={run:n,use:r};return t;function n(...o){let s=-1;const i=o.pop();if(typeof i!="function")throw new TypeError("Expected function as last argument, not "+i);l(null,...o);function l(c,...u){const d=e[++s];let f=-1;if(c){i(c);return}for(;++f<o.length;)(u[f]===null||u[f]===void 0)&&(u[f]=o[f]);o=u,d?nA(d,l)(...u):i(null,...u)}}function r(o){if(typeof o!="function")throw new TypeError("Expected `middelware` to be a function, not "+o);return e.push(o),t}}function nA(e,t){let n;return r;function r(...i){const l=e.length>i.length;let c;l&&i.push(o);try{c=e.apply(this,i)}catch(u){const d=u;if(l&&n)throw d;return o(d)}l||(c&&c.then&&typeof c.then=="function"?c.then(s,o):c instanceof Error?o(c):s(c))}function o(i,...l){n||(n=!0,t(i,...l))}function s(i){o(null,i)}}const Mt={basename:rA,dirname:oA,extname:sA,join:iA,sep:"/"};function rA(e,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');Xr(e);let n=0,r=-1,o=e.length,s;if(t===void 0||t.length===0||t.length>e.length){for(;o--;)if(e.codePointAt(o)===47){if(s){n=o+1;break}}else r<0&&(s=!0,r=o+1);return r<0?"":e.slice(n,r)}if(t===e)return"";let i=-1,l=t.length-1;for(;o--;)if(e.codePointAt(o)===47){if(s){n=o+1;break}}else i<0&&(s=!0,i=o+1),l>-1&&(e.codePointAt(o)===t.codePointAt(l--)?l<0&&(r=o):(l=-1,r=i));return n===r?r=i:r<0&&(r=e.length),e.slice(n,r)}function oA(e){if(Xr(e),e.length===0)return".";let t=-1,n=e.length,r;for(;--n;)if(e.codePointAt(n)===47){if(r){t=n;break}}else r||(r=!0);return t<0?e.codePointAt(0)===47?"/":".":t===1&&e.codePointAt(0)===47?"//":e.slice(0,t)}function sA(e){Xr(e);let t=e.length,n=-1,r=0,o=-1,s=0,i;for(;t--;){const l=e.codePointAt(t);if(l===47){if(i){r=t+1;break}continue}n<0&&(i=!0,n=t+1),l===46?o<0?o=t:s!==1&&(s=1):o>-1&&(s=-1)}return o<0||n<0||s===0||s===1&&o===n-1&&o===r+1?"":e.slice(o,n)}function iA(...e){let t=-1,n;for(;++t<e.length;)Xr(e[t]),e[t]&&(n=n===void 0?e[t]:n+"/"+e[t]);return n===void 0?".":aA(n)}function aA(e){Xr(e);const t=e.codePointAt(0)===47;let n=lA(e,!t);return n.length===0&&!t&&(n="."),n.length>0&&e.codePointAt(e.length-1)===47&&(n+="/"),t?"/"+n:n}function lA(e,t){let n="",r=0,o=-1,s=0,i=-1,l,c;for(;++i<=e.length;){if(i<e.length)l=e.codePointAt(i);else{if(l===47)break;l=47}if(l===47){if(!(o===i-1||s===1))if(o!==i-1&&s===2){if(n.length<2||r!==2||n.codePointAt(n.length-1)!==46||n.codePointAt(n.length-2)!==46){if(n.length>2){if(c=n.lastIndexOf("/"),c!==n.length-1){c<0?(n="",r=0):(n=n.slice(0,c),r=n.length-1-n.lastIndexOf("/")),o=i,s=0;continue}}else if(n.length>0){n="",r=0,o=i,s=0;continue}}t&&(n=n.length>0?n+"/..":"..",r=2)}else n.length>0?n+="/"+e.slice(o+1,i):n=e.slice(o+1,i),r=i-o-1;o=i,s=0}else l===46&&s>-1?s++:s=-1}return n}function Xr(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const cA={cwd:uA};function uA(){return"/"}function da(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function dA(e){if(typeof e=="string")e=new URL(e);else if(!da(e)){const t=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+e+"`");throw t.code="ERR_INVALID_ARG_TYPE",t}if(e.protocol!=="file:"){const t=new TypeError("The URL must be of scheme file");throw t.code="ERR_INVALID_URL_SCHEME",t}return fA(e)}function fA(e){if(e.hostname!==""){const r=new TypeError('File URL host must be "localhost" or empty on darwin');throw r.code="ERR_INVALID_FILE_URL_HOST",r}const t=e.pathname;let n=-1;for(;++n<t.length;)if(t.codePointAt(n)===37&&t.codePointAt(n+1)===50){const r=t.codePointAt(n+2);if(r===70||r===102){const o=new TypeError("File URL path must not include encoded / characters");throw o.code="ERR_INVALID_FILE_URL_PATH",o}}return decodeURIComponent(t)}const pi=["history","path","basename","stem","extname","dirname"];class pg{constructor(t){let n;t?da(t)?n={path:t}:typeof t=="string"||pA(t)?n={value:t}:n=t:n={},this.cwd="cwd"in n?"":cA.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let r=-1;for(;++r<pi.length;){const s=pi[r];s in n&&n[s]!==void 0&&n[s]!==null&&(this[s]=s==="history"?[...n[s]]:n[s])}let o;for(o in n)pi.includes(o)||(this[o]=n[o])}get basename(){return typeof this.path=="string"?Mt.basename(this.path):void 0}set basename(t){mi(t,"basename"),hi(t,"basename"),this.path=Mt.join(this.dirname||"",t)}get dirname(){return typeof this.path=="string"?Mt.dirname(this.path):void 0}set dirname(t){Bu(this.basename,"dirname"),this.path=Mt.join(t||"",this.basename)}get extname(){return typeof this.path=="string"?Mt.extname(this.path):void 0}set extname(t){if(hi(t,"extname"),Bu(this.dirname,"extname"),t){if(t.codePointAt(0)!==46)throw new Error("`extname` must start with `.`");if(t.includes(".",1))throw new Error("`extname` cannot contain multiple dots")}this.path=Mt.join(this.dirname,this.stem+(t||""))}get path(){return this.history[this.history.length-1]}set path(t){da(t)&&(t=dA(t)),mi(t,"path"),this.path!==t&&this.history.push(t)}get stem(){return typeof this.path=="string"?Mt.basename(this.path,this.extname):void 0}set stem(t){mi(t,"stem"),hi(t,"stem"),this.path=Mt.join(this.dirname||"",t+(this.extname||""))}fail(t,n,r){const o=this.message(t,n,r);throw o.fatal=!0,o}info(t,n,r){const o=this.message(t,n,r);return o.fatal=void 0,o}message(t,n,r){const o=new it(t,n,r);return this.path&&(o.name=this.path+":"+o.name,o.file=this.path),o.fatal=!1,this.messages.push(o),o}toString(t){return this.value===void 0?"":typeof this.value=="string"?this.value:new TextDecoder(t||void 0).decode(this.value)}}function hi(e,t){if(e&&e.includes(Mt.sep))throw new Error("`"+t+"` cannot be a path: did not expect `"+Mt.sep+"`")}function mi(e,t){if(!e)throw new Error("`"+t+"` cannot be empty")}function Bu(e,t){if(!e)throw new Error("Setting `"+t+"` requires `path` to be set too")}function pA(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const hA=(function(e){const r=this.constructor.prototype,o=r[e],s=function(){return o.apply(s,arguments)};return Object.setPrototypeOf(s,r),s}),mA={}.hasOwnProperty;class Sl extends hA{constructor(){super("copy"),this.Compiler=void 0,this.Parser=void 0,this.attachers=[],this.compiler=void 0,this.freezeIndex=-1,this.frozen=void 0,this.namespace={},this.parser=void 0,this.transformers=tA()}copy(){const t=new Sl;let n=-1;for(;++n<this.attachers.length;){const r=this.attachers[n];t.use(...r)}return t.data(fi(!0,{},this.namespace)),t}data(t,n){return typeof t=="string"?arguments.length===2?(bi("data",this.frozen),this.namespace[t]=n,this):mA.call(this.namespace,t)&&this.namespace[t]||void 0:t?(bi("data",this.frozen),this.namespace=t,this):this.namespace}freeze(){if(this.frozen)return this;const t=this;for(;++this.freezeIndex<this.attachers.length;){const[n,...r]=this.attachers[this.freezeIndex];if(r[0]===!1)continue;r[0]===!0&&(r[0]=void 0);const o=n.call(t,...r);typeof o=="function"&&this.transformers.use(o)}return this.frozen=!0,this.freezeIndex=Number.POSITIVE_INFINITY,this}parse(t){this.freeze();const n=vo(t),r=this.parser||this.Parser;return gi("parse",r),r(String(n),n)}process(t,n){const r=this;return this.freeze(),gi("process",this.parser||this.Parser),xi("process",this.compiler||this.Compiler),n?o(void 0,n):new Promise(o);function o(s,i){const l=vo(t),c=r.parse(l);r.run(c,l,function(d,f,h){if(d||!f||!h)return u(d);const p=f,y=r.stringify(p,h);bA(y)?h.value=y:h.result=y,u(d,h)});function u(d,f){d||!f?i(d):s?s(f):n(void 0,f)}}}processSync(t){let n=!1,r;return this.freeze(),gi("processSync",this.parser||this.Parser),xi("processSync",this.compiler||this.Compiler),this.process(t,o),Wu("processSync","process",n),r;function o(s,i){n=!0,Fu(s),r=i}}run(t,n,r){Uu(t),this.freeze();const o=this.transformers;return!r&&typeof n=="function"&&(r=n,n=void 0),r?s(void 0,r):new Promise(s);function s(i,l){const c=vo(n);o.run(t,c,u);function u(d,f,h){const p=f||t;d?l(d):i?i(p):r(void 0,p,h)}}}runSync(t,n){let r=!1,o;return this.run(t,n,s),Wu("runSync","run",r),o;function s(i,l){Fu(i),o=l,r=!0}}stringify(t,n){this.freeze();const r=vo(n),o=this.compiler||this.Compiler;return xi("stringify",o),Uu(t),o(t,r)}use(t,...n){const r=this.attachers,o=this.namespace;if(bi("use",this.frozen),t!=null)if(typeof t=="function")c(t,n);else if(typeof t=="object")Array.isArray(t)?l(t):i(t);else throw new TypeError("Expected usable value, not `"+t+"`");return this;function s(u){if(typeof u=="function")c(u,[]);else if(typeof u=="object")if(Array.isArray(u)){const[d,...f]=u;c(d,f)}else i(u);else throw new TypeError("Expected usable value, not `"+u+"`")}function i(u){if(!("plugins"in u)&&!("settings"in u))throw new Error("Expected usable value but received an empty preset, which is probably a mistake: presets typically come with `plugins` and sometimes with `settings`, but this has neither");l(u.plugins),u.settings&&(o.settings=fi(!0,o.settings,u.settings))}function l(u){let d=-1;if(u!=null)if(Array.isArray(u))for(;++d<u.length;){const f=u[d];s(f)}else throw new TypeError("Expected a list of plugins, not `"+u+"`")}function c(u,d){let f=-1,h=-1;for(;++f<r.length;)if(r[f][0]===u){h=f;break}if(h===-1)r.push([u,...d]);else if(d.length>0){let[p,...y]=d;const m=r[h][1];ua(m)&&ua(p)&&(p=fi(!0,m,p)),r[h]=[u,p,...y]}}}}const gA=new Sl().freeze();function gi(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function xi(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function bi(e,t){if(t)throw new Error("Cannot call `"+e+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function Uu(e){if(!ua(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function Wu(e,t,n){if(!n)throw new Error("`"+e+"` finished async. Use `"+t+"` instead")}function vo(e){return xA(e)?e:new pg(e)}function xA(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function bA(e){return typeof e=="string"||yA(e)}function yA(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const vA="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",Hu=[],Vu={allowDangerousHtml:!0},wA=/^(https?|ircs?|mailto|xmpp)$/i,kA=[{from:"astPlugins",id:"remove-buggy-html-in-markdown-parser"},{from:"allowDangerousHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"allowNode",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowElement"},{from:"allowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowedElements"},{from:"className",id:"remove-classname"},{from:"disallowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"disallowedElements"},{from:"escapeHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"includeElementIndex",id:"#remove-includeelementindex"},{from:"includeNodeIndex",id:"change-includenodeindex-to-includeelementindex"},{from:"linkTarget",id:"remove-linktarget"},{from:"plugins",id:"change-plugins-to-remarkplugins",to:"remarkPlugins"},{from:"rawSourcePos",id:"#remove-rawsourcepos"},{from:"renderers",id:"change-renderers-to-components",to:"components"},{from:"source",id:"change-source-to-children",to:"children"},{from:"sourcePos",id:"#remove-sourcepos"},{from:"transformImageUri",id:"#add-urltransform",to:"urlTransform"},{from:"transformLinkUri",id:"#add-urltransform",to:"urlTransform"}];function Zu(e){const t=_A(e),n=SA(e);return CA(t.runSync(t.parse(n),n),e)}function _A(e){const t=e.rehypePlugins||Hu,n=e.remarkPlugins||Hu,r=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...Vu}:Vu;return gA().use(r4).use(n).use(X4,r).use(t)}function SA(e){const t=e.children||"",n=new pg;return typeof t=="string"&&(n.value=t),n}function CA(e,t){const n=t.allowedElements,r=t.allowElement,o=t.components,s=t.disallowedElements,i=t.skipHtml,l=t.unwrapDisallowed,c=t.urlTransform||jA;for(const d of kA)Object.hasOwn(t,d.from)&&(""+d.from+(d.to?"use `"+d.to+"` instead":"remove it")+vA+d.id,void 0);return fg(e,u),ME(e,{Fragment:a.Fragment,components:o,ignoreInvalidStyle:!0,jsx:a.jsx,jsxs:a.jsxs,passKeys:!0,passNode:!0});function u(d,f,h){if(d.type==="raw"&&h&&typeof f=="number")return i?h.children.splice(f,1):h.children[f]={type:"text",value:d.value},f;if(d.type==="element"){let p;for(p in li)if(Object.hasOwn(li,p)&&Object.hasOwn(d.properties,p)){const y=d.properties[p],m=li[p];(m===null||m.includes(d.tagName))&&(d.properties[p]=c(String(y||""),p,d))}}if(d.type==="element"){let p=n?!n.includes(d.tagName):s?s.includes(d.tagName):!1;if(!p&&r&&typeof f=="number"&&(p=!r(d,f,h)),p&&h&&typeof f=="number")return l&&d.children?h.children.splice(f,1,...d.children):h.children.splice(f,1),f}}}function jA(e){const t=e.indexOf(":"),n=e.indexOf("?"),r=e.indexOf("#"),o=e.indexOf("/");return t===-1||o!==-1&&t>o||n!==-1&&t>n||r!==-1&&t>r||wA.test(e.slice(0,t))?e:""}function hg(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 Tr(e){return e!==null&&(Array.isArray(e)||typeof e=="object")}function mg(e){return Array.isArray(e)?e.map((t,n)=>[String(n),t]):typeof e=="object"&&e!==null?Object.entries(e):[]}const qu=120;function NA({text:e}){const[t,n]=x.useState(!1);return e.length>qu?a.jsxs("span",{className:"text-emerald-400 break-all",children:['"',t?a.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:a.jsx(Zu,{children:e})}):a.jsxs(Fe,{delayDuration:300,children:[a.jsxs($e,{onClick:o=>{o.stopPropagation(),n(!0)},className:"text-left cursor-pointer",children:[a.jsx("span",{children:e.slice(0,qu)}),a.jsx("span",{className:"text-emerald-400/50",children:"…"})]}),a.jsxs(Be,{side:"bottom",className:"max-w-md text-xs p-2 break-words whitespace-pre-wrap",children:[e.slice(0,500),e.length>500?"…":""]})]}),'"']}):a.jsxs("span",{className:"text-emerald-400 break-all",children:['"',a.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:a.jsx(Zu,{children:e})}),'"']})}function gg({value:e}){if(e===null)return a.jsx("span",{className:"text-rose-400 italic",children:"null"});switch(typeof e){case"string":return a.jsx(NA,{text:e});case"number":return a.jsx("span",{className:"text-amber-400",children:e});case"boolean":return a.jsx("span",{className:"text-blue-400",children:e?"true":"false"});case"object":case"bigint":case"symbol":case"undefined":case"function":return a.jsx("span",{className:"text-muted-foreground",children:JSON.stringify(e)})}}function Ku({value:e}){const[t,n]=x.useState(!1);function r(o){o.stopPropagation(),window.navigator.clipboard.writeText(JSON.stringify(e,null,2)).then(()=>{n(!0),setTimeout(()=>{n(!1)},2e3)})}return a.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?a.jsx(rt,{className:"size-3 text-green-500"}):a.jsx(_t,{className:"size-3"})})}function EA({value:e}){const[t,n]=x.useState(!1);function r(o){o.stopPropagation(),window.navigator.clipboard.writeText(JSON.stringify(e,null,2)).then(()=>{n(!0),setTimeout(()=>{n(!1)},2e3)})}return a.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?a.jsx(rt,{className:"size-3 text-green-500"}):a.jsx(_t,{className:"size-3 text-muted-foreground"})})}function TA({onClick:e}){return a.jsx("button",{type:"button",onClick:e,className:"opacity-0 group-hover/row:opacity-100 hover:bg-muted p-0.5 rounded transition-opacity shrink-0",title:"Expand all descendants",children:a.jsx(Ef,{className:"size-3.5 text-muted-foreground"})})}const AA=x.memo(function e({name:t,value:n,level:r,defaultExpandDepth:o,isArrayItem:s,path:i,expandTargetPath:l,anatomyPaths:c}){const u=x.useMemo(()=>l===null?!1:i===""?l.length>0:l===i||l.startsWith(`${i}/`),[l,i]),d=r<o||u&&Tr(n),[f,h]=x.useState(d);x.useEffect(()=>{u&&Tr(n)&&!f&&h(!0)},[l]);const[p,y]=x.useState(0),[m,g]=x.useState(null),b=Tr(n),v=m===Number.POSITIVE_INFINITY,k=x.useMemo(()=>mg(n),[n]),S=x.useMemo(()=>k.some(([,w])=>Tr(w)),[k]),C=hg(n),j=C==="array"?"[":"{",E=C==="array"?"]":"}",T=c!==null&&c.has(i);function z(){h(!0),g(Number.POSITIVE_INFINITY),y(w=>w+1)}function O(){h(!1),g(0),y(w=>w+1)}function B(){v?O():h(!f)}function N(w){w.stopPropagation(),z()}const D=m??o;return a.jsxs("div",{className:ve(r>0&&"border-l border-border/50 ml-2"),children:[a.jsxs("div",{className:ve("flex items-start gap-1 py-0.5 px-1 -ml-1 rounded-sm group/row",b&&"cursor-pointer hover:bg-muted/50"),"data-anatomy-path":T?i:void 0,onClick:b?B:void 0,onKeyDown:b?w=>{(w.key==="Enter"||w.key===" ")&&(w.preventDefault(),B())}:void 0,onDoubleClick:b&&S?()=>z():void 0,role:b?"button":void 0,tabIndex:b?0:void 0,children:[b?a.jsx("span",{className:"w-4 h-5 flex items-center justify-center shrink-0",children:f?a.jsx(Zt,{className:"size-3 text-muted-foreground"}):a.jsx(on,{className:"size-3 text-muted-foreground"})}):a.jsx("span",{className:"w-4 shrink-0"}),a.jsx("span",{className:ve("shrink-0",s?"text-muted-foreground":"text-cyan-400"),children:s?t:`"${t}"`}),a.jsx("span",{className:"text-muted-foreground shrink-0",children:b?"":":"}),b?a.jsxs("span",{className:"text-muted-foreground",children:[j,a.jsxs("span",{className:"text-muted-foreground/60 text-xs",children:[" ",k.length," ",k.length===1?"item":"items"," ",E]})]}):a.jsx("span",{className:"min-w-0",children:a.jsx(gg,{value:n})}),b&&S&&!v&&a.jsx(TA,{onClick:N}),a.jsx(EA,{value:n})]}),b&&f&&a.jsxs("div",{className:"pl-4",children:[k.map(([w,L])=>a.jsx(e,{name:w,value:L,level:r+1,defaultExpandDepth:D,isArrayItem:C==="array",path:i===""?`/${w}`:`${i}/${w}`,expandTargetPath:l,anatomyPaths:c},w)),a.jsx("div",{className:"text-muted-foreground py-0.5 px-1",children:E})]},p)]})});function Cl({data:e,defaultExpandDepth:t=0,className:n,showCopy:r=!1,bulkDepth:o,bulkRevision:s,anatomyPaths:i=null,expandToPath:l=null}){const c=Tr(e),u=x.useMemo(()=>mg(e),[e]),d=o??t,f=s??0;if(!c)return a.jsx(tt,{children:a.jsx("div",{className:ve("font-mono text-xs leading-relaxed",n),children:a.jsxs("div",{className:"flex items-center gap-1",children:[a.jsx(gg,{value:e}),r&&a.jsx(Ku,{value:e})]})})});const p=hg(e)==="array";return a.jsx(tt,{children:a.jsxs("div",{className:ve("font-mono text-xs leading-relaxed",n),children:[r&&a.jsx("div",{className:"mb-2 flex items-center justify-end gap-2",children:a.jsx(Ku,{value:e})}),a.jsx("div",{children:u.map(([y,m])=>a.jsx(AA,{name:y,value:m,level:0,defaultExpandDepth:d,isArrayItem:p,path:`/${y}`,expandTargetPath:l,anatomyPaths:i},y))},f)]})})}const IA=x.memo(function({text:t,defaultExpandDepth:n=0,className:r,bulkDepth:o,bulkRevision:s}){const i=x.useMemo(()=>km(t),[t]);return i.kind==="json"?a.jsx(Cl,{data:i.data,defaultExpandDepth:n,className:r,bulkDepth:o,bulkRevision:s}):a.jsx("pre",{className:ve("font-mono text-xs whitespace-pre-wrap break-words",r),children:t})}),xg=Object.freeze(Object.defineProperty({__proto__:null,JsonViewer:Cl,JsonViewerFromString:IA},Symbol.toStringTag,{value:"Module"}));function zA({className:e,children:t,...n}){return a.jsxs(hj,{"data-slot":"scroll-area",className:ve("relative overflow-hidden",e),...n,children:[a.jsx(mj,{"data-slot":"scroll-area-viewport",className:"focus-visible:ring-ring/50 size-full max-h-[inherit] rounded-[inherit] transition-[color,box-shadow] outline-none focus-visible:ring-[3px] focus-visible:outline-1",children:t}),a.jsx(RA,{}),a.jsx(gj,{})]})}function RA({className:e,orientation:t="vertical",...n}){return a.jsx(mh,{"data-slot":"scroll-area-scrollbar",orientation:t,className:ve("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:a.jsx(yh,{"data-slot":"scroll-area-thumb",className:"bg-border relative flex-1 rounded-full"})})}const bg={file:"file",shell:"shell",browser:"browser",web:"web",mcp:"MCP",code:"code",other:"other"},PA={file:"border-blue-400/20 bg-blue-400/5 text-blue-300",shell:"border-teal-400/20 bg-teal-400/5 text-teal-300",browser:"border-cyan-400/20 bg-cyan-400/5 text-cyan-300",web:"border-sky-400/20 bg-sky-400/5 text-sky-300",mcp:"border-violet-400/20 bg-violet-400/5 text-violet-300",code:"border-emerald-400/20 bg-emerald-400/5 text-emerald-300",other:"border-muted-foreground/20 bg-muted/30 text-muted-foreground"};function OA({category:e}){switch(e){case"file":return a.jsx(C2,{className:"size-3.5"});case"shell":return a.jsx(Rf,{className:"size-3.5"});case"browser":return a.jsx($2,{className:"size-3.5"});case"web":return a.jsx(If,{className:"size-3.5"});case"mcp":return a.jsx(Bv,{className:"size-3.5"});case"code":return a.jsx(l2,{className:"size-3.5"});case"other":return a.jsx(h2,{className:"size-3.5"})}}function MA({names:e}){return e.length===0?null:a.jsxs("div",{className:"flex min-w-0 flex-wrap items-center gap-1",children:[a.jsx("span",{className:"text-[10px] uppercase tracking-wide text-muted-foreground",children:"required"}),e.slice(0,4).map(t=>a.jsx(st,{variant:"outline",className:"h-5 max-w-36 truncate rounded-md px-1.5 py-0 font-mono text-[10px]",children:t},t)),e.length>4&&a.jsxs("span",{className:"font-mono text-[10px] text-muted-foreground",children:["+",e.length-4]})]})}function LA({tool:e,called:t}){const[n,r]=x.useState(!1),o=Xt(e.name),s=e.description!==null||e.requiredParameters.length>0||e.schema!==null;return a.jsx(iE,{open:n,onOpenChange:r,children:a.jsxs("div",{className:"rounded-md border border-border/60 bg-background/40",children:[a.jsxs("div",{className:"flex min-w-0 items-center gap-2 px-2.5 py-2",children:[a.jsxs("button",{type:"button",className:"flex min-w-0 flex-1 items-center gap-2 text-left focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",onClick:()=>r(i=>!i),"aria-expanded":n,disabled:!s,children:[a.jsx(OA,{category:e.category}),a.jsx("span",{className:"min-w-0 truncate font-mono text-xs font-semibold text-foreground/90",children:e.name}),t&&a.jsx(st,{variant:"outline",className:"h-5 rounded-md border-emerald-400/20 bg-emerald-400/5 px-1.5 py-0 text-[10px] text-emerald-300",children:"called"}),a.jsxs("span",{className:"font-mono text-[10px] text-muted-foreground",children:[e.parameterCount," params"]}),e.descriptionPreview!==null&&a.jsx("span",{className:"hidden min-w-0 truncate text-xs text-muted-foreground md:inline",children:e.descriptionPreview}),a.jsx("span",{className:"flex-1"}),s&&(n?a.jsx(Zt,{className:"size-3.5 shrink-0 text-muted-foreground"}):a.jsx(on,{className:"size-3.5 shrink-0 text-muted-foreground"}))]}),a.jsx("button",{type:"button",className:"inline-flex size-7 shrink-0 items-center justify-center rounded text-muted-foreground transition-colors hover:bg-muted hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",onClick:o.copy,"aria-label":o.copied?"Copied tool name":"Copy tool name",children:o.copied?a.jsx(rt,{className:"size-3.5 text-emerald-400"}):a.jsx(_t,{className:"size-3.5"})})]}),a.jsx(aE,{children:a.jsxs("div",{className:"space-y-2 border-t border-border/60 px-2.5 py-2",children:[e.description!==null&&a.jsx("p",{className:"text-xs leading-relaxed text-muted-foreground",children:e.description}),a.jsx(MA,{names:e.requiredParameters}),e.schema!==null&&a.jsx(zA,{className:"max-h-64 rounded-md border border-border/60 bg-muted/20 p-2",children:a.jsx(Cl,{data:Jo(e.schema),defaultExpandDepth:0})})]})})]})})}function DA(e,t){return t.length===0?!0:`${e.name} ${e.description??""} ${bg[e.category]}`.toLowerCase().trim().includes(t)}const FA=x.memo(function({summary:t,calledToolNames:n}){const[r,o]=x.useState(!1),[s,i]=x.useState(""),l=x.useMemo(()=>new Set(n),[n]),c=s.trim().toLowerCase(),u=x.useMemo(()=>t===null?[]:t.tools.filter(h=>DA(h,c)),[c,t]);if(t===null)return null;const d=t.tools.slice(0,6),f=t.tools.length-d.length;return a.jsxs("section",{className:"mb-3 rounded-lg border border-border/70 bg-muted/20",children:[a.jsxs("div",{className:"flex min-w-0 flex-wrap items-center gap-2 px-3 py-2",children:[a.jsxs("div",{className:"flex min-w-0 flex-1 items-center gap-2",children:[a.jsx(qr,{className:"size-4 shrink-0 text-sky-300/80"}),a.jsxs("div",{className:"min-w-0",children:[a.jsxs("div",{className:"flex min-w-0 flex-wrap items-center gap-1.5",children:[a.jsx("span",{className:"text-sm font-semibold text-foreground",children:"Request Tools"}),a.jsx(st,{variant:"outline",className:"h-5 rounded-md px-1.5 py-0 font-mono text-[10px]",children:t.tools.length}),t.toolChoiceLabel!==null&&a.jsxs(st,{variant:"outline",className:"h-5 rounded-md px-1.5 py-0 font-mono text-[10px] text-muted-foreground",children:["tool_choice: ",t.toolChoiceLabel]})]}),a.jsx("div",{className:"mt-1 flex min-w-0 flex-wrap gap-1",children:t.categories.map(h=>a.jsxs(st,{variant:"outline",className:ve("h-5 rounded-md px-1.5 py-0 font-mono text-[10px]",PA[h.category]),children:[h.count," ",bg[h.category]]},h.category))})]})]}),a.jsxs(Ae,{type:"button",variant:"ghost",size:"sm",className:"h-7 px-2",onClick:()=>o(h=>!h),"aria-expanded":r,children:[r?a.jsx(Zt,{className:"size-3.5"}):a.jsx(on,{className:"size-3.5"}),r?"Hide":"Show"]})]}),a.jsxs("div",{className:"flex min-w-0 flex-wrap gap-1.5 border-t border-border/60 px-3 py-2",children:[d.map(h=>a.jsx(st,{variant:"outline",className:ve("h-5 max-w-44 truncate rounded-md px-1.5 py-0 font-mono text-[10px]",l.has(h.name)&&"border-emerald-400/20 text-emerald-300"),children:h.name},h.name)),f>0&&a.jsxs("span",{className:"font-mono text-[10px] leading-5 text-muted-foreground",children:["+",f]})]}),r&&a.jsxs("div",{className:"space-y-2 border-t border-border/60 px-3 py-3",children:[a.jsxs("label",{className:"flex h-8 items-center gap-2 rounded-md border border-border/70 bg-background/50 px-2 text-xs",children:[a.jsx(rw,{className:"size-3.5 shrink-0 text-muted-foreground"}),a.jsx("input",{value:s,onChange:h=>i(h.target.value),placeholder:"Filter tools",className:"min-w-0 flex-1 bg-transparent font-mono text-xs outline-none placeholder:text-muted-foreground/70"})]}),a.jsx("div",{className:"grid gap-1.5",children:u.length>0?u.map(h=>a.jsx(LA,{tool:h,called:l.has(h.name)},h.name)):a.jsx("p",{className:"py-2 text-xs text-muted-foreground",children:"No matching tools"})})]})]})}),$A="/v1/chat/completions",BA="/chat/completions",UA="/v1/messages";class WA{handlers=new Map;pathMap=new Map;register(t){this.handlers.set(t.format,t)}registerPath(t,n){this.pathMap.set(t,n)}get(t){return this.handlers.get(t)}getByPath(t){const n=t.split("?")[0]??"",r=this.pathMap.get(n);return r===void 0?void 0:this.handlers.get(r)}detectFormat(t){if(t===null)return"unknown";for(const n of this.handlers.values())if(n.detectFormat(t))return n.format;return"unknown"}}const gr=new WA;function HA(e){return gr.getByPath(e)??null}function VA(e){return HA(e)?.format??"unknown"}gr.registerPath(UA,"anthropic");gr.registerPath($A,"openai");gr.registerPath(BA,"openai");function ZA(e){if(e==="")return{};try{const t=JSON.parse(e);return t!==null&&typeof t=="object"&&!Array.isArray(t)?{...t}:{}}catch{return{}}}function qA(e){switch(e.type){case"text":return{type:"text",text:e.text};case"thinking":{const t={type:"thinking",thinking:e.thinking};return e.signature!==""&&(t.signature=e.signature),t}case"think":{const t={type:"think",thinking:e.thinking};return e.signature!==""&&(t.signature=e.signature),t}case"tool_use":return{type:"tool_use",id:e.id,name:e.name,input:ZA(e.inputJson)}}}function yg(e,t,n,r){const o=new Map;let s="",i="",l=null,c=null,u=0,d=0;const f=1e3;let h=0,p=0;const y=[];for(const g of e.split(`
|
|
107
|
-
`)){const b=g.trim();if(b.startsWith("data: "))try{const v=JSON.parse(b.slice(6)),k=hv.safeParse(v);if(!k.success)continue;const S=k.data;switch(h===0&&(p=Date.now()),r===!0&&y.length<f&&y.push({index:h,timestamp:Date.now()-p,type:S.type,data:S}),h++,S.type){case"message_start":s=S.message.id,i=S.message.model,u=S.message.usage.input_tokens,t.inputTokens=u,t.cacheCreationInputTokens=S.message.usage.cache_creation_input_tokens??null,t.cacheReadInputTokens=S.message.usage.cache_read_input_tokens??null,t.model===null&&(t.model=i);break;case"content_block_start":{const C=S.content_block;switch(C.type){case"text":o.set(S.index,{type:"text",text:C.text??""});break;case"thinking":o.set(S.index,{type:"thinking",thinking:C.thinking??"",signature:C.signature??""});break;case"think":o.set(S.index,{type:"think",thinking:C.thinking??"",signature:C.signature??""});break;case"tool_use":o.set(S.index,{type:"tool_use",id:C.id,name:C.name,inputJson:""});break}break}case"content_block_delta":{const C=o.get(S.index);if(C===void 0)break;const j=S.delta;j.type==="text_delta"&&C.type==="text"?C.text+=j.text:j.type==="thinking_delta"&&(C.type==="thinking"||C.type==="think")?C.thinking+=j.thinking:j.type==="signature_delta"&&(C.type==="thinking"||C.type==="think")?C.signature+=j.signature:j.type==="input_json_delta"&&C.type==="tool_use"&&(C.inputJson+=j.partial_json);break}case"message_delta":l=S.delta.stop_reason,c=S.delta.stop_sequence??null,d=S.usage.output_tokens,t.outputTokens=d,S.usage.cache_creation_input_tokens!==void 0&&(t.cacheCreationInputTokens=S.usage.cache_creation_input_tokens),S.usage.cache_read_input_tokens!==void 0&&(t.cacheReadInputTokens=S.usage.cache_read_input_tokens);break;case"error":t.error=S.error.message;break;case"content_block_stop":case"message_stop":case"ping":break}}catch{}}r===!0&&(t.streamingChunks={chunks:y,truncated:h>f});const m=[...o.entries()].sort(([g],[b])=>g-b).map(([,g])=>qA(g));return JSON.stringify({id:s,type:"message",model:i!==""?i:n??"",role:"assistant",content:m,stop_reason:l,stop_sequence:c,usage:{input_tokens:u,output_tokens:d}})}const KA={format:"anthropic",parseRequest(e,t){try{const n=JSON.parse(e),r=xf.safeParse(n);return r.success?{model:r.data.model,sessionId:r.data.metadata?.user_id??t?.get("x-session-affinity")??null}:null}catch{return null}},extractTokens(e){try{const t=JSON.parse(e),n=bf.safeParse(t);if(n.success)return{inputTokens:n.data.usage.input_tokens??null,outputTokens:n.data.usage.output_tokens??null,cacheCreationInputTokens:n.data.usage.cache_creation_input_tokens??null,cacheReadInputTokens:n.data.usage.cache_read_input_tokens??null}}catch{}return{inputTokens:null,outputTokens:null,cacheCreationInputTokens:null,cacheReadInputTokens:null}},extractStream(e,t,n,r){return yg(e,t,n,r)},detectFormat(e){if(e===null)return!1;try{const t=JSON.parse(e);if(typeof t=="object"&&t!==null&&!Array.isArray(t)){const n=Object.keys(t);return n.includes("model")&&n.includes("messages")&&n.includes("system")}return!1}catch{return!1}}};gr.register(KA);class GA{providers=[];register(t){this.providers.push(t)}findProvider(t){let n=null;for(const r of this.providers)if(r.matches(t)){if(r.name!=="anthropic")return r;n=r}return n}getAll(){return[...this.providers]}}const Fs=new GA,JA="https://api.anthropic.com",YA={MiniMax:"https://api.minimaxi.com/anthropic"},XA={name:"anthropic",matches(e){const t=e.toLowerCase();if(t.startsWith("openai-"))return!1;if(t.includes("claude")||t.includes("anthropic"))return!0;for(const n of Object.keys(YA))if(t.startsWith(n.toLowerCase()))return!0;return!0},getUpstreamBase(e,t){return t?.baseUrl!==void 0?t.baseUrl:JA},extractStream(e,t,n,r){return yg(e,t,n,r)}};Fs.register(XA);function $s(e,t,n,r=!0){let o="",s="",i="",l="",c=null,u=0,d=0,f=!1,h=!1;const p=new Map,y=1e3;let m=0,g=0;const b=[];for(const k of e.split(`
|
|
108
|
-
`)){const S=k.trim();if(!S.startsWith("data: "))continue;const C=S.slice(6);if(C==="[DONE]")break;try{const j=JSON.parse(C);if(typeof j=="object"&&j!==null&&!Array.isArray(j)){const z=Object.getOwnPropertyDescriptor(j,"error");if(z!==void 0&&typeof z.value=="object"&&z.value!==null){const O=Object.getOwnPropertyDescriptor(z.value,"message");O!==void 0&&typeof O.value=="string"&&(t.error=O.value);continue}}const E=vv.safeParse(j);if(!E.success)continue;const T=E.data;if(m===0&&(g=Date.now()),r===!0&&b.length<y&&b.push({index:m,timestamp:Date.now()-g,type:"chat.completion.chunk",data:T}),m++,h||(o=T.id,s=T.model,h=!0),!f&&T.usage!==void 0&&T.usage!==null){if(u=T.usage.prompt_tokens??0,d=T.usage.completion_tokens??0,t.inputTokens=u,typeof j=="object"&&j!==null&&!Array.isArray(j)){const z=Object.getOwnPropertyDescriptor(j,"usage");if(z!==void 0&&typeof z.value=="object"&&z.value!==null){const O=Object.getOwnPropertyDescriptor(z.value,"prompt_tokens_details");if(O!==void 0&&typeof O.value=="object"&&O.value!==null){const B=Object.getOwnPropertyDescriptor(O.value,"cached_tokens");B!==void 0&&typeof B.value=="number"&&(t.cacheReadInputTokens=B.value)}}}f=!0}for(const z of T.choices){const O=z.delta;O.content!==void 0&&O.content!==null&&(i+=O.content),O.reasoning_content!==void 0&&O.reasoning_content!==null&&(l+=O.reasoning_content),O.thinking!==void 0&&O.thinking!==null&&(l+=O.thinking);const B=O.think;if(B!=null&&(l+=B),z.finish_reason!==void 0&&z.finish_reason!==null&&(c=z.finish_reason),O.tool_calls!==void 0&&O.tool_calls!==null)for(const N of O.tool_calls){let D=p.get(N.index);D===void 0&&(D={index:N.index,type:"function",function:{name:"",arguments:""}},p.set(N.index,D)),N.id!==void 0&&(D.id=N.id),N.function?.name!==void 0&&(D.function.name+=N.function.name),N.function?.arguments!==void 0&&(D.function.arguments+=N.function.arguments)}}}catch{}}r===!0&&(t.streamingChunks={chunks:b,truncated:m>y}),f||(d=Math.ceil(i.length/4)),t.outputTokens=d;const v={role:"assistant",content:i};return l&&(v.reasoning_content=l),p.size>0&&(v.tool_calls=[...p.values()]),JSON.stringify({id:o,object:"chat.completion",created:Math.floor(Date.now()/1e3),model:s!==""?s:n??"",choices:[{index:0,message:v,finish_reason:c}],usage:{prompt_tokens:u,completion_tokens:d,total_tokens:u+d}})}const QA={format:"openai",parseRequest(e,t){try{const n=JSON.parse(e),r=wf.safeParse(n);return r.success?{model:r.data.model,sessionId:t?.get("x-session-affinity")??null}:null}catch{return null}},extractTokens(e){const t=_f(e);if(t){let n=null;try{const r=JSON.parse(e);if(r!==null&&typeof r=="object"&&!Array.isArray(r)){const o=Object.getOwnPropertyDescriptor(r,"usage");if(o!==void 0&&typeof o.value=="object"&&o.value!==null){const s=Object.getOwnPropertyDescriptor(o.value,"prompt_tokens_details");if(s!==void 0&&typeof s.value=="object"&&s.value!==null){const i=Object.getOwnPropertyDescriptor(s.value,"cached_tokens");i!==void 0&&typeof i.value=="number"&&(n=i.value)}}}}catch{}return{inputTokens:t.usage.prompt_tokens??null,outputTokens:t.usage.completion_tokens??null,cacheCreationInputTokens:null,cacheReadInputTokens:n}}return{inputTokens:null,outputTokens:null,cacheCreationInputTokens:null,cacheReadInputTokens:null}},extractStream(e,t,n,r){return $s(e,t,n,r)},detectFormat(e){if(e===null)return!1;try{const t=JSON.parse(e);if(typeof t=="object"&&t!==null&&!Array.isArray(t)){const n=Object.keys(t);return n.includes("model")&&n.includes("messages")&&!n.includes("system")}return!1}catch{return!1}}};gr.register(QA);const eI="https://api.openai.com/v1",tI={name:"openai",matches(e){const t=e.toLowerCase();return!!(t.startsWith("openai-")||t.includes("gpt-")||t.includes("o1")||t.includes("o2")||t.includes("o3"))},getUpstreamBase(e,t){return t?.baseUrl!==void 0?t.baseUrl:eI},extractStream(e,t,n,r){return $s(e,t,n,r)}};Fs.register(tI);const nI="https://open.bigmodel.cn/api/paas/v4",rI=["glm-","charglm-","cogview-","embedding-","rerank-"],oI={name:"zhipu",matches(e){const t=e.toLowerCase().replace(/\s+/g,"-");return rI.some(n=>t.startsWith(n))},getUpstreamBase(e,t){return t?.baseUrl??nI},extractStream(e,t,n,r){return $s(e,t,n,r)}};Fs.register(oI);const sI="https://dashscope.aliyuncs.com/compatible-mode/v1",iI={name:"alibaba",matches(e){const t=e.toLowerCase().replace(/\s+/g,"-");return!!(t.startsWith("glm-5")||t.startsWith("qwen"))},getUpstreamBase(e,t){return sI},extractStream(e,t,n){return $s(e,t,n)}};Fs.register(iI);function vg(e,t){for(const n of Array.from(e))t(n)}const aI=/[\u3000-\u9FFF\uAC00-\uD7FF\uF900-\uFAFF\uFF00-\uFFEF\u{1F300}-\u{1FAFF}]/u;function jl(e){if(e.length===0)return 0;let t=0,n=0;return vg(e,r=>{aI.test(r)?t+=1:n+=1}),Math.ceil(t*1)+Math.ceil(n/4)}function Nl(e){if(e.length===0)return 0;let t=0;return vg(e,()=>{t+=1}),t}function Cn(e){return{parsed:null,comparisonValue:e,messageCount:null,toolCount:null}}const er={parsed:null,toolNames:null};function lI(e){if(typeof e=="string")return e;if(!Array.isArray(e))return"";const t=[];for(const n of e){if(n===null||typeof n!="object")continue;const r=n;switch(r.type){case"text":typeof r.text=="string"&&t.push(r.text);break;case"thinking":case"think":typeof r.thinking=="string"&&t.push(r.thinking);break;case"tool_use":{const s=typeof r.name=="string"?r.name:"",i=r.input!==void 0?JSON.stringify(r.input):"";t.push(`${s} ${i}`.trim());break}case"tool_result":{const s=r.content;if(typeof s=="string")t.push(s);else if(Array.isArray(s)){for(const i of s)if(i!==null&&typeof i=="object"){const l=i.text;typeof l=="string"&&t.push(l)}}break}case"image":t.push("[image]");break}}return t.join(`
|
|
109
|
-
`)}function cI(e){if(typeof e=="string")return e;if(!Array.isArray(e))return"";const t=[];for(const n of e)if(n!==null&&typeof n=="object"){const r=n.text;n.type==="text"&&typeof r=="string"&&t.push(r)}return t.join(`
|
|
110
|
-
`)}function uI(e){if(!Array.isArray(e))return"";const t=[];for(const n of e){if(n===null||typeof n!="object")continue;const r=n;typeof r.name=="string"&&t.push(r.name),typeof r.description=="string"&&t.push(r.description),r.input_schema!==void 0&&t.push(JSON.stringify(r.input_schema))}return t.join(`
|
|
111
|
-
`)}function yi(e,t,n,r){return{role:e,label:t,text:n,size:jl(n),characters:Nl(n),path:r}}const dI={format:"anthropic",analyzeRequest(e){if(e===null)return Cn(e);try{const t=xf.safeParse(JSON.parse(e));return t.success?{parsed:t.data,comparisonValue:t.data,messageCount:t.data.messages.length,toolCount:t.data.tools!==void 0&&t.data.tools.length>0?t.data.tools.length:null}:Cn(e)}catch{return Cn(e)}},analyzeResponse(e){if(e===null)return er;try{let t=JSON.parse(e);typeof t=="string"&&(t=JSON.parse(t));const n=bf.safeParse(t);if(!n.success)return er;const r=n.data.content.filter(o=>o.type==="tool_use").map(o=>o.name);return{parsed:n.data,toolNames:r.length>0?r:null}}catch{return er}},anatomySegments(e){if(e===null||typeof e!="object")return null;const t=e,n=[];if(t.system!==void 0){const r=cI(t.system);r.length>0&&n.push(yi("system","system",r,"/system"))}if(Array.isArray(t.messages)&&t.messages.forEach((r,o)=>{if(r===null||typeof r!="object")return;const s=r,i=s.role==="user"||s.role==="assistant"?s.role:"user",l=lI(s.content);n.push(yi(i,`[${o}] ${i}`,l,`/messages/${o}`))}),Array.isArray(t.tools)&&t.tools.length>0){const r=uI(t.tools);n.push(yi("tools","tools",r,"/tools"))}return n.length>0?n:null}};function fI(e){if(typeof e=="string")return e;if(!Array.isArray(e))return"";const t=[];for(const n of e){if(n===null||typeof n!="object")continue;const r=n,o=r.type;o==="text"&&typeof r.text=="string"?t.push(r.text):o==="image_url"&&t.push("[image]")}return t.join(`
|
|
112
|
-
`)}function pI(e){const t=[],n=fI(e.content);n.length>0&&t.push(n);const r=typeof e.reasoning_content=="string"?e.reasoning_content:typeof e.thinking=="string"?e.thinking:typeof e.think=="string"?e.think:"";r.length>0&&t.push(r);const o=e.tool_calls;if(Array.isArray(o))for(const s of o){if(s===null||typeof s!="object")continue;const i=s.function;if(i===void 0)continue;const l=typeof i.name=="string"?i.name:"",c=typeof i.arguments=="string"?i.arguments:"";t.push(`${l} ${c}`.trim())}return t.join(`
|
|
113
|
-
`)}function hI(e){if(!Array.isArray(e))return"";const t=[];for(const n of e){if(n===null||typeof n!="object")continue;const o=n.function;o!==void 0&&(typeof o.name=="string"&&t.push(o.name),typeof o.description=="string"&&t.push(o.description),o.parameters!==void 0&&t.push(JSON.stringify(o.parameters)))}return t.join(`
|
|
114
|
-
`)}function Gu(e,t,n,r){return{role:e,label:t,text:n,size:jl(n),characters:Nl(n),path:r}}const mI={format:"openai",analyzeRequest(e){if(e===null)return Cn(e);try{const t=wf.safeParse(JSON.parse(e));return t.success?{parsed:t.data,comparisonValue:t.data,messageCount:t.data.messages.length,toolCount:t.data.tools!==void 0&&t.data.tools.length>0?t.data.tools.length:null}:Cn(e)}catch{return Cn(e)}},analyzeResponse(e){if(e===null)return er;const t=_f(e);if(t===null)return er;const n=t.choices[0]?.message?.tool_calls?.map(r=>r.function?.name??"").filter(r=>r!=="")??[];return{parsed:t,toolNames:n.length>0?n:null}},anatomySegments(e){if(e===null||typeof e!="object")return null;const t=e,n=[];if(Array.isArray(t.messages)&&t.messages.forEach((r,o)=>{if(r===null||typeof r!="object")return;const s=r,i=s.role==="user"||s.role==="assistant"||s.role==="system"||s.role==="tool"?s.role:"user",l=pI(s);n.push(Gu(i,`[${o}] ${i}`,l,`/messages/${o}`))}),Array.isArray(t.tools)&&t.tools.length>0){const r=hI(t.tools);n.push(Gu("tools","tools",r,"/tools"))}return n.length>0?n:null}},gI={format:"unknown",analyzeRequest(e){return Cn(e)},analyzeResponse(){return er},anatomySegments(){return null}},xI={anthropic:dI,openai:mI,unknown:gI};function wg(e){return xI[e]}function Hr(e){const t=VA(e.path);return t==="unknown"?e.apiFormat:t}const nn="agent-inspector:focus-log";function fa(e){window.dispatchEvent(new CustomEvent(nn,{detail:e}))}function Bs(e){if(typeof CustomEvent>"u"||!(e instanceof CustomEvent))return null;const t=e.detail,n=Me(t,"logId");if(typeof n!="number"||!Number.isInteger(n)||n<0)return null;const r=Me(t,"tab");switch(r){case"anatomy":case"request":return{logId:n,tab:r};case void 0:return{logId:n,tab:"request"};default:return null}}function Ju(e,t,n){return e==="anthropic"&&t==="full"&&n}function bI(e,t){return e==="full"&&t}function yI(e,t,n,r){return e==="anthropic"&&t==="full"&&n&&r}const vI=["file","shell","browser","web","mcp","code","other"];function pa(e){const t=e.replace(/\s+/g," ").trim();return t.length<=120?t:`${t.slice(0,119)}...`}function kg(e){if(e===null)return null;const t=e.replace(/\s+/g," ").trim();if(t.length===0)return null;const n=t.search(/[.!?。!?]/);return n>=24?pa(t.slice(0,n+1)):pa(t)}function wI(e,t){return`${e} ${t??""}`.toLowerCase()}function Hn(e,t){return t.some(n=>e.includes(n))}function _g(e,t){const n=wI(e,t);return e.startsWith("mcp__")||e.startsWith("inspector_")||Hn(n,[" mcp","model context protocol"])?"mcp":Hn(n,["bash","shell","terminal","command","powershell","exec","process"])?"shell":Hn(n,["browser","playwright","screenshot","click","navigate","page","tab"])?"browser":Hn(n,["read","write","edit","file","glob","grep","patch","filesystem","directory"])?"file":Hn(n,["web","search","http","url","fetch"])?"web":Hn(n,["code","typescript","javascript","python","repl"])?"code":"other"}function Sg(e){const t=Me(e,"properties");return t===null||typeof t!="object"||Array.isArray(t)?[]:Object.keys(t).sort((n,r)=>n.localeCompare(r))}function Cg(e){const t=Me(e,"required");if(!Array.isArray(t))return[];const n=[];for(const r of t)typeof r=="string"&&r.length>0&&n.push(r);return n.sort((r,o)=>r.localeCompare(o))}function kI(e){const t=Me(e,"name");if(typeof t!="string"||t.length===0)return null;const n=Me(e,"description"),r=Me(e,"input_schema")??null,o=typeof n=="string"?n:null;return{name:t,description:o,descriptionPreview:kg(o),category:_g(t,o),parameterCount:Sg(r).length,requiredParameters:Cg(r),schema:r}}function _I(e){const t=Me(e,"function"),n=Me(t,"name");if(typeof n!="string"||n.length===0)return null;const r=Me(t,"description"),o=Me(t,"parameters")??null,s=typeof r=="string"?r:null;return{name:n,description:s,descriptionPreview:kg(s),category:_g(n,s),parameterCount:Sg(o).length,requiredParameters:Cg(o),schema:o}}function SI(e){const t=_I(e);return t!==null?t:kI(e)}function CI(e){if(e==null)return null;if(typeof e=="string")return e;const t=Me(e,"type"),n=Me(e,"name"),r=Me(Me(e,"function"),"name");if(typeof t=="string"&&typeof r=="string"&&r.length>0)return`${t}: ${r}`;if(typeof t=="string"&&typeof n=="string"&&n.length>0)return`${t}: ${n}`;if(typeof t=="string")return t;const o=JSON.stringify(e);return o===void 0?null:pa(o)}function jI(e){const t=new Map;for(const n of e)t.set(n.category,(t.get(n.category)??0)+1);return vI.flatMap(n=>{const r=t.get(n)??0;return r>0?[{category:n,count:r}]:[]})}function NI(e){const t=Me(e,"tools");if(!Array.isArray(t)||t.length===0)return null;const n=[];for(const r of t){const o=SI(r);o!==null&&n.push(o)}return n.length===0?null:{tools:n,toolChoiceLabel:CI(Me(e,"tool_choice")),categories:jI(n)}}function Vn(){return a.jsx("div",{className:"h-1","aria-hidden":"true"})}function EI(e,t){switch(e){case"anatomy":return t===null?"request":"anatomy";case"request":return"request"}}function TI({active:e,onClick:t}){return a.jsxs(Fe,{children:[a.jsx($e,{asChild:!0,children:a.jsxs(Ae,{variant:e?"default":"outline",size:"sm",className:"h-8 text-xs",onClick:t,"aria-pressed":e,children:[a.jsx(E2,{className:"size-3.5 mr-1"}),e?"Showing diff":"Diff with Raw"]})}),a.jsx(Be,{children:e?"Hide diff view":"Compare proxy output against the original raw version"})]})}const AI=x.memo(function({rawBody:e,displayedBody:t,emptyLabel:n}){const r=x.useMemo(()=>zN(e,t),[e,t]);return a.jsx(zm,{result:r,emptyLabel:n})}),II=x.memo(function({rawHeaders:e,headers:t,emptyLabel:n}){const r=x.useMemo(()=>IN(e,t),[e,t]);return a.jsx(zm,{result:r,emptyLabel:n})}),zI=x.memo(function({log:e,viewMode:t="simple",strip:n,slowResponseThresholdSeconds:r,timeDisplayFormat:o,cacheTrend:s=null,onCompareWithPrevious:i}){const[l,c]=x.useState(!1),[u,d]=x.useState(!1),[f,h]=x.useState(!1),[p,y]=x.useState(!1),[m,g]=x.useState("request"),[b,v]=x.useState(null),k=x.useRef(null),S=Hr(e),C=wg(S),j=x.useMemo(()=>C.analyzeRequest(e.rawRequestBody),[C,e.rawRequestBody]),E=x.useMemo(()=>C.analyzeResponse(e.responseText),[C,e.responseText]),z=x.useMemo(()=>!n||S!=="anthropic"||e.rawRequestBody===null?null:hN(e.rawRequestBody).body,[e.rawRequestBody,S,n])??e.rawRequestBody,O=oi(z),B=oi(e.rawRequestBody),N=oi(e.responseText),D=x.useMemo(()=>e.headers&&Object.keys(e.headers).length>0?JSON.stringify(e.headers,null,2):null,[e.headers]),w=x.useMemo(()=>e.rawHeaders&&Object.keys(e.rawHeaders).length>0?JSON.stringify(e.rawHeaders,null,2):null,[e.rawHeaders]),L=Xt(z),W=Xt(e.rawRequestBody),U=Xt(D),F=Xt(w),K=Xt(e.responseText),I=x.useMemo(()=>({request:{copyLabel:"Copy request body",copyText:z,copyCopied:L.copied,onCopy:L.copy,expansion:{isExpanded:O.isExpanded,isPending:O.isPending,onToggle:O.toggle},diffWithRaw:yI(S,t,n,e.rawRequestBody!==null)?{active:p,onToggle:()=>y(!p)}:void 0,diffWithPrevious:i===void 0?void 0:()=>{i(e)}},"raw-request":{copyLabel:"Copy raw request",copyText:e.rawRequestBody,copyCopied:W.copied,onCopy:W.copy,expansion:{isExpanded:B.isExpanded,isPending:B.isPending,onToggle:B.toggle}},headers:{copyLabel:"Copy headers",copyText:D,copyCopied:U.copied,onCopy:U.copy,expansion:null},"raw-headers":{copyLabel:"Copy raw headers",copyText:w,copyCopied:F.copied,onCopy:F.copy,expansion:null},raw:{copyLabel:"Copy response",copyText:e.responseText,copyCopied:K.copied,onCopy:K.copy,expansion:{isExpanded:N.isExpanded,isPending:N.isPending,onToggle:N.toggle}}}),[z,L,O,p,e.rawRequestBody,W,B,D,U,w,F,e.responseText,K,N,S,t,n,i]),V=x.useMemo(()=>O.parsedData!==null?C.anatomySegments(O.parsedData):null,[C,O.parsedData]),G=x.useMemo(()=>NI(O.parsedData),[O.parsedData]),R=x.useMemo(()=>{if(V!==null)return new Set(V.map(oe=>oe.path))},[V]),ae=CN({containerRef:k,setExpandToPath:v,ensureTabActive:()=>{m!=="request"&&g("request")}});return x.useEffect(()=>{l&&g(V!==null?"anatomy":"request")},[V,l]),x.useEffect(()=>{const oe=fe=>{const le=Bs(fe);le!==null&&le.logId===e.id&&(c(!0),g(EI(le.tab,V)))};return window.addEventListener(nn,oe),()=>{window.removeEventListener(nn,oe)}},[V,e.id]),a.jsxs(tt,{children:[a.jsxs("div",{className:"border border-border rounded-lg mb-1 overflow-hidden",children:[a.jsx(sE,{log:e,messageCount:j.messageCount,toolCount:j.toolCount,expanded:l,onToggle:()=>c(!l),cacheTrend:s,slowResponseThresholdSeconds:r,timeDisplayFormat:o,activeTab:m,tabActions:I,onReplay:i===void 0?void 0:()=>{d(!0)}}),l&&a.jsx("div",{onClick:oe=>oe.stopPropagation(),onKeyDown:oe=>oe.stopPropagation(),children:a.jsxs(_m,{value:m,onValueChange:g,children:[a.jsxs(Sm,{className:"mx-4 mt-2",children:[t==="full"&&a.jsx(Tt,{value:"raw-headers",children:"Raw Headers"}),t==="full"&&a.jsx(Tt,{value:"headers",children:"Headers"}),V!==null&&a.jsx(Tt,{value:"anatomy",children:"Context"}),Ju(S,t,n)&&a.jsx(Tt,{value:"raw-request",children:"Raw Request"}),a.jsx(Tt,{value:"request",children:"Request"}),t==="full"&&a.jsx(Tt,{value:"raw",children:"Raw Response"}),a.jsx(Tt,{value:"parsed",children:"Response"})]}),Ju(S,t,n)&&a.jsx(At,{value:"raw-request",children:m==="raw-request"&&a.jsx("div",{className:"px-4 pt-1 pb-3",children:e.rawRequestBody===null?a.jsx("p",{className:"text-xs text-muted-foreground italic",children:"No request body"}):B.parsedData!==null?a.jsx(x.Suspense,{fallback:a.jsx(Vn,{}),children:a.jsx(Xc,{data:B.parsedData,bulkDepth:B.bulkDepth,bulkRevision:B.bulkRevision})}):a.jsx("pre",{className:"font-mono text-xs whitespace-pre-wrap break-words",children:e.rawRequestBody})})}),a.jsx(At,{value:"request",children:m==="request"&&a.jsxs("div",{className:"px-4 pt-1 pb-3",children:[a.jsx(FA,{summary:G,calledToolNames:E.toolNames??[]}),p?a.jsx(AI,{rawBody:e.rawRequestBody,displayedBody:z,emptyLabel:"No transformation applied; raw and sent request bodies are identical."}):a.jsx("div",{ref:k,children:z===null?a.jsx("p",{className:"text-xs text-muted-foreground italic",children:"No request body"}):O.parsedData!==null?a.jsx(x.Suspense,{fallback:a.jsx(Vn,{}),children:a.jsx(Xc,{data:O.parsedData,bulkDepth:O.bulkDepth,bulkRevision:O.bulkRevision,anatomyPaths:R,expandToPath:b})}):a.jsx("pre",{className:"font-mono text-xs whitespace-pre-wrap break-words",children:z})})]})}),V!==null&&a.jsx(At,{value:"anatomy",children:m==="anatomy"&&a.jsx(x.Suspense,{fallback:a.jsx(Vn,{}),children:a.jsx(yN,{parsed:O.parsedData,inputTokens:e.inputTokens??null,model:e.model,segments:V,onSegmentActivate:ae})})}),t==="full"&&a.jsx(At,{value:"headers",children:m==="headers"&&a.jsxs("div",{className:"px-4 pt-1 pb-3",children:[a.jsx("div",{className:"flex justify-end gap-2 mb-2",children:bI(t,e.rawHeaders!==void 0&&Object.keys(e.rawHeaders).length>0)&&a.jsx(TI,{active:f,onClick:oe=>{oe.stopPropagation(),h(!f)}})}),f?a.jsx(II,{rawHeaders:e.rawHeaders,headers:e.headers,emptyLabel:"No transformation applied; raw and processed headers are identical."}):e.headers&&Object.keys(e.headers).length>0?a.jsx("div",{className:"space-y-1 font-mono text-xs",children:Object.entries(e.headers).sort(([oe],[fe])=>oe.localeCompare(fe)).map(([oe,fe])=>a.jsxs("div",{className:"flex gap-2",children:[a.jsxs("span",{className:"text-blue-600 dark:text-blue-400 font-semibold shrink-0",children:[oe,":"]}),a.jsx("span",{className:"text-muted-foreground truncate",title:fe,children:fe})]},oe))}):a.jsx("p",{className:"text-xs text-muted-foreground italic",children:"No headers captured"})]})}),t==="full"&&a.jsx(At,{value:"raw-headers",children:m==="raw-headers"&&a.jsx("div",{className:"px-4 pt-1 pb-3",children:e.rawHeaders&&Object.keys(e.rawHeaders).length>0?a.jsx("div",{className:"space-y-1 font-mono text-xs",children:Object.entries(e.rawHeaders).sort(([oe],[fe])=>oe.localeCompare(fe)).map(([oe,fe])=>a.jsxs("div",{className:"flex gap-2",children:[a.jsxs("span",{className:"text-blue-600 dark:text-blue-400 font-semibold shrink-0",children:[oe,":"]}),a.jsx("span",{className:"text-muted-foreground truncate",title:fe,children:fe})]},oe))}):a.jsx("p",{className:"text-xs text-muted-foreground italic",children:"No raw headers captured"})})}),a.jsx(At,{value:"raw",children:m==="raw"&&a.jsxs("div",{className:"px-4 pt-1 pb-3 space-y-3",children:[e.error!==void 0&&e.error!==null&&a.jsxs("div",{className:"rounded border border-destructive/50 bg-destructive/10 p-3 text-xs",children:[a.jsx("div",{className:"font-semibold text-destructive mb-1",children:"SSE Error"}),a.jsx("div",{className:"text-muted-foreground font-mono",children:e.error})]}),e.responseText!==null?a.jsx(x.Suspense,{fallback:a.jsx(Vn,{}),children:a.jsx(kN,{text:e.responseText,defaultExpandDepth:0,bulkDepth:N.bulkDepth,bulkRevision:N.bulkRevision})}):a.jsx("p",{className:"text-xs text-muted-foreground italic",children:"No response"}),e.streaming===!0&&a.jsx(x.Suspense,{fallback:a.jsx(Vn,{}),children:a.jsx(wN,{logId:e.id,truncated:e.streamingChunksPath!==null})})]})}),a.jsx(At,{value:"parsed",children:m==="parsed"&&a.jsx("div",{className:"px-4 pt-1 pb-3",children:a.jsx(x.Suspense,{fallback:a.jsx(Vn,{}),children:a.jsx(vN,{responseText:e.responseText,responseStatus:e.responseStatus,streaming:e.streaming,inputTokens:e.inputTokens,outputTokens:e.outputTokens,cacheCreationInputTokens:e.cacheCreationInputTokens,cacheReadInputTokens:e.cacheReadInputTokens,apiFormat:S,error:e.error})})})})]})})]}),a.jsx(x.Suspense,{fallback:null,children:a.jsx(bN,{log:e,open:u,onOpenChange:d})})]})});function RI({stopReason:e,isPending:t,isFirst:n,isTurnStart:r,isOnlyEntry:o=!1,crabIndex:s=0,collapsible:i=!1,onToggle:l}){const c=e==="end_turn"||e==="stop",u=o&&r&&c,d=t&&!c,f=x.useMemo(()=>Go(s),[s]),h=x.useMemo(()=>K5(s),[s]),p=i&&l?{role:"button",tabIndex:0,className:"cursor-pointer",onClick:y=>{y.stopPropagation(),l()},onKeyDown:y=>{(y.key==="Enter"||y.key===" ")&&(y.preventDefault(),l())}}:{};return a.jsxs("div",{className:"flex flex-col items-center w-6 shrink-0 pt-0.5 pb-0.5",children:[a.jsx("div",{className:"flex justify-center h-[calc(0.75rem-8px)]",children:!n&&a.jsx("div",{className:"w-0.5 bg-muted-foreground/30 h-full"})}),u?a.jsx("span",{title:"Start and end of turn",children:a.jsx(h,{className:ve("size-3.5 text-[#80FF00]","animate-crab-settle","drop-shadow-[0_0_4px_rgba(128,255,0,0.5)]")})}):c?a.jsx("span",{title:e==="end_turn"?"End of Turn (Anthropic)":"End of Turn (OpenAI)",...p,children:a.jsx(f,{className:ve("size-3.5 text-amber-400","animate-crab-settle","drop-shadow-[0_0_4px_rgba(251,191,36,0.5)]")})}):r?a.jsx("span",{title:"Start of turn",...p,children:a.jsx(f,{className:ve("size-3.5 text-emerald-400","animate-crab-appear","drop-shadow-[0_0_4px_rgba(52,211,153,0.5)]")})}):d?a.jsx("span",{title:"Processing…",children:a.jsx(f,{className:ve("size-3.5 text-amber-300/80","animate-crab-crawl")})}):a.jsx("span",{children:a.jsx(f,{className:"size-3.5 text-muted-foreground/40"})}),a.jsx("div",{className:"flex-1 flex justify-center min-h-0",children:!c&&a.jsx("div",{className:ve("w-0.5 h-full",t?"border-dashed bg-transparent border-l-2 border-muted-foreground/20":"bg-muted-foreground/30")})})]})}function PI({event:e}){const t=Xt(e.argumentsText),n=e.argumentsText!==null;return a.jsxs("div",{className:"group/tool-trace flex min-w-0 items-center gap-2 rounded-md border border-border/70 bg-muted/20 px-2.5 py-1.5 text-xs",children:[a.jsx(qr,{className:"size-3.5 shrink-0 text-sky-400/70"}),a.jsx("span",{className:"font-mono font-semibold text-foreground/80",children:e.name}),e.argumentsPreview!==null&&a.jsxs(a.Fragment,{children:[a.jsx(on,{className:"size-3 shrink-0 text-muted-foreground/60"}),a.jsx("span",{className:"min-w-0 truncate font-mono text-muted-foreground",children:e.argumentsPreview})]}),n&&a.jsx("button",{type:"button",className:"ml-auto inline-flex size-6 shrink-0 items-center justify-center rounded text-muted-foreground opacity-0 transition-opacity hover:bg-background/80 hover:text-foreground focus-visible:opacity-100 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring group-hover/tool-trace:opacity-100 group-focus-within/tool-trace:opacity-100",onClick:t.copy,"aria-label":t.copied?"Copied tool arguments":"Copy tool arguments",title:t.copied?"Copied tool arguments":"Copy tool arguments",children:t.copied?a.jsx(rt,{className:"size-3.5"}):a.jsx(_t,{className:"size-3.5"})})]},e.id)}function OI({events:e}){return e.length===0?null:a.jsx("div",{className:"mx-3 mb-2 grid gap-1.5",children:e.map(t=>a.jsx(PI,{event:t},t.id))})}const Yu=180;function MI(e,t){return e||t}function LI(e,t,n){return e>1&&t&&!n}function DI(e){const t=[];let n=[],r=0;for(const o of e){n.push({log:o,stopReason:O5(o)});const s=n[n.length-1];s!==void 0&&xm(s.stopReason)&&(t.push({entries:n,turnIndex:r}),n=[],r+=1)}return n.length>0&&t.push({entries:n,turnIndex:r}),t}function FI(e){const t=new Map;for(const n of e)for(let r=1;r<n.logs.length;r+=1){const o=n.logs[r],s=n.logs[r-1];if(o===void 0||s===void 0)continue;const i=Hr(o),l=Hr(s);i==="unknown"||i!==l||t.set(o.id,s)}return t}function jg(e){if(e===null)return null;try{const t=JSON.parse(e);return typeof t=="string"?JSON.parse(t):t}catch{return null}}function Ng(e){if(e==null)return null;const t=typeof e=="string"?e:JSON.stringify(e);if(t===void 0)return null;const n=t.replace(/\s+/g," ").trim();return n.length===0?null:n.length>Yu?`${n.slice(0,Yu-1)}...`:n}function Eg(e){if(e==null)return null;if(typeof e=="string")return e.length>0?e:null;const t=JSON.stringify(e,null,2);return t===void 0||t.length===0?null:t}function $I(e){const t=jg(e.responseText),n=Me(t,"content");if(!Array.isArray(n))return[];const r=[];for(const o of n){if(Me(o,"type")!=="tool_use")continue;const i=Me(o,"name");if(typeof i!="string"||i.length===0)continue;const l=Me(o,"input");r.push({id:`${String(e.id)}-anthropic-tool-${String(r.length)}`,logId:e.id,index:r.length,provider:"anthropic",name:i,argumentsText:Eg(l),argumentsPreview:Ng(l)})}return r}function BI(e){const t=jg(e.responseText),n=Me(t,"choices");if(!Array.isArray(n))return[];const r=[];for(const o of n){const s=Me(o,"message"),i=Me(s,"tool_calls");if(Array.isArray(i))for(const l of i){const c=Me(l,"function"),u=Me(c,"name");if(typeof u!="string"||u.length===0)continue;const d=Me(c,"arguments");r.push({id:`${String(e.id)}-openai-tool-${String(r.length)}`,logId:e.id,index:r.length,provider:"openai",name:u,argumentsText:Eg(d),argumentsPreview:Ng(d)})}}return r}function El(e){switch(Hr(e)){case"anthropic":return $I(e);case"openai":return BI(e);case"unknown":return[]}}function UI(e,t,n=0){let r=0,o=0,s=0,i=0,l=0,c=0,u=0,d=0,f=null,h=0;for(const p of e)p.responseStatus===null?o+=1:p.responseStatus>=400&&(r+=1),p.elapsedMs!==null&&t>0&&p.elapsedMs>t*1e3&&(s+=1),p.inputTokens!==null&&(i+=p.inputTokens),p.outputTokens!==null&&(l+=p.outputTokens),p.cacheCreationInputTokens!==null&&(c+=p.cacheCreationInputTokens),p.cacheReadInputTokens!==null&&(u+=p.cacheReadInputTokens),p.elapsedMs!==null&&(d+=p.elapsedMs,f=f===null?p.elapsedMs:Math.max(f,p.elapsedMs)),h+=El(p).length;return{llmCallCount:e.length,toolCallCount:h,failedCallCount:r,pendingCallCount:o,slowCallCount:s,totalInputTokens:i,totalOutputTokens:l,totalCacheCreationInputTokens:c,totalCacheReadInputTokens:u,totalElapsedMs:d,maxElapsedMs:f,startedAt:e[0]?.timestamp??null,endedAt:e[e.length-1]?.timestamp??null,knowledgeCandidateCount:n}}function vi(e){return e<1e3?`${e}ms`:`${(e/1e3).toFixed(1)}s`}const WI=x.memo(function({entries:t,viewMode:n,strip:r,slowResponseThresholdSeconds:o,cacheTrends:s,onCompareWithPrevious:i,comparisonPredecessors:l,turnIndex:c=0,timeDisplayFormat:u}){const d=t.length-1,f=t[d]?.stopReason??null,h=f!==null?xm(f):!1,p=t[d]?.log.responseStatus===null,y=t.length===1,m=LI(t.length,h,p),[g,b]=x.useState(!1),v=x.useRef(!1);x.useEffect(()=>{m?h&&!v.current&&b(!0):b(!1),v.current=h},[m,h]),x.useEffect(()=>{const W=U=>{const F=Bs(U);F!==null&&t.some(K=>K.log.id===F.logId)&&m&&b(!1)};return window.addEventListener(nn,W),()=>{window.removeEventListener(nn,W)}},[m,t]);const k=x.useCallback(()=>{m&&b(W=>!W)},[m]),S=x.useMemo(()=>{let W=0,U=0,F=null,K=!1;for(const I of t)I.log.inputTokens!==null&&(W+=I.log.inputTokens,K=!0),I.log.outputTokens!==null&&(U+=I.log.outputTokens,K=!0),I.log.elapsedMs!==null&&(F=F===null?I.log.elapsedMs:Math.max(F,I.log.elapsedMs));return{totalInput:W,totalOutput:U,hasTokens:K,maxElapsed:F}},[t,d]),C=x.useMemo(()=>{const W=new Set;for(const U of t){const F=vm(U.log.model);F!=="unknown"&&W.add(F)}return[...W]},[t]),j=x.useMemo(()=>Go(t[0]?.log.id??0),[t]),E=x.useMemo(()=>Go(t[d]?.log.id??0),[t,d]),T=c%2===0?"bg-muted/10":"bg-muted/25",z=S.maxElapsed!==null&&o>0&&S.maxElapsed>o*1e3,O=x.useMemo(()=>{const W=new Map;for(const U of t){const F=El(U.log);F.length>0&&W.set(U.log.id,F)}return W},[t]),[B,N]=x.useState(0),D=x.useRef(null);x.useEffect(()=>{const W=D.current;if(!W)return;let U=0;const F=new ResizeObserver(()=>{window.cancelAnimationFrame(U),U=window.requestAnimationFrame(()=>N(K=>K+1))});return F.observe(W),()=>{F.disconnect(),window.cancelAnimationFrame(U)}},[]);const w=t[0]?.log.id??c,L=`Turn ${String(c+1)}`;return a.jsx("div",{ref:D,tabIndex:g?void 0:0,role:g?void 0:"group","aria-label":g?void 0:L,"data-nav-id":g?void 0:`turn-${String(w)}`,className:ve("border rounded-lg",p?"border-amber-500/10":"border-transparent",!g&&"focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1 focus-visible:outline-none"),children:g?a.jsxs("div",{"data-nav-id":`turn-collapsed-${String(w)}`,"data-nav-action":"expand",role:"button",tabIndex:0,className:"flex items-stretch cursor-pointer focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1 focus-visible:outline-none rounded-lg",onClick:k,onKeyDown:W=>{(W.key==="Enter"||W.key===" ")&&(W.preventDefault(),k())},children:[a.jsx("div",{className:"w-5 shrink-0 flex items-start pt-1.5",children:a.jsx("span",{className:"text-[10px] text-muted-foreground/50 font-mono tabular-nums leading-none select-none",children:c+1})}),a.jsxs("div",{className:"w-6 shrink-0 flex flex-col items-center pt-0.5 pb-0.5",children:[a.jsx("div",{className:"flex justify-center h-[calc(0.75rem-8px)]"}),a.jsx("span",{role:"button",tabIndex:0,title:"Start of turn — click to expand",className:"cursor-pointer",onClick:W=>{W.stopPropagation(),k()},onKeyDown:W=>{(W.key==="Enter"||W.key===" ")&&(W.preventDefault(),k())},children:a.jsx(j,{className:ve("size-3.5 text-emerald-400","animate-crab-appear drop-shadow-[0_0_4px_rgba(52,211,153,0.5)]")})}),a.jsx("div",{className:"flex-1 flex justify-center min-h-0",children:a.jsx("div",{className:"w-0.5 bg-muted-foreground/30 h-full"})}),a.jsx("span",{role:"button",tabIndex:0,title:"End of Turn — click to expand",className:"cursor-pointer",onClick:W=>{W.stopPropagation(),k()},onKeyDown:W=>{(W.key==="Enter"||W.key===" ")&&(W.preventDefault(),k())},children:a.jsx(E,{className:ve("size-3.5 text-amber-400","animate-crab-settle drop-shadow-[0_0_4px_rgba(251,191,36,0.5)]")})})]}),t.length>1&&a.jsxs("div",{className:ve("flex-1 min-w-0 mb-0.5 rounded-lg border border-border py-1 px-3 flex items-center gap-3 text-xs",T),children:[a.jsxs("span",{className:"text-blue-400/80 font-mono font-semibold tabular-nums shrink-0",children:["#",t[0]?.log.id??"?"," ~ #",t[d]?.log.id??"?"]}),a.jsxs("span",{className:"text-muted-foreground shrink-0",children:[t.length," request",t.length>1?"s":""]}),C.length>0&&a.jsx("span",{className:"flex items-center gap-0.5 shrink-0",children:C.map(W=>a.jsx(wm,{provider:W,className:"size-4"},W))}),S.maxElapsed!==null&&a.jsx(tt,{children:a.jsxs(Fe,{children:[a.jsx($e,{asChild:!0,children:a.jsxs("span",{className:ve("flex items-center gap-1 shrink-0",z?"text-amber-400":"text-muted-foreground"),children:[a.jsx(hn,{className:"size-3"}),a.jsx("span",{className:"font-mono tabular-nums",children:vi(S.maxElapsed)}),z&&a.jsx(Lo,{className:"size-3","aria-label":"Slow response"})]})}),a.jsx(Be,{children:z?`Slow response: ${vi(S.maxElapsed)} exceeds ${vi(o*1e3)}`:"Slowest request in this turn"})]})}),S.hasTokens&&a.jsxs("span",{className:"flex items-center gap-1 shrink-0",children:[a.jsx(Dr,{className:"size-3 text-muted-foreground"}),a.jsxs("span",{className:"font-mono tabular-nums",children:[a.jsxs("span",{className:"text-blue-400",children:["IN ",Ve(S.totalInput)]})," / ",a.jsxs("span",{className:"text-amber-400",children:["OUT ",Ve(S.totalOutput)]})]})]}),a.jsx("span",{className:"flex-1 min-w-0"}),a.jsx(on,{className:"size-4 text-muted-foreground shrink-0"})]})]}):t.map((W,U)=>{const{log:F,stopReason:K}=W,I=U===0;return a.jsxs("div",{className:"flex items-stretch",children:[I?a.jsx("div",{className:"w-5 shrink-0 flex items-start pt-1.5",children:a.jsx("span",{className:"text-[10px] text-muted-foreground/50 font-mono tabular-nums leading-none select-none",children:c+1})}):a.jsx("div",{className:"w-5 shrink-0"}),a.jsx(RI,{stopReason:K,isPending:F.responseStatus===null,isFirst:U===0,isTurnStart:I,isOnlyEntry:y,crabIndex:F.id%12,collapsible:m&&I,onToggle:k}),a.jsxs("div",{className:ve("flex-1 min-w-0 mb-0.5 rounded-lg",T),children:[a.jsx(zI,{log:F,viewMode:n,strip:r,slowResponseThresholdSeconds:o,timeDisplayFormat:u,cacheTrend:s?.get(F.id)??null,onCompareWithPrevious:l.has(F.id)?i:void 0}),a.jsx(OI,{events:O.get(F.id)??[]})]})]},F.id)})})}),Tl=Re(["episode","procedure","preference","project-fact"]),HI=Re(["draft","promoted","failed"]),Tg=te({source:je("agent-inspector"),sessionId:A(),logIds:we(ie().int().positive()),project:A().nullable(),models:we(A())}),VI=te({redacted:Ze(),patterns:we(A())}),Qr=te({id:A(),type:Tl,title:A(),content:A(),tags:we(A()),source:je("agent-inspector"),sessionId:A(),logIds:we(ie().int().positive()),evidence:Tg,status:HI,createdAt:A(),updatedAt:A(),openClawMemoryId:A().nullable(),error:A().nullable(),redaction:VI});te({idempotencyKey:A(),type:Tl,title:A(),content:A(),tags:we(A()),source:je("agent-inspector"),project:A().nullable(),evidence:Tg});const ZI=te({id:A(),type:Tl.or(A()),title:A(),content:A(),score:ie().nullable(),source:A().nullable(),project:A().nullable(),evidence:Ti().optional()});te({results:we(ZI),warning:A().nullable()});const qI=te({candidates:we(Qr)}),KI=te({candidate:Qr}),GI=te({error:A().optional(),candidate:Qr.optional()}),JI=te({candidate:Qr}),YI={draft:"border-amber-500/30 bg-amber-500/10 text-amber-500",promoted:"border-emerald-500/30 bg-emerald-500/10 text-emerald-500",failed:"border-destructive/30 bg-destructive/10 text-destructive"};function ha(e){return e===null?"-":e<1e3?`${String(e)}ms`:`${(e/1e3).toFixed(1)}s`}function XI(e,t,n){return e===null||t===null?null:Da(e,t,n)}function QI(e){return`${String(e)} candidate${e===1?"":"s"}`}function Ag(e){return`log-${String(e)}`}function Ig(e){const t=Ag(e),n=document.getElementById(t);window.history.replaceState(null,"",`#${t}`),n instanceof HTMLElement&&(n.scrollIntoView({block:"center",behavior:"smooth"}),n.focus({preventScroll:!0}))}function ez(e){for(const t of e)if(t.responseStatus!==null&&t.responseStatus>=400)return t;return null}function tz(e){let t=null,n=-1;for(const r of e)r.elapsedMs!==null&&r.elapsedMs>n&&(t=r,n=r.elapsedMs);return t}function nz(e){for(const t of e)if(El(t).length>0)return t;return null}function rz(e){const t=[{kind:"session",title:`${String(e.summary.llmCallCount)} LLM call${e.summary.llmCallCount===1?"":"s"}`,detail:`Scope ${e.scopeId}`,logId:e.logs[0]?.id??null}],n=nz(e.logs);e.summary.toolCallCount>0&&n!==null&&t.push({kind:"tool",title:`${String(e.summary.toolCallCount)} tool call${e.summary.toolCallCount===1?"":"s"}`,detail:`First tool evidence at #${String(n.id)}`,logId:n.id});const r=ez(e.logs);r!==null&&t.push({kind:"failure",title:`Failure #${String(r.responseStatus)}`,detail:`First failed request is #${String(r.id)}`,logId:r.id});const o=tz(e.logs);if(o!==null&&e.summary.maxElapsedMs!==null&&t.push({kind:"slow",title:`Slowest ${ha(e.summary.maxElapsedMs)}`,detail:`Max latency observed at #${String(o.id)}`,logId:o.id}),e.candidates.length>0){const s=e.candidates.filter(l=>l.status==="draft").length,i=e.candidates.filter(l=>l.status==="promoted").length;t.push({kind:"candidate",title:`${String(e.candidates.length)} memory candidate${e.candidates.length===1?"":"s"}`,detail:`${String(s)} draft / ${String(i)} promoted`,logId:e.candidates[0]?.logIds[0]??null})}return t}function oz(e){switch(e){case"session":return a.jsx(fs,{className:"size-3.5 text-blue-400"});case"tool":return a.jsx(qr,{className:"size-3.5 text-sky-400/70"});case"slow":return a.jsx(hn,{className:"size-3.5 text-amber-400"});case"failure":return a.jsx(Tf,{className:"size-3.5 text-destructive"});case"candidate":return a.jsx(Nf,{className:"size-3.5 text-emerald-400"})}}function sz({insights:e}){return e.length===0?null:a.jsx("div",{className:"mt-2 grid gap-1.5 border-t border-border/70 pt-2 md:grid-cols-2 xl:grid-cols-3",children:e.map(t=>a.jsxs("button",{type:"button",className:ve("flex min-w-0 items-center gap-2 rounded-md px-2 py-1.5 text-left text-xs","text-muted-foreground transition-colors hover:bg-muted/40 hover:text-foreground","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring"),onClick:()=>{t.logId!==null&&Ig(t.logId)},disabled:t.logId===null,children:[oz(t.kind),a.jsxs("span",{className:"min-w-0",children:[a.jsx("span",{className:"block truncate font-medium text-foreground/90",children:t.title}),a.jsx("span",{className:"block truncate font-mono text-[10px]",children:t.detail})]})]},`${t.kind}-${t.title}`))})}function iz(e){switch(e){case"draft":return"Draft";case"promoted":return"Promoted";case"failed":return"Failed"}}function az(e,t){if(t)return"Promoting";switch(e.status){case"draft":return"Promote";case"failed":return"Retry";case"promoted":return"Promoted"}}function lz(e){return e.redaction.redacted?`Redacted ${e.redaction.patterns.join(", ")}`:"No sensitive pattern matched"}function cz(e,t){const n=e.replace(/\s+/g," ").trim();return n.length<=t?n:`${n.slice(0,t-3)}...`}function uz(e){const t=e[0],n=e[e.length-1];return t===void 0?"No evidence logs":n===void 0||t===n?`#${String(t)}`:`#${String(t)}-#${String(n)}`}function Xu(e){return e.join(", ")}function dz(e){return e.split(",").map(t=>t.trim()).filter(t=>t.length>0)}function fz({candidate:e,isPromoting:t,isUpdating:n,onPromoteCandidate:r,onUpdateCandidate:o}){const[s,i]=x.useState(!1),[l,c]=x.useState(e.type),[u,d]=x.useState(e.title),[f,h]=x.useState(e.content),[p,y]=x.useState(Xu(e.tags)),[m,g]=x.useState(null),b=e.status!=="promoted",v=e.status!=="promoted",k=x.useCallback(()=>{c(e.type),d(e.title),h(e.content),y(Xu(e.tags)),g(null)},[e.content,e.tags,e.title,e.type]),S=x.useCallback(async()=>{const C=u.trim(),j=f.trim(),E=dz(p);if(C.length===0){g("Title is required.");return}if(j.length===0){g("Content is required.");return}if(E.length===0){g("At least one tag is required.");return}g(null),await o(e.id,{type:l,title:C,content:j,tags:E})&&i(!1)},[e.id,f,p,u,l,o]);return s?a.jsx("div",{className:"rounded-md border border-border/80 bg-background/60 px-2.5 py-2",children:a.jsxs("div",{className:"grid gap-2",children:[a.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[a.jsxs("select",{value:l,disabled:n,onChange:C=>{const j=Qr.shape.type.safeParse(C.currentTarget.value);j.success&&c(j.data)},className:"h-7 rounded-md border border-input bg-background px-2 text-xs","aria-label":"Candidate type",children:[a.jsx("option",{value:"episode",children:"episode"}),a.jsx("option",{value:"procedure",children:"procedure"}),a.jsx("option",{value:"preference",children:"preference"}),a.jsx("option",{value:"project-fact",children:"project-fact"})]}),a.jsx("input",{value:u,disabled:n,onChange:C=>d(C.currentTarget.value),className:"h-7 min-w-[220px] flex-1 rounded-md border border-input bg-background px-2 text-xs","aria-label":"Candidate title"})]}),a.jsx("textarea",{value:f,disabled:n,onChange:C=>h(C.currentTarget.value),className:"min-h-28 rounded-md border border-input bg-background px-2 py-1.5 font-mono text-[11px] leading-relaxed","aria-label":"Candidate content"}),a.jsx("input",{value:p,disabled:n,onChange:C=>y(C.currentTarget.value),className:"h-7 rounded-md border border-input bg-background px-2 text-xs","aria-label":"Candidate tags"}),a.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[a.jsxs("span",{className:"inline-flex items-center gap-1 text-[10px] text-muted-foreground",children:[a.jsx(hc,{className:"size-3"}),"Saving reruns Inspector redaction before promotion."]}),a.jsx("span",{className:"flex-1"}),m!==null&&a.jsx("span",{className:"text-[10px] text-destructive",children:m}),a.jsxs(Ae,{type:"button",variant:"ghost",size:"sm",className:"h-7 gap-1.5 px-2 text-xs",disabled:n,onClick:()=>{k(),i(!1)},children:[a.jsx(La,{className:"size-3.5"}),"Cancel"]}),a.jsxs(Ae,{type:"button",variant:"outline",size:"sm",className:"h-7 gap-1.5 px-2 text-xs",disabled:n,onClick:()=>{S()},children:[n?a.jsx(Pi,{className:"size-3.5 animate-spin"}):a.jsx(Q2,{className:"size-3.5"}),"Save"]})]})]})}):a.jsxs("div",{className:"rounded-md border border-border/80 bg-background/60 px-2.5 py-2",children:[a.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[a.jsx(st,{variant:"outline",className:"h-5 px-1.5 text-[10px] font-mono",children:e.type}),a.jsx("span",{className:"min-w-0 flex-1 truncate text-xs font-medium",title:e.title,children:e.title}),a.jsx(st,{variant:"outline",className:ve("h-5 shrink-0 px-1.5 text-[10px] font-mono",YI[e.status]),children:iz(e.status)})]}),a.jsx("p",{className:"mt-1 text-[11px] leading-relaxed text-muted-foreground",title:e.content,children:cz(e.content,360)}),a.jsxs("div",{className:"mt-2 flex flex-wrap items-center gap-x-3 gap-y-1 text-[10px] text-muted-foreground",children:[a.jsxs("span",{className:"inline-flex items-center gap-1",children:[a.jsx(w2,{className:"size-3"}),uz(e.logIds)]}),a.jsxs("span",{className:"inline-flex items-center gap-1",children:[a.jsx(hc,{className:"size-3"}),lz(e)]}),e.status==="promoted"&&a.jsxs("span",{className:"inline-flex items-center gap-1 text-emerald-500",children:[a.jsx(dc,{className:"size-3"}),e.openClawMemoryId??"OpenClaw"]}),e.status==="failed"&&e.error!==null&&a.jsxs("span",{className:"inline-flex items-center gap-1 text-destructive",children:[a.jsx(Tf,{className:"size-3"}),e.error]})]}),a.jsxs("div",{className:"mt-1 flex flex-wrap items-center gap-1.5",children:[e.logIds.map(C=>a.jsxs("a",{href:`#${Ag(C)}`,onClick:j=>{j.preventDefault(),Ig(C)},className:"rounded border border-blue-400/25 px-1.5 py-0.5 font-mono text-[10px] text-blue-400 underline-offset-2 transition-colors hover:bg-blue-400/10 hover:text-blue-300 hover:underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring","aria-label":`Jump to evidence log ${String(C)}`,children:["#",C]},C)),a.jsx("span",{className:"flex-1"}),v&&a.jsxs(Ae,{type:"button",variant:"ghost",size:"sm",className:"h-6 gap-1.5 px-2 text-[10px]",disabled:n||t,onClick:()=>i(!0),children:[a.jsx(zf,{className:"size-3"}),"Review"]}),a.jsxs(Ae,{type:"button",variant:b?"outline":"ghost",size:"sm",className:"h-6 gap-1.5 px-2 text-[10px]",onClick:()=>r(e.id),disabled:!b||t||n,children:[t?a.jsx(Pi,{className:"size-3 animate-spin"}):b?a.jsx(i2,{className:"size-3"}):a.jsx(dc,{className:"size-3"}),az(e,t)]})]})]})}function pz({candidates:e,promotingCandidateIds:t,updatingCandidateIds:n,onPromoteCandidate:r,onUpdateCandidate:o}){return e.length===0?null:a.jsx("div",{className:"mt-2 grid gap-1.5",children:e.map(s=>a.jsx(fz,{candidate:s,isPromoting:t.has(s.id),isUpdating:n.has(s.id),onPromoteCandidate:r,onUpdateCandidate:o},s.id))})}function hz({logs:e,scopeId:t,slowResponseThresholdSeconds:n,showRollupMetrics:r,timeDisplayFormat:o}){const[s,i]=x.useState([]),[l,c]=x.useState(!0),[u,d]=x.useState({status:"idle",error:null}),[f,h]=x.useState(()=>new Set),[p,y]=x.useState(()=>new Set),m=s.length>0,g=x.useMemo(()=>UI(e,n,s.length),[s.length,e,n]),b=x.useMemo(()=>rz({logs:e,scopeId:t,summary:g,candidates:s}),[s,e,t,g]),v=r||g.maxElapsedMs!==null,k=x.useMemo(()=>XI(g.startedAt,g.endedAt,o),[g.endedAt,g.startedAt,o]),S=x.useCallback(()=>{e.length===0||u.status==="loading"||(d({status:"loading",error:null}),(async()=>{try{const E=await fetch(`/api/knowledge/sessions/${encodeURIComponent(t)}/candidates`,{method:"POST"});if(!E.ok){const z=await Qt(E,`Candidate generation failed with ${String(E.status)}`);d({status:"failed",error:z});return}const T=await It(E,qI);i(T.candidates),c(T.candidates.length>0),d(T.candidates.length>0?{status:"ready",error:null}:{status:"failed",error:"No candidate was generated for this trace scope."})}catch(E){d({status:"failed",error:E instanceof Error?E.message:"Candidate response was invalid"})}})())},[u.status,e.length,t]),C=x.useCallback(E=>{h(T=>{if(T.has(E))return T;const z=new Set(T);return z.add(E),z}),(async()=>{try{const T=await fetch(`/api/knowledge/candidates/${encodeURIComponent(E)}/promote`,{method:"POST"}),z=await T.json().catch(()=>null),O=KI.safeParse(z);if(T.ok&&O.success){i(N=>N.map(D=>D.id===O.data.candidate.id?O.data.candidate:D)),d({status:"ready",error:null});return}const B=GI.safeParse(z);B.success&&B.data.candidate!==void 0&&i(N=>N.map(D=>D.id===B.data.candidate?.id?B.data.candidate:D)),d({status:"failed",error:B.success?B.data.error??"Candidate promotion failed":`Candidate promotion failed with ${String(T.status)}`})}catch(T){d({status:"failed",error:T instanceof Error?T.message:"Candidate promotion failed"})}finally{h(T=>{const z=new Set(T);return z.delete(E),z})}})()},[]),j=x.useCallback(async(E,T)=>{y(z=>{if(z.has(E))return z;const O=new Set(z);return O.add(E),O});try{const z=await fetch(`/api/knowledge/candidates/${encodeURIComponent(E)}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify(T)});if(!z.ok){const B=await Qt(z,`Candidate update failed with ${String(z.status)}`);return d({status:"failed",error:B}),!1}const O=await It(z,JI);return i(B=>B.map(N=>N.id===O.candidate.id?O.candidate:N)),d({status:"ready",error:null}),!0}catch(z){return d({status:"failed",error:z instanceof Error?z.message:"Candidate update failed"}),!1}finally{y(z=>{const O=new Set(z);return O.delete(E),O})}},[]);return e.length===0?null:a.jsxs("section",{className:"mb-2 rounded-lg border border-border bg-muted/10 px-3 py-2",children:[a.jsxs("div",{className:"flex flex-wrap items-center gap-x-3 gap-y-2 text-xs",children:[r&&a.jsxs("span",{className:"inline-flex items-center gap-1.5 font-semibold text-foreground",children:[a.jsx(fs,{className:"size-3.5 text-blue-400"}),g.llmCallCount," LLM"]}),a.jsxs("span",{className:"inline-flex items-center gap-1.5 text-muted-foreground",children:[a.jsx(qr,{className:"size-3.5 text-sky-400/70"}),g.toolCallCount," tools"]}),r&&a.jsxs("span",{className:"inline-flex items-center gap-1.5 text-muted-foreground",children:[a.jsx(Dr,{className:"size-3.5 text-emerald-400"}),a.jsxs("span",{className:"font-mono",children:[Ve(g.totalInputTokens)," / ",Ve(g.totalOutputTokens)]})]}),(g.totalCacheCreationInputTokens>0||g.totalCacheReadInputTokens>0)&&a.jsxs("span",{className:"inline-flex items-center gap-1.5 text-muted-foreground",children:[a.jsx(Dr,{className:"size-3.5 text-purple-400"}),a.jsxs("span",{className:"font-mono",children:["KV Cache +",Ve(g.totalCacheCreationInputTokens)," / ~",Ve(g.totalCacheReadInputTokens)]})]}),v&&a.jsxs("span",{className:"inline-flex items-center gap-1.5 text-muted-foreground",children:[a.jsx(hn,{className:"size-3.5"}),r&&a.jsx("span",{className:"font-mono",children:ha(g.totalElapsedMs)}),g.maxElapsedMs!==null&&a.jsxs("span",{className:"font-mono text-muted-foreground/70",children:["max ",ha(g.maxElapsedMs)]})]}),r&&k!==null&&a.jsx("span",{className:"font-mono text-muted-foreground/70",children:k}),(g.failedCallCount>0||g.pendingCallCount>0||g.slowCallCount>0)&&a.jsxs("span",{className:"inline-flex items-center gap-1.5 text-amber-400",children:[a.jsx(Lo,{className:"size-3.5"}),a.jsxs("span",{className:"font-mono",children:[g.failedCallCount," fail / ",g.pendingCallCount," pending /"," ",g.slowCallCount," slow"]})]}),a.jsx("span",{className:"flex-1"}),m&&a.jsx(st,{variant:"outline",className:"h-6 px-2 text-[10px] font-mono",children:QI(g.knowledgeCandidateCount)}),a.jsxs(Ae,{type:"button",variant:"outline",size:"sm",className:"h-7 gap-1.5 px-2 text-xs",onClick:S,disabled:u.status==="loading",children:[u.status==="loading"?a.jsx(Wt,{className:"size-3.5 animate-spin"}):a.jsx(Nf,{className:"size-3.5"}),"Candidate"]}),m&&a.jsx(Ae,{type:"button",variant:"ghost",size:"icon",className:"size-7 text-muted-foreground",onClick:()=>c(E=>!E),"aria-expanded":l,"aria-label":l?"Collapse memory candidates":"Expand memory candidates",children:l?a.jsx(Zt,{className:"size-3.5"}):a.jsx(on,{className:"size-3.5"})})]}),u.status==="failed"&&a.jsx("p",{className:"mt-2 text-xs text-destructive",children:u.error}),a.jsx(sz,{insights:b}),l&&a.jsx(pz,{candidates:s,promotingCandidateIds:f,updatingCandidateIds:p,onPromoteCandidate:C,onUpdateCandidate:j})]})}function mz(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}}const zg=x.memo(function({group:e,viewMode:t="simple",strip:n,slowResponseThresholdSeconds:r,cacheTrends:o,onCompareWithPrevious:s,comparisonPredecessors:i,onClearGroup:l,standalone:c=!1,hasPinnedSessionContext:u=!1,timeDisplayFormat:d,expanded:f,onExpandedChange:h}){const[p,y]=x.useState(!1),m=f??p,g=x.useCallback(T=>{if(h!==void 0){h(T);return}y(T)},[h]),b=x.useMemo(()=>mz(e.logs),[e.logs]),v=e.logs[0]?.timestamp??new Date().toISOString(),k=e.logs[e.logs.length-1]?.timestamp??new Date().toISOString(),S=z5(e.logs),C=e.logs.some(T=>T.responseStatus===null),j=c&&!u,E=x.useMemo(()=>DI(e.logs),[e.logs]);return x.useEffect(()=>{const T=z=>{if(c)return;const O=Bs(z);O!==null&&e.logs.some(B=>B.id===O.logId)&&g(!0)};return window.addEventListener(nn,T),()=>{window.removeEventListener(nn,T)}},[e.logs,g,c]),a.jsxs("div",{className:"mb-2",children:[!c&&a.jsx(A5,{conversationId:e.conversationId,startTime:v,endTime:k,totalCalls:e.logs.length,totalInputTokens:b.totalInputTokens,totalOutputTokens:b.totalOutputTokens,apiFormat:I5(e.logs),expanded:m,onToggle:()=>g(!m),hideApiFormat:S,isLoading:C,userAgent:e.logs[0]?.userAgent??null,timeDisplayFormat:d,onClear:()=>l(e.logs.map(T=>T.id))}),MI(c,m)&&a.jsxs("div",{children:[a.jsx(hz,{logs:e.logs,scopeId:e.conversationId,slowResponseThresholdSeconds:r,showRollupMetrics:j,timeDisplayFormat:d}),E.map(T=>a.jsx(WI,{entries:T.entries,viewMode:t,strip:n,slowResponseThresholdSeconds:r,timeDisplayFormat:d,cacheTrends:o,onCompareWithPrevious:s,comparisonPredecessors:i,turnIndex:T.turnIndex},T.turnIndex))]})]})});function gz({className:e}){return a.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",className:ve("inline-block size-5",e),children:[a.jsx("path",{d:"M5 13 C5 9 8 7 12 7 C16 7 19 9 19 13 C19 16 16 18 12 18 C8 18 5 16 5 13 Z"}),a.jsx("path",{d:"M5 11 C3.5 9.5 1.5 10 2 12.5 C2.5 14 4 13.5 5 12.5"}),a.jsx("path",{d:"M19 11 C20.5 9.5 22.5 10 22 12.5 C21.5 14 20 13.5 19 12.5"}),a.jsx("line",{x1:"10",y1:"7",x2:"9.5",y2:"5"}),a.jsx("line",{x1:"14",y1:"7",x2:"14.5",y2:"5"}),a.jsx("circle",{cx:"9.5",cy:"4.5",r:"0.9",fill:"currentColor",stroke:"none"}),a.jsx("circle",{cx:"14.5",cy:"4.5",r:"0.9",fill:"currentColor",stroke:"none"}),a.jsx("line",{x1:"6.5",y1:"16",x2:"4.5",y2:"19.5"}),a.jsx("line",{x1:"9",y1:"17.5",x2:"8",y2:"20.5"}),a.jsx("line",{x1:"15",y1:"17.5",x2:"16",y2:"20.5"}),a.jsx("line",{x1:"17.5",y1:"16",x2:"19.5",y2:"19.5"}),a.jsxs("g",{children:[a.jsx("path",{d:"M5.6 17.7 L8.4 15.4 L10.8 18 C9.1 18.9 7.2 18.8 5.6 17.7 Z",fill:"#2f6b3f",stroke:"none",opacity:"0.95"}),a.jsx("path",{d:"M6.9 17.5 L8.4 16 L9.8 17.7 C8.9 18.1 7.8 18.1 6.9 17.5 Z",fill:"#6fb36f",stroke:"none",opacity:"0.95"}),a.jsx("path",{d:"M8.4 16 L8.4 18.4",stroke:"#d6b45f",strokeWidth:"0.34"}),a.jsx("circle",{cx:"10.6",cy:"17.75",r:"0.36",fill:"#c2412d",stroke:"none"})]}),a.jsxs("g",{children:[a.jsx("path",{d:"M8 16.5 L11.9 13.6 L15.8 16.8 C13.3 18.4 10.4 18.3 8 16.5 Z",fill:"#2f6b3f",stroke:"none",opacity:"0.97"}),a.jsx("path",{d:"M9.8 16.3 L11.9 14.4 L14.3 16.5 C12.8 17.4 11.3 17.4 9.8 16.3 Z",fill:"#6fb36f",stroke:"none",opacity:"0.95"}),a.jsx("path",{d:"M11.9 14.3 L11.9 17.8",stroke:"#d6b45f",strokeWidth:"0.42"}),a.jsx("path",{d:"M9.8 16.3 C11.2 15.8 12.9 15.9 14.3 16.5",stroke:"#9fca78",strokeWidth:"0.36"}),a.jsx("circle",{cx:"15.6",cy:"16.75",r:"0.43",fill:"#c2412d",stroke:"none"})]}),a.jsxs("g",{children:[a.jsx("path",{d:"M13.6 18.1 L16.2 15.7 L18.5 18.2 C17.1 19.1 15.2 19 13.6 18.1 Z",fill:"#2f6b3f",stroke:"none",opacity:"0.95"}),a.jsx("path",{d:"M14.8 17.9 L16.2 16.3 L17.5 18 C16.6 18.4 15.7 18.4 14.8 17.9 Z",fill:"#6fb36f",stroke:"none",opacity:"0.95"}),a.jsx("path",{d:"M16.2 16.3 L16.2 18.6",stroke:"#d6b45f",strokeWidth:"0.34"}),a.jsx("circle",{cx:"18.35",cy:"18.15",r:"0.36",fill:"#c2412d",stroke:"none"})]})]})}const xz="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAPoAAAD6CAQAAAAi5ZK2AAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAAAmJLR0QA/4ePzL8AAAAHdElNRQfpCxsJDCnsge2KAAAM2ElEQVR42u2de3AW1RnGnyQQDARDwiUFpHIVMHIpYgFRB2nLxQrC0FIDiCKDWNqBUqBlai8wvciIpaRTWh3QDqCDIIjKDL0IaBC5SKlysWJArgqh3BMICYFs/wgpGUi+8579dr89e/Z5zp/59j2755fn3d2z5wJQFEVRFEVRoVQSm+AG1UFrtEdT1EcjNEA5SlCMIhxDAQoJ3S4lIwf9cD+6ozXq1vKbYuzHNmxEPo6xwcKtungIS3EajkYpwLPoyqYLp3KwACe1cFcvezATmWzEMOk+rMBV18CrSjHy0IqNGQb1wMa4cV8vZfgzGrNRTVYm8nDFQ+SV5QymIIWNa6ZGaz6y6ZR/I4cNbJrSkOcb8MpyCVPYzCapKz71GXllWY5b2dhm6EGcTwhyBw52oyUbPHgNx6WEIXfg4CDuYKMHq0kevI/rlhP4Ghs+OE1ERcKRO3BwEh3Z+NFC7sDBATQngMRrcoDIHTj4iE/yUXJ5VVlhYsMkWezy+a6urgRbsAP7cRincQGpqI+maI+O6IMuSHYRbwIW0X/mJvZTeAH9ah1CATTCaKxBmWbUi7iTOMxEXoCncIsodgvM1ezo2cFPMebdy89qfyHL0vxSN5FQzHL5ajRxVU8v7NO4cWQRjCnIy/DDOOq6FcvENS0gGjMS+wUMjvvdZ5awrsv4KvEE7/Iz+Lontc4Q1vc8AQXt8rO4x7Oa54hqLOLI2aBdfrenHVyviWqdQUx2uLxS6fhMUO8ugrLD5VXqLfpmfxdh2eHyKi0S1P5b4rLF5ZVqiiJl/Z8SmD0ur9TzgnNoQWi2uLxSt+Gy8ixGEpvZLs9AN3RGqsYRa5Xn8SeCM9XlDfFT7Ll2bDnWYYRwOMZjyjP5kOjMdPkDOHpTjPX4iuDILOWL2znCMxH5IyitMc4+ZAuO3q08nyYEaFpiHxbjYWyDIMm/qDyje4kwPMgdOBihjDBNeU7fJcQwIXewTnBzUJ3Vk8Rozr18mOAtuxT1FFH6KmNMJkhTkH+7lse3G0s7RZyuygjPEGVYEntV6aSIlKOM8CvCDEtirywVyFDE6q2M8WPiDJPLJcMgBiljPEWg4XG5AwfTlfEmKWPkEml4XO7gCBooI85TRvlm8I1ax3CX68w8PYeB2KGFfEWM6Yo3qgy5uKj8VU/lLz5HG2QjHRlIA1CCIhTjBI6ggg43LbGXYYggZj3lgkYVtbwaluITvIlf4gHhNEomdheJXfpeXoX8EVHUAR4sY1CKfEyN5gibMCIHXvJsBYur2IDxSCNy05HXx1mPFy/5L2ZFZb6rGR2uusiByb6sWlOMZ5FOl5vocqAuDvm2XNExjLV5t52wuhyY7vM6Ve+jA11uksuB5glYcLgIY+hyc1yeJBj87E35q6BXkC5PAHJgdgKXI9xlzzt8eF0OjE/wypQH7Li7h9nl4wJYjPQ4utPlwSF/LKD1Z8+gC10eLeQOHHyJ1nR54pGPCniVadmcGyK3xOVVZYvWnNpqb5hBIv+L1hCJAdiuhXyVcpT6dV3GSLylhXyxy7YrxHYU4CBO4yKABmiCNuiIe9DMVbT5mMp7eWJc/rgLl1dgC6bE2NelM6Zim4uoDzOxm5nYS/GicNOuznhJc0X5k2HprIkS8gos1cTSSrgYodFbhkQ5sR/F/a7aqD8Oa9TSny43x+UblDNialcmVovr2WP2qOYoIV8V57tREuaK6/o+E7sJid2bO+00Ya0HTPV6lFy+3LNWmymsMZfIg+1w9fZ5ep6ozp3mjaKjy90rGetF9d5H5Ha4vFLZOB62zYGIPH6NEk2NqEvk4U/s1V/f8gX1DyJye5ADQC/BGfyRyO1I7Nf1rvIcPiZye1xeqaGCua6ZNiMf7sOSAolD3h+v4otrH2RewYPCo1JxWnkmQ4jcROTZNcyGWSMcN7PQ5KUJw4zc33t5G+xHzfu3S7655wqmPRG5ccgPxxjkqN7DvbnyfDYRuVmJvY1iYMQEQYxCxRkVEnlYXF5ZdguibFLEKI/6S9pQg1x+Ow4IYrZSxlmqjJFGl4fF5dLVJBcoYzQl8jDcy3XestV7tbcl8vC43IGD3spo6gEVtxF5mJCXCu7H6u6ZRlFE/nAoE7sDB8sEEd9URqkTfuT2P7FXlSuiZQb2KKKU0OXhcbmDGYKYdZWrTO8l8nDcyx04mCeKqh5IsYaJPRyJ3cEfhHFnePTPQ+ShQQ68r4z1NJEHkdj9Q95KcN7didwmlwOzBC2dTOT2uByoj5PBPcbR5UEgly0tPo3I7XE5kI1zgoVOWhO5PS4HXhHE/IDI7XE5MFIU9QdEbo/LO6NIEPWS98Mn/F04pD+R16oWOCiK+4LXyMf4irwnin1ErrtWzGtGIW+MXcJvdB4v/H87LvqIvL1yWG90XZ6J7UHNpVvoI/KGKPDxS5q/Lm/ry5e06i7/SBi5HHd5izxVI/nqIpcM6aXL1WW+1z7v6SPyJ0I7RMJvl+sgP+H9uLihviFvp5FDmNhrL096/34+2Jf3cgBYw8TuAfI3/OiHu8MXl+tsMM97ee3lKBr7AT1JuVuwG+Sp2EvkcSMvR1+/PqbO9Bw5MIn38rgTu69rP6fFeJd2hzwFn/OJPU6XO5gNX5VTy6iNk66QA4+KLqoCY5nYay0L4bs6YedN1e5EJ5fRdogu60dM7DE+/SZk+lIqxmMzrl5br2wzxrvbCA5Ad9FlraTLay2vJ3YV2DS0Rds4VzuYI7isQ1q9TNG6l79uzsK/8ldAyffhYRoRwz0qJgLIgT6CC/uHMcjpck/0c8Gl9aHLbUIO/FN5aflEbhfyOoJBfrlEbhNyydf5C0jnvdwm5MAY5eWtInK7kAOzlRc4mYndLuTAq8pL7KGMMTzUXTGGdrj6qc2KS7yq7O27E1fYxx4ufaK4yCOK41M0ofg7dYHIRVIh2xr3gyBdbpxUW8+8ozh+PV0ePqkmSK1RJPdLhrj890Qu1ynFxa6PeXRTQ76X871cS6rPqh/GPDrLiJc0ulxTqgVtj8U8OglneS8Pn9RrHjaMefwbvJeHT4vj/JY+iMjDJ/UQip8oIqyNcewyJnYT9T3lpf9NEaEJPqvlyEV0uZnqKpjVkqWIkV3DTuKlmusfE3kClYwzygaYIIiSi03XxuA7OIF5aE7kJuttZRPsQpIoUga64W601l75mF0xCZdkYdvBPtZP5AGom6Ahtvu2brnfiZ3IXfbKye7rdHmo9AtBc5zyYftIujxAtRONcduIFLrcJm3wpdmDdfm/iDy2BgqbZnpoXE7kSiUJOy8qMNWD2nJwlC43QY+Km+i5OF/fHhD0ARJ5grpjt4qbaT1auM4oU1DGxG6Oev2/71xdCpEr7Jqtro5YpwWELk+AXtZqsHz01ojdDHM1PU7kCVEznNDEko8RuEXQ0bsAJZqRiTxhGqQ5FdGBg3NYgsfRpoZoDTEIv8N/tCNGDnlSwPU/hxkujyzCPhzBOZQiBY3QFB3i6Lidp7lhZSbe0VorcyVGoZwer1JdbHHlTC8LE3vC1US8CLg/xf+XtDqEfLPa4BiRR0/dBXsGhzOxE3kMdcGXCUc+h8iDT/IFCQR+BROJ3ARlaw5DcF8uYAiRm6J6yHPRXaNb9mhvUknkPmuocuGC+MoS1Cdy89QSK3wCvg8PaZ8NkSdM/YT7hsvLRcwSfKwh8kBVB08LN/JSlxIscNUzT+QBKBlDsC1O4OeR53LkDZEHqN7Ic9VRW4a3kav92EbkxigF38BcbEO5CMBhLME45Tz3yCJPChn8dPRBF7RHB3RARrVtvC6hGIewHwUowBYcirMW/e/lubhCZybunyALmR7/6zKxR05ETuRETuRETuRsNCKniJwicorIKSKniJwicorIKSKniJyqGfnHmvsyE3nIlRJzHxi63ErlEXnUNI6JPWrKUO7rTJdbp98QedSUjWIm9qjpGSKPnrYysUdNzYRLEBO5RRrLxF6p5AhB7yz4zUqMtn+CUpSgZyt/sZpz0mzTWuXU5sbRaIgoOT1T8fdCnCZ026RC2lJzQ25CD4EKFX9PwWLUI/RoQQe+hbdcrEBFGazRovf0tdFwe1SUJVyx5u90u03aKOx7J3aLNEP8lY1J3ho10hg3Q7dbo59pjJwhdkvUAMeJPXr6jtY2Ary3W6Jfaw2CptutUJLmJgLEboXSsUkLO5O8JQ9079LtxE7sxE7sxE7sFqkhH+mIXV1WhG43DMoD7OPZZNHD/gWnPUUR+4BwX2wyeQMAijEYH4h/fS+hRw97c0K3B/tAvCf6ZRmh26OLGCpy+wE2VfQe6XLYTFHD/h6bKGrYy9CDDWQr9vwakV/FE2wce5WGl29CfgrD2TC2qy+W4/w14Hsxy5aVKvjFSN1CLVAPp1DEpqAoiqIoyiz9D9lYMumhgrvLAAAAJXRFWHRkYXRlOmNyZWF0ZQAyMDI1LTExLTI3VDA5OjEyOjQxKzAwOjAwvIZCxQAAACV0RVh0ZGF0ZTptb2RpZnkAMjAyNS0xMS0yN1QwOToxMjo0MSswMDowMM3b+nkAAAAASUVORK5CYII=";function bz({className:e}){return a.jsx("img",{src:xz,alt:"Model Context Protocol","aria-hidden":"true",className:ve("inline-block size-8 object-contain invert",e)})}function Qo({...e}){return a.jsx($j,{"data-slot":"select",...e})}function es({...e}){return a.jsx(Uj,{"data-slot":"select-value",...e})}function ts({className:e,size:t="default",children:n,...r}){return a.jsxs(Bj,{"data-slot":"select-trigger","data-size":t,className:ve("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,a.jsx(Wj,{asChild:!0,children:a.jsx(Zt,{className:"size-4 opacity-50"})})]})}function ns({className:e,children:t,position:n="popper",align:r="center",...o}){return a.jsx(Hj,{children:a.jsxs(Vj,{"data-slot":"select-content",className:ve("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:[a.jsx(yz,{}),a.jsx(Zj,{className:ve("p-1",n==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)] scroll-my-1"),children:t}),a.jsx(vz,{})]})})}function Lt({className:e,children:t,...n}){return a.jsxs(qj,{"data-slot":"select-item",className:ve("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:[a.jsx("span",{className:"absolute right-2 flex size-3.5 items-center justify-center",children:a.jsx(Gj,{children:a.jsx(rt,{className:"size-4"})})}),a.jsx(Kj,{children:t})]})}function yz({className:e,...t}){return a.jsx(Jj,{"data-slot":"select-scroll-up-button",className:ve("flex cursor-default items-center justify-center py-1",e),...t,children:a.jsx(qv,{className:"size-4"})})}function vz({className:e,...t}){return a.jsx(Yj,{"data-slot":"select-scroll-down-button",className:ve("flex cursor-default items-center justify-center py-1",e),...t,children:a.jsx(Zt,{className:"size-4"})})}const Rg=te({input:ie().int().nonnegative(),output:ie().int().nonnegative(),cacheCreate:ie().int().nonnegative(),cacheRead:ie().int().nonnegative(),total:ie().int().nonnegative()}),wz=te({id:ie().int().positive(),timestamp:A(),provider:A().nullable(),model:A().nullable(),apiFormat:Re(["anthropic","openai","unknown"]),method:A(),path:A(),status:ie().nullable(),isStreaming:Ze(),hasError:Ze(),error:A().nullable(),latencyMs:ie().nullable(),firstChunkMs:ie().nullable().optional(),totalStreamMs:ie().nullable().optional(),tokensPerSecond:ie().nullable().optional(),tokens:te({input:ie().nullable(),output:ie().nullable(),cacheCreate:ie().nullable(),cacheRead:ie().nullable()}),sessionId:A().nullable()}),Pg=te({id:A(),status:Re(["active","failed","completed","empty"]),logCoverage:Re(["recent","history"]),source:Re(["explicit","client-process","client-connection","provider-test"]).nullable(),runtimeMode:Re(["in-process","worker-thread","child-process"]).nullable(),createdAt:A().nullable(),updatedAt:A().nullable(),requestCount:ie().int().nonnegative(),activeRequests:ie().int().nonnegative(),completedRequests:ie().int().nonnegative(),failedRequests:ie().int().nonnegative(),queuedTasks:ie().int().nonnegative(),runningTasks:ie().int().nonnegative(),lastTaskError:A().nullable(),logCount:ie().int().nonnegative(),errorCount:ie().int().nonnegative(),models:we(A()),providers:we(A()),tokenUsage:Rg,lastLogId:ie().nullable(),lastModel:A().nullable(),clientPid:ie().nullable(),clientProjectFolder:A().nullable(),inspectorPath:A(),inspectorUrl:A(),apiPath:A(),apiUrl:A(),compactLogsPath:A(),compactLogsUrl:A(),latestLogLimit:ie().int().positive(),latestLogs:we(wz)}),eo=Re(["created","running","completed","failed","cancelled"]),Al=te({jsonPath:A(),markdownPath:A(),htmlPath:A(),exportedAt:A()}),kz=Re(["run-created","session-started","request","session-finished","evidence-exported"]),_z=Re(["info","success","warning","error"]),Sz=te({timestamp:A(),kind:kz,severity:_z,title:A(),details:A(),logId:ie().int().positive().nullable(),status:ie().nullable(),model:A().nullable(),provider:A().nullable(),latencyMs:ie().nullable(),isStreaming:Ze().nullable()}),Cz=Re(["none","active","provider-timeout","provider-http-error","provider-auth-error","provider-rate-limit","network-or-container","streaming-mismatch","context-pressure","runtime-task-error","model-output-error","unknown-failure","no-session-data"]),Og=te({outcome:Re(["success","failure","active","unknown"]),severity:Re(["none","low","medium","high"]),category:Cz,summary:A(),evidenceLogIds:we(ie().int().positive()),hints:we(A())}),Il=te({status:Re(["PASS","FAIL","RUNNING","UNKNOWN"]),summary:A(),markdown:A()}),Mg=Il,zl=te({id:A(),sessionId:A(),title:A(),task:A().nullable(),project:A().nullable(),agent:A().nullable(),status:eo,tags:we(A()),metadata:nt(A(),ft),evidence:Al.nullable(),createdAt:A(),updatedAt:A()});te({runId:A().min(1).optional(),sessionId:A().min(1).optional(),title:A().min(1).optional(),task:A().nullable().optional(),project:A().nullable().optional(),agent:A().nullable().optional(),status:eo.optional(),tags:we(A()).optional(),metadata:nt(A(),ft).optional()}).optional();te({sessionId:A().min(1).optional(),title:A().min(1).optional(),task:A().nullable().optional(),project:A().nullable().optional(),agent:A().nullable().optional(),status:eo.optional(),tags:we(A()).optional(),metadata:nt(A(),ft).optional()});te({includeHistory:Ze().optional(),latestLogLimit:ie().int().positive().max(50).optional()}).optional();te({run:zl,evidence:Al,session:Pg.nullable(),timeline:we(Sz),classification:Og,jenkinsReport:Il});const jz=te({run:zl,classification:Og,evidence:Al.nullable(),jenkinsReport:Il.nullable(),sessionId:A(),inspectorUrl:A().nullable(),evidenceMarkdownPath:A().nullable(),updatedAt:A()});te({failures:we(jz),total:ie().int().nonnegative(),limit:ie().int().positive()});const Rl=Re(["created","running","completed","failed","cancelled"]),Pl=Re(["evaluation","batch","manual"]),Ol=te({jsonPath:A(),markdownPath:A(),htmlPath:A(),exportedAt:A()}),Lg=te({id:A(),groupId:A(),sessionId:A(),runId:A().nullable(),label:A().nullable(),agent:A().nullable(),provider:A().nullable(),model:A().nullable(),status:eo.nullable(),metadata:nt(A(),ft),addedAt:A(),updatedAt:A()}),Ml=te({id:A(),title:A(),kind:Pl,task:A().nullable(),project:A().nullable(),status:Rl,tags:we(A()),metadata:nt(A(),ft),evidence:Ol.nullable(),members:we(Lg),createdAt:A(),updatedAt:A()});te({groupId:A().min(1).optional(),title:A().min(1).optional(),kind:Pl.optional(),task:A().nullable().optional(),project:A().nullable().optional(),status:Rl.optional(),tags:we(A()).optional(),metadata:nt(A(),ft).optional()}).optional();te({title:A().min(1).optional(),kind:Pl.optional(),task:A().nullable().optional(),project:A().nullable().optional(),status:Rl.optional(),tags:we(A()).optional(),metadata:nt(A(),ft).optional()});te({memberId:A().min(1).optional(),sessionId:A().min(1),runId:A().min(1).nullable().optional(),label:A().min(1).nullable().optional(),agent:A().min(1).nullable().optional(),provider:A().min(1).nullable().optional(),model:A().min(1).nullable().optional(),status:eo.nullable().optional(),metadata:nt(A(),ft).optional()});te({includeHistory:Ze().optional(),latestLogLimit:ie().int().positive().max(50).optional()}).optional();te({deleteEvidence:Ze().optional()});const Nz=te({groupId:A(),deleted:Ze(),evidenceDeleted:Ze(),evidencePath:A().nullable()}),Ez=te({member:Lg,run:zl.nullable(),session:Pg.nullable()}),Dg=te({memberCount:ie().int().nonnegative(),sessionsWithData:ie().int().nonnegative(),missingSessions:ie().int().nonnegative(),requestCount:ie().int().nonnegative(),errorCount:ie().int().nonnegative(),tokenUsage:Rg,models:we(A()),providers:we(A()),completedMembers:ie().int().nonnegative(),failedMembers:ie().int().nonnegative(),runningMembers:ie().int().nonnegative()}),Tz=te({group:Ml,evidence:Ol,markdown:A(),summary:Dg.nullable(),report:Mg.nullable()}),Az=te({group:Ml,evidence:Ol,members:we(Ez),summary:Dg,jenkinsReport:Mg}),Iz=te({groups:we(Ml)});function zz(e){return e===null||e.evidence===null?null:`/api/groups/${encodeURIComponent(e.id)}/evidence`}function Rz(e){const t=Vr(zz(e),n=>Pn(n,Tz));return{evidenceResponse:t.data??null,isLoading:t.isLoading,error:t.error,mutate:t.mutate}}function Pz(){const e=Vr("/api/groups",t=>Pn(t,Iz));return{groups:e.data?.groups??[],isLoading:e.isLoading,error:e.error,mutate:e.mutate}}function Oz(e,t){const n=`/api/groups/${encodeURIComponent(e)}`;return t?`${n}?deleteEvidence=1`:n}function Fg(e){let t=0,n=0,r=0,o=0;for(const s of e.members)switch(s.status){case"completed":t+=1;break;case"failed":case"cancelled":n+=1;break;case"running":r+=1;break;case"created":break;case null:o+=1;break}return{memberCount:e.members.length,completedMembers:t,failedMembers:n,runningMembers:r,missingStatusMembers:o}}function Mz(e,t){return t!==null&&t.group.id===e.id?t.members.map(n=>({member:n.member,exportMember:n})):e.members.map(n=>({member:n,exportMember:null}))}function Ll(e){switch(e){case"completed":return"border-emerald-200 bg-emerald-50 text-emerald-700";case"failed":case"cancelled":return"border-red-200 bg-red-50 text-red-700";case"running":return"border-sky-200 bg-sky-50 text-sky-700";case"created":return"border-zinc-200 bg-zinc-50 text-zinc-600";case null:return"border-zinc-200 bg-zinc-50 text-zinc-500"}}function Dl(e){return e??"unknown"}function Lz(e){switch(e){case"PASS":return"border-emerald-200 bg-emerald-50 text-emerald-700";case"FAIL":return"border-red-200 bg-red-50 text-red-700";case"RUNNING":return"border-sky-200 bg-sky-50 text-sky-700";case"UNKNOWN":return"border-zinc-200 bg-zinc-50 text-zinc-600"}}function $g(e){return e===null||e.trim().length===0?"-":e}function tr(e){return e.toLocaleString()}function Dz(e){return e==null?"-":e<1e3?`${tr(e)} ms`:`${(e/1e3).toFixed(1)} s`}function Fl(e){const t=Date.parse(e);return Number.isFinite(t)?new Intl.DateTimeFormat(void 0,{month:"short",day:"2-digit",hour:"2-digit",minute:"2-digit",hour12:!1}).format(new Date(t)):e}function Bg(...e){for(const t of e)if(t!==null&&t.trim().length>0)return t;return"-"}function Fz(e){const t=e.provider,n=e.model;return t!==null&&t.length>0&&n!==null&&n.length>0?`${t} / ${n}`:Bg(t,n)}function $z(e,t){if(t!==null){const n=e.find(r=>r.id===t);if(n!==void 0)return n}return e[0]??null}function Bz(e){return(e.exportMember?.session?.latestLogs??[])[0]??null}function Uz(e,t){return t!==null&&t.group.id===e.id?t.evidence:e.evidence}function Wz(e,t,n){return t!==null&&t.group.id===e.id?t.summary:n!==null&&n.group.id===e.id?n.summary:null}function Hz(e,t,n){return t!==null&&t.group.id===e.id?t.jenkinsReport:n!==null&&n.group.id===e.id?n.report:null}function Vz(){const[e,t]=x.useState(!1),[n,r]=x.useState(null),[o,s]=x.useState(null),[i,l]=x.useState(null),[c,u]=x.useState(null),[d,f]=x.useState(null),[h,p]=x.useState(!1),[y,m]=x.useState(null),[g,b]=x.useState(null),{groups:v,isLoading:k,error:S,mutate:C}=Pz(),j=x.useMemo(()=>$z(v,n),[v,n]);x.useEffect(()=>{!e||n!==null&&v.some(K=>K.id===n)||r(v[0]?.id??null)},[v,e,n]);const E=j!==null&&c!==null&&c.group.id===j.id?c:null,{evidenceResponse:T,isLoading:z,error:O,mutate:B}=Rz(j),N=x.useCallback(()=>{C()},[C]),D=x.useCallback(async F=>{s(F.id),l(null);try{const K=await fetch(`/api/groups/${encodeURIComponent(F.id)}/evidence`,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({latestLogLimit:10})});if(!K.ok){l(await Qt(K,`Export failed with status ${String(K.status)}`));return}const I=await It(K,Az);u(I),await C(),await B()}catch(K){l(K instanceof Error?K.message:String(K))}finally{s(null)}},[C,B]),w=x.useCallback(F=>{f(F),p(!1),b(null)},[]),L=x.useCallback(()=>{y===null&&(f(null),p(!1),b(null))},[y]),W=x.useCallback(F=>{r(F),f(null),p(!1),b(null)},[]),U=x.useCallback(async()=>{const F=d;if(F!==null){m(F.id),b(null);try{const K=await fetch(Oz(F.id,h),{method:"DELETE"});if(!K.ok){b(await Qt(K,`Delete failed with status ${String(K.status)}`));return}await It(K,Nz),u(I=>I!==null&&I.group.id===F.id?null:I),r(I=>I===F.id?null:I),f(null),p(!1),await C(),await B()}catch(K){b(K instanceof Error?K.message:String(K))}finally{m(null)}}},[h,d,C,B]);return a.jsxs(zs,{open:e,onOpenChange:t,children:[a.jsx(mm,{asChild:!0,children:a.jsxs(Ae,{type:"button",variant:"ghost",size:"icon",className:"relative size-8","aria-label":"Evaluation groups",title:"Evaluation groups",children:[a.jsx(fc,{className:"size-4"}),k?a.jsx(Wt,{className:"absolute -right-0.5 -top-0.5 size-3 animate-spin text-muted-foreground"}):v.length>0?a.jsx("span",{className:"absolute -right-1 -top-1 min-w-4 rounded-full bg-primary px-1 text-[10px] leading-4 text-primary-foreground",children:v.length}):null,a.jsx("span",{className:"sr-only",children:"Evaluation groups"})]})}),a.jsxs(Rs,{className:"flex max-h-[85vh] max-w-5xl flex-col overflow-hidden",children:[a.jsx(Ps,{children:a.jsxs(Os,{className:"flex items-center gap-2 pr-8",children:[a.jsx(fc,{className:"size-5 text-muted-foreground"}),a.jsx("span",{children:"Groups"}),a.jsx(st,{variant:"outline",children:tr(v.length)})]})}),a.jsxs("div",{className:"flex min-h-0 items-center justify-between gap-3 border-b border-border pb-3",children:[a.jsx("p",{className:"text-xs text-muted-foreground",children:"Evaluation batches, model runs, and exported evidence packs."}),a.jsxs(Ae,{type:"button",variant:"outline",size:"sm",className:"shrink-0",onClick:N,children:[a.jsx(Pi,{className:"size-3.5"}),"Refresh"]})]}),a.jsxs("div",{className:"grid min-h-0 flex-1 gap-4 md:grid-cols-[260px_minmax(0,1fr)]",children:[a.jsx(Zz,{groups:v,selectedGroupId:j?.id??null,isLoading:k,error:S,onSelect:W}),a.jsx(qz,{group:j,deleteTarget:d,deleteEvidence:h,exportResult:E,evidenceResponse:T,evidenceLoading:z,evidenceError:O,exportError:i,deleteError:g,exportingGroupId:o,deletingGroupId:y,onDeleteEvidenceChange:p,onExport:D,onRequestDelete:w,onCancelDelete:L,onConfirmDelete:()=>{U()}})]})]})]})}function Zz({groups:e,selectedGroupId:t,isLoading:n,error:r,onSelect:o}){return n?a.jsx("div",{className:"flex min-h-48 items-center justify-center rounded-md border border-dashed border-border text-xs text-muted-foreground",children:"Loading groups..."}):r!==void 0?a.jsx("div",{className:"rounded-md border border-red-200 bg-red-50 px-3 py-2 text-xs text-red-700",children:r.message}):e.length===0?a.jsx("div",{className:"rounded-md border border-dashed border-border px-3 py-8 text-center text-xs text-muted-foreground",children:"No groups yet."}):a.jsx("div",{className:"min-h-0 overflow-y-auto pr-1",children:a.jsx("div",{className:"space-y-2",children:e.map(s=>{const i=Fg(s),l=t===s.id;return a.jsxs("button",{type:"button",onClick:()=>o(s.id),className:ve("w-full rounded-md border px-3 py-2 text-left text-xs transition-colors",l?"border-primary bg-primary/5":"border-border bg-background hover:bg-muted/50"),children:[a.jsxs("div",{className:"flex min-w-0 items-center justify-between gap-2",children:[a.jsx("span",{className:"min-w-0 truncate text-sm font-medium",children:s.title}),a.jsx(st,{variant:"outline",className:Ll(s.status),children:Dl(s.status)})]}),a.jsxs("div",{className:"mt-1 flex items-center gap-2 text-muted-foreground",children:[a.jsxs("span",{children:[i.memberCount," sessions"]}),a.jsx("span",{children:Fl(s.updatedAt)})]})]},s.id)})})})}function qz({group:e,deleteTarget:t,deleteEvidence:n,exportResult:r,evidenceResponse:o,evidenceLoading:s,evidenceError:i,exportError:l,deleteError:c,exportingGroupId:u,deletingGroupId:d,onDeleteEvidenceChange:f,onExport:h,onRequestDelete:p,onCancelDelete:y,onConfirmDelete:m}){if(e===null)return a.jsx("div",{className:"flex min-h-48 items-center justify-center rounded-md border border-dashed border-border text-xs text-muted-foreground",children:"Select a group to inspect."});const g=Fg(e),b=Wz(e,r,o),v=Hz(e,r,o),k=Uz(e,r),S=Mz(e,r),C=u===e.id,j=d===e.id,E=t?.id===e.id;return a.jsx("div",{className:"min-h-0 overflow-y-auto pr-1",children:a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"flex min-w-0 flex-col gap-3 sm:flex-row sm:items-start sm:justify-between",children:[a.jsxs("div",{className:"min-w-0 space-y-1",children:[a.jsxs("div",{className:"flex min-w-0 flex-wrap items-center gap-2",children:[a.jsx("h3",{className:"min-w-0 truncate text-base font-semibold",children:e.title}),a.jsx(st,{variant:"outline",className:Ll(e.status),children:Dl(e.status)}),a.jsx(st,{variant:"outline",children:e.kind})]}),a.jsxs("div",{className:"flex flex-wrap items-center gap-2 text-xs text-muted-foreground",children:[a.jsx("span",{children:$g(e.project)}),a.jsxs("span",{children:["updated ",Fl(e.updatedAt)]})]})]}),a.jsxs("div",{className:"flex shrink-0 items-center gap-2",children:[a.jsx(Ae,{type:"button",variant:"outline",size:"icon",className:"size-8 text-red-600 hover:text-red-700","aria-label":"Delete group",title:"Delete group",disabled:j,onClick:()=>p(e),children:j?a.jsx(Wt,{className:"size-3.5 animate-spin"}):a.jsx(Lr,{className:"size-3.5"})}),a.jsxs(Ae,{type:"button",variant:"default",size:"sm",className:"shrink-0",disabled:C||j,onClick:()=>{h(e)},children:[C?a.jsx(Wt,{className:"size-3.5 animate-spin"}):a.jsx(ds,{className:"size-3.5"}),"Export evidence"]})]})]}),e.task!==null&&e.task.trim().length>0&&a.jsx("p",{className:"rounded-md border border-border bg-muted/20 px-3 py-2 text-xs text-muted-foreground",children:e.task}),E&&a.jsx(Kz,{group:e,deleteEvidence:n,isDeleting:j,error:c,onDeleteEvidenceChange:f,onCancel:y,onConfirm:m}),a.jsxs("div",{className:"grid gap-2 sm:grid-cols-4",children:[a.jsx(cn,{label:"Members",value:g.memberCount}),a.jsx(cn,{label:"Done",value:g.completedMembers}),a.jsx(cn,{label:"Failed",value:g.failedMembers}),a.jsx(cn,{label:"Running",value:g.runningMembers})]}),b!==null&&a.jsxs("div",{className:"grid gap-2 sm:grid-cols-4",children:[a.jsx(cn,{label:"Requests",value:b.requestCount}),a.jsx(cn,{label:"Errors",value:b.errorCount}),a.jsx(cn,{label:"Tokens",value:b.tokenUsage.total}),a.jsx(cn,{label:"Missing",value:b.missingSessions})]}),a.jsx(Gz,{report:v,loading:s,error:i,hasEvidence:k!==null}),a.jsx(Jz,{evidence:k}),l!==null&&a.jsx("div",{className:"rounded-md border border-red-200 bg-red-50 px-3 py-2 text-xs text-red-700",children:l}),c!==null&&!E&&a.jsx("div",{className:"rounded-md border border-red-200 bg-red-50 px-3 py-2 text-xs text-red-700",children:c}),a.jsx(Yz,{rows:S})]})})}function Kz({group:e,deleteEvidence:t,isDeleting:n,error:r,onDeleteEvidenceChange:o,onCancel:s,onConfirm:i}){const l=e.evidence!==null,c=e.evidence?.markdownPath??"No evidence pack exported.";return a.jsx("div",{className:"rounded-md border border-red-200 bg-red-50 px-3 py-3 text-red-900",children:a.jsxs("div",{className:"flex min-w-0 flex-col gap-3 lg:flex-row lg:items-start lg:justify-between",children:[a.jsxs("div",{className:"min-w-0 space-y-2",children:[a.jsxs("div",{className:"flex items-center gap-2 text-sm font-semibold",children:[a.jsx(Lr,{className:"size-4 text-red-600"}),a.jsx("span",{children:"Delete group?"})]}),a.jsxs("p",{className:"text-xs text-red-800",children:["Delete ",a.jsx("span",{className:"font-medium",children:e.title}),". Session logs and run records stay intact."]}),a.jsxs("label",{className:ve("flex min-w-0 items-start gap-2 text-xs",l?"cursor-pointer":"opacity-60"),children:[a.jsx("input",{type:"checkbox",className:"mt-0.5 size-4 shrink-0",checked:t,disabled:!l||n,onChange:u=>o(u.currentTarget.checked)}),a.jsxs("span",{className:"min-w-0",children:[a.jsx("span",{className:"block font-medium",children:"Also delete exported evidence files"}),a.jsx("code",{className:"mt-1 block truncate font-mono text-[11px] text-red-700",children:c})]})]}),r!==null&&a.jsx("div",{className:"rounded-md border border-red-200 bg-white px-2 py-1.5 text-xs text-red-700",children:r})]}),a.jsxs("div",{className:"flex shrink-0 justify-end gap-2",children:[a.jsx(Ae,{type:"button",variant:"outline",size:"sm",disabled:n,onClick:s,children:"Cancel"}),a.jsxs(Ae,{type:"button",variant:"destructive",size:"sm",disabled:n,onClick:i,children:[n?a.jsx(Wt,{className:"size-3.5 animate-spin"}):a.jsx(Lr,{className:"size-3.5"}),"Delete"]})]})]})})}function cn({label:e,value:t}){return a.jsxs("div",{className:"rounded-md border border-border bg-muted/20 px-3 py-2",children:[a.jsx("div",{className:"text-[11px] font-medium uppercase text-muted-foreground",children:e}),a.jsx("div",{className:"mt-1 font-mono text-sm font-semibold",children:tr(t)})]})}function Gz({report:e,loading:t,error:n,hasEvidence:r}){const{copied:o,copy:s}=Xt(e?.markdown??null);return e===null&&!t&&n===void 0?null:t?a.jsxs("div",{className:"flex items-center gap-2 rounded-md border border-border bg-muted/20 px-3 py-2 text-xs text-muted-foreground",children:[a.jsx(Wt,{className:"size-3.5 animate-spin"}),"Loading evidence report..."]}):n!==void 0&&r?a.jsxs("div",{className:"rounded-md border border-red-200 bg-red-50 px-3 py-2 text-xs text-red-700",children:["Failed to load evidence report: ",n.message]}):e===null?null:a.jsxs("div",{className:"rounded-md border border-border bg-muted/20 px-3 py-2",children:[a.jsxs("div",{className:"flex min-w-0 items-center justify-between gap-2",children:[a.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[a.jsx("span",{className:"text-xs font-semibold",children:"Evidence report"}),a.jsx(st,{variant:"outline",className:Lz(e.status),children:e.status})]}),a.jsx(Ae,{type:"button",variant:"ghost",size:"icon",className:"size-7 shrink-0","aria-label":o?"Copied evidence report":"Copy evidence report",onClick:s,children:o?a.jsx(rt,{className:"size-3.5 text-emerald-500"}):a.jsx(_t,{className:"size-3.5"})})]}),a.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:e.summary})]})}function Jz({evidence:e}){return e===null?a.jsx("div",{className:"rounded-md border border-dashed border-border px-3 py-2 text-xs text-muted-foreground",children:"No evidence pack exported yet."}):a.jsxs("div",{className:"space-y-2 rounded-md border border-border bg-muted/20 px-3 py-2",children:[a.jsxs("div",{className:"flex items-center justify-between gap-2",children:[a.jsx("span",{className:"text-xs font-semibold",children:"Evidence paths"}),a.jsx("span",{className:"text-[11px] text-muted-foreground",children:Fl(e.exportedAt)})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(wi,{label:"JSON",value:e.jsonPath}),a.jsx(wi,{label:"Markdown",value:e.markdownPath}),a.jsx(wi,{label:"HTML",value:e.htmlPath})]})]})}function wi({label:e,value:t}){const{copied:n,copy:r}=Xt(t);return a.jsxs("div",{className:"flex min-w-0 items-center gap-2 rounded-md border border-border bg-background px-2 py-1.5",children:[a.jsx("span",{className:"w-16 shrink-0 text-[11px] font-medium text-muted-foreground",children:e}),a.jsx("code",{className:"min-w-0 flex-1 truncate font-mono text-xs",children:t}),a.jsx(Ae,{type:"button",variant:"ghost",size:"icon",className:"size-7 shrink-0","aria-label":n?`Copied ${e} path`:`Copy ${e} path`,onClick:r,children:n?a.jsx(rt,{className:"size-3.5 text-emerald-500"}):a.jsx(_t,{className:"size-3.5"})})]})}function Yz({rows:e}){return e.length===0?a.jsx("div",{className:"rounded-md border border-dashed border-border px-3 py-8 text-center text-xs text-muted-foreground",children:"No sessions attached."}):a.jsxs("div",{className:"overflow-hidden rounded-md border border-border",children:[a.jsx("div",{className:"border-b border-border bg-muted/30 px-3 py-2 text-xs font-semibold",children:"Members"}),a.jsx("div",{className:"overflow-x-auto",children:a.jsxs("table",{className:"w-full min-w-[760px] text-left text-xs",children:[a.jsx("thead",{className:"border-b border-border bg-muted/20 text-muted-foreground",children:a.jsxs("tr",{children:[a.jsx("th",{className:"px-3 py-2 font-medium",children:"Session"}),a.jsx("th",{className:"px-3 py-2 font-medium",children:"Provider / Model"}),a.jsx("th",{className:"px-3 py-2 font-medium",children:"Status"}),a.jsx("th",{className:"px-3 py-2 font-medium",children:"Requests"}),a.jsx("th",{className:"px-3 py-2 font-medium",children:"Errors"}),a.jsx("th",{className:"px-3 py-2 font-medium",children:"First chunk"}),a.jsx("th",{className:"px-3 py-2 font-medium",children:"Tokens"})]})}),a.jsx("tbody",{children:e.map(t=>a.jsx(Xz,{row:t},t.member.id))})]})})]})}function Xz({row:e}){const t=e.member,n=e.exportMember?.session??null,r=Bz(e),o=n?.inspectorPath??Pd(t.sessionId),s=n?.requestCount??null,i=n?.errorCount??null,l=n?.tokenUsage.total??null,c=r?.firstChunkMs??null;return a.jsxs("tr",{className:"border-b border-border last:border-0",children:[a.jsxs("td",{className:"max-w-56 px-3 py-2",children:[a.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[a.jsx("a",{href:o,target:"_blank",rel:"noreferrer",className:"min-w-0 truncate font-mono text-xs text-primary hover:underline",children:Bg(t.label,t.sessionId)}),a.jsx(Pa,{className:"size-3 shrink-0 text-muted-foreground"})]}),a.jsx("div",{className:"mt-0.5 truncate text-[11px] text-muted-foreground",children:$g(t.agent)})]}),a.jsx("td",{className:"max-w-52 px-3 py-2",children:a.jsx("span",{className:"block truncate",children:Fz(t)})}),a.jsx("td",{className:"px-3 py-2",children:a.jsx(st,{variant:"outline",className:Ll(t.status),children:Dl(t.status)})}),a.jsx("td",{className:"px-3 py-2 font-mono",children:s===null?"-":tr(s)}),a.jsx("td",{className:"px-3 py-2 font-mono",children:i===null?"-":tr(i)}),a.jsx("td",{className:"px-3 py-2 font-mono",children:Dz(c)}),a.jsx("td",{className:"px-3 py-2 font-mono",children:l===null?"-":tr(l)})]})}function Qz(){return a.jsxs("svg",{fill:"currentColor",fillRule:"evenodd",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",className:"size-6 shrink-0",children:[a.jsx("title",{children:"Claude Code"}),a.jsx("path",{clipRule:"evenodd",d:"M20.998 10.949H24v3.102h-3v3.028h-1.487V20H18v-2.921h-1.487V20H15v-2.921H9V20H7.488v-2.921H6V20H4.487v-2.921H3V14.05H0V10.95h3V5h17.998v5.949zM6 10.949h1.488V8.102H6v2.847zm10.51 0H18V8.102h-1.49v2.847z"})]})}function eR(){return a.jsxs("svg",{fill:"currentColor",fillRule:"evenodd",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",className:"size-6 shrink-0",children:[a.jsx("title",{children:"OpenCode"}),a.jsx("path",{d:"M16 6H8v12h8V6zm4 16H4V2h16v20z"})]})}function tR(){return a.jsxs("svg",{fill:"currentColor",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",className:"size-6 shrink-0",children:[a.jsx("title",{children:"MiMo Code"}),a.jsx("text",{x:"12",y:"18",textAnchor:"middle",fontSize:"16",fontWeight:"800",fontFamily:"system-ui, sans-serif",children:"M"})]})}const nR=te({name:A(),apiKey:A(),format:Re(["anthropic","openai"]),anthropicBaseUrl:A(),openaiBaseUrl:A(),models:we(A()),sourceTool:Re(["claude-code","opencode","mimo-code"]),alreadyExists:Ze()}),rR=te({providers:we(nR),warnings:we(A()).optional()}),oR=te({success:Ze().optional(),imported:ie().optional(),message:A().optional(),errors:we(A()).optional()}),sR={"claude-code":Qz,opencode:eR,"mimo-code":tR};function iR({open:e,onOpenChange:t,onImportComplete:n}){const[r,o]=x.useState(!1),[s,i]=x.useState(null),[l,c]=x.useState([]),[u,d]=x.useState([]),[f,h]=x.useState(new Set),[p,y]=x.useState(!1),[m,g]=x.useState(null),[b,v]=x.useState(null),k=x.useCallback(()=>{o(!0),i(null),d([]),c([]),h(new Set),g(null),v(null),fetch("/api/providers/scan").then(E=>E.ok?E.json().then(T=>{const z=rR.safeParse(T);if(!z.success){i(`Invalid response: ${z.error.message}`);return}c(z.data.providers),d(z.data.warnings??[]);const O=new Set;z.data.providers.forEach((B,N)=>{B.alreadyExists||O.add(N)}),h(O)}):E.text().then(T=>{i(`Scan failed (${E.status}): ${T}`)})).catch(E=>{i(E instanceof Error?E.message:String(E))}).finally(()=>{o(!1)})},[]);x.useEffect(()=>{e&&k()},[e,k]);const S=x.useCallback(E=>{h(T=>{const z=new Set(T);return z.has(E)?z.delete(E):z.add(E),z})},[]),C=x.useCallback(()=>{const E=l.filter((O,B)=>f.has(B));if(E.length===0)return;y(!0),v(null),g(null);const T=new Date().toISOString(),z=E.map(O=>({id:window.crypto.randomUUID(),name:O.name,apiKey:O.apiKey,format:O.format,anthropicBaseUrl:O.anthropicBaseUrl,openaiBaseUrl:O.openaiBaseUrl,models:O.models,createdAt:T,updatedAt:T}));fetch("/api/providers/import",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({providers:z})}).then(O=>O.json()).then(O=>{const B=oR.safeParse(O);if(!B.success){v(`Invalid response: ${B.error.message}`);return}const N=B.data;c(D=>D.map((w,L)=>f.has(L)?{...w,alreadyExists:!0}:w)),h(new Set),N.errors!==void 0&&N.errors.length>0&&N.message!==void 0?g(N.message):g(`Imported ${N.imported??E.length} provider(s)`),n()}).catch(O=>{v(O instanceof Error?O.message:String(O))}).finally(()=>{y(!1)})},[l,f,n]),j=l.some(E=>!E.alreadyExists);return a.jsx(zs,{open:e,onOpenChange:t,children:a.jsxs(Rs,{className:"max-w-xl max-h-[80vh] overflow-hidden flex flex-col",children:[a.jsxs(Ps,{children:[a.jsx(Os,{children:"Import from External Tools"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"Detect provider configurations from Claude Code, OpenCode, and MiMo Code."})]}),a.jsxs("div",{className:"flex-1 overflow-y-auto space-y-3",children:[r&&a.jsxs("div",{className:"flex items-center justify-center py-8 gap-2 text-muted-foreground",children:[a.jsx(Wt,{className:"size-4 animate-spin"}),a.jsx("span",{className:"text-sm",children:"Scanning for external providers..."})]}),s!==null&&a.jsxs("div",{className:"flex items-center gap-2 text-destructive text-sm py-4",children:[a.jsx(Mr,{className:"size-4"}),s]}),!r&&s===null&&l.length===0&&a.jsxs("p",{className:"text-sm text-muted-foreground py-8 text-center",children:["No external provider configurations found.",a.jsx("br",{}),a.jsx("span",{className:"text-xs",children:"Supported tools: Claude Code (~/.claude/settings.json), OpenCode (~/.config/opencode/opencode.json), MiMo Code (~/.config/mimocode/mimocode.jsonc)"})]}),!r&&l.map((E,T)=>a.jsxs("label",{className:`flex items-start gap-3 p-3 border rounded-md ${E.alreadyExists?"":"cursor-pointer hover:bg-muted/50"}`,children:[!E.alreadyExists&&a.jsx("input",{type:"checkbox",checked:f.has(T),disabled:p,onChange:()=>S(T),className:"mt-0.5 size-4"}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[(()=>{const z=sR[E.sourceTool];return z===void 0?null:a.jsx(z,{})})(),E.alreadyExists&&a.jsx("span",{className:"text-[10px] text-muted-foreground",children:"Already added"})]}),a.jsxs("div",{className:"text-xs text-muted-foreground mt-1 truncate",children:[E.models.slice(0,4).join(", "),E.models.length>4?` +${E.models.length-4} more`:""]}),a.jsx("div",{className:"text-xs text-muted-foreground mt-0.5 truncate",children:E.format==="anthropic"?E.anthropicBaseUrl:E.openaiBaseUrl}),a.jsx("div",{className:"text-xs text-muted-foreground mt-0.5 font-mono",children:E.apiKey.length>8?`${E.apiKey.slice(0,4)}••••${E.apiKey.slice(-4)}`:"••••"})]})]},`${E.sourceTool}-${E.name}`)),u.length>0&&a.jsx("div",{className:"text-xs text-muted-foreground space-y-1 border-t pt-2",children:u.map((E,T)=>a.jsxs("div",{className:"flex items-center gap-1",children:[a.jsx(Mr,{className:"size-3"}),E]},T))}),m!==null&&a.jsx("div",{className:"text-sm text-green-500 border-t pt-2",children:m}),b!==null&&a.jsx("div",{className:"text-sm text-destructive border-t pt-2",children:b})]}),a.jsxs("div",{className:"flex items-center justify-between pt-3 border-t",children:[a.jsxs(Ae,{variant:"outline",size:"sm",onClick:k,disabled:r,children:[a.jsx(Wt,{className:`size-3 mr-1 ${r?"animate-spin":""}`}),"Rescan"]}),a.jsxs(Ae,{size:"sm",onClick:C,disabled:!j||f.size===0||p,children:[a.jsx(ds,{className:"size-3 mr-1"}),p?"Importing...":`Import Selected (${f.size})`]})]})]})})}function Ug(e){return e.length<=8?"••••••••":e.slice(0,4)+"••••••••"+e.slice(-4)}const Wg=te({id:A().min(1),aliases:we(A()).optional().default([]),contextWindow:ie().int().positive().optional(),outputLimit:ie().int().positive().optional(),sourceUrl:A().optional()}),aR=te({name:A().min(1).optional(),aliases:we(A()).optional().default([]),baseUrls:we(A()).optional().default([]),models:we(Wg).min(1)});te({version:ie().int().positive().optional(),updatedAt:A().optional(),providers:we(aR).optional().default([]),models:we(Wg).optional().default([])});function Qu(e){return e.trim().toLowerCase().replace(/\s+/g,"-")}function lR(e){const t=e.models.filter(n=>n.trim()!=="");return t.length>0?t:e.model!==void 0&&e.model.trim()!==""?[e.model]:[]}function $l(e,t){const n=Qu(t);return(e.modelMetadata??[]).find(o=>Qu(o.model)===n)??null}function cR(e){const t=lR(e);return t.length===0?!1:t.every(n=>{const r=$l(e,n);return r!==null&&r.contextWindow!==void 0})}function uR(e,t){if(e===null)return null;for(const n of t){const r=$l(n,e);if(r!==null&&r.contextWindow!==void 0)return{providerName:n.name,model:r.model,tokens:r.contextWindow,sourceUrl:r.sourceUrl}}return null}const dR={deepseek:"https://api-docs.deepseek.com/zh-cn/"};function fR(e){return Object.prototype.hasOwnProperty.call(e,"success")}function pR(e){return Object.prototype.hasOwnProperty.call(e,"notConfigured")}function xt(e){return e!==void 0&&e.trim()!==""}function ma(e){if(e===void 0)return;const t=Object.entries(e).map(([n,r])=>`${n}: ${r}`);if(t.length!==0)return t.join(`
|
|
115
|
-
`)}function ed(e){return ma(e)!==void 0}function td(e){return e<1e3?`${e}ms`:`${(e/1e3).toFixed(1)}s`}function hR(e){return e>=10?`${e.toFixed(0)}/s`:`${e.toFixed(1)}/s`}function mR(e){const t=e.debug;return xt(e.error?.hint)||xt(e.error?.details)||xt(e.rawResponse)||xt(t?.requestUrl)||xt(t?.requestBody)||xt(t?.responseBody)||ed(t?.requestHeaders)||ed(t?.responseHeaders)||t?.responseStatus!==void 0}function un({title:e,children:t}){return a.jsxs("div",{className:"space-y-1",children:[a.jsx("div",{className:"font-medium text-foreground/80",children:e}),t]})}function Sr({value:e}){return a.jsx("pre",{className:"max-h-40 overflow-auto whitespace-pre-wrap break-all rounded-md bg-background/80 p-2 font-mono text-[11px] leading-relaxed text-foreground/80",children:e})}function gR({result:e}){const t=e.debug,n=t?.requestUrl,r=t?.requestMethod??"POST",o=ma(t?.requestHeaders),s=ma(t?.responseHeaders),i=t?.responseStatus!==void 0?`${t.responseStatus}${xt(t.responseStatusText)?` ${t.responseStatusText}`:""}`:void 0,l=t?.responseBody??e.rawResponse;return a.jsxs("div",{className:"max-h-80 max-w-full space-y-2 overflow-auto rounded-md border bg-muted/50 p-2 text-xs text-muted-foreground shadow-sm sm:w-[520px]",children:[xt(e.error?.hint)&&a.jsx(un,{title:"Hint",children:a.jsx("div",{children:e.error.hint})}),xt(e.error?.details)&&a.jsx(un,{title:"Error",children:a.jsx(Sr,{value:e.error.details})}),xt(n)&&a.jsx(un,{title:"Request",children:a.jsxs("div",{className:"rounded-md bg-background/80 p-2 font-mono text-[11px] break-all text-foreground/80",children:[r," ",n]})}),o!==void 0&&a.jsx(un,{title:"Request Headers",children:a.jsx(Sr,{value:o})}),xt(t?.requestBody)&&a.jsx(un,{title:"Request Body",children:a.jsx(Sr,{value:t.requestBody})}),xt(i)&&a.jsx(un,{title:"Response Status",children:a.jsx("div",{className:"rounded-md bg-background/80 p-2 font-mono text-[11px] text-foreground/80",children:i})}),s!==void 0&&a.jsx(un,{title:"Response Headers",children:a.jsx(Sr,{value:s})}),xt(l)&&a.jsx(un,{title:"Response Body",children:a.jsx(Sr,{value:l})})]})}function wo({results:e}){return a.jsxs("div",{className:"flex min-w-0 flex-col gap-2",children:[a.jsxs("div",{className:"flex min-w-0 flex-col gap-1",children:[a.jsx("span",{className:"text-[10px] text-muted-foreground",children:"Non-stream"}),a.jsx(nd,{result:e.nonStreaming})]}),a.jsxs("div",{className:"flex min-w-0 flex-col gap-1",children:[a.jsx("span",{className:"text-[10px] text-muted-foreground",children:"Stream"}),a.jsx(nd,{result:e.streaming})]})]})}function xR(e){const t={className:"size-3",strokeWidth:2};switch(e){case"timeout":return a.jsx(hn,{...t});case"network_unreachable":return a.jsx(xw,{...t});case"connection_refused":return a.jsx(yw,{...t});case"auth_failed":return a.jsx(O2,{...t});case"rate_limited":return a.jsx(Af,{...t});case"server_error":return a.jsx(sw,{...t});case"invalid_response":return a.jsx(n2,{...t});case"unknown":return a.jsx(Mr,{...t});default:return a.jsx(Mr,{...t})}}function nd({result:e}){const[t,n]=x.useState(!1);if(!fR(e))return pR(e)?a.jsxs("div",{className:"flex items-center gap-1 text-xs text-muted-foreground shrink-0",children:[a.jsx(D2,{className:"size-3"}),a.jsx("span",{children:"Not configured"})]}):a.jsxs("div",{className:"flex items-center gap-1 text-xs text-muted-foreground shrink-0",children:[a.jsx(Oi,{className:"size-3 animate-spin"}),a.jsx("span",{children:"Testing..."})]});if(e.success){const l=[],c=[];e.inputTokens!==void 0&&l.push(a.jsxs("span",{children:[e.inputTokens," in"]},"in")),e.outputTokens!==void 0&&l.push(a.jsxs("span",{children:[e.outputTokens," out"]},"out")),e.cacheCreationInputTokens!==void 0&&e.cacheCreationInputTokens>0&&l.push(a.jsxs("span",{className:"font-mono tabular-nums text-emerald-400",children:["KV Cache +",e.cacheCreationInputTokens]},"cache-create")),e.cacheReadInputTokens!==void 0&&e.cacheReadInputTokens>0&&l.push(a.jsxs("span",{className:"font-mono tabular-nums text-purple-400",children:["KV Cache ~",e.cacheReadInputTokens]},"cache-read")),e.firstChunkMs!==void 0&&e.firstChunkMs!==null&&c.push(a.jsxs("span",{children:["first ",td(e.firstChunkMs)]},"first")),e.totalStreamMs!==void 0&&e.totalStreamMs!==null&&c.push(a.jsxs("span",{children:["total ",td(e.totalStreamMs)]},"total")),e.tokensPerSecond!==void 0&&e.tokensPerSecond!==null&&e.tokensPerSecond>0&&c.push(a.jsxs("span",{children:[hR(e.tokensPerSecond)," tok/s"]},"rate"));const u=[];for(let f=0;f<l.length;f++)f>0&&u.push(", "),u.push(l[f]);const d=[];for(let f=0;f<c.length;f++)f>0&&d.push(", "),d.push(c[f]);return a.jsx(tt,{children:a.jsxs(Fe,{children:[a.jsx($e,{asChild:!0,children:a.jsxs("div",{className:"flex items-center gap-1 text-xs text-green-600 shrink-0",children:[a.jsx(Qv,{className:"size-3"}),a.jsx("span",{children:"Connected"}),l.length>0&&a.jsxs("span",{className:"text-muted-foreground",children:["(",u,")"]}),c.length>0&&a.jsxs("span",{className:"hidden text-muted-foreground lg:inline",children:["(",d,")"]})]})}),a.jsx(Be,{children:"Connection test passed"})]})})}const r=e.error,o=r?.message??"Connection failed",s=r?.type??"unknown",i=mR(e);return a.jsxs("div",{className:"flex flex-col gap-1 shrink-0",children:[a.jsxs("div",{className:"flex items-center gap-1 text-xs text-red-600 max-w-[200px]",children:[xR(s),a.jsx(tt,{children:a.jsxs(Fe,{children:[a.jsx($e,{asChild:!0,children:a.jsx("span",{className:"truncate",children:o})}),a.jsx(Be,{children:"Connection test failed"})]})}),i&&a.jsxs("button",{type:"button",onClick:()=>n(l=>!l),"aria-expanded":t,"aria-label":t?"Hide provider test diagnostics":"Show provider test diagnostics",className:"inline-flex h-5 shrink-0 items-center gap-1 rounded border border-border/70 bg-background/70 px-1.5 text-[10px] text-muted-foreground transition-colors hover:text-foreground",children:[t?a.jsx(Oa,{className:"size-3"}):a.jsx(Ma,{className:"size-3"}),a.jsx("span",{children:t?"Hide":"Details"})]})]}),t&&i&&a.jsx(gR,{result:e})]})}function bR(e){const t=Date.now(),n=new Date(e).getTime(),r=t-n,o=Math.floor(r/1e3);if(o<60)return"just now";const s=Math.floor(o/60);if(s<60)return`${s}m ago`;const i=Math.floor(s/60);return i<24?`${i}h ago`:`${Math.floor(i/24)}d ago`}function yR(e){if(e===void 0||e.trim()==="")return null;try{const t=new URL(e);if(t.protocol!=="https:"&&t.protocol!=="http:")return null;const n=t.hostname.toLowerCase(),r=n==="huggingface.co"||n.endsWith(".huggingface.co");return{label:r?"HF":"Source",title:r?"Open Hugging Face model source":"Open model metadata source",url:e}}catch{return null}}function vR({provider:e,testResults:t,isTesting:n,testingTimeLeft:r,isHighlighted:o,onEdit:s,onDelete:i,onTest:l,onRefreshMetadata:c,isRefreshingMetadata:u=!1}){const[d,f]=x.useState(!1),[h,p]=x.useState(!1),[y,m]=x.useState(!1);function g(){navigator.clipboard.writeText(e.apiKey).catch(()=>{}),p(!0),setTimeout(()=>p(!1),2e3)}const b=e.apiDocsUrl??Object.entries(dR).find(([C])=>e.name.toLowerCase().includes(C))?.[1],v=cR(e),k=e.modelMetadataUrl!==void 0&&e.modelMetadataUrl.trim()!=="",S=k?"Refresh":"Import defaults";return a.jsxs("div",{className:`border rounded-lg p-4 flex flex-col gap-3 bg-card transition-all duration-500 ${o===!0?"ring-2 ring-primary shadow-md":""}`,children:[a.jsxs("div",{className:"flex items-start justify-between gap-2",children:[a.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[a.jsx("span",{className:"font-medium truncate",children:e.name}),e.source==="company"&&a.jsx(tt,{children:a.jsxs(Fe,{children:[a.jsx($e,{asChild:!0,children:a.jsx("span",{className:"text-xs px-1.5 py-0.5 rounded bg-blue-100 text-blue-700 dark:bg-blue-900/30 dark:text-blue-400 shrink-0",children:"公司"})}),a.jsx(Be,{children:"Company-provided API key"})]})}),e.source==="personal"&&a.jsx(tt,{children:a.jsxs(Fe,{children:[a.jsx($e,{asChild:!0,children:a.jsx("span",{className:"text-xs px-1.5 py-0.5 rounded bg-green-100 text-green-700 dark:bg-green-900/30 dark:text-green-400 shrink-0",children:"个人"})}),a.jsx(Be,{children:"Your personal API key"})]})})]}),b!==void 0&&a.jsxs("a",{href:b,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:[a.jsx(Pa,{className:"size-3"}),a.jsx("span",{className:"sr-only",children:"Docs"})]})]}),e.models!==void 0&&e.models.length>0&&a.jsx("div",{className:"flex flex-wrap gap-1",children:e.models.map(C=>{const j=$l(e,C),E=yR(j?.sourceUrl);return a.jsxs("span",{className:"inline-flex items-center gap-1 text-xs px-1.5 py-0.5 rounded bg-muted text-muted-foreground",children:[a.jsx("span",{children:C}),j!==null&&j.contextWindow!==void 0&&a.jsx("span",{className:"font-mono text-foreground/80",children:Gf(j.contextWindow)}),E!==null&&a.jsx(tt,{children:a.jsxs(Fe,{children:[a.jsx($e,{asChild:!0,children:a.jsx("a",{href:E.url,target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-0.5 rounded border border-border/70 bg-background/70 px-1 font-mono text-[10px] leading-4 text-muted-foreground transition-colors hover:text-foreground","aria-label":E.title,children:E.label})}),a.jsx(Be,{children:E.title})]})})]},C)})}),!v&&a.jsxs("div",{className:"flex items-center justify-between gap-2 rounded-md border border-amber-500/25 bg-amber-500/6 px-2 py-1.5 text-xs text-muted-foreground",children:[a.jsx("span",{children:"Context window metadata missing"}),a.jsxs("div",{className:"flex shrink-0 items-center gap-1",children:[a.jsxs(Ae,{type:"button",variant:"outline",size:"sm",onClick:()=>c?.(e.id),className:"h-6 gap-1 px-2 text-xs",disabled:u,children:[a.jsx(Oi,{className:`size-3 ${u?"animate-spin":""}`}),S]}),!k&&a.jsx(Ae,{type:"button",variant:"ghost",size:"sm",onClick:()=>s(e),className:"h-6 px-2 text-xs",children:"Set URL"})]})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("code",{className:"text-xs text-muted-foreground bg-muted px-2 py-1 rounded flex-1 truncate",children:d?e.apiKey:Ug(e.apiKey)}),a.jsx("button",{type:"button",onClick:()=>f(C=>!C),className:"text-muted-foreground hover:text-foreground transition-colors p-1","aria-label":d?"Hide API key":"Show API key",children:d?a.jsx(Oa,{className:"size-4"}):a.jsx(Ma,{className:"size-4"})}),a.jsx("button",{type:"button",onClick:g,className:"text-muted-foreground hover:text-foreground transition-colors p-1","aria-label":"Copy API key",children:h?a.jsx(rt,{className:"size-4 text-green-500"}):a.jsx(_t,{className:"size-4"})})]}),e.anthropicBaseUrl!==void 0&&e.anthropicBaseUrl!==""&&a.jsxs("div",{className:"flex min-w-0 flex-col gap-2",children:[a.jsxs("div",{className:"min-w-0 text-xs text-muted-foreground",children:[a.jsx("span",{className:"font-medium",children:"Anthropic:"})," ",a.jsx("span",{className:"truncate",children:e.anthropicBaseUrl})]}),t!==void 0&&a.jsx(wo,{results:t.anthropic})]}),e.openaiBaseUrl!==void 0&&e.openaiBaseUrl!==""&&a.jsxs("div",{className:"flex min-w-0 flex-col gap-2",children:[a.jsxs("div",{className:"min-w-0 text-xs text-muted-foreground",children:[a.jsx("span",{className:"font-medium",children:"OpenAI:"})," ",a.jsx("span",{className:"truncate",children:e.openaiBaseUrl})]}),t!==void 0&&a.jsx(wo,{results:t.openai})]}),t?.testedAt!==void 0&&a.jsxs("div",{className:"text-xs text-muted-foreground flex items-center gap-1",children:[a.jsx(hn,{className:"size-3"}),a.jsxs("span",{children:["Tested ",bR(t.testedAt)]})]}),t?.models!==void 0&&Object.keys(t.models).length>0&&a.jsxs("div",{className:"border-t pt-2",children:[a.jsxs("button",{type:"button",onClick:()=>m(C=>!C),className:"text-xs text-muted-foreground hover:text-foreground transition-colors flex items-center gap-1",children:[y?a.jsx(Zt,{className:"size-3"}):a.jsx(on,{className:"size-3"}),"Model Test Results (",Object.keys(t.models).length,")"]}),y&&a.jsx("div",{className:"mt-2 overflow-x-auto",children:a.jsxs("table",{className:"w-full text-xs border-collapse",children:[a.jsx("thead",{children:a.jsxs("tr",{className:"border-b border-border",children:[a.jsx("th",{className:"text-left py-1 px-2 font-medium text-muted-foreground",children:"Model"}),e.anthropicBaseUrl!==void 0&&e.anthropicBaseUrl!==""&&a.jsx("th",{className:"text-left py-1 px-2 font-medium text-muted-foreground",children:"Anthropic"}),e.openaiBaseUrl!==void 0&&e.openaiBaseUrl!==""&&a.jsx("th",{className:"text-left py-1 px-2 font-medium text-muted-foreground",children:"OpenAI"})]})}),a.jsx("tbody",{children:Object.entries(t.models).map(([C,j])=>a.jsxs("tr",{className:"border-b border-border/50 last:border-0",children:[a.jsx("td",{className:"py-1 px-2 font-medium",children:C}),e.anthropicBaseUrl!==void 0&&e.anthropicBaseUrl!==""&&a.jsx("td",{className:"py-1 px-2 align-top",children:a.jsx(wo,{results:j.anthropic})}),e.openaiBaseUrl!==void 0&&e.openaiBaseUrl!==""&&a.jsx("td",{className:"py-1 px-2 align-top",children:a.jsx(wo,{results:j.openai})})]},C))})]})})]}),a.jsxs("div",{className:"flex gap-2 pt-1 border-t",children:[l!==void 0&&a.jsxs(Ae,{variant:"outline",size:"sm",onClick:()=>l(e.id),className:"text-xs h-7 gap-1",disabled:n??!1,children:[a.jsx(Oi,{className:`size-3 ${n??!1?"animate-spin":""}`}),n??!1?r!==void 0?`Testing (${r}s)`:"Testing...":"Test"]}),a.jsxs(Ae,{variant:"outline",size:"sm",onClick:()=>s(e),className:"text-xs h-7 gap-1",disabled:n??!1,children:[a.jsx(zf,{className:"size-3"}),"Edit"]}),a.jsxs(Ae,{variant:"outline",size:"sm",onClick:()=>i(e.id),className:"text-xs h-7 gap-1 text-destructive hover:text-destructive",disabled:n??!1,children:[a.jsx(Lr,{className:"size-3"}),"Delete"]})]})]})}const rd=["zhipu","zhipuai","bigmodel","z.ai","zai","glm"],od=["zhipu coding","glm coding","bigmodel coding","z.ai coding","zai coding"],wR={deepseek:{openaiBaseUrl:"https://api.deepseek.com"},minimax:{anthropicBaseUrl:"https://api.minimaxi.com/anthropic",apiDocsUrl:"https://platform.minimaxi.com/docs/api-reference/api-overview"},"zhipu coding":{anthropicBaseUrl:"https://open.bigmodel.cn/api/anthropic",openaiBaseUrl:"https://open.bigmodel.cn/api/coding/paas/v4",apiDocsUrl:"https://docs.bigmodel.cn/cn/coding-plan/quick-start"},"glm coding":{anthropicBaseUrl:"https://open.bigmodel.cn/api/anthropic",openaiBaseUrl:"https://open.bigmodel.cn/api/coding/paas/v4",apiDocsUrl:"https://docs.bigmodel.cn/cn/coding-plan/quick-start"},"bigmodel coding":{anthropicBaseUrl:"https://open.bigmodel.cn/api/anthropic",openaiBaseUrl:"https://open.bigmodel.cn/api/coding/paas/v4",apiDocsUrl:"https://docs.bigmodel.cn/cn/coding-plan/quick-start"},"z.ai coding":{anthropicBaseUrl:"https://open.bigmodel.cn/api/anthropic",openaiBaseUrl:"https://open.bigmodel.cn/api/coding/paas/v4",apiDocsUrl:"https://docs.bigmodel.cn/cn/coding-plan/quick-start"},"zai coding":{anthropicBaseUrl:"https://open.bigmodel.cn/api/anthropic",openaiBaseUrl:"https://open.bigmodel.cn/api/coding/paas/v4",apiDocsUrl:"https://docs.bigmodel.cn/cn/coding-plan/quick-start"},zhipu:{openaiBaseUrl:"https://open.bigmodel.cn/api/paas/v4",apiDocsUrl:"https://docs.bigmodel.cn/cn/guide/develop/openai/introduction"},zhipuai:{openaiBaseUrl:"https://open.bigmodel.cn/api/paas/v4",apiDocsUrl:"https://docs.bigmodel.cn/cn/guide/develop/openai/introduction"},bigmodel:{openaiBaseUrl:"https://open.bigmodel.cn/api/paas/v4",apiDocsUrl:"https://docs.bigmodel.cn/cn/guide/develop/openai/introduction"},"z.ai":{openaiBaseUrl:"https://open.bigmodel.cn/api/paas/v4",apiDocsUrl:"https://docs.bigmodel.cn/cn/guide/develop/openai/introduction"},zai:{openaiBaseUrl:"https://open.bigmodel.cn/api/paas/v4",apiDocsUrl:"https://docs.bigmodel.cn/cn/guide/develop/openai/introduction"},glm:{openaiBaseUrl:"https://open.bigmodel.cn/api/paas/v4",apiDocsUrl:"https://docs.bigmodel.cn/cn/guide/develop/openai/introduction"},alibaba:{openaiBaseUrl:"https://dashscope.aliyuncs.com/compatible-mode"}},sd=["MiniMax M3","MiniMax M2.7","MiniMax M2.7-highspeed","MiniMax M2.5","MiniMax M2.5-highspeed","MiniMax M2.1","MiniMax M2.1-highspeed","MiniMax M2"],id=["glm-5","glm-5.1","glm-5.2","qwen3.6-plus","qwen3.7-max"],ad=["glm-5.2","glm-5.1","glm-5","glm-5-turbo","glm-4.7","glm-4.7-flashx","glm-4.6","glm-4.5","glm-4.5-air","glm-4.5-x","glm-4.5-airx","glm-4.5-flash"],ga="__unset__",rs="__custom__",Hg=[{value:"32K",label:"Small"},{value:"64K",label:"Standard"},{value:"128K",label:"Medium"},{value:"200K",label:"Long"},{value:"256K",label:"Extended"},{value:"512K",label:"Large"},{value:"1M",label:"Max"}];function Sn(){return{contextWindow:"",contextWindowMode:"unset",outputLimit:""}}function ld(e){return e.trim().toLowerCase().replace(/\s+/g,"-")}function Vg(e,t){const n=ld(t);return e?.modelMetadata?.find(r=>ld(r.model)===n)??null}function Zg(e){const t=Fo(e);if(t===null)return null;for(const n of Hg)if(Fo(n.value)===t)return n.value;return null}function kR(e){return e.trim()===""?"unset":Zg(e)!==null?"preset":"custom"}function _R(e){switch(e.contextWindowMode){case"unset":return ga;case"custom":return rs;case"preset":return Zg(e.contextWindow)??rs}}function ki(e){const t=e.trim().replaceAll(",","");if(t==="")return{amount:"",unit:"K"};const n=/^(\d+(?:\.\d+)?)\s*([kKmM])?$/.exec(t);if(n===null)return{amount:t,unit:"K"};const r=n[1];if(r===void 0)return{amount:t,unit:"K"};const o=n[2];if(o===void 0||o==="")return{amount:r,unit:"tokens"};switch(o.toLowerCase()){case"k":return{amount:r,unit:"K"};case"m":return{amount:r,unit:"M"};default:return{amount:t,unit:"K"}}}function cd(e,t){const n=e.trim();if(n==="")return"";switch(t){case"K":return`${n}K`;case"M":return`${n}M`;case"tokens":return n}}function ud(e,t){return t.map(n=>{const r=Vg(e,n),o=r?.contextWindow!==void 0?Ek(r.contextWindow):"";return{contextWindow:o,contextWindowMode:kR(o),outputLimit:r?.outputLimit?.toString()??""}})}function dd(e){const t=e.trim();if(t==="")return null;const n=Number(t);return!Number.isInteger(n)||n<=0?null:n}function SR({provider:e,onSubmit:t,onCancel:n}){const[r,o]=x.useState(e?.name??""),[s,i]=x.useState(e?.apiKey??""),[l,c]=x.useState(!1),[u,d]=x.useState(!1),f=e?.models,[h,p]=x.useState(f!==void 0&&f.length>0?f:[""]),[y,m]=x.useState(()=>ud(e,f!==void 0&&f.length>0?f:[""])),[g,b]=x.useState("anthropic"),[v,k]=x.useState(e?.anthropicBaseUrl??""),[S,C]=x.useState(e?.openaiBaseUrl??""),[j,E]=x.useState(e?.apiDocsUrl??""),[T,z]=x.useState(e?.modelMetadataUrl??""),[O,B]=x.useState(e?.source),[N,D]=x.useState({}),[w,L]=x.useState(!1),[W,U]=x.useState(null),F=x.useRef([]);x.useEffect(()=>{if(W===null)return;const Z=W;function J(H){if(!(H.target instanceof Node))return;const se=F.current[Z];se!=null&&!se.contains(H.target)&&U(null)}return document.addEventListener("mousedown",J),()=>document.removeEventListener("mousedown",J)},[W]);const[K,I]=x.useState(!1),[V,G]=x.useState(!1),R=r.toLowerCase().includes("minimax"),ae=r.toLowerCase().includes("alibaba"),oe=[...rd,...od].some(Z=>r.toLowerCase().includes(Z)),fe=R?sd:oe?ad:ae?id:[],le=e?.modelMetadata?.some(Z=>Z.contextWindow!==void 0)??!1;function de(){navigator.clipboard.writeText(s).catch(()=>{}),d(!0),setTimeout(()=>d(!1),2e3)}x.useEffect(()=>{if(e){o(e.name),i(e.apiKey);const Z=(e.models?.length??0)>0?e.models:[""];p(Z),m(ud(e,Z)),k(e.anthropicBaseUrl??""),C(e.openaiBaseUrl??""),E(e.apiDocsUrl??""),z(e.modelMetadataUrl??""),B(e.source),I(!1),G(!1)}},[e]),x.useEffect(()=>{const Z=r.toLowerCase();for(const[J,H]of Object.entries(wR))if(Z.includes(J)){H.anthropicBaseUrl!==void 0&&!K&&k(H.anthropicBaseUrl),H.openaiBaseUrl!==void 0&&!V&&C(H.openaiBaseUrl),H.apiDocsUrl!==void 0&&!j&&E(H.apiDocsUrl),J==="minimax"&&h.length===1&&h[0]===""&&p([sd[0]??""]),J==="alibaba"&&h.length===1&&h[0]===""&&p([id[0]??""]),(rd.includes(J)||od.includes(J))&&h.length===1&&h[0]===""&&p([ad[0]??""]);break}},[r]);function pe(){const Z={};return r.trim()||(Z.name="Name is required"),s.trim()||(Z.apiKey="API key is required"),(h.length===0||h.every(J=>!J.trim()))&&(Z.models="At least one model is required"),v.trim()&&!he(v.trim())&&(Z.anthropicBaseUrl="Invalid URL format"),S.trim()&&!he(S.trim())&&(Z.openaiBaseUrl="Invalid URL format"),T.trim()&&!he(T.trim())&&(Z.modelMetadataUrl="Invalid URL format"),y.forEach((J,H)=>{const se=Fo(J.contextWindow),Y=dd(J.outputLimit);J.contextWindow.trim()!==""&&se===null&&(Z[`modelMetadata.${H}.contextWindow`]="Context window must be a positive number, optionally using K or M"),J.outputLimit.trim()!==""&&Y===null&&(Z[`modelMetadata.${H}.outputLimit`]="Output limit must be a positive integer"),se!==null&&Y!==null&&Y>se&&(Z[`modelMetadata.${H}.outputLimit`]="Output limit should not exceed context window")}),!v.trim()&&!S.trim()&&(Z.format="At least one format URL (Anthropic or OpenAI) is required"),D(Z),Object.keys(Z).length===0}function he(Z){try{return new URL(Z),!0}catch{return!1}}function me(Z,J){p(H=>{const se=[...H];return se[Z]=J,se})}function _e(Z,J){m(H=>{const se=[...H];return se[Z]={...se[Z]??Sn(),...J},se})}function Pe(Z,J){switch(J){case ga:_e(Z,{contextWindow:"",contextWindowMode:"unset"});return;case rs:{const H=y[Z]??Sn();_e(Z,{contextWindow:H.contextWindow,contextWindowMode:"custom"});return}default:_e(Z,{contextWindow:J,contextWindowMode:"preset"});return}}function _(Z,J){const H=y[Z]??Sn(),se=ki(H.contextWindow);_e(Z,{contextWindow:cd(J,se.unit),contextWindowMode:"custom"})}function ne(Z,J){const H=y[Z]??Sn(),se=ki(H.contextWindow);switch(J){case"K":case"M":case"tokens":_e(Z,{contextWindow:cd(se.amount,J),contextWindowMode:"custom"});return;default:return}}function Q(Z){p(J=>J.filter((H,se)=>se!==Z)),m(J=>J.filter((H,se)=>se!==Z))}function M(){p(Z=>[...Z,""]),m(Z=>[...Z,Sn()])}function P(){const Z=new Date().toISOString(),J=[];return h.forEach((H,se)=>{const Y=H.trim();if(Y==="")return;const ee=y[se]??Sn(),$=Fo(ee.contextWindow),X=dd(ee.outputLimit);if($===null&&X===null)return;const ce=Vg(e,Y);if(ce!==null&&ce.contextWindow===($??void 0)&&ce.outputLimit===(X??void 0)){J.push({...ce,model:Y});return}const xe={model:Y,source:"manual",updatedAt:Z};$!==null&&(xe.contextWindow=$),X!==null&&(xe.outputLimit=X),J.push(xe)}),J.length>0?J:e?.modelMetadata!==void 0?[]:void 0}function q(Z){if(Z.preventDefault(),!!pe()){L(!0);try{t({name:r.trim(),apiKey:s.trim(),models:h.map(J=>J.trim()).filter(J=>J!==""),anthropicBaseUrl:v.trim()||void 0,openaiBaseUrl:S.trim()||void 0,apiDocsUrl:j.trim()||void 0,modelMetadataUrl:T.trim()||void 0,modelMetadata:P(),source:O})}finally{L(!1)}}}return a.jsxs("form",{onSubmit:q,className:"space-y-4",children:[a.jsxs("div",{className:"space-y-2",children:[a.jsxs("label",{htmlFor:"provider-name",className:"text-sm font-medium",children:["Name ",a.jsx("span",{className:"text-destructive",children:"*"})]}),a.jsx("input",{id:"provider-name",type:"text",value:r,onChange:Z=>o(Z.target.value),placeholder:"Provider 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"}),N.name!==void 0&&a.jsx("p",{className:"text-xs text-destructive",children:N.name})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx("label",{htmlFor:"provider-source",className:"text-sm font-medium",children:"Token Source"}),a.jsxs("select",{id:"provider-source",value:O??"",onChange:Z=>B(Z.target.value==="company"||Z.target.value==="personal"?Z.target.value:void 0),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:[a.jsx("option",{value:"",children:"—"}),a.jsx("option",{value:"personal",children:"个人 (Personal)"}),a.jsx("option",{value:"company",children:"公司 (Company)"})]}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"Label whether this API key is company-provided or personal."})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx("label",{htmlFor:"provider-model-metadata-url",className:"text-sm font-medium",children:"Model Metadata URL"}),a.jsx("input",{id:"provider-model-metadata-url",type:"text",value:T,onChange:Z=>z(Z.target.value),placeholder:"https://example.com/agent-inspector-models.json",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"}),N.modelMetadataUrl!==void 0&&a.jsx("p",{className:"text-xs text-destructive",children:N.modelMetadataUrl}),T.trim()===""&&a.jsx("div",{className:"rounded-md border border-border bg-muted/20 px-3 py-2 text-xs text-muted-foreground",children:"Built-in limits cover DeepSeek v4 pro/flash, MiniMax M3/M2.7/M2.5/M2.1, and GLM coding models. Use a registry URL for private or custom model limits."}),e!==void 0&&!le&&T.trim()===""&&a.jsx("p",{className:"text-xs text-amber-400",children:"This provider has no matching context metadata yet."}),T.trim()!==""&&a.jsx("p",{className:"text-xs text-muted-foreground",children:"Agent Inspector will refresh model limits from this JSON registry after save."})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsxs("label",{htmlFor:"provider-apikey",className:"text-sm font-medium",children:["API Key ",a.jsx("span",{className:"text-destructive",children:"*"})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("input",{id:"provider-apikey",type:"text",value:l||s.length===0?s:Ug(s),onChange:Z=>i(Z.target.value),onFocus:()=>{!l&&s.length>0&&c(!0)},placeholder:"sk-ant-...",readOnly:!l&&s.length>0,className:"flex-1 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"}),a.jsx("button",{type:"button",onClick:()=>c(Z=>!Z),className:"text-muted-foreground hover:text-foreground transition-colors p-1 shrink-0","aria-label":l?"Hide API key":"Show API key",children:l?a.jsx(Oa,{className:"size-4"}):a.jsx(Ma,{className:"size-4"})}),a.jsx("button",{type:"button",onClick:de,className:"text-muted-foreground hover:text-foreground transition-colors p-1 shrink-0","aria-label":"Copy API key",children:u?a.jsx(rt,{className:"size-4 text-green-500"}):a.jsx(_t,{className:"size-4"})})]}),N.apiKey!==void 0&&a.jsx("p",{className:"text-xs text-destructive",children:N.apiKey})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsxs("label",{className:"text-sm font-medium",children:["Models ",a.jsx("span",{className:"text-destructive",children:"*"})]}),h.map((Z,J)=>{const H=y[J]??Sn(),se=N[`modelMetadata.${J}.contextWindow`],Y=N[`modelMetadata.${J}.outputLimit`],ee=_R(H),$=ki(H.contextWindow);return a.jsxs("div",{ref:X=>{F.current[J]=X},className:"space-y-2 rounded-md border border-border bg-muted/10 p-2",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsxs("div",{className:"relative flex-1",children:[a.jsx("input",{type:"text",value:Z,onChange:X=>me(J,X.target.value),placeholder:fe.length>0?"Type or select a model...":"Model name",className:"w-full rounded-md border border-input bg-background px-4 py-3 pr-8 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"}),fe.length>0&&a.jsxs(a.Fragment,{children:[a.jsx("button",{type:"button",onClick:()=>U(W===J?null:J),className:"absolute right-1 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground transition-colors p-1 z-10","aria-label":"Show model suggestions",children:a.jsx(Zt,{className:"size-4"})}),W===J&&a.jsx("div",{className:"absolute left-0 right-0 top-full mt-1 z-50 bg-popover border border-border rounded-md shadow-md max-h-48 overflow-y-auto",children:fe.map(X=>a.jsx("button",{type:"button",onClick:()=>{me(J,X),U(null)},className:"w-full text-left px-3 py-2 text-sm hover:bg-muted transition-colors",children:X},X))})]})]}),h.length>1&&a.jsx("button",{type:"button",onClick:()=>Q(J),className:"text-muted-foreground hover:text-destructive transition-colors p-1 shrink-0","aria-label":"Remove model",children:a.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[a.jsx("path",{d:"M3 6h18"}),a.jsx("path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6"}),a.jsx("path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2"})]})})]}),a.jsxs("div",{className:"grid gap-2 sm:grid-cols-2",children:[a.jsxs("div",{className:"space-y-1 text-xs text-muted-foreground",children:[a.jsx("span",{children:"Context Window"}),a.jsxs(Qo,{value:ee,onValueChange:X=>Pe(J,X),children:[a.jsx(ts,{size:"sm",className:"w-full bg-background font-mono text-xs",children:a.jsx(es,{})}),a.jsxs(ns,{className:"max-h-64",children:[a.jsx(Lt,{value:ga,children:"Not set"}),Hg.map(X=>a.jsxs(Lt,{value:X.value,children:[X.label," · ",X.value]},X.value)),a.jsx(Lt,{value:rs,children:"Custom"})]})]}),H.contextWindowMode==="custom"&&a.jsxs("div",{className:"grid grid-cols-[minmax(0,1fr)_5.75rem] gap-1.5",children:[a.jsx("input",{type:"text",inputMode:"decimal",value:$.amount,onChange:X=>_(J,X.target.value),placeholder:"128",className:"w-full rounded-md border border-input bg-background px-3 py-2 font-mono text-xs text-foreground ring-offset-background placeholder:text-muted-foreground focus-visible:border-ring focus-visible:outline-ring focus-visible:ring-[3px]"}),a.jsxs(Qo,{value:$.unit,onValueChange:X=>ne(J,X),children:[a.jsx(ts,{size:"sm",className:"w-full bg-background font-mono text-xs",children:a.jsx(es,{})}),a.jsxs(ns,{children:[a.jsx(Lt,{value:"K",children:"K"}),a.jsx(Lt,{value:"M",children:"M"}),a.jsx(Lt,{value:"tokens",children:"tokens"})]})]})]}),se!==void 0&&a.jsx("span",{className:"block text-destructive",children:se})]}),a.jsxs("label",{className:"space-y-1 text-xs text-muted-foreground",children:[a.jsx("span",{children:"Output Limit"}),a.jsx("input",{type:"number",min:1,step:1e3,value:H.outputLimit,onChange:X=>_e(J,{outputLimit:X.target.value}),placeholder:"e.g. 8192",className:"w-full rounded-md border border-input bg-background px-3 py-2 font-mono text-xs text-foreground ring-offset-background placeholder:text-muted-foreground focus-visible:border-ring focus-visible:outline-ring focus-visible:ring-[3px]"}),Y!==void 0&&a.jsx("span",{className:"block text-destructive",children:Y})]})]})]},J)}),a.jsx("button",{type:"button",onClick:M,className:"text-xs text-primary hover:underline flex items-center gap-1",children:"+ Add Model"}),N.models!==void 0&&a.jsx("p",{className:"text-xs text-destructive",children:N.models})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsxs("div",{className:"flex gap-1 border-b border-border",children:[a.jsx(tt,{children:a.jsxs(Fe,{children:[a.jsx($e,{asChild:!0,children:a.jsx("button",{type:"button",onClick:()=>b("anthropic"),className:`px-3 py-2 text-sm font-medium border-b-2 transition-colors ${g==="anthropic"?"border-primary text-primary":"border-transparent text-muted-foreground hover:text-foreground"}`,children:"Anthropic Format"})}),a.jsx(Be,{children:"Anthropic Messages API protocol"})]})}),a.jsx(tt,{children:a.jsxs(Fe,{children:[a.jsx($e,{asChild:!0,children:a.jsx("button",{type:"button",onClick:()=>b("openai"),className:`px-3 py-2 text-sm font-medium border-b-2 transition-colors ${g==="openai"?"border-primary text-primary":"border-transparent text-muted-foreground hover:text-foreground"}`,children:"OpenAI Format"})}),a.jsx(Be,{children:"OpenAI Chat Completions API protocol"})]})})]}),N.format!==void 0&&a.jsx("p",{className:"text-xs text-destructive",children:N.format})]}),g==="anthropic"&&a.jsxs("div",{className:"space-y-2",children:[a.jsx("label",{htmlFor:"provider-anthropic-base-url",className:"text-sm font-medium",children:"Anthropic Base URL"}),a.jsx("input",{id:"provider-anthropic-base-url",type:"text",value:v,onChange:Z=>{I(!0),k(Z.target.value)},placeholder:"https://api.anthropic.com",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"}),N.anthropicBaseUrl!==void 0&&a.jsx("p",{className:"text-xs text-destructive",children:N.anthropicBaseUrl}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"Anthropic-compatible endpoint URL. Leave empty if this provider does not support Anthropic format."})]}),g==="openai"&&a.jsxs("div",{className:"space-y-2",children:[a.jsx("label",{htmlFor:"provider-openai-base-url",className:"text-sm font-medium",children:"OpenAI Base URL"}),a.jsx("input",{id:"provider-openai-base-url",type:"text",value:S,onChange:Z=>{G(!0),C(Z.target.value)},placeholder:"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"}),N.openaiBaseUrl!==void 0&&a.jsx("p",{className:"text-xs text-destructive",children:N.openaiBaseUrl}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"OpenAI-compatible endpoint URL. Leave empty if this provider does not support OpenAI format."})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx("label",{htmlFor:"provider-api-docs-url",className:"text-sm font-medium",children:"API Docs URL"}),a.jsx("input",{id:"provider-api-docs-url",type:"text",value:j,onChange:Z=>E(Z.target.value),placeholder:"https://api.example.com/docs",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"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"Optional API documentation URL. If not set, uses known provider docs."})]}),a.jsxs("div",{className:"sticky bottom-0 bg-card border-t flex gap-2 justify-end pt-2 pb-2",children:[a.jsx(Ae,{type:"button",variant:"outline",onClick:n,disabled:w,children:"Cancel"}),a.jsx(Ae,{type:"submit",disabled:w,children:w?"Saving...":e?"Update Provider":"Add Provider"})]})]})}const CR=Re(["timeout","network_unreachable","connection_refused","auth_failed","rate_limited","server_error","invalid_response","unknown"]),jR=te({message:A(),type:CR,details:A().optional(),hint:A().optional()}),NR=te({type:Re(["text","thinking"]),text:A().optional(),thinking:A().optional()}),ER=te({requestUrl:A().optional(),requestMethod:A().optional(),requestHeaders:nt(A(),A()).optional(),requestBody:A().optional(),responseStatus:ie().optional(),responseStatusText:A().optional(),responseHeaders:nt(A(),A()).optional(),responseBody:A().optional()}),TR=te({success:Ze(),error:jR.optional(),model:A().optional(),inputTokens:ie().optional(),outputTokens:ie().optional(),cacheCreationInputTokens:ie().optional(),cacheReadInputTokens:ie().optional(),latencyMs:ie().optional(),firstChunkMs:ie().nullable().optional(),totalStreamMs:ie().nullable().optional(),tokensPerSecond:ie().nullable().optional(),content:we(NR).optional(),rawResponse:A().optional(),streaming:Ze().optional(),streamingChunks:te({chunks:we(Sf),truncated:Ze().default(!1)}).optional(),requestHeaders:nt(A(),A()).optional(),debug:ER.optional()}),fd=rn([TR,te({notConfigured:je(!0)}),te({testing:je(!0)})]),os=te({nonStreaming:fd,streaming:fd}),AR=te({anthropic:os,openai:os}),IR=te({anthropic:os,openai:os,models:nt(A(),AR).optional(),testedAt:A().optional()});function zR(){return{anthropic:{nonStreaming:{testing:!0},streaming:{testing:!0}},openai:{nonStreaming:{testing:!0},streaming:{testing:!0}}}}function pd(e,t){const n=()=>({nonStreaming:{success:!1,error:{message:e,type:t}},streaming:{notConfigured:!0}});return{anthropic:n(),openai:n()}}const RR=te({providerConfig:A()}),PR=te({success:Ze().optional(),imported:ie().optional(),message:A().optional(),errors:we(A()).optional()}),OR=te({provider:$o,imported:ie(),matchedModels:we(A()),missingModels:we(A()),sourceUrl:A()}),ko="Network error: could not reach the server. Is the proxy running?";function hd(e){return{name:e.name,apiKey:e.apiKey,models:e.models,anthropicBaseUrl:(e.anthropicBaseUrl?.length??0)>0?e.anthropicBaseUrl:void 0,openaiBaseUrl:(e.openaiBaseUrl?.length??0)>0?e.openaiBaseUrl:void 0,apiDocsUrl:(e.apiDocsUrl?.length??0)>0?e.apiDocsUrl:void 0,modelMetadataUrl:(e.modelMetadataUrl?.length??0)>0?e.modelMetadataUrl:void 0,modelMetadata:e.modelMetadata,source:e.source}}function MR(e,t){const n=e?.models?.map(r=>r.trim()).filter(r=>r!=="").length??0;return Math.max(1,n)*t}async function LR(e,t){if(t.models!==void 0)try{await fetch(`/api/providers/${e}/test/log`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)})}catch{}}function DR({externalProviders:e,isLoading:t=!1,externalTestResults:n,externalTestingProviders:r,externalTestingTimeLeft:o,onProvidersMutate:s,onTestResultsChange:i,onTestingProvidersChange:l,onTestingTimeLeftChange:c}){const[u,d]=x.useState(!1),[f,h]=x.useState(),[p,y]=x.useState(null),[m,g]=x.useState({}),[b,v]=x.useState(new Set),[k,S]=x.useState({}),[C,j]=x.useState(null),[E,T]=x.useState(!1),[z,O]=x.useState(null),[B,N]=x.useState(!1),[D,w]=x.useState(!1),[L,W]=x.useState(null),[U,F]=x.useState("all"),[K,I]=x.useState(new Set),{providerTestTimeoutSeconds:V}=Ra(),G=x.useRef(null),R=x.useRef(null),ae=e??[],oe=x.useMemo(()=>{const Y=U==="all"?ae:ae.filter(ee=>ee.source===U);return U==="all"?[...Y].sort((ee,$)=>{const X={personal:0,company:1};return(X[ee.source??""]??2)-(X[$.source??""]??2)}):Y},[ae,U]),fe=n??m,le=r??b,de=o??k,pe=c?(Y,ee)=>c(Y,ee):(Y,ee)=>{S(ee===void 0?$=>{const X={...$};return delete X[Y],X}:$=>({...$,[Y]:ee}))};x.useEffect(()=>{(async()=>{try{const Y=await fetch("/api/config/paths");if(Y.ok){const ee=await It(Y,RR);j(ee.providerConfig)}}catch{}})()},[]);const he=x.useCallback(Y=>{R.current!==null&&clearTimeout(R.current),O(Y),G.current?.scrollTo({top:G.current.scrollHeight,behavior:"smooth"}),R.current=setTimeout(()=>{O(null),R.current=null},2e3)},[]);x.useEffect(()=>()=>{R.current!==null&&clearTimeout(R.current)},[]);const me=x.useCallback(()=>{s?.().catch(()=>{})},[s]),_e=x.useCallback((Y,ee)=>{i?i(Y,ee):g($=>({...$,[Y]:ee}))},[i]),Pe=x.useCallback((Y,ee)=>{if(l){l(Y,ee);return}v($=>{const X=new Set($);return ee?X.add(Y):X.delete(Y),X})},[l]),_=x.useCallback(async Y=>{_e(Y,zR()),Pe(Y,!0);const ee=new AbortController,$=ae.find(Ne=>Ne.id===Y);let ce=MR($,V);pe(Y,ce);const xe=setInterval(()=>{ce--,pe(Y,ce),ce<=0&&(clearInterval(xe),ee.abort())},1e3);try{const Ne=await fetch(`/api/providers/${Y}/test`,{method:"POST",signal:ee.signal});if(Ne.ok){const Ue=await It(Ne,IR);_e(Y,Ue),await LR(Y,Ue)}else _e(Y,pd(`HTTP ${Ne.status}: ${Ne.statusText}`,"server_error"))}catch(Ne){Ne instanceof Error&&Ne.name==="AbortError"&&_e(Y,pd("Request timed out","timeout"))}finally{clearInterval(xe),pe(Y,void 0),Pe(Y,!1)}},[V,ae,pe,_e,Pe]),ne=x.useCallback(async(Y,ee,$=!0)=>{I(X=>{const ce=new Set(X);return ce.add(Y),ce});try{const X=ee!==void 0&&ee.trim()!==""?{url:ee}:{},ce=await fetch(`/api/providers/${Y}/model-metadata`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(X)});if(!ce.ok)return $&&y(await Qt(ce,"Failed to refresh model metadata")),!1;const xe=await It(ce,OR);return xe.imported===0&&$?y("No matching model metadata found for this provider."):y(null),he(xe.provider.id),me(),xe.imported>0}catch{return $&&y(ko),!1}finally{I(X=>{const ce=new Set(X);return ce.delete(Y),ce})}},[me,he]);function Q(Y){(async()=>{try{const ee=await fetch("/api/providers",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(hd(Y))});if(!ee.ok){y(await Qt(ee,"Failed to add provider"));return}const $=await It(ee,$o);d(!1),he($.id),Y.modelMetadataUrl!==void 0&&Y.modelMetadataUrl.trim()!==""&&await ne($.id,Y.modelMetadataUrl,!1),me(),await _($.id)}catch{y(ko)}})()}function M(Y){f&&(async()=>{try{const ee=await fetch(`/api/providers/${f.id}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(hd(Y))});if(!ee.ok){y(await Qt(ee,"Failed to update provider"));return}const $=await It(ee,$o);h(void 0),he($.id),Y.modelMetadataUrl!==void 0&&Y.modelMetadataUrl.trim()!==""&&await ne($.id,Y.modelMetadataUrl,!1),me(),((Y.apiKey??"")!==(f.apiKey??"")||JSON.stringify(Y.models)!==JSON.stringify(f.models)||(Y.anthropicBaseUrl??"")!==(f.anthropicBaseUrl??"")||(Y.openaiBaseUrl??"")!==(f.openaiBaseUrl??""))&&await _($.id)}catch{y(ko)}})()}function P(Y){W(Y),w(!0)}function q(){const Y=L;Y!==null&&(async()=>{let ee;try{ee=await fetch(`/api/providers/${Y}`,{method:"DELETE"})}catch{y(ko);return}if(!ee.ok){y(await Qt(ee,"Failed to delete provider"));return}me()})()}const Z=x.useRef(null);function J(Y){const ee="/api/providers/export";(async()=>{try{const $=await fetch(ee);if(!$.ok){y("Failed to export providers");return}const X=await $.blob(),ce=URL.createObjectURL(X),xe=document.createElement("a");xe.href=ce,xe.download=$.headers.get("Content-Disposition")?.match(/filename="(.+)"/)?.[1]??"providers.json",document.body.appendChild(xe),xe.click(),document.body.removeChild(xe),URL.revokeObjectURL(ce)}catch{y("Failed to export providers")}})()}function H(){Z.current?.click()}function se(Y){const ee=Y.target.files?.[0];ee&&(async()=>{try{const $=await ee.text(),X=await fetch("/api/providers/import",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify($)}),ce=await It(X,PR);X.ok&&ce.imported!==void 0&&ce.imported>0?(me(),y(null)):ce.errors&&ce.errors.length>0?y(ce.errors.join("; ")):y(ce.message??"Import failed")}catch{y("Failed to import providers")}Y.target.value=""})()}return t?a.jsx("div",{className:"flex items-center justify-center py-8",children:a.jsx("p",{className:"text-sm text-muted-foreground",children:"Loading providers..."})}):u||f?a.jsxs("div",{className:"space-y-4",children:[a.jsx("div",{className:"flex items-center justify-between sticky top-0 bg-background z-10 pb-2",children:a.jsx("h3",{className:"text-lg font-medium",children:f?"Edit Provider":"Add New Provider"})}),a.jsx(SR,{provider:f,onSubmit:f?M:Q,onCancel:()=>{d(!1),h(void 0)}})]}):a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"flex items-center justify-between sticky top-0 z-10 bg-background pb-2",children:[a.jsx("h3",{className:"text-lg font-medium",children:"Providers"}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(tt,{children:a.jsxs(Fe,{children:[a.jsx($e,{asChild:!0,children:a.jsxs(Ae,{variant:"outline",size:"sm",onClick:()=>J(),className:"gap-1 hover:bg-muted",children:[a.jsx(ds,{className:"size-3"}),"Export"]})}),a.jsx(Be,{children:"Download providers as JSON for backup or sharing"})]})}),a.jsx(tt,{children:a.jsxs(Fe,{children:[a.jsx($e,{asChild:!0,children:a.jsxs(Ae,{variant:"outline",size:"sm",onClick:H,className:"gap-1 hover:bg-muted",children:[a.jsx(pw,{className:"size-3"}),"Import"]})}),a.jsx(Be,{children:"Import providers from an exported JSON file"})]})}),a.jsx("input",{type:"file",ref:Z,accept:".json",onChange:se,style:{display:"none"}}),a.jsx(tt,{children:a.jsxs(Fe,{children:[a.jsx($e,{asChild:!0,children:a.jsxs(Ae,{variant:"outline",size:"sm",onClick:()=>N(!0),className:"gap-1",children:[a.jsx(tw,{className:"size-3"}),"Scan"]})}),a.jsx(Be,{children:"Detect and import provider configs from Claude Code and OpenCode"})]})}),a.jsxs(Ae,{onClick:()=>d(!0),size:"sm",className:"gap-1",children:[a.jsx(Ri,{className:"size-4"}),"Add Provider"]})]})]}),C!==null&&a.jsxs("div",{className:"flex items-center gap-2 text-xs text-muted-foreground bg-muted/30 rounded-md px-3 py-2",children:[a.jsx("span",{className:"shrink-0",children:"Config:"}),a.jsx("span",{className:"font-mono truncate",title:C,children:C}),a.jsx(tt,{children:a.jsxs(Fe,{children:[a.jsx($e,{asChild:!0,children:a.jsx("button",{type:"button",onClick:()=>{window.navigator.clipboard.writeText(C).then(()=>{T(!0),setTimeout(()=>T(!1),2e3)})},className:"shrink-0 ml-auto text-muted-foreground hover:text-foreground transition-colors",children:E?a.jsx(rt,{className:"size-3 text-green-500"}):a.jsx(_t,{className:"size-3"})})}),a.jsx(Be,{children:"Copy config file path to clipboard"})]})})]}),p!==null&&a.jsxs("div",{className:"flex items-center gap-2 text-sm text-destructive bg-destructive/10 rounded-md px-3 py-2",children:[a.jsx(Mr,{className:"size-4 shrink-0"}),p]}),ae.length===0?a.jsxs("div",{className:"text-center py-12 space-y-3",children:[a.jsx("p",{className:"text-sm text-muted-foreground",children:"No providers configured yet."}),a.jsxs(Ae,{onClick:()=>d(!0),variant:"outline",size:"sm",children:[a.jsx(Ri,{className:"size-4"}),"Add Your First Provider"]})]}):a.jsxs("div",{className:"space-y-3",children:[a.jsx("div",{className:"flex gap-1 border-b border-border",children:["all","personal","company"].map(Y=>a.jsx(tt,{children:a.jsxs(Fe,{children:[a.jsx($e,{asChild:!0,children:a.jsx("button",{type:"button",onClick:()=>F(Y),className:`px-3 py-2 text-sm font-medium border-b-2 transition-colors ${U===Y?"border-primary text-primary":"border-transparent text-muted-foreground hover:text-foreground"}`,children:Y==="all"?"All":Y==="personal"?"Personal":"Company"})}),a.jsx(Be,{children:Y==="all"?"Show all providers":Y==="personal"?"Providers you configured yourself":"Providers set by your organization"})]})},Y))}),a.jsx("div",{ref:G,className:"space-y-3",children:oe.map(Y=>a.jsx(vR,{provider:Y,testResults:fe[Y.id],isTesting:le.has(Y.id),testingTimeLeft:de[Y.id],isHighlighted:Y.id===z,onEdit:ee=>h(ee),onDelete:P,onRefreshMetadata:ee=>{ne(ee)},isRefreshingMetadata:K.has(Y.id),onTest:ee=>{_(ee)}},Y.id))})]}),a.jsx(iR,{open:B,onOpenChange:N,onImportComplete:()=>{s!==void 0&&s()}}),a.jsx(gm,{open:D,onOpenChange:w,title:"Delete Provider",description:"Are you sure you want to delete this provider? This action cannot be undone.",confirmLabel:"Delete",variant:"destructive",onConfirm:q})]})}function FR(){const[e,t]=x.useState(!1),[n,r]=x.useState("providers"),{providers:o,isLoading:s,mutate:i}=Jf(),[l,c]=x.useState({}),[u,d]=x.useState(new Set),[f,h]=x.useState({}),p=x.useCallback((g,b)=>{c(v=>({...v,[g]:b}))},[]),y=x.useCallback((g,b)=>{d(v=>{const k=new Set(v);return b?k.add(g):k.delete(g),k})},[]),m=x.useCallback((g,b)=>{h(v=>{if(b===void 0){const k={...v};return delete k[g],k}return{...v,[g]:b}})},[]);return a.jsxs(zs,{open:e,onOpenChange:t,children:[a.jsx(mm,{asChild:!0,children:a.jsxs(Ae,{variant:"ghost",size:"icon",className:"size-8",children:[a.jsx(aw,{className:"size-4"}),a.jsx("span",{className:"sr-only",children:"Settings"})]})}),a.jsxs(Rs,{className:"max-w-2xl max-h-[80vh] overflow-hidden flex flex-col",children:[a.jsx(Ps,{children:a.jsx(Os,{children:"Settings"})}),a.jsxs(_m,{value:n,onValueChange:r,className:"flex-1 overflow-hidden",children:[a.jsxs(Sm,{children:[a.jsx(Tt,{value:"providers",children:"Providers"}),a.jsx(Tt,{value:"proxy",children:"Proxy"}),a.jsx(Tt,{value:"storage",children:"Storage"}),a.jsx(Tt,{value:"onboarding",children:"Onboarding"})]}),a.jsxs("div",{className:"mt-4 flex-1 overflow-x-hidden overflow-y-auto pr-3",children:[a.jsx(At,{value:"providers",children:a.jsx(DR,{externalProviders:o,isLoading:s,externalTestResults:l,externalTestingProviders:u,externalTestingTimeLeft:f,onProvidersMutate:()=>i(),onTestResultsChange:p,onTestingProvidersChange:y,onTestingTimeLeftChange:m})}),a.jsx(At,{value:"proxy",children:a.jsx(WR,{})}),a.jsx(At,{value:"storage",children:a.jsx(BR,{})}),a.jsx(At,{value:"onboarding",children:a.jsx(UR,{})})]})]})]})]})}const $R=te({memoryCount:ie(),logDir:A(),logFileCount:ie(),logBytes:ie(),chunkDir:A(),chunkFileCount:ie(),chunkBytes:ie()});function md(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KiB`:e<1024*1024*1024?`${(e/1024/1024).toFixed(1)} MiB`:`${(e/1024/1024/1024).toFixed(1)} GiB`}function BR(){const[e,t]=x.useState(null),[n,r]=x.useState(null),[o,s]=x.useState(!1),[i,l]=x.useState(null),c=x.useCallback(async()=>{s(!0),r(null);try{const d=await fetch("/api/logs?stats=1");if(!d.ok){r(`Failed to load storage stats: HTTP ${String(d.status)}`);return}const f=await d.json(),h=$R.safeParse(f);if(!h.success){r("Storage stats response was not valid.");return}t(h.data)}catch(d){r(d instanceof Error?d.message:String(d))}finally{s(!1)}},[]);x.useEffect(()=>{c()},[c]);const u=x.useCallback((d,f)=>{window.navigator.clipboard.writeText(f).then(()=>{l(d),setTimeout(()=>l(null),1600)})},[]);return a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"flex items-center justify-between gap-3",children:[a.jsxs("div",{children:[a.jsx("h3",{className:"text-sm font-semibold",children:"Log storage"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"Inspect local log and streaming chunk footprint before exporting or clearing sessions."})]}),a.jsx(Ae,{type:"button",variant:"outline",size:"sm",onClick:()=>{c()},children:o?"Refreshing...":"Refresh"})]}),e!==null&&a.jsxs("div",{className:"grid gap-2 text-xs",children:[a.jsx(xa,{id:"log-dir",label:"Log storage path",value:e.logDir,copiedId:i,onCopy:u}),a.jsx(xa,{id:"chunk-dir",label:"Streaming chunks storage path",value:e.chunkDir,copiedId:i,onCopy:u}),a.jsxs("div",{className:"rounded-md border border-border bg-muted/20 px-3 py-2",children:[a.jsx("div",{className:"font-medium",children:"In-memory logs"}),a.jsxs("div",{className:"mt-1 font-mono text-muted-foreground",children:[e.memoryCount.toLocaleString()," loaded"]})]}),a.jsxs("div",{className:"rounded-md border border-border bg-muted/20 px-3 py-2",children:[a.jsx("div",{className:"font-medium",children:"Log files"}),a.jsxs("div",{className:"mt-1 font-mono text-muted-foreground",children:[e.logFileCount.toLocaleString()," files / ",md(e.logBytes)]})]}),a.jsxs("div",{className:"rounded-md border border-border bg-muted/20 px-3 py-2",children:[a.jsx("div",{className:"font-medium",children:"Streaming chunks"}),a.jsxs("div",{className:"mt-1 font-mono text-muted-foreground",children:[e.chunkFileCount.toLocaleString()," files / ",md(e.chunkBytes)]})]})]}),n!==null&&a.jsx("p",{className:"text-xs text-destructive",children:n})]})}function xa({id:e,label:t,value:n,copiedId:r,onCopy:o}){const s=r===e;return a.jsxs("div",{className:"min-w-0 rounded-md border border-border bg-muted/20 px-3 py-2",children:[a.jsx("div",{className:"mb-1 text-xs font-medium text-muted-foreground",children:t}),a.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[a.jsx("code",{className:"min-w-0 flex-1 truncate font-mono text-xs text-foreground",children:n}),a.jsx(Ae,{type:"button",variant:"ghost",size:"icon",className:"size-7 shrink-0",onClick:()=>o(e,n),"aria-label":s?`Copied ${t}`:`Copy ${t}`,children:s?a.jsx(rt,{className:"size-3.5 text-emerald-500"}):a.jsx(_t,{className:"size-3.5"})})]})]})}function UR(){const[e,t]=x.useState(null),n=x.useMemo(()=>typeof window>"u"?"http://localhost:25947":window.location.origin,[]),r=x.useMemo(()=>[{id:"status",label:"Check onboarding",value:"agent-inspector onboard --status"},{id:"status-json",label:"Check onboarding JSON",value:"agent-inspector onboard --status --json"},{id:"refresh",label:"Refresh generated files",value:"agent-inspector onboard --force"},{id:"uninstall",label:"Remove matching generated files",value:"agent-inspector onboard --uninstall"},{id:"claude",label:"Claude Code command",value:"/agent-inspector:onboard"},{id:"codex",label:"Codex prompt",value:"Use the agent-inspector-onboard skill"},{id:"mcp",label:"MCP URL",value:`${n}/api/mcp`},{id:"proxy",label:"Proxy URL",value:`${n}/proxy`},{id:"anthropic",label:"Anthropic base",value:`ANTHROPIC_BASE_URL=${n}/proxy`},{id:"openai",label:"OpenAI base",value:`OPENAI_BASE_URL=${n}/proxy`}],[n]),o=x.useCallback((s,i)=>{window.navigator.clipboard.writeText(i).then(()=>{t(s),setTimeout(()=>t(null),1600)})},[]);return a.jsxs("div",{className:"min-w-0 space-y-4",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(Rf,{className:"size-4 text-muted-foreground"}),a.jsx("h3",{className:"text-sm font-semibold",children:"Agent onboarding"})]}),a.jsx("div",{className:"grid gap-2",children:r.map(s=>a.jsx(xa,{id:s.id,label:s.label,value:s.value,copiedId:e,onCopy:o},s.id))}),a.jsxs("div",{className:"grid gap-2 rounded-md border border-border bg-background px-3 py-2 text-xs text-muted-foreground",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(rt,{className:"size-3.5 text-emerald-500"}),a.jsx("span",{children:"Provider test creates a traceable memory probe session."})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(rt,{className:"size-3.5 text-emerald-500"}),a.jsx("span",{children:"Captured sessions can produce reviewable memory candidates."})]}),a.jsxs("div",{className:"flex items-start gap-2",children:[a.jsx(rt,{className:"mt-0.5 size-3.5 text-emerald-500"}),a.jsxs("span",{children:["Streamable HTTP clients should use the MCP URL directly. Stdio-only clients should use",a.jsx("code",{className:"mx-1 rounded bg-muted px-1 py-0.5 font-mono text-[11px] text-foreground",children:"agent-inspector-mcp stdio"}),"instead. Configure only one entry for the same Inspector."]})]}),a.jsxs("div",{className:"flex items-start gap-2",children:[a.jsx(rt,{className:"mt-0.5 size-3.5 text-emerald-500"}),a.jsx("span",{children:"If your AI tool runs in another container or host, replace localhost with an address reachable from that tool and verify the network/firewall path."})]})]})]})}function WR(){const{strip:e,captureMode:t,slowResponseThresholdSeconds:n,providerTestTimeoutSeconds:r,timeDisplayFormat:o,isLoading:s,setStrip:i,setSlowResponseThresholdSeconds:l,setProviderTestTimeoutSeconds:c,setTimeDisplayFormat:u}=Ra(),[d,f]=x.useState(null),[h,p]=x.useState(!1),y=t==="full"?"simple":"full",m=x.useCallback(async k=>{f(null),p(!0);try{await i(k)}catch(S){f(S instanceof Error?S.message:String(S))}finally{p(!1)}},[i]),g=x.useCallback(async k=>{f(null),p(!0);try{await l(k)}catch(S){f(S instanceof Error?S.message:String(S))}finally{p(!1)}},[l]),b=x.useCallback(async k=>{f(null),p(!0);try{await c(k)}catch(S){f(S instanceof Error?S.message:String(S))}finally{p(!1)}},[c]),v=x.useCallback(async k=>{f(null),p(!0);try{await u(k)}catch(S){f(S instanceof Error?S.message:String(S))}finally{p(!1)}},[u]);return a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"space-y-1",children:[a.jsx("h3",{className:"text-sm font-semibold",children:"Capture mode"}),a.jsxs("p",{className:"text-xs text-muted-foreground",children:["This process is running in ",a.jsx("code",{children:t})," mode. Restart with"," ",a.jsxs("code",{children:["agent-inspector --mode ",y]})," to change it.",t==="simple"?" Simple mode keeps replay, parsed requests, responses, timing, tools, and token usage while skipping raw headers, raw response retention, and detailed SSE chunk retention.":" Full mode retains raw headers, raw responses, and SSE chunks for diagnostics; use simple mode for everyday lower-overhead capture."]})]}),a.jsxs("div",{className:"space-y-1",children:[a.jsx("h3",{className:"text-sm font-semibold",children:"Claude Code billing header"}),a.jsxs("p",{className:"text-xs text-muted-foreground",children:["When enabled, the proxy strips the synthetic ",a.jsx("code",{children:"x-anthropic-billing-header"})," text block that Claude Code prepends to the system prompt before forwarding to upstream. Improves prefix-cache hit rates against third-party upstreams. The default at startup is controlled by the ",a.jsx("code",{children:"AGENT_INSPECTOR_STRIP_CLAUDE_CODE_BILLING_HEADER"})," ","environment variable; your choice is persisted to ",a.jsx("code",{children:"config.json"})," and overrides the env var for subsequent requests."]})]}),a.jsxs("label",{className:"flex items-center gap-3",children:[a.jsx("input",{type:"checkbox",role:"switch",checked:e,disabled:s||h,onChange:k=>{m(k.currentTarget.checked)},className:"size-4 cursor-pointer disabled:cursor-not-allowed disabled:opacity-50"}),a.jsx("span",{className:"text-sm",children:s?"Loading...":e?"Stripping enabled":"Stripping disabled"})]}),a.jsxs("div",{className:"space-y-1",children:[a.jsx("label",{htmlFor:"slow-response-threshold",className:"text-sm font-semibold",children:"Slow response threshold"}),a.jsxs("p",{className:"text-xs text-muted-foreground",children:["Logs whose elapsed time exceeds this many seconds show a warning icon next to the duration. Set to ",a.jsx("code",{children:"0"})," to disable the indicator."]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("input",{id:"slow-response-threshold",type:"number",min:0,max:Ii,step:1,value:n,disabled:s||h,onChange:k=>{const S=Number(k.currentTarget.value);Number.isInteger(S)&&(S<0||S>Ii||g(S))},className:"h-8 w-24 rounded-md border border-input bg-transparent px-2 text-sm font-mono disabled:cursor-not-allowed disabled:opacity-50"}),a.jsx("span",{className:"text-xs text-muted-foreground",children:"seconds"})]})]}),a.jsxs("div",{className:"space-y-1",children:[a.jsx("label",{htmlFor:"provider-test-timeout",className:"text-sm font-semibold",children:"Provider test timeout"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"Provider Test waits this many seconds per configured model before aborting slow probes. The full test window scales with model count."}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("input",{id:"provider-test-timeout",type:"number",min:1,max:zi,step:1,value:r,disabled:s||h,onChange:k=>{const S=Number(k.currentTarget.value);Number.isInteger(S)&&(S<1||S>zi||b(S))},className:"h-8 w-24 rounded-md border border-input bg-transparent px-2 text-sm font-mono disabled:cursor-not-allowed disabled:opacity-50"}),a.jsx("span",{className:"text-xs text-muted-foreground",children:"seconds / model"})]})]}),a.jsxs("div",{className:"space-y-1",children:[a.jsx("label",{htmlFor:"time-display-format",className:"text-sm font-semibold",children:"Time display"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"Controls timestamps in session summaries, conversation headers, and log rows."}),a.jsxs("select",{id:"time-display-format",value:o,disabled:s||h,onChange:k=>{const S=Cf.safeParse(k.currentTarget.value);S.success&&v(S.data)},className:"h-8 rounded-md border border-input bg-background px-2 text-sm disabled:cursor-not-allowed disabled:opacity-50",children:[a.jsx("option",{value:"time",children:"Time only"}),a.jsx("option",{value:"full",children:"Full ISO"})]})]}),d!==null&&a.jsxs("p",{className:"text-xs text-destructive",children:["Failed to save: ",d]})]})}function HR(e){const t=new Map;for(const n of e){const r=n.logs;for(let o=1;o<r.length;o++){const s=r[o-1],i=r[o];s===void 0||i===void 0||t.set(i.id,{creation:gd(s.cacheCreationInputTokens,i.cacheCreationInputTokens),read:gd(s.cacheReadInputTokens,i.cacheReadInputTokens)})}}return t}function gd(e,t){return t===null||e===null?null:t>e?{direction:"up",delta:t-e}:t<e?{direction:"down",delta:e-t}:null}const VR=30,ZR=112,qR=6;function KR(e){return e>VR}function GR({groups:e,standalone:t,...n}){return KR(e.length)?a.jsx(JR,{groups:e,standalone:t,...n}):a.jsx(a.Fragment,{children:e.map(r=>a.jsx(zg,{group:r,standalone:t,...n},r.id))})}function JR({groups:e,standalone:t,...n}){const[r,o]=x.useState(()=>new Map),s=KN({count:e.length,estimateSize:()=>ZR,overscan:qR,getItemKey:c=>e[c]?.id??c}),i=x.useCallback((c,u)=>{o(d=>{const f=new Map(d);return u?f.set(c,!0):f.delete(c),f})},[]),l=x.useMemo(()=>{const c=new Map;for(let u=0;u<e.length;u++){const d=e[u];if(d!==void 0)for(const f of d.logs)c.set(f.id,u)}return c},[e]);return x.useEffect(()=>{const c=u=>{const d=Bs(u);if(d===null)return;const f=l.get(d.logId);if(f===void 0)return;const h=e[f];h!==void 0&&(i(h.id,!0),s.scrollToIndex(f,{align:"center"}))};return window.addEventListener(nn,c),()=>{window.removeEventListener(nn,c)}},[e,l,i,s]),a.jsx("div",{className:"relative w-full",style:{height:`${s.getTotalSize()}px`},"data-virtualized-conversation-list":"true",children:s.getVirtualItems().map(c=>{const u=e[c.index];return u===void 0?null:a.jsx("div",{"data-index":c.index,ref:s.measureElement,className:"absolute left-0 top-0 w-full",style:{transform:`translateY(${c.start}px)`},children:a.jsx(zg,{group:u,standalone:t,expanded:r.get(u.id)??!1,onExpandedChange:d=>i(u.id,d),...n})},c.key)})})}const ss="data-nav-id",YR="data-nav-action";function xd(e){return Array.from(e.querySelectorAll(`[${ss}]`))}function bd(e){return e instanceof HTMLElement}function XR(e,t){let n=e;for(;n!==null&&n!==t;){if(n.hasAttribute(ss))return n;n=n.parentElement}return e.hasAttribute(ss)?e:null}function _i(e){const t=e.getAttribute(YR);return t==="toggle"||t==="expand"||t==="collapse"?t:null}function Cr(e){e.focus({preventScroll:!0}),e.scrollIntoView({block:"nearest",behavior:"smooth"})}function jr(e,t){return e[t]??null}function qg(e){const t=e.tagName;return!!(t==="INPUT"||t==="TEXTAREA"||t==="SELECT"||e.isContentEditable)}function yd(e){const t=e.tagName;return t==="BUTTON"||t==="A"||qg(e)?!0:e.closest("[role='button'],[role='menuitem'],[role='option']")!==null}function QR(e){return e.closest("[role='dialog'],[role='menu'],[role='listbox']")!==null?!0:document.querySelector("[role='dialog'],[role='menu'],[role='listbox']")!==null}function eP(){const e=window.getSelection();return e===null?!1:e.type==="Range"&&e.toString().length>0}function _o(e,t){return e.key===t&&e.shiftKey}function tP(e,t,n={}){const r=t??e,o=n.pageWide===!0,s=x.useCallback(i=>{const l=e.current,c=r.current;if(!l||!c)return;const u=i.target;if(!bd(u)||u!==c)return;const d=xd(l),f=jr(d,0);f!==null&&Cr(f)},[e,r]);x.useEffect(()=>{const i=l=>{if(l.altKey||l.ctrlKey||l.metaKey)return;const c=e.current;if(!c)return;const u=l.target;if(!bd(u)||qg(u)||eP())return;const d=c.contains(u);if(d&&yd(u)&&!u.hasAttribute(ss)||!d&&(!o||yd(u)||QR(u)))return;const f=xd(c);if(f.length===0)return;const h=XR(u,c),p=h!==null?f.indexOf(h):-1;let y=!1;switch(l.key){case"ArrowUp":case"W":{if(l.shiftKey&&l.key==="ArrowUp"||l.key==="W"&&!_o(l,"W"))break;l.preventDefault();const m=p>0?p-1:p===-1?f.length-1:-1;if(m!==-1){const g=jr(f,m);g!==null&&Cr(g)}y=!0;break}case"ArrowDown":case"S":{if(l.shiftKey&&l.key==="ArrowDown"||l.key==="S"&&!_o(l,"S"))break;l.preventDefault();const m=p<f.length-1?p+1:p===-1?0:-1;if(m!==-1){const g=jr(f,m);g!==null&&Cr(g)}y=!0;break}case"ArrowLeft":case"A":{if(l.shiftKey&&l.key==="ArrowLeft"||l.key==="A"&&!_o(l,"A")||h===null)break;if(l.preventDefault(),_i(h)==="collapse")h.click();else if(p>0){const g=jr(f,p-1);g!==null&&Cr(g)}y=!0;break}case"ArrowRight":case"D":{if(l.shiftKey&&l.key==="ArrowRight"||l.key==="D"&&!_o(l,"D")||h===null)break;if(l.preventDefault(),_i(h)==="expand")h.click();else if(p<f.length-1){const g=jr(f,p+1);g!==null&&Cr(g)}y=!0;break}case" ":{if(h===null)break;l.preventDefault(),_i(h)!==null&&h.click(),y=!0;break}}y&&l.stopPropagation()};return document.addEventListener("keydown",i,{capture:!0}),()=>document.removeEventListener("keydown",i,{capture:!0})},[e,o,r]),x.useEffect(()=>(document.addEventListener("focusin",s),()=>document.removeEventListener("focusin",s)),[s])}const nP={system:"System",user:"User",assistant:"Assistant",tool:"Tool Results",tools:"Tool Definitions"},rP={system:"bg-sky-500/70",user:"bg-emerald-500/70",assistant:"bg-violet-500/70",tool:"bg-sky-400/55",tools:"bg-slate-500/70"},oP={system:"focus-visible:ring-sky-300",user:"focus-visible:ring-emerald-300",assistant:"focus-visible:ring-violet-300",tool:"focus-visible:ring-sky-300",tools:"focus-visible:ring-slate-300"},Si=12,So=1,vd=80,wd=24;function sP(e){return e.length<=wd?e:`${e.slice(0,wd-3)}...`}function iP(e){const t=e.replace(/\s+/g," ").trim();return t.length<=vd?t:`${t.slice(0,vd)}...`}function Co(e){return e>=10?`${e.toFixed(0)}%`:e>=1?`${e.toFixed(1)}%`:e>0?"<1%":"0%"}const aP=x.memo(function({segments:t,totalTokens:n,showLabels:r=!0,onActivate:o}){const s=x.useMemo(()=>n>0?n:t.reduce((g,b)=>g+b.size,0),[t,n]),i=t.slice(0,Si),l=t.slice(Si),c=l.reduce((g,b)=>g+b.size,0),u=l.length,d=Si,f=d+u-1,h=u>0,p=o!==void 0,y=x.useMemo(()=>i.reduce((g,b)=>g+b.size,0),[i]),m=x.useMemo(()=>`Request context: ~${Ve(s)} tokens across ${t.length} segment${t.length===1?"":"s"}`,[t.length,s]);return t.length===0||s<=0?a.jsx("div",{role:"img","aria-label":m,className:"h-6"}):a.jsx(tt,{delayDuration:150,children:a.jsxs("div",{role:"img","aria-label":m,className:"flex flex-col gap-1.5",children:[a.jsxs("div",{className:"relative flex h-6 w-full overflow-hidden rounded border border-border/40 bg-muted/30","data-testid":"anatomy-segment-bar",children:[i.map((g,b)=>{const v=s>0?g.size/s*100:0,k=Math.max(So,v),S=ve("h-full border-r border-background/80 last:border-r-0",p?"opacity-90 hover:opacity-100 focus:opacity-100 focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-1 focus-visible:ring-offset-background":"opacity-90",rP[g.role],p?oP[g.role]:""),C={width:`${k}%`},j=`${g.label}, ${Co(v)}, ~${Ve(g.size)} tokens`;return a.jsxs(Fe,{children:[a.jsx($e,{asChild:!0,children:p?a.jsx("button",{type:"button",role:"button",tabIndex:0,onClick:()=>o(g),onKeyDown:E=>{(E.key==="Enter"||E.key===" ")&&(E.preventDefault(),o(g))},"data-anatomy-path":g.path,"aria-label":j,className:S,style:C}):a.jsx("span",{"aria-label":j,className:S,style:C})}),a.jsxs(Be,{side:"bottom",className:"max-w-sm text-xs p-2 space-y-0.5",children:[a.jsxs("div",{className:"font-semibold",children:[g.label," - ",Co(v)," - ~",Ve(g.size)," ","tokens"]}),a.jsx("div",{className:"text-muted-foreground",children:nP[g.role]}),a.jsxs("div",{className:"text-muted-foreground",children:[g.characters.toLocaleString()," chars"]}),g.text.length>0&&a.jsx("div",{className:"text-muted-foreground/90 break-words whitespace-pre-wrap",children:iP(g.text)})]})]},`${g.path}-${b}`)}),h&&a.jsxs(Fe,{children:[a.jsx($e,{asChild:!0,children:a.jsxs("div",{role:"img","aria-label":`${u} additional segments`,className:"flex h-full items-center justify-center bg-muted-foreground/30 px-1.5 text-[10px] font-mono text-background",style:{width:`${Math.max(So,c/s*100)}%`},children:["... +",u]})}),a.jsxs(Be,{side:"bottom",className:"text-xs",children:[u," more segment",u===1?"":"s"," (indices"," ",d,"-",f,")"]})]})]}),r&&a.jsxs("div",{className:"flex w-full gap-1 text-[10px] text-muted-foreground",children:[i.map((g,b)=>{const v=s>0?g.size/s*100:0,k=Math.max(So,v);return a.jsxs("div",{className:"flex flex-col gap-0.5 truncate",style:{width:`${k}%`},title:`${g.label} - ${Co(v)} - ~${Ve(g.size)} tokens`,children:[a.jsx("span",{className:"truncate font-mono text-foreground/80",children:sP(g.label)}),a.jsxs("span",{className:"truncate font-mono text-muted-foreground/70",children:[Co(v)," - ~",Ve(g.size)]})]},`label-${g.path}-${b}`)}),h&&a.jsxs("div",{className:"flex flex-col gap-0.5 truncate text-muted-foreground",style:{width:`${Math.max(So,c/s*100)}%`},children:[a.jsxs("span",{className:"truncate font-mono text-foreground/60",children:["... +",u]}),a.jsxs("span",{className:"truncate font-mono text-muted-foreground/60",children:["~",Ve(c)]})]})]}),y<s*.1&&a.jsx("div",{className:"h-0"})]})})}),Kg=.75,Gg=.9,ba=8e3,lP=.35,Jg=40,Yg=160,cP=5,uP=8,dP=18,fP=6e4,pP=.7,kd=3e3,hP=.3,_d=160,mP=new Set(["answer","body","content","data","error","message","markdown","output","response","result","stderr","stdout","text","transcript"]),gP=["context_window","contextWindow","context_length","contextLength","max_context_length","maxContextLength","max_input_tokens","maxInputTokens"],xP=["max_tokens","maxTokens","max_completion_tokens","maxCompletionTokens","max_output_tokens","maxOutputTokens"],bP=[{family:"OpenAI GPT-4.1",tokens:1047576,mode:"prefix",patterns:["gpt-4.1"]},{family:"OpenAI GPT-4o",tokens:128e3,mode:"prefix",patterns:["gpt-4o"]},{family:"OpenAI o-series",tokens:128e3,mode:"prefix",patterns:["o1","o3","o4"]},{family:"Anthropic Claude",tokens:2e5,mode:"prefix",patterns:["claude-"]},{family:"DeepSeek V4",tokens:1048576,mode:"prefix",patterns:["deepseek-v4-pro","deepseek-v4-flash"]},{family:"DeepSeek",tokens:64e3,mode:"prefix",patterns:["deepseek-"]},{family:"MiniMax M3",tokens:1048576,mode:"includes",patterns:["minimax-m3"]},{family:"MiniMax M2.7",tokens:204800,mode:"includes",patterns:["minimax-m2.7"]},{family:"MiniMax M2.5/M2.1",tokens:196608,mode:"includes",patterns:["minimax-m2.5","minimax-m2.1"]},{family:"GLM-5.2",tokens:1048576,mode:"prefix",patterns:["glm-5.2"]},{family:"GLM-5",tokens:202752,mode:"prefix",patterns:["glm-5","glm-5.1"]}],yP={system:"System",user:"User messages",assistant:"Assistant messages",tool:"Tool results",tools:"Tool definitions"};function vP(e){if(typeof e=="number")return Number.isFinite(e)&&e>0?Math.floor(e):null;if(typeof e=="string"){const t=Number(e);if(Number.isFinite(t)&&t>0)return Math.floor(t)}return null}function Xg(e,t){for(const n of t){const r=vP(Me(e,n));if(r!==null)return r}return null}function wP(e){const t=Me(e,"model");if(typeof t!="string")return null;const n=t.trim();return n===""?null:n}function kP(e,t){switch(t.mode){case"prefix":return t.patterns.some(n=>e.startsWith(n));case"includes":return t.patterns.some(n=>e.includes(n))}}function _P(e,t,n=[]){const r=Xg(t,gP);if(r!==null)return{tokens:r,label:"Request metadata",source:"request"};const o=uR(e,n);if(o!==null)return{tokens:o.tokens,label:`${o.providerName} config`,source:"provider"};if(e===null)return{tokens:null,label:"Unknown model",source:"unknown"};const s=e.trim().toLowerCase().replace(/\s+/g,"-");for(const i of bP)if(kP(s,i))return{tokens:i.tokens,label:`${i.family} local rule`,source:"model-rule"};return{tokens:null,label:"No local rule",source:"unknown"}}function SP(e){return e<0?0:e>1?1:e}function CP(e){return e===null?"unknown":e>=Gg?"danger":e>=Kg?"watch":"ok"}function jP(e,t){return e.filter(n=>n.role===t).reduce((n,r)=>n+r.size,0)}function NP(e,t){return["system","user","assistant","tool","tools"].map(r=>{const o=jP(e,r);return{role:r,label:yP[r],tokens:o,percent:t>0?o/t:0}}).filter(r=>r.tokens>0).sort((r,o)=>o.tokens-r.tokens)}function ya(e){return e.replace(/\s+/g," ").trim().toLowerCase()}function EP(e){const t=e.replace(/\s+/g," ").trim();return t.length<=_d?t:`${t.slice(0,_d-3)}...`}function TP(e){return{role:e.role,label:e.label,path:e.path,tokens:e.tokens,characters:e.characters}}function AP(e){return{role:e.role,label:e.label,path:e.path,tokens:e.size,characters:e.characters,text:e.text}}function IP(e){const t=e.trim();return t.startsWith("{")||t.startsWith("[")}function zP(e){if(!IP(e))return null;try{return JSON.parse(e)}catch{return null}}function RP(e){return e.toLowerCase().replace(/[^a-z0-9]/g,"")}function PP(e){for(let t=e.length-1;t>=0;t-=1){const n=e[t]??"";if(!(n.startsWith("[")&&n.endsWith("]")))return n}return null}function OP(e){const t=PP(e);return t===null?!1:mP.has(RP(t))}function MP(e){return e.map(t=>t.startsWith("[")?t:`.${t}`).join("").replace(/^\./,"")}function LP(e,t,n){const r=Nl(t);if(r<Yg)return null;const o=jl(t);return o<Jg?null:{role:e.role,label:`${e.label} ${MP(n)}`,path:e.path,tokens:o,characters:r,text:t}}function va({value:e,segment:t,path:n,depth:r,candidates:o}){if(!(o.length>=uP)&&!(r>cP)){if(typeof e=="string"){if(!OP(n))return;const s=LP(t,e,n);s!==null&&o.push(s);return}if(Array.isArray(e)){e.forEach((s,i)=>va({value:s,segment:t,path:[...n,`[${String(i)}]`],depth:r+1,candidates:o}));return}ul(e)&&Object.entries(e).forEach(([s,i])=>va({value:i,segment:t,path:[...n,s],depth:r+1,candidates:o}))}}function DP(e){const t=AP(e),n=zP(e.text);if(n===null)return[t];const r=[];va({value:n,segment:e,path:[],depth:0,candidates:r});const o=ya(e.text),s=new Set([o]),i=r.filter(l=>{const c=ya(l.text);return c===""||s.has(c)?!1:(s.add(c),!0)});return[t,...i]}function FP(e){const t=new Map;for(const r of e){const o=DP(r);for(const s of o){if(s.tokens<Jg||s.characters<Yg)continue;const i=ya(s.text);if(i==="")continue;const l=t.get(i);if(l===void 0){t.set(i,{tokens:s.tokens,candidates:[s]});continue}t.set(i,{tokens:l.tokens+s.tokens,candidates:[...l.candidates,s]})}}const n=[];for(const r of t.values()){if(r.candidates.length<2)continue;const o=r.candidates[0]??null;if(o===null)continue;const s=r.tokens-o.tokens;n.push({key:`${o.path}:${o.label}:${String(r.candidates.length)}:${String(r.tokens)}`,count:r.candidates.length,totalTokens:r.tokens,repeatedTokens:s,preview:EP(o.text),firstLabel:o.label,segments:r.candidates.map(TP)})}return n.sort((r,o)=>o.repeatedTokens-r.repeatedTokens||o.totalTokens-r.totalTokens)}function $P(e){if(e.length===0)return null;const t=e.length,n=e.reduce((o,s)=>o+s.count,0),r=e.reduce((o,s)=>o+s.repeatedTokens,0);return{kind:"duplicate",severity:r>=ba?"danger":"watch",title:"Duplicate context",detail:`${String(n)} repeated blocks across ${String(t)} group${t===1?"":"s"}, ~${String(r)} repeated tokens.`}}function BP(e){return e.reduce((t,n)=>t+n.repeatedTokens,0)}function UP(e,t,n){const r=[],o=e.find(c=>c.role==="tools")??null;o!==null&&(o.tokens>=ba||o.percent>=lP&&o.tokens>=kd)&&r.push({kind:"tool-schema",severity:o.tokens>=ba?"danger":"watch",title:"Large tool schema",detail:`Tool definitions take ${Math.round(o.percent*100)}% of request context.`});const s=e.find(c=>c.role==="system")??null;s!==null&&s.tokens>=kd&&s.percent>=hP&&r.push({kind:"system-heavy",severity:"watch",title:"Large system prompt",detail:`System instructions take ${Math.round(s.percent*100)}% of request context.`});const i=e.filter(c=>c.role==="user"||c.role==="assistant"||c.role==="tool").reduce((c,u)=>c+u.tokens,0),l=t>0?i/t:0;return n>=dP&&(i>=fP||l>=pP)&&r.push({kind:"history-bloat",severity:l>=.85?"danger":"watch",title:"Conversation history growth",detail:`${String(n)} message blocks take ${Math.round(l*100)}% of request context.`}),r}function WP({risk:e,contextWindow:t,diagnostics:n,duplicateGroups:r}){let s=new Set(n.map(c=>c.kind)).size;(e==="watch"||e==="danger")&&(s+=1),t.source==="unknown"&&(s+=1);const i=n.some(c=>c.severity==="danger");return{level:e==="danger"||i?"risk":s>0?"optimizable":"ok",opportunityCount:s,reclaimableTokens:BP(r)}}function HP({segments:e,inputTokens:t,parsed:n,model:r,providers:o=[]}){const s=e.reduce((j,E)=>j+E.size,0),i=r??wP(n),l=t??s,c=Xg(n,xP),u=_P(i,n,o),d=c??0,f=u.tokens===null?null:l+d,h=u.tokens===null?null:u.tokens-l,p=u.tokens===null?null:u.tokens-l-d,y=u.tokens===null||f===null?null:SP(f/u.tokens),m=NP(e,s),g=m[0]??null,b=e.filter(j=>j.role!=="tools").length,v=FP(e),k=$P(v),S=UP(m,s,b);k!==null&&S.unshift(k);const C=CP(y);return{model:i,contextWindow:u,estimatedInputTokens:l,outputReserveTokens:c,windowUsedTokens:f,remainingInputTokens:h,remainingAfterReserveTokens:p,usagePercent:y,riskLevel:C,roleUsages:m,largestRole:g,diagnostics:S,duplicateGroups:v,health:WP({risk:C,contextWindow:u,diagnostics:S,duplicateGroups:v})}}const AO={watch:Kg,danger:Gg};function VP(e){if(e===null)return null;try{return JSON.parse(e)}catch{return null}}function ZP(e){return{role:e.role,label:e.label,size:e.tokens,characters:e.tokens*4,text:"",path:`role:${e.role}`}}function qP(e,t){const n=VP(e.rawRequestBody);if(n===null)return null;const o=wg(Hr(e)).anatomySegments(n);if(o===null)return null;const s=HP({segments:o,inputTokens:e.inputTokens??null,parsed:n,model:e.model,providers:t}),i=s.model??e.model??"Unknown model",l=s.roleUsages.map(ZP);return{logId:e.id,model:i,timestamp:e.timestamp,contextWindow:s.contextWindow,estimatedInputTokens:s.estimatedInputTokens,windowUsedTokens:s.windowUsedTokens,usagePercent:s.usagePercent,riskLevel:s.riskLevel,health:s.health,diagnostics:s.diagnostics.map(c=>c.title),roleSegments:l,roleTotalTokens:l.reduce((c,u)=>c+u.size,0)}}function KP(e,t){return e.usagePercent!==null&&t.usagePercent!==null?e.usagePercent>t.usagePercent:e.usagePercent!==null&&t.usagePercent===null?!0:e.usagePercent===null&&t.usagePercent!==null?!1:e.estimatedInputTokens>t.estimatedInputTokens}function Sd(e){switch(e){case"danger":return 4;case"watch":return 3;case"unknown":return 2;case"ok":return 1}}function GP(e,t){const n=Sd(t.latest.riskLevel)-Sd(e.latest.riskLevel);if(n!==0)return n;const r=e.peak.usagePercent??-1,s=(t.peak.usagePercent??-1)-r;return s!==0?s:t.latest.logId-e.latest.logId}function JP(e,t){return e.usagePercent===null||t.usagePercent===null?null:(t.usagePercent-e.usagePercent)*100}function YP(e,t=[]){const n=[...e].sort((s,i)=>s.id-i.id),r=new Map;for(const s of n){const i=qP(s,t);if(i===null)continue;const l=r.get(i.model);if(l===void 0){r.set(i.model,{model:i.model,requestCount:1,first:i,latest:i,peak:i});continue}r.set(i.model,{model:l.model,requestCount:l.requestCount+1,first:l.first,latest:i,peak:KP(i,l.peak)?i:l.peak})}return{models:[...r.values()].map(s=>({model:s.model,requestCount:s.requestCount,first:s.first,latest:s.latest,peak:s.peak,trendPercent:JP(s.first,s.latest)})).sort(GP)}}function Ao(e){return e.length<=30?e:`${e.slice(0,12)}...${e.slice(-12)}`}function XP(e){return e==="full"}function Cd(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 QP(e,t){const n=e[0],r=e[e.length-1];return n===void 0||r===void 0?null:Da(n.timestamp,r.timestamp,t)}function eO(e){for(const t of e)if(t.userAgent!==null&&t.userAgent!==void 0&&t.userAgent!=="")return t.userAgent;return null}function tO({pinnedSessionId:e,selectedSession:t,sessions:n,logs:r}){if(e!==void 0){const i=r.filter(l=>l.sessionId===e);return i.length===0?null:{label:e,logs:i,showBackLink:!0}}if(t!=="__all__"){const i=r.filter(l=>l.sessionId===t);return i.length===0?null:{label:t,logs:i,showBackLink:!0}}const o=n.length===1?n[0]??null:null;return o!==null&&r.every(l=>l.sessionId===o)?{label:o,logs:[...r],showBackLink:!1}:n.length===0&&r.length>0&&r.every(i=>i.sessionId===null)?{label:"Visible requests",logs:[...r],showBackLink:!1}:null}function Rr(e){if(e===null)return"Unknown";const t=e*100;return t>=10?`${t.toFixed(0)}%`:t>=1?`${t.toFixed(1)}%`:t>0?"<1%":"0%"}function nO(e){return e===null?"n/a":Math.abs(e)<.1?"0%":`${e>0?"+":""}${e.toFixed(1)}%`}function wa(e){return e===null||!Number.isFinite(e)?0:Math.min(Math.max(e*100,0),100)}function rO(e,t){if(t===null)return null;const n=wa(e),r=wa(t);return r<=0||Math.abs(r-n)<.5?null:r}function oO(e){switch(e){case"danger":return"bg-red-400";case"watch":return"bg-amber-300";case"unknown":return"bg-muted-foreground/50";case"ok":return"bg-emerald-400"}}function sO(e){const t=e.latest.contextWindow.tokens;return t===null?"Context window unknown":`Context window ${Gf(t)}`}function iO(e){return`${e} ${e===1?"request":"requests"}`}function jd(e){return`#${String(e)}`}function Nd(e){switch(e){case"danger":return"text-red-300";case"watch":return"text-amber-200";case"unknown":return"text-muted-foreground";case"ok":return"text-emerald-300"}}function aO(e){switch(e){case"risk":return"border-red-400/30 bg-red-500/10 text-red-100";case"optimizable":return"border-amber-400/25 bg-amber-400/8 text-amber-100";case"ok":return"border-emerald-400/25 bg-emerald-400/8 text-emerald-100"}}function lO(e){switch(e){case"risk":return"Risk";case"optimizable":return"Optimizable";case"ok":return"OK"}}const cO=10,uO=80;function dO(e){e.setAttribute("data-deep-link-highlight","true"),window.setTimeout(()=>{e.removeAttribute("data-deep-link-highlight")},1800)}function fO(e){const t=document.getElementById(`log-${String(e)}`);return t instanceof HTMLElement?(t.scrollIntoView({block:"center",behavior:"smooth"}),t.focus({preventScroll:!0}),dO(t),!0):!1}function Qg(e){fa({logId:e,tab:"anatomy"});let t=0;const n=()=>{fa({logId:e,tab:"anatomy"}),!fO(e)&&(t+=1,t<cO&&window.setTimeout(n,uO))};window.setTimeout(n,0)}function Ed({command:e}){const[t,n]=x.useState(!1),r=x.useCallback(()=>{window.navigator.clipboard.writeText(e).then(()=>{n(!0),setTimeout(()=>n(!1),2e3)})},[e]);return a.jsxs("div",{className:"inline-flex items-center gap-2 bg-muted rounded-md px-3 py-2",children:[a.jsx("pre",{className:"text-blue-500 font-mono text-sm m-0",children:e}),a.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?a.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:a.jsx("path",{d:"M20 6 9 17l-5-5"})}):a.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[a.jsx("rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2"}),a.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 pO(){return a.jsx(tt,{children:a.jsxs(Fe,{children:[a.jsx($e,{asChild:!0,children:a.jsxs("span",{className:"inline-flex h-7 items-center gap-2 rounded-md border border-cyan-400/30 bg-cyan-500/10 px-2.5 font-mono text-[11px] font-medium text-cyan-300 shadow-[0_0_16px_rgba(34,211,238,0.08)]",children:[a.jsx("span",{className:"size-1.5 rounded-full bg-emerald-300 shadow-[0_0_8px_rgba(110,231,183,0.8)]"}),"MCP Ready",a.jsx("span",{className:"hidden text-cyan-200/70 sm:inline",children:"/api/mcp"})]})}),a.jsx(Be,{sideOffset:8,className:"max-w-[320px] text-left leading-relaxed",children:"Coding agents can inspect logs, replay requests, test providers, and debug sessions through MCP at /api/mcp."})]})})}function Td({label:e,logId:t}){return a.jsxs("button",{type:"button",onClick:()=>Qg(t),className:"inline-flex h-5 items-center rounded px-1 font-mono text-[10px] text-muted-foreground transition-colors hover:bg-muted hover:text-foreground",title:`Open Context for ${jd(t)}`,children:[e," ",jd(t)]})}function hO({latestPercent:e,peakPercent:t,risk:n,onOpenContext:r}){const o=wa(e),s=rO(e,t),i=t===null?`Latest context window usage ${Rr(e)}`:`Latest context window usage ${Rr(e)}, peak ${Rr(t)}`;return a.jsx("button",{type:"button",onClick:r,className:"group block w-full rounded-full focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1","aria-label":`${i}. Open latest Context details`,title:"Open latest Context details",children:a.jsxs("span",{className:"relative block h-2.5 overflow-hidden rounded-full border border-border/70 bg-background transition-colors group-hover:border-foreground/30",role:"meter","aria-label":i,"aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":Math.round(o),children:[a.jsx("span",{className:ve("block h-full rounded-full transition-[width]",oO(n)),style:{width:`${o}%`}}),s!==null&&a.jsx("span",{className:"absolute top-0 h-full w-0.5 rounded-full bg-amber-100/75 shadow-[0_0_0_1px_rgba(0,0,0,0.25)]",style:{left:`calc(${s}% - 0.5px)`},"aria-hidden":"true"})]})})}function mO({summary:e}){const t=e.trendPercent,n=t===null||Math.abs(t)<.1?null:t>0?Lv:Iv,r=e.latest.diagnostics[0]??null,o=Rr(e.latest.usagePercent),s=Rr(e.peak.usagePercent),i=()=>{Qg(e.latest.logId)};return a.jsxs("div",{className:"grid gap-x-4 gap-y-2 border-t border-border/60 py-2 first:border-t-0 lg:grid-cols-[minmax(180px,1fr)_minmax(260px,1fr)_minmax(260px,1.4fr)]",children:[a.jsxs("div",{className:"min-w-0",children:[a.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[a.jsx("button",{type:"button",onClick:i,className:"min-w-0 truncate rounded-sm text-left font-mono font-semibold text-foreground transition-colors hover:text-cyan-200 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1",title:`Open latest Context for ${e.model}`,children:e.model}),a.jsx("span",{className:ve("inline-flex h-5 shrink-0 items-center rounded border px-1.5 font-mono text-[10px]",aO(e.latest.health.level)),children:lO(e.latest.health.level)})]}),a.jsxs("div",{className:"mt-1 flex min-w-0 flex-wrap items-center gap-x-2 gap-y-1 text-[11px] text-muted-foreground",children:[a.jsx("span",{children:iO(e.requestCount)}),a.jsx("span",{children:sO(e)})]})]}),a.jsxs("div",{className:"min-w-0 space-y-2 text-xs",children:[a.jsx(hO,{latestPercent:e.latest.usagePercent,peakPercent:e.peak.usagePercent,risk:e.latest.riskLevel,onOpenContext:i}),a.jsxs("div",{className:"grid grid-cols-3 gap-2",children:[a.jsxs("div",{className:"min-w-0",children:[a.jsx("div",{className:"text-[10px] uppercase text-muted-foreground",children:"Latest"}),a.jsx("div",{className:ve("mt-0.5 font-mono",Nd(e.latest.riskLevel)),children:o}),a.jsx(Td,{label:"Log",logId:e.latest.logId})]}),a.jsxs("div",{className:"min-w-0",children:[a.jsx("div",{className:"text-[10px] uppercase text-muted-foreground",children:"Peak"}),a.jsx("div",{className:ve("mt-0.5 font-mono",Nd(e.peak.riskLevel)),children:s}),a.jsx(Td,{label:"Log",logId:e.peak.logId})]}),a.jsxs("div",{className:"min-w-0",children:[a.jsx("div",{className:"text-[10px] uppercase text-muted-foreground",children:"Trend"}),a.jsxs("div",{className:"mt-0.5 flex items-center gap-1 font-mono text-foreground",children:[n!==null&&a.jsx(n,{className:ve("size-3",t!==null&&t>0?"text-amber-300":"text-emerald-300")}),nO(t)]}),a.jsx("div",{className:"h-5","aria-hidden":"true"})]})]})]}),a.jsxs("div",{className:"min-w-0 space-y-1.5",children:[a.jsx(aP,{segments:e.latest.roleSegments,totalTokens:e.latest.roleTotalTokens,showLabels:!1}),a.jsxs("div",{className:"flex min-w-0 flex-wrap items-center gap-x-2 gap-y-1 text-[11px] text-muted-foreground",children:[a.jsxs("span",{className:"font-mono",children:["~",Ve(e.latest.estimatedInputTokens)," input"]}),e.latest.windowUsedTokens!==null&&a.jsxs("span",{className:"font-mono",children:["~",Ve(e.latest.windowUsedTokens)," used"]}),r!==null&&a.jsx("span",{className:"truncate",children:r})]})]})]})}function gO({summary:e}){return e.models.length===0?null:a.jsxs("div",{className:"mt-3 border-t border-border/70 pt-2",children:[a.jsxs("div",{className:"mb-1 flex items-center justify-between gap-2",children:[a.jsx("div",{className:"text-[11px] font-semibold uppercase tracking-normal text-muted-foreground",children:"Session Context"}),a.jsxs("div",{className:"font-mono text-[10px] text-muted-foreground",children:[e.models.length," model",e.models.length===1?"":"s"]})]}),a.jsx("div",{className:"max-h-52 overflow-y-auto pr-1",children:e.models.map(t=>a.jsx(mO,{summary:t},t.model))})]})}function xO({label:e,logs:t,totalIn:n,totalOut:r,timeDisplayFormat:o,contextSummary:s,showBackLink:i}){const[l,c]=x.useState(!1),u=x.useMemo(()=>QP(t,o),[t,o]),d=x.useMemo(()=>eO(t),[t]),f=x.useCallback(()=>{window.navigator.clipboard.writeText(window.location.href).then(()=>{c(!0),setTimeout(()=>c(!1),2e3)})},[]);return a.jsxs("div",{className:"mb-4 border border-border rounded-md bg-muted/20 px-3 py-2 text-xs",children:[a.jsxs("div",{className:"flex items-center gap-3",children:[i&&a.jsx("a",{href:"/",className:"inline-flex size-8 shrink-0 items-center justify-center rounded-md text-muted-foreground transition-colors hover:bg-muted hover:text-foreground","aria-label":"Back to all sessions",title:"Back to all sessions",children:a.jsx(Ov,{className:"size-3.5"})}),a.jsxs("div",{className:"min-w-0 flex-1",children:[a.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[a.jsx("span",{className:"font-mono font-semibold text-purple-400/90 truncate",title:e,children:Ao(e)}),d!==null&&a.jsx("span",{className:"font-mono text-muted-foreground truncate max-w-[220px]",title:d,children:d})]}),a.jsxs("div",{className:"mt-1 flex flex-wrap items-center gap-x-3 gap-y-1 text-muted-foreground",children:[a.jsxs("span",{children:[t.length," request",t.length!==1?"s":""]}),u!==null&&a.jsx("span",{children:u}),(n>0||r>0)&&a.jsxs("span",{className:"font-mono",children:[Ve(n)," in / ",Ve(r)," out"]})]})]}),a.jsx("button",{type:"button",onClick:f,className:"inline-flex size-8 shrink-0 items-center justify-center rounded-md text-muted-foreground transition-colors hover:bg-muted hover:text-foreground","aria-label":l?"Copied session link":"Copy session link",title:l?"Copied session link":"Copy session link",children:l?a.jsx(rt,{className:"size-3.5"}):a.jsx(_t,{className:"size-3.5"})})]}),a.jsx(gO,{summary:s})]})}function bO({logs:e,sessions:t,models:n,selectedSession:r,selectedModel:o,onSessionChange:s,onModelChange:i,onClearAll:l,onClearGroup:c,viewMode:u,onViewModeChange:d,captureMode:f,strip:h,slowResponseThresholdSeconds:p,timeDisplayFormat:y,hideSessionFilter:m=!1,pinnedSessionId:g}){const{totalIn:b,totalOut:v}=x.useMemo(()=>Cd(e),[e]),{providers:k}=Jf(),[S,C]=x.useState(null),[j,E]=x.useState(null),[T,z]=x.useState(null),[O,B]=x.useState("hidden"),N=x.useRef(null),D=x.useRef(null);tP(N,D,{pageWide:!0}),x.useEffect(()=>{const pe=50+Br.length*400,he=setTimeout(()=>B("playing"),50),me=setTimeout(()=>B("done"),pe);return()=>{clearTimeout(he),clearTimeout(me)}},[]),x.useEffect(()=>{if(g===void 0){document.title="Agent Inspector";return}const le=e.length===1?"1 req":`${e.length} req`;document.title=`${Ao(g)} - ${le} - Agent Inspector`},[e.length,g]);const w=x.useCallback(async le=>{C(le),E(null);try{const de=await Fw(e,le);de.ok||E(de.message)}finally{C(null)}},[e]);x.useEffect(()=>{z(null)},[r,o]);const L=x.useCallback(()=>{z(null)},[]),W=x.useMemo(()=>P5(e),[e]),U=x.useMemo(()=>tO({pinnedSessionId:g,selectedSession:r,sessions:t,logs:e}),[e,g,r,t]),F=U?.logs??[],K=U!==null&&F.length>0,{totalIn:I,totalOut:V}=x.useMemo(()=>Cd(F),[F]),G=x.useMemo(()=>YP(F,k),[F,k]),R=x.useMemo(()=>HR(W),[W]),ae=x.useMemo(()=>FI(W),[W]),oe=XP(f),fe=x.useCallback(le=>{const de=ae.get(le.id);de!==void 0&&z([de,le])},[ae]);return a.jsxs("div",{className:"max-w-[1400px] xl:max-w-[1600px] 2xl:max-w-[1800px] mx-auto px-6 pb-6",children:[a.jsxs("div",{className:"sticky top-0 z-30 bg-background pt-6",children:[a.jsxs("div",{className:"grid grid-cols-[1fr_auto_1fr] items-start gap-3 pb-8",children:[a.jsx("div",{}),a.jsxs("h1",{className:"flex min-w-0 flex-col items-center gap-2 text-center",children:[a.jsxs("span",{className:"flex max-w-[calc(100vw-7rem)] items-end gap-2 whitespace-nowrap",children:[a.jsxs("span",{className:"flex shrink-0 items-end gap-1 group cursor-default","aria-hidden":"true",children:[a.jsx(gz,{className:"size-10 text-amber-500 transition-all duration-300 group-hover:scale-125 group-hover:-translate-y-1.5"}),a.jsx("span",{className:"hidden items-end gap-0.5 sm:flex",children:Br.map((le,de)=>{const pe=["text-amber-500","text-rose-500","text-sky-500","text-emerald-500","text-violet-500","text-orange-500","text-cyan-500","text-pink-500","text-lime-500","text-blue-500","text-yellow-500","text-fuchsia-500"][de],he=O==="hidden"?"opacity-0 scale-0":O==="playing"?"animate-crab-piano-pop":"";return a.jsx(le,{className:`size-5 ${pe} transition-all duration-300 ease-out group-hover:scale-125 group-hover:-translate-y-1 ${he}`,style:{transitionDelay:`${de*50}ms`,...O==="playing"?{animationDelay:`${de*400}ms`}:{}}},de)})})]}),a.jsxs("span",{className:"flex min-w-0 items-baseline gap-2 pl-1",children:[a.jsx("span",{className:"truncate text-lg font-bold",children:"Agent Inspector"}),a.jsxs("span",{className:"shrink-0 font-mono text-xs font-semibold text-muted-foreground",children:["v",Pk.version]})]}),a.jsx(Ri,{className:"size-4 shrink-0 text-muted-foreground/70","aria-hidden":"true"}),a.jsx(bz,{className:"size-10 shrink-0"})]}),a.jsx("span",{className:"max-w-[calc(100vw-7rem)] text-sm font-semibold text-muted-foreground",children:"Local First. Evidence First."}),a.jsx(pO,{})]}),a.jsxs("div",{className:"justify-self-end flex items-center gap-1",children:[a.jsx(Vz,{}),a.jsx(FR,{})]})]}),K&&U!==null&&a.jsx(xO,{label:U.label,logs:F,totalIn:I,totalOut:V,timeDisplayFormat:y,contextSummary:G,showBackLink:U.showBackLink}),a.jsxs("div",{className:"flex items-center gap-3 mb-4",children:[!m&&a.jsxs(Qo,{value:r,onValueChange:s,children:[a.jsx(ts,{className:"flex-1 max-w-[350px] text-xs",children:a.jsx(es,{placeholder:"All sessions"})}),a.jsxs(ns,{children:[a.jsx(Lt,{value:"__all__",children:"All sessions"}),t.map(le=>a.jsx(Lt,{value:le,children:Ao(le)},le))]})]}),a.jsxs(Qo,{value:o,onValueChange:i,children:[a.jsx(ts,{className:"flex-1 max-w-[250px] text-xs",children:a.jsx(es,{placeholder:"All models"})}),a.jsxs(ns,{children:[a.jsx(Lt,{value:"__all__",children:"All models"}),n.map(le=>a.jsx(Lt,{value:le,children:le},le))]})]}),f==="full"?a.jsxs("div",{className:"flex items-center border border-border rounded-md overflow-hidden",children:[a.jsx("button",{type:"button",onClick:()=>d("simple"),className:`h-8 px-3 cursor-pointer transition-colors text-xs ${u==="simple"?"bg-muted text-foreground":"text-muted-foreground hover:bg-muted/50"}`,children:"Simple"}),a.jsx("button",{type:"button",onClick:()=>d("full"),className:`h-8 px-3 cursor-pointer transition-colors text-xs ${u==="full"?"bg-muted text-foreground":"text-muted-foreground hover:bg-muted/50"}`,children:"Full"})]}):a.jsx("div",{className:"flex h-8 items-center rounded-md border border-border bg-muted px-3 text-xs text-foreground",children:"Simple"}),a.jsx("div",{className:"flex-1"}),!K&&a.jsxs("span",{className:"text-muted-foreground text-xs font-mono",children:[e.length," request",e.length!==1?"s":"",b>0||v>0?` - ${Ve(b)} in / ${Ve(v)} out`:""]}),e.length>0&&oe&&a.jsx("button",{type:"button",onClick:()=>{w("redacted")},disabled:S!==null,className:"h-8 px-3 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.5 rounded-md hover:bg-muted",title:"Export redacted logs as JSON ZIP",children:S==="redacted"?a.jsx("span",{children:"Exporting..."}):a.jsxs(a.Fragment,{children:[a.jsx(ds,{className:"size-3.5"}),a.jsx("span",{children:"Export"})]})}),e.length>0&&a.jsx("button",{type:"button",onClick:()=>{w("raw")},disabled:S!==null,className:"h-8 px-2 text-xs text-muted-foreground hover:text-foreground transition-colors cursor-pointer disabled:opacity-50 disabled:cursor-not-allowed rounded-md hover:bg-muted",title:"Export raw logs without redaction",children:S==="raw"?"Exporting...":"Raw"}),a.jsx("button",{type:"button",onClick:l,className:"h-8 px-3 text-xs text-muted-foreground hover:text-foreground transition-colors cursor-pointer rounded-md hover:bg-muted",title:"Clear all logs",children:"Clear"})]}),j!==null&&a.jsx("div",{className:"mb-4 rounded-md border border-destructive/30 bg-destructive/10 px-3 py-2 text-xs text-destructive",children:j})]}),a.jsx("div",{children:e.length===0?r!=="__all__"?a.jsxs("div",{className:"text-center text-muted-foreground py-16 space-y-4",children:[a.jsx("p",{className:"text-sm font-medium",children:"Session not found"}),a.jsx("p",{className:"text-xs font-mono bg-muted px-3 py-1 rounded inline-block max-w-[500px] break-all",children:Ao(r)}),a.jsxs("p",{className:"text-xs",children:["This session may have been cleared or never existed."," ",m?a.jsx("a",{href:"/",className:"underline hover:text-foreground transition-colors",children:"Back to all sessions"}):a.jsx("button",{type:"button",onClick:()=>s("__all__"),className:"underline hover:text-foreground transition-colors",children:"Show all sessions"})]})]}):a.jsxs("div",{className:"text-center text-muted-foreground py-16 space-y-4",children:[a.jsx("p",{className:"text-sm",children:"No requests captured yet."}),a.jsx("p",{className:"text-xs",children:"Route AI coding tools through the proxy:"}),a.jsxs("div",{className:"flex flex-col items-center gap-2",children:[a.jsx(Ed,{command:"ANTHROPIC_BASE_URL=http://localhost:25947/proxy <your-tool>"}),a.jsx(Ed,{command:"OPENAI_BASE_URL=http://localhost:25947/proxy <your-tool>"})]}),a.jsx("p",{className:"mx-auto max-w-xl text-xs leading-relaxed text-muted-foreground",children:"Container note: if your AI tool runs in a different container or host than Agent Inspector, replace localhost with an address reachable from that tool and verify the network/firewall path."})]}):a.jsx("div",{ref:D,tabIndex:0,className:"flex flex-col gap-2 focus:outline-none",children:a.jsx("div",{ref:N,children:a.jsx(GR,{groups:W,viewMode:u,strip:h,slowResponseThresholdSeconds:p,cacheTrends:R,onCompareWithPrevious:fe,comparisonPredecessors:ae,onClearGroup:c,standalone:W.length===1,hasPinnedSessionContext:K,timeDisplayFormat:y})})})}),T!==null&&a.jsx(x.Suspense,{fallback:null,children:a.jsx(xN,{left:T[0],right:T[1],onClose:L})})]})}const yO=rn([te({type:je("init"),logs:we(cc)}),te({type:je("update"),log:cc})]);function vO(e){const t=new Set;for(const n of e)n.sessionId!==null&&n.sessionId!==""&&t.add(n.sessionId);return[...t]}function wO(e){const t=new Set;for(const n of e)n.model!==null&&n.model!==""&&t.add(n.model);return[...t]}function kO(e,t,n){return t==="__all__"&&n==="__all__"?e:e.filter(r=>!(t!=="__all__"&&r.sessionId!==t||n!=="__all__"&&r.model!==n))}const _O=50,SO=12,CO=1800,Ad=500;function jO(e){return e===void 0?"/api/logs/stream":`/api/logs/stream?${new URLSearchParams({sessionId:e}).toString()}`}function Ci(e){const t=new Map;for(let n=0;n<e.length;n++){const r=e[n];r!==void 0&&t.set(r.id,n)}return t}function Id(e){return e.length<=Ad?e:e.slice(e.length-Ad)}function IO({initialSessionId:e}={}){const[t,n]=x.useState([]),[r,o]=x.useState(e??"__all__"),[s,i]=x.useState("__all__"),[l,c]=x.useState("simple"),[u,d]=x.useState(null),f=x.useRef(null),h=x.useRef(null),p=x.useRef(null),y=x.useRef(new Map),m=x.useRef([]),g=x.useRef(null),b=x.useMemo(()=>kO(t,r,s),[t,r,s]),v=x.useMemo(()=>vO(t),[t]),k=x.useMemo(()=>wO(t),[t]),S=x.useCallback(()=>{g.current=null;const D=m.current;m.current=[],D.length!==0&&n(w=>{let L=w;for(const W of D){const U=y.current.get(W.id);U!==void 0?L=[...L.slice(0,U),W,...L.slice(U+1)]:(y.current.set(W.id,L.length),L=[...L,W])}return L=Id(L),y.current=Ci(L),L})},[]),C=x.useCallback(D=>{m.current.push(D),g.current===null&&(g.current=setTimeout(S,_O))},[S]),j=x.useCallback(()=>{f.current&&f.current.close();const D=new EventSource(jO(e));f.current=D,D.onmessage=w=>{try{const L=String(w.data),W=JSON.parse(L),U=yO.safeParse(W);if(!U.success){d("Failed to parse SSE data");return}const F=U.data;if(F.type==="init"){g.current!==null&&(clearTimeout(g.current),g.current=null),m.current=[];const K=Id(F.logs);y.current=Ci(K),n(K),d(null)}else F.type==="update"&&C(F.log)}catch{d("Failed to parse SSE data")}},D.onerror=()=>{d("SSE connection lost, reconnecting..."),D.close(),h.current!==null&&clearTimeout(h.current),h.current=setTimeout(j,3e3)}},[e,C]);x.useEffect(()=>(j(),()=>{f.current&&(f.current.close(),f.current=null),h.current!==null&&(clearTimeout(h.current),h.current=null),g.current!==null&&(clearTimeout(g.current),g.current=null)}),[j]),x.useEffect(()=>{const D=window.location.hash;if(!D.startsWith("#log-")||p.current===D)return;const w=D.slice(1),L=Number(w.replace(/^log-/,""));Number.isInteger(L)&&L>0&&fa({logId:L,tab:"request"});let W=!1,U=0,F=null,K=null;const I=()=>{if(W)return;const V=document.getElementById(w);if(V!==null){p.current=D,V.scrollIntoView({block:"center",behavior:"smooth"}),V instanceof HTMLElement&&(F=V,V.setAttribute("data-deep-link-highlight","true"),K=window.setTimeout(()=>{V.removeAttribute("data-deep-link-highlight")},CO),V.focus({preventScroll:!0}),V.getAttribute("data-nav-action")==="expand"&&V.click());return}U+=1,U<SO&&window.setTimeout(I,100)};return I(),()=>{W=!0,K!==null&&window.clearTimeout(K),F!==null&&F.removeAttribute("data-deep-link-highlight")}},[b.length]);const E=x.useCallback(()=>{e!==void 0&&t.length===0||(async()=>{try{const D=e===void 0?void 0:JSON.stringify({ids:t.map(L=>L.id)});if(!(await fetch("/api/logs",{method:"DELETE",...D===void 0?{}:{headers:{"Content-Type":"application/json"},body:D}})).ok){d("Failed to clear logs");return}y.current.clear(),n([]),d(null)}catch(D){d(D instanceof Error?D.message:"Unknown error clearing logs")}})()},[t,e]),T=x.useCallback(D=>{D.length!==0&&(async()=>{try{if(!(await fetch("/api/logs",{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({ids:D})})).ok){d("Failed to clear group");return}const L=new Set(D);n(W=>{const U=W.filter(F=>!L.has(F.id));return y.current=Ci(U),U}),d(null)}catch(w){d(w instanceof Error?w.message:"Unknown error clearing group")}})()},[]),{strip:z,captureMode:O,slowResponseThresholdSeconds:B,timeDisplayFormat:N}=Ra();return a.jsxs(a.Fragment,{children:[u!==null&&a.jsx("div",{className:"fixed top-4 right-4 bg-destructive text-destructive-foreground px-4 py-2 rounded-md text-sm z-50",children:u}),a.jsx(jw,{}),a.jsx(bO,{logs:b,sessions:v,models:k,selectedSession:r,selectedModel:s,onSessionChange:o,onModelChange:i,onClearAll:E,onClearGroup:T,viewMode:l,onViewModeChange:c,captureMode:O,strip:z,slowResponseThresholdSeconds:B,timeDisplayFormat:N,hideSessionFilter:e!==void 0,pinnedSessionId:e})]})}export{zA as $,we as A,st as B,u2 as C,zs as D,fa as E,Ze as F,A as G,cc as H,HP as I,IA as J,rP as K,nP as L,D2 as M,Gf as N,AO as O,IO as P,Zt as Q,Y2 as R,aP as S,_m as T,Te as U,Zu as V,iE as W,La as X,TO as Y,Nf as Z,aE as _,R5 as a,Rf as a0,Cl as a1,Jo as a2,Dr as a3,Lo as a4,Ak as a5,Wt as a6,ve as b,ge as c,Ri as d,zf as e,Ve as f,wg as g,on as h,rt as i,_t as j,Rs as k,Ps as l,Os as m,K2 as n,Sm as o,Tt as p,At as q,Hr as r,Ae as s,tt as t,Jf as u,Fe as v,$e as w,Be as x,te as y,ie as z};
|
|
113
|
+
`}),n}function Du(e){let t=0,n=e.charCodeAt(t);for(;n===9||n===32;)t++,n=e.charCodeAt(t);return e.slice(t)}function Fu(e,t){const n=jA(e,t),r=n.one(e,void 0),o=mA(n),s=Array.isArray(r)?{type:"root",children:r}:r||{type:"root",children:[]};return o&&s.children.push({type:"text",value:`
|
|
114
|
+
`},o),s}function IA(e,t){return e&&"run"in e?async function(n,r){const o=Fu(n,{file:r,...t});await e.run(o,r)}:function(n,r){return Fu(n,{file:r,...e||t})}}function $u(e){if(e)throw e}var fi,Bu;function zA(){if(Bu)return fi;Bu=1;var e=Object.prototype.hasOwnProperty,t=Object.prototype.toString,n=Object.defineProperty,r=Object.getOwnPropertyDescriptor,o=function(u){return typeof Array.isArray=="function"?Array.isArray(u):t.call(u)==="[object Array]"},s=function(u){if(!u||t.call(u)!=="[object Object]")return!1;var d=e.call(u,"constructor"),f=u.constructor&&u.constructor.prototype&&e.call(u.constructor.prototype,"isPrototypeOf");if(u.constructor&&!d&&!f)return!1;var h;for(h in u);return typeof h>"u"||e.call(u,h)},i=function(u,d){n&&d.name==="__proto__"?n(u,d.name,{enumerable:!0,configurable:!0,value:d.newValue,writable:!0}):u[d.name]=d.newValue},l=function(u,d){if(d==="__proto__")if(e.call(u,d)){if(r)return r(u,d).value}else return;return u[d]};return fi=function c(){var u,d,f,h,p,y,m=arguments[0],g=1,b=arguments.length,v=!1;for(typeof m=="boolean"&&(v=m,m=arguments[1]||{},g=2),(m==null||typeof m!="object"&&typeof m!="function")&&(m={});g<b;++g)if(u=arguments[g],u!=null)for(d in u)f=l(m,d),h=l(u,d),m!==h&&(v&&h&&(s(h)||(p=o(h)))?(p?(p=!1,y=f&&o(f)?f:[]):y=f&&s(f)?f:{},i(m,{name:d,newValue:c(v,y,h)})):typeof h<"u"&&i(m,{name:d,newValue:h}));return m},fi}var RA=zA();const pi=ka(RA);function ua(e){if(typeof e!="object"||e===null)return!1;const t=Object.getPrototypeOf(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)}function PA(){const e=[],t={run:n,use:r};return t;function n(...o){let s=-1;const i=o.pop();if(typeof i!="function")throw new TypeError("Expected function as last argument, not "+i);l(null,...o);function l(c,...u){const d=e[++s];let f=-1;if(c){i(c);return}for(;++f<o.length;)(u[f]===null||u[f]===void 0)&&(u[f]=o[f]);o=u,d?OA(d,l)(...u):i(null,...u)}}function r(o){if(typeof o!="function")throw new TypeError("Expected `middelware` to be a function, not "+o);return e.push(o),t}}function OA(e,t){let n;return r;function r(...i){const l=e.length>i.length;let c;l&&i.push(o);try{c=e.apply(this,i)}catch(u){const d=u;if(l&&n)throw d;return o(d)}l||(c&&c.then&&typeof c.then=="function"?c.then(s,o):c instanceof Error?o(c):s(c))}function o(i,...l){n||(n=!0,t(i,...l))}function s(i){o(null,i)}}const Mt={basename:MA,dirname:LA,extname:DA,join:FA,sep:"/"};function MA(e,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');Xr(e);let n=0,r=-1,o=e.length,s;if(t===void 0||t.length===0||t.length>e.length){for(;o--;)if(e.codePointAt(o)===47){if(s){n=o+1;break}}else r<0&&(s=!0,r=o+1);return r<0?"":e.slice(n,r)}if(t===e)return"";let i=-1,l=t.length-1;for(;o--;)if(e.codePointAt(o)===47){if(s){n=o+1;break}}else i<0&&(s=!0,i=o+1),l>-1&&(e.codePointAt(o)===t.codePointAt(l--)?l<0&&(r=o):(l=-1,r=i));return n===r?r=i:r<0&&(r=e.length),e.slice(n,r)}function LA(e){if(Xr(e),e.length===0)return".";let t=-1,n=e.length,r;for(;--n;)if(e.codePointAt(n)===47){if(r){t=n;break}}else r||(r=!0);return t<0?e.codePointAt(0)===47?"/":".":t===1&&e.codePointAt(0)===47?"//":e.slice(0,t)}function DA(e){Xr(e);let t=e.length,n=-1,r=0,o=-1,s=0,i;for(;t--;){const l=e.codePointAt(t);if(l===47){if(i){r=t+1;break}continue}n<0&&(i=!0,n=t+1),l===46?o<0?o=t:s!==1&&(s=1):o>-1&&(s=-1)}return o<0||n<0||s===0||s===1&&o===n-1&&o===r+1?"":e.slice(o,n)}function FA(...e){let t=-1,n;for(;++t<e.length;)Xr(e[t]),e[t]&&(n=n===void 0?e[t]:n+"/"+e[t]);return n===void 0?".":$A(n)}function $A(e){Xr(e);const t=e.codePointAt(0)===47;let n=BA(e,!t);return n.length===0&&!t&&(n="."),n.length>0&&e.codePointAt(e.length-1)===47&&(n+="/"),t?"/"+n:n}function BA(e,t){let n="",r=0,o=-1,s=0,i=-1,l,c;for(;++i<=e.length;){if(i<e.length)l=e.codePointAt(i);else{if(l===47)break;l=47}if(l===47){if(!(o===i-1||s===1))if(o!==i-1&&s===2){if(n.length<2||r!==2||n.codePointAt(n.length-1)!==46||n.codePointAt(n.length-2)!==46){if(n.length>2){if(c=n.lastIndexOf("/"),c!==n.length-1){c<0?(n="",r=0):(n=n.slice(0,c),r=n.length-1-n.lastIndexOf("/")),o=i,s=0;continue}}else if(n.length>0){n="",r=0,o=i,s=0;continue}}t&&(n=n.length>0?n+"/..":"..",r=2)}else n.length>0?n+="/"+e.slice(o+1,i):n=e.slice(o+1,i),r=i-o-1;o=i,s=0}else l===46&&s>-1?s++:s=-1}return n}function Xr(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const UA={cwd:WA};function WA(){return"/"}function da(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function VA(e){if(typeof e=="string")e=new URL(e);else if(!da(e)){const t=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+e+"`");throw t.code="ERR_INVALID_ARG_TYPE",t}if(e.protocol!=="file:"){const t=new TypeError("The URL must be of scheme file");throw t.code="ERR_INVALID_URL_SCHEME",t}return HA(e)}function HA(e){if(e.hostname!==""){const r=new TypeError('File URL host must be "localhost" or empty on darwin');throw r.code="ERR_INVALID_FILE_URL_HOST",r}const t=e.pathname;let n=-1;for(;++n<t.length;)if(t.codePointAt(n)===37&&t.codePointAt(n+1)===50){const r=t.codePointAt(n+2);if(r===70||r===102){const o=new TypeError("File URL path must not include encoded / characters");throw o.code="ERR_INVALID_FILE_URL_PATH",o}}return decodeURIComponent(t)}const hi=["history","path","basename","stem","extname","dirname"];class gg{constructor(t){let n;t?da(t)?n={path:t}:typeof t=="string"||ZA(t)?n={value:t}:n=t:n={},this.cwd="cwd"in n?"":UA.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let r=-1;for(;++r<hi.length;){const s=hi[r];s in n&&n[s]!==void 0&&n[s]!==null&&(this[s]=s==="history"?[...n[s]]:n[s])}let o;for(o in n)hi.includes(o)||(this[o]=n[o])}get basename(){return typeof this.path=="string"?Mt.basename(this.path):void 0}set basename(t){gi(t,"basename"),mi(t,"basename"),this.path=Mt.join(this.dirname||"",t)}get dirname(){return typeof this.path=="string"?Mt.dirname(this.path):void 0}set dirname(t){Uu(this.basename,"dirname"),this.path=Mt.join(t||"",this.basename)}get extname(){return typeof this.path=="string"?Mt.extname(this.path):void 0}set extname(t){if(mi(t,"extname"),Uu(this.dirname,"extname"),t){if(t.codePointAt(0)!==46)throw new Error("`extname` must start with `.`");if(t.includes(".",1))throw new Error("`extname` cannot contain multiple dots")}this.path=Mt.join(this.dirname,this.stem+(t||""))}get path(){return this.history[this.history.length-1]}set path(t){da(t)&&(t=VA(t)),gi(t,"path"),this.path!==t&&this.history.push(t)}get stem(){return typeof this.path=="string"?Mt.basename(this.path,this.extname):void 0}set stem(t){gi(t,"stem"),mi(t,"stem"),this.path=Mt.join(this.dirname||"",t+(this.extname||""))}fail(t,n,r){const o=this.message(t,n,r);throw o.fatal=!0,o}info(t,n,r){const o=this.message(t,n,r);return o.fatal=void 0,o}message(t,n,r){const o=new it(t,n,r);return this.path&&(o.name=this.path+":"+o.name,o.file=this.path),o.fatal=!1,this.messages.push(o),o}toString(t){return this.value===void 0?"":typeof this.value=="string"?this.value:new TextDecoder(t||void 0).decode(this.value)}}function mi(e,t){if(e&&e.includes(Mt.sep))throw new Error("`"+t+"` cannot be a path: did not expect `"+Mt.sep+"`")}function gi(e,t){if(!e)throw new Error("`"+t+"` cannot be empty")}function Uu(e,t){if(!e)throw new Error("Setting `"+t+"` requires `path` to be set too")}function ZA(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const qA=(function(e){const r=this.constructor.prototype,o=r[e],s=function(){return o.apply(s,arguments)};return Object.setPrototypeOf(s,r),s}),KA={}.hasOwnProperty;class jl extends qA{constructor(){super("copy"),this.Compiler=void 0,this.Parser=void 0,this.attachers=[],this.compiler=void 0,this.freezeIndex=-1,this.frozen=void 0,this.namespace={},this.parser=void 0,this.transformers=PA()}copy(){const t=new jl;let n=-1;for(;++n<this.attachers.length;){const r=this.attachers[n];t.use(...r)}return t.data(pi(!0,{},this.namespace)),t}data(t,n){return typeof t=="string"?arguments.length===2?(yi("data",this.frozen),this.namespace[t]=n,this):KA.call(this.namespace,t)&&this.namespace[t]||void 0:t?(yi("data",this.frozen),this.namespace=t,this):this.namespace}freeze(){if(this.frozen)return this;const t=this;for(;++this.freezeIndex<this.attachers.length;){const[n,...r]=this.attachers[this.freezeIndex];if(r[0]===!1)continue;r[0]===!0&&(r[0]=void 0);const o=n.call(t,...r);typeof o=="function"&&this.transformers.use(o)}return this.frozen=!0,this.freezeIndex=Number.POSITIVE_INFINITY,this}parse(t){this.freeze();const n=vo(t),r=this.parser||this.Parser;return xi("parse",r),r(String(n),n)}process(t,n){const r=this;return this.freeze(),xi("process",this.parser||this.Parser),bi("process",this.compiler||this.Compiler),n?o(void 0,n):new Promise(o);function o(s,i){const l=vo(t),c=r.parse(l);r.run(c,l,function(d,f,h){if(d||!f||!h)return u(d);const p=f,y=r.stringify(p,h);YA(y)?h.value=y:h.result=y,u(d,h)});function u(d,f){d||!f?i(d):s?s(f):n(void 0,f)}}}processSync(t){let n=!1,r;return this.freeze(),xi("processSync",this.parser||this.Parser),bi("processSync",this.compiler||this.Compiler),this.process(t,o),Vu("processSync","process",n),r;function o(s,i){n=!0,$u(s),r=i}}run(t,n,r){Wu(t),this.freeze();const o=this.transformers;return!r&&typeof n=="function"&&(r=n,n=void 0),r?s(void 0,r):new Promise(s);function s(i,l){const c=vo(n);o.run(t,c,u);function u(d,f,h){const p=f||t;d?l(d):i?i(p):r(void 0,p,h)}}}runSync(t,n){let r=!1,o;return this.run(t,n,s),Vu("runSync","run",r),o;function s(i,l){$u(i),o=l,r=!0}}stringify(t,n){this.freeze();const r=vo(n),o=this.compiler||this.Compiler;return bi("stringify",o),Wu(t),o(t,r)}use(t,...n){const r=this.attachers,o=this.namespace;if(yi("use",this.frozen),t!=null)if(typeof t=="function")c(t,n);else if(typeof t=="object")Array.isArray(t)?l(t):i(t);else throw new TypeError("Expected usable value, not `"+t+"`");return this;function s(u){if(typeof u=="function")c(u,[]);else if(typeof u=="object")if(Array.isArray(u)){const[d,...f]=u;c(d,f)}else i(u);else throw new TypeError("Expected usable value, not `"+u+"`")}function i(u){if(!("plugins"in u)&&!("settings"in u))throw new Error("Expected usable value but received an empty preset, which is probably a mistake: presets typically come with `plugins` and sometimes with `settings`, but this has neither");l(u.plugins),u.settings&&(o.settings=pi(!0,o.settings,u.settings))}function l(u){let d=-1;if(u!=null)if(Array.isArray(u))for(;++d<u.length;){const f=u[d];s(f)}else throw new TypeError("Expected a list of plugins, not `"+u+"`")}function c(u,d){let f=-1,h=-1;for(;++f<r.length;)if(r[f][0]===u){h=f;break}if(h===-1)r.push([u,...d]);else if(d.length>0){let[p,...y]=d;const m=r[h][1];ua(m)&&ua(p)&&(p=pi(!0,m,p)),r[h]=[u,p,...y]}}}}const GA=new jl().freeze();function xi(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function bi(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function yi(e,t){if(t)throw new Error("Cannot call `"+e+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function Wu(e){if(!ua(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function Vu(e,t,n){if(!n)throw new Error("`"+e+"` finished async. Use `"+t+"` instead")}function vo(e){return JA(e)?e:new gg(e)}function JA(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function YA(e){return typeof e=="string"||XA(e)}function XA(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const QA="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",Hu=[],Zu={allowDangerousHtml:!0},eI=/^(https?|ircs?|mailto|xmpp)$/i,tI=[{from:"astPlugins",id:"remove-buggy-html-in-markdown-parser"},{from:"allowDangerousHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"allowNode",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowElement"},{from:"allowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowedElements"},{from:"className",id:"remove-classname"},{from:"disallowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"disallowedElements"},{from:"escapeHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"includeElementIndex",id:"#remove-includeelementindex"},{from:"includeNodeIndex",id:"change-includenodeindex-to-includeelementindex"},{from:"linkTarget",id:"remove-linktarget"},{from:"plugins",id:"change-plugins-to-remarkplugins",to:"remarkPlugins"},{from:"rawSourcePos",id:"#remove-rawsourcepos"},{from:"renderers",id:"change-renderers-to-components",to:"components"},{from:"source",id:"change-source-to-children",to:"children"},{from:"sourcePos",id:"#remove-sourcepos"},{from:"transformImageUri",id:"#add-urltransform",to:"urlTransform"},{from:"transformLinkUri",id:"#add-urltransform",to:"urlTransform"}];function qu(e){const t=nI(e),n=rI(e);return oI(t.runSync(t.parse(n),n),e)}function nI(e){const t=e.rehypePlugins||Hu,n=e.remarkPlugins||Hu,r=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...Zu}:Zu;return GA().use(M4).use(n).use(IA,r).use(t)}function rI(e){const t=e.children||"",n=new gg;return typeof t=="string"&&(n.value=t),n}function oI(e,t){const n=t.allowedElements,r=t.allowElement,o=t.components,s=t.disallowedElements,i=t.skipHtml,l=t.unwrapDisallowed,c=t.urlTransform||sI;for(const d of tI)Object.hasOwn(t,d.from)&&(""+d.from+(d.to?"use `"+d.to+"` instead":"remove it")+QA+d.id,void 0);return mg(e,u),m3(e,{Fragment:a.Fragment,components:o,ignoreInvalidStyle:!0,jsx:a.jsx,jsxs:a.jsxs,passKeys:!0,passNode:!0});function u(d,f,h){if(d.type==="raw"&&h&&typeof f=="number")return i?h.children.splice(f,1):h.children[f]={type:"text",value:d.value},f;if(d.type==="element"){let p;for(p in ci)if(Object.hasOwn(ci,p)&&Object.hasOwn(d.properties,p)){const y=d.properties[p],m=ci[p];(m===null||m.includes(d.tagName))&&(d.properties[p]=c(String(y||""),p,d))}}if(d.type==="element"){let p=n?!n.includes(d.tagName):s?s.includes(d.tagName):!1;if(!p&&r&&typeof f=="number"&&(p=!r(d,f,h)),p&&h&&typeof f=="number")return l&&d.children?h.children.splice(f,1,...d.children):h.children.splice(f,1),f}}}function sI(e){const t=e.indexOf(":"),n=e.indexOf("?"),r=e.indexOf("#"),o=e.indexOf("/");return t===-1||o!==-1&&t>o||n!==-1&&t>n||r!==-1&&t>r||eI.test(e.slice(0,t))?e:""}function xg(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 Ir(e){return e!==null&&(Array.isArray(e)||typeof e=="object")}function bg(e){return Array.isArray(e)?e.map((t,n)=>[String(n),t]):typeof e=="object"&&e!==null?Object.entries(e):[]}const Ku=120;function iI({text:e}){const[t,n]=x.useState(!1);return e.length>Ku?a.jsxs("span",{className:"text-emerald-400 break-all",children:['"',t?a.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:a.jsx(qu,{children:e})}):a.jsxs(Fe,{delayDuration:300,children:[a.jsxs($e,{onClick:o=>{o.stopPropagation(),n(!0)},className:"text-left cursor-pointer",children:[a.jsx("span",{children:e.slice(0,Ku)}),a.jsx("span",{className:"text-emerald-400/50",children:"…"})]}),a.jsxs(Be,{side:"bottom",className:"max-w-md text-xs p-2 break-words whitespace-pre-wrap",children:[e.slice(0,500),e.length>500?"…":""]})]}),'"']}):a.jsxs("span",{className:"text-emerald-400 break-all",children:['"',a.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:a.jsx(qu,{children:e})}),'"']})}function yg({value:e}){if(e===null)return a.jsx("span",{className:"text-rose-400 italic",children:"null"});switch(typeof e){case"string":return a.jsx(iI,{text:e});case"number":return a.jsx("span",{className:"text-amber-400",children:e});case"boolean":return a.jsx("span",{className:"text-blue-400",children:e?"true":"false"});case"object":case"bigint":case"symbol":case"undefined":case"function":return a.jsx("span",{className:"text-muted-foreground",children:JSON.stringify(e)})}}function Gu({value:e}){const[t,n]=x.useState(!1);function r(o){o.stopPropagation(),window.navigator.clipboard.writeText(JSON.stringify(e,null,2)).then(()=>{n(!0),setTimeout(()=>{n(!1)},2e3)})}return a.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?a.jsx(rt,{className:"size-3 text-green-500"}):a.jsx(_t,{className:"size-3"})})}function aI({value:e}){const[t,n]=x.useState(!1);function r(o){o.stopPropagation(),window.navigator.clipboard.writeText(JSON.stringify(e,null,2)).then(()=>{n(!0),setTimeout(()=>{n(!1)},2e3)})}return a.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?a.jsx(rt,{className:"size-3 text-green-500"}):a.jsx(_t,{className:"size-3 text-muted-foreground"})})}function lI({onClick:e}){return a.jsx("button",{type:"button",onClick:e,className:"opacity-0 group-hover/row:opacity-100 hover:bg-muted p-0.5 rounded transition-opacity shrink-0",title:"Expand all descendants",children:a.jsx(Ef,{className:"size-3.5 text-muted-foreground"})})}const cI=x.memo(function e({name:t,value:n,level:r,defaultExpandDepth:o,isArrayItem:s,path:i,expandTargetPath:l,anatomyPaths:c}){const u=x.useMemo(()=>l===null?!1:i===""?l.length>0:l===i||l.startsWith(`${i}/`),[l,i]),d=r<o||u&&Ir(n),[f,h]=x.useState(d);x.useEffect(()=>{u&&Ir(n)&&!f&&h(!0)},[l]);const[p,y]=x.useState(0),[m,g]=x.useState(null),b=Ir(n),v=m===Number.POSITIVE_INFINITY,k=x.useMemo(()=>bg(n),[n]),S=x.useMemo(()=>k.some(([,w])=>Ir(w)),[k]),C=xg(n),j=C==="array"?"[":"{",E=C==="array"?"]":"}",T=c!==null&&c.has(i);function z(){h(!0),g(Number.POSITIVE_INFINITY),y(w=>w+1)}function O(){h(!1),g(0),y(w=>w+1)}function B(){v?O():h(!f)}function N(w){w.stopPropagation(),z()}const D=m??o;return a.jsxs("div",{className:ve(r>0&&"border-l border-border/50 ml-2"),children:[a.jsxs("div",{className:ve("flex items-start gap-1 py-0.5 px-1 -ml-1 rounded-sm group/row",b&&"cursor-pointer hover:bg-muted/50"),"data-anatomy-path":T?i:void 0,onClick:b?B:void 0,onKeyDown:b?w=>{(w.key==="Enter"||w.key===" ")&&(w.preventDefault(),B())}:void 0,onDoubleClick:b&&S?()=>z():void 0,role:b?"button":void 0,tabIndex:b?0:void 0,children:[b?a.jsx("span",{className:"w-4 h-5 flex items-center justify-center shrink-0",children:f?a.jsx(Zt,{className:"size-3 text-muted-foreground"}):a.jsx(on,{className:"size-3 text-muted-foreground"})}):a.jsx("span",{className:"w-4 shrink-0"}),a.jsx("span",{className:ve("shrink-0",s?"text-muted-foreground":"text-cyan-400"),children:s?t:`"${t}"`}),a.jsx("span",{className:"text-muted-foreground shrink-0",children:b?"":":"}),b?a.jsxs("span",{className:"text-muted-foreground",children:[j,a.jsxs("span",{className:"text-muted-foreground/60 text-xs",children:[" ",k.length," ",k.length===1?"item":"items"," ",E]})]}):a.jsx("span",{className:"min-w-0",children:a.jsx(yg,{value:n})}),b&&S&&!v&&a.jsx(lI,{onClick:N}),a.jsx(aI,{value:n})]}),b&&f&&a.jsxs("div",{className:"pl-4",children:[k.map(([w,L])=>a.jsx(e,{name:w,value:L,level:r+1,defaultExpandDepth:D,isArrayItem:C==="array",path:i===""?`/${w}`:`${i}/${w}`,expandTargetPath:l,anatomyPaths:c},w)),a.jsx("div",{className:"text-muted-foreground py-0.5 px-1",children:E})]},p)]})});function Nl({data:e,defaultExpandDepth:t=0,className:n,showCopy:r=!1,bulkDepth:o,bulkRevision:s,anatomyPaths:i=null,expandToPath:l=null}){const c=Ir(e),u=x.useMemo(()=>bg(e),[e]),d=o??t,f=s??0;if(!c)return a.jsx(tt,{children:a.jsx("div",{className:ve("font-mono text-xs leading-relaxed",n),children:a.jsxs("div",{className:"flex items-center gap-1",children:[a.jsx(yg,{value:e}),r&&a.jsx(Gu,{value:e})]})})});const p=xg(e)==="array";return a.jsx(tt,{children:a.jsxs("div",{className:ve("font-mono text-xs leading-relaxed",n),children:[r&&a.jsx("div",{className:"mb-2 flex items-center justify-end gap-2",children:a.jsx(Gu,{value:e})}),a.jsx("div",{children:u.map(([y,m])=>a.jsx(cI,{name:y,value:m,level:0,defaultExpandDepth:d,isArrayItem:p,path:`/${y}`,expandTargetPath:l,anatomyPaths:i},y))},f)]})})}const uI=x.memo(function({text:t,defaultExpandDepth:n=0,className:r,bulkDepth:o,bulkRevision:s}){const i=x.useMemo(()=>Cm(t),[t]);return i.kind==="json"?a.jsx(Nl,{data:i.data,defaultExpandDepth:n,className:r,bulkDepth:o,bulkRevision:s}):a.jsx("pre",{className:ve("font-mono text-xs whitespace-pre-wrap break-words",r),children:t})}),vg=Object.freeze(Object.defineProperty({__proto__:null,JsonViewer:Nl,JsonViewerFromString:uI},Symbol.toStringTag,{value:"Module"}));function dI({className:e,children:t,...n}){return a.jsxs(gj,{"data-slot":"scroll-area",className:ve("relative overflow-hidden",e),...n,children:[a.jsx(xj,{"data-slot":"scroll-area-viewport",className:"focus-visible:ring-ring/50 size-full max-h-[inherit] rounded-[inherit] transition-[color,box-shadow] outline-none focus-visible:ring-[3px] focus-visible:outline-1",children:t}),a.jsx(fI,{}),a.jsx(bj,{})]})}function fI({className:e,orientation:t="vertical",...n}){return a.jsx(mh,{"data-slot":"scroll-area-scrollbar",orientation:t,className:ve("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:a.jsx(yh,{"data-slot":"scroll-area-thumb",className:"bg-border relative flex-1 rounded-full"})})}const wg={file:"file",shell:"shell",browser:"browser",web:"web",mcp:"MCP",code:"code",other:"other"},pI={file:"border-blue-400/20 bg-blue-400/5 text-blue-300",shell:"border-teal-400/20 bg-teal-400/5 text-teal-300",browser:"border-cyan-400/20 bg-cyan-400/5 text-cyan-300",web:"border-sky-400/20 bg-sky-400/5 text-sky-300",mcp:"border-violet-400/20 bg-violet-400/5 text-violet-300",code:"border-emerald-400/20 bg-emerald-400/5 text-emerald-300",other:"border-muted-foreground/20 bg-muted/30 text-muted-foreground"};function hI({category:e}){switch(e){case"file":return a.jsx(N2,{className:"size-3.5"});case"shell":return a.jsx(Rf,{className:"size-3.5"});case"browser":return a.jsx(U2,{className:"size-3.5"});case"web":return a.jsx(If,{className:"size-3.5"});case"mcp":return a.jsx(Bv,{className:"size-3.5"});case"code":return a.jsx(l2,{className:"size-3.5"});case"other":return a.jsx(h2,{className:"size-3.5"})}}function mI({names:e}){return e.length===0?null:a.jsxs("div",{className:"flex min-w-0 flex-wrap items-center gap-1",children:[a.jsx("span",{className:"text-[10px] uppercase tracking-wide text-muted-foreground",children:"required"}),e.slice(0,4).map(t=>a.jsx(st,{variant:"outline",className:"h-5 max-w-36 truncate rounded-md px-1.5 py-0 font-mono text-[10px]",children:t},t)),e.length>4&&a.jsxs("span",{className:"font-mono text-[10px] text-muted-foreground",children:["+",e.length-4]})]})}function gI({tool:e,called:t}){const[n,r]=x.useState(!1),o=Xt(e.name),s=e.description!==null||e.requiredParameters.length>0||e.schema!==null;return a.jsx(FE,{open:n,onOpenChange:r,children:a.jsxs("div",{className:"rounded-md border border-border/60 bg-background/40",children:[a.jsxs("div",{className:"flex min-w-0 items-center gap-2 px-2.5 py-2",children:[a.jsxs("button",{type:"button",className:"flex min-w-0 flex-1 items-center gap-2 text-left focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",onClick:()=>r(i=>!i),"aria-expanded":n,disabled:!s,children:[a.jsx(hI,{category:e.category}),a.jsx("span",{className:"min-w-0 truncate font-mono text-xs font-semibold text-foreground/90",children:e.name}),t&&a.jsx(st,{variant:"outline",className:"h-5 rounded-md border-emerald-400/20 bg-emerald-400/5 px-1.5 py-0 text-[10px] text-emerald-300",children:"called"}),a.jsxs("span",{className:"font-mono text-[10px] text-muted-foreground",children:[e.parameterCount," params"]}),e.descriptionPreview!==null&&a.jsx("span",{className:"hidden min-w-0 truncate text-xs text-muted-foreground md:inline",children:e.descriptionPreview}),a.jsx("span",{className:"flex-1"}),s&&(n?a.jsx(Zt,{className:"size-3.5 shrink-0 text-muted-foreground"}):a.jsx(on,{className:"size-3.5 shrink-0 text-muted-foreground"}))]}),a.jsx("button",{type:"button",className:"inline-flex size-7 shrink-0 items-center justify-center rounded text-muted-foreground transition-colors hover:bg-muted hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",onClick:o.copy,"aria-label":o.copied?"Copied tool name":"Copy tool name",children:o.copied?a.jsx(rt,{className:"size-3.5 text-emerald-400"}):a.jsx(_t,{className:"size-3.5"})})]}),a.jsx($E,{children:a.jsxs("div",{className:"space-y-2 border-t border-border/60 px-2.5 py-2",children:[e.description!==null&&a.jsx("p",{className:"text-xs leading-relaxed text-muted-foreground",children:e.description}),a.jsx(mI,{names:e.requiredParameters}),e.schema!==null&&a.jsx(dI,{className:"max-h-64 rounded-md border border-border/60 bg-muted/20 p-2",children:a.jsx(Nl,{data:Jo(e.schema),defaultExpandDepth:0})})]})})]})})}function xI(e,t){return t.length===0?!0:`${e.name} ${e.description??""} ${wg[e.category]}`.toLowerCase().trim().includes(t)}const bI=x.memo(function({summary:t,calledToolNames:n}){const[r,o]=x.useState(!1),[s,i]=x.useState(""),l=x.useMemo(()=>new Set(n),[n]),c=s.trim().toLowerCase(),u=x.useMemo(()=>t===null?[]:t.tools.filter(h=>xI(h,c)),[c,t]);if(t===null)return null;const d=t.tools.slice(0,6),f=t.tools.length-d.length;return a.jsxs("section",{className:"mb-3 rounded-lg border border-border/70 bg-muted/20",children:[a.jsxs("div",{className:"flex min-w-0 flex-wrap items-center gap-2 px-3 py-2",children:[a.jsxs("div",{className:"flex min-w-0 flex-1 items-center gap-2",children:[a.jsx(qr,{className:"size-4 shrink-0 text-sky-300/80"}),a.jsxs("div",{className:"min-w-0",children:[a.jsxs("div",{className:"flex min-w-0 flex-wrap items-center gap-1.5",children:[a.jsx("span",{className:"text-sm font-semibold text-foreground",children:"Request Tools"}),a.jsx(st,{variant:"outline",className:"h-5 rounded-md px-1.5 py-0 font-mono text-[10px]",children:t.tools.length}),t.toolChoiceLabel!==null&&a.jsxs(st,{variant:"outline",className:"h-5 rounded-md px-1.5 py-0 font-mono text-[10px] text-muted-foreground",children:["tool_choice: ",t.toolChoiceLabel]})]}),a.jsx("div",{className:"mt-1 flex min-w-0 flex-wrap gap-1",children:t.categories.map(h=>a.jsxs(st,{variant:"outline",className:ve("h-5 rounded-md px-1.5 py-0 font-mono text-[10px]",pI[h.category]),children:[h.count," ",wg[h.category]]},h.category))})]})]}),a.jsxs(Ae,{type:"button",variant:"ghost",size:"sm",className:"h-7 px-2",onClick:()=>o(h=>!h),"aria-expanded":r,children:[r?a.jsx(Zt,{className:"size-3.5"}):a.jsx(on,{className:"size-3.5"}),r?"Hide":"Show"]})]}),a.jsxs("div",{className:"flex min-w-0 flex-wrap gap-1.5 border-t border-border/60 px-3 py-2",children:[d.map(h=>a.jsx(st,{variant:"outline",className:ve("h-5 max-w-44 truncate rounded-md px-1.5 py-0 font-mono text-[10px]",l.has(h.name)&&"border-emerald-400/20 text-emerald-300"),children:h.name},h.name)),f>0&&a.jsxs("span",{className:"font-mono text-[10px] leading-5 text-muted-foreground",children:["+",f]})]}),r&&a.jsxs("div",{className:"space-y-2 border-t border-border/60 px-3 py-3",children:[a.jsxs("label",{className:"flex h-8 items-center gap-2 rounded-md border border-border/70 bg-background/50 px-2 text-xs",children:[a.jsx(sw,{className:"size-3.5 shrink-0 text-muted-foreground"}),a.jsx("input",{value:s,onChange:h=>i(h.target.value),placeholder:"Filter tools",className:"min-w-0 flex-1 bg-transparent font-mono text-xs outline-none placeholder:text-muted-foreground/70"})]}),a.jsx("div",{className:"grid gap-1.5",children:u.length>0?u.map(h=>a.jsx(gI,{tool:h,called:l.has(h.name)},h.name)):a.jsx("p",{className:"py-2 text-xs text-muted-foreground",children:"No matching tools"})})]})]})}),nn="agent-inspector:focus-log";function fa(e){window.dispatchEvent(new CustomEvent(nn,{detail:e}))}function Bs(e){if(typeof CustomEvent>"u"||!(e instanceof CustomEvent))return null;const t=e.detail,n=Me(t,"logId");if(typeof n!="number"||!Number.isInteger(n)||n<0)return null;const r=Me(t,"tab");switch(r){case"anatomy":case"request":return{logId:n,tab:r};case void 0:return{logId:n,tab:"request"};default:return null}}function Ju(e,t,n){return e==="anthropic"&&t==="full"&&n}function yI(e,t){return e==="full"&&t}function vI(e,t,n,r){return e==="anthropic"&&t==="full"&&n&&r}const wI=["file","shell","browser","web","mcp","code","other"];function pa(e){const t=e.replace(/\s+/g," ").trim();return t.length<=120?t:`${t.slice(0,119)}...`}function kg(e){if(e===null)return null;const t=e.replace(/\s+/g," ").trim();if(t.length===0)return null;const n=t.search(/[.!?。!?]/);return n>=24?pa(t.slice(0,n+1)):pa(t)}function kI(e,t){return`${e} ${t??""}`.toLowerCase()}function Hn(e,t){return t.some(n=>e.includes(n))}function _g(e,t){const n=kI(e,t);return e.startsWith("mcp__")||e.startsWith("inspector_")||Hn(n,[" mcp","model context protocol"])?"mcp":Hn(n,["bash","shell","terminal","command","powershell","exec","process"])?"shell":Hn(n,["browser","playwright","screenshot","click","navigate","page","tab"])?"browser":Hn(n,["read","write","edit","file","glob","grep","patch","filesystem","directory"])?"file":Hn(n,["web","search","http","url","fetch"])?"web":Hn(n,["code","typescript","javascript","python","repl"])?"code":"other"}function Sg(e){const t=Me(e,"properties");return t===null||typeof t!="object"||Array.isArray(t)?[]:Object.keys(t).sort((n,r)=>n.localeCompare(r))}function Cg(e){const t=Me(e,"required");if(!Array.isArray(t))return[];const n=[];for(const r of t)typeof r=="string"&&r.length>0&&n.push(r);return n.sort((r,o)=>r.localeCompare(o))}function _I(e){const t=Me(e,"name");if(typeof t!="string"||t.length===0)return null;const n=Me(e,"description"),r=Me(e,"input_schema")??null,o=typeof n=="string"?n:null;return{name:t,description:o,descriptionPreview:kg(o),category:_g(t,o),parameterCount:Sg(r).length,requiredParameters:Cg(r),schema:r}}function SI(e){const t=Me(e,"function"),n=Me(t,"name");if(typeof n!="string"||n.length===0)return null;const r=Me(t,"description"),o=Me(t,"parameters")??null,s=typeof r=="string"?r:null;return{name:n,description:s,descriptionPreview:kg(s),category:_g(n,s),parameterCount:Sg(o).length,requiredParameters:Cg(o),schema:o}}function CI(e){const t=SI(e);return t!==null?t:_I(e)}function jI(e){if(e==null)return null;if(typeof e=="string")return e;const t=Me(e,"type"),n=Me(e,"name"),r=Me(Me(e,"function"),"name");if(typeof t=="string"&&typeof r=="string"&&r.length>0)return`${t}: ${r}`;if(typeof t=="string"&&typeof n=="string"&&n.length>0)return`${t}: ${n}`;if(typeof t=="string")return t;const o=JSON.stringify(e);return o===void 0?null:pa(o)}function NI(e){const t=new Map;for(const n of e)t.set(n.category,(t.get(n.category)??0)+1);return wI.flatMap(n=>{const r=t.get(n)??0;return r>0?[{category:n,count:r}]:[]})}function EI(e){const t=Me(e,"tools");if(!Array.isArray(t)||t.length===0)return null;const n=[];for(const r of t){const o=CI(r);o!==null&&n.push(o)}return n.length===0?null:{tools:n,toolChoiceLabel:jI(Me(e,"tool_choice")),categories:NI(n)}}function Zn(){return a.jsx("div",{className:"h-1","aria-hidden":"true"})}function TI(e,t){switch(e){case"anatomy":return t===null?"request":"anatomy";case"request":return"request"}}function AI({active:e,onClick:t}){return a.jsxs(Fe,{children:[a.jsx($e,{asChild:!0,children:a.jsxs(Ae,{variant:e?"default":"outline",size:"sm",className:"h-8 text-xs",onClick:t,"aria-pressed":e,children:[a.jsx(A2,{className:"size-3.5 mr-1"}),e?"Showing diff":"Diff with Raw"]})}),a.jsx(Be,{children:e?"Hide diff view":"Compare proxy output against the original raw version"})]})}const II=x.memo(function({rawBody:e,displayedBody:t,emptyLabel:n}){const r=x.useMemo(()=>dE(e,t),[e,t]);return a.jsx(Om,{result:r,emptyLabel:n})}),zI=x.memo(function({rawHeaders:e,headers:t,emptyLabel:n}){const r=x.useMemo(()=>uE(e,t),[e,t]);return a.jsx(Om,{result:r,emptyLabel:n})}),RI=x.memo(function({log:e,viewMode:t="simple",strip:n,slowResponseThresholdSeconds:r,timeDisplayFormat:o,cacheTrend:s=null,onCompareWithPrevious:i}){const[l,c]=x.useState(!1),[u,d]=x.useState(!1),[f,h]=x.useState(!1),[p,y]=x.useState(!1),[m,g]=x.useState("request"),[b,v]=x.useState(null),k=x.useRef(null),S=In(e),C=ym(S),j=x.useMemo(()=>C.analyzeRequest(e.rawRequestBody),[C,e.rawRequestBody]),E=x.useMemo(()=>C.analyzeResponse(e.responseText),[C,e.responseText]),z=x.useMemo(()=>!n||S!=="anthropic"||e.rawRequestBody===null?null:qN(e.rawRequestBody).body,[e.rawRequestBody,S,n])??e.rawRequestBody,O=si(z),B=si(e.rawRequestBody),N=si(e.responseText),D=x.useMemo(()=>e.headers&&Object.keys(e.headers).length>0?JSON.stringify(e.headers,null,2):null,[e.headers]),w=x.useMemo(()=>e.rawHeaders&&Object.keys(e.rawHeaders).length>0?JSON.stringify(e.rawHeaders,null,2):null,[e.rawHeaders]),L=Xt(z),W=Xt(e.rawRequestBody),U=Xt(D),F=Xt(w),K=Xt(e.responseText),I=x.useMemo(()=>({request:{copyLabel:"Copy request body",copyText:z,copyCopied:L.copied,onCopy:L.copy,expansion:{isExpanded:O.isExpanded,isPending:O.isPending,onToggle:O.toggle},diffWithRaw:vI(S,t,n,e.rawRequestBody!==null)?{active:p,onToggle:()=>y(!p)}:void 0,diffWithPrevious:i===void 0?void 0:()=>{i(e)}},"raw-request":{copyLabel:"Copy raw request",copyText:e.rawRequestBody,copyCopied:W.copied,onCopy:W.copy,expansion:{isExpanded:B.isExpanded,isPending:B.isPending,onToggle:B.toggle}},headers:{copyLabel:"Copy headers",copyText:D,copyCopied:U.copied,onCopy:U.copy,expansion:null},"raw-headers":{copyLabel:"Copy raw headers",copyText:w,copyCopied:F.copied,onCopy:F.copy,expansion:null},raw:{copyLabel:"Copy response",copyText:e.responseText,copyCopied:K.copied,onCopy:K.copy,expansion:{isExpanded:N.isExpanded,isPending:N.isPending,onToggle:N.toggle}}}),[z,L,O,p,e.rawRequestBody,W,B,D,U,w,F,e.responseText,K,N,S,t,n,i]),H=x.useMemo(()=>O.parsedData!==null?C.anatomySegments(O.parsedData):null,[C,O.parsedData]),G=x.useMemo(()=>EI(O.parsedData),[O.parsedData]),R=x.useMemo(()=>{if(H!==null)return new Set(H.map(re=>re.path))},[H]),ae=oE({containerRef:k,setExpandToPath:v,ensureTabActive:()=>{m!=="request"&&g("request")}});return x.useEffect(()=>{l&&g(H!==null?"anatomy":"request")},[H,l]),x.useEffect(()=>{const re=fe=>{const le=Bs(fe);le!==null&&le.logId===e.id&&(c(!0),g(TI(le.tab,H)))};return window.addEventListener(nn,re),()=>{window.removeEventListener(nn,re)}},[H,e.id]),a.jsxs(tt,{children:[a.jsxs("div",{className:"border border-border rounded-lg mb-1 overflow-hidden",children:[a.jsx(DE,{log:e,messageCount:j.messageCount,toolCount:j.toolCount,expanded:l,onToggle:()=>c(!l),cacheTrend:s,slowResponseThresholdSeconds:r,timeDisplayFormat:o,activeTab:m,tabActions:I,onReplay:i===void 0?void 0:()=>{d(!0)}}),l&&a.jsx("div",{onClick:re=>re.stopPropagation(),onKeyDown:re=>re.stopPropagation(),children:a.jsxs(jm,{value:m,onValueChange:g,children:[a.jsxs(Nm,{className:"mx-4 mt-2",children:[t==="full"&&a.jsx(Tt,{value:"raw-headers",children:"Raw Headers"}),t==="full"&&a.jsx(Tt,{value:"headers",children:"Headers"}),H!==null&&a.jsx(Tt,{value:"anatomy",children:"Context"}),Ju(S,t,n)&&a.jsx(Tt,{value:"raw-request",children:"Raw Request"}),a.jsx(Tt,{value:"request",children:"Request"}),t==="full"&&a.jsx(Tt,{value:"raw",children:"Raw Response"}),a.jsx(Tt,{value:"parsed",children:"Response"})]}),Ju(S,t,n)&&a.jsx(At,{value:"raw-request",children:m==="raw-request"&&a.jsx("div",{className:"px-4 pt-1 pb-3",children:e.rawRequestBody===null?a.jsx("p",{className:"text-xs text-muted-foreground italic",children:"No request body"}):B.parsedData!==null?a.jsx(x.Suspense,{fallback:a.jsx(Zn,{}),children:a.jsx(Qc,{data:B.parsedData,bulkDepth:B.bulkDepth,bulkRevision:B.bulkRevision})}):a.jsx("pre",{className:"font-mono text-xs whitespace-pre-wrap break-words",children:e.rawRequestBody})})}),a.jsx(At,{value:"request",children:m==="request"&&a.jsxs("div",{className:"px-4 pt-1 pb-3",children:[a.jsx(bI,{summary:G,calledToolNames:E.toolNames??[]}),p?a.jsx(II,{rawBody:e.rawRequestBody,displayedBody:z,emptyLabel:"No transformation applied; raw and sent request bodies are identical."}):a.jsx("div",{ref:k,children:z===null?a.jsx("p",{className:"text-xs text-muted-foreground italic",children:"No request body"}):O.parsedData!==null?a.jsx(x.Suspense,{fallback:a.jsx(Zn,{}),children:a.jsx(Qc,{data:O.parsedData,bulkDepth:O.bulkDepth,bulkRevision:O.bulkRevision,anatomyPaths:R,expandToPath:b})}):a.jsx("pre",{className:"font-mono text-xs whitespace-pre-wrap break-words",children:z})})]})}),H!==null&&a.jsx(At,{value:"anatomy",children:m==="anatomy"&&a.jsx(x.Suspense,{fallback:a.jsx(Zn,{}),children:a.jsx(XN,{parsed:O.parsedData,inputTokens:e.inputTokens??null,model:e.model,segments:H,onSegmentActivate:ae})})}),t==="full"&&a.jsx(At,{value:"headers",children:m==="headers"&&a.jsxs("div",{className:"px-4 pt-1 pb-3",children:[a.jsx("div",{className:"flex justify-end gap-2 mb-2",children:yI(t,e.rawHeaders!==void 0&&Object.keys(e.rawHeaders).length>0)&&a.jsx(AI,{active:f,onClick:re=>{re.stopPropagation(),h(!f)}})}),f?a.jsx(zI,{rawHeaders:e.rawHeaders,headers:e.headers,emptyLabel:"No transformation applied; raw and processed headers are identical."}):e.headers&&Object.keys(e.headers).length>0?a.jsx("div",{className:"space-y-1 font-mono text-xs",children:Object.entries(e.headers).sort(([re],[fe])=>re.localeCompare(fe)).map(([re,fe])=>a.jsxs("div",{className:"flex gap-2",children:[a.jsxs("span",{className:"text-blue-600 dark:text-blue-400 font-semibold shrink-0",children:[re,":"]}),a.jsx("span",{className:"text-muted-foreground truncate",title:fe,children:fe})]},re))}):a.jsx("p",{className:"text-xs text-muted-foreground italic",children:"No headers captured"})]})}),t==="full"&&a.jsx(At,{value:"raw-headers",children:m==="raw-headers"&&a.jsx("div",{className:"px-4 pt-1 pb-3",children:e.rawHeaders&&Object.keys(e.rawHeaders).length>0?a.jsx("div",{className:"space-y-1 font-mono text-xs",children:Object.entries(e.rawHeaders).sort(([re],[fe])=>re.localeCompare(fe)).map(([re,fe])=>a.jsxs("div",{className:"flex gap-2",children:[a.jsxs("span",{className:"text-blue-600 dark:text-blue-400 font-semibold shrink-0",children:[re,":"]}),a.jsx("span",{className:"text-muted-foreground truncate",title:fe,children:fe})]},re))}):a.jsx("p",{className:"text-xs text-muted-foreground italic",children:"No raw headers captured"})})}),a.jsx(At,{value:"raw",children:m==="raw"&&a.jsxs("div",{className:"px-4 pt-1 pb-3 space-y-3",children:[e.error!==void 0&&e.error!==null&&a.jsxs("div",{className:"rounded border border-destructive/50 bg-destructive/10 p-3 text-xs",children:[a.jsx("div",{className:"font-semibold text-destructive mb-1",children:"SSE Error"}),a.jsx("div",{className:"text-muted-foreground font-mono",children:e.error})]}),e.responseText!==null?a.jsx(x.Suspense,{fallback:a.jsx(Zn,{}),children:a.jsx(tE,{text:e.responseText,defaultExpandDepth:0,bulkDepth:N.bulkDepth,bulkRevision:N.bulkRevision})}):a.jsx("p",{className:"text-xs text-muted-foreground italic",children:"No response"}),e.streaming===!0&&a.jsx(x.Suspense,{fallback:a.jsx(Zn,{}),children:a.jsx(eE,{logId:e.id,truncated:e.streamingChunksPath!==null})})]})}),a.jsx(At,{value:"parsed",children:m==="parsed"&&a.jsx("div",{className:"px-4 pt-1 pb-3",children:a.jsx(x.Suspense,{fallback:a.jsx(Zn,{}),children:a.jsx(QN,{responseText:e.responseText,responseStatus:e.responseStatus,streaming:e.streaming,inputTokens:e.inputTokens,outputTokens:e.outputTokens,cacheCreationInputTokens:e.cacheCreationInputTokens,cacheReadInputTokens:e.cacheReadInputTokens,apiFormat:S,error:e.error})})})})]})})]}),a.jsx(x.Suspense,{fallback:null,children:a.jsx(YN,{log:e,open:u,onOpenChange:d})})]})});function PI({stopReason:e,isPending:t,isFirst:n,isTurnStart:r,isOnlyEntry:o=!1,crabIndex:s=0,collapsible:i=!1,onToggle:l}){const c=e==="end_turn"||e==="stop",u=o&&r&&c,d=t&&!c,f=x.useMemo(()=>Go(s),[s]),h=x.useMemo(()=>NN(s),[s]),p=i&&l?{role:"button",tabIndex:0,className:"cursor-pointer",onClick:y=>{y.stopPropagation(),l()},onKeyDown:y=>{(y.key==="Enter"||y.key===" ")&&(y.preventDefault(),l())}}:{};return a.jsxs("div",{className:"flex flex-col items-center w-6 shrink-0 pt-0.5 pb-0.5",children:[a.jsx("div",{className:"flex justify-center h-[calc(0.75rem-8px)]",children:!n&&a.jsx("div",{className:"w-0.5 bg-muted-foreground/30 h-full"})}),u?a.jsx("span",{title:"Start and end of turn",children:a.jsx(h,{className:ve("size-3.5 text-[#80FF00]","animate-crab-settle","drop-shadow-[0_0_4px_rgba(128,255,0,0.5)]")})}):c?a.jsx("span",{title:e==="end_turn"?"End of Turn (Anthropic)":"End of Turn (OpenAI)",...p,children:a.jsx(f,{className:ve("size-3.5 text-amber-400","animate-crab-settle","drop-shadow-[0_0_4px_rgba(251,191,36,0.5)]")})}):r?a.jsx("span",{title:"Start of turn",...p,children:a.jsx(f,{className:ve("size-3.5 text-emerald-400","animate-crab-appear","drop-shadow-[0_0_4px_rgba(52,211,153,0.5)]")})}):d?a.jsx("span",{title:"Processing…",children:a.jsx(f,{className:ve("size-3.5 text-amber-300/80","animate-crab-crawl")})}):a.jsx("span",{children:a.jsx(f,{className:"size-3.5 text-muted-foreground/40"})}),a.jsx("div",{className:"flex-1 flex justify-center min-h-0",children:!c&&a.jsx("div",{className:ve("w-0.5 h-full",t?"border-dashed bg-transparent border-l-2 border-muted-foreground/20":"bg-muted-foreground/30")})})]})}function OI({event:e}){const t=Xt(e.argumentsText),n=e.argumentsText!==null;return a.jsxs("div",{className:"group/tool-trace flex min-w-0 items-center gap-2 rounded-md border border-border/70 bg-muted/20 px-2.5 py-1.5 text-xs",children:[a.jsx(qr,{className:"size-3.5 shrink-0 text-sky-400/70"}),a.jsx("span",{className:"font-mono font-semibold text-foreground/80",children:e.name}),e.argumentsPreview!==null&&a.jsxs(a.Fragment,{children:[a.jsx(on,{className:"size-3 shrink-0 text-muted-foreground/60"}),a.jsx("span",{className:"min-w-0 truncate font-mono text-muted-foreground",children:e.argumentsPreview})]}),n&&a.jsx("button",{type:"button",className:"ml-auto inline-flex size-6 shrink-0 items-center justify-center rounded text-muted-foreground opacity-0 transition-opacity hover:bg-background/80 hover:text-foreground focus-visible:opacity-100 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring group-hover/tool-trace:opacity-100 group-focus-within/tool-trace:opacity-100",onClick:t.copy,"aria-label":t.copied?"Copied tool arguments":"Copy tool arguments",title:t.copied?"Copied tool arguments":"Copy tool arguments",children:t.copied?a.jsx(rt,{className:"size-3.5"}):a.jsx(_t,{className:"size-3.5"})})]},e.id)}function MI({events:e}){return e.length===0?null:a.jsx("div",{className:"mx-3 mb-2 grid gap-1.5",children:e.map(t=>a.jsx(OI,{event:t},t.id))})}const Yu=180;function LI(e,t){return e||t}function DI(e,t,n){return e>1&&t&&!n}function FI(e){const t=[];let n=[],r=0;for(const o of e){n.push({log:o,stopReason:hN(o)});const s=n[n.length-1];s!==void 0&&vm(s.stopReason)&&(t.push({entries:n,turnIndex:r}),n=[],r+=1)}return n.length>0&&t.push({entries:n,turnIndex:r}),t}function $I(e){const t=new Map;for(const n of e)for(let r=1;r<n.logs.length;r+=1){const o=n.logs[r],s=n.logs[r-1];if(o===void 0||s===void 0)continue;const i=In(o),l=In(s);i==="unknown"||i!==l||t.set(o.id,s)}return t}function jg(e){if(e===null)return null;try{const t=JSON.parse(e);return typeof t=="string"?JSON.parse(t):t}catch{return null}}function Ng(e){if(e==null)return null;const t=typeof e=="string"?e:JSON.stringify(e);if(t===void 0)return null;const n=t.replace(/\s+/g," ").trim();return n.length===0?null:n.length>Yu?`${n.slice(0,Yu-1)}...`:n}function Eg(e){if(e==null)return null;if(typeof e=="string")return e.length>0?e:null;const t=JSON.stringify(e,null,2);return t===void 0||t.length===0?null:t}function BI(e){const t=jg(e.responseText),n=Me(t,"content");if(!Array.isArray(n))return[];const r=[];for(const o of n){if(Me(o,"type")!=="tool_use")continue;const i=Me(o,"name");if(typeof i!="string"||i.length===0)continue;const l=Me(o,"input");r.push({id:`${String(e.id)}-anthropic-tool-${String(r.length)}`,logId:e.id,index:r.length,provider:"anthropic",name:i,argumentsText:Eg(l),argumentsPreview:Ng(l)})}return r}function UI(e){const t=jg(e.responseText),n=Me(t,"choices");if(!Array.isArray(n))return[];const r=[];for(const o of n){const s=Me(o,"message"),i=Me(s,"tool_calls");if(Array.isArray(i))for(const l of i){const c=Me(l,"function"),u=Me(c,"name");if(typeof u!="string"||u.length===0)continue;const d=Me(c,"arguments");r.push({id:`${String(e.id)}-openai-tool-${String(r.length)}`,logId:e.id,index:r.length,provider:"openai",name:u,argumentsText:Eg(d),argumentsPreview:Ng(d)})}}return r}function El(e){switch(In(e)){case"anthropic":return BI(e);case"openai":return UI(e);case"unknown":return[]}}function WI(e,t,n=0){let r=0,o=0,s=0,i=0,l=0,c=0,u=0,d=0,f=null,h=0;for(const p of e)p.responseStatus===null?o+=1:p.responseStatus>=400&&(r+=1),p.elapsedMs!==null&&t>0&&p.elapsedMs>t*1e3&&(s+=1),p.inputTokens!==null&&(i+=p.inputTokens),p.outputTokens!==null&&(l+=p.outputTokens),p.cacheCreationInputTokens!==null&&(c+=p.cacheCreationInputTokens),p.cacheReadInputTokens!==null&&(u+=p.cacheReadInputTokens),p.elapsedMs!==null&&(d+=p.elapsedMs,f=f===null?p.elapsedMs:Math.max(f,p.elapsedMs)),h+=El(p).length;return{llmCallCount:e.length,toolCallCount:h,failedCallCount:r,pendingCallCount:o,slowCallCount:s,totalInputTokens:i,totalOutputTokens:l,totalCacheCreationInputTokens:c,totalCacheReadInputTokens:u,totalElapsedMs:d,maxElapsedMs:f,startedAt:e[0]?.timestamp??null,endedAt:e[e.length-1]?.timestamp??null,knowledgeCandidateCount:n}}function vi(e){return e<1e3?`${e}ms`:`${(e/1e3).toFixed(1)}s`}const VI=x.memo(function({entries:t,viewMode:n,strip:r,slowResponseThresholdSeconds:o,cacheTrends:s,onCompareWithPrevious:i,comparisonPredecessors:l,turnIndex:c=0,timeDisplayFormat:u}){const d=t.length-1,f=t[d]?.stopReason??null,h=f!==null?vm(f):!1,p=t[d]?.log.responseStatus===null,y=t.length===1,m=DI(t.length,h,p),[g,b]=x.useState(!1),v=x.useRef(!1);x.useEffect(()=>{m?h&&!v.current&&b(!0):b(!1),v.current=h},[m,h]),x.useEffect(()=>{const W=U=>{const F=Bs(U);F!==null&&t.some(K=>K.log.id===F.logId)&&m&&b(!1)};return window.addEventListener(nn,W),()=>{window.removeEventListener(nn,W)}},[m,t]);const k=x.useCallback(()=>{m&&b(W=>!W)},[m]),S=x.useMemo(()=>{let W=0,U=0,F=null,K=!1;for(const I of t)I.log.inputTokens!==null&&(W+=I.log.inputTokens,K=!0),I.log.outputTokens!==null&&(U+=I.log.outputTokens,K=!0),I.log.elapsedMs!==null&&(F=F===null?I.log.elapsedMs:Math.max(F,I.log.elapsedMs));return{totalInput:W,totalOutput:U,hasTokens:K,maxElapsed:F}},[t,d]),C=x.useMemo(()=>{const W=new Set;for(const U of t){const F=_m(U.log.model);F!=="unknown"&&W.add(F)}return[...W]},[t]),j=x.useMemo(()=>Go(t[0]?.log.id??0),[t]),E=x.useMemo(()=>Go(t[d]?.log.id??0),[t,d]),T=c%2===0?"bg-muted/10":"bg-muted/25",z=S.maxElapsed!==null&&o>0&&S.maxElapsed>o*1e3,O=x.useMemo(()=>{const W=new Map;for(const U of t){const F=El(U.log);F.length>0&&W.set(U.log.id,F)}return W},[t]),[B,N]=x.useState(0),D=x.useRef(null);x.useEffect(()=>{const W=D.current;if(!W)return;let U=0;const F=new ResizeObserver(()=>{window.cancelAnimationFrame(U),U=window.requestAnimationFrame(()=>N(K=>K+1))});return F.observe(W),()=>{F.disconnect(),window.cancelAnimationFrame(U)}},[]);const w=t[0]?.log.id??c,L=`Turn ${String(c+1)}`;return a.jsx("div",{ref:D,tabIndex:g?void 0:0,role:g?void 0:"group","aria-label":g?void 0:L,"data-nav-id":g?void 0:`turn-${String(w)}`,className:ve("border rounded-lg",p?"border-amber-500/10":"border-transparent",!g&&"focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1 focus-visible:outline-none"),children:g?a.jsxs("div",{"data-nav-id":`turn-collapsed-${String(w)}`,"data-nav-action":"expand",role:"button",tabIndex:0,className:"flex items-stretch cursor-pointer focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1 focus-visible:outline-none rounded-lg",onClick:k,onKeyDown:W=>{(W.key==="Enter"||W.key===" ")&&(W.preventDefault(),k())},children:[a.jsx("div",{className:"w-5 shrink-0 flex items-start pt-1.5",children:a.jsx("span",{className:"text-[10px] text-muted-foreground/50 font-mono tabular-nums leading-none select-none",children:c+1})}),a.jsxs("div",{className:"w-6 shrink-0 flex flex-col items-center pt-0.5 pb-0.5",children:[a.jsx("div",{className:"flex justify-center h-[calc(0.75rem-8px)]"}),a.jsx("span",{role:"button",tabIndex:0,title:"Start of turn — click to expand",className:"cursor-pointer",onClick:W=>{W.stopPropagation(),k()},onKeyDown:W=>{(W.key==="Enter"||W.key===" ")&&(W.preventDefault(),k())},children:a.jsx(j,{className:ve("size-3.5 text-emerald-400","animate-crab-appear drop-shadow-[0_0_4px_rgba(52,211,153,0.5)]")})}),a.jsx("div",{className:"flex-1 flex justify-center min-h-0",children:a.jsx("div",{className:"w-0.5 bg-muted-foreground/30 h-full"})}),a.jsx("span",{role:"button",tabIndex:0,title:"End of Turn — click to expand",className:"cursor-pointer",onClick:W=>{W.stopPropagation(),k()},onKeyDown:W=>{(W.key==="Enter"||W.key===" ")&&(W.preventDefault(),k())},children:a.jsx(E,{className:ve("size-3.5 text-amber-400","animate-crab-settle drop-shadow-[0_0_4px_rgba(251,191,36,0.5)]")})})]}),t.length>1&&a.jsxs("div",{className:ve("flex-1 min-w-0 mb-0.5 rounded-lg border border-border py-1 px-3 flex items-center gap-3 text-xs",T),children:[a.jsxs("span",{className:"text-blue-400/80 font-mono font-semibold tabular-nums shrink-0",children:["#",t[0]?.log.id??"?"," ~ #",t[d]?.log.id??"?"]}),a.jsxs("span",{className:"text-muted-foreground shrink-0",children:[t.length," request",t.length>1?"s":""]}),C.length>0&&a.jsx("span",{className:"flex items-center gap-0.5 shrink-0",children:C.map(W=>a.jsx(Sm,{provider:W,className:"size-4"},W))}),S.maxElapsed!==null&&a.jsx(tt,{children:a.jsxs(Fe,{children:[a.jsx($e,{asChild:!0,children:a.jsxs("span",{className:ve("flex items-center gap-1 shrink-0",z?"text-amber-400":"text-muted-foreground"),children:[a.jsx(hn,{className:"size-3"}),a.jsx("span",{className:"font-mono tabular-nums",children:vi(S.maxElapsed)}),z&&a.jsx(Lo,{className:"size-3","aria-label":"Slow response"})]})}),a.jsx(Be,{children:z?`Slow response: ${vi(S.maxElapsed)} exceeds ${vi(o*1e3)}`:"Slowest request in this turn"})]})}),S.hasTokens&&a.jsxs("span",{className:"flex items-center gap-1 shrink-0",children:[a.jsx(Fr,{className:"size-3 text-muted-foreground"}),a.jsxs("span",{className:"font-mono tabular-nums",children:[a.jsxs("span",{className:"text-blue-400",children:["IN ",He(S.totalInput)]})," / ",a.jsxs("span",{className:"text-amber-400",children:["OUT ",He(S.totalOutput)]})]})]}),a.jsx("span",{className:"flex-1 min-w-0"}),a.jsx(on,{className:"size-4 text-muted-foreground shrink-0"})]})]}):t.map((W,U)=>{const{log:F,stopReason:K}=W,I=U===0;return a.jsxs("div",{className:"flex items-stretch",children:[I?a.jsx("div",{className:"w-5 shrink-0 flex items-start pt-1.5",children:a.jsx("span",{className:"text-[10px] text-muted-foreground/50 font-mono tabular-nums leading-none select-none",children:c+1})}):a.jsx("div",{className:"w-5 shrink-0"}),a.jsx(PI,{stopReason:K,isPending:F.responseStatus===null,isFirst:U===0,isTurnStart:I,isOnlyEntry:y,crabIndex:F.id%12,collapsible:m&&I,onToggle:k}),a.jsxs("div",{className:ve("flex-1 min-w-0 mb-0.5 rounded-lg",T),children:[a.jsx(RI,{log:F,viewMode:n,strip:r,slowResponseThresholdSeconds:o,timeDisplayFormat:u,cacheTrend:s?.get(F.id)??null,onCompareWithPrevious:l.has(F.id)?i:void 0}),a.jsx(MI,{events:O.get(F.id)??[]})]})]},F.id)})})}),Tl=Re(["episode","procedure","preference","project-fact"]),HI=Re(["draft","promoted","failed"]),Tg=te({source:je("agent-inspector"),sessionId:A(),logIds:we(ie().int().positive()),project:A().nullable(),models:we(A())}),ZI=te({redacted:Ze(),patterns:we(A())}),Qr=te({id:A(),type:Tl,title:A(),content:A(),tags:we(A()),source:je("agent-inspector"),sessionId:A(),logIds:we(ie().int().positive()),evidence:Tg,status:HI,createdAt:A(),updatedAt:A(),openClawMemoryId:A().nullable(),error:A().nullable(),redaction:ZI});te({idempotencyKey:A(),type:Tl,title:A(),content:A(),tags:we(A()),source:je("agent-inspector"),project:A().nullable(),evidence:Tg});const qI=te({id:A(),type:Tl.or(A()),title:A(),content:A(),score:ie().nullable(),source:A().nullable(),project:A().nullable(),evidence:Ti().optional()});te({results:we(qI),warning:A().nullable()});const KI=te({candidates:we(Qr)}),GI=te({candidate:Qr}),JI=te({error:A().optional(),candidate:Qr.optional()}),YI=te({candidate:Qr}),XI={draft:"border-amber-500/30 bg-amber-500/10 text-amber-500",promoted:"border-emerald-500/30 bg-emerald-500/10 text-emerald-500",failed:"border-destructive/30 bg-destructive/10 text-destructive"};function ha(e){return e===null?"-":e<1e3?`${String(e)}ms`:`${(e/1e3).toFixed(1)}s`}function QI(e,t,n){return e===null||t===null?null:Da(e,t,n)}function ez(e){return`${String(e)} candidate${e===1?"":"s"}`}function Ag(e){return`log-${String(e)}`}function Ig(e){const t=Ag(e),n=document.getElementById(t);window.history.replaceState(null,"",`#${t}`),n instanceof HTMLElement&&(n.scrollIntoView({block:"center",behavior:"smooth"}),n.focus({preventScroll:!0}))}function tz(e){for(const t of e)if(t.responseStatus!==null&&t.responseStatus>=400)return t;return null}function nz(e){let t=null,n=-1;for(const r of e)r.elapsedMs!==null&&r.elapsedMs>n&&(t=r,n=r.elapsedMs);return t}function rz(e){for(const t of e)if(El(t).length>0)return t;return null}function oz(e){const t=[{kind:"session",title:`${String(e.summary.llmCallCount)} LLM call${e.summary.llmCallCount===1?"":"s"}`,detail:`Scope ${e.scopeId}`,logId:e.logs[0]?.id??null}],n=rz(e.logs);e.summary.toolCallCount>0&&n!==null&&t.push({kind:"tool",title:`${String(e.summary.toolCallCount)} tool call${e.summary.toolCallCount===1?"":"s"}`,detail:`First tool evidence at #${String(n.id)}`,logId:n.id});const r=tz(e.logs);r!==null&&t.push({kind:"failure",title:`Failure #${String(r.responseStatus)}`,detail:`First failed request is #${String(r.id)}`,logId:r.id});const o=nz(e.logs);if(o!==null&&e.summary.maxElapsedMs!==null&&t.push({kind:"slow",title:`Slowest ${ha(e.summary.maxElapsedMs)}`,detail:`Max latency observed at #${String(o.id)}`,logId:o.id}),e.candidates.length>0){const s=e.candidates.filter(l=>l.status==="draft").length,i=e.candidates.filter(l=>l.status==="promoted").length;t.push({kind:"candidate",title:`${String(e.candidates.length)} memory candidate${e.candidates.length===1?"":"s"}`,detail:`${String(s)} draft / ${String(i)} promoted`,logId:e.candidates[0]?.logIds[0]??null})}return t}function sz(e){switch(e){case"session":return a.jsx(fs,{className:"size-3.5 text-blue-400"});case"tool":return a.jsx(qr,{className:"size-3.5 text-sky-400/70"});case"slow":return a.jsx(hn,{className:"size-3.5 text-amber-400"});case"failure":return a.jsx(Tf,{className:"size-3.5 text-destructive"});case"candidate":return a.jsx(Nf,{className:"size-3.5 text-emerald-400"})}}function iz({insights:e}){return e.length===0?null:a.jsx("div",{className:"mt-2 grid gap-1.5 border-t border-border/70 pt-2 md:grid-cols-2 xl:grid-cols-3",children:e.map(t=>a.jsxs("button",{type:"button",className:ve("flex min-w-0 items-center gap-2 rounded-md px-2 py-1.5 text-left text-xs","text-muted-foreground transition-colors hover:bg-muted/40 hover:text-foreground","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring"),onClick:()=>{t.logId!==null&&Ig(t.logId)},disabled:t.logId===null,children:[sz(t.kind),a.jsxs("span",{className:"min-w-0",children:[a.jsx("span",{className:"block truncate font-medium text-foreground/90",children:t.title}),a.jsx("span",{className:"block truncate font-mono text-[10px]",children:t.detail})]})]},`${t.kind}-${t.title}`))})}function az(e){switch(e){case"draft":return"Draft";case"promoted":return"Promoted";case"failed":return"Failed"}}function lz(e,t){if(t)return"Promoting";switch(e.status){case"draft":return"Promote";case"failed":return"Retry";case"promoted":return"Promoted"}}function cz(e){return e.redaction.redacted?`Redacted ${e.redaction.patterns.join(", ")}`:"No sensitive pattern matched"}function uz(e,t){const n=e.replace(/\s+/g," ").trim();return n.length<=t?n:`${n.slice(0,t-3)}...`}function dz(e){const t=e[0],n=e[e.length-1];return t===void 0?"No evidence logs":n===void 0||t===n?`#${String(t)}`:`#${String(t)}-#${String(n)}`}function Xu(e){return e.join(", ")}function fz(e){return e.split(",").map(t=>t.trim()).filter(t=>t.length>0)}function pz({candidate:e,isPromoting:t,isUpdating:n,onPromoteCandidate:r,onUpdateCandidate:o}){const[s,i]=x.useState(!1),[l,c]=x.useState(e.type),[u,d]=x.useState(e.title),[f,h]=x.useState(e.content),[p,y]=x.useState(Xu(e.tags)),[m,g]=x.useState(null),b=e.status!=="promoted",v=e.status!=="promoted",k=x.useCallback(()=>{c(e.type),d(e.title),h(e.content),y(Xu(e.tags)),g(null)},[e.content,e.tags,e.title,e.type]),S=x.useCallback(async()=>{const C=u.trim(),j=f.trim(),E=fz(p);if(C.length===0){g("Title is required.");return}if(j.length===0){g("Content is required.");return}if(E.length===0){g("At least one tag is required.");return}g(null),await o(e.id,{type:l,title:C,content:j,tags:E})&&i(!1)},[e.id,f,p,u,l,o]);return s?a.jsx("div",{className:"rounded-md border border-border/80 bg-background/60 px-2.5 py-2",children:a.jsxs("div",{className:"grid gap-2",children:[a.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[a.jsxs("select",{value:l,disabled:n,onChange:C=>{const j=Qr.shape.type.safeParse(C.currentTarget.value);j.success&&c(j.data)},className:"h-7 rounded-md border border-input bg-background px-2 text-xs","aria-label":"Candidate type",children:[a.jsx("option",{value:"episode",children:"episode"}),a.jsx("option",{value:"procedure",children:"procedure"}),a.jsx("option",{value:"preference",children:"preference"}),a.jsx("option",{value:"project-fact",children:"project-fact"})]}),a.jsx("input",{value:u,disabled:n,onChange:C=>d(C.currentTarget.value),className:"h-7 min-w-[220px] flex-1 rounded-md border border-input bg-background px-2 text-xs","aria-label":"Candidate title"})]}),a.jsx("textarea",{value:f,disabled:n,onChange:C=>h(C.currentTarget.value),className:"min-h-28 rounded-md border border-input bg-background px-2 py-1.5 font-mono text-[11px] leading-relaxed","aria-label":"Candidate content"}),a.jsx("input",{value:p,disabled:n,onChange:C=>y(C.currentTarget.value),className:"h-7 rounded-md border border-input bg-background px-2 text-xs","aria-label":"Candidate tags"}),a.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[a.jsxs("span",{className:"inline-flex items-center gap-1 text-[10px] text-muted-foreground",children:[a.jsx(hc,{className:"size-3"}),"Saving reruns Inspector redaction before promotion."]}),a.jsx("span",{className:"flex-1"}),m!==null&&a.jsx("span",{className:"text-[10px] text-destructive",children:m}),a.jsxs(Ae,{type:"button",variant:"ghost",size:"sm",className:"h-7 gap-1.5 px-2 text-xs",disabled:n,onClick:()=>{k(),i(!1)},children:[a.jsx(La,{className:"size-3.5"}),"Cancel"]}),a.jsxs(Ae,{type:"button",variant:"outline",size:"sm",className:"h-7 gap-1.5 px-2 text-xs",disabled:n,onClick:()=>{S()},children:[n?a.jsx(Pi,{className:"size-3.5 animate-spin"}):a.jsx(tw,{className:"size-3.5"}),"Save"]})]})]})}):a.jsxs("div",{className:"rounded-md border border-border/80 bg-background/60 px-2.5 py-2",children:[a.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[a.jsx(st,{variant:"outline",className:"h-5 px-1.5 text-[10px] font-mono",children:e.type}),a.jsx("span",{className:"min-w-0 flex-1 truncate text-xs font-medium",title:e.title,children:e.title}),a.jsx(st,{variant:"outline",className:ve("h-5 shrink-0 px-1.5 text-[10px] font-mono",XI[e.status]),children:az(e.status)})]}),a.jsx("p",{className:"mt-1 text-[11px] leading-relaxed text-muted-foreground",title:e.content,children:uz(e.content,360)}),a.jsxs("div",{className:"mt-2 flex flex-wrap items-center gap-x-3 gap-y-1 text-[10px] text-muted-foreground",children:[a.jsxs("span",{className:"inline-flex items-center gap-1",children:[a.jsx(_2,{className:"size-3"}),dz(e.logIds)]}),a.jsxs("span",{className:"inline-flex items-center gap-1",children:[a.jsx(hc,{className:"size-3"}),cz(e)]}),e.status==="promoted"&&a.jsxs("span",{className:"inline-flex items-center gap-1 text-emerald-500",children:[a.jsx(dc,{className:"size-3"}),e.openClawMemoryId??"OpenClaw"]}),e.status==="failed"&&e.error!==null&&a.jsxs("span",{className:"inline-flex items-center gap-1 text-destructive",children:[a.jsx(Tf,{className:"size-3"}),e.error]})]}),a.jsxs("div",{className:"mt-1 flex flex-wrap items-center gap-1.5",children:[e.logIds.map(C=>a.jsxs("a",{href:`#${Ag(C)}`,onClick:j=>{j.preventDefault(),Ig(C)},className:"rounded border border-blue-400/25 px-1.5 py-0.5 font-mono text-[10px] text-blue-400 underline-offset-2 transition-colors hover:bg-blue-400/10 hover:text-blue-300 hover:underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring","aria-label":`Jump to evidence log ${String(C)}`,children:["#",C]},C)),a.jsx("span",{className:"flex-1"}),v&&a.jsxs(Ae,{type:"button",variant:"ghost",size:"sm",className:"h-6 gap-1.5 px-2 text-[10px]",disabled:n||t,onClick:()=>i(!0),children:[a.jsx(zf,{className:"size-3"}),"Review"]}),a.jsxs(Ae,{type:"button",variant:b?"outline":"ghost",size:"sm",className:"h-6 gap-1.5 px-2 text-[10px]",onClick:()=>r(e.id),disabled:!b||t||n,children:[t?a.jsx(Pi,{className:"size-3 animate-spin"}):b?a.jsx(i2,{className:"size-3"}):a.jsx(dc,{className:"size-3"}),lz(e,t)]})]})]})}function hz({candidates:e,promotingCandidateIds:t,updatingCandidateIds:n,onPromoteCandidate:r,onUpdateCandidate:o}){return e.length===0?null:a.jsx("div",{className:"mt-2 grid gap-1.5",children:e.map(s=>a.jsx(pz,{candidate:s,isPromoting:t.has(s.id),isUpdating:n.has(s.id),onPromoteCandidate:r,onUpdateCandidate:o},s.id))})}function mz({logs:e,scopeId:t,slowResponseThresholdSeconds:n,showRollupMetrics:r,timeDisplayFormat:o}){const[s,i]=x.useState([]),[l,c]=x.useState(!0),[u,d]=x.useState({status:"idle",error:null}),[f,h]=x.useState(()=>new Set),[p,y]=x.useState(()=>new Set),m=s.length>0,g=x.useMemo(()=>WI(e,n,s.length),[s.length,e,n]),b=x.useMemo(()=>oz({logs:e,scopeId:t,summary:g,candidates:s}),[s,e,t,g]),v=r||g.maxElapsedMs!==null,k=x.useMemo(()=>QI(g.startedAt,g.endedAt,o),[g.endedAt,g.startedAt,o]),S=x.useCallback(()=>{e.length===0||u.status==="loading"||(d({status:"loading",error:null}),(async()=>{try{const E=await fetch(`/api/knowledge/sessions/${encodeURIComponent(t)}/candidates`,{method:"POST"});if(!E.ok){const z=await Qt(E,`Candidate generation failed with ${String(E.status)}`);d({status:"failed",error:z});return}const T=await It(E,KI);i(T.candidates),c(T.candidates.length>0),d(T.candidates.length>0?{status:"ready",error:null}:{status:"failed",error:"No candidate was generated for this trace scope."})}catch(E){d({status:"failed",error:E instanceof Error?E.message:"Candidate response was invalid"})}})())},[u.status,e.length,t]),C=x.useCallback(E=>{h(T=>{if(T.has(E))return T;const z=new Set(T);return z.add(E),z}),(async()=>{try{const T=await fetch(`/api/knowledge/candidates/${encodeURIComponent(E)}/promote`,{method:"POST"}),z=await T.json().catch(()=>null),O=GI.safeParse(z);if(T.ok&&O.success){i(N=>N.map(D=>D.id===O.data.candidate.id?O.data.candidate:D)),d({status:"ready",error:null});return}const B=JI.safeParse(z);B.success&&B.data.candidate!==void 0&&i(N=>N.map(D=>D.id===B.data.candidate?.id?B.data.candidate:D)),d({status:"failed",error:B.success?B.data.error??"Candidate promotion failed":`Candidate promotion failed with ${String(T.status)}`})}catch(T){d({status:"failed",error:T instanceof Error?T.message:"Candidate promotion failed"})}finally{h(T=>{const z=new Set(T);return z.delete(E),z})}})()},[]),j=x.useCallback(async(E,T)=>{y(z=>{if(z.has(E))return z;const O=new Set(z);return O.add(E),O});try{const z=await fetch(`/api/knowledge/candidates/${encodeURIComponent(E)}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify(T)});if(!z.ok){const B=await Qt(z,`Candidate update failed with ${String(z.status)}`);return d({status:"failed",error:B}),!1}const O=await It(z,YI);return i(B=>B.map(N=>N.id===O.candidate.id?O.candidate:N)),d({status:"ready",error:null}),!0}catch(z){return d({status:"failed",error:z instanceof Error?z.message:"Candidate update failed"}),!1}finally{y(z=>{const O=new Set(z);return O.delete(E),O})}},[]);return e.length===0?null:a.jsxs("section",{className:"mb-2 rounded-lg border border-border bg-muted/10 px-3 py-2",children:[a.jsxs("div",{className:"flex flex-wrap items-center gap-x-3 gap-y-2 text-xs",children:[r&&a.jsxs("span",{className:"inline-flex items-center gap-1.5 font-semibold text-foreground",children:[a.jsx(fs,{className:"size-3.5 text-blue-400"}),g.llmCallCount," LLM"]}),a.jsxs("span",{className:"inline-flex items-center gap-1.5 text-muted-foreground",children:[a.jsx(qr,{className:"size-3.5 text-sky-400/70"}),g.toolCallCount," tools"]}),r&&a.jsxs("span",{className:"inline-flex items-center gap-1.5 text-muted-foreground",children:[a.jsx(Fr,{className:"size-3.5 text-emerald-400"}),a.jsxs("span",{className:"font-mono",children:[He(g.totalInputTokens)," / ",He(g.totalOutputTokens)]})]}),(g.totalCacheCreationInputTokens>0||g.totalCacheReadInputTokens>0)&&a.jsxs("span",{className:"inline-flex items-center gap-1.5 text-muted-foreground",children:[a.jsx(Fr,{className:"size-3.5 text-purple-400"}),a.jsxs("span",{className:"font-mono",children:["KV Cache +",He(g.totalCacheCreationInputTokens)," / ~",He(g.totalCacheReadInputTokens)]})]}),v&&a.jsxs("span",{className:"inline-flex items-center gap-1.5 text-muted-foreground",children:[a.jsx(hn,{className:"size-3.5"}),r&&a.jsx("span",{className:"font-mono",children:ha(g.totalElapsedMs)}),g.maxElapsedMs!==null&&a.jsxs("span",{className:"font-mono text-muted-foreground/70",children:["max ",ha(g.maxElapsedMs)]})]}),r&&k!==null&&a.jsx("span",{className:"font-mono text-muted-foreground/70",children:k}),(g.failedCallCount>0||g.pendingCallCount>0||g.slowCallCount>0)&&a.jsxs("span",{className:"inline-flex items-center gap-1.5 text-amber-400",children:[a.jsx(Lo,{className:"size-3.5"}),a.jsxs("span",{className:"font-mono",children:[g.failedCallCount," fail / ",g.pendingCallCount," pending /"," ",g.slowCallCount," slow"]})]}),a.jsx("span",{className:"flex-1"}),m&&a.jsx(st,{variant:"outline",className:"h-6 px-2 text-[10px] font-mono",children:ez(g.knowledgeCandidateCount)}),a.jsxs(Ae,{type:"button",variant:"outline",size:"sm",className:"h-7 gap-1.5 px-2 text-xs",onClick:S,disabled:u.status==="loading",children:[u.status==="loading"?a.jsx(Wt,{className:"size-3.5 animate-spin"}):a.jsx(Nf,{className:"size-3.5"}),"Candidate"]}),m&&a.jsx(Ae,{type:"button",variant:"ghost",size:"icon",className:"size-7 text-muted-foreground",onClick:()=>c(E=>!E),"aria-expanded":l,"aria-label":l?"Collapse memory candidates":"Expand memory candidates",children:l?a.jsx(Zt,{className:"size-3.5"}):a.jsx(on,{className:"size-3.5"})})]}),u.status==="failed"&&a.jsx("p",{className:"mt-2 text-xs text-destructive",children:u.error}),a.jsx(iz,{insights:b}),l&&a.jsx(hz,{candidates:s,promotingCandidateIds:f,updatingCandidateIds:p,onPromoteCandidate:C,onUpdateCandidate:j})]})}function gz(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}}const zg=x.memo(function({group:e,viewMode:t="simple",strip:n,slowResponseThresholdSeconds:r,cacheTrends:o,onCompareWithPrevious:s,comparisonPredecessors:i,onClearGroup:l,standalone:c=!1,hasPinnedSessionContext:u=!1,timeDisplayFormat:d,expanded:f,onExpandedChange:h}){const[p,y]=x.useState(!1),m=f??p,g=x.useCallback(T=>{if(h!==void 0){h(T);return}y(T)},[h]),b=x.useMemo(()=>gz(e.logs),[e.logs]),v=e.logs[0]?.timestamp??new Date().toISOString(),k=e.logs[e.logs.length-1]?.timestamp??new Date().toISOString(),S=dN(e.logs),C=e.logs.some(T=>T.responseStatus===null),j=c&&!u,E=x.useMemo(()=>FI(e.logs),[e.logs]);return x.useEffect(()=>{const T=z=>{if(c)return;const O=Bs(z);O!==null&&e.logs.some(B=>B.id===O.logId)&&g(!0)};return window.addEventListener(nn,T),()=>{window.removeEventListener(nn,T)}},[e.logs,g,c]),a.jsxs("div",{className:"mb-2",children:[!c&&a.jsx(cN,{conversationId:e.conversationId,startTime:v,endTime:k,totalCalls:e.logs.length,totalInputTokens:b.totalInputTokens,totalOutputTokens:b.totalOutputTokens,apiFormat:uN(e.logs),expanded:m,onToggle:()=>g(!m),hideApiFormat:S,isLoading:C,userAgent:e.logs[0]?.userAgent??null,timeDisplayFormat:d,onClear:()=>l(e.logs.map(T=>T.id))}),LI(c,m)&&a.jsxs("div",{children:[a.jsx(mz,{logs:e.logs,scopeId:e.conversationId,slowResponseThresholdSeconds:r,showRollupMetrics:j,timeDisplayFormat:d}),E.map(T=>a.jsx(VI,{entries:T.entries,viewMode:t,strip:n,slowResponseThresholdSeconds:r,timeDisplayFormat:d,cacheTrends:o,onCompareWithPrevious:s,comparisonPredecessors:i,turnIndex:T.turnIndex},T.turnIndex))]})]})});function xz({className:e}){return a.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",className:ve("inline-block size-5",e),children:[a.jsx("path",{d:"M5 13 C5 9 8 7 12 7 C16 7 19 9 19 13 C19 16 16 18 12 18 C8 18 5 16 5 13 Z"}),a.jsx("path",{d:"M5 11 C3.5 9.5 1.5 10 2 12.5 C2.5 14 4 13.5 5 12.5"}),a.jsx("path",{d:"M19 11 C20.5 9.5 22.5 10 22 12.5 C21.5 14 20 13.5 19 12.5"}),a.jsx("line",{x1:"10",y1:"7",x2:"9.5",y2:"5"}),a.jsx("line",{x1:"14",y1:"7",x2:"14.5",y2:"5"}),a.jsx("circle",{cx:"9.5",cy:"4.5",r:"0.9",fill:"currentColor",stroke:"none"}),a.jsx("circle",{cx:"14.5",cy:"4.5",r:"0.9",fill:"currentColor",stroke:"none"}),a.jsx("line",{x1:"6.5",y1:"16",x2:"4.5",y2:"19.5"}),a.jsx("line",{x1:"9",y1:"17.5",x2:"8",y2:"20.5"}),a.jsx("line",{x1:"15",y1:"17.5",x2:"16",y2:"20.5"}),a.jsx("line",{x1:"17.5",y1:"16",x2:"19.5",y2:"19.5"}),a.jsxs("g",{children:[a.jsx("path",{d:"M5.6 17.7 L8.4 15.4 L10.8 18 C9.1 18.9 7.2 18.8 5.6 17.7 Z",fill:"#2f6b3f",stroke:"none",opacity:"0.95"}),a.jsx("path",{d:"M6.9 17.5 L8.4 16 L9.8 17.7 C8.9 18.1 7.8 18.1 6.9 17.5 Z",fill:"#6fb36f",stroke:"none",opacity:"0.95"}),a.jsx("path",{d:"M8.4 16 L8.4 18.4",stroke:"#d6b45f",strokeWidth:"0.34"}),a.jsx("circle",{cx:"10.6",cy:"17.75",r:"0.36",fill:"#c2412d",stroke:"none"})]}),a.jsxs("g",{children:[a.jsx("path",{d:"M8 16.5 L11.9 13.6 L15.8 16.8 C13.3 18.4 10.4 18.3 8 16.5 Z",fill:"#2f6b3f",stroke:"none",opacity:"0.97"}),a.jsx("path",{d:"M9.8 16.3 L11.9 14.4 L14.3 16.5 C12.8 17.4 11.3 17.4 9.8 16.3 Z",fill:"#6fb36f",stroke:"none",opacity:"0.95"}),a.jsx("path",{d:"M11.9 14.3 L11.9 17.8",stroke:"#d6b45f",strokeWidth:"0.42"}),a.jsx("path",{d:"M9.8 16.3 C11.2 15.8 12.9 15.9 14.3 16.5",stroke:"#9fca78",strokeWidth:"0.36"}),a.jsx("circle",{cx:"15.6",cy:"16.75",r:"0.43",fill:"#c2412d",stroke:"none"})]}),a.jsxs("g",{children:[a.jsx("path",{d:"M13.6 18.1 L16.2 15.7 L18.5 18.2 C17.1 19.1 15.2 19 13.6 18.1 Z",fill:"#2f6b3f",stroke:"none",opacity:"0.95"}),a.jsx("path",{d:"M14.8 17.9 L16.2 16.3 L17.5 18 C16.6 18.4 15.7 18.4 14.8 17.9 Z",fill:"#6fb36f",stroke:"none",opacity:"0.95"}),a.jsx("path",{d:"M16.2 16.3 L16.2 18.6",stroke:"#d6b45f",strokeWidth:"0.34"}),a.jsx("circle",{cx:"18.35",cy:"18.15",r:"0.36",fill:"#c2412d",stroke:"none"})]})]})}const bz="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAPoAAAD6CAQAAAAi5ZK2AAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAAAmJLR0QA/4ePzL8AAAAHdElNRQfpCxsJDCnsge2KAAAM2ElEQVR42u2de3AW1RnGnyQQDARDwiUFpHIVMHIpYgFRB2nLxQrC0FIDiCKDWNqBUqBlai8wvciIpaRTWh3QDqCDIIjKDL0IaBC5SKlysWJArgqh3BMICYFs/wgpGUi+8579dr89e/Z5zp/59j2755fn3d2z5wJQFEVRFEVRoVQSm+AG1UFrtEdT1EcjNEA5SlCMIhxDAQoJ3S4lIwf9cD+6ozXq1vKbYuzHNmxEPo6xwcKtungIS3EajkYpwLPoyqYLp3KwACe1cFcvezATmWzEMOk+rMBV18CrSjHy0IqNGQb1wMa4cV8vZfgzGrNRTVYm8nDFQ+SV5QymIIWNa6ZGaz6y6ZR/I4cNbJrSkOcb8MpyCVPYzCapKz71GXllWY5b2dhm6EGcTwhyBw52oyUbPHgNx6WEIXfg4CDuYKMHq0kevI/rlhP4Ghs+OE1ERcKRO3BwEh3Z+NFC7sDBATQngMRrcoDIHTj4iE/yUXJ5VVlhYsMkWezy+a6urgRbsAP7cRincQGpqI+maI+O6IMuSHYRbwIW0X/mJvZTeAH9ah1CATTCaKxBmWbUi7iTOMxEXoCncIsodgvM1ezo2cFPMebdy89qfyHL0vxSN5FQzHL5ajRxVU8v7NO4cWQRjCnIy/DDOOq6FcvENS0gGjMS+wUMjvvdZ5awrsv4KvEE7/Iz+Lontc4Q1vc8AQXt8rO4x7Oa54hqLOLI2aBdfrenHVyviWqdQUx2uLxS6fhMUO8ugrLD5VXqLfpmfxdh2eHyKi0S1P5b4rLF5ZVqiiJl/Z8SmD0ur9TzgnNoQWi2uLxSt+Gy8ixGEpvZLs9AN3RGqsYRa5Xn8SeCM9XlDfFT7Ll2bDnWYYRwOMZjyjP5kOjMdPkDOHpTjPX4iuDILOWL2znCMxH5IyitMc4+ZAuO3q08nyYEaFpiHxbjYWyDIMm/qDyje4kwPMgdOBihjDBNeU7fJcQwIXewTnBzUJ3Vk8Rozr18mOAtuxT1FFH6KmNMJkhTkH+7lse3G0s7RZyuygjPEGVYEntV6aSIlKOM8CvCDEtirywVyFDE6q2M8WPiDJPLJcMgBiljPEWg4XG5AwfTlfEmKWPkEml4XO7gCBooI85TRvlm8I1ax3CX68w8PYeB2KGFfEWM6Yo3qgy5uKj8VU/lLz5HG2QjHRlIA1CCIhTjBI6ggg43LbGXYYggZj3lgkYVtbwaluITvIlf4gHhNEomdheJXfpeXoX8EVHUAR4sY1CKfEyN5gibMCIHXvJsBYur2IDxSCNy05HXx1mPFy/5L2ZFZb6rGR2uusiByb6sWlOMZ5FOl5vocqAuDvm2XNExjLV5t52wuhyY7vM6Ve+jA11uksuB5glYcLgIY+hyc1yeJBj87E35q6BXkC5PAHJgdgKXI9xlzzt8eF0OjE/wypQH7Li7h9nl4wJYjPQ4utPlwSF/LKD1Z8+gC10eLeQOHHyJ1nR54pGPCniVadmcGyK3xOVVZYvWnNpqb5hBIv+L1hCJAdiuhXyVcpT6dV3GSLylhXyxy7YrxHYU4CBO4yKABmiCNuiIe9DMVbT5mMp7eWJc/rgLl1dgC6bE2NelM6Zim4uoDzOxm5nYS/GicNOuznhJc0X5k2HprIkS8gos1cTSSrgYodFbhkQ5sR/F/a7aqD8Oa9TSny43x+UblDNialcmVovr2WP2qOYoIV8V57tREuaK6/o+E7sJid2bO+00Ya0HTPV6lFy+3LNWmymsMZfIg+1w9fZ5ep6ozp3mjaKjy90rGetF9d5H5Ha4vFLZOB62zYGIPH6NEk2NqEvk4U/s1V/f8gX1DyJye5ADQC/BGfyRyO1I7Nf1rvIcPiZye1xeqaGCua6ZNiMf7sOSAolD3h+v4otrH2RewYPCo1JxWnkmQ4jcROTZNcyGWSMcN7PQ5KUJw4zc33t5G+xHzfu3S7655wqmPRG5ccgPxxjkqN7DvbnyfDYRuVmJvY1iYMQEQYxCxRkVEnlYXF5ZdguibFLEKI/6S9pQg1x+Ow4IYrZSxlmqjJFGl4fF5dLVJBcoYzQl8jDcy3XestV7tbcl8vC43IGD3spo6gEVtxF5mJCXCu7H6u6ZRlFE/nAoE7sDB8sEEd9URqkTfuT2P7FXlSuiZQb2KKKU0OXhcbmDGYKYdZWrTO8l8nDcyx04mCeKqh5IsYaJPRyJ3cEfhHFnePTPQ+ShQQ68r4z1NJEHkdj9Q95KcN7didwmlwOzBC2dTOT2uByoj5PBPcbR5UEgly0tPo3I7XE5kI1zgoVOWhO5PS4HXhHE/IDI7XE5MFIU9QdEbo/LO6NIEPWS98Mn/F04pD+R16oWOCiK+4LXyMf4irwnin1ErrtWzGtGIW+MXcJvdB4v/H87LvqIvL1yWG90XZ6J7UHNpVvoI/KGKPDxS5q/Lm/ry5e06i7/SBi5HHd5izxVI/nqIpcM6aXL1WW+1z7v6SPyJ0I7RMJvl+sgP+H9uLihviFvp5FDmNhrL096/34+2Jf3cgBYw8TuAfI3/OiHu8MXl+tsMM97ee3lKBr7AT1JuVuwG+Sp2EvkcSMvR1+/PqbO9Bw5MIn38rgTu69rP6fFeJd2hzwFn/OJPU6XO5gNX5VTy6iNk66QA4+KLqoCY5nYay0L4bs6YedN1e5EJ5fRdogu60dM7DE+/SZk+lIqxmMzrl5br2wzxrvbCA5Ad9FlraTLay2vJ3YV2DS0Rds4VzuYI7isQ1q9TNG6l79uzsK/8ldAyffhYRoRwz0qJgLIgT6CC/uHMcjpck/0c8Gl9aHLbUIO/FN5aflEbhfyOoJBfrlEbhNyydf5C0jnvdwm5MAY5eWtInK7kAOzlRc4mYndLuTAq8pL7KGMMTzUXTGGdrj6qc2KS7yq7O27E1fYxx4ufaK4yCOK41M0ofg7dYHIRVIh2xr3gyBdbpxUW8+8ozh+PV0ePqkmSK1RJPdLhrj890Qu1ynFxa6PeXRTQ76X871cS6rPqh/GPDrLiJc0ulxTqgVtj8U8OglneS8Pn9RrHjaMefwbvJeHT4vj/JY+iMjDJ/UQip8oIqyNcewyJnYT9T3lpf9NEaEJPqvlyEV0uZnqKpjVkqWIkV3DTuKlmusfE3kClYwzygaYIIiSi03XxuA7OIF5aE7kJuttZRPsQpIoUga64W601l75mF0xCZdkYdvBPtZP5AGom6Ahtvu2brnfiZ3IXfbKye7rdHmo9AtBc5zyYftIujxAtRONcduIFLrcJm3wpdmDdfm/iDy2BgqbZnpoXE7kSiUJOy8qMNWD2nJwlC43QY+Km+i5OF/fHhD0ARJ5grpjt4qbaT1auM4oU1DGxG6Oev2/71xdCpEr7Jqtro5YpwWELk+AXtZqsHz01ojdDHM1PU7kCVEznNDEko8RuEXQ0bsAJZqRiTxhGqQ5FdGBg3NYgsfRpoZoDTEIv8N/tCNGDnlSwPU/hxkujyzCPhzBOZQiBY3QFB3i6Lidp7lhZSbe0VorcyVGoZwer1JdbHHlTC8LE3vC1US8CLg/xf+XtDqEfLPa4BiRR0/dBXsGhzOxE3kMdcGXCUc+h8iDT/IFCQR+BROJ3ARlaw5DcF8uYAiRm6J6yHPRXaNb9mhvUknkPmuocuGC+MoS1Cdy89QSK3wCvg8PaZ8NkSdM/YT7hsvLRcwSfKwh8kBVB08LN/JSlxIscNUzT+QBKBlDsC1O4OeR53LkDZEHqN7Ic9VRW4a3kav92EbkxigF38BcbEO5CMBhLME45Tz3yCJPChn8dPRBF7RHB3RARrVtvC6hGIewHwUowBYcirMW/e/lubhCZybunyALmR7/6zKxR05ETuRETuRETuRsNCKniJwicorIKSKniJwicorIKSKniJyqGfnHmvsyE3nIlRJzHxi63ErlEXnUNI6JPWrKUO7rTJdbp98QedSUjWIm9qjpGSKPnrYysUdNzYRLEBO5RRrLxF6p5AhB7yz4zUqMtn+CUpSgZyt/sZpz0mzTWuXU5sbRaIgoOT1T8fdCnCZ026RC2lJzQ25CD4EKFX9PwWLUI/RoQQe+hbdcrEBFGazRovf0tdFwe1SUJVyx5u90u03aKOx7J3aLNEP8lY1J3ho10hg3Q7dbo59pjJwhdkvUAMeJPXr6jtY2Ary3W6Jfaw2CptutUJLmJgLEboXSsUkLO5O8JQ9079LtxE7sxE7sxE7sFqkhH+mIXV1WhG43DMoD7OPZZNHD/gWnPUUR+4BwX2wyeQMAijEYH4h/fS+hRw97c0K3B/tAvCf6ZRmh26OLGCpy+wE2VfQe6XLYTFHD/h6bKGrYy9CDDWQr9vwakV/FE2wce5WGl29CfgrD2TC2qy+W4/w14Hsxy5aVKvjFSN1CLVAPp1DEpqAoiqIoyiz9D9lYMumhgrvLAAAAJXRFWHRkYXRlOmNyZWF0ZQAyMDI1LTExLTI3VDA5OjEyOjQxKzAwOjAwvIZCxQAAACV0RVh0ZGF0ZTptb2RpZnkAMjAyNS0xMS0yN1QwOToxMjo0MSswMDowMM3b+nkAAAAASUVORK5CYII=";function yz({className:e}){return a.jsx("img",{src:bz,alt:"Model Context Protocol","aria-hidden":"true",className:ve("inline-block size-8 object-contain invert",e)})}function Qo({...e}){return a.jsx(Uj,{"data-slot":"select",...e})}function es({...e}){return a.jsx(Vj,{"data-slot":"select-value",...e})}function ts({className:e,size:t="default",children:n,...r}){return a.jsxs(Wj,{"data-slot":"select-trigger","data-size":t,className:ve("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,a.jsx(Hj,{asChild:!0,children:a.jsx(Zt,{className:"size-4 opacity-50"})})]})}function ns({className:e,children:t,position:n="popper",align:r="center",...o}){return a.jsx(Zj,{children:a.jsxs(qj,{"data-slot":"select-content",className:ve("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:[a.jsx(vz,{}),a.jsx(Kj,{className:ve("p-1",n==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)] scroll-my-1"),children:t}),a.jsx(wz,{})]})})}function Lt({className:e,children:t,...n}){return a.jsxs(Gj,{"data-slot":"select-item",className:ve("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:[a.jsx("span",{className:"absolute right-2 flex size-3.5 items-center justify-center",children:a.jsx(Yj,{children:a.jsx(rt,{className:"size-4"})})}),a.jsx(Jj,{children:t})]})}function vz({className:e,...t}){return a.jsx(Xj,{"data-slot":"select-scroll-up-button",className:ve("flex cursor-default items-center justify-center py-1",e),...t,children:a.jsx(qv,{className:"size-4"})})}function wz({className:e,...t}){return a.jsx(Qj,{"data-slot":"select-scroll-down-button",className:ve("flex cursor-default items-center justify-center py-1",e),...t,children:a.jsx(Zt,{className:"size-4"})})}const Rg=te({input:ie().int().nonnegative(),output:ie().int().nonnegative(),cacheCreate:ie().int().nonnegative(),cacheRead:ie().int().nonnegative(),total:ie().int().nonnegative()}),kz=te({id:ie().int().positive(),timestamp:A(),provider:A().nullable(),model:A().nullable(),apiFormat:Re(["anthropic","openai","unknown"]),method:A(),path:A(),status:ie().nullable(),isStreaming:Ze(),hasError:Ze(),error:A().nullable(),latencyMs:ie().nullable(),firstChunkMs:ie().nullable().optional(),totalStreamMs:ie().nullable().optional(),tokensPerSecond:ie().nullable().optional(),tokens:te({input:ie().nullable(),output:ie().nullable(),cacheCreate:ie().nullable(),cacheRead:ie().nullable()}),sessionId:A().nullable()}),Pg=te({id:A(),status:Re(["active","failed","completed","empty"]),logCoverage:Re(["recent","history"]),source:Re(["explicit","client-process","client-connection","provider-test"]).nullable(),runtimeMode:Re(["in-process","worker-thread","child-process"]).nullable(),createdAt:A().nullable(),updatedAt:A().nullable(),requestCount:ie().int().nonnegative(),activeRequests:ie().int().nonnegative(),completedRequests:ie().int().nonnegative(),failedRequests:ie().int().nonnegative(),queuedTasks:ie().int().nonnegative(),runningTasks:ie().int().nonnegative(),lastTaskError:A().nullable(),logCount:ie().int().nonnegative(),errorCount:ie().int().nonnegative(),models:we(A()),providers:we(A()),tokenUsage:Rg,lastLogId:ie().nullable(),lastModel:A().nullable(),clientPid:ie().nullable(),clientProjectFolder:A().nullable(),inspectorPath:A(),inspectorUrl:A(),apiPath:A(),apiUrl:A(),compactLogsPath:A(),compactLogsUrl:A(),latestLogLimit:ie().int().positive(),latestLogs:we(kz)}),eo=Re(["created","running","completed","failed","cancelled"]),Al=te({jsonPath:A(),markdownPath:A(),htmlPath:A(),exportedAt:A()}),_z=Re(["run-created","session-started","request","session-finished","evidence-exported"]),Sz=Re(["info","success","warning","error"]),Cz=te({timestamp:A(),kind:_z,severity:Sz,title:A(),details:A(),logId:ie().int().positive().nullable(),status:ie().nullable(),model:A().nullable(),provider:A().nullable(),latencyMs:ie().nullable(),isStreaming:Ze().nullable()}),jz=Re(["none","active","provider-timeout","provider-http-error","provider-auth-error","provider-rate-limit","network-or-container","streaming-mismatch","context-pressure","runtime-task-error","model-output-error","unknown-failure","no-session-data"]),Og=te({outcome:Re(["success","failure","active","unknown"]),severity:Re(["none","low","medium","high"]),category:jz,summary:A(),evidenceLogIds:we(ie().int().positive()),hints:we(A())}),Il=te({status:Re(["PASS","FAIL","RUNNING","UNKNOWN"]),summary:A(),markdown:A()}),Mg=Il,zl=te({id:A(),sessionId:A(),title:A(),task:A().nullable(),project:A().nullable(),agent:A().nullable(),status:eo,tags:we(A()),metadata:nt(A(),ft),evidence:Al.nullable(),createdAt:A(),updatedAt:A()});te({runId:A().min(1).optional(),sessionId:A().min(1).optional(),title:A().min(1).optional(),task:A().nullable().optional(),project:A().nullable().optional(),agent:A().nullable().optional(),status:eo.optional(),tags:we(A()).optional(),metadata:nt(A(),ft).optional()}).optional();te({sessionId:A().min(1).optional(),title:A().min(1).optional(),task:A().nullable().optional(),project:A().nullable().optional(),agent:A().nullable().optional(),status:eo.optional(),tags:we(A()).optional(),metadata:nt(A(),ft).optional()});te({includeHistory:Ze().optional(),latestLogLimit:ie().int().positive().max(50).optional()}).optional();te({run:zl,evidence:Al,session:Pg.nullable(),timeline:we(Cz),classification:Og,jenkinsReport:Il});const Nz=te({run:zl,classification:Og,evidence:Al.nullable(),jenkinsReport:Il.nullable(),sessionId:A(),inspectorUrl:A().nullable(),evidenceMarkdownPath:A().nullable(),updatedAt:A()});te({failures:we(Nz),total:ie().int().nonnegative(),limit:ie().int().positive()});const Rl=Re(["created","running","completed","failed","cancelled"]),Pl=Re(["evaluation","batch","manual"]),Ol=te({jsonPath:A(),markdownPath:A(),htmlPath:A(),exportedAt:A()}),Lg=te({id:A(),groupId:A(),sessionId:A(),runId:A().nullable(),label:A().nullable(),agent:A().nullable(),provider:A().nullable(),model:A().nullable(),status:eo.nullable(),metadata:nt(A(),ft),addedAt:A(),updatedAt:A()}),Ml=te({id:A(),title:A(),kind:Pl,task:A().nullable(),project:A().nullable(),status:Rl,tags:we(A()),metadata:nt(A(),ft),evidence:Ol.nullable(),members:we(Lg),createdAt:A(),updatedAt:A()});te({groupId:A().min(1).optional(),title:A().min(1).optional(),kind:Pl.optional(),task:A().nullable().optional(),project:A().nullable().optional(),status:Rl.optional(),tags:we(A()).optional(),metadata:nt(A(),ft).optional()}).optional();te({title:A().min(1).optional(),kind:Pl.optional(),task:A().nullable().optional(),project:A().nullable().optional(),status:Rl.optional(),tags:we(A()).optional(),metadata:nt(A(),ft).optional()});te({memberId:A().min(1).optional(),sessionId:A().min(1),runId:A().min(1).nullable().optional(),label:A().min(1).nullable().optional(),agent:A().min(1).nullable().optional(),provider:A().min(1).nullable().optional(),model:A().min(1).nullable().optional(),status:eo.nullable().optional(),metadata:nt(A(),ft).optional()});te({includeHistory:Ze().optional(),latestLogLimit:ie().int().positive().max(50).optional()}).optional();te({deleteEvidence:Ze().optional()});const Ez=te({groupId:A(),deleted:Ze(),evidenceDeleted:Ze(),evidencePath:A().nullable()}),Tz=te({member:Lg,run:zl.nullable(),session:Pg.nullable()}),Dg=te({memberCount:ie().int().nonnegative(),sessionsWithData:ie().int().nonnegative(),missingSessions:ie().int().nonnegative(),requestCount:ie().int().nonnegative(),errorCount:ie().int().nonnegative(),tokenUsage:Rg,models:we(A()),providers:we(A()),completedMembers:ie().int().nonnegative(),failedMembers:ie().int().nonnegative(),runningMembers:ie().int().nonnegative()}),Az=te({group:Ml,evidence:Ol,markdown:A(),summary:Dg.nullable(),report:Mg.nullable()}),Iz=te({group:Ml,evidence:Ol,members:we(Tz),summary:Dg,jenkinsReport:Mg}),zz=te({groups:we(Ml)});function Rz(e){return e===null||e.evidence===null?null:`/api/groups/${encodeURIComponent(e.id)}/evidence`}function Pz(e){const t=Hr(Rz(e),n=>On(n,Az));return{evidenceResponse:t.data??null,isLoading:t.isLoading,error:t.error,mutate:t.mutate}}function Oz(){const e=Hr("/api/groups",t=>On(t,zz));return{groups:e.data?.groups??[],isLoading:e.isLoading,error:e.error,mutate:e.mutate}}function Mz(e,t){const n=`/api/groups/${encodeURIComponent(e)}`;return t?`${n}?deleteEvidence=1`:n}function Fg(e){let t=0,n=0,r=0,o=0;for(const s of e.members)switch(s.status){case"completed":t+=1;break;case"failed":case"cancelled":n+=1;break;case"running":r+=1;break;case"created":break;case null:o+=1;break}return{memberCount:e.members.length,completedMembers:t,failedMembers:n,runningMembers:r,missingStatusMembers:o}}function Lz(e,t){return t!==null&&t.group.id===e.id?t.members.map(n=>({member:n.member,exportMember:n})):e.members.map(n=>({member:n,exportMember:null}))}function Ll(e){switch(e){case"completed":return"border-emerald-200 bg-emerald-50 text-emerald-700";case"failed":case"cancelled":return"border-red-200 bg-red-50 text-red-700";case"running":return"border-sky-200 bg-sky-50 text-sky-700";case"created":return"border-zinc-200 bg-zinc-50 text-zinc-600";case null:return"border-zinc-200 bg-zinc-50 text-zinc-500"}}function Dl(e){return e??"unknown"}function Dz(e){switch(e){case"PASS":return"border-emerald-200 bg-emerald-50 text-emerald-700";case"FAIL":return"border-red-200 bg-red-50 text-red-700";case"RUNNING":return"border-sky-200 bg-sky-50 text-sky-700";case"UNKNOWN":return"border-zinc-200 bg-zinc-50 text-zinc-600"}}function $g(e){return e===null||e.trim().length===0?"-":e}function nr(e){return e.toLocaleString()}function Fz(e){return e==null?"-":e<1e3?`${nr(e)} ms`:`${(e/1e3).toFixed(1)} s`}function Fl(e){const t=Date.parse(e);return Number.isFinite(t)?new Intl.DateTimeFormat(void 0,{month:"short",day:"2-digit",hour:"2-digit",minute:"2-digit",hour12:!1}).format(new Date(t)):e}function Bg(...e){for(const t of e)if(t!==null&&t.trim().length>0)return t;return"-"}function $z(e){const t=e.provider,n=e.model;return t!==null&&t.length>0&&n!==null&&n.length>0?`${t} / ${n}`:Bg(t,n)}function Bz(e,t){if(t!==null){const n=e.find(r=>r.id===t);if(n!==void 0)return n}return e[0]??null}function Uz(e){return(e.exportMember?.session?.latestLogs??[])[0]??null}function Wz(e,t){return t!==null&&t.group.id===e.id?t.evidence:e.evidence}function Vz(e,t,n){return t!==null&&t.group.id===e.id?t.summary:n!==null&&n.group.id===e.id?n.summary:null}function Hz(e,t,n){return t!==null&&t.group.id===e.id?t.jenkinsReport:n!==null&&n.group.id===e.id?n.report:null}function Zz(){const[e,t]=x.useState(!1),[n,r]=x.useState(null),[o,s]=x.useState(null),[i,l]=x.useState(null),[c,u]=x.useState(null),[d,f]=x.useState(null),[h,p]=x.useState(!1),[y,m]=x.useState(null),[g,b]=x.useState(null),{groups:v,isLoading:k,error:S,mutate:C}=Oz(),j=x.useMemo(()=>Bz(v,n),[v,n]);x.useEffect(()=>{!e||n!==null&&v.some(K=>K.id===n)||r(v[0]?.id??null)},[v,e,n]);const E=j!==null&&c!==null&&c.group.id===j.id?c:null,{evidenceResponse:T,isLoading:z,error:O,mutate:B}=Pz(j),N=x.useCallback(()=>{C()},[C]),D=x.useCallback(async F=>{s(F.id),l(null);try{const K=await fetch(`/api/groups/${encodeURIComponent(F.id)}/evidence`,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({latestLogLimit:10})});if(!K.ok){l(await Qt(K,`Export failed with status ${String(K.status)}`));return}const I=await It(K,Iz);u(I),await C(),await B()}catch(K){l(K instanceof Error?K.message:String(K))}finally{s(null)}},[C,B]),w=x.useCallback(F=>{f(F),p(!1),b(null)},[]),L=x.useCallback(()=>{y===null&&(f(null),p(!1),b(null))},[y]),W=x.useCallback(F=>{r(F),f(null),p(!1),b(null)},[]),U=x.useCallback(async()=>{const F=d;if(F!==null){m(F.id),b(null);try{const K=await fetch(Mz(F.id,h),{method:"DELETE"});if(!K.ok){b(await Qt(K,`Delete failed with status ${String(K.status)}`));return}await It(K,Ez),u(I=>I!==null&&I.group.id===F.id?null:I),r(I=>I===F.id?null:I),f(null),p(!1),await C(),await B()}catch(K){b(K instanceof Error?K.message:String(K))}finally{m(null)}}},[h,d,C,B]);return a.jsxs(zs,{open:e,onOpenChange:t,children:[a.jsx(mm,{asChild:!0,children:a.jsxs(Ae,{type:"button",variant:"ghost",size:"icon",className:"relative size-8","aria-label":"Evaluation groups",title:"Evaluation groups",children:[a.jsx(fc,{className:"size-4"}),k?a.jsx(Wt,{className:"absolute -right-0.5 -top-0.5 size-3 animate-spin text-muted-foreground"}):v.length>0?a.jsx("span",{className:"absolute -right-1 -top-1 min-w-4 rounded-full bg-primary px-1 text-[10px] leading-4 text-primary-foreground",children:v.length}):null,a.jsx("span",{className:"sr-only",children:"Evaluation groups"})]})}),a.jsxs(Rs,{className:"flex max-h-[85vh] max-w-5xl flex-col overflow-hidden",children:[a.jsx(Ps,{children:a.jsxs(Os,{className:"flex items-center gap-2 pr-8",children:[a.jsx(fc,{className:"size-5 text-muted-foreground"}),a.jsx("span",{children:"Groups"}),a.jsx(st,{variant:"outline",children:nr(v.length)})]})}),a.jsxs("div",{className:"flex min-h-0 items-center justify-between gap-3 border-b border-border pb-3",children:[a.jsx("p",{className:"text-xs text-muted-foreground",children:"Evaluation batches, model runs, and exported evidence packs."}),a.jsxs(Ae,{type:"button",variant:"outline",size:"sm",className:"shrink-0",onClick:N,children:[a.jsx(Pi,{className:"size-3.5"}),"Refresh"]})]}),a.jsxs("div",{className:"grid min-h-0 flex-1 gap-4 md:grid-cols-[260px_minmax(0,1fr)]",children:[a.jsx(qz,{groups:v,selectedGroupId:j?.id??null,isLoading:k,error:S,onSelect:W}),a.jsx(Kz,{group:j,deleteTarget:d,deleteEvidence:h,exportResult:E,evidenceResponse:T,evidenceLoading:z,evidenceError:O,exportError:i,deleteError:g,exportingGroupId:o,deletingGroupId:y,onDeleteEvidenceChange:p,onExport:D,onRequestDelete:w,onCancelDelete:L,onConfirmDelete:()=>{U()}})]})]})]})}function qz({groups:e,selectedGroupId:t,isLoading:n,error:r,onSelect:o}){return n?a.jsx("div",{className:"flex min-h-48 items-center justify-center rounded-md border border-dashed border-border text-xs text-muted-foreground",children:"Loading groups..."}):r!==void 0?a.jsx("div",{className:"rounded-md border border-red-200 bg-red-50 px-3 py-2 text-xs text-red-700",children:r.message}):e.length===0?a.jsx("div",{className:"rounded-md border border-dashed border-border px-3 py-8 text-center text-xs text-muted-foreground",children:"No groups yet."}):a.jsx("div",{className:"min-h-0 overflow-y-auto pr-1",children:a.jsx("div",{className:"space-y-2",children:e.map(s=>{const i=Fg(s),l=t===s.id;return a.jsxs("button",{type:"button",onClick:()=>o(s.id),className:ve("w-full rounded-md border px-3 py-2 text-left text-xs transition-colors",l?"border-primary bg-primary/5":"border-border bg-background hover:bg-muted/50"),children:[a.jsxs("div",{className:"flex min-w-0 items-center justify-between gap-2",children:[a.jsx("span",{className:"min-w-0 truncate text-sm font-medium",children:s.title}),a.jsx(st,{variant:"outline",className:Ll(s.status),children:Dl(s.status)})]}),a.jsxs("div",{className:"mt-1 flex items-center gap-2 text-muted-foreground",children:[a.jsxs("span",{children:[i.memberCount," sessions"]}),a.jsx("span",{children:Fl(s.updatedAt)})]})]},s.id)})})})}function Kz({group:e,deleteTarget:t,deleteEvidence:n,exportResult:r,evidenceResponse:o,evidenceLoading:s,evidenceError:i,exportError:l,deleteError:c,exportingGroupId:u,deletingGroupId:d,onDeleteEvidenceChange:f,onExport:h,onRequestDelete:p,onCancelDelete:y,onConfirmDelete:m}){if(e===null)return a.jsx("div",{className:"flex min-h-48 items-center justify-center rounded-md border border-dashed border-border text-xs text-muted-foreground",children:"Select a group to inspect."});const g=Fg(e),b=Vz(e,r,o),v=Hz(e,r,o),k=Wz(e,r),S=Lz(e,r),C=u===e.id,j=d===e.id,E=t?.id===e.id;return a.jsx("div",{className:"min-h-0 overflow-y-auto pr-1",children:a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"flex min-w-0 flex-col gap-3 sm:flex-row sm:items-start sm:justify-between",children:[a.jsxs("div",{className:"min-w-0 space-y-1",children:[a.jsxs("div",{className:"flex min-w-0 flex-wrap items-center gap-2",children:[a.jsx("h3",{className:"min-w-0 truncate text-base font-semibold",children:e.title}),a.jsx(st,{variant:"outline",className:Ll(e.status),children:Dl(e.status)}),a.jsx(st,{variant:"outline",children:e.kind})]}),a.jsxs("div",{className:"flex flex-wrap items-center gap-2 text-xs text-muted-foreground",children:[a.jsx("span",{children:$g(e.project)}),a.jsxs("span",{children:["updated ",Fl(e.updatedAt)]})]})]}),a.jsxs("div",{className:"flex shrink-0 items-center gap-2",children:[a.jsx(Ae,{type:"button",variant:"outline",size:"icon",className:"size-8 text-red-600 hover:text-red-700","aria-label":"Delete group",title:"Delete group",disabled:j,onClick:()=>p(e),children:j?a.jsx(Wt,{className:"size-3.5 animate-spin"}):a.jsx(sr,{className:"size-3.5"})}),a.jsxs(Ae,{type:"button",variant:"default",size:"sm",className:"shrink-0",disabled:C||j,onClick:()=>{h(e)},children:[C?a.jsx(Wt,{className:"size-3.5 animate-spin"}):a.jsx(ds,{className:"size-3.5"}),"Export evidence"]})]})]}),e.task!==null&&e.task.trim().length>0&&a.jsx("p",{className:"rounded-md border border-border bg-muted/20 px-3 py-2 text-xs text-muted-foreground",children:e.task}),E&&a.jsx(Gz,{group:e,deleteEvidence:n,isDeleting:j,error:c,onDeleteEvidenceChange:f,onCancel:y,onConfirm:m}),a.jsxs("div",{className:"grid gap-2 sm:grid-cols-4",children:[a.jsx(cn,{label:"Members",value:g.memberCount}),a.jsx(cn,{label:"Done",value:g.completedMembers}),a.jsx(cn,{label:"Failed",value:g.failedMembers}),a.jsx(cn,{label:"Running",value:g.runningMembers})]}),b!==null&&a.jsxs("div",{className:"grid gap-2 sm:grid-cols-4",children:[a.jsx(cn,{label:"Requests",value:b.requestCount}),a.jsx(cn,{label:"Errors",value:b.errorCount}),a.jsx(cn,{label:"Tokens",value:b.tokenUsage.total}),a.jsx(cn,{label:"Missing",value:b.missingSessions})]}),a.jsx(Jz,{report:v,loading:s,error:i,hasEvidence:k!==null}),a.jsx(Yz,{evidence:k}),l!==null&&a.jsx("div",{className:"rounded-md border border-red-200 bg-red-50 px-3 py-2 text-xs text-red-700",children:l}),c!==null&&!E&&a.jsx("div",{className:"rounded-md border border-red-200 bg-red-50 px-3 py-2 text-xs text-red-700",children:c}),a.jsx(Xz,{rows:S})]})})}function Gz({group:e,deleteEvidence:t,isDeleting:n,error:r,onDeleteEvidenceChange:o,onCancel:s,onConfirm:i}){const l=e.evidence!==null,c=e.evidence?.markdownPath??"No evidence pack exported.";return a.jsx("div",{className:"rounded-md border border-red-200 bg-red-50 px-3 py-3 text-red-900",children:a.jsxs("div",{className:"flex min-w-0 flex-col gap-3 lg:flex-row lg:items-start lg:justify-between",children:[a.jsxs("div",{className:"min-w-0 space-y-2",children:[a.jsxs("div",{className:"flex items-center gap-2 text-sm font-semibold",children:[a.jsx(sr,{className:"size-4 text-red-600"}),a.jsx("span",{children:"Delete group?"})]}),a.jsxs("p",{className:"text-xs text-red-800",children:["Delete ",a.jsx("span",{className:"font-medium",children:e.title}),". Session logs and run records stay intact."]}),a.jsxs("label",{className:ve("flex min-w-0 items-start gap-2 text-xs",l?"cursor-pointer":"opacity-60"),children:[a.jsx("input",{type:"checkbox",className:"mt-0.5 size-4 shrink-0",checked:t,disabled:!l||n,onChange:u=>o(u.currentTarget.checked)}),a.jsxs("span",{className:"min-w-0",children:[a.jsx("span",{className:"block font-medium",children:"Also delete exported evidence files"}),a.jsx("code",{className:"mt-1 block truncate font-mono text-[11px] text-red-700",children:c})]})]}),r!==null&&a.jsx("div",{className:"rounded-md border border-red-200 bg-white px-2 py-1.5 text-xs text-red-700",children:r})]}),a.jsxs("div",{className:"flex shrink-0 justify-end gap-2",children:[a.jsx(Ae,{type:"button",variant:"outline",size:"sm",disabled:n,onClick:s,children:"Cancel"}),a.jsxs(Ae,{type:"button",variant:"destructive",size:"sm",disabled:n,onClick:i,children:[n?a.jsx(Wt,{className:"size-3.5 animate-spin"}):a.jsx(sr,{className:"size-3.5"}),"Delete"]})]})]})})}function cn({label:e,value:t}){return a.jsxs("div",{className:"rounded-md border border-border bg-muted/20 px-3 py-2",children:[a.jsx("div",{className:"text-[11px] font-medium uppercase text-muted-foreground",children:e}),a.jsx("div",{className:"mt-1 font-mono text-sm font-semibold",children:nr(t)})]})}function Jz({report:e,loading:t,error:n,hasEvidence:r}){const{copied:o,copy:s}=Xt(e?.markdown??null);return e===null&&!t&&n===void 0?null:t?a.jsxs("div",{className:"flex items-center gap-2 rounded-md border border-border bg-muted/20 px-3 py-2 text-xs text-muted-foreground",children:[a.jsx(Wt,{className:"size-3.5 animate-spin"}),"Loading evidence report..."]}):n!==void 0&&r?a.jsxs("div",{className:"rounded-md border border-red-200 bg-red-50 px-3 py-2 text-xs text-red-700",children:["Failed to load evidence report: ",n.message]}):e===null?null:a.jsxs("div",{className:"rounded-md border border-border bg-muted/20 px-3 py-2",children:[a.jsxs("div",{className:"flex min-w-0 items-center justify-between gap-2",children:[a.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[a.jsx("span",{className:"text-xs font-semibold",children:"Evidence report"}),a.jsx(st,{variant:"outline",className:Dz(e.status),children:e.status})]}),a.jsx(Ae,{type:"button",variant:"ghost",size:"icon",className:"size-7 shrink-0","aria-label":o?"Copied evidence report":"Copy evidence report",onClick:s,children:o?a.jsx(rt,{className:"size-3.5 text-emerald-500"}):a.jsx(_t,{className:"size-3.5"})})]}),a.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:e.summary})]})}function Yz({evidence:e}){return e===null?a.jsx("div",{className:"rounded-md border border-dashed border-border px-3 py-2 text-xs text-muted-foreground",children:"No evidence pack exported yet."}):a.jsxs("div",{className:"space-y-2 rounded-md border border-border bg-muted/20 px-3 py-2",children:[a.jsxs("div",{className:"flex items-center justify-between gap-2",children:[a.jsx("span",{className:"text-xs font-semibold",children:"Evidence paths"}),a.jsx("span",{className:"text-[11px] text-muted-foreground",children:Fl(e.exportedAt)})]}),a.jsxs("div",{className:"grid gap-2",children:[a.jsx(wi,{label:"JSON",value:e.jsonPath}),a.jsx(wi,{label:"Markdown",value:e.markdownPath}),a.jsx(wi,{label:"HTML",value:e.htmlPath})]})]})}function wi({label:e,value:t}){const{copied:n,copy:r}=Xt(t);return a.jsxs("div",{className:"flex min-w-0 items-center gap-2 rounded-md border border-border bg-background px-2 py-1.5",children:[a.jsx("span",{className:"w-16 shrink-0 text-[11px] font-medium text-muted-foreground",children:e}),a.jsx("code",{className:"min-w-0 flex-1 truncate font-mono text-xs",children:t}),a.jsx(Ae,{type:"button",variant:"ghost",size:"icon",className:"size-7 shrink-0","aria-label":n?`Copied ${e} path`:`Copy ${e} path`,onClick:r,children:n?a.jsx(rt,{className:"size-3.5 text-emerald-500"}):a.jsx(_t,{className:"size-3.5"})})]})}function Xz({rows:e}){return e.length===0?a.jsx("div",{className:"rounded-md border border-dashed border-border px-3 py-8 text-center text-xs text-muted-foreground",children:"No sessions attached."}):a.jsxs("div",{className:"overflow-hidden rounded-md border border-border",children:[a.jsx("div",{className:"border-b border-border bg-muted/30 px-3 py-2 text-xs font-semibold",children:"Members"}),a.jsx("div",{className:"overflow-x-auto",children:a.jsxs("table",{className:"w-full min-w-[760px] text-left text-xs",children:[a.jsx("thead",{className:"border-b border-border bg-muted/20 text-muted-foreground",children:a.jsxs("tr",{children:[a.jsx("th",{className:"px-3 py-2 font-medium",children:"Session"}),a.jsx("th",{className:"px-3 py-2 font-medium",children:"Provider / Model"}),a.jsx("th",{className:"px-3 py-2 font-medium",children:"Status"}),a.jsx("th",{className:"px-3 py-2 font-medium",children:"Requests"}),a.jsx("th",{className:"px-3 py-2 font-medium",children:"Errors"}),a.jsx("th",{className:"px-3 py-2 font-medium",children:"First chunk"}),a.jsx("th",{className:"px-3 py-2 font-medium",children:"Tokens"})]})}),a.jsx("tbody",{children:e.map(t=>a.jsx(Qz,{row:t},t.member.id))})]})})]})}function Qz({row:e}){const t=e.member,n=e.exportMember?.session??null,r=Uz(e),o=n?.inspectorPath??Pd(t.sessionId),s=n?.requestCount??null,i=n?.errorCount??null,l=n?.tokenUsage.total??null,c=r?.firstChunkMs??null;return a.jsxs("tr",{className:"border-b border-border last:border-0",children:[a.jsxs("td",{className:"max-w-56 px-3 py-2",children:[a.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[a.jsx("a",{href:o,target:"_blank",rel:"noreferrer",className:"min-w-0 truncate font-mono text-xs text-primary hover:underline",children:Bg(t.label,t.sessionId)}),a.jsx(Pa,{className:"size-3 shrink-0 text-muted-foreground"})]}),a.jsx("div",{className:"mt-0.5 truncate text-[11px] text-muted-foreground",children:$g(t.agent)})]}),a.jsx("td",{className:"max-w-52 px-3 py-2",children:a.jsx("span",{className:"block truncate",children:$z(t)})}),a.jsx("td",{className:"px-3 py-2",children:a.jsx(st,{variant:"outline",className:Ll(t.status),children:Dl(t.status)})}),a.jsx("td",{className:"px-3 py-2 font-mono",children:s===null?"-":nr(s)}),a.jsx("td",{className:"px-3 py-2 font-mono",children:i===null?"-":nr(i)}),a.jsx("td",{className:"px-3 py-2 font-mono",children:Fz(c)}),a.jsx("td",{className:"px-3 py-2 font-mono",children:l===null?"-":nr(l)})]})}function eR(){return a.jsxs("svg",{fill:"currentColor",fillRule:"evenodd",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",className:"size-6 shrink-0",children:[a.jsx("title",{children:"Claude Code"}),a.jsx("path",{clipRule:"evenodd",d:"M20.998 10.949H24v3.102h-3v3.028h-1.487V20H18v-2.921h-1.487V20H15v-2.921H9V20H7.488v-2.921H6V20H4.487v-2.921H3V14.05H0V10.95h3V5h17.998v5.949zM6 10.949h1.488V8.102H6v2.847zm10.51 0H18V8.102h-1.49v2.847z"})]})}function tR(){return a.jsxs("svg",{fill:"currentColor",fillRule:"evenodd",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",className:"size-6 shrink-0",children:[a.jsx("title",{children:"OpenCode"}),a.jsx("path",{d:"M16 6H8v12h8V6zm4 16H4V2h16v20z"})]})}function nR(){return a.jsxs("svg",{fill:"currentColor",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",className:"size-6 shrink-0",children:[a.jsx("title",{children:"MiMo Code"}),a.jsx("text",{x:"12",y:"18",textAnchor:"middle",fontSize:"16",fontWeight:"800",fontFamily:"system-ui, sans-serif",children:"M"})]})}const rR=te({name:A(),apiKey:A(),format:Re(["anthropic","openai"]),anthropicBaseUrl:A(),openaiBaseUrl:A(),models:we(A()),sourceTool:Re(["claude-code","opencode","mimo-code"]),alreadyExists:Ze()}),oR=te({providers:we(rR),warnings:we(A()).optional()}),sR=te({success:Ze().optional(),imported:ie().optional(),message:A().optional(),errors:we(A()).optional()}),iR={"claude-code":eR,opencode:tR,"mimo-code":nR};function aR({open:e,onOpenChange:t,onImportComplete:n}){const[r,o]=x.useState(!1),[s,i]=x.useState(null),[l,c]=x.useState([]),[u,d]=x.useState([]),[f,h]=x.useState(new Set),[p,y]=x.useState(!1),[m,g]=x.useState(null),[b,v]=x.useState(null),k=x.useCallback(()=>{o(!0),i(null),d([]),c([]),h(new Set),g(null),v(null),fetch("/api/providers/scan").then(E=>E.ok?E.json().then(T=>{const z=oR.safeParse(T);if(!z.success){i(`Invalid response: ${z.error.message}`);return}c(z.data.providers),d(z.data.warnings??[]);const O=new Set;z.data.providers.forEach((B,N)=>{B.alreadyExists||O.add(N)}),h(O)}):E.text().then(T=>{i(`Scan failed (${E.status}): ${T}`)})).catch(E=>{i(E instanceof Error?E.message:String(E))}).finally(()=>{o(!1)})},[]);x.useEffect(()=>{e&&k()},[e,k]);const S=x.useCallback(E=>{h(T=>{const z=new Set(T);return z.has(E)?z.delete(E):z.add(E),z})},[]),C=x.useCallback(()=>{const E=l.filter((O,B)=>f.has(B));if(E.length===0)return;y(!0),v(null),g(null);const T=new Date().toISOString(),z=E.map(O=>({id:window.crypto.randomUUID(),name:O.name,apiKey:O.apiKey,format:O.format,anthropicBaseUrl:O.anthropicBaseUrl,openaiBaseUrl:O.openaiBaseUrl,models:O.models,createdAt:T,updatedAt:T}));fetch("/api/providers/import",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({providers:z})}).then(O=>O.json()).then(O=>{const B=sR.safeParse(O);if(!B.success){v(`Invalid response: ${B.error.message}`);return}const N=B.data;c(D=>D.map((w,L)=>f.has(L)?{...w,alreadyExists:!0}:w)),h(new Set),N.errors!==void 0&&N.errors.length>0&&N.message!==void 0?g(N.message):g(`Imported ${N.imported??E.length} provider(s)`),n()}).catch(O=>{v(O instanceof Error?O.message:String(O))}).finally(()=>{y(!1)})},[l,f,n]),j=l.some(E=>!E.alreadyExists);return a.jsx(zs,{open:e,onOpenChange:t,children:a.jsxs(Rs,{className:"max-w-xl max-h-[80vh] overflow-hidden flex flex-col",children:[a.jsxs(Ps,{children:[a.jsx(Os,{children:"Import from External Tools"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"Detect provider configurations from Claude Code, OpenCode, and MiMo Code."})]}),a.jsxs("div",{className:"flex-1 overflow-y-auto space-y-3",children:[r&&a.jsxs("div",{className:"flex items-center justify-center py-8 gap-2 text-muted-foreground",children:[a.jsx(Wt,{className:"size-4 animate-spin"}),a.jsx("span",{className:"text-sm",children:"Scanning for external providers..."})]}),s!==null&&a.jsxs("div",{className:"flex items-center gap-2 text-destructive text-sm py-4",children:[a.jsx(Dr,{className:"size-4"}),s]}),!r&&s===null&&l.length===0&&a.jsxs("p",{className:"text-sm text-muted-foreground py-8 text-center",children:["No external provider configurations found.",a.jsx("br",{}),a.jsx("span",{className:"text-xs",children:"Supported tools: Claude Code (~/.claude/settings.json), OpenCode (~/.config/opencode/opencode.json), MiMo Code (~/.config/mimocode/mimocode.jsonc)"})]}),!r&&l.map((E,T)=>a.jsxs("label",{className:`flex items-start gap-3 p-3 border rounded-md ${E.alreadyExists?"":"cursor-pointer hover:bg-muted/50"}`,children:[!E.alreadyExists&&a.jsx("input",{type:"checkbox",checked:f.has(T),disabled:p,onChange:()=>S(T),className:"mt-0.5 size-4"}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[(()=>{const z=iR[E.sourceTool];return z===void 0?null:a.jsx(z,{})})(),E.alreadyExists&&a.jsx("span",{className:"text-[10px] text-muted-foreground",children:"Already added"})]}),a.jsxs("div",{className:"text-xs text-muted-foreground mt-1 truncate",children:[E.models.slice(0,4).join(", "),E.models.length>4?` +${E.models.length-4} more`:""]}),a.jsx("div",{className:"text-xs text-muted-foreground mt-0.5 truncate",children:E.format==="anthropic"?E.anthropicBaseUrl:E.openaiBaseUrl}),a.jsx("div",{className:"text-xs text-muted-foreground mt-0.5 font-mono",children:E.apiKey.length>8?`${E.apiKey.slice(0,4)}••••${E.apiKey.slice(-4)}`:"••••"})]})]},`${E.sourceTool}-${E.name}`)),u.length>0&&a.jsx("div",{className:"text-xs text-muted-foreground space-y-1 border-t pt-2",children:u.map((E,T)=>a.jsxs("div",{className:"flex items-center gap-1",children:[a.jsx(Dr,{className:"size-3"}),E]},T))}),m!==null&&a.jsx("div",{className:"text-sm text-green-500 border-t pt-2",children:m}),b!==null&&a.jsx("div",{className:"text-sm text-destructive border-t pt-2",children:b})]}),a.jsxs("div",{className:"flex items-center justify-between pt-3 border-t",children:[a.jsxs(Ae,{variant:"outline",size:"sm",onClick:k,disabled:r,children:[a.jsx(Wt,{className:`size-3 mr-1 ${r?"animate-spin":""}`}),"Rescan"]}),a.jsxs(Ae,{size:"sm",onClick:C,disabled:!j||f.size===0||p,children:[a.jsx(ds,{className:"size-3 mr-1"}),p?"Importing...":`Import Selected (${f.size})`]})]})]})})}function Ug(e){return e.length<=8?"••••••••":e.slice(0,4)+"••••••••"+e.slice(-4)}const Wg=te({id:A().min(1),aliases:we(A()).optional().default([]),contextWindow:ie().int().positive().optional(),outputLimit:ie().int().positive().optional(),sourceUrl:A().optional()}),lR=te({name:A().min(1).optional(),aliases:we(A()).optional().default([]),baseUrls:we(A()).optional().default([]),models:we(Wg).min(1)});te({version:ie().int().positive().optional(),updatedAt:A().optional(),providers:we(lR).optional().default([]),models:we(Wg).optional().default([])});function Qu(e){return e.trim().toLowerCase().replace(/\s+/g,"-")}function cR(e){const t=e.models.filter(n=>n.trim()!=="");return t.length>0?t:e.model!==void 0&&e.model.trim()!==""?[e.model]:[]}function $l(e,t){const n=Qu(t);return(e.modelMetadata??[]).find(o=>Qu(o.model)===n)??null}function uR(e){const t=cR(e);return t.length===0?!1:t.every(n=>{const r=$l(e,n);return r!==null&&r.contextWindow!==void 0})}function dR(e,t){if(e===null)return null;for(const n of t){const r=$l(n,e);if(r!==null&&r.contextWindow!==void 0)return{providerName:n.name,model:r.model,tokens:r.contextWindow,sourceUrl:r.sourceUrl}}return null}const fR={deepseek:"https://api-docs.deepseek.com/zh-cn/"};function pR(e){return Object.prototype.hasOwnProperty.call(e,"success")}function hR(e){return Object.prototype.hasOwnProperty.call(e,"notConfigured")}function xt(e){return e!==void 0&&e.trim()!==""}function ma(e){if(e===void 0)return;const t=Object.entries(e).map(([n,r])=>`${n}: ${r}`);if(t.length!==0)return t.join(`
|
|
115
|
+
`)}function ed(e){return ma(e)!==void 0}function td(e){return e<1e3?`${e}ms`:`${(e/1e3).toFixed(1)}s`}function mR(e){return e>=10?`${e.toFixed(0)}/s`:`${e.toFixed(1)}/s`}function gR(e){const t=e.debug;return xt(e.error?.hint)||xt(e.error?.details)||xt(e.rawResponse)||xt(t?.requestUrl)||xt(t?.requestBody)||xt(t?.responseBody)||ed(t?.requestHeaders)||ed(t?.responseHeaders)||t?.responseStatus!==void 0}function un({title:e,children:t}){return a.jsxs("div",{className:"space-y-1",children:[a.jsx("div",{className:"font-medium text-foreground/80",children:e}),t]})}function jr({value:e}){return a.jsx("pre",{className:"max-h-40 overflow-auto whitespace-pre-wrap break-all rounded-md bg-background/80 p-2 font-mono text-[11px] leading-relaxed text-foreground/80",children:e})}function xR({result:e}){const t=e.debug,n=t?.requestUrl,r=t?.requestMethod??"POST",o=ma(t?.requestHeaders),s=ma(t?.responseHeaders),i=t?.responseStatus!==void 0?`${t.responseStatus}${xt(t.responseStatusText)?` ${t.responseStatusText}`:""}`:void 0,l=t?.responseBody??e.rawResponse;return a.jsxs("div",{className:"max-h-80 max-w-full space-y-2 overflow-auto rounded-md border bg-muted/50 p-2 text-xs text-muted-foreground shadow-sm sm:w-[520px]",children:[xt(e.error?.hint)&&a.jsx(un,{title:"Hint",children:a.jsx("div",{children:e.error.hint})}),xt(e.error?.details)&&a.jsx(un,{title:"Error",children:a.jsx(jr,{value:e.error.details})}),xt(n)&&a.jsx(un,{title:"Request",children:a.jsxs("div",{className:"rounded-md bg-background/80 p-2 font-mono text-[11px] break-all text-foreground/80",children:[r," ",n]})}),o!==void 0&&a.jsx(un,{title:"Request Headers",children:a.jsx(jr,{value:o})}),xt(t?.requestBody)&&a.jsx(un,{title:"Request Body",children:a.jsx(jr,{value:t.requestBody})}),xt(i)&&a.jsx(un,{title:"Response Status",children:a.jsx("div",{className:"rounded-md bg-background/80 p-2 font-mono text-[11px] text-foreground/80",children:i})}),s!==void 0&&a.jsx(un,{title:"Response Headers",children:a.jsx(jr,{value:s})}),xt(l)&&a.jsx(un,{title:"Response Body",children:a.jsx(jr,{value:l})})]})}function wo({results:e}){return a.jsxs("div",{className:"flex min-w-0 flex-col gap-2",children:[a.jsxs("div",{className:"flex min-w-0 flex-col gap-1",children:[a.jsx("span",{className:"text-[10px] text-muted-foreground",children:"Non-stream"}),a.jsx(nd,{result:e.nonStreaming})]}),a.jsxs("div",{className:"flex min-w-0 flex-col gap-1",children:[a.jsx("span",{className:"text-[10px] text-muted-foreground",children:"Stream"}),a.jsx(nd,{result:e.streaming})]})]})}function bR(e){const t={className:"size-3",strokeWidth:2};switch(e){case"timeout":return a.jsx(hn,{...t});case"network_unreachable":return a.jsx(yw,{...t});case"connection_refused":return a.jsx(ww,{...t});case"auth_failed":return a.jsx(L2,{...t});case"rate_limited":return a.jsx(Af,{...t});case"server_error":return a.jsx(aw,{...t});case"invalid_response":return a.jsx(n2,{...t});case"unknown":return a.jsx(Dr,{...t});default:return a.jsx(Dr,{...t})}}function nd({result:e}){const[t,n]=x.useState(!1);if(!pR(e))return hR(e)?a.jsxs("div",{className:"flex items-center gap-1 text-xs text-muted-foreground shrink-0",children:[a.jsx($2,{className:"size-3"}),a.jsx("span",{children:"Not configured"})]}):a.jsxs("div",{className:"flex items-center gap-1 text-xs text-muted-foreground shrink-0",children:[a.jsx(Oi,{className:"size-3 animate-spin"}),a.jsx("span",{children:"Testing..."})]});if(e.success){const l=[],c=[];e.inputTokens!==void 0&&l.push(a.jsxs("span",{children:[e.inputTokens," in"]},"in")),e.outputTokens!==void 0&&l.push(a.jsxs("span",{children:[e.outputTokens," out"]},"out")),e.cacheCreationInputTokens!==void 0&&e.cacheCreationInputTokens>0&&l.push(a.jsxs("span",{className:"font-mono tabular-nums text-emerald-400",children:["KV Cache +",e.cacheCreationInputTokens]},"cache-create")),e.cacheReadInputTokens!==void 0&&e.cacheReadInputTokens>0&&l.push(a.jsxs("span",{className:"font-mono tabular-nums text-purple-400",children:["KV Cache ~",e.cacheReadInputTokens]},"cache-read")),e.firstChunkMs!==void 0&&e.firstChunkMs!==null&&c.push(a.jsxs("span",{children:["first ",td(e.firstChunkMs)]},"first")),e.totalStreamMs!==void 0&&e.totalStreamMs!==null&&c.push(a.jsxs("span",{children:["total ",td(e.totalStreamMs)]},"total")),e.tokensPerSecond!==void 0&&e.tokensPerSecond!==null&&e.tokensPerSecond>0&&c.push(a.jsxs("span",{children:[mR(e.tokensPerSecond)," tok/s"]},"rate"));const u=[];for(let f=0;f<l.length;f++)f>0&&u.push(", "),u.push(l[f]);const d=[];for(let f=0;f<c.length;f++)f>0&&d.push(", "),d.push(c[f]);return a.jsx(tt,{children:a.jsxs(Fe,{children:[a.jsx($e,{asChild:!0,children:a.jsxs("div",{className:"flex items-center gap-1 text-xs text-green-600 shrink-0",children:[a.jsx(Qv,{className:"size-3"}),a.jsx("span",{children:"Connected"}),l.length>0&&a.jsxs("span",{className:"text-muted-foreground",children:["(",u,")"]}),c.length>0&&a.jsxs("span",{className:"hidden text-muted-foreground lg:inline",children:["(",d,")"]})]})}),a.jsx(Be,{children:"Connection test passed"})]})})}const r=e.error,o=r?.message??"Connection failed",s=r?.type??"unknown",i=gR(e);return a.jsxs("div",{className:"flex flex-col gap-1 shrink-0",children:[a.jsxs("div",{className:"flex items-center gap-1 text-xs text-red-600 max-w-[200px]",children:[bR(s),a.jsx(tt,{children:a.jsxs(Fe,{children:[a.jsx($e,{asChild:!0,children:a.jsx("span",{className:"truncate",children:o})}),a.jsx(Be,{children:"Connection test failed"})]})}),i&&a.jsxs("button",{type:"button",onClick:()=>n(l=>!l),"aria-expanded":t,"aria-label":t?"Hide provider test diagnostics":"Show provider test diagnostics",className:"inline-flex h-5 shrink-0 items-center gap-1 rounded border border-border/70 bg-background/70 px-1.5 text-[10px] text-muted-foreground transition-colors hover:text-foreground",children:[t?a.jsx(Oa,{className:"size-3"}):a.jsx(Ma,{className:"size-3"}),a.jsx("span",{children:t?"Hide":"Details"})]})]}),t&&i&&a.jsx(xR,{result:e})]})}function yR(e){const t=Date.now(),n=new Date(e).getTime(),r=t-n,o=Math.floor(r/1e3);if(o<60)return"just now";const s=Math.floor(o/60);if(s<60)return`${s}m ago`;const i=Math.floor(s/60);return i<24?`${i}h ago`:`${Math.floor(i/24)}d ago`}function vR(e){if(e===void 0||e.trim()==="")return null;try{const t=new URL(e);if(t.protocol!=="https:"&&t.protocol!=="http:")return null;const n=t.hostname.toLowerCase(),r=n==="huggingface.co"||n.endsWith(".huggingface.co");return{label:r?"HF":"Source",title:r?"Open Hugging Face model source":"Open model metadata source",url:e}}catch{return null}}function wR({provider:e,testResults:t,isTesting:n,testingTimeLeft:r,isHighlighted:o,onEdit:s,onDelete:i,onTest:l,onRefreshMetadata:c,isRefreshingMetadata:u=!1}){const[d,f]=x.useState(!1),[h,p]=x.useState(!1),[y,m]=x.useState(!1);function g(){navigator.clipboard.writeText(e.apiKey).catch(()=>{}),p(!0),setTimeout(()=>p(!1),2e3)}const b=e.apiDocsUrl??Object.entries(fR).find(([C])=>e.name.toLowerCase().includes(C))?.[1],v=uR(e),k=e.modelMetadataUrl!==void 0&&e.modelMetadataUrl.trim()!=="",S=k?"Refresh":"Import defaults";return a.jsxs("div",{className:`border rounded-lg p-4 flex flex-col gap-3 bg-card transition-all duration-500 ${o===!0?"ring-2 ring-primary shadow-md":""}`,children:[a.jsxs("div",{className:"flex items-start justify-between gap-2",children:[a.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[a.jsx("span",{className:"font-medium truncate",children:e.name}),e.source==="company"&&a.jsx(tt,{children:a.jsxs(Fe,{children:[a.jsx($e,{asChild:!0,children:a.jsx("span",{className:"text-xs px-1.5 py-0.5 rounded bg-blue-100 text-blue-700 dark:bg-blue-900/30 dark:text-blue-400 shrink-0",children:"公司"})}),a.jsx(Be,{children:"Company-provided API key"})]})}),e.source==="personal"&&a.jsx(tt,{children:a.jsxs(Fe,{children:[a.jsx($e,{asChild:!0,children:a.jsx("span",{className:"text-xs px-1.5 py-0.5 rounded bg-green-100 text-green-700 dark:bg-green-900/30 dark:text-green-400 shrink-0",children:"个人"})}),a.jsx(Be,{children:"Your personal API key"})]})})]}),b!==void 0&&a.jsxs("a",{href:b,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:[a.jsx(Pa,{className:"size-3"}),a.jsx("span",{className:"sr-only",children:"Docs"})]})]}),e.models!==void 0&&e.models.length>0&&a.jsx("div",{className:"flex flex-wrap gap-1",children:e.models.map(C=>{const j=$l(e,C),E=vR(j?.sourceUrl);return a.jsxs("span",{className:"inline-flex items-center gap-1 text-xs px-1.5 py-0.5 rounded bg-muted text-muted-foreground",children:[a.jsx("span",{children:C}),j!==null&&j.contextWindow!==void 0&&a.jsx("span",{className:"font-mono text-foreground/80",children:Gf(j.contextWindow)}),E!==null&&a.jsx(tt,{children:a.jsxs(Fe,{children:[a.jsx($e,{asChild:!0,children:a.jsx("a",{href:E.url,target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-0.5 rounded border border-border/70 bg-background/70 px-1 font-mono text-[10px] leading-4 text-muted-foreground transition-colors hover:text-foreground","aria-label":E.title,children:E.label})}),a.jsx(Be,{children:E.title})]})})]},C)})}),!v&&a.jsxs("div",{className:"flex items-center justify-between gap-2 rounded-md border border-amber-500/25 bg-amber-500/6 px-2 py-1.5 text-xs text-muted-foreground",children:[a.jsx("span",{children:"Context window metadata missing"}),a.jsxs("div",{className:"flex shrink-0 items-center gap-1",children:[a.jsxs(Ae,{type:"button",variant:"outline",size:"sm",onClick:()=>c?.(e.id),className:"h-6 gap-1 px-2 text-xs",disabled:u,children:[a.jsx(Oi,{className:`size-3 ${u?"animate-spin":""}`}),S]}),!k&&a.jsx(Ae,{type:"button",variant:"ghost",size:"sm",onClick:()=>s(e),className:"h-6 px-2 text-xs",children:"Set URL"})]})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("code",{className:"text-xs text-muted-foreground bg-muted px-2 py-1 rounded flex-1 truncate",children:d?e.apiKey:Ug(e.apiKey)}),a.jsx("button",{type:"button",onClick:()=>f(C=>!C),className:"text-muted-foreground hover:text-foreground transition-colors p-1","aria-label":d?"Hide API key":"Show API key",children:d?a.jsx(Oa,{className:"size-4"}):a.jsx(Ma,{className:"size-4"})}),a.jsx("button",{type:"button",onClick:g,className:"text-muted-foreground hover:text-foreground transition-colors p-1","aria-label":"Copy API key",children:h?a.jsx(rt,{className:"size-4 text-green-500"}):a.jsx(_t,{className:"size-4"})})]}),e.anthropicBaseUrl!==void 0&&e.anthropicBaseUrl!==""&&a.jsxs("div",{className:"flex min-w-0 flex-col gap-2",children:[a.jsxs("div",{className:"min-w-0 text-xs text-muted-foreground",children:[a.jsx("span",{className:"font-medium",children:"Anthropic:"})," ",a.jsx("span",{className:"truncate",children:e.anthropicBaseUrl})]}),t!==void 0&&a.jsx(wo,{results:t.anthropic})]}),e.openaiBaseUrl!==void 0&&e.openaiBaseUrl!==""&&a.jsxs("div",{className:"flex min-w-0 flex-col gap-2",children:[a.jsxs("div",{className:"min-w-0 text-xs text-muted-foreground",children:[a.jsx("span",{className:"font-medium",children:"OpenAI:"})," ",a.jsx("span",{className:"truncate",children:e.openaiBaseUrl})]}),t!==void 0&&a.jsx(wo,{results:t.openai})]}),t?.testedAt!==void 0&&a.jsxs("div",{className:"text-xs text-muted-foreground flex items-center gap-1",children:[a.jsx(hn,{className:"size-3"}),a.jsxs("span",{children:["Tested ",yR(t.testedAt)]})]}),t?.models!==void 0&&Object.keys(t.models).length>0&&a.jsxs("div",{className:"border-t pt-2",children:[a.jsxs("button",{type:"button",onClick:()=>m(C=>!C),className:"text-xs text-muted-foreground hover:text-foreground transition-colors flex items-center gap-1",children:[y?a.jsx(Zt,{className:"size-3"}):a.jsx(on,{className:"size-3"}),"Model Test Results (",Object.keys(t.models).length,")"]}),y&&a.jsx("div",{className:"mt-2 overflow-x-auto",children:a.jsxs("table",{className:"w-full text-xs border-collapse",children:[a.jsx("thead",{children:a.jsxs("tr",{className:"border-b border-border",children:[a.jsx("th",{className:"text-left py-1 px-2 font-medium text-muted-foreground",children:"Model"}),e.anthropicBaseUrl!==void 0&&e.anthropicBaseUrl!==""&&a.jsx("th",{className:"text-left py-1 px-2 font-medium text-muted-foreground",children:"Anthropic"}),e.openaiBaseUrl!==void 0&&e.openaiBaseUrl!==""&&a.jsx("th",{className:"text-left py-1 px-2 font-medium text-muted-foreground",children:"OpenAI"})]})}),a.jsx("tbody",{children:Object.entries(t.models).map(([C,j])=>a.jsxs("tr",{className:"border-b border-border/50 last:border-0",children:[a.jsx("td",{className:"py-1 px-2 font-medium",children:C}),e.anthropicBaseUrl!==void 0&&e.anthropicBaseUrl!==""&&a.jsx("td",{className:"py-1 px-2 align-top",children:a.jsx(wo,{results:j.anthropic})}),e.openaiBaseUrl!==void 0&&e.openaiBaseUrl!==""&&a.jsx("td",{className:"py-1 px-2 align-top",children:a.jsx(wo,{results:j.openai})})]},C))})]})})]}),a.jsxs("div",{className:"flex gap-2 pt-1 border-t",children:[l!==void 0&&a.jsxs(Ae,{variant:"outline",size:"sm",onClick:()=>l(e.id),className:"text-xs h-7 gap-1",disabled:n??!1,children:[a.jsx(Oi,{className:`size-3 ${n??!1?"animate-spin":""}`}),n??!1?r!==void 0?`Testing (${r}s)`:"Testing...":"Test"]}),a.jsxs(Ae,{variant:"outline",size:"sm",onClick:()=>s(e),className:"text-xs h-7 gap-1",disabled:n??!1,children:[a.jsx(zf,{className:"size-3"}),"Edit"]}),a.jsxs(Ae,{variant:"outline",size:"sm",onClick:()=>i(e.id),className:"text-xs h-7 gap-1 text-destructive hover:text-destructive",disabled:n??!1,children:[a.jsx(sr,{className:"size-3"}),"Delete"]})]})]})}const rd=["zhipu","zhipuai","bigmodel","z.ai","zai","glm"],od=["zhipu coding","glm coding","bigmodel coding","z.ai coding","zai coding"],kR={deepseek:{openaiBaseUrl:"https://api.deepseek.com"},minimax:{anthropicBaseUrl:"https://api.minimaxi.com/anthropic",apiDocsUrl:"https://platform.minimaxi.com/docs/api-reference/api-overview"},"zhipu coding":{anthropicBaseUrl:"https://open.bigmodel.cn/api/anthropic",openaiBaseUrl:"https://open.bigmodel.cn/api/coding/paas/v4",apiDocsUrl:"https://docs.bigmodel.cn/cn/coding-plan/quick-start"},"glm coding":{anthropicBaseUrl:"https://open.bigmodel.cn/api/anthropic",openaiBaseUrl:"https://open.bigmodel.cn/api/coding/paas/v4",apiDocsUrl:"https://docs.bigmodel.cn/cn/coding-plan/quick-start"},"bigmodel coding":{anthropicBaseUrl:"https://open.bigmodel.cn/api/anthropic",openaiBaseUrl:"https://open.bigmodel.cn/api/coding/paas/v4",apiDocsUrl:"https://docs.bigmodel.cn/cn/coding-plan/quick-start"},"z.ai coding":{anthropicBaseUrl:"https://open.bigmodel.cn/api/anthropic",openaiBaseUrl:"https://open.bigmodel.cn/api/coding/paas/v4",apiDocsUrl:"https://docs.bigmodel.cn/cn/coding-plan/quick-start"},"zai coding":{anthropicBaseUrl:"https://open.bigmodel.cn/api/anthropic",openaiBaseUrl:"https://open.bigmodel.cn/api/coding/paas/v4",apiDocsUrl:"https://docs.bigmodel.cn/cn/coding-plan/quick-start"},zhipu:{openaiBaseUrl:"https://open.bigmodel.cn/api/paas/v4",apiDocsUrl:"https://docs.bigmodel.cn/cn/guide/develop/openai/introduction"},zhipuai:{openaiBaseUrl:"https://open.bigmodel.cn/api/paas/v4",apiDocsUrl:"https://docs.bigmodel.cn/cn/guide/develop/openai/introduction"},bigmodel:{openaiBaseUrl:"https://open.bigmodel.cn/api/paas/v4",apiDocsUrl:"https://docs.bigmodel.cn/cn/guide/develop/openai/introduction"},"z.ai":{openaiBaseUrl:"https://open.bigmodel.cn/api/paas/v4",apiDocsUrl:"https://docs.bigmodel.cn/cn/guide/develop/openai/introduction"},zai:{openaiBaseUrl:"https://open.bigmodel.cn/api/paas/v4",apiDocsUrl:"https://docs.bigmodel.cn/cn/guide/develop/openai/introduction"},glm:{openaiBaseUrl:"https://open.bigmodel.cn/api/paas/v4",apiDocsUrl:"https://docs.bigmodel.cn/cn/guide/develop/openai/introduction"},alibaba:{openaiBaseUrl:"https://dashscope.aliyuncs.com/compatible-mode"}},sd=["MiniMax M3","MiniMax M2.7","MiniMax M2.7-highspeed","MiniMax M2.5","MiniMax M2.5-highspeed","MiniMax M2.1","MiniMax M2.1-highspeed","MiniMax M2"],id=["glm-5","glm-5.1","glm-5.2","qwen3.6-plus","qwen3.7-max"],ad=["glm-5.2","glm-5.1","glm-5","glm-5-turbo","glm-4.7","glm-4.7-flashx","glm-4.6","glm-4.5","glm-4.5-air","glm-4.5-x","glm-4.5-airx","glm-4.5-flash"],ga="__unset__",rs="__custom__",Vg=[{value:"32K",label:"Small"},{value:"64K",label:"Standard"},{value:"128K",label:"Medium"},{value:"200K",label:"Long"},{value:"256K",label:"Extended"},{value:"512K",label:"Large"},{value:"1M",label:"Max"}];function Sn(){return{contextWindow:"",contextWindowMode:"unset",outputLimit:""}}function ld(e){return e.trim().toLowerCase().replace(/\s+/g,"-")}function Hg(e,t){const n=ld(t);return e?.modelMetadata?.find(r=>ld(r.model)===n)??null}function Zg(e){const t=Fo(e);if(t===null)return null;for(const n of Vg)if(Fo(n.value)===t)return n.value;return null}function _R(e){return e.trim()===""?"unset":Zg(e)!==null?"preset":"custom"}function SR(e){switch(e.contextWindowMode){case"unset":return ga;case"custom":return rs;case"preset":return Zg(e.contextWindow)??rs}}function ki(e){const t=e.trim().replaceAll(",","");if(t==="")return{amount:"",unit:"K"};const n=/^(\d+(?:\.\d+)?)\s*([kKmM])?$/.exec(t);if(n===null)return{amount:t,unit:"K"};const r=n[1];if(r===void 0)return{amount:t,unit:"K"};const o=n[2];if(o===void 0||o==="")return{amount:r,unit:"tokens"};switch(o.toLowerCase()){case"k":return{amount:r,unit:"K"};case"m":return{amount:r,unit:"M"};default:return{amount:t,unit:"K"}}}function cd(e,t){const n=e.trim();if(n==="")return"";switch(t){case"K":return`${n}K`;case"M":return`${n}M`;case"tokens":return n}}function ud(e,t){return t.map(n=>{const r=Hg(e,n),o=r?.contextWindow!==void 0?Ak(r.contextWindow):"";return{contextWindow:o,contextWindowMode:_R(o),outputLimit:r?.outputLimit?.toString()??""}})}function dd(e){const t=e.trim();if(t==="")return null;const n=Number(t);return!Number.isInteger(n)||n<=0?null:n}function CR({provider:e,onSubmit:t,onCancel:n}){const[r,o]=x.useState(e?.name??""),[s,i]=x.useState(e?.apiKey??""),[l,c]=x.useState(!1),[u,d]=x.useState(!1),f=e?.models,[h,p]=x.useState(f!==void 0&&f.length>0?f:[""]),[y,m]=x.useState(()=>ud(e,f!==void 0&&f.length>0?f:[""])),[g,b]=x.useState("anthropic"),[v,k]=x.useState(e?.anthropicBaseUrl??""),[S,C]=x.useState(e?.openaiBaseUrl??""),[j,E]=x.useState(e?.apiDocsUrl??""),[T,z]=x.useState(e?.modelMetadataUrl??""),[O,B]=x.useState(e?.source),[N,D]=x.useState({}),[w,L]=x.useState(!1),[W,U]=x.useState(null),F=x.useRef([]);x.useEffect(()=>{if(W===null)return;const Z=W;function J(V){if(!(V.target instanceof Node))return;const se=F.current[Z];se!=null&&!se.contains(V.target)&&U(null)}return document.addEventListener("mousedown",J),()=>document.removeEventListener("mousedown",J)},[W]);const[K,I]=x.useState(!1),[H,G]=x.useState(!1),R=r.toLowerCase().includes("minimax"),ae=r.toLowerCase().includes("alibaba"),re=[...rd,...od].some(Z=>r.toLowerCase().includes(Z)),fe=R?sd:re?ad:ae?id:[],le=e?.modelMetadata?.some(Z=>Z.contextWindow!==void 0)??!1;function de(){navigator.clipboard.writeText(s).catch(()=>{}),d(!0),setTimeout(()=>d(!1),2e3)}x.useEffect(()=>{if(e){o(e.name),i(e.apiKey);const Z=(e.models?.length??0)>0?e.models:[""];p(Z),m(ud(e,Z)),k(e.anthropicBaseUrl??""),C(e.openaiBaseUrl??""),E(e.apiDocsUrl??""),z(e.modelMetadataUrl??""),B(e.source),I(!1),G(!1)}},[e]),x.useEffect(()=>{const Z=r.toLowerCase();for(const[J,V]of Object.entries(kR))if(Z.includes(J)){V.anthropicBaseUrl!==void 0&&!K&&k(V.anthropicBaseUrl),V.openaiBaseUrl!==void 0&&!H&&C(V.openaiBaseUrl),V.apiDocsUrl!==void 0&&!j&&E(V.apiDocsUrl),J==="minimax"&&h.length===1&&h[0]===""&&p([sd[0]??""]),J==="alibaba"&&h.length===1&&h[0]===""&&p([id[0]??""]),(rd.includes(J)||od.includes(J))&&h.length===1&&h[0]===""&&p([ad[0]??""]);break}},[r]);function pe(){const Z={};return r.trim()||(Z.name="Name is required"),s.trim()||(Z.apiKey="API key is required"),(h.length===0||h.every(J=>!J.trim()))&&(Z.models="At least one model is required"),v.trim()&&!he(v.trim())&&(Z.anthropicBaseUrl="Invalid URL format"),S.trim()&&!he(S.trim())&&(Z.openaiBaseUrl="Invalid URL format"),T.trim()&&!he(T.trim())&&(Z.modelMetadataUrl="Invalid URL format"),y.forEach((J,V)=>{const se=Fo(J.contextWindow),Y=dd(J.outputLimit);J.contextWindow.trim()!==""&&se===null&&(Z[`modelMetadata.${V}.contextWindow`]="Context window must be a positive number, optionally using K or M"),J.outputLimit.trim()!==""&&Y===null&&(Z[`modelMetadata.${V}.outputLimit`]="Output limit must be a positive integer"),se!==null&&Y!==null&&Y>se&&(Z[`modelMetadata.${V}.outputLimit`]="Output limit should not exceed context window")}),!v.trim()&&!S.trim()&&(Z.format="At least one format URL (Anthropic or OpenAI) is required"),D(Z),Object.keys(Z).length===0}function he(Z){try{return new URL(Z),!0}catch{return!1}}function me(Z,J){p(V=>{const se=[...V];return se[Z]=J,se})}function _e(Z,J){m(V=>{const se=[...V];return se[Z]={...se[Z]??Sn(),...J},se})}function Pe(Z,J){switch(J){case ga:_e(Z,{contextWindow:"",contextWindowMode:"unset"});return;case rs:{const V=y[Z]??Sn();_e(Z,{contextWindow:V.contextWindow,contextWindowMode:"custom"});return}default:_e(Z,{contextWindow:J,contextWindowMode:"preset"});return}}function _(Z,J){const V=y[Z]??Sn(),se=ki(V.contextWindow);_e(Z,{contextWindow:cd(J,se.unit),contextWindowMode:"custom"})}function ne(Z,J){const V=y[Z]??Sn(),se=ki(V.contextWindow);switch(J){case"K":case"M":case"tokens":_e(Z,{contextWindow:cd(se.amount,J),contextWindowMode:"custom"});return;default:return}}function Q(Z){p(J=>J.filter((V,se)=>se!==Z)),m(J=>J.filter((V,se)=>se!==Z))}function M(){p(Z=>[...Z,""]),m(Z=>[...Z,Sn()])}function P(){const Z=new Date().toISOString(),J=[];return h.forEach((V,se)=>{const Y=V.trim();if(Y==="")return;const ee=y[se]??Sn(),$=Fo(ee.contextWindow),X=dd(ee.outputLimit);if($===null&&X===null)return;const ce=Hg(e,Y);if(ce!==null&&ce.contextWindow===($??void 0)&&ce.outputLimit===(X??void 0)){J.push({...ce,model:Y});return}const xe={model:Y,source:"manual",updatedAt:Z};$!==null&&(xe.contextWindow=$),X!==null&&(xe.outputLimit=X),J.push(xe)}),J.length>0?J:e?.modelMetadata!==void 0?[]:void 0}function q(Z){if(Z.preventDefault(),!!pe()){L(!0);try{t({name:r.trim(),apiKey:s.trim(),models:h.map(J=>J.trim()).filter(J=>J!==""),anthropicBaseUrl:v.trim()||void 0,openaiBaseUrl:S.trim()||void 0,apiDocsUrl:j.trim()||void 0,modelMetadataUrl:T.trim()||void 0,modelMetadata:P(),source:O})}finally{L(!1)}}}return a.jsxs("form",{onSubmit:q,className:"space-y-4",children:[a.jsxs("div",{className:"space-y-2",children:[a.jsxs("label",{htmlFor:"provider-name",className:"text-sm font-medium",children:["Name ",a.jsx("span",{className:"text-destructive",children:"*"})]}),a.jsx("input",{id:"provider-name",type:"text",value:r,onChange:Z=>o(Z.target.value),placeholder:"Provider 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"}),N.name!==void 0&&a.jsx("p",{className:"text-xs text-destructive",children:N.name})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx("label",{htmlFor:"provider-source",className:"text-sm font-medium",children:"Token Source"}),a.jsxs("select",{id:"provider-source",value:O??"",onChange:Z=>B(Z.target.value==="company"||Z.target.value==="personal"?Z.target.value:void 0),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:[a.jsx("option",{value:"",children:"—"}),a.jsx("option",{value:"personal",children:"个人 (Personal)"}),a.jsx("option",{value:"company",children:"公司 (Company)"})]}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"Label whether this API key is company-provided or personal."})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx("label",{htmlFor:"provider-model-metadata-url",className:"text-sm font-medium",children:"Model Metadata URL"}),a.jsx("input",{id:"provider-model-metadata-url",type:"text",value:T,onChange:Z=>z(Z.target.value),placeholder:"https://example.com/agent-inspector-models.json",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"}),N.modelMetadataUrl!==void 0&&a.jsx("p",{className:"text-xs text-destructive",children:N.modelMetadataUrl}),T.trim()===""&&a.jsx("div",{className:"rounded-md border border-border bg-muted/20 px-3 py-2 text-xs text-muted-foreground",children:"Built-in limits cover DeepSeek v4 pro/flash, MiniMax M3/M2.7/M2.5/M2.1, and GLM coding models. Use a registry URL for private or custom model limits."}),e!==void 0&&!le&&T.trim()===""&&a.jsx("p",{className:"text-xs text-amber-400",children:"This provider has no matching context metadata yet."}),T.trim()!==""&&a.jsx("p",{className:"text-xs text-muted-foreground",children:"Agent Inspector will refresh model limits from this JSON registry after save."})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsxs("label",{htmlFor:"provider-apikey",className:"text-sm font-medium",children:["API Key ",a.jsx("span",{className:"text-destructive",children:"*"})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("input",{id:"provider-apikey",type:"text",value:l||s.length===0?s:Ug(s),onChange:Z=>i(Z.target.value),onFocus:()=>{!l&&s.length>0&&c(!0)},placeholder:"sk-ant-...",readOnly:!l&&s.length>0,className:"flex-1 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"}),a.jsx("button",{type:"button",onClick:()=>c(Z=>!Z),className:"text-muted-foreground hover:text-foreground transition-colors p-1 shrink-0","aria-label":l?"Hide API key":"Show API key",children:l?a.jsx(Oa,{className:"size-4"}):a.jsx(Ma,{className:"size-4"})}),a.jsx("button",{type:"button",onClick:de,className:"text-muted-foreground hover:text-foreground transition-colors p-1 shrink-0","aria-label":"Copy API key",children:u?a.jsx(rt,{className:"size-4 text-green-500"}):a.jsx(_t,{className:"size-4"})})]}),N.apiKey!==void 0&&a.jsx("p",{className:"text-xs text-destructive",children:N.apiKey})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsxs("label",{className:"text-sm font-medium",children:["Models ",a.jsx("span",{className:"text-destructive",children:"*"})]}),h.map((Z,J)=>{const V=y[J]??Sn(),se=N[`modelMetadata.${J}.contextWindow`],Y=N[`modelMetadata.${J}.outputLimit`],ee=SR(V),$=ki(V.contextWindow);return a.jsxs("div",{ref:X=>{F.current[J]=X},className:"space-y-2 rounded-md border border-border bg-muted/10 p-2",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsxs("div",{className:"relative flex-1",children:[a.jsx("input",{type:"text",value:Z,onChange:X=>me(J,X.target.value),placeholder:fe.length>0?"Type or select a model...":"Model name",className:"w-full rounded-md border border-input bg-background px-4 py-3 pr-8 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"}),fe.length>0&&a.jsxs(a.Fragment,{children:[a.jsx("button",{type:"button",onClick:()=>U(W===J?null:J),className:"absolute right-1 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground transition-colors p-1 z-10","aria-label":"Show model suggestions",children:a.jsx(Zt,{className:"size-4"})}),W===J&&a.jsx("div",{className:"absolute left-0 right-0 top-full mt-1 z-50 bg-popover border border-border rounded-md shadow-md max-h-48 overflow-y-auto",children:fe.map(X=>a.jsx("button",{type:"button",onClick:()=>{me(J,X),U(null)},className:"w-full text-left px-3 py-2 text-sm hover:bg-muted transition-colors",children:X},X))})]})]}),h.length>1&&a.jsx("button",{type:"button",onClick:()=>Q(J),className:"text-muted-foreground hover:text-destructive transition-colors p-1 shrink-0","aria-label":"Remove model",children:a.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[a.jsx("path",{d:"M3 6h18"}),a.jsx("path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6"}),a.jsx("path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2"})]})})]}),a.jsxs("div",{className:"grid gap-2 sm:grid-cols-2",children:[a.jsxs("div",{className:"space-y-1 text-xs text-muted-foreground",children:[a.jsx("span",{children:"Context Window"}),a.jsxs(Qo,{value:ee,onValueChange:X=>Pe(J,X),children:[a.jsx(ts,{size:"sm",className:"w-full bg-background font-mono text-xs",children:a.jsx(es,{})}),a.jsxs(ns,{className:"max-h-64",children:[a.jsx(Lt,{value:ga,children:"Not set"}),Vg.map(X=>a.jsxs(Lt,{value:X.value,children:[X.label," · ",X.value]},X.value)),a.jsx(Lt,{value:rs,children:"Custom"})]})]}),V.contextWindowMode==="custom"&&a.jsxs("div",{className:"grid grid-cols-[minmax(0,1fr)_5.75rem] gap-1.5",children:[a.jsx("input",{type:"text",inputMode:"decimal",value:$.amount,onChange:X=>_(J,X.target.value),placeholder:"128",className:"w-full rounded-md border border-input bg-background px-3 py-2 font-mono text-xs text-foreground ring-offset-background placeholder:text-muted-foreground focus-visible:border-ring focus-visible:outline-ring focus-visible:ring-[3px]"}),a.jsxs(Qo,{value:$.unit,onValueChange:X=>ne(J,X),children:[a.jsx(ts,{size:"sm",className:"w-full bg-background font-mono text-xs",children:a.jsx(es,{})}),a.jsxs(ns,{children:[a.jsx(Lt,{value:"K",children:"K"}),a.jsx(Lt,{value:"M",children:"M"}),a.jsx(Lt,{value:"tokens",children:"tokens"})]})]})]}),se!==void 0&&a.jsx("span",{className:"block text-destructive",children:se})]}),a.jsxs("label",{className:"space-y-1 text-xs text-muted-foreground",children:[a.jsx("span",{children:"Output Limit"}),a.jsx("input",{type:"number",min:1,step:1e3,value:V.outputLimit,onChange:X=>_e(J,{outputLimit:X.target.value}),placeholder:"e.g. 8192",className:"w-full rounded-md border border-input bg-background px-3 py-2 font-mono text-xs text-foreground ring-offset-background placeholder:text-muted-foreground focus-visible:border-ring focus-visible:outline-ring focus-visible:ring-[3px]"}),Y!==void 0&&a.jsx("span",{className:"block text-destructive",children:Y})]})]})]},J)}),a.jsx("button",{type:"button",onClick:M,className:"text-xs text-primary hover:underline flex items-center gap-1",children:"+ Add Model"}),N.models!==void 0&&a.jsx("p",{className:"text-xs text-destructive",children:N.models})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsxs("div",{className:"flex gap-1 border-b border-border",children:[a.jsx(tt,{children:a.jsxs(Fe,{children:[a.jsx($e,{asChild:!0,children:a.jsx("button",{type:"button",onClick:()=>b("anthropic"),className:`px-3 py-2 text-sm font-medium border-b-2 transition-colors ${g==="anthropic"?"border-primary text-primary":"border-transparent text-muted-foreground hover:text-foreground"}`,children:"Anthropic Format"})}),a.jsx(Be,{children:"Anthropic Messages API protocol"})]})}),a.jsx(tt,{children:a.jsxs(Fe,{children:[a.jsx($e,{asChild:!0,children:a.jsx("button",{type:"button",onClick:()=>b("openai"),className:`px-3 py-2 text-sm font-medium border-b-2 transition-colors ${g==="openai"?"border-primary text-primary":"border-transparent text-muted-foreground hover:text-foreground"}`,children:"OpenAI Format"})}),a.jsx(Be,{children:"OpenAI Chat Completions API protocol"})]})})]}),N.format!==void 0&&a.jsx("p",{className:"text-xs text-destructive",children:N.format})]}),g==="anthropic"&&a.jsxs("div",{className:"space-y-2",children:[a.jsx("label",{htmlFor:"provider-anthropic-base-url",className:"text-sm font-medium",children:"Anthropic Base URL"}),a.jsx("input",{id:"provider-anthropic-base-url",type:"text",value:v,onChange:Z=>{I(!0),k(Z.target.value)},placeholder:"https://api.anthropic.com",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"}),N.anthropicBaseUrl!==void 0&&a.jsx("p",{className:"text-xs text-destructive",children:N.anthropicBaseUrl}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"Anthropic-compatible endpoint URL. Leave empty if this provider does not support Anthropic format."})]}),g==="openai"&&a.jsxs("div",{className:"space-y-2",children:[a.jsx("label",{htmlFor:"provider-openai-base-url",className:"text-sm font-medium",children:"OpenAI Base URL"}),a.jsx("input",{id:"provider-openai-base-url",type:"text",value:S,onChange:Z=>{G(!0),C(Z.target.value)},placeholder:"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"}),N.openaiBaseUrl!==void 0&&a.jsx("p",{className:"text-xs text-destructive",children:N.openaiBaseUrl}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"OpenAI-compatible endpoint URL. Leave empty if this provider does not support OpenAI format."})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx("label",{htmlFor:"provider-api-docs-url",className:"text-sm font-medium",children:"API Docs URL"}),a.jsx("input",{id:"provider-api-docs-url",type:"text",value:j,onChange:Z=>E(Z.target.value),placeholder:"https://api.example.com/docs",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"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"Optional API documentation URL. If not set, uses known provider docs."})]}),a.jsxs("div",{className:"sticky bottom-0 bg-card border-t flex gap-2 justify-end pt-2 pb-2",children:[a.jsx(Ae,{type:"button",variant:"outline",onClick:n,disabled:w,children:"Cancel"}),a.jsx(Ae,{type:"submit",disabled:w,children:w?"Saving...":e?"Update Provider":"Add Provider"})]})]})}const jR=Re(["timeout","network_unreachable","connection_refused","auth_failed","rate_limited","server_error","invalid_response","unknown"]),NR=te({message:A(),type:jR,details:A().optional(),hint:A().optional()}),ER=te({type:Re(["text","thinking"]),text:A().optional(),thinking:A().optional()}),TR=te({requestUrl:A().optional(),requestMethod:A().optional(),requestHeaders:nt(A(),A()).optional(),requestBody:A().optional(),responseStatus:ie().optional(),responseStatusText:A().optional(),responseHeaders:nt(A(),A()).optional(),responseBody:A().optional()}),AR=te({success:Ze(),error:NR.optional(),model:A().optional(),inputTokens:ie().optional(),outputTokens:ie().optional(),cacheCreationInputTokens:ie().optional(),cacheReadInputTokens:ie().optional(),latencyMs:ie().optional(),firstChunkMs:ie().nullable().optional(),totalStreamMs:ie().nullable().optional(),tokensPerSecond:ie().nullable().optional(),content:we(ER).optional(),rawResponse:A().optional(),streaming:Ze().optional(),streamingChunks:te({chunks:we(Sf),truncated:Ze().default(!1)}).optional(),requestHeaders:nt(A(),A()).optional(),debug:TR.optional()}),fd=rn([AR,te({notConfigured:je(!0)}),te({testing:je(!0)})]),os=te({nonStreaming:fd,streaming:fd}),IR=te({anthropic:os,openai:os}),zR=te({anthropic:os,openai:os,models:nt(A(),IR).optional(),testedAt:A().optional()});function RR(){return{anthropic:{nonStreaming:{testing:!0},streaming:{testing:!0}},openai:{nonStreaming:{testing:!0},streaming:{testing:!0}}}}function pd(e,t){const n=()=>({nonStreaming:{success:!1,error:{message:e,type:t}},streaming:{notConfigured:!0}});return{anthropic:n(),openai:n()}}const PR=te({providerConfig:A()}),OR=te({success:Ze().optional(),imported:ie().optional(),message:A().optional(),errors:we(A()).optional()}),MR=te({provider:$o,imported:ie(),matchedModels:we(A()),missingModels:we(A()),sourceUrl:A()}),ko="Network error: could not reach the server. Is the proxy running?";function hd(e){return{name:e.name,apiKey:e.apiKey,models:e.models,anthropicBaseUrl:(e.anthropicBaseUrl?.length??0)>0?e.anthropicBaseUrl:void 0,openaiBaseUrl:(e.openaiBaseUrl?.length??0)>0?e.openaiBaseUrl:void 0,apiDocsUrl:(e.apiDocsUrl?.length??0)>0?e.apiDocsUrl:void 0,modelMetadataUrl:(e.modelMetadataUrl?.length??0)>0?e.modelMetadataUrl:void 0,modelMetadata:e.modelMetadata,source:e.source}}function LR(e,t){const n=e?.models?.map(r=>r.trim()).filter(r=>r!=="").length??0;return Math.max(1,n)*t}async function DR(e,t){if(t.models!==void 0)try{await fetch(`/api/providers/${e}/test/log`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)})}catch{}}function FR({externalProviders:e,isLoading:t=!1,externalTestResults:n,externalTestingProviders:r,externalTestingTimeLeft:o,onProvidersMutate:s,onTestResultsChange:i,onTestingProvidersChange:l,onTestingTimeLeftChange:c}){const[u,d]=x.useState(!1),[f,h]=x.useState(),[p,y]=x.useState(null),[m,g]=x.useState({}),[b,v]=x.useState(new Set),[k,S]=x.useState({}),[C,j]=x.useState(null),[E,T]=x.useState(!1),[z,O]=x.useState(null),[B,N]=x.useState(!1),[D,w]=x.useState(!1),[L,W]=x.useState(null),[U,F]=x.useState("all"),[K,I]=x.useState(new Set),{providerTestTimeoutSeconds:H}=Ra(),G=x.useRef(null),R=x.useRef(null),ae=e??[],re=x.useMemo(()=>{const Y=U==="all"?ae:ae.filter(ee=>ee.source===U);return U==="all"?[...Y].sort((ee,$)=>{const X={personal:0,company:1};return(X[ee.source??""]??2)-(X[$.source??""]??2)}):Y},[ae,U]),fe=n??m,le=r??b,de=o??k,pe=c?(Y,ee)=>c(Y,ee):(Y,ee)=>{S(ee===void 0?$=>{const X={...$};return delete X[Y],X}:$=>({...$,[Y]:ee}))};x.useEffect(()=>{(async()=>{try{const Y=await fetch("/api/config/paths");if(Y.ok){const ee=await It(Y,PR);j(ee.providerConfig)}}catch{}})()},[]);const he=x.useCallback(Y=>{R.current!==null&&clearTimeout(R.current),O(Y),G.current?.scrollTo({top:G.current.scrollHeight,behavior:"smooth"}),R.current=setTimeout(()=>{O(null),R.current=null},2e3)},[]);x.useEffect(()=>()=>{R.current!==null&&clearTimeout(R.current)},[]);const me=x.useCallback(()=>{s?.().catch(()=>{})},[s]),_e=x.useCallback((Y,ee)=>{i?i(Y,ee):g($=>({...$,[Y]:ee}))},[i]),Pe=x.useCallback((Y,ee)=>{if(l){l(Y,ee);return}v($=>{const X=new Set($);return ee?X.add(Y):X.delete(Y),X})},[l]),_=x.useCallback(async Y=>{_e(Y,RR()),Pe(Y,!0);const ee=new AbortController,$=ae.find(Ne=>Ne.id===Y);let ce=LR($,H);pe(Y,ce);const xe=setInterval(()=>{ce--,pe(Y,ce),ce<=0&&(clearInterval(xe),ee.abort())},1e3);try{const Ne=await fetch(`/api/providers/${Y}/test`,{method:"POST",signal:ee.signal});if(Ne.ok){const Ue=await It(Ne,zR);_e(Y,Ue),await DR(Y,Ue)}else _e(Y,pd(`HTTP ${Ne.status}: ${Ne.statusText}`,"server_error"))}catch(Ne){Ne instanceof Error&&Ne.name==="AbortError"&&_e(Y,pd("Request timed out","timeout"))}finally{clearInterval(xe),pe(Y,void 0),Pe(Y,!1)}},[H,ae,pe,_e,Pe]),ne=x.useCallback(async(Y,ee,$=!0)=>{I(X=>{const ce=new Set(X);return ce.add(Y),ce});try{const X=ee!==void 0&&ee.trim()!==""?{url:ee}:{},ce=await fetch(`/api/providers/${Y}/model-metadata`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(X)});if(!ce.ok)return $&&y(await Qt(ce,"Failed to refresh model metadata")),!1;const xe=await It(ce,MR);return xe.imported===0&&$?y("No matching model metadata found for this provider."):y(null),he(xe.provider.id),me(),xe.imported>0}catch{return $&&y(ko),!1}finally{I(X=>{const ce=new Set(X);return ce.delete(Y),ce})}},[me,he]);function Q(Y){(async()=>{try{const ee=await fetch("/api/providers",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(hd(Y))});if(!ee.ok){y(await Qt(ee,"Failed to add provider"));return}const $=await It(ee,$o);d(!1),he($.id),Y.modelMetadataUrl!==void 0&&Y.modelMetadataUrl.trim()!==""&&await ne($.id,Y.modelMetadataUrl,!1),me(),await _($.id)}catch{y(ko)}})()}function M(Y){f&&(async()=>{try{const ee=await fetch(`/api/providers/${f.id}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(hd(Y))});if(!ee.ok){y(await Qt(ee,"Failed to update provider"));return}const $=await It(ee,$o);h(void 0),he($.id),Y.modelMetadataUrl!==void 0&&Y.modelMetadataUrl.trim()!==""&&await ne($.id,Y.modelMetadataUrl,!1),me(),((Y.apiKey??"")!==(f.apiKey??"")||JSON.stringify(Y.models)!==JSON.stringify(f.models)||(Y.anthropicBaseUrl??"")!==(f.anthropicBaseUrl??"")||(Y.openaiBaseUrl??"")!==(f.openaiBaseUrl??""))&&await _($.id)}catch{y(ko)}})()}function P(Y){W(Y),w(!0)}function q(){const Y=L;Y!==null&&(async()=>{let ee;try{ee=await fetch(`/api/providers/${Y}`,{method:"DELETE"})}catch{y(ko);return}if(!ee.ok){y(await Qt(ee,"Failed to delete provider"));return}me()})()}const Z=x.useRef(null);function J(Y){const ee="/api/providers/export";(async()=>{try{const $=await fetch(ee);if(!$.ok){y("Failed to export providers");return}const X=await $.blob(),ce=URL.createObjectURL(X),xe=document.createElement("a");xe.href=ce,xe.download=$.headers.get("Content-Disposition")?.match(/filename="(.+)"/)?.[1]??"providers.json",document.body.appendChild(xe),xe.click(),document.body.removeChild(xe),URL.revokeObjectURL(ce)}catch{y("Failed to export providers")}})()}function V(){Z.current?.click()}function se(Y){const ee=Y.target.files?.[0];ee&&(async()=>{try{const $=await ee.text(),X=await fetch("/api/providers/import",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify($)}),ce=await It(X,OR);X.ok&&ce.imported!==void 0&&ce.imported>0?(me(),y(null)):ce.errors&&ce.errors.length>0?y(ce.errors.join("; ")):y(ce.message??"Import failed")}catch{y("Failed to import providers")}Y.target.value=""})()}return t?a.jsx("div",{className:"flex items-center justify-center py-8",children:a.jsx("p",{className:"text-sm text-muted-foreground",children:"Loading providers..."})}):u||f?a.jsxs("div",{className:"space-y-4",children:[a.jsx("div",{className:"flex items-center justify-between sticky top-0 bg-background z-10 pb-2",children:a.jsx("h3",{className:"text-lg font-medium",children:f?"Edit Provider":"Add New Provider"})}),a.jsx(CR,{provider:f,onSubmit:f?M:Q,onCancel:()=>{d(!1),h(void 0)}})]}):a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"flex items-center justify-between sticky top-0 z-10 bg-background pb-2",children:[a.jsx("h3",{className:"text-lg font-medium",children:"Providers"}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(tt,{children:a.jsxs(Fe,{children:[a.jsx($e,{asChild:!0,children:a.jsxs(Ae,{variant:"outline",size:"sm",onClick:()=>J(),className:"gap-1 hover:bg-muted",children:[a.jsx(ds,{className:"size-3"}),"Export"]})}),a.jsx(Be,{children:"Download providers as JSON for backup or sharing"})]})}),a.jsx(tt,{children:a.jsxs(Fe,{children:[a.jsx($e,{asChild:!0,children:a.jsxs(Ae,{variant:"outline",size:"sm",onClick:V,className:"gap-1 hover:bg-muted",children:[a.jsx(mw,{className:"size-3"}),"Import"]})}),a.jsx(Be,{children:"Import providers from an exported JSON file"})]})}),a.jsx("input",{type:"file",ref:Z,accept:".json",onChange:se,style:{display:"none"}}),a.jsx(tt,{children:a.jsxs(Fe,{children:[a.jsx($e,{asChild:!0,children:a.jsxs(Ae,{variant:"outline",size:"sm",onClick:()=>N(!0),className:"gap-1",children:[a.jsx(rw,{className:"size-3"}),"Scan"]})}),a.jsx(Be,{children:"Detect and import provider configs from Claude Code and OpenCode"})]})}),a.jsxs(Ae,{onClick:()=>d(!0),size:"sm",className:"gap-1",children:[a.jsx(Ri,{className:"size-4"}),"Add Provider"]})]})]}),C!==null&&a.jsxs("div",{className:"flex items-center gap-2 text-xs text-muted-foreground bg-muted/30 rounded-md px-3 py-2",children:[a.jsx("span",{className:"shrink-0",children:"Config:"}),a.jsx("span",{className:"font-mono truncate",title:C,children:C}),a.jsx(tt,{children:a.jsxs(Fe,{children:[a.jsx($e,{asChild:!0,children:a.jsx("button",{type:"button",onClick:()=>{window.navigator.clipboard.writeText(C).then(()=>{T(!0),setTimeout(()=>T(!1),2e3)})},className:"shrink-0 ml-auto text-muted-foreground hover:text-foreground transition-colors",children:E?a.jsx(rt,{className:"size-3 text-green-500"}):a.jsx(_t,{className:"size-3"})})}),a.jsx(Be,{children:"Copy config file path to clipboard"})]})})]}),p!==null&&a.jsxs("div",{className:"flex items-center gap-2 text-sm text-destructive bg-destructive/10 rounded-md px-3 py-2",children:[a.jsx(Dr,{className:"size-4 shrink-0"}),p]}),ae.length===0?a.jsxs("div",{className:"text-center py-12 space-y-3",children:[a.jsx("p",{className:"text-sm text-muted-foreground",children:"No providers configured yet."}),a.jsxs(Ae,{onClick:()=>d(!0),variant:"outline",size:"sm",children:[a.jsx(Ri,{className:"size-4"}),"Add Your First Provider"]})]}):a.jsxs("div",{className:"space-y-3",children:[a.jsx("div",{className:"flex gap-1 border-b border-border",children:["all","personal","company"].map(Y=>a.jsx(tt,{children:a.jsxs(Fe,{children:[a.jsx($e,{asChild:!0,children:a.jsx("button",{type:"button",onClick:()=>F(Y),className:`px-3 py-2 text-sm font-medium border-b-2 transition-colors ${U===Y?"border-primary text-primary":"border-transparent text-muted-foreground hover:text-foreground"}`,children:Y==="all"?"All":Y==="personal"?"Personal":"Company"})}),a.jsx(Be,{children:Y==="all"?"Show all providers":Y==="personal"?"Providers you configured yourself":"Providers set by your organization"})]})},Y))}),a.jsx("div",{ref:G,className:"space-y-3",children:re.map(Y=>a.jsx(wR,{provider:Y,testResults:fe[Y.id],isTesting:le.has(Y.id),testingTimeLeft:de[Y.id],isHighlighted:Y.id===z,onEdit:ee=>h(ee),onDelete:P,onRefreshMetadata:ee=>{ne(ee)},isRefreshingMetadata:K.has(Y.id),onTest:ee=>{_(ee)}},Y.id))})]}),a.jsx(aR,{open:B,onOpenChange:N,onImportComplete:()=>{s!==void 0&&s()}}),a.jsx(gm,{open:D,onOpenChange:w,title:"Delete Provider",description:"Are you sure you want to delete this provider? This action cannot be undone.",confirmLabel:"Delete",variant:"destructive",onConfirm:q})]})}function $R(){const[e,t]=x.useState(!1),[n,r]=x.useState("providers"),{providers:o,isLoading:s,mutate:i}=Jf(),[l,c]=x.useState({}),[u,d]=x.useState(new Set),[f,h]=x.useState({}),p=x.useCallback((g,b)=>{c(v=>({...v,[g]:b}))},[]),y=x.useCallback((g,b)=>{d(v=>{const k=new Set(v);return b?k.add(g):k.delete(g),k})},[]),m=x.useCallback((g,b)=>{h(v=>{if(b===void 0){const k={...v};return delete k[g],k}return{...v,[g]:b}})},[]);return a.jsxs(zs,{open:e,onOpenChange:t,children:[a.jsx(mm,{asChild:!0,children:a.jsxs(Ae,{variant:"ghost",size:"icon",className:"size-8",children:[a.jsx(cw,{className:"size-4"}),a.jsx("span",{className:"sr-only",children:"Settings"})]})}),a.jsxs(Rs,{className:"max-w-2xl max-h-[80vh] overflow-hidden flex flex-col",children:[a.jsx(Ps,{children:a.jsx(Os,{children:"Settings"})}),a.jsxs(jm,{value:n,onValueChange:r,className:"flex-1 overflow-hidden",children:[a.jsxs(Nm,{children:[a.jsx(Tt,{value:"providers",children:"Providers"}),a.jsx(Tt,{value:"proxy",children:"Proxy"}),a.jsx(Tt,{value:"storage",children:"Storage"}),a.jsx(Tt,{value:"onboarding",children:"Onboarding"})]}),a.jsxs("div",{className:"mt-4 flex-1 overflow-x-hidden overflow-y-auto pr-3",children:[a.jsx(At,{value:"providers",children:a.jsx(FR,{externalProviders:o,isLoading:s,externalTestResults:l,externalTestingProviders:u,externalTestingTimeLeft:f,onProvidersMutate:()=>i(),onTestResultsChange:p,onTestingProvidersChange:y,onTestingTimeLeftChange:m})}),a.jsx(At,{value:"proxy",children:a.jsx(VR,{})}),a.jsx(At,{value:"storage",children:a.jsx(UR,{})}),a.jsx(At,{value:"onboarding",children:a.jsx(WR,{})})]})]})]})]})}const BR=te({memoryCount:ie(),logDir:A(),logFileCount:ie(),logBytes:ie(),chunkDir:A(),chunkFileCount:ie(),chunkBytes:ie()});function md(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KiB`:e<1024*1024*1024?`${(e/1024/1024).toFixed(1)} MiB`:`${(e/1024/1024/1024).toFixed(1)} GiB`}function UR(){const[e,t]=x.useState(null),[n,r]=x.useState(null),[o,s]=x.useState(!1),[i,l]=x.useState(null),c=x.useCallback(async()=>{s(!0),r(null);try{const d=await fetch("/api/logs?stats=1");if(!d.ok){r(`Failed to load storage stats: HTTP ${String(d.status)}`);return}const f=await d.json(),h=BR.safeParse(f);if(!h.success){r("Storage stats response was not valid.");return}t(h.data)}catch(d){r(d instanceof Error?d.message:String(d))}finally{s(!1)}},[]);x.useEffect(()=>{c()},[c]);const u=x.useCallback((d,f)=>{window.navigator.clipboard.writeText(f).then(()=>{l(d),setTimeout(()=>l(null),1600)})},[]);return a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"flex items-center justify-between gap-3",children:[a.jsxs("div",{children:[a.jsx("h3",{className:"text-sm font-semibold",children:"Log storage"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"Inspect local log and streaming chunk footprint before exporting or clearing sessions."})]}),a.jsx(Ae,{type:"button",variant:"outline",size:"sm",onClick:()=>{c()},children:o?"Refreshing...":"Refresh"})]}),e!==null&&a.jsxs("div",{className:"grid gap-2 text-xs",children:[a.jsx(xa,{id:"log-dir",label:"Log storage path",value:e.logDir,copiedId:i,onCopy:u}),a.jsx(xa,{id:"chunk-dir",label:"Streaming chunks storage path",value:e.chunkDir,copiedId:i,onCopy:u}),a.jsxs("div",{className:"rounded-md border border-border bg-muted/20 px-3 py-2",children:[a.jsx("div",{className:"font-medium",children:"In-memory logs"}),a.jsxs("div",{className:"mt-1 font-mono text-muted-foreground",children:[e.memoryCount.toLocaleString()," loaded"]})]}),a.jsxs("div",{className:"rounded-md border border-border bg-muted/20 px-3 py-2",children:[a.jsx("div",{className:"font-medium",children:"Log files"}),a.jsxs("div",{className:"mt-1 font-mono text-muted-foreground",children:[e.logFileCount.toLocaleString()," files / ",md(e.logBytes)]})]}),a.jsxs("div",{className:"rounded-md border border-border bg-muted/20 px-3 py-2",children:[a.jsx("div",{className:"font-medium",children:"Streaming chunks"}),a.jsxs("div",{className:"mt-1 font-mono text-muted-foreground",children:[e.chunkFileCount.toLocaleString()," files / ",md(e.chunkBytes)]})]})]}),n!==null&&a.jsx("p",{className:"text-xs text-destructive",children:n})]})}function xa({id:e,label:t,value:n,copiedId:r,onCopy:o}){const s=r===e;return a.jsxs("div",{className:"min-w-0 rounded-md border border-border bg-muted/20 px-3 py-2",children:[a.jsx("div",{className:"mb-1 text-xs font-medium text-muted-foreground",children:t}),a.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[a.jsx("code",{className:"min-w-0 flex-1 truncate font-mono text-xs text-foreground",children:n}),a.jsx(Ae,{type:"button",variant:"ghost",size:"icon",className:"size-7 shrink-0",onClick:()=>o(e,n),"aria-label":s?`Copied ${t}`:`Copy ${t}`,children:s?a.jsx(rt,{className:"size-3.5 text-emerald-500"}):a.jsx(_t,{className:"size-3.5"})})]})]})}function WR(){const[e,t]=x.useState(null),n=x.useMemo(()=>typeof window>"u"?"http://localhost:25947":window.location.origin,[]),r=x.useMemo(()=>[{id:"status",label:"Check onboarding",value:"agent-inspector onboard --status"},{id:"status-json",label:"Check onboarding JSON",value:"agent-inspector onboard --status --json"},{id:"refresh",label:"Refresh generated files",value:"agent-inspector onboard --force"},{id:"uninstall",label:"Remove matching generated files",value:"agent-inspector onboard --uninstall"},{id:"claude",label:"Claude Code command",value:"/agent-inspector:onboard"},{id:"codex",label:"Codex prompt",value:"Use the agent-inspector-onboard skill"},{id:"mcp",label:"MCP URL",value:`${n}/api/mcp`},{id:"proxy",label:"Proxy URL",value:`${n}/proxy`},{id:"anthropic",label:"Anthropic base",value:`ANTHROPIC_BASE_URL=${n}/proxy`},{id:"openai",label:"OpenAI base",value:`OPENAI_BASE_URL=${n}/proxy`}],[n]),o=x.useCallback((s,i)=>{window.navigator.clipboard.writeText(i).then(()=>{t(s),setTimeout(()=>t(null),1600)})},[]);return a.jsxs("div",{className:"min-w-0 space-y-4",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(Rf,{className:"size-4 text-muted-foreground"}),a.jsx("h3",{className:"text-sm font-semibold",children:"Agent onboarding"})]}),a.jsx("div",{className:"grid gap-2",children:r.map(s=>a.jsx(xa,{id:s.id,label:s.label,value:s.value,copiedId:e,onCopy:o},s.id))}),a.jsxs("div",{className:"grid gap-2 rounded-md border border-border bg-background px-3 py-2 text-xs text-muted-foreground",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(rt,{className:"size-3.5 text-emerald-500"}),a.jsx("span",{children:"Provider test creates a traceable memory probe session."})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(rt,{className:"size-3.5 text-emerald-500"}),a.jsx("span",{children:"Captured sessions can produce reviewable memory candidates."})]}),a.jsxs("div",{className:"flex items-start gap-2",children:[a.jsx(rt,{className:"mt-0.5 size-3.5 text-emerald-500"}),a.jsxs("span",{children:["Streamable HTTP clients should use the MCP URL directly. Stdio-only clients should use",a.jsx("code",{className:"mx-1 rounded bg-muted px-1 py-0.5 font-mono text-[11px] text-foreground",children:"agent-inspector-mcp stdio"}),"instead. Configure only one entry for the same Inspector."]})]}),a.jsxs("div",{className:"flex items-start gap-2",children:[a.jsx(rt,{className:"mt-0.5 size-3.5 text-emerald-500"}),a.jsx("span",{children:"If your AI tool runs in another container or host, replace localhost with an address reachable from that tool and verify the network/firewall path."})]})]})]})}function VR(){const{strip:e,captureMode:t,slowResponseThresholdSeconds:n,providerTestTimeoutSeconds:r,timeDisplayFormat:o,isLoading:s,setStrip:i,setSlowResponseThresholdSeconds:l,setProviderTestTimeoutSeconds:c,setTimeDisplayFormat:u}=Ra(),[d,f]=x.useState(null),[h,p]=x.useState(!1),y=t==="full"?"simple":"full",m=x.useCallback(async k=>{f(null),p(!0);try{await i(k)}catch(S){f(S instanceof Error?S.message:String(S))}finally{p(!1)}},[i]),g=x.useCallback(async k=>{f(null),p(!0);try{await l(k)}catch(S){f(S instanceof Error?S.message:String(S))}finally{p(!1)}},[l]),b=x.useCallback(async k=>{f(null),p(!0);try{await c(k)}catch(S){f(S instanceof Error?S.message:String(S))}finally{p(!1)}},[c]),v=x.useCallback(async k=>{f(null),p(!0);try{await u(k)}catch(S){f(S instanceof Error?S.message:String(S))}finally{p(!1)}},[u]);return a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"space-y-1",children:[a.jsx("h3",{className:"text-sm font-semibold",children:"Capture mode"}),a.jsxs("p",{className:"text-xs text-muted-foreground",children:["This process is running in ",a.jsx("code",{children:t})," mode. Restart with"," ",a.jsxs("code",{children:["agent-inspector --mode ",y]})," to change it.",t==="simple"?" Simple mode keeps replay, parsed requests, responses, timing, tools, and token usage while skipping raw headers, raw response retention, and detailed SSE chunk retention.":" Full mode retains raw headers, raw responses, and SSE chunks for diagnostics; use simple mode for everyday lower-overhead capture."]})]}),a.jsxs("div",{className:"space-y-1",children:[a.jsx("h3",{className:"text-sm font-semibold",children:"Claude Code billing header"}),a.jsxs("p",{className:"text-xs text-muted-foreground",children:["When enabled, the proxy strips the synthetic ",a.jsx("code",{children:"x-anthropic-billing-header"})," text block that Claude Code prepends to the system prompt before forwarding to upstream. Improves prefix-cache hit rates against third-party upstreams. The default at startup is controlled by the ",a.jsx("code",{children:"AGENT_INSPECTOR_STRIP_CLAUDE_CODE_BILLING_HEADER"})," ","environment variable; your choice is persisted to ",a.jsx("code",{children:"config.json"})," and overrides the env var for subsequent requests."]})]}),a.jsxs("label",{className:"flex items-center gap-3",children:[a.jsx("input",{type:"checkbox",role:"switch",checked:e,disabled:s||h,onChange:k=>{m(k.currentTarget.checked)},className:"size-4 cursor-pointer disabled:cursor-not-allowed disabled:opacity-50"}),a.jsx("span",{className:"text-sm",children:s?"Loading...":e?"Stripping enabled":"Stripping disabled"})]}),a.jsxs("div",{className:"space-y-1",children:[a.jsx("label",{htmlFor:"slow-response-threshold",className:"text-sm font-semibold",children:"Slow response threshold"}),a.jsxs("p",{className:"text-xs text-muted-foreground",children:["Logs whose elapsed time exceeds this many seconds show a warning icon next to the duration. Set to ",a.jsx("code",{children:"0"})," to disable the indicator."]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("input",{id:"slow-response-threshold",type:"number",min:0,max:Ii,step:1,value:n,disabled:s||h,onChange:k=>{const S=Number(k.currentTarget.value);Number.isInteger(S)&&(S<0||S>Ii||g(S))},className:"h-8 w-24 rounded-md border border-input bg-transparent px-2 text-sm font-mono disabled:cursor-not-allowed disabled:opacity-50"}),a.jsx("span",{className:"text-xs text-muted-foreground",children:"seconds"})]})]}),a.jsxs("div",{className:"space-y-1",children:[a.jsx("label",{htmlFor:"provider-test-timeout",className:"text-sm font-semibold",children:"Provider test timeout"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"Provider Test waits this many seconds per configured model before aborting slow probes. The full test window scales with model count."}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("input",{id:"provider-test-timeout",type:"number",min:1,max:zi,step:1,value:r,disabled:s||h,onChange:k=>{const S=Number(k.currentTarget.value);Number.isInteger(S)&&(S<1||S>zi||b(S))},className:"h-8 w-24 rounded-md border border-input bg-transparent px-2 text-sm font-mono disabled:cursor-not-allowed disabled:opacity-50"}),a.jsx("span",{className:"text-xs text-muted-foreground",children:"seconds / model"})]})]}),a.jsxs("div",{className:"space-y-1",children:[a.jsx("label",{htmlFor:"time-display-format",className:"text-sm font-semibold",children:"Time display"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"Controls timestamps in session summaries, conversation headers, and log rows."}),a.jsxs("select",{id:"time-display-format",value:o,disabled:s||h,onChange:k=>{const S=Cf.safeParse(k.currentTarget.value);S.success&&v(S.data)},className:"h-8 rounded-md border border-input bg-background px-2 text-sm disabled:cursor-not-allowed disabled:opacity-50",children:[a.jsx("option",{value:"time",children:"Time only"}),a.jsx("option",{value:"full",children:"Full ISO"})]})]}),d!==null&&a.jsxs("p",{className:"text-xs text-destructive",children:["Failed to save: ",d]})]})}function HR(e){const t=new Map;for(const n of e){const r=n.logs;for(let o=1;o<r.length;o++){const s=r[o-1],i=r[o];s===void 0||i===void 0||t.set(i.id,{creation:gd(s.cacheCreationInputTokens,i.cacheCreationInputTokens),read:gd(s.cacheReadInputTokens,i.cacheReadInputTokens)})}}return t}function gd(e,t){return t===null||e===null?null:t>e?{direction:"up",delta:t-e}:t<e?{direction:"down",delta:e-t}:null}const ZR=30,qR=112,KR=6;function GR(e){return e>ZR}function JR({groups:e,standalone:t,...n}){return GR(e.length)?a.jsx(YR,{groups:e,standalone:t,...n}):a.jsx(a.Fragment,{children:e.map(r=>a.jsx(zg,{group:r,standalone:t,...n},r.id))})}function YR({groups:e,standalone:t,...n}){const[r,o]=x.useState(()=>new Map),s=NE({count:e.length,estimateSize:()=>qR,overscan:KR,getItemKey:c=>e[c]?.id??c}),i=x.useCallback((c,u)=>{o(d=>{const f=new Map(d);return u?f.set(c,!0):f.delete(c),f})},[]),l=x.useMemo(()=>{const c=new Map;for(let u=0;u<e.length;u++){const d=e[u];if(d!==void 0)for(const f of d.logs)c.set(f.id,u)}return c},[e]);return x.useEffect(()=>{const c=u=>{const d=Bs(u);if(d===null)return;const f=l.get(d.logId);if(f===void 0)return;const h=e[f];h!==void 0&&(i(h.id,!0),s.scrollToIndex(f,{align:"center"}))};return window.addEventListener(nn,c),()=>{window.removeEventListener(nn,c)}},[e,l,i,s]),a.jsx("div",{className:"relative w-full",style:{height:`${s.getTotalSize()}px`},"data-virtualized-conversation-list":"true",children:s.getVirtualItems().map(c=>{const u=e[c.index];return u===void 0?null:a.jsx("div",{"data-index":c.index,ref:s.measureElement,className:"absolute left-0 top-0 w-full",style:{transform:`translateY(${c.start}px)`},children:a.jsx(zg,{group:u,standalone:t,expanded:r.get(u.id)??!1,onExpandedChange:d=>i(u.id,d),...n})},c.key)})})}const ss="data-nav-id",XR="data-nav-action";function xd(e){return Array.from(e.querySelectorAll(`[${ss}]`))}function bd(e){return e instanceof HTMLElement}function QR(e,t){let n=e;for(;n!==null&&n!==t;){if(n.hasAttribute(ss))return n;n=n.parentElement}return e.hasAttribute(ss)?e:null}function _i(e){const t=e.getAttribute(XR);return t==="toggle"||t==="expand"||t==="collapse"?t:null}function Nr(e){e.focus({preventScroll:!0}),e.scrollIntoView({block:"nearest",behavior:"smooth"})}function Er(e,t){return e[t]??null}function qg(e){const t=e.tagName;return!!(t==="INPUT"||t==="TEXTAREA"||t==="SELECT"||e.isContentEditable)}function yd(e){const t=e.tagName;return t==="BUTTON"||t==="A"||qg(e)?!0:e.closest("[role='button'],[role='menuitem'],[role='option']")!==null}function eP(e){return e.closest("[role='dialog'],[role='menu'],[role='listbox']")!==null?!0:document.querySelector("[role='dialog'],[role='menu'],[role='listbox']")!==null}function tP(){const e=window.getSelection();return e===null?!1:e.type==="Range"&&e.toString().length>0}function _o(e,t){return e.key===t&&e.shiftKey}function nP(e,t,n={}){const r=t??e,o=n.pageWide===!0,s=x.useCallback(i=>{const l=e.current,c=r.current;if(!l||!c)return;const u=i.target;if(!bd(u)||u!==c)return;const d=xd(l),f=Er(d,0);f!==null&&Nr(f)},[e,r]);x.useEffect(()=>{const i=l=>{if(l.altKey||l.ctrlKey||l.metaKey)return;const c=e.current;if(!c)return;const u=l.target;if(!bd(u)||qg(u)||tP())return;const d=c.contains(u);if(d&&yd(u)&&!u.hasAttribute(ss)||!d&&(!o||yd(u)||eP(u)))return;const f=xd(c);if(f.length===0)return;const h=QR(u,c),p=h!==null?f.indexOf(h):-1;let y=!1;switch(l.key){case"ArrowUp":case"W":{if(l.shiftKey&&l.key==="ArrowUp"||l.key==="W"&&!_o(l,"W"))break;l.preventDefault();const m=p>0?p-1:p===-1?f.length-1:-1;if(m!==-1){const g=Er(f,m);g!==null&&Nr(g)}y=!0;break}case"ArrowDown":case"S":{if(l.shiftKey&&l.key==="ArrowDown"||l.key==="S"&&!_o(l,"S"))break;l.preventDefault();const m=p<f.length-1?p+1:p===-1?0:-1;if(m!==-1){const g=Er(f,m);g!==null&&Nr(g)}y=!0;break}case"ArrowLeft":case"A":{if(l.shiftKey&&l.key==="ArrowLeft"||l.key==="A"&&!_o(l,"A")||h===null)break;if(l.preventDefault(),_i(h)==="collapse")h.click();else if(p>0){const g=Er(f,p-1);g!==null&&Nr(g)}y=!0;break}case"ArrowRight":case"D":{if(l.shiftKey&&l.key==="ArrowRight"||l.key==="D"&&!_o(l,"D")||h===null)break;if(l.preventDefault(),_i(h)==="expand")h.click();else if(p<f.length-1){const g=Er(f,p+1);g!==null&&Nr(g)}y=!0;break}case" ":{if(h===null)break;l.preventDefault(),_i(h)!==null&&h.click(),y=!0;break}}y&&l.stopPropagation()};return document.addEventListener("keydown",i,{capture:!0}),()=>document.removeEventListener("keydown",i,{capture:!0})},[e,o,r]),x.useEffect(()=>(document.addEventListener("focusin",s),()=>document.removeEventListener("focusin",s)),[s])}const rP={system:"System",user:"User",assistant:"Assistant",tool:"Tool Results",tools:"Tool Definitions"},oP={system:"bg-sky-500/70",user:"bg-emerald-500/70",assistant:"bg-violet-500/70",tool:"bg-sky-400/55",tools:"bg-slate-500/70"},sP={system:"focus-visible:ring-sky-300",user:"focus-visible:ring-emerald-300",assistant:"focus-visible:ring-violet-300",tool:"focus-visible:ring-sky-300",tools:"focus-visible:ring-slate-300"},Si=12,So=1,vd=80,wd=24;function iP(e){return e.length<=wd?e:`${e.slice(0,wd-3)}...`}function aP(e){const t=e.replace(/\s+/g," ").trim();return t.length<=vd?t:`${t.slice(0,vd)}...`}function Co(e){return e>=10?`${e.toFixed(0)}%`:e>=1?`${e.toFixed(1)}%`:e>0?"<1%":"0%"}const lP=x.memo(function({segments:t,totalTokens:n,showLabels:r=!0,onActivate:o}){const s=x.useMemo(()=>n>0?n:t.reduce((g,b)=>g+b.size,0),[t,n]),i=t.slice(0,Si),l=t.slice(Si),c=l.reduce((g,b)=>g+b.size,0),u=l.length,d=Si,f=d+u-1,h=u>0,p=o!==void 0,y=x.useMemo(()=>i.reduce((g,b)=>g+b.size,0),[i]),m=x.useMemo(()=>`Request context: ~${He(s)} tokens across ${t.length} segment${t.length===1?"":"s"}`,[t.length,s]);return t.length===0||s<=0?a.jsx("div",{role:"img","aria-label":m,className:"h-6"}):a.jsx(tt,{delayDuration:150,children:a.jsxs("div",{role:"img","aria-label":m,className:"flex flex-col gap-1.5",children:[a.jsxs("div",{className:"relative flex h-6 w-full overflow-hidden rounded border border-border/40 bg-muted/30","data-testid":"anatomy-segment-bar",children:[i.map((g,b)=>{const v=s>0?g.size/s*100:0,k=Math.max(So,v),S=ve("h-full border-r border-background/80 last:border-r-0",p?"opacity-90 hover:opacity-100 focus:opacity-100 focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-1 focus-visible:ring-offset-background":"opacity-90",oP[g.role],p?sP[g.role]:""),C={width:`${k}%`},j=`${g.label}, ${Co(v)}, ~${He(g.size)} tokens`;return a.jsxs(Fe,{children:[a.jsx($e,{asChild:!0,children:p?a.jsx("button",{type:"button",role:"button",tabIndex:0,onClick:()=>o(g),onKeyDown:E=>{(E.key==="Enter"||E.key===" ")&&(E.preventDefault(),o(g))},"data-anatomy-path":g.path,"aria-label":j,className:S,style:C}):a.jsx("span",{"aria-label":j,className:S,style:C})}),a.jsxs(Be,{side:"bottom",className:"max-w-sm text-xs p-2 space-y-0.5",children:[a.jsxs("div",{className:"font-semibold",children:[g.label," - ",Co(v)," - ~",He(g.size)," ","tokens"]}),a.jsx("div",{className:"text-muted-foreground",children:rP[g.role]}),a.jsxs("div",{className:"text-muted-foreground",children:[g.characters.toLocaleString()," chars"]}),g.text.length>0&&a.jsx("div",{className:"text-muted-foreground/90 break-words whitespace-pre-wrap",children:aP(g.text)})]})]},`${g.path}-${b}`)}),h&&a.jsxs(Fe,{children:[a.jsx($e,{asChild:!0,children:a.jsxs("div",{role:"img","aria-label":`${u} additional segments`,className:"flex h-full items-center justify-center bg-muted-foreground/30 px-1.5 text-[10px] font-mono text-background",style:{width:`${Math.max(So,c/s*100)}%`},children:["... +",u]})}),a.jsxs(Be,{side:"bottom",className:"text-xs",children:[u," more segment",u===1?"":"s"," (indices"," ",d,"-",f,")"]})]})]}),r&&a.jsxs("div",{className:"flex w-full gap-1 text-[10px] text-muted-foreground",children:[i.map((g,b)=>{const v=s>0?g.size/s*100:0,k=Math.max(So,v);return a.jsxs("div",{className:"flex flex-col gap-0.5 truncate",style:{width:`${k}%`},title:`${g.label} - ${Co(v)} - ~${He(g.size)} tokens`,children:[a.jsx("span",{className:"truncate font-mono text-foreground/80",children:iP(g.label)}),a.jsxs("span",{className:"truncate font-mono text-muted-foreground/70",children:[Co(v)," - ~",He(g.size)]})]},`label-${g.path}-${b}`)}),h&&a.jsxs("div",{className:"flex flex-col gap-0.5 truncate text-muted-foreground",style:{width:`${Math.max(So,c/s*100)}%`},children:[a.jsxs("span",{className:"truncate font-mono text-foreground/60",children:["... +",u]}),a.jsxs("span",{className:"truncate font-mono text-muted-foreground/60",children:["~",He(c)]})]})]}),y<s*.1&&a.jsx("div",{className:"h-0"})]})})}),Kg=.75,Gg=.9,ba=8e3,cP=.35,Jg=40,Yg=160,uP=5,dP=8,fP=18,pP=6e4,hP=.7,kd=3e3,mP=.3,_d=160,gP=new Set(["answer","body","content","data","error","message","markdown","output","response","result","stderr","stdout","text","transcript"]),xP=["context_window","contextWindow","context_length","contextLength","max_context_length","maxContextLength","max_input_tokens","maxInputTokens"],bP=["max_tokens","maxTokens","max_completion_tokens","maxCompletionTokens","max_output_tokens","maxOutputTokens"],yP=[{family:"OpenAI GPT-4.1",tokens:1047576,mode:"prefix",patterns:["gpt-4.1"]},{family:"OpenAI GPT-4o",tokens:128e3,mode:"prefix",patterns:["gpt-4o"]},{family:"OpenAI o-series",tokens:128e3,mode:"prefix",patterns:["o1","o3","o4"]},{family:"Anthropic Claude",tokens:2e5,mode:"prefix",patterns:["claude-"]},{family:"DeepSeek V4",tokens:1048576,mode:"prefix",patterns:["deepseek-v4-pro","deepseek-v4-flash"]},{family:"DeepSeek",tokens:64e3,mode:"prefix",patterns:["deepseek-"]},{family:"MiniMax M3",tokens:1048576,mode:"includes",patterns:["minimax-m3"]},{family:"MiniMax M2.7",tokens:204800,mode:"includes",patterns:["minimax-m2.7"]},{family:"MiniMax M2.5/M2.1",tokens:196608,mode:"includes",patterns:["minimax-m2.5","minimax-m2.1"]},{family:"GLM-5.2",tokens:1048576,mode:"prefix",patterns:["glm-5.2"]},{family:"GLM-5",tokens:202752,mode:"prefix",patterns:["glm-5","glm-5.1"]}],vP={system:"System",user:"User messages",assistant:"Assistant messages",tool:"Tool results",tools:"Tool definitions"};function wP(e){if(typeof e=="number")return Number.isFinite(e)&&e>0?Math.floor(e):null;if(typeof e=="string"){const t=Number(e);if(Number.isFinite(t)&&t>0)return Math.floor(t)}return null}function Xg(e,t){for(const n of t){const r=wP(Me(e,n));if(r!==null)return r}return null}function kP(e){const t=Me(e,"model");if(typeof t!="string")return null;const n=t.trim();return n===""?null:n}function _P(e,t){switch(t.mode){case"prefix":return t.patterns.some(n=>e.startsWith(n));case"includes":return t.patterns.some(n=>e.includes(n))}}function SP(e,t,n=[]){const r=Xg(t,xP);if(r!==null)return{tokens:r,label:"Request metadata",source:"request"};const o=dR(e,n);if(o!==null)return{tokens:o.tokens,label:`${o.providerName} config`,source:"provider"};if(e===null)return{tokens:null,label:"Unknown model",source:"unknown"};const s=e.trim().toLowerCase().replace(/\s+/g,"-");for(const i of yP)if(_P(s,i))return{tokens:i.tokens,label:`${i.family} local rule`,source:"model-rule"};return{tokens:null,label:"No local rule",source:"unknown"}}function CP(e){return e<0?0:e>1?1:e}function jP(e){return e===null?"unknown":e>=Gg?"danger":e>=Kg?"watch":"ok"}function NP(e,t){return e.filter(n=>n.role===t).reduce((n,r)=>n+r.size,0)}function EP(e,t){return["system","user","assistant","tool","tools"].map(r=>{const o=NP(e,r);return{role:r,label:vP[r],tokens:o,percent:t>0?o/t:0}}).filter(r=>r.tokens>0).sort((r,o)=>o.tokens-r.tokens)}function ya(e){return e.replace(/\s+/g," ").trim().toLowerCase()}function TP(e){const t=e.replace(/\s+/g," ").trim();return t.length<=_d?t:`${t.slice(0,_d-3)}...`}function AP(e){return{role:e.role,label:e.label,path:e.path,tokens:e.tokens,characters:e.characters}}function IP(e){return{role:e.role,label:e.label,path:e.path,tokens:e.size,characters:e.characters,text:e.text}}function zP(e){const t=e.trim();return t.startsWith("{")||t.startsWith("[")}function RP(e){if(!zP(e))return null;try{return JSON.parse(e)}catch{return null}}function PP(e){return e.toLowerCase().replace(/[^a-z0-9]/g,"")}function OP(e){for(let t=e.length-1;t>=0;t-=1){const n=e[t]??"";if(!(n.startsWith("[")&&n.endsWith("]")))return n}return null}function MP(e){const t=OP(e);return t===null?!1:gP.has(PP(t))}function LP(e){return e.map(t=>t.startsWith("[")?t:`.${t}`).join("").replace(/^\./,"")}function DP(e,t,n){const r=dl(t);if(r<Yg)return null;const o=ul(t);return o<Jg?null:{role:e.role,label:`${e.label} ${LP(n)}`,path:e.path,tokens:o,characters:r,text:t}}function va({value:e,segment:t,path:n,depth:r,candidates:o}){if(!(o.length>=dP)&&!(r>uP)){if(typeof e=="string"){if(!MP(n))return;const s=DP(t,e,n);s!==null&&o.push(s);return}if(Array.isArray(e)){e.forEach((s,i)=>va({value:s,segment:t,path:[...n,`[${String(i)}]`],depth:r+1,candidates:o}));return}fl(e)&&Object.entries(e).forEach(([s,i])=>va({value:i,segment:t,path:[...n,s],depth:r+1,candidates:o}))}}function FP(e){const t=IP(e),n=RP(e.text);if(n===null)return[t];const r=[];va({value:n,segment:e,path:[],depth:0,candidates:r});const o=ya(e.text),s=new Set([o]),i=r.filter(l=>{const c=ya(l.text);return c===""||s.has(c)?!1:(s.add(c),!0)});return[t,...i]}function $P(e){const t=new Map;for(const r of e){const o=FP(r);for(const s of o){if(s.tokens<Jg||s.characters<Yg)continue;const i=ya(s.text);if(i==="")continue;const l=t.get(i);if(l===void 0){t.set(i,{tokens:s.tokens,candidates:[s]});continue}t.set(i,{tokens:l.tokens+s.tokens,candidates:[...l.candidates,s]})}}const n=[];for(const r of t.values()){if(r.candidates.length<2)continue;const o=r.candidates[0]??null;if(o===null)continue;const s=r.tokens-o.tokens;n.push({key:`${o.path}:${o.label}:${String(r.candidates.length)}:${String(r.tokens)}`,count:r.candidates.length,totalTokens:r.tokens,repeatedTokens:s,preview:TP(o.text),firstLabel:o.label,segments:r.candidates.map(AP)})}return n.sort((r,o)=>o.repeatedTokens-r.repeatedTokens||o.totalTokens-r.totalTokens)}function BP(e){if(e.length===0)return null;const t=e.length,n=e.reduce((o,s)=>o+s.count,0),r=e.reduce((o,s)=>o+s.repeatedTokens,0);return{kind:"duplicate",severity:r>=ba?"danger":"watch",title:"Duplicate context",detail:`${String(n)} repeated blocks across ${String(t)} group${t===1?"":"s"}, ~${String(r)} repeated tokens.`}}function UP(e){return e.reduce((t,n)=>t+n.repeatedTokens,0)}function WP(e,t,n){const r=[],o=e.find(c=>c.role==="tools")??null;o!==null&&(o.tokens>=ba||o.percent>=cP&&o.tokens>=kd)&&r.push({kind:"tool-schema",severity:o.tokens>=ba?"danger":"watch",title:"Large tool schema",detail:`Tool definitions take ${Math.round(o.percent*100)}% of request context.`});const s=e.find(c=>c.role==="system")??null;s!==null&&s.tokens>=kd&&s.percent>=mP&&r.push({kind:"system-heavy",severity:"watch",title:"Large system prompt",detail:`System instructions take ${Math.round(s.percent*100)}% of request context.`});const i=e.filter(c=>c.role==="user"||c.role==="assistant"||c.role==="tool").reduce((c,u)=>c+u.tokens,0),l=t>0?i/t:0;return n>=fP&&(i>=pP||l>=hP)&&r.push({kind:"history-bloat",severity:l>=.85?"danger":"watch",title:"Conversation history growth",detail:`${String(n)} message blocks take ${Math.round(l*100)}% of request context.`}),r}function VP({risk:e,contextWindow:t,diagnostics:n,duplicateGroups:r}){let s=new Set(n.map(c=>c.kind)).size;(e==="watch"||e==="danger")&&(s+=1),t.source==="unknown"&&(s+=1);const i=n.some(c=>c.severity==="danger");return{level:e==="danger"||i?"risk":s>0?"optimizable":"ok",opportunityCount:s,reclaimableTokens:UP(r)}}function HP({segments:e,inputTokens:t,parsed:n,model:r,providers:o=[]}){const s=e.reduce((j,E)=>j+E.size,0),i=r??kP(n),l=t??s,c=Xg(n,bP),u=SP(i,n,o),d=c??0,f=u.tokens===null?null:l+d,h=u.tokens===null?null:u.tokens-l,p=u.tokens===null?null:u.tokens-l-d,y=u.tokens===null||f===null?null:CP(f/u.tokens),m=EP(e,s),g=m[0]??null,b=e.filter(j=>j.role!=="tools").length,v=$P(e),k=BP(v),S=WP(m,s,b);k!==null&&S.unshift(k);const C=jP(y);return{model:i,contextWindow:u,estimatedInputTokens:l,outputReserveTokens:c,windowUsedTokens:f,remainingInputTokens:h,remainingAfterReserveTokens:p,usagePercent:y,riskLevel:C,roleUsages:m,largestRole:g,diagnostics:S,duplicateGroups:v,health:VP({risk:C,contextWindow:u,diagnostics:S,duplicateGroups:v})}}const zO={watch:Kg,danger:Gg};function ZP(e){if(e===null)return null;try{return JSON.parse(e)}catch{return null}}function qP(e){return{role:e.role,label:e.label,size:e.tokens,characters:e.tokens*4,text:"",path:`role:${e.role}`}}function KP(e,t){const n=ZP(e.rawRequestBody);if(n===null)return null;const o=ym(In(e)).anatomySegments(n);if(o===null)return null;const s=HP({segments:o,inputTokens:e.inputTokens??null,parsed:n,model:e.model,providers:t}),i=s.model??e.model??"Unknown model",l=s.roleUsages.map(qP);return{logId:e.id,model:i,timestamp:e.timestamp,contextWindow:s.contextWindow,estimatedInputTokens:s.estimatedInputTokens,windowUsedTokens:s.windowUsedTokens,usagePercent:s.usagePercent,riskLevel:s.riskLevel,health:s.health,diagnostics:s.diagnostics.map(c=>c.title),roleSegments:l,roleTotalTokens:l.reduce((c,u)=>c+u.size,0)}}function GP(e,t){return e.usagePercent!==null&&t.usagePercent!==null?e.usagePercent>t.usagePercent:e.usagePercent!==null&&t.usagePercent===null?!0:e.usagePercent===null&&t.usagePercent!==null?!1:e.estimatedInputTokens>t.estimatedInputTokens}function Sd(e){switch(e){case"danger":return 4;case"watch":return 3;case"unknown":return 2;case"ok":return 1}}function JP(e,t){const n=Sd(t.latest.riskLevel)-Sd(e.latest.riskLevel);if(n!==0)return n;const r=e.peak.usagePercent??-1,s=(t.peak.usagePercent??-1)-r;return s!==0?s:t.latest.logId-e.latest.logId}function YP(e,t){return e.usagePercent===null||t.usagePercent===null?null:(t.usagePercent-e.usagePercent)*100}function XP(e,t=[]){const n=[...e].sort((s,i)=>s.id-i.id),r=new Map;for(const s of n){const i=KP(s,t);if(i===null)continue;const l=r.get(i.model);if(l===void 0){r.set(i.model,{model:i.model,requestCount:1,first:i,latest:i,peak:i});continue}r.set(i.model,{model:l.model,requestCount:l.requestCount+1,first:l.first,latest:i,peak:GP(i,l.peak)?i:l.peak})}return{models:[...r.values()].map(s=>({model:s.model,requestCount:s.requestCount,first:s.first,latest:s.latest,peak:s.peak,trendPercent:YP(s.first,s.latest)})).sort(JP)}}function Ao(e){return e.length<=30?e:`${e.slice(0,12)}...${e.slice(-12)}`}function QP(e){return e==="full"}function eO(e,t){const n=t>0;return{redacted:n,raw:n&&QP(e)}}function Cd(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 tO(e,t){const n=e[0],r=e[e.length-1];return n===void 0||r===void 0?null:Da(n.timestamp,r.timestamp,t)}function nO(e){for(const t of e)if(t.userAgent!==null&&t.userAgent!==void 0&&t.userAgent!=="")return t.userAgent;return null}function rO({pinnedSessionId:e,selectedSession:t,sessions:n,logs:r}){if(e!==void 0){const i=r.filter(l=>l.sessionId===e);return i.length===0?null:{label:e,logs:i,showBackLink:!0}}if(t!=="__all__"){const i=r.filter(l=>l.sessionId===t);return i.length===0?null:{label:t,logs:i,showBackLink:!0}}const o=n.length===1?n[0]??null:null;return o!==null&&r.every(l=>l.sessionId===o)?{label:o,logs:[...r],showBackLink:!1}:n.length===0&&r.length>0&&r.every(i=>i.sessionId===null)?{label:"Visible requests",logs:[...r],showBackLink:!1}:null}function Or(e){if(e===null)return"Unknown";const t=e*100;return t>=10?`${t.toFixed(0)}%`:t>=1?`${t.toFixed(1)}%`:t>0?"<1%":"0%"}function oO(e){return e===null?"n/a":Math.abs(e)<.1?"0%":`${e>0?"+":""}${e.toFixed(1)}%`}function wa(e){return e===null||!Number.isFinite(e)?0:Math.min(Math.max(e*100,0),100)}function sO(e,t){if(t===null)return null;const n=wa(e),r=wa(t);return r<=0||Math.abs(r-n)<.5?null:r}function iO(e){switch(e){case"danger":return"bg-red-400";case"watch":return"bg-amber-300";case"unknown":return"bg-muted-foreground/50";case"ok":return"bg-emerald-400"}}function aO(e){const t=e.latest.contextWindow.tokens;return t===null?"Context window unknown":`Context window ${Gf(t)}`}function lO(e){return`${e} ${e===1?"request":"requests"}`}function jd(e){return`#${String(e)}`}function Nd(e){switch(e){case"danger":return"text-red-300";case"watch":return"text-amber-200";case"unknown":return"text-muted-foreground";case"ok":return"text-emerald-300"}}function cO(e){switch(e){case"risk":return"border-red-400/30 bg-red-500/10 text-red-100";case"optimizable":return"border-amber-400/25 bg-amber-400/8 text-amber-100";case"ok":return"border-emerald-400/25 bg-emerald-400/8 text-emerald-100"}}function uO(e){switch(e){case"risk":return"Risk";case"optimizable":return"Optimizable";case"ok":return"OK"}}const dO=10,fO=80;function pO(e){e.setAttribute("data-deep-link-highlight","true"),window.setTimeout(()=>{e.removeAttribute("data-deep-link-highlight")},1800)}function hO(e){const t=document.getElementById(`log-${String(e)}`);return t instanceof HTMLElement?(t.scrollIntoView({block:"center",behavior:"smooth"}),t.focus({preventScroll:!0}),pO(t),!0):!1}function Qg(e){fa({logId:e,tab:"anatomy"});let t=0;const n=()=>{fa({logId:e,tab:"anatomy"}),!hO(e)&&(t+=1,t<dO&&window.setTimeout(n,fO))};window.setTimeout(n,0)}function Ed({command:e}){const[t,n]=x.useState(!1),r=x.useCallback(()=>{window.navigator.clipboard.writeText(e).then(()=>{n(!0),setTimeout(()=>n(!1),2e3)})},[e]);return a.jsxs("div",{className:"inline-flex items-center gap-2 bg-muted rounded-md px-3 py-2",children:[a.jsx("pre",{className:"text-blue-500 font-mono text-sm m-0",children:e}),a.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?a.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:a.jsx("path",{d:"M20 6 9 17l-5-5"})}):a.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[a.jsx("rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2"}),a.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 mO(){return a.jsx(tt,{children:a.jsxs(Fe,{children:[a.jsx($e,{asChild:!0,children:a.jsxs("span",{className:"inline-flex h-7 items-center gap-2 rounded-md border border-cyan-400/30 bg-cyan-500/10 px-2.5 font-mono text-[11px] font-medium text-cyan-300 shadow-[0_0_16px_rgba(34,211,238,0.08)]",children:[a.jsx("span",{className:"size-1.5 rounded-full bg-emerald-300 shadow-[0_0_8px_rgba(110,231,183,0.8)]"}),"MCP Ready",a.jsx("span",{className:"hidden text-cyan-200/70 sm:inline",children:"/api/mcp"})]})}),a.jsx(Be,{sideOffset:8,className:"max-w-[320px] text-left leading-relaxed",children:"Coding agents can inspect logs, replay requests, test providers, and debug sessions through MCP at /api/mcp."})]})})}function Td({label:e,logId:t}){return a.jsxs("button",{type:"button",onClick:()=>Qg(t),className:"inline-flex h-5 items-center rounded px-1 font-mono text-[10px] text-muted-foreground transition-colors hover:bg-muted hover:text-foreground",title:`Open Context for ${jd(t)}`,children:[e," ",jd(t)]})}function gO({latestPercent:e,peakPercent:t,risk:n,onOpenContext:r}){const o=wa(e),s=sO(e,t),i=t===null?`Latest context window usage ${Or(e)}`:`Latest context window usage ${Or(e)}, peak ${Or(t)}`;return a.jsx("button",{type:"button",onClick:r,className:"group block w-full rounded-full focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1","aria-label":`${i}. Open latest Context details`,title:"Open latest Context details",children:a.jsxs("span",{className:"relative block h-2.5 overflow-hidden rounded-full border border-border/70 bg-background transition-colors group-hover:border-foreground/30",role:"meter","aria-label":i,"aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":Math.round(o),children:[a.jsx("span",{className:ve("block h-full rounded-full transition-[width]",iO(n)),style:{width:`${o}%`}}),s!==null&&a.jsx("span",{className:"absolute top-0 h-full w-0.5 rounded-full bg-amber-100/75 shadow-[0_0_0_1px_rgba(0,0,0,0.25)]",style:{left:`calc(${s}% - 0.5px)`},"aria-hidden":"true"})]})})}function xO({summary:e}){const t=e.trendPercent,n=t===null||Math.abs(t)<.1?null:t>0?Lv:Iv,r=e.latest.diagnostics[0]??null,o=Or(e.latest.usagePercent),s=Or(e.peak.usagePercent),i=()=>{Qg(e.latest.logId)};return a.jsxs("div",{className:"grid gap-x-4 gap-y-2 border-t border-border/60 py-2 first:border-t-0 lg:grid-cols-[minmax(180px,1fr)_minmax(260px,1fr)_minmax(260px,1.4fr)]",children:[a.jsxs("div",{className:"min-w-0",children:[a.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[a.jsx("button",{type:"button",onClick:i,className:"min-w-0 truncate rounded-sm text-left font-mono font-semibold text-foreground transition-colors hover:text-cyan-200 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1",title:`Open latest Context for ${e.model}`,children:e.model}),a.jsx("span",{className:ve("inline-flex h-5 shrink-0 items-center rounded border px-1.5 font-mono text-[10px]",cO(e.latest.health.level)),children:uO(e.latest.health.level)})]}),a.jsxs("div",{className:"mt-1 flex min-w-0 flex-wrap items-center gap-x-2 gap-y-1 text-[11px] text-muted-foreground",children:[a.jsx("span",{children:lO(e.requestCount)}),a.jsx("span",{children:aO(e)})]})]}),a.jsxs("div",{className:"min-w-0 space-y-2 text-xs",children:[a.jsx(gO,{latestPercent:e.latest.usagePercent,peakPercent:e.peak.usagePercent,risk:e.latest.riskLevel,onOpenContext:i}),a.jsxs("div",{className:"grid grid-cols-3 gap-2",children:[a.jsxs("div",{className:"min-w-0",children:[a.jsx("div",{className:"text-[10px] uppercase text-muted-foreground",children:"Latest"}),a.jsx("div",{className:ve("mt-0.5 font-mono",Nd(e.latest.riskLevel)),children:o}),a.jsx(Td,{label:"Log",logId:e.latest.logId})]}),a.jsxs("div",{className:"min-w-0",children:[a.jsx("div",{className:"text-[10px] uppercase text-muted-foreground",children:"Peak"}),a.jsx("div",{className:ve("mt-0.5 font-mono",Nd(e.peak.riskLevel)),children:s}),a.jsx(Td,{label:"Log",logId:e.peak.logId})]}),a.jsxs("div",{className:"min-w-0",children:[a.jsx("div",{className:"text-[10px] uppercase text-muted-foreground",children:"Trend"}),a.jsxs("div",{className:"mt-0.5 flex items-center gap-1 font-mono text-foreground",children:[n!==null&&a.jsx(n,{className:ve("size-3",t!==null&&t>0?"text-amber-300":"text-emerald-300")}),oO(t)]}),a.jsx("div",{className:"h-5","aria-hidden":"true"})]})]})]}),a.jsxs("div",{className:"min-w-0 space-y-1.5",children:[a.jsx(lP,{segments:e.latest.roleSegments,totalTokens:e.latest.roleTotalTokens,showLabels:!1}),a.jsxs("div",{className:"flex min-w-0 flex-wrap items-center gap-x-2 gap-y-1 text-[11px] text-muted-foreground",children:[a.jsxs("span",{className:"font-mono",children:["~",He(e.latest.estimatedInputTokens)," input"]}),e.latest.windowUsedTokens!==null&&a.jsxs("span",{className:"font-mono",children:["~",He(e.latest.windowUsedTokens)," used"]}),r!==null&&a.jsx("span",{className:"truncate",children:r})]})]})]})}function bO({summary:e}){return e.models.length===0?null:a.jsxs("div",{className:"mt-3 border-t border-border/70 pt-2",children:[a.jsxs("div",{className:"mb-1 flex items-center justify-between gap-2",children:[a.jsx("div",{className:"text-[11px] font-semibold uppercase tracking-normal text-muted-foreground",children:"Session Context"}),a.jsxs("div",{className:"font-mono text-[10px] text-muted-foreground",children:[e.models.length," model",e.models.length===1?"":"s"]})]}),a.jsx("div",{className:"max-h-52 overflow-y-auto pr-1",children:e.models.map(t=>a.jsx(xO,{summary:t},t.model))})]})}function yO({label:e,logs:t,totalIn:n,totalOut:r,timeDisplayFormat:o,contextSummary:s,showBackLink:i}){const[l,c]=x.useState(!1),u=x.useMemo(()=>tO(t,o),[t,o]),d=x.useMemo(()=>nO(t),[t]),f=x.useCallback(()=>{window.navigator.clipboard.writeText(window.location.href).then(()=>{c(!0),setTimeout(()=>c(!1),2e3)})},[]);return a.jsxs("div",{className:"mb-4 border border-border rounded-md bg-muted/20 px-3 py-2 text-xs",children:[a.jsxs("div",{className:"flex items-center gap-3",children:[i&&a.jsx("a",{href:"/",className:"inline-flex size-8 shrink-0 items-center justify-center rounded-md text-muted-foreground transition-colors hover:bg-muted hover:text-foreground","aria-label":"Back to all sessions",title:"Back to all sessions",children:a.jsx(Ov,{className:"size-3.5"})}),a.jsxs("div",{className:"min-w-0 flex-1",children:[a.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[a.jsx("span",{className:"font-mono font-semibold text-purple-400/90 truncate",title:e,children:Ao(e)}),d!==null&&a.jsx("span",{className:"font-mono text-muted-foreground truncate max-w-[220px]",title:d,children:d})]}),a.jsxs("div",{className:"mt-1 flex flex-wrap items-center gap-x-3 gap-y-1 text-muted-foreground",children:[a.jsxs("span",{children:[t.length," request",t.length!==1?"s":""]}),u!==null&&a.jsx("span",{children:u}),(n>0||r>0)&&a.jsxs("span",{className:"font-mono",children:[He(n)," in / ",He(r)," out"]})]})]}),a.jsx("button",{type:"button",onClick:f,className:"inline-flex size-8 shrink-0 items-center justify-center rounded-md text-muted-foreground transition-colors hover:bg-muted hover:text-foreground","aria-label":l?"Copied session link":"Copy session link",title:l?"Copied session link":"Copy session link",children:l?a.jsx(rt,{className:"size-3.5"}):a.jsx(_t,{className:"size-3.5"})})]}),a.jsx(bO,{summary:s})]})}function vO({logs:e,sessions:t,models:n,selectedSession:r,selectedModel:o,onSessionChange:s,onModelChange:i,onClearAll:l,onClearGroup:c,viewMode:u,onViewModeChange:d,captureMode:f,strip:h,slowResponseThresholdSeconds:p,timeDisplayFormat:y,hideSessionFilter:m=!1,pinnedSessionId:g}){const{totalIn:b,totalOut:v}=x.useMemo(()=>Cd(e),[e]),{providers:k}=Jf(),[S,C]=x.useState(null),[j,E]=x.useState(null),[T,z]=x.useState(null),[O,B]=x.useState("hidden"),N=x.useRef(null),D=x.useRef(null);nP(N,D,{pageWide:!0}),x.useEffect(()=>{const pe=50+Ur.length*400,he=setTimeout(()=>B("playing"),50),me=setTimeout(()=>B("done"),pe);return()=>{clearTimeout(he),clearTimeout(me)}},[]),x.useEffect(()=>{if(g===void 0){document.title="Agent Inspector";return}const le=e.length===1?"1 req":`${e.length} req`;document.title=`${Ao(g)} - ${le} - Agent Inspector`},[e.length,g]);const w=x.useCallback(async le=>{C(le),E(null);try{const de=await Bw(e,le);de.ok||E(de.message)}finally{C(null)}},[e]);x.useEffect(()=>{z(null)},[r,o]);const L=x.useCallback(()=>{z(null)},[]),W=x.useMemo(()=>pN(e),[e]),U=x.useMemo(()=>rO({pinnedSessionId:g,selectedSession:r,sessions:t,logs:e}),[e,g,r,t]),F=U?.logs??[],K=U!==null&&F.length>0,{totalIn:I,totalOut:H}=x.useMemo(()=>Cd(F),[F]),G=x.useMemo(()=>XP(F,k),[F,k]),R=x.useMemo(()=>HR(W),[W]),ae=x.useMemo(()=>$I(W),[W]),re=eO(f,e.length),fe=x.useCallback(le=>{const de=ae.get(le.id);de!==void 0&&z([de,le])},[ae]);return a.jsxs("div",{className:"max-w-[1400px] xl:max-w-[1600px] 2xl:max-w-[1800px] mx-auto px-6 pb-6",children:[a.jsxs("div",{className:"sticky top-0 z-30 bg-background pt-6",children:[a.jsxs("div",{className:"grid grid-cols-[1fr_auto_1fr] items-start gap-3 pb-8",children:[a.jsx("div",{}),a.jsxs("h1",{className:"flex min-w-0 flex-col items-center gap-2 text-center",children:[a.jsxs("span",{className:"flex max-w-[calc(100vw-7rem)] items-end gap-2 whitespace-nowrap",children:[a.jsxs("span",{className:"flex shrink-0 items-end gap-1 group cursor-default","aria-hidden":"true",children:[a.jsx(xz,{className:"size-10 text-amber-500 transition-all duration-300 group-hover:scale-125 group-hover:-translate-y-1.5"}),a.jsx("span",{className:"hidden items-end gap-0.5 sm:flex",children:Ur.map((le,de)=>{const pe=["text-amber-500","text-rose-500","text-sky-500","text-emerald-500","text-violet-500","text-orange-500","text-cyan-500","text-pink-500","text-lime-500","text-blue-500","text-yellow-500","text-fuchsia-500"][de],he=O==="hidden"?"opacity-0 scale-0":O==="playing"?"animate-crab-piano-pop":"";return a.jsx(le,{className:`size-5 ${pe} transition-all duration-300 ease-out group-hover:scale-125 group-hover:-translate-y-1 ${he}`,style:{transitionDelay:`${de*50}ms`,...O==="playing"?{animationDelay:`${de*400}ms`}:{}}},de)})})]}),a.jsxs("span",{className:"flex min-w-0 items-baseline gap-2 pl-1",children:[a.jsx("span",{className:"truncate text-lg font-bold",children:"Agent Inspector"}),a.jsxs("span",{className:"shrink-0 font-mono text-xs font-semibold text-muted-foreground",children:["v",Mk.version]})]}),a.jsx(Ri,{className:"size-4 shrink-0 text-muted-foreground/70","aria-hidden":"true"}),a.jsx(yz,{className:"size-10 shrink-0"})]}),a.jsx("span",{className:"max-w-[calc(100vw-7rem)] text-sm font-semibold text-muted-foreground",children:"Local First. Evidence First."}),a.jsx(mO,{})]}),a.jsxs("div",{className:"justify-self-end flex items-center gap-1",children:[a.jsx(Zz,{}),a.jsx($R,{})]})]}),K&&U!==null&&a.jsx(yO,{label:U.label,logs:F,totalIn:I,totalOut:H,timeDisplayFormat:y,contextSummary:G,showBackLink:U.showBackLink}),a.jsxs("div",{className:"flex items-center gap-3 mb-4",children:[!m&&a.jsxs(Qo,{value:r,onValueChange:s,children:[a.jsx(ts,{className:"flex-1 max-w-[350px] text-xs",children:a.jsx(es,{placeholder:"All sessions"})}),a.jsxs(ns,{children:[a.jsx(Lt,{value:"__all__",children:"All sessions"}),t.map(le=>a.jsx(Lt,{value:le,children:Ao(le)},le))]})]}),a.jsxs(Qo,{value:o,onValueChange:i,children:[a.jsx(ts,{className:"flex-1 max-w-[250px] text-xs",children:a.jsx(es,{placeholder:"All models"})}),a.jsxs(ns,{children:[a.jsx(Lt,{value:"__all__",children:"All models"}),n.map(le=>a.jsx(Lt,{value:le,children:le},le))]})]}),f==="full"?a.jsxs("div",{className:"flex items-center border border-border rounded-md overflow-hidden",children:[a.jsx("button",{type:"button",onClick:()=>d("simple"),className:`h-8 px-3 cursor-pointer transition-colors text-xs ${u==="simple"?"bg-muted text-foreground":"text-muted-foreground hover:bg-muted/50"}`,children:"Simple"}),a.jsx("button",{type:"button",onClick:()=>d("full"),className:`h-8 px-3 cursor-pointer transition-colors text-xs ${u==="full"?"bg-muted text-foreground":"text-muted-foreground hover:bg-muted/50"}`,children:"Full"})]}):a.jsx("div",{className:"flex h-8 items-center rounded-md border border-border bg-muted px-3 text-xs text-foreground",children:"Simple"}),a.jsx("div",{className:"flex-1"}),!K&&a.jsxs("span",{className:"text-muted-foreground text-xs font-mono",children:[e.length," request",e.length!==1?"s":"",b>0||v>0?` - ${He(b)} in / ${He(v)} out`:""]}),re.redacted&&a.jsx("button",{type:"button",onClick:()=>{w("redacted")},disabled:S!==null,className:"h-8 px-3 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.5 rounded-md hover:bg-muted",title:"Export redacted logs as JSON ZIP",children:S==="redacted"?a.jsx("span",{children:"Exporting..."}):a.jsxs(a.Fragment,{children:[a.jsx(ds,{className:"size-3.5"}),a.jsx("span",{children:"Export"})]})}),re.raw&&a.jsx("button",{type:"button",onClick:()=>{w("raw")},disabled:S!==null,className:"h-8 px-2.5 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.5 rounded-md hover:bg-muted",title:"Export raw logs without redaction",children:S==="raw"?a.jsx("span",{children:"Exporting..."}):a.jsxs(a.Fragment,{children:[a.jsx(y2,{className:"size-3.5"}),a.jsx("span",{children:"Raw"})]})}),a.jsxs("button",{type:"button",onClick:l,className:"h-8 px-3 text-xs text-muted-foreground hover:text-foreground transition-colors cursor-pointer inline-flex items-center gap-1.5 rounded-md hover:bg-muted",title:"Clear all logs",children:[a.jsx(sr,{className:"size-3.5"}),a.jsx("span",{children:"Clear"})]})]}),j!==null&&a.jsx("div",{className:"mb-4 rounded-md border border-destructive/30 bg-destructive/10 px-3 py-2 text-xs text-destructive",children:j})]}),a.jsx("div",{children:e.length===0?r!=="__all__"?a.jsxs("div",{className:"text-center text-muted-foreground py-16 space-y-4",children:[a.jsx("p",{className:"text-sm font-medium",children:"Session not found"}),a.jsx("p",{className:"text-xs font-mono bg-muted px-3 py-1 rounded inline-block max-w-[500px] break-all",children:Ao(r)}),a.jsxs("p",{className:"text-xs",children:["This session may have been cleared or never existed."," ",m?a.jsx("a",{href:"/",className:"underline hover:text-foreground transition-colors",children:"Back to all sessions"}):a.jsx("button",{type:"button",onClick:()=>s("__all__"),className:"underline hover:text-foreground transition-colors",children:"Show all sessions"})]})]}):a.jsxs("div",{className:"text-center text-muted-foreground py-16 space-y-4",children:[a.jsx("p",{className:"text-sm",children:"No requests captured yet."}),a.jsx("p",{className:"text-xs",children:"Route AI coding tools through the proxy:"}),a.jsxs("div",{className:"flex flex-col items-center gap-2",children:[a.jsx(Ed,{command:"ANTHROPIC_BASE_URL=http://localhost:25947/proxy <your-tool>"}),a.jsx(Ed,{command:"OPENAI_BASE_URL=http://localhost:25947/proxy <your-tool>"})]}),a.jsx("p",{className:"mx-auto max-w-xl text-xs leading-relaxed text-muted-foreground",children:"Container note: if your AI tool runs in a different container or host than Agent Inspector, replace localhost with an address reachable from that tool and verify the network/firewall path."})]}):a.jsx("div",{ref:D,tabIndex:0,className:"flex flex-col gap-2 focus:outline-none",children:a.jsx("div",{ref:N,children:a.jsx(JR,{groups:W,viewMode:u,strip:h,slowResponseThresholdSeconds:p,cacheTrends:R,onCompareWithPrevious:fe,comparisonPredecessors:ae,onClearGroup:c,standalone:W.length===1,hasPinnedSessionContext:K,timeDisplayFormat:y})})})}),T!==null&&a.jsx(x.Suspense,{fallback:null,children:a.jsx(JN,{left:T[0],right:T[1],onClose:L})})]})}const wO=rn([te({type:je("init"),logs:we(cc)}),te({type:je("update"),log:cc})]);function kO(e){const t=new Set;for(const n of e)n.sessionId!==null&&n.sessionId!==""&&t.add(n.sessionId);return[...t]}function _O(e){const t=new Set;for(const n of e)n.model!==null&&n.model!==""&&t.add(n.model);return[...t]}function SO(e,t,n){return t==="__all__"&&n==="__all__"?e:e.filter(r=>!(t!=="__all__"&&r.sessionId!==t||n!=="__all__"&&r.model!==n))}const CO=50,jO=12,NO=1800,Ad=500;function EO(e){return e===void 0?"/api/logs/stream":`/api/logs/stream?${new URLSearchParams({sessionId:e}).toString()}`}function Ci(e){const t=new Map;for(let n=0;n<e.length;n++){const r=e[n];r!==void 0&&t.set(r.id,n)}return t}function Id(e){return e.length<=Ad?e:e.slice(e.length-Ad)}function RO({initialSessionId:e}={}){const[t,n]=x.useState([]),[r,o]=x.useState(e??"__all__"),[s,i]=x.useState("__all__"),[l,c]=x.useState("simple"),[u,d]=x.useState(null),f=x.useRef(null),h=x.useRef(null),p=x.useRef(null),y=x.useRef(new Map),m=x.useRef([]),g=x.useRef(null),b=x.useMemo(()=>SO(t,r,s),[t,r,s]),v=x.useMemo(()=>kO(t),[t]),k=x.useMemo(()=>_O(t),[t]),S=x.useCallback(()=>{g.current=null;const D=m.current;m.current=[],D.length!==0&&n(w=>{let L=w;for(const W of D){const U=y.current.get(W.id);U!==void 0?L=[...L.slice(0,U),W,...L.slice(U+1)]:(y.current.set(W.id,L.length),L=[...L,W])}return L=Id(L),y.current=Ci(L),L})},[]),C=x.useCallback(D=>{m.current.push(D),g.current===null&&(g.current=setTimeout(S,CO))},[S]),j=x.useCallback(()=>{f.current&&f.current.close();const D=new EventSource(EO(e));f.current=D,D.onmessage=w=>{try{const L=String(w.data),W=JSON.parse(L),U=wO.safeParse(W);if(!U.success){d("Failed to parse SSE data");return}const F=U.data;if(F.type==="init"){g.current!==null&&(clearTimeout(g.current),g.current=null),m.current=[];const K=Id(F.logs);y.current=Ci(K),n(K),d(null)}else F.type==="update"&&C(F.log)}catch{d("Failed to parse SSE data")}},D.onerror=()=>{d("SSE connection lost, reconnecting..."),D.close(),h.current!==null&&clearTimeout(h.current),h.current=setTimeout(j,3e3)}},[e,C]);x.useEffect(()=>(j(),()=>{f.current&&(f.current.close(),f.current=null),h.current!==null&&(clearTimeout(h.current),h.current=null),g.current!==null&&(clearTimeout(g.current),g.current=null)}),[j]),x.useEffect(()=>{const D=window.location.hash;if(!D.startsWith("#log-")||p.current===D)return;const w=D.slice(1),L=Number(w.replace(/^log-/,""));Number.isInteger(L)&&L>0&&fa({logId:L,tab:"request"});let W=!1,U=0,F=null,K=null;const I=()=>{if(W)return;const H=document.getElementById(w);if(H!==null){p.current=D,H.scrollIntoView({block:"center",behavior:"smooth"}),H instanceof HTMLElement&&(F=H,H.setAttribute("data-deep-link-highlight","true"),K=window.setTimeout(()=>{H.removeAttribute("data-deep-link-highlight")},NO),H.focus({preventScroll:!0}),H.getAttribute("data-nav-action")==="expand"&&H.click());return}U+=1,U<jO&&window.setTimeout(I,100)};return I(),()=>{W=!0,K!==null&&window.clearTimeout(K),F!==null&&F.removeAttribute("data-deep-link-highlight")}},[b.length]);const E=x.useCallback(()=>{e!==void 0&&t.length===0||(async()=>{try{const D=e===void 0?void 0:JSON.stringify({ids:t.map(L=>L.id)});if(!(await fetch("/api/logs",{method:"DELETE",...D===void 0?{}:{headers:{"Content-Type":"application/json"},body:D}})).ok){d("Failed to clear logs");return}y.current.clear(),n([]),d(null)}catch(D){d(D instanceof Error?D.message:"Unknown error clearing logs")}})()},[t,e]),T=x.useCallback(D=>{D.length!==0&&(async()=>{try{if(!(await fetch("/api/logs",{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({ids:D})})).ok){d("Failed to clear group");return}const L=new Set(D);n(W=>{const U=W.filter(F=>!L.has(F.id));return y.current=Ci(U),U}),d(null)}catch(w){d(w instanceof Error?w.message:"Unknown error clearing group")}})()},[]),{strip:z,captureMode:O,slowResponseThresholdSeconds:B,timeDisplayFormat:N}=Ra();return a.jsxs(a.Fragment,{children:[u!==null&&a.jsx("div",{className:"fixed top-4 right-4 bg-destructive text-destructive-foreground px-4 py-2 rounded-md text-sm z-50",children:u}),a.jsx(Ew,{}),a.jsx(vO,{logs:b,sessions:v,models:k,selectedSession:r,selectedModel:s,onSessionChange:o,onModelChange:i,onClearAll:E,onClearGroup:T,viewMode:l,onViewModeChange:c,captureMode:O,strip:z,slowResponseThresholdSeconds:B,timeDisplayFormat:N,hideSessionFilter:e!==void 0,pinnedSessionId:e})]})}export{dI as $,we as A,st as B,u2 as C,zs as D,fa as E,Ze as F,A as G,cc as H,HP as I,uI as J,oP as K,rP as L,$2 as M,Gf as N,zO as O,RO as P,Zt as Q,Q2 as R,lP as S,jm as T,Te as U,qu as V,FE as W,La as X,IO as Y,Nf as Z,$E as _,fN as a,Rf as a0,Nl as a1,Jo as a2,Fr as a3,Lo as a4,zk as a5,Wt as a6,ve as b,ge as c,Ri as d,zf as e,He as f,ym as g,on as h,rt as i,_t as j,Rs as k,Ps as l,Os as m,J2 as n,Nm as o,Tt as p,At as q,In as r,Ae as s,tt as t,Jf as u,Fe as v,$e as w,Be as x,te as y,ie as z};
|