@tonyclaw/agent-inspector 2.0.28 → 2.0.29
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-CicCP3Hb.js → CompareDrawer-DcqxlgSQ.js} +1 -1
- package/.output/public/assets/ProxyViewerContainer-D650kQlv.js +115 -0
- package/.output/public/assets/{ReplayDialog-Bc8q3ujm.js → ReplayDialog-CBcnPgx1.js} +1 -1
- package/.output/public/assets/{RequestAnatomy-Coyy3zcH.js → RequestAnatomy-DSgSqCYt.js} +1 -1
- package/.output/public/assets/{ResponseView-BWJzgh0c.js → ResponseView-CjqzBSoF.js} +1 -1
- package/.output/public/assets/{StreamingChunkSequence-BSC3uuE5.js → StreamingChunkSequence-DdBBKolI.js} +1 -1
- package/.output/public/assets/_sessionId-wctOoGh_.js +1 -0
- package/.output/public/assets/index-BhQGSdhG.js +1 -0
- package/.output/public/assets/{index-DsiKfWCp.css → index-CwlHPmgL.css} +1 -1
- package/.output/public/assets/{main-Brj0Gn91.js → main-B6OLZCp9.js} +2 -2
- package/.output/server/_libs/lucide-react.mjs +13 -13
- package/.output/server/{_sessionId-DDdyKVG-.mjs → _sessionId-CCfKJJ19.mjs} +2 -2
- package/.output/server/_ssr/{CompareDrawer-XSExe2ml.mjs → CompareDrawer-uaPI5R6e.mjs} +2 -2
- package/.output/server/_ssr/{ProxyViewerContainer-B5pIiBZN.mjs → ProxyViewerContainer-BV2nIxXy.mjs} +83 -20
- package/.output/server/_ssr/{ReplayDialog-BOAu0ric.mjs → ReplayDialog-eE2Hy2Nl.mjs} +4 -4
- package/.output/server/_ssr/{RequestAnatomy-C8Q5lozD.mjs → RequestAnatomy-B7vwWo57.mjs} +2 -2
- package/.output/server/_ssr/{ResponseView-a_iJfPUF.mjs → ResponseView-Bm6Qp8mo.mjs} +2 -2
- package/.output/server/_ssr/{StreamingChunkSequence-YMKC0j8U.mjs → StreamingChunkSequence-CbAJKJQx.mjs} +2 -2
- package/.output/server/_ssr/{index-CkDwBPzI.mjs → index-u14_Aj60.mjs} +2 -2
- package/.output/server/_ssr/index.mjs +2 -2
- package/.output/server/_ssr/{router-DXOXdFFM.mjs → router-qgeGUp1k.mjs} +161 -18
- package/.output/server/{_tanstack-start-manifest_v-DPf3uJys.mjs → _tanstack-start-manifest_v-BrfUXnre.mjs} +1 -1
- package/.output/server/index.mjs +66 -66
- package/package.json +1 -1
- package/src/components/ProxyViewer.tsx +3 -0
- package/src/components/providers/ProviderCard.tsx +32 -0
- package/src/components/proxy-viewer/LogEntryHeader.tsx +38 -1
- package/src/lib/providerTestContract.ts +3 -0
- package/src/lib/sessionInfoContract.ts +3 -0
- package/src/mcp/toolHandlers.ts +3 -0
- package/src/proxy/evidenceAnalysis.ts +5 -0
- package/src/proxy/evidenceExporter.ts +8 -3
- package/src/proxy/handler.ts +8 -1
- package/src/proxy/logFinalizer.ts +36 -0
- package/src/proxy/schemas.ts +3 -0
- package/src/proxy/sessionInfo.ts +3 -0
- package/src/proxy/store.ts +3 -0
- package/src/proxy/streamTiming.ts +31 -0
- package/src/routes/api/logs.$id.replay.ts +25 -2
- package/src/routes/api/providers.$providerId.test.log.ts +34 -2
- package/.output/public/assets/ProxyViewerContainer-BccuA6p5.js +0 -115
- package/.output/public/assets/_sessionId-9rEF0uSE.js +0 -1
- package/.output/public/assets/index-B9_VaAWl.js +0 -1
|
@@ -1,115 +0,0 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/CompareDrawer-CicCP3Hb.js","assets/main-Brj0Gn91.js","assets/ReplayDialog-Bc8q3ujm.js","assets/ResponseView-BWJzgh0c.js","assets/RequestAnatomy-Coyy3zcH.js","assets/StreamingChunkSequence-BSC3uuE5.js"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{u as ua,a as pd,r as y,j as a,c as Yr,g as da,b as Br,d as lt,e as hd,f as Eg,h as Ng,_ as Nn}from"./main-Brj0Gn91.js";function ne(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 Hn extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class md extends Error{constructor(t){super(`Encountered unidirectional transform during encode: ${t}`),this.name="ZodEncodeError"}}const gd={};function an(e){return gd}function xd(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 mi(e,t){return typeof t=="bigint"?t.toString():t}function es(e){return{get value(){{const t=e();return Object.defineProperty(this,"value",{value:t}),t}}}}function fa(e){return e==null}function pa(e){const t=e.startsWith("^")?1:0,n=e.endsWith("$")?e.length-1:e.length;return e.slice(t,n)}function Tg(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 Cl=Symbol("evaluating");function Ie(e,t,n){let r;Object.defineProperty(e,t,{get(){if(r!==Cl)return r===void 0&&(r=Cl,r=n()),r},set(o){Object.defineProperty(e,t,{value:o})},configurable:!0})}function Tn(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function fn(...e){const t={};for(const n of e){const r=Object.getOwnPropertyDescriptors(n);Object.assign(t,r)}return Object.defineProperties({},t)}function jl(e){return JSON.stringify(e)}function Ag(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}const yd="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function Ar(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}const Ig=es(()=>{if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{const e=Function;return new e(""),!0}catch{return!1}});function Yn(e){if(Ar(e)===!1)return!1;const t=e.constructor;if(t===void 0||typeof t!="function")return!0;const n=t.prototype;return!(Ar(n)===!1||Object.prototype.hasOwnProperty.call(n,"isPrototypeOf")===!1)}function bd(e){return Yn(e)?{...e}:Array.isArray(e)?[...e]:e}const zg=new Set(["string","number","symbol"]);function Xn(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function pn(e,t,n){const r=new e._zod.constr(t??e._zod.def);return(!t||n?.parent)&&(r._zod.parent=e),r}function we(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 Rg(e){return Object.keys(e).filter(t=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}const Pg={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 Og(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=fn(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 Tn(this,"shape",i),i},checks:[]});return pn(e,s)}function Mg(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=fn(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 Tn(this,"shape",i),i},checks:[]});return pn(e,s)}function Lg(e,t){if(!Yn(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=fn(e._zod.def,{get shape(){const s={...e._zod.def.shape,...t};return Tn(this,"shape",s),s}});return pn(e,o)}function Dg(e,t){if(!Yn(t))throw new Error("Invalid input to safeExtend: expected a plain object");const n=fn(e._zod.def,{get shape(){const r={...e._zod.def.shape,...t};return Tn(this,"shape",r),r}});return pn(e,n)}function Fg(e,t){const n=fn(e._zod.def,{get shape(){const r={...e._zod.def.shape,...t._zod.def.shape};return Tn(this,"shape",r),r},get catchall(){return t._zod.def.catchall},checks:[]});return pn(e,n)}function $g(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=fn(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 Tn(this,"shape",c),c},checks:[]});return pn(t,i)}function Bg(e,t,n){const r=fn(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 Tn(this,"shape",s),s}});return pn(t,r)}function Wn(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 Vn(e,t){return t.map(n=>{var r;return(r=n).path??(r.path=[]),n.path.unshift(e),n})}function Xr(e){return typeof e=="string"?e:e?.message}function ln(e,t,n){const r={...e,path:e.path??[]};if(!e.message){const o=Xr(e.inst?._zod.def?.error?.(e))??Xr(t?.error?.(e))??Xr(n.customError?.(e))??Xr(n.localeError?.(e))??"Invalid input";r.message=o}return delete r.inst,delete r.continue,t?.reportInput||delete r.input,r}function ha(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}function Ir(...e){const[t,n,r]=e;return typeof t=="string"?{message:t,code:"custom",input:n,inst:r}:{...t}}const vd=(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,mi,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},wd=ne("$ZodError",vd),kd=ne("$ZodError",vd,{Parent:Error});function Ug(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 Wg(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 ma=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 Hn;if(i.issues.length){const l=new(o?.Err??e)(i.issues.map(c=>ln(c,s,an())));throw yd(l,o?.callee),l}return i.value},ga=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=>ln(c,s,an())));throw yd(l,o?.callee),l}return i.value},ts=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 Hn;return s.issues.length?{success:!1,error:new(e??wd)(s.issues.map(i=>ln(i,o,an())))}:{success:!0,data:s.value}},Vg=ts(kd),ns=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=>ln(i,o,an())))}:{success:!0,data:s.value}},Hg=ns(kd),Zg=e=>(t,n,r)=>{const o=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return ma(e)(t,n,o)},qg=e=>(t,n,r)=>ma(e)(t,n,r),Kg=e=>async(t,n,r)=>{const o=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return ga(e)(t,n,o)},Jg=e=>async(t,n,r)=>ga(e)(t,n,r),Gg=e=>(t,n,r)=>{const o=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return ts(e)(t,n,o)},Yg=e=>(t,n,r)=>ts(e)(t,n,r),Xg=e=>async(t,n,r)=>{const o=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return ns(e)(t,n,o)},Qg=e=>async(t,n,r)=>ns(e)(t,n,r),ex=/^[cC][^\s-]{8,}$/,tx=/^[0-9a-z]+$/,nx=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,rx=/^[0-9a-vA-V]{20}$/,ox=/^[A-Za-z0-9]{27}$/,sx=/^[a-zA-Z0-9_-]{21}$/,ix=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,ax=/^([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})$/,El=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)$/,lx=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,cx="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function ux(){return new RegExp(cx,"u")}const dx=/^(?:(?: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])$/,fx=/^(([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}|:))$/,px=/^((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])$/,hx=/^(([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])$/,mx=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,_d=/^[A-Za-z0-9_-]*$/,gx=/^\+[1-9]\d{6,14}$/,Sd="(?:(?:\\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])))",xx=new RegExp(`^${Sd}$`);function Cd(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 yx(e){return new RegExp(`^${Cd(e)}$`)}function bx(e){const t=Cd({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(`^${Sd}T(?:${r})$`)}const vx=e=>{const t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${t}$`)},wx=/^-?\d+$/,jd=/^-?\d+(?:\.\d+)?$/,kx=/^(?:true|false)$/i,_x=/^null$/i,Sx=/^[^A-Z]*$/,Cx=/^[^a-z]*$/,ut=ne("$ZodCheck",(e,t)=>{var n;e._zod??(e._zod={}),e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),Ed={number:"number",bigint:"bigint",object:"date"},Nd=ne("$ZodCheckLessThan",(e,t)=>{ut.init(e,t);const n=Ed[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})}}),Td=ne("$ZodCheckGreaterThan",(e,t)=>{ut.init(e,t);const n=Ed[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})}}),jx=ne("$ZodCheckMultipleOf",(e,t)=>{ut.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):Tg(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})}}),Ex=ne("$ZodCheckNumberFormat",(e,t)=>{ut.init(e,t),t.format=t.format||"float64";const n=t.format?.includes("int"),r=n?"int":"number",[o,s]=Pg[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=wx)}),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})}}),Nx=ne("$ZodCheckMaxLength",(e,t)=>{var n;ut.init(e,t),(n=e._zod.def).when??(n.when=r=>{const o=r.value;return!fa(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=ha(o);r.issues.push({origin:i,code:"too_big",maximum:t.maximum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),Tx=ne("$ZodCheckMinLength",(e,t)=>{var n;ut.init(e,t),(n=e._zod.def).when??(n.when=r=>{const o=r.value;return!fa(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=ha(o);r.issues.push({origin:i,code:"too_small",minimum:t.minimum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),Ax=ne("$ZodCheckLengthEquals",(e,t)=>{var n;ut.init(e,t),(n=e._zod.def).when??(n.when=r=>{const o=r.value;return!fa(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=ha(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})}}),rs=ne("$ZodCheckStringFormat",(e,t)=>{var n,r;ut.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=()=>{})}),Ix=ne("$ZodCheckRegex",(e,t)=>{rs.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})}}),zx=ne("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=Sx),rs.init(e,t)}),Rx=ne("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=Cx),rs.init(e,t)}),Px=ne("$ZodCheckIncludes",(e,t)=>{ut.init(e,t);const n=Xn(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})}}),Ox=ne("$ZodCheckStartsWith",(e,t)=>{ut.init(e,t);const n=new RegExp(`^${Xn(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})}}),Mx=ne("$ZodCheckEndsWith",(e,t)=>{ut.init(e,t);const n=new RegExp(`.*${Xn(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})}}),Lx=ne("$ZodCheckOverwrite",(e,t)=>{ut.init(e,t),e._zod.check=n=>{n.value=t.tx(n.value)}});class Dx{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
|
-
`).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 Fx={major:4,minor:3,patch:6},He=ne("$ZodType",(e,t)=>{var n;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=Fx;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=Wn(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 Hn;if(d||p instanceof Promise)d=(d??Promise.resolve()).then(async()=>{await p,i.issues.length!==h&&(u||(u=Wn(i,h)))});else{if(i.issues.length===h)continue;u||(u=Wn(i,h))}}return d?d.then(()=>i):i},s=(i,l,c)=>{if(Wn(i))return i.aborted=!0,i;const u=o(l,r,c);if(u instanceof Promise){if(c.async===!1)throw new Hn;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 Hn;return c.then(u=>o(u,r,l))}return o(c,r,l)}}Ie(e,"~standard",()=>({validate:o=>{try{const s=Vg(e,o);return s.success?{value:s.data}:{issues:s.error?.issues}}catch{return Hg(e,o).then(i=>i.success?{value:i.data}:{issues:i.error?.issues})}},vendor:"zod",version:1}))}),xa=ne("$ZodString",(e,t)=>{He.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??vx(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}}),qe=ne("$ZodStringFormat",(e,t)=>{rs.init(e,t),xa.init(e,t)}),$x=ne("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=ax),qe.init(e,t)}),Bx=ne("$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=El(r))}else t.pattern??(t.pattern=El());qe.init(e,t)}),Ux=ne("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=lx),qe.init(e,t)}),Wx=ne("$ZodURL",(e,t)=>{qe.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})}}}),Vx=ne("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=ux()),qe.init(e,t)}),Hx=ne("$ZodNanoID",(e,t)=>{t.pattern??(t.pattern=sx),qe.init(e,t)}),Zx=ne("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=ex),qe.init(e,t)}),qx=ne("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=tx),qe.init(e,t)}),Kx=ne("$ZodULID",(e,t)=>{t.pattern??(t.pattern=nx),qe.init(e,t)}),Jx=ne("$ZodXID",(e,t)=>{t.pattern??(t.pattern=rx),qe.init(e,t)}),Gx=ne("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=ox),qe.init(e,t)}),Yx=ne("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=bx(t)),qe.init(e,t)}),Xx=ne("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=xx),qe.init(e,t)}),Qx=ne("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=yx(t)),qe.init(e,t)}),e0=ne("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=ix),qe.init(e,t)}),t0=ne("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=dx),qe.init(e,t),e._zod.bag.format="ipv4"}),n0=ne("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=fx),qe.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})}}}),r0=ne("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=px),qe.init(e,t)}),o0=ne("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=hx),qe.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 Ad(e){if(e==="")return!0;if(e.length%4!==0)return!1;try{return atob(e),!0}catch{return!1}}const s0=ne("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=mx),qe.init(e,t),e._zod.bag.contentEncoding="base64",e._zod.check=n=>{Ad(n.value)||n.issues.push({code:"invalid_format",format:"base64",input:n.value,inst:e,continue:!t.abort})}});function i0(e){if(!_d.test(e))return!1;const t=e.replace(/[-_]/g,r=>r==="-"?"+":"/"),n=t.padEnd(Math.ceil(t.length/4)*4,"=");return Ad(n)}const a0=ne("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=_d),qe.init(e,t),e._zod.bag.contentEncoding="base64url",e._zod.check=n=>{i0(n.value)||n.issues.push({code:"invalid_format",format:"base64url",input:n.value,inst:e,continue:!t.abort})}}),l0=ne("$ZodE164",(e,t)=>{t.pattern??(t.pattern=gx),qe.init(e,t)});function c0(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 u0=ne("$ZodJWT",(e,t)=>{qe.init(e,t),e._zod.check=n=>{c0(n.value,t.alg)||n.issues.push({code:"invalid_format",format:"jwt",input:n.value,inst:e,continue:!t.abort})}}),Id=ne("$ZodNumber",(e,t)=>{He.init(e,t),e._zod.pattern=e._zod.bag.pattern??jd,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}}),d0=ne("$ZodNumberFormat",(e,t)=>{Ex.init(e,t),Id.init(e,t)}),f0=ne("$ZodBoolean",(e,t)=>{He.init(e,t),e._zod.pattern=kx,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}}),p0=ne("$ZodNull",(e,t)=>{He.init(e,t),e._zod.pattern=_x,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}}),h0=ne("$ZodUnknown",(e,t)=>{He.init(e,t),e._zod.parse=n=>n}),m0=ne("$ZodNever",(e,t)=>{He.init(e,t),e._zod.parse=(n,r)=>(n.issues.push({expected:"never",code:"invalid_type",input:n.value,inst:e}),n)});function Nl(e,t,n){e.issues.length&&t.issues.push(...Vn(n,e.issues)),t.value[n]=e.value}const g0=ne("$ZodArray",(e,t)=>{He.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=>Nl(u,n,i))):Nl(c,n,i)}return s.length?Promise.all(s).then(()=>n):n}});function Co(e,t,n,r,o){if(e.issues.length){if(o&&!(n in r))return;t.issues.push(...Vn(n,e.issues))}e.value===void 0?n in r&&(t.value[n]=void 0):t.value[n]=e.value}function zd(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=Rg(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(n)}}function Rd(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=>Co(p,n,f,t,d))):Co(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 x0=ne("$ZodObject",(e,t)=>{if(He.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=es(()=>zd(t));Ie(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=Ar,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],x=p._zod.optout==="optional",m=p._zod.run({value:u[h],issues:[]},c);m instanceof Promise?d.push(m.then(g=>Co(g,l,h,u,x))):Co(m,l,h,u,x)}return s?Rd(d,u,l,c,r.value,e):d.length?Promise.all(d).then(()=>l):l}}),y0=ne("$ZodObjectJIT",(e,t)=>{x0.init(e,t);const n=e._zod.parse,r=es(()=>zd(t)),o=h=>{const p=new Dx(["shape","payload","ctx"]),x=r.value,m=k=>{const S=jl(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 x.keys)g[k]=`key_${b++}`;p.write("const newResult = {};");for(const k of x.keys){const S=g[k],C=jl(k),N=h[k]?._zod?.optout==="optional";p.write(`const ${S} = ${m(k)};`),N?p.write(`
|
|
5
|
-
if (${S}.issues.length) {
|
|
6
|
-
if (${C} in input) {
|
|
7
|
-
payload.issues = payload.issues.concat(${S}.issues.map(iss => ({
|
|
8
|
-
...iss,
|
|
9
|
-
path: iss.path ? [${C}, ...iss.path] : [${C}]
|
|
10
|
-
})));
|
|
11
|
-
}
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
if (${S}.value === undefined) {
|
|
15
|
-
if (${C} in input) {
|
|
16
|
-
newResult[${C}] = undefined;
|
|
17
|
-
}
|
|
18
|
-
} else {
|
|
19
|
-
newResult[${C}] = ${S}.value;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
`):p.write(`
|
|
23
|
-
if (${S}.issues.length) {
|
|
24
|
-
payload.issues = payload.issues.concat(${S}.issues.map(iss => ({
|
|
25
|
-
...iss,
|
|
26
|
-
path: iss.path ? [${C}, ...iss.path] : [${C}]
|
|
27
|
-
})));
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
if (${S}.value === undefined) {
|
|
31
|
-
if (${C} in input) {
|
|
32
|
-
newResult[${C}] = undefined;
|
|
33
|
-
}
|
|
34
|
-
} else {
|
|
35
|
-
newResult[${C}] = ${S}.value;
|
|
36
|
-
}
|
|
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=Ar,l=!gd.jitless,u=l&&Ig.value,d=t.catchall;let f;e._zod.parse=(h,p)=>{f??(f=r.value);const x=h.value;return i(x)?l&&u&&p?.async===!1&&p.jitless!==!0?(s||(s=o(t.shape)),h=s(h,p),d?Rd([],x,h,p,f,e):h):n(h,p):(h.issues.push({expected:"object",code:"invalid_type",input:x,inst:e}),h)}});function Tl(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=>!Wn(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=>ln(i,r,an())))}),t)}const Pd=ne("$ZodUnion",(e,t)=>{He.init(e,t),Ie(e._zod,"optin",()=>t.options.some(o=>o._zod.optin==="optional")?"optional":void 0),Ie(e._zod,"optout",()=>t.options.some(o=>o._zod.optout==="optional")?"optional":void 0),Ie(e._zod,"values",()=>{if(t.options.every(o=>o._zod.values))return new Set(t.options.flatMap(o=>Array.from(o._zod.values)))}),Ie(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=>pa(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=>Tl(c,o,e,s)):Tl(l,o,e,s)}}),b0=ne("$ZodDiscriminatedUnion",(e,t)=>{t.inclusive=!1,Pd.init(e,t);const n=e._zod.parse;Ie(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=es(()=>{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(!Ar(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)}}),v0=ne("$ZodIntersection",(e,t)=>{He.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])=>Al(n,c,u)):Al(n,s,i)}});function gi(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(Yn(e)&&Yn(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=gi(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=gi(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 Al(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}),Wn(e))return e;const i=gi(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 w0=ne("$ZodRecord",(e,t)=>{He.init(e,t),e._zod.parse=(n,r)=>{const o=n.value;if(!Yn(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(...Vn(u,f.issues)),n.value[u]=f.value})):(d.issues.length&&n.issues.push(...Vn(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"&&jd.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=>ln(f,r,an())),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(...Vn(l,f.issues)),n.value[c.value]=f.value})):(d.issues.length&&n.issues.push(...Vn(l,d.issues)),n.value[c.value]=d.value)}}return s.length?Promise.all(s).then(()=>n):n}}),k0=ne("$ZodEnum",(e,t)=>{He.init(e,t);const n=xd(t.entries),r=new Set(n);e._zod.values=r,e._zod.pattern=new RegExp(`^(${n.filter(o=>zg.has(typeof o)).map(o=>typeof o=="string"?Xn(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}}),_0=ne("$ZodLiteral",(e,t)=>{if(He.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"?Xn(r):r?Xn(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}}),S0=ne("$ZodTransform",(e,t)=>{He.init(e,t),e._zod.parse=(n,r)=>{if(r.direction==="backward")throw new md(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 Hn;return n.value=o,n}});function Il(e,t){return e.issues.length&&t===void 0?{issues:[],value:void 0}:e}const Od=ne("$ZodOptional",(e,t)=>{He.init(e,t),e._zod.optin="optional",e._zod.optout="optional",Ie(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),Ie(e._zod,"pattern",()=>{const n=t.innerType._zod.pattern;return n?new RegExp(`^(${pa(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=>Il(s,n.value)):Il(o,n.value)}return n.value===void 0?n:t.innerType._zod.run(n,r)}}),C0=ne("$ZodExactOptional",(e,t)=>{Od.init(e,t),Ie(e._zod,"values",()=>t.innerType._zod.values),Ie(e._zod,"pattern",()=>t.innerType._zod.pattern),e._zod.parse=(n,r)=>t.innerType._zod.run(n,r)}),j0=ne("$ZodNullable",(e,t)=>{He.init(e,t),Ie(e._zod,"optin",()=>t.innerType._zod.optin),Ie(e._zod,"optout",()=>t.innerType._zod.optout),Ie(e._zod,"pattern",()=>{const n=t.innerType._zod.pattern;return n?new RegExp(`^(${pa(n.source)}|null)$`):void 0}),Ie(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)}),E0=ne("$ZodDefault",(e,t)=>{He.init(e,t),e._zod.optin="optional",Ie(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=>zl(s,t)):zl(o,t)}});function zl(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}const N0=ne("$ZodPrefault",(e,t)=>{He.init(e,t),e._zod.optin="optional",Ie(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))}),T0=ne("$ZodNonOptional",(e,t)=>{He.init(e,t),Ie(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=>Rl(s,e)):Rl(o,e)}});function Rl(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 A0=ne("$ZodCatch",(e,t)=>{He.init(e,t),Ie(e._zod,"optin",()=>t.innerType._zod.optin),Ie(e._zod,"optout",()=>t.innerType._zod.optout),Ie(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=>ln(i,r,an()))},input:n.value}),n.issues=[]),n)):(n.value=o.value,o.issues.length&&(n.value=t.catchValue({...n,error:{issues:o.issues.map(s=>ln(s,r,an()))},input:n.value}),n.issues=[]),n)}}),I0=ne("$ZodPipe",(e,t)=>{He.init(e,t),Ie(e._zod,"values",()=>t.in._zod.values),Ie(e._zod,"optin",()=>t.in._zod.optin),Ie(e._zod,"optout",()=>t.out._zod.optout),Ie(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=>Qr(i,t.in,r)):Qr(s,t.in,r)}const o=t.in._zod.run(n,r);return o instanceof Promise?o.then(s=>Qr(s,t.out,r)):Qr(o,t.out,r)}});function Qr(e,t,n){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},n)}const z0=ne("$ZodReadonly",(e,t)=>{He.init(e,t),Ie(e._zod,"propValues",()=>t.innerType._zod.propValues),Ie(e._zod,"values",()=>t.innerType._zod.values),Ie(e._zod,"optin",()=>t.innerType?._zod?.optin),Ie(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(Pl):Pl(o)}});function Pl(e){return e.value=Object.freeze(e.value),e}const R0=ne("$ZodLazy",(e,t)=>{He.init(e,t),Ie(e._zod,"innerType",()=>t.getter()),Ie(e._zod,"pattern",()=>e._zod.innerType?._zod?.pattern),Ie(e._zod,"propValues",()=>e._zod.innerType?._zod?.propValues),Ie(e._zod,"optin",()=>e._zod.innerType?._zod?.optin??void 0),Ie(e._zod,"optout",()=>e._zod.innerType?._zod?.optout??void 0),e._zod.parse=(n,r)=>e._zod.innerType._zod.run(n,r)}),P0=ne("$ZodCustom",(e,t)=>{ut.init(e,t),He.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=>Ol(s,n,r,e));Ol(o,n,r,e)}});function Ol(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(Ir(o))}}var Ml;class O0{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 M0(){return new O0}(Ml=globalThis).__zod_globalRegistry??(Ml.__zod_globalRegistry=M0());const _r=globalThis.__zod_globalRegistry;function L0(e,t){return new e({type:"string",...we(t)})}function D0(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...we(t)})}function Ll(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...we(t)})}function F0(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...we(t)})}function $0(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...we(t)})}function B0(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...we(t)})}function U0(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...we(t)})}function W0(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...we(t)})}function V0(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...we(t)})}function H0(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...we(t)})}function Z0(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...we(t)})}function q0(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...we(t)})}function K0(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...we(t)})}function J0(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...we(t)})}function G0(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...we(t)})}function Y0(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...we(t)})}function X0(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...we(t)})}function Q0(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...we(t)})}function e1(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...we(t)})}function t1(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...we(t)})}function n1(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...we(t)})}function r1(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...we(t)})}function o1(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...we(t)})}function s1(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...we(t)})}function i1(e,t){return new e({type:"string",format:"date",check:"string_format",...we(t)})}function a1(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...we(t)})}function l1(e,t){return new e({type:"string",format:"duration",check:"string_format",...we(t)})}function c1(e,t){return new e({type:"number",checks:[],...we(t)})}function u1(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...we(t)})}function d1(e,t){return new e({type:"boolean",...we(t)})}function f1(e,t){return new e({type:"null",...we(t)})}function p1(e){return new e({type:"unknown"})}function h1(e,t){return new e({type:"never",...we(t)})}function Dl(e,t){return new Nd({check:"less_than",...we(t),value:e,inclusive:!1})}function Is(e,t){return new Nd({check:"less_than",...we(t),value:e,inclusive:!0})}function Fl(e,t){return new Td({check:"greater_than",...we(t),value:e,inclusive:!1})}function zs(e,t){return new Td({check:"greater_than",...we(t),value:e,inclusive:!0})}function $l(e,t){return new jx({check:"multiple_of",...we(t),value:e})}function Md(e,t){return new Nx({check:"max_length",...we(t),maximum:e})}function jo(e,t){return new Tx({check:"min_length",...we(t),minimum:e})}function Ld(e,t){return new Ax({check:"length_equals",...we(t),length:e})}function m1(e,t){return new Ix({check:"string_format",format:"regex",...we(t),pattern:e})}function g1(e){return new zx({check:"string_format",format:"lowercase",...we(e)})}function x1(e){return new Rx({check:"string_format",format:"uppercase",...we(e)})}function y1(e,t){return new Px({check:"string_format",format:"includes",...we(t),includes:e})}function b1(e,t){return new Ox({check:"string_format",format:"starts_with",...we(t),prefix:e})}function v1(e,t){return new Mx({check:"string_format",format:"ends_with",...we(t),suffix:e})}function or(e){return new Lx({check:"overwrite",tx:e})}function w1(e){return or(t=>t.normalize(e))}function k1(){return or(e=>e.trim())}function _1(){return or(e=>e.toLowerCase())}function S1(){return or(e=>e.toUpperCase())}function C1(){return or(e=>Ag(e))}function j1(e,t,n){return new e({type:"array",element:t,...we(n)})}function E1(e,t,n){return new e({type:"custom",check:"custom",fn:t,...we(n)})}function N1(e){const t=T1(n=>(n.addIssue=r=>{if(typeof r=="string")n.issues.push(Ir(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(Ir(o))}},e(n.value,n)));return t}function T1(e,t){const n=new ut({check:"custom",...we(t)});return n._zod.check=e,n}function Dd(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??_r,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 Ge(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),Ge(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"&&ot(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 Fd(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??(x=>x);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
|
-
|
|
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 $d(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:Eo(t,"input",e.processors),output:Eo(t,"output",e.processors)}},enumerable:!1,writable:!1}),i}catch{throw new Error("Error converting schema to JSON.")}}function ot(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 ot(r.element,n);if(r.type==="set")return ot(r.valueType,n);if(r.type==="lazy")return ot(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 ot(r.innerType,n);if(r.type==="intersection")return ot(r.left,n)||ot(r.right,n);if(r.type==="record"||r.type==="map")return ot(r.keyType,n)||ot(r.valueType,n);if(r.type==="pipe")return ot(r.in,n)||ot(r.out,n);if(r.type==="object"){for(const o in r.shape)if(ot(r.shape[o],n))return!0;return!1}if(r.type==="union"){for(const o of r.options)if(ot(o,n))return!0;return!1}if(r.type==="tuple"){for(const o of r.items)if(ot(o,n))return!0;return!!(r.rest&&ot(r.rest,n))}return!1}const A1=(e,t={})=>n=>{const r=Dd({...n,processors:t});return Ge(e,r),Fd(r,e),$d(r,e)},Eo=(e,t,n={})=>r=>{const{libraryOptions:o,target:s}=r??{},i=Dd({...o??{},target:s,io:t,processors:n});return Ge(e,i),Fd(i,e),$d(i,e)},I1={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},z1=(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=I1[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}))])}},R1=(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)},P1=(e,t,n,r)=>{n.type="boolean"},O1=(e,t,n,r)=>{t.target==="openapi-3.0"?(n.type="string",n.nullable=!0,n.enum=[null]):n.type="null"},M1=(e,t,n,r)=>{n.not={}},L1=(e,t,n,r)=>{},D1=(e,t,n,r)=>{const o=e._zod.def,s=xd(o.entries);s.every(i=>typeof i=="number")&&(n.type="number"),s.every(i=>typeof i=="string")&&(n.type="string"),n.enum=s},F1=(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},$1=(e,t,n,r)=>{if(t.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema")},B1=(e,t,n,r)=>{if(t.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema")},U1=(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=Ge(s.element,t,{...r,path:[...r.path,"items"]})},W1=(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]=Ge(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=Ge(s.catchall,t,{...r,path:[...r.path,"additionalProperties"]})):t.io==="output"&&(o.additionalProperties=!1)},V1=(e,t,n,r)=>{const o=e._zod.def,s=o.inclusive===!1,i=o.options.map((l,c)=>Ge(l,t,{...r,path:[...r.path,s?"oneOf":"anyOf",c]}));s?n.oneOf=i:n.anyOf=i},H1=(e,t,n,r)=>{const o=e._zod.def,s=Ge(o.left,t,{...r,path:[...r.path,"allOf",0]}),i=Ge(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},Z1=(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=Ge(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=Ge(s.keyType,t,{...r,path:[...r.path,"propertyNames"]})),o.additionalProperties=Ge(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)}},q1=(e,t,n,r)=>{const o=e._zod.def,s=Ge(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"}]},K1=(e,t,n,r)=>{const o=e._zod.def;Ge(o.innerType,t,r);const s=t.seen.get(e);s.ref=o.innerType},J1=(e,t,n,r)=>{const o=e._zod.def;Ge(o.innerType,t,r);const s=t.seen.get(e);s.ref=o.innerType,n.default=JSON.parse(JSON.stringify(o.defaultValue))},G1=(e,t,n,r)=>{const o=e._zod.def;Ge(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)))},Y1=(e,t,n,r)=>{const o=e._zod.def;Ge(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},X1=(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;Ge(s,t,r);const i=t.seen.get(e);i.ref=s},Q1=(e,t,n,r)=>{const o=e._zod.def;Ge(o.innerType,t,r);const s=t.seen.get(e);s.ref=o.innerType,n.readOnly=!0},Bd=(e,t,n,r)=>{const o=e._zod.def;Ge(o.innerType,t,r);const s=t.seen.get(e);s.ref=o.innerType},ey=(e,t,n,r)=>{const o=e._zod.innerType;Ge(o,t,r);const s=t.seen.get(e);s.ref=o},ty=ne("ZodISODateTime",(e,t)=>{Yx.init(e,t),Je.init(e,t)});function ny(e){return s1(ty,e)}const ry=ne("ZodISODate",(e,t)=>{Xx.init(e,t),Je.init(e,t)});function oy(e){return i1(ry,e)}const sy=ne("ZodISOTime",(e,t)=>{Qx.init(e,t),Je.init(e,t)});function iy(e){return a1(sy,e)}const ay=ne("ZodISODuration",(e,t)=>{e0.init(e,t),Je.init(e,t)});function ly(e){return l1(ay,e)}const cy=(e,t)=>{wd.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:n=>Wg(e,n)},flatten:{value:n=>Ug(e,n)},addIssue:{value:n=>{e.issues.push(n),e.message=JSON.stringify(e.issues,mi,2)}},addIssues:{value:n=>{e.issues.push(...n),e.message=JSON.stringify(e.issues,mi,2)}},isEmpty:{get(){return e.issues.length===0}}})},bt=ne("ZodError",cy,{Parent:Error}),uy=ma(bt),dy=ga(bt),fy=ts(bt),py=ns(bt),hy=Zg(bt),my=qg(bt),gy=Kg(bt),xy=Jg(bt),yy=Gg(bt),by=Yg(bt),vy=Xg(bt),wy=Qg(bt),Ze=ne("ZodType",(e,t)=>(He.init(e,t),Object.assign(e["~standard"],{jsonSchema:{input:Eo(e,"input"),output:Eo(e,"output")}}),e.toJSONSchema=A1(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.check=(...n)=>e.clone(fn(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)=>pn(e,n,r),e.brand=()=>e,e.register=((n,r)=>(n.add(e,r),e)),e.parse=(n,r)=>uy(e,n,r,{callee:e.parse}),e.safeParse=(n,r)=>fy(e,n,r),e.parseAsync=async(n,r)=>dy(e,n,r,{callee:e.parseAsync}),e.safeParseAsync=async(n,r)=>py(e,n,r),e.spa=e.safeParseAsync,e.encode=(n,r)=>hy(e,n,r),e.decode=(n,r)=>my(e,n,r),e.encodeAsync=async(n,r)=>gy(e,n,r),e.decodeAsync=async(n,r)=>xy(e,n,r),e.safeEncode=(n,r)=>yy(e,n,r),e.safeDecode=(n,r)=>by(e,n,r),e.safeEncodeAsync=async(n,r)=>vy(e,n,r),e.safeDecodeAsync=async(n,r)=>wy(e,n,r),e.refine=(n,r)=>e.check(xb(n,r)),e.superRefine=n=>e.check(yb(n)),e.overwrite=n=>e.check(or(n)),e.optional=()=>Wl(e),e.exactOptional=()=>nb(e),e.nullable=()=>Vl(e),e.nullish=()=>Wl(Vl(e)),e.nonoptional=n=>lb(e,n),e.array=()=>Ce(e),e.or=n=>Qt([e,n]),e.and=n=>Gy(e,n),e.transform=n=>Hl(e,eb(n)),e.default=n=>sb(e,n),e.prefault=n=>ab(e,n),e.catch=n=>ub(e,n),e.pipe=n=>Hl(e,n),e.readonly=()=>pb(e),e.describe=n=>{const r=e.clone();return _r.add(r,{description:n}),r},Object.defineProperty(e,"description",{get(){return _r.get(e)?.description},configurable:!0}),e.meta=(...n)=>{if(n.length===0)return _r.get(e);const r=e.clone();return _r.add(r,n[0]),r},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e.apply=n=>n(e),e)),Ud=ne("_ZodString",(e,t)=>{xa.init(e,t),Ze.init(e,t),e._zod.processJSONSchema=(r,o,s)=>z1(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(m1(...r)),e.includes=(...r)=>e.check(y1(...r)),e.startsWith=(...r)=>e.check(b1(...r)),e.endsWith=(...r)=>e.check(v1(...r)),e.min=(...r)=>e.check(jo(...r)),e.max=(...r)=>e.check(Md(...r)),e.length=(...r)=>e.check(Ld(...r)),e.nonempty=(...r)=>e.check(jo(1,...r)),e.lowercase=r=>e.check(g1(r)),e.uppercase=r=>e.check(x1(r)),e.trim=()=>e.check(k1()),e.normalize=(...r)=>e.check(w1(...r)),e.toLowerCase=()=>e.check(_1()),e.toUpperCase=()=>e.check(S1()),e.slugify=()=>e.check(C1())}),ky=ne("ZodString",(e,t)=>{xa.init(e,t),Ud.init(e,t),e.email=n=>e.check(D0(_y,n)),e.url=n=>e.check(W0(Sy,n)),e.jwt=n=>e.check(o1(Fy,n)),e.emoji=n=>e.check(V0(Cy,n)),e.guid=n=>e.check(Ll(Bl,n)),e.uuid=n=>e.check(F0(eo,n)),e.uuidv4=n=>e.check($0(eo,n)),e.uuidv6=n=>e.check(B0(eo,n)),e.uuidv7=n=>e.check(U0(eo,n)),e.nanoid=n=>e.check(H0(jy,n)),e.guid=n=>e.check(Ll(Bl,n)),e.cuid=n=>e.check(Z0(Ey,n)),e.cuid2=n=>e.check(q0(Ny,n)),e.ulid=n=>e.check(K0(Ty,n)),e.base64=n=>e.check(t1(My,n)),e.base64url=n=>e.check(n1(Ly,n)),e.xid=n=>e.check(J0(Ay,n)),e.ksuid=n=>e.check(G0(Iy,n)),e.ipv4=n=>e.check(Y0(zy,n)),e.ipv6=n=>e.check(X0(Ry,n)),e.cidrv4=n=>e.check(Q0(Py,n)),e.cidrv6=n=>e.check(e1(Oy,n)),e.e164=n=>e.check(r1(Dy,n)),e.datetime=n=>e.check(ny(n)),e.date=n=>e.check(oy(n)),e.time=n=>e.check(iy(n)),e.duration=n=>e.check(ly(n))});function W(e){return L0(ky,e)}const Je=ne("ZodStringFormat",(e,t)=>{qe.init(e,t),Ud.init(e,t)}),_y=ne("ZodEmail",(e,t)=>{Ux.init(e,t),Je.init(e,t)}),Bl=ne("ZodGUID",(e,t)=>{$x.init(e,t),Je.init(e,t)}),eo=ne("ZodUUID",(e,t)=>{Bx.init(e,t),Je.init(e,t)}),Sy=ne("ZodURL",(e,t)=>{Wx.init(e,t),Je.init(e,t)}),Cy=ne("ZodEmoji",(e,t)=>{Vx.init(e,t),Je.init(e,t)}),jy=ne("ZodNanoID",(e,t)=>{Hx.init(e,t),Je.init(e,t)}),Ey=ne("ZodCUID",(e,t)=>{Zx.init(e,t),Je.init(e,t)}),Ny=ne("ZodCUID2",(e,t)=>{qx.init(e,t),Je.init(e,t)}),Ty=ne("ZodULID",(e,t)=>{Kx.init(e,t),Je.init(e,t)}),Ay=ne("ZodXID",(e,t)=>{Jx.init(e,t),Je.init(e,t)}),Iy=ne("ZodKSUID",(e,t)=>{Gx.init(e,t),Je.init(e,t)}),zy=ne("ZodIPv4",(e,t)=>{t0.init(e,t),Je.init(e,t)}),Ry=ne("ZodIPv6",(e,t)=>{n0.init(e,t),Je.init(e,t)}),Py=ne("ZodCIDRv4",(e,t)=>{r0.init(e,t),Je.init(e,t)}),Oy=ne("ZodCIDRv6",(e,t)=>{o0.init(e,t),Je.init(e,t)}),My=ne("ZodBase64",(e,t)=>{s0.init(e,t),Je.init(e,t)}),Ly=ne("ZodBase64URL",(e,t)=>{a0.init(e,t),Je.init(e,t)}),Dy=ne("ZodE164",(e,t)=>{l0.init(e,t),Je.init(e,t)}),Fy=ne("ZodJWT",(e,t)=>{u0.init(e,t),Je.init(e,t)}),Wd=ne("ZodNumber",(e,t)=>{Id.init(e,t),Ze.init(e,t),e._zod.processJSONSchema=(r,o,s)=>R1(e,r,o),e.gt=(r,o)=>e.check(Fl(r,o)),e.gte=(r,o)=>e.check(zs(r,o)),e.min=(r,o)=>e.check(zs(r,o)),e.lt=(r,o)=>e.check(Dl(r,o)),e.lte=(r,o)=>e.check(Is(r,o)),e.max=(r,o)=>e.check(Is(r,o)),e.int=r=>e.check(Ul(r)),e.safe=r=>e.check(Ul(r)),e.positive=r=>e.check(Fl(0,r)),e.nonnegative=r=>e.check(zs(0,r)),e.negative=r=>e.check(Dl(0,r)),e.nonpositive=r=>e.check(Is(0,r)),e.multipleOf=(r,o)=>e.check($l(r,o)),e.step=(r,o)=>e.check($l(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 fe(e){return c1(Wd,e)}const $y=ne("ZodNumberFormat",(e,t)=>{d0.init(e,t),Wd.init(e,t)});function Ul(e){return u1($y,e)}const By=ne("ZodBoolean",(e,t)=>{f0.init(e,t),Ze.init(e,t),e._zod.processJSONSchema=(n,r,o)=>P1(e,n,r)});function nt(e){return d1(By,e)}const Uy=ne("ZodNull",(e,t)=>{p0.init(e,t),Ze.init(e,t),e._zod.processJSONSchema=(n,r,o)=>O1(e,n,r)});function xi(e){return f1(Uy,e)}const Wy=ne("ZodUnknown",(e,t)=>{h0.init(e,t),Ze.init(e,t),e._zod.processJSONSchema=(n,r,o)=>L1()});function yi(){return p1(Wy)}const Vy=ne("ZodNever",(e,t)=>{m0.init(e,t),Ze.init(e,t),e._zod.processJSONSchema=(n,r,o)=>M1(e,n,r)});function Hy(e){return h1(Vy,e)}const Zy=ne("ZodArray",(e,t)=>{g0.init(e,t),Ze.init(e,t),e._zod.processJSONSchema=(n,r,o)=>U1(e,n,r,o),e.element=t.element,e.min=(n,r)=>e.check(jo(n,r)),e.nonempty=n=>e.check(jo(1,n)),e.max=(n,r)=>e.check(Md(n,r)),e.length=(n,r)=>e.check(Ld(n,r)),e.unwrap=()=>e.element});function Ce(e,t){return j1(Zy,e,t)}const qy=ne("ZodObject",(e,t)=>{y0.init(e,t),Ze.init(e,t),e._zod.processJSONSchema=(n,r,o)=>W1(e,n,r,o),Ie(e,"shape",()=>t.shape),e.keyof=()=>Xe(Object.keys(e._zod.def.shape)),e.catchall=n=>e.clone({...e._zod.def,catchall:n}),e.passthrough=()=>e.clone({...e._zod.def,catchall:yi()}),e.loose=()=>e.clone({...e._zod.def,catchall:yi()}),e.strict=()=>e.clone({...e._zod.def,catchall:Hy()}),e.strip=()=>e.clone({...e._zod.def,catchall:void 0}),e.extend=n=>Lg(e,n),e.safeExtend=n=>Dg(e,n),e.merge=n=>Fg(e,n),e.pick=n=>Og(e,n),e.omit=n=>Mg(e,n),e.partial=(...n)=>$g(Hd,e,n[0]),e.required=(...n)=>Bg(Zd,e,n[0])});function le(e,t){const n={type:"object",shape:e??{},...we(t)};return new qy(n)}const Vd=ne("ZodUnion",(e,t)=>{Pd.init(e,t),Ze.init(e,t),e._zod.processJSONSchema=(n,r,o)=>V1(e,n,r,o),e.options=t.options});function Qt(e,t){return new Vd({type:"union",options:e,...we(t)})}const Ky=ne("ZodDiscriminatedUnion",(e,t)=>{Vd.init(e,t),b0.init(e,t)});function An(e,t,n){return new Ky({type:"union",options:t,discriminator:e,...we(n)})}const Jy=ne("ZodIntersection",(e,t)=>{v0.init(e,t),Ze.init(e,t),e._zod.processJSONSchema=(n,r,o)=>H1(e,n,r,o)});function Gy(e,t){return new Jy({type:"intersection",left:e,right:t})}const Yy=ne("ZodRecord",(e,t)=>{w0.init(e,t),Ze.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Z1(e,n,r,o),e.keyType=t.keyType,e.valueType=t.valueType});function Nt(e,t,n){return new Yy({type:"record",keyType:e,valueType:t,...we(n)})}const bi=ne("ZodEnum",(e,t)=>{k0.init(e,t),Ze.init(e,t),e._zod.processJSONSchema=(r,o,s)=>D1(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 bi({...t,checks:[],...we(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 bi({...t,checks:[],...we(o),entries:s})}});function Xe(e,t){const n=Array.isArray(e)?Object.fromEntries(e.map(r=>[r,r])):e;return new bi({type:"enum",entries:n,...we(t)})}const Xy=ne("ZodLiteral",(e,t)=>{_0.init(e,t),Ze.init(e,t),e._zod.processJSONSchema=(n,r,o)=>F1(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 Xy({type:"literal",values:Array.isArray(e)?e:[e],...we(t)})}const Qy=ne("ZodTransform",(e,t)=>{S0.init(e,t),Ze.init(e,t),e._zod.processJSONSchema=(n,r,o)=>B1(e,n),e._zod.parse=(n,r)=>{if(r.direction==="backward")throw new md(e.constructor.name);n.addIssue=s=>{if(typeof s=="string")n.issues.push(Ir(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(Ir(i))}};const o=t.transform(n.value,n);return o instanceof Promise?o.then(s=>(n.value=s,n)):(n.value=o,n)}});function eb(e){return new Qy({type:"transform",transform:e})}const Hd=ne("ZodOptional",(e,t)=>{Od.init(e,t),Ze.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Bd(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function Wl(e){return new Hd({type:"optional",innerType:e})}const tb=ne("ZodExactOptional",(e,t)=>{C0.init(e,t),Ze.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Bd(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function nb(e){return new tb({type:"optional",innerType:e})}const rb=ne("ZodNullable",(e,t)=>{j0.init(e,t),Ze.init(e,t),e._zod.processJSONSchema=(n,r,o)=>q1(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function Vl(e){return new rb({type:"nullable",innerType:e})}const ob=ne("ZodDefault",(e,t)=>{E0.init(e,t),Ze.init(e,t),e._zod.processJSONSchema=(n,r,o)=>J1(e,n,r,o),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function sb(e,t){return new ob({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():bd(t)}})}const ib=ne("ZodPrefault",(e,t)=>{N0.init(e,t),Ze.init(e,t),e._zod.processJSONSchema=(n,r,o)=>G1(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function ab(e,t){return new ib({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():bd(t)}})}const Zd=ne("ZodNonOptional",(e,t)=>{T0.init(e,t),Ze.init(e,t),e._zod.processJSONSchema=(n,r,o)=>K1(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function lb(e,t){return new Zd({type:"nonoptional",innerType:e,...we(t)})}const cb=ne("ZodCatch",(e,t)=>{A0.init(e,t),Ze.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Y1(e,n,r,o),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function ub(e,t){return new cb({type:"catch",innerType:e,catchValue:typeof t=="function"?t:()=>t})}const db=ne("ZodPipe",(e,t)=>{I0.init(e,t),Ze.init(e,t),e._zod.processJSONSchema=(n,r,o)=>X1(e,n,r,o),e.in=t.in,e.out=t.out});function Hl(e,t){return new db({type:"pipe",in:e,out:t})}const fb=ne("ZodReadonly",(e,t)=>{z0.init(e,t),Ze.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Q1(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function pb(e){return new fb({type:"readonly",innerType:e})}const hb=ne("ZodLazy",(e,t)=>{R0.init(e,t),Ze.init(e,t),e._zod.processJSONSchema=(n,r,o)=>ey(e,n,r,o),e.unwrap=()=>e._zod.def.getter()});function mb(e){return new hb({type:"lazy",getter:e})}const gb=ne("ZodCustom",(e,t)=>{P0.init(e,t),Ze.init(e,t),e._zod.processJSONSchema=(n,r,o)=>$1(e,n)});function xb(e,t={}){return E1(gb,e,t)}function yb(e){return N1(e)}const Qn=mb(()=>Qt([W(),fe(),nt(),xi(),Ce(Qn),Nt(W(),Qn)]));const ya=le({type:W(),ttl:W().optional(),scope:W().optional()}),ba=le({type:je("text"),text:W(),cache_control:ya.optional()}),qd=le({type:je("thinking"),thinking:W(),signature:W().optional()}),bb=le({type:je("think"),thinking:W(),signature:W().optional()}),vb=le({type:je("base64"),media_type:W(),data:W()}),Kd=le({type:je("image"),source:vb}),Jd=le({type:je("tool_use"),id:W(),name:W(),input:Nt(W(),Qn)}),wb=An("type",[ba,Kd]),kb=le({type:je("tool_result"),tool_use_id:W().optional(),content:Qt([W(),Ce(wb)]),is_error:nt().optional()}),_b=An("type",[ba,qd,Kd,Jd,kb]),Sb=Qt([W(),Ce(_b)]),Cb=le({role:Xe(["user","assistant"]),content:Sb}),jb=le({type:je("text"),text:W(),cache_control:ya.optional()}),Eb=le({type:W(),properties:Nt(W(),Nt(W(),Qn)).optional(),required:Ce(W()).optional(),additionalProperties:nt().optional(),$schema:W().optional()}),Nb=le({name:W(),description:W().optional(),input_schema:Eb.optional(),cache_control:ya.optional()}),Tb=An("type",[le({type:je("enabled"),budget_tokens:fe()}),le({type:je("disabled")}),le({type:je("adaptive")})]),Gd=le({model:W(),messages:Ce(Cb),system:Ce(jb).optional(),tools:Ce(Nb).optional(),max_tokens:fe().optional(),temperature:fe().optional(),stream:nt().optional(),thinking:Tb.optional(),metadata:le({user_id:W().optional()}).optional()}),va=An("type",[ba,qd,bb,Jd]),Ab=le({input_tokens:fe().nullable().optional(),output_tokens:fe().nullable().optional(),cache_creation_input_tokens:fe().nullable().optional(),cache_read_input_tokens:fe().nullable().optional()}).passthrough(),Yd=le({id:W(),type:je("message"),model:W(),role:je("assistant"),content:Ce(va),stop_reason:W().nullable(),stop_sequence:W().nullable().optional(),usage:Ab}).passthrough(),Ib=le({type:je("message_start"),message:le({id:W(),type:je("message"),model:W(),role:je("assistant"),content:Ce(va),stop_reason:xi(),stop_sequence:xi(),usage:le({input_tokens:fe(),cache_creation_input_tokens:fe().optional(),cache_read_input_tokens:fe().optional()}).passthrough()})}),zb=le({type:je("content_block_start"),index:fe(),content_block:va}),Rb=An("type",[le({type:je("text_delta"),text:W()}),le({type:je("input_json_delta"),partial_json:W()}),le({type:je("thinking_delta"),thinking:W()}),le({type:je("signature_delta"),signature:W()})]),Pb=le({type:je("content_block_delta"),index:fe(),delta:Rb}),Ob=le({type:je("content_block_stop"),index:fe()}),Mb=le({type:je("message_delta"),delta:le({stop_reason:W().nullable(),stop_sequence:W().nullable().optional()}),usage:le({output_tokens:fe(),input_tokens:fe().optional(),cache_creation_input_tokens:fe().optional(),cache_read_input_tokens:fe().optional()}).passthrough()}),Lb=le({type:je("message_stop")}),Db=le({type:je("ping")}),Fb=le({type:je("error"),error:le({type:W(),message:W()})}),$b=An("type",[Ib,zb,Pb,Ob,Mb,Lb,Db,Fb]),Bb=Qt([W(),Ce(An("type",[le({type:je("text"),text:W()}),le({type:je("image_url"),image_url:le({url:W(),detail:W().optional()})})]))]),Xd=le({role:Xe(["system","user","assistant","tool"]),content:Bb,name:W().optional(),reasoning_content:W().optional(),thinking:W().optional(),think:W().optional()}),Ub=le({name:W(),arguments:W()}),Qd=le({index:fe().optional(),id:W().optional(),type:je("function").optional(),function:le({name:W().optional(),arguments:W().optional()})});Xd.extend({content:Qt([W(),Ce(le({type:je("text"),text:W()}))]).optional(),function_call:Ub.optional(),tool_calls:Ce(Qd).optional()});const Wb=le({type:je("function"),function:le({name:W(),description:W().optional(),parameters:Nt(W(),Qn)})}),ef=le({model:W(),messages:Ce(Xd),temperature:fe().optional(),max_tokens:fe().optional(),stream:nt().optional(),tools:Ce(Wb).optional(),tool_choice:Qt([Xe(["auto","none","required"]),le({type:je("auto")}),le({type:je("none")}),le({type:je("function"),function:le({name:W()})})]).optional(),user:W().optional()}),tf=le({role:Xe(["assistant"]).optional(),content:W().nullable().optional(),reasoning_content:W().nullable().optional(),thinking:W().nullable().optional(),think:W().nullable().optional(),function_call:le({name:W().optional(),arguments:W().optional()}).nullable().optional(),tool_calls:Ce(le({index:fe(),id:W().optional(),type:je("function").optional(),function:le({name:W().optional(),arguments:W().optional()})})).nullable().optional()}),Vb=le({index:fe(),message:le({role:Xe(["assistant"]),content:W().nullable(),reasoning_content:W().optional(),thinking:W().optional(),think:W().optional(),function_call:le({name:W(),arguments:W()}).nullable().optional(),tool_calls:Ce(Qd).optional()}).optional(),delta:tf.optional(),finish_reason:W().nullable()}),Hb=le({id:W(),object:je("chat.completion"),created:fe(),model:W(),choices:Ce(Vb),usage:le({prompt_tokens:fe().nullable().optional(),completion_tokens:fe().nullable().optional(),total_tokens:fe().nullable().optional()}).passthrough(),service_tier:W().nullable().optional(),system_fingerprint:W().nullable().optional()}).passthrough(),Zb=le({id:W(),object:je("chat.completion.chunk"),created:fe(),model:W(),choices:Ce(le({index:fe(),delta:tf,finish_reason:W().nullable().optional()})),usage:le({prompt_tokens:fe().nullable().optional(),completion_tokens:fe().nullable().optional(),total_tokens:fe().nullable().optional()}).passthrough().nullable().optional()}).passthrough();function nf(e){try{const t=JSON.parse(e),n=Hb.safeParse(t);return n.success?n.data:null}catch{return null}}const rf=le({index:fe(),timestamp:fe(),type:W(),data:Qn}),qb=le({chunks:Ce(rf),truncated:nt().optional().default(!1)}),Zl=le({id:fe(),timestamp:W(),method:W(),path:W(),model:W().nullable(),sessionId:W().nullable(),rawRequestBody:W().nullable(),responseStatus:fe().nullable(),responseText:W().nullable(),inputTokens:fe().nullable(),outputTokens:fe().nullable(),cacheCreationInputTokens:fe().nullable(),cacheReadInputTokens:fe().nullable(),elapsedMs:fe().nullable(),streaming:nt(),userAgent:W().nullable(),origin:W().nullable(),rawHeaders:Nt(W(),W()).optional(),headers:Nt(W(),W()).optional(),apiFormat:Xe(["anthropic","openai","unknown"]).default("unknown"),isTest:nt().optional().default(!1),replayOfLogId:fe().nullable().optional(),providerName:W().nullable().optional(),clientPort:fe().nullable().optional(),clientPid:fe().nullable().optional(),clientCwd:W().nullable().optional(),clientProjectFolder:W().nullable().optional(),streamingChunks:qb.optional(),streamingChunksPath:W().nullable().optional(),rawRequestBodyBytes:fe().int().nonnegative().nullable().optional(),responseTextBytes:fe().int().nonnegative().nullable().optional(),bodyContentMode:Xe(["full","compact","truncated"]).optional(),error:W().nullable().optional()});le({model:W()});le({model:W().optional(),metadata:le({user_id:W().optional()}).passthrough().optional()});const Kb=le({error:W()});async function Jt(e,t){const n=await e.json();return t.parse(n)}async function wn(e,t){try{const n=await e.json(),r=Kb.safeParse(n);return r.success?r.data.error:t}catch{return t}}async function Ur(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 wn(o,s))}return Jt(o,t)}const No=10,vi=600,To=60,wi=600,Ao="time",wa="simple",of=Xe(["time","full"]),Jb=Xe(["simple","full"]),os=le({stripClaudeCodeBillingHeader:nt(),hasSeenOnboarding:nt().default(!1),slowResponseThresholdSeconds:fe().int().min(0).max(vi).default(No),providerTestTimeoutSeconds:fe().int().min(1).max(wi).default(To),timeDisplayFormat:of.default(Ao),captureMode:Jb.default(wa)}),Un="/api/config";async function Gb(e){return Ur(e,os,void 0,t=>`Failed to fetch ${e}: ${t.status}`)}async function to(e){return Ur(Un,os,{method:"PATCH",headers:{"content-type":"application/json"},body:JSON.stringify(e)},t=>`PATCH failed with status ${t.status}`)}function ka(){const e=ua(Un,Gb,{revalidateOnFocus:!1,revalidateIfStale:!1}),{mutate:t}=pd(),n=e.data?.stripClaudeCodeBillingHeader??!1,r=e.data?.captureMode??wa,o=e.data?.slowResponseThresholdSeconds??No,s=e.data?.providerTestTimeoutSeconds??To,i=e.data?.timeDisplayFormat??Ao,l=h=>({stripClaudeCodeBillingHeader:e.data?.stripClaudeCodeBillingHeader??!1,hasSeenOnboarding:e.data?.hasSeenOnboarding??!1,slowResponseThresholdSeconds:e.data?.slowResponseThresholdSeconds??No,providerTestTimeoutSeconds:e.data?.providerTestTimeoutSeconds??To,timeDisplayFormat:e.data?.timeDisplayFormat??Ao,captureMode:r,...h}),c=async h=>{await t(Un,to({stripClaudeCodeBillingHeader:h}),{optimisticData:l({stripClaudeCodeBillingHeader:h}),rollbackOnError:!0,revalidate:!1})},u=async h=>{await t(Un,to({slowResponseThresholdSeconds:h}),{optimisticData:l({slowResponseThresholdSeconds:h}),rollbackOnError:!0,revalidate:!1})},d=async h=>{await t(Un,to({timeDisplayFormat:h}),{optimisticData:l({timeDisplayFormat:h}),rollbackOnError:!0,revalidate:!1})},f=async h=>{await t(Un,to({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 sf=(...e)=>e.filter((t,n,r)=>!!t&&t.trim()!==""&&r.indexOf(t)===n).join(" ").trim();const Yb=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();const Xb=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(t,n,r)=>r?r.toUpperCase():n.toLowerCase());const ql=e=>{const t=Xb(e);return t.charAt(0).toUpperCase()+t.slice(1)};var Qb={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=y.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:n=2,absoluteStrokeWidth:r,className:o="",children:s,iconNode:i,...l},c)=>y.createElement("svg",{ref:c,...Qb,width:t,height:t,stroke:e,strokeWidth:r?Number(n)*24/Number(t):n,className:sf("lucide",o),...!s&&!ev(l)&&{"aria-hidden":"true"},...l},[...i.map(([u,d])=>y.createElement(u,d)),...Array.isArray(s)?s:[s]]));const xe=(e,t)=>{const n=y.forwardRef(({className:r,...o},s)=>y.createElement(tv,{ref:s,iconNode:t,className:sf(`lucide-${Yb(ql(e))}`,`lucide-${e}`,r),...o}));return n.displayName=ql(e),n};const nv=[["path",{d:"m7 7 10 10",key:"1fmybs"}],["path",{d:"M17 7v10H7",key:"6fjiku"}]],rv=xe("arrow-down-right",nv);const ov=[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]],sv=xe("arrow-down",ov);const iv=[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]],av=xe("arrow-left",iv);const lv=[["path",{d:"M7 7h10v10",key:"1tivn9"}],["path",{d:"M7 17 17 7",key:"1vkiza"}]],cv=xe("arrow-up-right",lv);const uv=[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]],dv=xe("arrow-up",uv);const fv=[["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"}]],pv=xe("blocks",fv);const hv=[["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"}]],af=xe("brain",hv);const mv=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],it=xe("check",mv);const gv=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],Ut=xe("chevron-down",gv);const xv=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],en=xe("chevron-right",xv);const yv=[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]],bv=xe("chevron-up",yv);const vv=[["path",{d:"m7 6 5 5 5-5",key:"1lc07p"}],["path",{d:"m7 13 5 5 5-5",key:"1d48rs"}]],lf=xe("chevrons-down",vv);const wv=[["path",{d:"m17 11-5-5-5 5",key:"e8nh98"}],["path",{d:"m17 18-5-5-5 5",key:"2avn1x"}]],kv=xe("chevrons-up",wv);const _v=[["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"}]],zr=xe("circle-alert",_v);const Sv=[["path",{d:"M21.801 10A10 10 0 1 1 17 3.335",key:"yps3ct"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]],Cv=xe("circle-check-big",Sv);const jv=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],Kl=xe("circle-check",jv);const Ev=[["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"}]],Nv=xe("circle-question-mark",Ev);const Tv=[["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"}]],cf=xe("circle-x",Tv);const Av=[["path",{d:"M12 6v6l4 2",key:"mmk7yg"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],cn=xe("clock",Av);const Iv=[["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"}]],zv=xe("cloud-upload",Iv);const Rv=[["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"}]],Pv=xe("code-xml",Rv);const Ov=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M12 3v18",key:"108xh3"}]],Mv=xe("columns-2",Ov);const Lv=[["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"}]],Wt=xe("copy",Lv);const Dv=[["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"}]],_a=xe("download",Dv);const Fv=[["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"}]],$v=xe("ellipsis",Fv);const Bv=[["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"}]],uf=xe("external-link",Bv);const Uv=[["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"}]],Sa=xe("eye-off",Uv);const Wv=[["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"}]],Ca=xe("eye",Wv);const Vv=[["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"}]],Hv=xe("file-diff",Vv);const Zv=[["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"}]],qv=xe("file-search",Zv);const Kv=[["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"}]],Jv=xe("file-terminal",Kv);const Gv=[["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"}]],Yv=xe("file-text",Gv);const Xv=[["path",{d:"m12 14 4-4",key:"9kzdfg"}],["path",{d:"M3.34 19a10 10 0 1 1 17.32 0",key:"19p75a"}]],Qv=xe("gauge",Xv);const ew=[["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"}]],tw=xe("git-compare-arrows",ew);const nw=[["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"}]],df=xe("globe",nw);const rw=[["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"}]],ow=xe("history",rw);const sw=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],Rr=xe("loader-circle",sw);const iw=[["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"}]],aw=xe("lock",iw);const lw=[["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"}]],ss=xe("message-square",lw);const cw=[["path",{d:"M5 12h14",key:"1ays0h"}]],uw=xe("minus",cw);const dw=[["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"}]],fw=xe("mouse-pointer-click",dw);const pw=[["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"}]],hw=xe("octagon-alert",pw);const mw=[["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"}]],ff=xe("pencil",mw);const gw=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],ki=xe("plus",gw);const xw=[["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"}]],yw=xe("radio",xw);const bw=[["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"}]],Jl=xe("refresh-cw",bw);const vw=[["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"}]],ww=xe("rotate-ccw",vw);const kw=[["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"}]],_i=xe("rotate-cw",kw);const _w=[["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"}]],Sw=xe("rows-3",_w);const Cw=[["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"}]],jw=xe("save",Cw);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"}]],Nw=xe("scan",Ew);const Tw=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],Aw=xe("search",Tw);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"}]],zw=xe("server",Iw);const Rw=[["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"}]],Pw=xe("settings",Rw);const Ow=[["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"}]],Gl=xe("shield-check",Ow);const Mw=[["path",{d:"M12 19h8",key:"baeox8"}],["path",{d:"m4 17 6-6-6-6",key:"1yngyt"}]],pf=xe("terminal",Mw);const Lw=[["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"}]],hf=xe("trash-2",Lw);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"}]],Io=xe("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"}]],$w=xe("upload",Fw);const Bw=[["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"}]],Uw=xe("user",Bw);const Ww=[["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"}]],Vw=xe("wifi-off",Ww);const Hw=[["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"}]],Zw=xe("wifi",Hw);const qw=[["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"}]],Wr=xe("wrench",qw);const Kw=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],ja=xe("x",Kw);const Jw=[["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"}]],Pr=xe("zap",Jw),Si="/api/config";async function Gw(e){return Ur(e,os,void 0,t=>`Failed to fetch ${e}: ${t.status}`)}async function Yw(e){return Ur(Si,os,{method:"PATCH",headers:{"content-type":"application/json"},body:JSON.stringify(e)},t=>`PATCH failed with status ${t.status}`)}function Xw(){const e=ua(Si,Gw,{revalidateOnFocus:!1,revalidateIfStale:!1}),{mutate:t}=pd(),n=e.data?.hasSeenOnboarding??!1,r=e.data?.captureMode??wa,o=async()=>{await t(Si,Yw({hasSeenOnboarding:!0}),{optimisticData:{stripClaudeCodeBillingHeader:e.data?.stripClaudeCodeBillingHeader??!1,hasSeenOnboarding:!0,slowResponseThresholdSeconds:e.data?.slowResponseThresholdSeconds??No,providerTestTimeoutSeconds:e.data?.providerTestTimeoutSeconds??To,timeDisplayFormat:e.data?.timeDisplayFormat??Ao,captureMode:r},rollbackOnError:!0,revalidate:!1})};return{hasSeenOnboarding:n,captureMode:r,isLoading:e.isLoading,markSeen:o}}function Qw(){const{hasSeenOnboarding:e,captureMode:t,isLoading:n,markSeen:r}=Xw();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(it,{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(ja,{className:"size-3.5"})})]})}function no(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 Rs={exports:{}};var Yl;function e2(){return Yl||(Yl=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 no=="function"&&no;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(x){var m=r[u][1][x];return i(m||x)},p,p.exports,n,r,o,s)}return o[u].exports}for(var l=typeof no=="function"&&no,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,x,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,x=1<k?(15&d)<<2|f>>6:64,m=2<k?63&f:64,g.push(l.charAt(h)+l.charAt(p)+l.charAt(x)+l.charAt(m));return g.join("")},o.decode=function(c){var u,d,f,h,p,x,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|(x=l.indexOf(c.charAt(m++))),v[g++]=u,p!==64&&(v[g++]=d),x!==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,x){this.compressedSize=d,this.uncompressedSize=f,this.crc32=h,this.compression=p,this.compressedContent=x}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,x=h+f;u^=-1;for(var m=h;m<x;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,x=h+f;u^=-1;for(var m=h;m<x;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,x){var m,g="";for(m=0;m<x;m++)g+=String.fromCharCode(255&p),p>>>=8;return g}function i(p,x,m,g,b,v){var k,S,C=p.file,j=p.compression,N=v!==u.utf8encode,T=l.transformTo("string",v(C.name)),A=l.transformTo("string",u.utf8encode(C.name)),O=C.comment,$=l.transformTo("string",v(O)),E=l.transformTo("string",u.utf8encode(O)),L=A.length!==C.name.length,w=E.length!==O.length,M="",U="",F="",B=C.dir,G=C.date,I={crc32:0,compressedSize:0,uncompressedSize:0};x&&!m||(I.crc32=p.crc32,I.compressedSize=p.compressedSize,I.uncompressedSize=p.uncompressedSize);var H=0;x&&(H|=8),N||!L&&!w||(H|=2048);var K=0,z=0;B&&(K|=16),b==="UNIX"?(z=798,K|=(function(re,ue){var ie=re;return re||(ie=ue?16893:33204),(65535&ie)<<16})(C.unixPermissions,B)):(z=20,K|=(function(re){return 63&(re||0)})(C.dosPermissions)),k=G.getUTCHours(),k<<=6,k|=G.getUTCMinutes(),k<<=5,k|=G.getUTCSeconds()/2,S=G.getUTCFullYear()-1980,S<<=4,S|=G.getUTCMonth()+1,S<<=5,S|=G.getUTCDate(),L&&(U=s(1,1)+s(d(T),4)+A,M+="up"+s(U.length,2)+U),w&&(F=s(1,1)+s(d($),4)+E,M+="uc"+s(F.length,2)+F);var se="";return se+=`
|
|
41
|
-
\0`,se+=s(H,2),se+=j.magic,se+=s(k,2),se+=s(S,2),se+=s(I.crc32,4),se+=s(I.compressedSize,4),se+=s(I.uncompressedSize,4),se+=s(T.length,2),se+=s(M.length,2),{fileRecord:f.LOCAL_FILE_HEADER+se+T+M,dirRecord:f.CENTRAL_FILE_HEADER+s(z,2)+se+s($.length,2)+"\0\0\0\0"+s(K,4)+s(g,4)+T+M+$}}var l=n("../utils"),c=n("../stream/GenericWorker"),u=n("../utf8"),d=n("../crc32"),f=n("../signature");function h(p,x,m,g){c.call(this,"ZipFileWorker"),this.bytesWritten=0,this.zipComment=x,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 x=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?(x+100*(m-g-1))/m:100}}))},h.prototype.openedSource=function(p){this.currentSourceOffset=this.bytesWritten,this.currentFile=p.file.name;var x=this.streamFiles&&!p.file.dir;if(x){var m=i(p,x,!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 x=this.streamFiles&&!p.file.dir,m=i(p,x,!0,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);if(this.dirRecords.push(m.dirRecord),x)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,x=0;x<this.dirRecords.length;x++)this.push({data:this.dirRecords[x],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 x=this;return p.on("data",function(m){x.processChunk(m)}),p.on("end",function(){x.closedSource(x.previous.streamInfo),x._sources.length?x.prepareNextSource():x.end()}),p.on("error",function(m){x.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 x=this._sources;if(!c.prototype.error.call(this,p))return!1;for(var m=0;m<x.length;m++)try{x[m].error(p)}catch{}return!0},h.prototype.lock=function(){c.prototype.lock.call(this);for(var p=this._sources,x=0;x<p.length;x++)p[x].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 x=(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(x,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,x){var m=h.decompressed.getContentWorker().pipe(new u);m.on("error",function(g){x(g)}).on("end",function(){m.streamInfo.crc32!==h.decompressed.crc32?x(new Error("Corrupted zip : CRC32 mismatch")):p()}).resume()})}r.exports=function(h,p){var x=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);x.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||(x.file(C).unsafeOriginalName=S)}return g.zipComment.length&&(x.comment=g.zipComment),x})}},{"./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,N){var T,A=l.getTypeOf(j),O=l.extend(N||{},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 $=A==="string"&&O.binary===!1&&O.base64===!1;N&&N.binary!==void 0||(O.binary=!$),(j instanceof f&&j.uncompressedSize===0||O.dir||!j||j.length===0)&&(O.base64=!1,O.binary=!0,j="",O.compression="STORE",A="string");var E=null;E=j instanceof f||j instanceof c?j:x.isNode&&x.isStream(j)?new m(C,j):l.prepareContent(C,j,O.binary,O.optimizedBinaryString,O.base64);var L=new h(C,E,O);this.files[C]=L}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"),x=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,N,T;for(j in this.files)T=this.files[j],(N=j.slice(this.root.length,j.length))&&j.slice(0,this.root.length)===this.root&&C(N,T)},filter:function(C){var j=[];return this.forEach(function(N,T){C(N,T)&&j.push(T)}),j},file:function(C,j,N){if(arguments.length!==1)return C=this.root+C,s.call(this,C,j,N),this;if(k(C)){var T=C;return this.filter(function(O,$){return!$.dir&&T.test(O)})}var A=this.files[this.root+C];return A&&!A.dir?A:null},folder:function(C){if(!C)return this;if(k(C))return this.filter(function(A,O){return O.dir&&C.test(A)});var j=this.root+C,N=v.call(this,j),T=this.clone();return T.root=N.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 N=this.filter(function(A,O){return O.name.slice(0,C.length)===C}),T=0;T<N.length;T++)delete this.files[N[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,N={};try{if((N=l.extend(C||{},{streamFiles:!1,compression:"STORE",compressionOptions:null,type:"",platform:"DOS",comment:null,mimeType:"application/zip",encodeFileName:i.utf8encode})).type=N.type.toLowerCase(),N.compression=N.compression.toUpperCase(),N.type==="binarystring"&&(N.type="string"),!N.type)throw new Error("No output type specified.");l.checkSupport(N.type),N.platform!=="darwin"&&N.platform!=="freebsd"&&N.platform!=="linux"&&N.platform!=="sunos"||(N.platform="UNIX"),N.platform==="win32"&&(N.platform="DOS");var T=N.comment||this.comment||"";j=p.generateWorker(this,N,T)}catch(A){(j=new c("error")).error(A)}return new u(j,N.type||"string",N.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(x,m){return new d.Promise(function(g,b){var v=[],k=x._internalType,S=x._outputType,C=x._mimeType;x.on("data",function(j,N){v.push(j),m&&m(N)}).on("error",function(j){v=[],b(j)}).on("end",function(){try{var j=(function(N,T,A){switch(N){case"blob":return s.newBlob(s.transformTo("arraybuffer",T),A);case"base64":return c.encode(T);default:return s.transformTo(N,T)}})(S,(function(N,T){var A,O=0,$=null,E=0;for(A=0;A<T.length;A++)E+=T[A].length;switch(N){case"string":return T.join("");case"array":return Array.prototype.concat.apply([],T);case"uint8array":for($=new Uint8Array(E),A=0;A<T.length;A++)$.set(T[A],O),O+=T[A].length;return $;case"nodebuffer":return Buffer.concat(T);default:throw new Error("concat : unsupported type '"+N+"'")}})(k,v),C);g(j)}catch(N){b(N)}v=[]}).resume()})}function p(x,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=x.pipe(new i(b)),x.lock()}catch(v){this._worker=new l("error"),this._worker.error(v)}}p.prototype={accumulate:function(x){return h(this,x)},on:function(x,m){var g=this;return x==="data"?this._worker.on(x,function(b){m.call(g,b.data,b.meta)}):this._worker.on(x,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(x){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"},x)}},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(x){var m,g,b,v,k,S=x.length,C=0;for(v=0;v<S;v++)(64512&(g=x.charCodeAt(v)))==55296&&v+1<S&&(64512&(b=x.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=x.charCodeAt(v)))==55296&&v+1<S&&(64512&(b=x.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(x){var m,g,b,v,k=x.length,S=new Array(2*k);for(m=g=0;m<k;)if((b=x[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&x[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 x=s.transformTo(i.uint8array?"uint8array":"array",p.data);if(this.leftOver&&this.leftOver.length){if(i.uint8array){var m=x;(x=new Uint8Array(m.length+this.leftOver.length)).set(this.leftOver,0),x.set(m,this.leftOver.length)}else x=this.leftOver.concat(x);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})(x),b=x;g!==x.length&&(i.uint8array?(b=x.subarray(0,g),this.leftOver=x.subarray(g,x.length)):(b=x.slice(0,g),this.leftOver=x.slice(g,x.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 x={};x.string={string:u,array:function(m){return d(m,new Array(m.length))},arraybuffer:function(m){return x.string.uint8array(m).buffer},uint8array:function(m){return d(m,new Uint8Array(m.length))},nodebuffer:function(m){return d(m,l.allocBuffer(m.length))}},x.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)}},x.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))}},x.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)}},x.nodebuffer={string:h,array:function(m){return p(m,new Array(m.length))},arraybuffer:function(m){return x.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 x[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 N=new FileReader;N.onload=function(T){C(T.target.result)},N.onerror=function(T){j(T.target.error)},N.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 x=this.reader.readString(4)===h;return this.reader.setIndex(p),x},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,x=this.zip64EndOfCentralSize-44;0<x;)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 x=h-p;if(0<x)this.isSignature(h,l.CENTRAL_FILE_HEADER)||(this.reader.zero=x);else if(x<0)throw new Error("Corrupted zip: missing "+Math.abs(x)+" 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,x){this.options=p,this.loadOptions=x}h.prototype={isEncrypted:function(){return(1&this.bitFlag)==1},useUTF8:function(){return(2048&this.bitFlag)==2048},readLocalPart:function(p){var x,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((x=(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,x,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 x=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(x),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 x,m,g,b=p.index+this.extraFieldsLength;for(this.extraFields||(this.extraFields={});p.index+4<b;)x=p.readInt(2),m=p.readInt(2),g=p.readData(m),this.extraFields[x]={id:x,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 x=this.findExtraFieldUnicodePath();if(x!==null)this.fileNameStr=x;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 x=s(p.value);return x.readInt(1)!==1||c(this.fileName)!==x.readInt(4)?null:u.utf8decode(x.readData(p.length-5))}return null},findExtraFieldUnicodeComment:function(){var p=this.extraFields[25461];if(p){var x=s(p.value);return x.readInt(1)!==1||c(this.fileComment)!==x.readInt(4)?null:u.utf8decode(x.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(x,m,g){this.name=x,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(x){var m=null,g="string";try{if(!x)throw new Error("No output type specified.");var b=(g=x.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(x,m){return this.internalStream(x).accumulate(m)},nodeStream:function(x,m){return this.internalStream(x||"nodebuffer").toNodejsStream(m)},_compressWorker:function(x,m){if(this._data instanceof u&&this._data.compression.magic===x.magic)return this._data.getCompressedWorker();var g=this._decompressWorker();return this._dataBinary||(g=g.pipe(new c.Utf8EncodeWorker)),u.createWorkerFrom(g,x,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(x),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(){x(),m.onreadystatechange=null,m.parentNode.removeChild(m),m=null},s.document.documentElement.appendChild(m)}:function(){setTimeout(x,0)};else{var h=new s.MessageChannel;h.port1.onmessage=x,i=function(){h.port2.postMessage(0)}}var p=[];function x(){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 Yr<"u"?Yr: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 x(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(N){k||(k=!0,l.reject(b,N))}function C(N){k||(k=!0,l.resolve(b,N))}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(x,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,N=-1,T=new this(i);++N<k;)A(b[N],N);return T;function A(O,$){v.resolve(O).then(function(E){C[$]=E,++j!==k||S||(S=!0,l.resolve(T,C))},function(E){S||(S=!0,l.reject(T,E))})}},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;)N=b[C],v.resolve(N).then(function(T){S||(S=!0,l.resolve(j,T))},function(T){S||(S=!0,l.reject(j,T))});var N;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,x=8;function m(b){if(!(this instanceof m))return new m(b);this.options=i.assign({level:h,method:x,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 x(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,N=this.strm,T=this.options.chunkSize,A=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"?N.input=l.binstring2buf(m):h.call(m)==="[object ArrayBuffer]"?N.input=new Uint8Array(m):N.input=m,N.next_in=0,N.avail_in=N.input.length;do{if(N.avail_out===0&&(N.output=new i.Buf8(T),N.next_out=0,N.avail_out=T),(b=s.inflate(N,c.Z_NO_FLUSH))===c.Z_NEED_DICT&&A&&(j=typeof A=="string"?l.string2buf(A):h.call(A)==="[object ArrayBuffer]"?new Uint8Array(A):A,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);N.next_out&&(N.avail_out!==0&&b!==c.Z_STREAM_END&&(N.avail_in!==0||v!==c.Z_FINISH&&v!==c.Z_SYNC_FLUSH)||(this.options.to==="string"?(k=l.utf8border(N.output,N.next_out),S=N.next_out-k,C=l.buf2string(N.output,k),N.next_out=S,N.avail_out=T-S,S&&i.arraySet(N.output,N.output,k,S,0),this.onData(C)):this.onData(i.shrinkBuf(N.output,N.next_out)))),N.avail_in===0&&N.avail_out===0&&(O=!0)}while((0<N.avail_in||N.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),!(N.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=x,o.inflateRaw=function(m,g){return(g=g||{}).raw=!0,x(m,g)},o.ungzip=x},{"./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,x;for(u=f=0,d=c.length;u<d;u++)f+=c[u].length;for(x=new Uint8Array(f),u=h=0,d=c.length;u<d;u++)p=c[u],x.set(p,h),h+=p.length;return x}},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="",x=0;x<h;x++)p+=String.fromCharCode(f[x]);return p}c[254]=c[254]=1,o.string2buf=function(f){var h,p,x,m,g,b=f.length,v=0;for(m=0;m<b;m++)(64512&(p=f.charCodeAt(m)))==55296&&m+1<b&&(64512&(x=f.charCodeAt(m+1)))==56320&&(p=65536+(p-55296<<10)+(x-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&(x=f.charCodeAt(m+1)))==56320&&(p=65536+(p-55296<<10)+(x-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,x=h.length;p<x;p++)h[p]=f.charCodeAt(p);return h},o.buf2string=function(f,h){var p,x,m,g,b=h||f.length,v=new Array(2*b);for(p=x=0;p<b;)if((m=f[p++])<128)v[x++]=m;else if(4<(g=c[m]))v[x++]=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[x++]=65533:m<65536?v[x++]=m:(m-=65536,v[x++]=55296|m>>10&1023,v[x++]=56320|1023&m)}return d(v,x)},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,x=-2,m=-1,g=4,b=2,v=8,k=9,S=286,C=30,j=19,N=2*S+1,T=15,A=3,O=258,$=O+A+1,E=42,L=113,w=1,M=2,U=3,F=4;function B(_,te){return _.msg=d[te],te}function G(_){return(_<<1)-(4<_?9:0)}function I(_){for(var te=_.length;0<=--te;)_[te]=0}function H(_){var te=_.state,Q=te.pending;Q>_.avail_out&&(Q=_.avail_out),Q!==0&&(i.arraySet(_.output,te.pending_buf,te.pending_out,Q,_.next_out),_.next_out+=Q,te.pending_out+=Q,_.total_out+=Q,_.avail_out-=Q,te.pending-=Q,te.pending===0&&(te.pending_out=0))}function K(_,te){l._tr_flush_block(_,0<=_.block_start?_.block_start:-1,_.strstart-_.block_start,te),_.block_start=_.strstart,H(_.strm)}function z(_,te){_.pending_buf[_.pending++]=te}function se(_,te){_.pending_buf[_.pending++]=te>>>8&255,_.pending_buf[_.pending++]=255&te}function re(_,te){var Q,P,R=_.max_chain_length,q=_.strstart,Z=_.prev_length,J=_.nice_match,V=_.strstart>_.w_size-$?_.strstart-(_.w_size-$):0,oe=_.window,Y=_.w_mask,ee=_.prev,D=_.strstart+O,X=oe[q+Z-1],ae=oe[q+Z];_.prev_length>=_.good_match&&(R>>=2),J>_.lookahead&&(J=_.lookahead);do if(oe[(Q=te)+Z]===ae&&oe[Q+Z-1]===X&&oe[Q]===oe[q]&&oe[++Q]===oe[q+1]){q+=2,Q++;do;while(oe[++q]===oe[++Q]&&oe[++q]===oe[++Q]&&oe[++q]===oe[++Q]&&oe[++q]===oe[++Q]&&oe[++q]===oe[++Q]&&oe[++q]===oe[++Q]&&oe[++q]===oe[++Q]&&oe[++q]===oe[++Q]&&q<D);if(P=O-(D-q),q=D-O,Z<P){if(_.match_start=te,J<=(Z=P))break;X=oe[q+Z-1],ae=oe[q+Z]}}while((te=ee[te&Y])>V&&--R!=0);return Z<=_.lookahead?Z:_.lookahead}function ue(_){var te,Q,P,R,q,Z,J,V,oe,Y,ee=_.w_size;do{if(R=_.window_size-_.lookahead-_.strstart,_.strstart>=ee+(ee-$)){for(i.arraySet(_.window,_.window,ee,ee,0),_.match_start-=ee,_.strstart-=ee,_.block_start-=ee,te=Q=_.hash_size;P=_.head[--te],_.head[te]=ee<=P?P-ee:0,--Q;);for(te=Q=ee;P=_.prev[--te],_.prev[te]=ee<=P?P-ee:0,--Q;);R+=ee}if(_.strm.avail_in===0)break;if(Z=_.strm,J=_.window,V=_.strstart+_.lookahead,oe=R,Y=void 0,Y=Z.avail_in,oe<Y&&(Y=oe),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>=A)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+A-1])&_.hash_mask,_.prev[q&_.w_mask]=_.head[_.ins_h],_.head[_.ins_h]=q,q++,_.insert--,!(_.lookahead+_.insert<A)););}while(_.lookahead<$&&_.strm.avail_in!==0)}function ie(_,te){for(var Q,P;;){if(_.lookahead<$){if(ue(_),_.lookahead<$&&te===f)return w;if(_.lookahead===0)break}if(Q=0,_.lookahead>=A&&(_.ins_h=(_.ins_h<<_.hash_shift^_.window[_.strstart+A-1])&_.hash_mask,Q=_.prev[_.strstart&_.w_mask]=_.head[_.ins_h],_.head[_.ins_h]=_.strstart),Q!==0&&_.strstart-Q<=_.w_size-$&&(_.match_length=re(_,Q)),_.match_length>=A)if(P=l._tr_tally(_,_.strstart-_.match_start,_.match_length-A),_.lookahead-=_.match_length,_.match_length<=_.max_lazy_match&&_.lookahead>=A){for(_.match_length--;_.strstart++,_.ins_h=(_.ins_h<<_.hash_shift^_.window[_.strstart+A-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 P=l._tr_tally(_,0,_.window[_.strstart]),_.lookahead--,_.strstart++;if(P&&(K(_,!1),_.strm.avail_out===0))return w}return _.insert=_.strstart<A-1?_.strstart:A-1,te===h?(K(_,!0),_.strm.avail_out===0?U:F):_.last_lit&&(K(_,!1),_.strm.avail_out===0)?w:M}function de(_,te){for(var Q,P,R;;){if(_.lookahead<$){if(ue(_),_.lookahead<$&&te===f)return w;if(_.lookahead===0)break}if(Q=0,_.lookahead>=A&&(_.ins_h=(_.ins_h<<_.hash_shift^_.window[_.strstart+A-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=A-1,Q!==0&&_.prev_length<_.max_lazy_match&&_.strstart-Q<=_.w_size-$&&(_.match_length=re(_,Q),_.match_length<=5&&(_.strategy===1||_.match_length===A&&4096<_.strstart-_.match_start)&&(_.match_length=A-1)),_.prev_length>=A&&_.match_length<=_.prev_length){for(R=_.strstart+_.lookahead-A,P=l._tr_tally(_,_.strstart-1-_.prev_match,_.prev_length-A),_.lookahead-=_.prev_length-1,_.prev_length-=2;++_.strstart<=R&&(_.ins_h=(_.ins_h<<_.hash_shift^_.window[_.strstart+A-1])&_.hash_mask,Q=_.prev[_.strstart&_.w_mask]=_.head[_.ins_h],_.head[_.ins_h]=_.strstart),--_.prev_length!=0;);if(_.match_available=0,_.match_length=A-1,_.strstart++,P&&(K(_,!1),_.strm.avail_out===0))return w}else if(_.match_available){if((P=l._tr_tally(_,0,_.window[_.strstart-1]))&&K(_,!1),_.strstart++,_.lookahead--,_.strm.avail_out===0)return w}else _.match_available=1,_.strstart++,_.lookahead--}return _.match_available&&(P=l._tr_tally(_,0,_.window[_.strstart-1]),_.match_available=0),_.insert=_.strstart<A-1?_.strstart:A-1,te===h?(K(_,!0),_.strm.avail_out===0?U:F):_.last_lit&&(K(_,!1),_.strm.avail_out===0)?w:M}function pe(_,te,Q,P,R){this.good_length=_,this.max_lazy=te,this.nice_length=Q,this.max_chain=P,this.func=R}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*N),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 te;return _&&_.state?(_.total_in=_.total_out=0,_.data_type=b,(te=_.state).pending=0,te.pending_out=0,te.wrap<0&&(te.wrap=-te.wrap),te.status=te.wrap?E:L,_.adler=te.wrap===2?0:1,te.last_flush=f,l._tr_init(te),p):B(_,x)}function ke(_){var te=me(_);return te===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=A-1,Q.match_available=0,Q.ins_h=0})(_.state),te}function ze(_,te,Q,P,R,q){if(!_)return x;var Z=1;if(te===m&&(te=6),P<0?(Z=0,P=-P):15<P&&(Z=2,P-=16),R<1||k<R||Q!==v||P<8||15<P||te<0||9<te||q<0||g<q)return B(_,x);P===8&&(P=9);var J=new he;return(_.state=J).strm=_,J.wrap=Z,J.gzhead=null,J.w_bits=P,J.w_size=1<<J.w_bits,J.w_mask=J.w_size-1,J.hash_bits=R+7,J.hash_size=1<<J.hash_bits,J.hash_mask=J.hash_size-1,J.hash_shift=~~((J.hash_bits+A-1)/A),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<<R+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=te,J.strategy=q,J.method=Q,ke(_)}s=[new pe(0,0,0,0,function(_,te){var Q=65535;for(Q>_.pending_buf_size-5&&(Q=_.pending_buf_size-5);;){if(_.lookahead<=1){if(ue(_),_.lookahead===0&&te===f)return w;if(_.lookahead===0)break}_.strstart+=_.lookahead,_.lookahead=0;var P=_.block_start+Q;if((_.strstart===0||_.strstart>=P)&&(_.lookahead=_.strstart-P,_.strstart=P,K(_,!1),_.strm.avail_out===0)||_.strstart-_.block_start>=_.w_size-$&&(K(_,!1),_.strm.avail_out===0))return w}return _.insert=0,te===h?(K(_,!0),_.strm.avail_out===0?U:F):(_.strstart>_.block_start&&(K(_,!1),_.strm.avail_out),w)}),new pe(4,4,8,4,ie),new pe(4,5,16,8,ie),new pe(4,6,32,32,ie),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(_,te){return ze(_,te,v,15,8,0)},o.deflateInit2=ze,o.deflateReset=ke,o.deflateResetKeep=me,o.deflateSetHeader=function(_,te){return _&&_.state?_.state.wrap!==2?x:(_.state.gzhead=te,p):x},o.deflate=function(_,te){var Q,P,R,q;if(!_||!_.state||5<te||te<0)return _?B(_,x):x;if(P=_.state,!_.output||!_.input&&_.avail_in!==0||P.status===666&&te!==h)return B(_,_.avail_out===0?-5:x);if(P.strm=_,Q=P.last_flush,P.last_flush=te,P.status===E)if(P.wrap===2)_.adler=0,z(P,31),z(P,139),z(P,8),P.gzhead?(z(P,(P.gzhead.text?1:0)+(P.gzhead.hcrc?2:0)+(P.gzhead.extra?4:0)+(P.gzhead.name?8:0)+(P.gzhead.comment?16:0)),z(P,255&P.gzhead.time),z(P,P.gzhead.time>>8&255),z(P,P.gzhead.time>>16&255),z(P,P.gzhead.time>>24&255),z(P,P.level===9?2:2<=P.strategy||P.level<2?4:0),z(P,255&P.gzhead.os),P.gzhead.extra&&P.gzhead.extra.length&&(z(P,255&P.gzhead.extra.length),z(P,P.gzhead.extra.length>>8&255)),P.gzhead.hcrc&&(_.adler=u(_.adler,P.pending_buf,P.pending,0)),P.gzindex=0,P.status=69):(z(P,0),z(P,0),z(P,0),z(P,0),z(P,0),z(P,P.level===9?2:2<=P.strategy||P.level<2?4:0),z(P,3),P.status=L);else{var Z=v+(P.w_bits-8<<4)<<8;Z|=(2<=P.strategy||P.level<2?0:P.level<6?1:P.level===6?2:3)<<6,P.strstart!==0&&(Z|=32),Z+=31-Z%31,P.status=L,se(P,Z),P.strstart!==0&&(se(P,_.adler>>>16),se(P,65535&_.adler)),_.adler=1}if(P.status===69)if(P.gzhead.extra){for(R=P.pending;P.gzindex<(65535&P.gzhead.extra.length)&&(P.pending!==P.pending_buf_size||(P.gzhead.hcrc&&P.pending>R&&(_.adler=u(_.adler,P.pending_buf,P.pending-R,R)),H(_),R=P.pending,P.pending!==P.pending_buf_size));)z(P,255&P.gzhead.extra[P.gzindex]),P.gzindex++;P.gzhead.hcrc&&P.pending>R&&(_.adler=u(_.adler,P.pending_buf,P.pending-R,R)),P.gzindex===P.gzhead.extra.length&&(P.gzindex=0,P.status=73)}else P.status=73;if(P.status===73)if(P.gzhead.name){R=P.pending;do{if(P.pending===P.pending_buf_size&&(P.gzhead.hcrc&&P.pending>R&&(_.adler=u(_.adler,P.pending_buf,P.pending-R,R)),H(_),R=P.pending,P.pending===P.pending_buf_size)){q=1;break}q=P.gzindex<P.gzhead.name.length?255&P.gzhead.name.charCodeAt(P.gzindex++):0,z(P,q)}while(q!==0);P.gzhead.hcrc&&P.pending>R&&(_.adler=u(_.adler,P.pending_buf,P.pending-R,R)),q===0&&(P.gzindex=0,P.status=91)}else P.status=91;if(P.status===91)if(P.gzhead.comment){R=P.pending;do{if(P.pending===P.pending_buf_size&&(P.gzhead.hcrc&&P.pending>R&&(_.adler=u(_.adler,P.pending_buf,P.pending-R,R)),H(_),R=P.pending,P.pending===P.pending_buf_size)){q=1;break}q=P.gzindex<P.gzhead.comment.length?255&P.gzhead.comment.charCodeAt(P.gzindex++):0,z(P,q)}while(q!==0);P.gzhead.hcrc&&P.pending>R&&(_.adler=u(_.adler,P.pending_buf,P.pending-R,R)),q===0&&(P.status=103)}else P.status=103;if(P.status===103&&(P.gzhead.hcrc?(P.pending+2>P.pending_buf_size&&H(_),P.pending+2<=P.pending_buf_size&&(z(P,255&_.adler),z(P,_.adler>>8&255),_.adler=0,P.status=L)):P.status=L),P.pending!==0){if(H(_),_.avail_out===0)return P.last_flush=-1,p}else if(_.avail_in===0&&G(te)<=G(Q)&&te!==h)return B(_,-5);if(P.status===666&&_.avail_in!==0)return B(_,-5);if(_.avail_in!==0||P.lookahead!==0||te!==f&&P.status!==666){var J=P.strategy===2?(function(V,oe){for(var Y;;){if(V.lookahead===0&&(ue(V),V.lookahead===0)){if(oe===f)return w;break}if(V.match_length=0,Y=l._tr_tally(V,0,V.window[V.strstart]),V.lookahead--,V.strstart++,Y&&(K(V,!1),V.strm.avail_out===0))return w}return V.insert=0,oe===h?(K(V,!0),V.strm.avail_out===0?U:F):V.last_lit&&(K(V,!1),V.strm.avail_out===0)?w:M})(P,te):P.strategy===3?(function(V,oe){for(var Y,ee,D,X,ae=V.window;;){if(V.lookahead<=O){if(ue(V),V.lookahead<=O&&oe===f)return w;if(V.lookahead===0)break}if(V.match_length=0,V.lookahead>=A&&0<V.strstart&&(ee=ae[D=V.strstart-1])===ae[++D]&&ee===ae[++D]&&ee===ae[++D]){X=V.strstart+O;do;while(ee===ae[++D]&&ee===ae[++D]&&ee===ae[++D]&&ee===ae[++D]&&ee===ae[++D]&&ee===ae[++D]&&ee===ae[++D]&&ee===ae[++D]&&D<X);V.match_length=O-(X-D),V.match_length>V.lookahead&&(V.match_length=V.lookahead)}if(V.match_length>=A?(Y=l._tr_tally(V,1,V.match_length-A),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&&(K(V,!1),V.strm.avail_out===0))return w}return V.insert=0,oe===h?(K(V,!0),V.strm.avail_out===0?U:F):V.last_lit&&(K(V,!1),V.strm.avail_out===0)?w:M})(P,te):s[P.level].func(P,te);if(J!==U&&J!==F||(P.status=666),J===w||J===U)return _.avail_out===0&&(P.last_flush=-1),p;if(J===M&&(te===1?l._tr_align(P):te!==5&&(l._tr_stored_block(P,0,0,!1),te===3&&(I(P.head),P.lookahead===0&&(P.strstart=0,P.block_start=0,P.insert=0))),H(_),_.avail_out===0))return P.last_flush=-1,p}return te!==h?p:P.wrap<=0?1:(P.wrap===2?(z(P,255&_.adler),z(P,_.adler>>8&255),z(P,_.adler>>16&255),z(P,_.adler>>24&255),z(P,255&_.total_in),z(P,_.total_in>>8&255),z(P,_.total_in>>16&255),z(P,_.total_in>>24&255)):(se(P,_.adler>>>16),se(P,65535&_.adler)),H(_),0<P.wrap&&(P.wrap=-P.wrap),P.pending!==0?p:1)},o.deflateEnd=function(_){var te;return _&&_.state?(te=_.state.status)!==E&&te!==69&&te!==73&&te!==91&&te!==103&&te!==L&&te!==666?B(_,x):(_.state=null,te===L?B(_,-3):p):x},o.deflateSetDictionary=function(_,te){var Q,P,R,q,Z,J,V,oe,Y=te.length;if(!_||!_.state||(q=(Q=_.state).wrap)===2||q===1&&Q.status!==E||Q.lookahead)return x;for(q===1&&(_.adler=c(_.adler,te,Y,0)),Q.wrap=0,Y>=Q.w_size&&(q===0&&(I(Q.head),Q.strstart=0,Q.block_start=0,Q.insert=0),oe=new i.Buf8(Q.w_size),i.arraySet(oe,te,Y-Q.w_size,Q.w_size,0),te=oe,Y=Q.w_size),Z=_.avail_in,J=_.next_in,V=_.input,_.avail_in=Y,_.next_in=0,_.input=te,ue(Q);Q.lookahead>=A;){for(P=Q.strstart,R=Q.lookahead-(A-1);Q.ins_h=(Q.ins_h<<Q.hash_shift^Q.window[P+A-1])&Q.hash_mask,Q.prev[P&Q.w_mask]=Q.head[Q.ins_h],Q.head[Q.ins_h]=P,P++,--R;);Q.strstart=P,Q.lookahead=A-1,ue(Q)}return Q.strstart+=Q.lookahead,Q.block_start=Q.strstart,Q.insert=Q.lookahead,Q.lookahead=0,Q.match_length=Q.prev_length=A-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,x,m,g,b,v,k,S,C,j,N,T,A,O,$,E,L,w,M;l=s.state,c=s.next_in,w=s.input,u=c+(s.avail_in-5),d=s.next_out,M=s.output,f=d-(i-s.avail_out),h=d+(s.avail_out-257),p=l.dmax,x=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,N=(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>>>=A=T>>>24,k-=A,(A=T>>>16&255)===0)M[d++]=65535&T;else{if(!(16&A)){if((64&A)==0){T=S[(65535&T)+(v&(1<<A)-1)];continue t}if(32&A){l.mode=12;break e}s.msg="invalid literal/length code",l.mode=30;break e}O=65535&T,(A&=15)&&(k<A&&(v+=w[c++]<<k,k+=8),O+=v&(1<<A)-1,v>>>=A,k-=A),k<15&&(v+=w[c++]<<k,k+=8,v+=w[c++]<<k,k+=8),T=C[v&N];n:for(;;){if(v>>>=A=T>>>24,k-=A,!(16&(A=T>>>16&255))){if((64&A)==0){T=C[(65535&T)+(v&(1<<A)-1)];continue n}s.msg="invalid distance code",l.mode=30;break e}if($=65535&T,k<(A&=15)&&(v+=w[c++]<<k,(k+=8)<A&&(v+=w[c++]<<k,k+=8)),p<($+=v&(1<<A)-1)){s.msg="invalid distance too far back",l.mode=30;break e}if(v>>>=A,k-=A,(A=d-f)<$){if(m<(A=$-A)&&l.sane){s.msg="invalid distance too far back",l.mode=30;break e}if(L=b,(E=0)===g){if(E+=x-A,A<O){for(O-=A;M[d++]=b[E++],--A;);E=d-$,L=M}}else if(g<A){if(E+=x+g-A,(A-=g)<O){for(O-=A;M[d++]=b[E++],--A;);if(E=0,g<O){for(O-=A=g;M[d++]=b[E++],--A;);E=d-$,L=M}}}else if(E+=g-A,A<O){for(O-=A;M[d++]=b[E++],--A;);E=d-$,L=M}for(;2<O;)M[d++]=L[E++],M[d++]=L[E++],M[d++]=L[E++],O-=3;O&&(M[d++]=L[E++],1<O&&(M[d++]=L[E++]))}else{for(E=d-$;M[d++]=M[E++],M[d++]=M[E++],M[d++]=M[E++],2<(O-=3););O&&(M[d++]=M[E++],1<O&&(M[d++]=M[E++]))}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,x=1,m=852,g=592;function b(E){return(E>>>24&255)+(E>>>8&65280)+((65280&E)<<8)+((255&E)<<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(E){var L;return E&&E.state?(L=E.state,E.total_in=E.total_out=L.total=0,E.msg="",L.wrap&&(E.adler=1&L.wrap),L.mode=x,L.last=0,L.havedict=0,L.dmax=32768,L.head=null,L.hold=0,L.bits=0,L.lencode=L.lendyn=new s.Buf32(m),L.distcode=L.distdyn=new s.Buf32(g),L.sane=1,L.back=-1,h):p}function S(E){var L;return E&&E.state?((L=E.state).wsize=0,L.whave=0,L.wnext=0,k(E)):p}function C(E,L){var w,M;return E&&E.state?(M=E.state,L<0?(w=0,L=-L):(w=1+(L>>4),L<48&&(L&=15)),L&&(L<8||15<L)?p:(M.window!==null&&M.wbits!==L&&(M.window=null),M.wrap=w,M.wbits=L,S(E))):p}function j(E,L){var w,M;return E?(M=new v,(E.state=M).window=null,(w=C(E,L))!==h&&(E.state=null),w):p}var N,T,A=!0;function O(E){if(A){var L;for(N=new s.Buf32(512),T=new s.Buf32(32),L=0;L<144;)E.lens[L++]=8;for(;L<256;)E.lens[L++]=9;for(;L<280;)E.lens[L++]=7;for(;L<288;)E.lens[L++]=8;for(u(d,E.lens,0,288,N,0,E.work,{bits:9}),L=0;L<32;)E.lens[L++]=5;u(f,E.lens,0,32,T,0,E.work,{bits:5}),A=!1}E.lencode=N,E.lenbits=9,E.distcode=T,E.distbits=5}function $(E,L,w,M){var U,F=E.state;return F.window===null&&(F.wsize=1<<F.wbits,F.wnext=0,F.whave=0,F.window=new s.Buf8(F.wsize)),M>=F.wsize?(s.arraySet(F.window,L,w-F.wsize,F.wsize,0),F.wnext=0,F.whave=F.wsize):(M<(U=F.wsize-F.wnext)&&(U=M),s.arraySet(F.window,L,w-M,U,F.wnext),(M-=U)?(s.arraySet(F.window,L,w-M,M,0),F.wnext=M,F.whave=F.wsize):(F.wnext+=U,F.wnext===F.wsize&&(F.wnext=0),F.whave<F.wsize&&(F.whave+=U))),0}o.inflateReset=S,o.inflateReset2=C,o.inflateResetKeep=k,o.inflateInit=function(E){return j(E,15)},o.inflateInit2=j,o.inflate=function(E,L){var w,M,U,F,B,G,I,H,K,z,se,re,ue,ie,de,pe,he,me,ke,ze,_,te,Q,P,R=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(!E||!E.state||!E.output||!E.input&&E.avail_in!==0)return p;(w=E.state).mode===12&&(w.mode=13),B=E.next_out,U=E.output,I=E.avail_out,F=E.next_in,M=E.input,G=E.avail_in,H=w.hold,K=w.bits,z=G,se=I,te=h;e:for(;;)switch(w.mode){case x:if(w.wrap===0){w.mode=13;break}for(;K<16;){if(G===0)break e;G--,H+=M[F++]<<K,K+=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),K=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){E.msg="incorrect header check",w.mode=30;break}if((15&H)!=8){E.msg="unknown compression method",w.mode=30;break}if(K-=4,_=8+(15&(H>>>=4)),w.wbits===0)w.wbits=_;else if(_>w.wbits){E.msg="invalid window size",w.mode=30;break}w.dmax=1<<_,E.adler=w.check=1,w.mode=512&H?10:12,K=H=0;break;case 2:for(;K<16;){if(G===0)break e;G--,H+=M[F++]<<K,K+=8}if(w.flags=H,(255&w.flags)!=8){E.msg="unknown compression method",w.mode=30;break}if(57344&w.flags){E.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)),K=H=0,w.mode=3;case 3:for(;K<32;){if(G===0)break e;G--,H+=M[F++]<<K,K+=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)),K=H=0,w.mode=4;case 4:for(;K<16;){if(G===0)break e;G--,H+=M[F++]<<K,K+=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)),K=H=0,w.mode=5;case 5:if(1024&w.flags){for(;K<16;){if(G===0)break e;G--,H+=M[F++]<<K,K+=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)),K=H=0}else w.head&&(w.head.extra=null);w.mode=6;case 6:if(1024&w.flags&&(G<(re=w.length)&&(re=G),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,M,F,re,_)),512&w.flags&&(w.check=l(w.check,M,re,F)),G-=re,F+=re,w.length-=re),w.length))break e;w.length=0,w.mode=7;case 7:if(2048&w.flags){if(G===0)break e;for(re=0;_=M[F+re++],w.head&&_&&w.length<65536&&(w.head.name+=String.fromCharCode(_)),_&&re<G;);if(512&w.flags&&(w.check=l(w.check,M,re,F)),G-=re,F+=re,_)break e}else w.head&&(w.head.name=null);w.length=0,w.mode=8;case 8:if(4096&w.flags){if(G===0)break e;for(re=0;_=M[F+re++],w.head&&_&&w.length<65536&&(w.head.comment+=String.fromCharCode(_)),_&&re<G;);if(512&w.flags&&(w.check=l(w.check,M,re,F)),G-=re,F+=re,_)break e}else w.head&&(w.head.comment=null);w.mode=9;case 9:if(512&w.flags){for(;K<16;){if(G===0)break e;G--,H+=M[F++]<<K,K+=8}if(H!==(65535&w.check)){E.msg="header crc mismatch",w.mode=30;break}K=H=0}w.head&&(w.head.hcrc=w.flags>>9&1,w.head.done=!0),E.adler=w.check=0,w.mode=12;break;case 10:for(;K<32;){if(G===0)break e;G--,H+=M[F++]<<K,K+=8}E.adler=w.check=b(H),K=H=0,w.mode=11;case 11:if(w.havedict===0)return E.next_out=B,E.avail_out=I,E.next_in=F,E.avail_in=G,w.hold=H,w.bits=K,2;E.adler=w.check=1,w.mode=12;case 12:if(L===5||L===6)break e;case 13:if(w.last){H>>>=7&K,K-=7&K,w.mode=27;break}for(;K<3;){if(G===0)break e;G--,H+=M[F++]<<K,K+=8}switch(w.last=1&H,K-=1,3&(H>>>=1)){case 0:w.mode=14;break;case 1:if(O(w),w.mode=20,L!==6)break;H>>>=2,K-=2;break e;case 2:w.mode=17;break;case 3:E.msg="invalid block type",w.mode=30}H>>>=2,K-=2;break;case 14:for(H>>>=7&K,K-=7&K;K<32;){if(G===0)break e;G--,H+=M[F++]<<K,K+=8}if((65535&H)!=(H>>>16^65535)){E.msg="invalid stored block lengths",w.mode=30;break}if(w.length=65535&H,K=H=0,w.mode=15,L===6)break e;case 15:w.mode=16;case 16:if(re=w.length){if(G<re&&(re=G),I<re&&(re=I),re===0)break e;s.arraySet(U,M,F,re,B),G-=re,F+=re,I-=re,B+=re,w.length-=re;break}w.mode=12;break;case 17:for(;K<14;){if(G===0)break e;G--,H+=M[F++]<<K,K+=8}if(w.nlen=257+(31&H),H>>>=5,K-=5,w.ndist=1+(31&H),H>>>=5,K-=5,w.ncode=4+(15&H),H>>>=4,K-=4,286<w.nlen||30<w.ndist){E.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(;K<3;){if(G===0)break e;G--,H+=M[F++]<<K,K+=8}w.lens[Z[w.have++]]=7&H,H>>>=3,K-=3}for(;w.have<19;)w.lens[Z[w.have++]]=0;if(w.lencode=w.lendyn,w.lenbits=7,Q={bits:w.lenbits},te=u(0,w.lens,0,19,w.lencode,0,w.work,Q),w.lenbits=Q.bits,te){E.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=(R=w.lencode[H&(1<<w.lenbits)-1])>>>16&255,he=65535&R,!((de=R>>>24)<=K);){if(G===0)break e;G--,H+=M[F++]<<K,K+=8}if(he<16)H>>>=de,K-=de,w.lens[w.have++]=he;else{if(he===16){for(P=de+2;K<P;){if(G===0)break e;G--,H+=M[F++]<<K,K+=8}if(H>>>=de,K-=de,w.have===0){E.msg="invalid bit length repeat",w.mode=30;break}_=w.lens[w.have-1],re=3+(3&H),H>>>=2,K-=2}else if(he===17){for(P=de+3;K<P;){if(G===0)break e;G--,H+=M[F++]<<K,K+=8}K-=de,_=0,re=3+(7&(H>>>=de)),H>>>=3,K-=3}else{for(P=de+7;K<P;){if(G===0)break e;G--,H+=M[F++]<<K,K+=8}K-=de,_=0,re=11+(127&(H>>>=de)),H>>>=7,K-=7}if(w.have+re>w.nlen+w.ndist){E.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){E.msg="invalid code -- missing end-of-block",w.mode=30;break}if(w.lenbits=9,Q={bits:w.lenbits},te=u(d,w.lens,0,w.nlen,w.lencode,0,w.work,Q),w.lenbits=Q.bits,te){E.msg="invalid literal/lengths set",w.mode=30;break}if(w.distbits=6,w.distcode=w.distdyn,Q={bits:w.distbits},te=u(f,w.lens,w.nlen,w.ndist,w.distcode,0,w.work,Q),w.distbits=Q.bits,te){E.msg="invalid distances set",w.mode=30;break}if(w.mode=20,L===6)break e;case 20:w.mode=21;case 21:if(6<=G&&258<=I){E.next_out=B,E.avail_out=I,E.next_in=F,E.avail_in=G,w.hold=H,w.bits=K,c(E,se),B=E.next_out,U=E.output,I=E.avail_out,F=E.next_in,M=E.input,G=E.avail_in,H=w.hold,K=w.bits,w.mode===12&&(w.back=-1);break}for(w.back=0;pe=(R=w.lencode[H&(1<<w.lenbits)-1])>>>16&255,he=65535&R,!((de=R>>>24)<=K);){if(G===0)break e;G--,H+=M[F++]<<K,K+=8}if(pe&&(240&pe)==0){for(me=de,ke=pe,ze=he;pe=(R=w.lencode[ze+((H&(1<<me+ke)-1)>>me)])>>>16&255,he=65535&R,!(me+(de=R>>>24)<=K);){if(G===0)break e;G--,H+=M[F++]<<K,K+=8}H>>>=me,K-=me,w.back+=me}if(H>>>=de,K-=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){E.msg="invalid literal/length code",w.mode=30;break}w.extra=15&pe,w.mode=22;case 22:if(w.extra){for(P=w.extra;K<P;){if(G===0)break e;G--,H+=M[F++]<<K,K+=8}w.length+=H&(1<<w.extra)-1,H>>>=w.extra,K-=w.extra,w.back+=w.extra}w.was=w.length,w.mode=23;case 23:for(;pe=(R=w.distcode[H&(1<<w.distbits)-1])>>>16&255,he=65535&R,!((de=R>>>24)<=K);){if(G===0)break e;G--,H+=M[F++]<<K,K+=8}if((240&pe)==0){for(me=de,ke=pe,ze=he;pe=(R=w.distcode[ze+((H&(1<<me+ke)-1)>>me)])>>>16&255,he=65535&R,!(me+(de=R>>>24)<=K);){if(G===0)break e;G--,H+=M[F++]<<K,K+=8}H>>>=me,K-=me,w.back+=me}if(H>>>=de,K-=de,w.back+=de,64&pe){E.msg="invalid distance code",w.mode=30;break}w.offset=he,w.extra=15&pe,w.mode=24;case 24:if(w.extra){for(P=w.extra;K<P;){if(G===0)break e;G--,H+=M[F++]<<K,K+=8}w.offset+=H&(1<<w.extra)-1,H>>>=w.extra,K-=w.extra,w.back+=w.extra}if(w.offset>w.dmax){E.msg="invalid distance too far back",w.mode=30;break}w.mode=25;case 25:if(I===0)break e;if(re=se-I,w.offset>re){if((re=w.offset-re)>w.whave&&w.sane){E.msg="invalid distance too far back",w.mode=30;break}ue=re>w.wnext?(re-=w.wnext,w.wsize-re):w.wnext-re,re>w.length&&(re=w.length),ie=w.window}else ie=U,ue=B-w.offset,re=w.length;for(I<re&&(re=I),I-=re,w.length-=re;U[B++]=ie[ue++],--re;);w.length===0&&(w.mode=21);break;case 26:if(I===0)break e;U[B++]=w.length,I--,w.mode=21;break;case 27:if(w.wrap){for(;K<32;){if(G===0)break e;G--,H|=M[F++]<<K,K+=8}if(se-=I,E.total_out+=se,w.total+=se,se&&(E.adler=w.check=w.flags?l(w.check,U,se,B-se):i(w.check,U,se,B-se)),se=I,(w.flags?H:b(H))!==w.check){E.msg="incorrect data check",w.mode=30;break}K=H=0}w.mode=28;case 28:if(w.wrap&&w.flags){for(;K<32;){if(G===0)break e;G--,H+=M[F++]<<K,K+=8}if(H!==(4294967295&w.total)){E.msg="incorrect length check",w.mode=30;break}K=H=0}w.mode=29;case 29:te=1;break e;case 30:te=-3;break e;case 31:return-4;default:return p}return E.next_out=B,E.avail_out=I,E.next_in=F,E.avail_in=G,w.hold=H,w.bits=K,(w.wsize||se!==E.avail_out&&w.mode<30&&(w.mode<27||L!==4))&&$(E,E.output,E.next_out,se-E.avail_out)?(w.mode=31,-4):(z-=E.avail_in,se-=E.avail_out,E.total_in+=z,E.total_out+=se,w.total+=se,w.wrap&&se&&(E.adler=w.check=w.flags?l(w.check,U,se,E.next_out-se):i(w.check,U,se,E.next_out-se)),E.data_type=w.bits+(w.last?64:0)+(w.mode===12?128:0)+(w.mode===20||w.mode===15?256:0),(z==0&&se===0||L===4)&&te===h&&(te=-5),te)},o.inflateEnd=function(E){if(!E||!E.state)return p;var L=E.state;return L.window&&(L.window=null),E.state=null,h},o.inflateGetHeader=function(E,L){var w;return E&&E.state?(2&(w=E.state).wrap)==0?p:((w.head=L).done=!1,h):p},o.inflateSetDictionary=function(E,L){var w,M=L.length;return E&&E.state?(w=E.state).wrap!==0&&w.mode!==11?p:w.mode===11&&i(1,L,M,0)!==w.check?-3:$(E,L,M,M)?(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,x,m,g,b){var v,k,S,C,j,N,T,A,O,$=b.bits,E=0,L=0,w=0,M=0,U=0,F=0,B=0,G=0,I=0,H=0,K=null,z=0,se=new s.Buf16(16),re=new s.Buf16(16),ue=null,ie=0;for(E=0;E<=15;E++)se[E]=0;for(L=0;L<p;L++)se[f[h+L]]++;for(U=$,M=15;1<=M&&se[M]===0;M--);if(M<U&&(U=M),M===0)return x[m++]=20971520,x[m++]=20971520,b.bits=1,0;for(w=1;w<M&&se[w]===0;w++);for(U<w&&(U=w),E=G=1;E<=15;E++)if(G<<=1,(G-=se[E])<0)return-1;if(0<G&&(d===0||M!==1))return-1;for(re[1]=0,E=1;E<15;E++)re[E+1]=re[E]+se[E];for(L=0;L<p;L++)f[h+L]!==0&&(g[re[f[h+L]]++]=L);if(N=d===0?(K=ue=g,19):d===1?(K=i,z-=257,ue=l,ie-=257,256):(K=c,ue=u,-1),E=w,j=m,B=L=H=0,S=-1,C=(I=1<<(F=U))-1,d===1&&852<I||d===2&&592<I)return 1;for(;;){for(T=E-B,O=g[L]<N?(A=0,g[L]):g[L]>N?(A=ue[ie+g[L]],K[z+g[L]]):(A=96,0),v=1<<E-B,w=k=1<<F;x[j+(H>>B)+(k-=v)]=T<<24|A<<16|O|0,k!==0;);for(v=1<<E-1;H&v;)v>>=1;if(v!==0?(H&=v-1,H+=v):H=0,L++,--se[E]==0){if(E===M)break;E=f[h+g[L]]}if(U<E&&(H&C)!==S){for(B===0&&(B=U),j+=w,G=1<<(F=E-B);F+B<M&&!((G-=se[F+B])<=0);)F++,G<<=1;if(I+=1<<F,d===1&&852<I||d===2&&592<I)return 1;x[S=H&C]=U<<24|F<<16|j-m|0}}return H!==0&&(x[j+H]=E-B<<24|64<<16|0),b.bits=U,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(R){for(var q=R.length;0<=--q;)R[q]=0}var u=0,d=29,f=256,h=f+1+d,p=30,x=19,m=2*h+1,g=15,b=16,v=7,k=256,S=16,C=17,j=18,N=[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],A=[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],$=new Array(2*(h+2));c($);var E=new Array(2*p);c(E);var L=new Array(512);c(L);var w=new Array(256);c(w);var M=new Array(d);c(M);var U,F,B,G=new Array(p);function I(R,q,Z,J,V){this.static_tree=R,this.extra_bits=q,this.extra_base=Z,this.elems=J,this.max_length=V,this.has_stree=R&&R.length}function H(R,q){this.dyn_tree=R,this.max_code=0,this.stat_desc=q}function K(R){return R<256?L[R]:L[256+(R>>>7)]}function z(R,q){R.pending_buf[R.pending++]=255&q,R.pending_buf[R.pending++]=q>>>8&255}function se(R,q,Z){R.bi_valid>b-Z?(R.bi_buf|=q<<R.bi_valid&65535,z(R,R.bi_buf),R.bi_buf=q>>b-R.bi_valid,R.bi_valid+=Z-b):(R.bi_buf|=q<<R.bi_valid&65535,R.bi_valid+=Z)}function re(R,q,Z){se(R,Z[2*q],Z[2*q+1])}function ue(R,q){for(var Z=0;Z|=1&R,R>>>=1,Z<<=1,0<--q;);return Z>>>1}function ie(R,q,Z){var J,V,oe=new Array(g+1),Y=0;for(J=1;J<=g;J++)oe[J]=Y=Y+Z[J-1]<<1;for(V=0;V<=q;V++){var ee=R[2*V+1];ee!==0&&(R[2*V]=ue(oe[ee]++,ee))}}function de(R){var q;for(q=0;q<h;q++)R.dyn_ltree[2*q]=0;for(q=0;q<p;q++)R.dyn_dtree[2*q]=0;for(q=0;q<x;q++)R.bl_tree[2*q]=0;R.dyn_ltree[2*k]=1,R.opt_len=R.static_len=0,R.last_lit=R.matches=0}function pe(R){8<R.bi_valid?z(R,R.bi_buf):0<R.bi_valid&&(R.pending_buf[R.pending++]=R.bi_buf),R.bi_buf=0,R.bi_valid=0}function he(R,q,Z,J){var V=2*q,oe=2*Z;return R[V]<R[oe]||R[V]===R[oe]&&J[q]<=J[Z]}function me(R,q,Z){for(var J=R.heap[Z],V=Z<<1;V<=R.heap_len&&(V<R.heap_len&&he(q,R.heap[V+1],R.heap[V],R.depth)&&V++,!he(q,J,R.heap[V],R.depth));)R.heap[Z]=R.heap[V],Z=V,V<<=1;R.heap[Z]=J}function ke(R,q,Z){var J,V,oe,Y,ee=0;if(R.last_lit!==0)for(;J=R.pending_buf[R.d_buf+2*ee]<<8|R.pending_buf[R.d_buf+2*ee+1],V=R.pending_buf[R.l_buf+ee],ee++,J===0?re(R,V,q):(re(R,(oe=w[V])+f+1,q),(Y=N[oe])!==0&&se(R,V-=M[oe],Y),re(R,oe=K(--J),Z),(Y=T[oe])!==0&&se(R,J-=G[oe],Y)),ee<R.last_lit;);re(R,k,q)}function ze(R,q){var Z,J,V,oe=q.dyn_tree,Y=q.stat_desc.static_tree,ee=q.stat_desc.has_stree,D=q.stat_desc.elems,X=-1;for(R.heap_len=0,R.heap_max=m,Z=0;Z<D;Z++)oe[2*Z]!==0?(R.heap[++R.heap_len]=X=Z,R.depth[Z]=0):oe[2*Z+1]=0;for(;R.heap_len<2;)oe[2*(V=R.heap[++R.heap_len]=X<2?++X:0)]=1,R.depth[V]=0,R.opt_len--,ee&&(R.static_len-=Y[2*V+1]);for(q.max_code=X,Z=R.heap_len>>1;1<=Z;Z--)me(R,oe,Z);for(V=D;Z=R.heap[1],R.heap[1]=R.heap[R.heap_len--],me(R,oe,1),J=R.heap[1],R.heap[--R.heap_max]=Z,R.heap[--R.heap_max]=J,oe[2*V]=oe[2*Z]+oe[2*J],R.depth[V]=(R.depth[Z]>=R.depth[J]?R.depth[Z]:R.depth[J])+1,oe[2*Z+1]=oe[2*J+1]=V,R.heap[1]=V++,me(R,oe,1),2<=R.heap_len;);R.heap[--R.heap_max]=R.heap[1],(function(ae,ge){var Ee,Be,ft,Pe,zt,Zt,Ke=ge.dyn_tree,qt=ge.max_code,_t=ge.stat_desc.static_tree,Cg=ge.stat_desc.has_stree,jg=ge.stat_desc.extra_bits,Sl=ge.stat_desc.extra_base,pr=ge.stat_desc.max_length,Gr=0;for(Pe=0;Pe<=g;Pe++)ae.bl_count[Pe]=0;for(Ke[2*ae.heap[ae.heap_max]+1]=0,Ee=ae.heap_max+1;Ee<m;Ee++)pr<(Pe=Ke[2*Ke[2*(Be=ae.heap[Ee])+1]+1]+1)&&(Pe=pr,Gr++),Ke[2*Be+1]=Pe,qt<Be||(ae.bl_count[Pe]++,zt=0,Sl<=Be&&(zt=jg[Be-Sl]),Zt=Ke[2*Be],ae.opt_len+=Zt*(Pe+zt),Cg&&(ae.static_len+=Zt*(_t[2*Be+1]+zt)));if(Gr!==0){do{for(Pe=pr-1;ae.bl_count[Pe]===0;)Pe--;ae.bl_count[Pe]--,ae.bl_count[Pe+1]+=2,ae.bl_count[pr]--,Gr-=2}while(0<Gr);for(Pe=pr;Pe!==0;Pe--)for(Be=ae.bl_count[Pe];Be!==0;)qt<(ft=ae.heap[--Ee])||(Ke[2*ft+1]!==Pe&&(ae.opt_len+=(Pe-Ke[2*ft+1])*Ke[2*ft],Ke[2*ft+1]=Pe),Be--)}})(R,q),ie(oe,X,R.bl_count)}function _(R,q,Z){var J,V,oe=-1,Y=q[1],ee=0,D=7,X=4;for(Y===0&&(D=138,X=3),q[2*(Z+1)+1]=65535,J=0;J<=Z;J++)V=Y,Y=q[2*(J+1)+1],++ee<D&&V===Y||(ee<X?R.bl_tree[2*V]+=ee:V!==0?(V!==oe&&R.bl_tree[2*V]++,R.bl_tree[2*S]++):ee<=10?R.bl_tree[2*C]++:R.bl_tree[2*j]++,oe=V,X=(ee=0)===Y?(D=138,3):V===Y?(D=6,3):(D=7,4))}function te(R,q,Z){var J,V,oe=-1,Y=q[1],ee=0,D=7,X=4;for(Y===0&&(D=138,X=3),J=0;J<=Z;J++)if(V=Y,Y=q[2*(J+1)+1],!(++ee<D&&V===Y)){if(ee<X)for(;re(R,V,R.bl_tree),--ee!=0;);else V!==0?(V!==oe&&(re(R,V,R.bl_tree),ee--),re(R,S,R.bl_tree),se(R,ee-3,2)):ee<=10?(re(R,C,R.bl_tree),se(R,ee-3,3)):(re(R,j,R.bl_tree),se(R,ee-11,7));oe=V,X=(ee=0)===Y?(D=138,3):V===Y?(D=6,3):(D=7,4)}}c(G);var Q=!1;function P(R,q,Z,J){se(R,(u<<1)+(J?1:0),3),(function(V,oe,Y,ee){pe(V),z(V,Y),z(V,~Y),s.arraySet(V.pending_buf,V.window,oe,Y,V.pending),V.pending+=Y})(R,q,Z)}o._tr_init=function(R){Q||((function(){var q,Z,J,V,oe,Y=new Array(g+1);for(V=J=0;V<d-1;V++)for(M[V]=J,q=0;q<1<<N[V];q++)w[J++]=V;for(w[J-1]=V,V=oe=0;V<16;V++)for(G[V]=oe,q=0;q<1<<T[V];q++)L[oe++]=V;for(oe>>=7;V<p;V++)for(G[V]=oe<<7,q=0;q<1<<T[V]-7;q++)L[256+oe++]=V;for(Z=0;Z<=g;Z++)Y[Z]=0;for(q=0;q<=143;)$[2*q+1]=8,q++,Y[8]++;for(;q<=255;)$[2*q+1]=9,q++,Y[9]++;for(;q<=279;)$[2*q+1]=7,q++,Y[7]++;for(;q<=287;)$[2*q+1]=8,q++,Y[8]++;for(ie($,h+1,Y),q=0;q<p;q++)E[2*q+1]=5,E[2*q]=ue(q,5);U=new I($,N,f+1,h,g),F=new I(E,T,0,p,g),B=new I(new Array(0),A,0,x,v)})(),Q=!0),R.l_desc=new H(R.dyn_ltree,U),R.d_desc=new H(R.dyn_dtree,F),R.bl_desc=new H(R.bl_tree,B),R.bi_buf=0,R.bi_valid=0,de(R)},o._tr_stored_block=P,o._tr_flush_block=function(R,q,Z,J){var V,oe,Y=0;0<R.level?(R.strm.data_type===2&&(R.strm.data_type=(function(ee){var D,X=4093624447;for(D=0;D<=31;D++,X>>>=1)if(1&X&&ee.dyn_ltree[2*D]!==0)return i;if(ee.dyn_ltree[18]!==0||ee.dyn_ltree[20]!==0||ee.dyn_ltree[26]!==0)return l;for(D=32;D<f;D++)if(ee.dyn_ltree[2*D]!==0)return l;return i})(R)),ze(R,R.l_desc),ze(R,R.d_desc),Y=(function(ee){var D;for(_(ee,ee.dyn_ltree,ee.l_desc.max_code),_(ee,ee.dyn_dtree,ee.d_desc.max_code),ze(ee,ee.bl_desc),D=x-1;3<=D&&ee.bl_tree[2*O[D]+1]===0;D--);return ee.opt_len+=3*(D+1)+5+5+4,D})(R),V=R.opt_len+3+7>>>3,(oe=R.static_len+3+7>>>3)<=V&&(V=oe)):V=oe=Z+5,Z+4<=V&&q!==-1?P(R,q,Z,J):R.strategy===4||oe===V?(se(R,2+(J?1:0),3),ke(R,$,E)):(se(R,4+(J?1:0),3),(function(ee,D,X,ae){var ge;for(se(ee,D-257,5),se(ee,X-1,5),se(ee,ae-4,4),ge=0;ge<ae;ge++)se(ee,ee.bl_tree[2*O[ge]+1],3);te(ee,ee.dyn_ltree,D-1),te(ee,ee.dyn_dtree,X-1)})(R,R.l_desc.max_code+1,R.d_desc.max_code+1,Y+1),ke(R,R.dyn_ltree,R.dyn_dtree)),de(R),J&&pe(R)},o._tr_tally=function(R,q,Z){return R.pending_buf[R.d_buf+2*R.last_lit]=q>>>8&255,R.pending_buf[R.d_buf+2*R.last_lit+1]=255&q,R.pending_buf[R.l_buf+R.last_lit]=255&Z,R.last_lit++,q===0?R.dyn_ltree[2*Z]++:(R.matches++,q--,R.dyn_ltree[2*(w[Z]+f+1)]++,R.dyn_dtree[2*K(q)]++),R.last_lit===R.lit_bufsize-1},o._tr_align=function(R){se(R,2,3),re(R,k,$),(function(q){q.bi_valid===16?(z(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)})(R)}},{"../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={},x=!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 N={callback:S,args:C};return p[h]=N,c(h),h++},g.clearImmediate=b}function b(S){delete p[S]}function v(S){if(x)setTimeout(v,0,S);else{var C=p[S];if(C){x=!0;try{(function(j){var N=j.callback,T=j.args;switch(T.length){case 0:N();break;case 1:N(T[0]);break;case 2:N(T[0],T[1]);break;case 3:N(T[0],T[1],T[2]);break;default:N.apply(l,T)}})(C)}finally{b(S),x=!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 Yr<"u"?Yr:typeof self<"u"?self:typeof window<"u"?window:{})},{}]},{},[10])(10)})})(Rs)),Rs.exports}var t2=e2();const n2=da(t2),mf="[REDACTED]",r2=/(^|[-_])(api[-_]?key|authorization|cookie|token|secret|password|access[-_]?token|refresh[-_]?token)([-_]|$)/i,o2=[/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],Xl=200,s2=25e6,Ql=50;function i2(e){return e<1024?`${e} chars`:e<1024*1024?`${Math.ceil(e/1024)} KB`:`${Math.ceil(e/(1024*1024))} MB`}function a2(e){let t=0;for(const n of e)t+=n.rawRequestBody?.length??0,t+=n.responseText?.length??0;return t}function l2(e){if(e.length>Xl)return`Export is limited to ${Xl} logs at once. Narrow the filter and try again.`;const t=a2(e);return t>s2?`Export is too large (${i2(t)} of text). Narrow the filter and try again.`:null}async function c2(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 u2(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function Ci(e){if(Array.isArray(e))return e.map(n=>Ci(n));if(!u2(e))return e;const t={};for(const[n,r]of Object.entries(e))t[n]=r2.test(n)?mf:Ci(r);return t}function d2(e){const t=n=>{let r=n;for(const o of o2)r=r.replace(o,mf);return r};try{const n=JSON.parse(e);return t(JSON.stringify(Ci(n),null,2))}catch{return t(e)}}function Ps(e,t){return t==="redacted"?d2(e):e}async function f2(e,t="redacted"){const n=l2(e);if(n!==null)return{ok:!1,message:n};const r=new n2,o=t==="redacted"?"redacted":"raw",s=e.filter(u=>u.streaming).slice(0,Ql);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:Ql,streamingChunkLogIds:s.map(u=>u.id)},null,2));for(const u of e)u.rawRequestBody!==null&&r.file(`#${u.id}.Request.json`,Ps(u.rawRequestBody,t)),u.responseText!==null&&r.file(`#${u.id}.Response.json`,Ps(u.responseText,t));for(const u of s){const d=await c2(u.id);d!==null&&r.file(`#${u.id}.SSE.Response.json`,Ps(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 ji(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 Ea(e,t,n){return`${ji(e,n)} - ${ji(t,n)}`}function gf(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=gf(e[t]))&&(r&&(r+=" "),r+=n)}else for(n in e)e[n]&&(r&&(r+=" "),r+=n);return r}function xf(){for(var e,t,n=0,r="",o=arguments.length;n<o;n++)(e=arguments[n])&&(t=gf(e))&&(r&&(r+=" "),r+=t);return r}const p2=(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},h2=(e,t)=>({classGroupId:e,validator:t}),yf=(e=new Map,t=null,n)=>({nextPart:e,validators:t,classGroupId:n}),zo="-",ec=[],m2="arbitrary..",g2=e=>{const t=y2(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=e;return{getClassGroupId:i=>{if(i.startsWith("[")&&i.endsWith("]"))return x2(i);const l=i.split(zo),c=l[0]===""&&l.length>1?1:0;return bf(l,c,t)},getConflictingClassGroupIds:(i,l)=>{if(l){const c=r[i],u=n[i];return c?u?p2(u,c):c:u||ec}return n[i]||ec}}},bf=(e,t,n)=>{if(e.length-t===0)return n.classGroupId;const o=e[t],s=n.nextPart.get(o);if(s){const u=bf(e,t+1,s);if(u)return u}const i=n.validators;if(i===null)return;const l=t===0?e.join(zo):e.slice(t).join(zo),c=i.length;for(let u=0;u<c;u++){const d=i[u];if(d.validator(l))return d.classGroupId}},x2=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?m2+r:void 0})(),y2=e=>{const{theme:t,classGroups:n}=e;return b2(n,t)},b2=(e,t)=>{const n=yf();for(const r in e){const o=e[r];Na(o,n,r,t)}return n},Na=(e,t,n,r)=>{const o=e.length;for(let s=0;s<o;s++){const i=e[s];v2(i,t,n,r)}},v2=(e,t,n,r)=>{if(typeof e=="string"){w2(e,t,n);return}if(typeof e=="function"){k2(e,t,n,r);return}_2(e,t,n,r)},w2=(e,t,n)=>{const r=e===""?t:vf(t,e);r.classGroupId=n},k2=(e,t,n,r)=>{if(S2(e)){Na(e(r),t,n,r);return}t.validators===null&&(t.validators=[]),t.validators.push(h2(n,e))},_2=(e,t,n,r)=>{const o=Object.entries(e),s=o.length;for(let i=0;i<s;i++){const[l,c]=o[i];Na(c,vf(t,l),n,r)}},vf=(e,t)=>{let n=e;const r=t.split(zo),o=r.length;for(let s=0;s<o;s++){const i=r[s];let l=n.nextPart.get(i);l||(l=yf(),n.nextPart.set(i,l)),n=l}return n},S2=e=>"isThemeGetter"in e&&e.isThemeGetter===!0,C2=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)}}},Ei="!",tc=":",j2=[],nc=(e,t,n,r,o)=>({modifiers:e,hasImportantModifier:t,baseClassName:n,maybePostfixModifierPosition:r,isExternal:o}),E2=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===tc){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(Ei)?(h=f.slice(0,-1),p=!0):f.startsWith(Ei)&&(h=f.slice(1),p=!0);const x=u&&u>c?u-c:void 0;return nc(s,p,h,x)};if(t){const o=t+tc,s=r;r=i=>i.startsWith(o)?s(i.slice(o.length)):nc(j2,!1,i,void 0,!0)}if(n){const o=r;r=s=>n({className:s,parseClassName:o})}return r},N2=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}},T2=e=>({cache:C2(e.cacheSize),parseClassName:E2(e),sortModifiers:N2(e),...g2(e)}),A2=/\s+/,I2=(e,t)=>{const{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:o,sortModifiers:s}=t,i=[],l=e.trim().split(A2);let c="";for(let u=l.length-1;u>=0;u-=1){const d=l[u],{isExternal:f,modifiers:h,hasImportantModifier:p,baseClassName:x,maybePostfixModifierPosition:m}=n(d);if(f){c=d+(c.length>0?" "+c:c);continue}let g=!!m,b=r(g?x.substring(0,m):x);if(!b){if(!g){c=d+(c.length>0?" "+c:c);continue}if(b=r(x),!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+Ei: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 N=C[j];i.push(k+N)}c=d+(c.length>0?" "+c:c)}return c},z2=(...e)=>{let t=0,n,r,o="";for(;t<e.length;)(n=e[t++])&&(r=wf(n))&&(o&&(o+=" "),o+=r);return o},wf=e=>{if(typeof e=="string")return e;let t,n="";for(let r=0;r<e.length;r++)e[r]&&(t=wf(e[r]))&&(n&&(n+=" "),n+=t);return n},R2=(e,...t)=>{let n,r,o,s;const i=c=>{const u=t.reduce((d,f)=>f(d),e());return n=T2(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=I2(c,n);return o(c,d),d};return s=i,(...c)=>s(z2(...c))},P2=[],Qe=e=>{const t=n=>n[e]||P2;return t.isThemeGetter=!0,t},kf=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,_f=/^\((?:(\w[\w-]*):)?(.+)\)$/i,O2=/^\d+\/\d+$/,M2=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,L2=/\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$/,D2=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,F2=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,$2=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Rn=e=>O2.test(e),Ae=e=>!!e&&!Number.isNaN(Number(e)),nn=e=>!!e&&Number.isInteger(Number(e)),Os=e=>e.endsWith("%")&&Ae(e.slice(0,-1)),Kt=e=>M2.test(e),B2=()=>!0,U2=e=>L2.test(e)&&!D2.test(e),Sf=()=>!1,W2=e=>F2.test(e),V2=e=>$2.test(e),H2=e=>!ye(e)&&!be(e),Z2=e=>sr(e,Ef,Sf),ye=e=>kf.test(e),yn=e=>sr(e,Nf,U2),Ms=e=>sr(e,Y2,Ae),rc=e=>sr(e,Cf,Sf),q2=e=>sr(e,jf,V2),ro=e=>sr(e,Tf,W2),be=e=>_f.test(e),hr=e=>ir(e,Nf),K2=e=>ir(e,X2),oc=e=>ir(e,Cf),J2=e=>ir(e,Ef),G2=e=>ir(e,jf),oo=e=>ir(e,Tf,!0),sr=(e,t,n)=>{const r=kf.exec(e);return r?r[1]?t(r[1]):n(r[2]):!1},ir=(e,t,n=!1)=>{const r=_f.exec(e);return r?r[1]?t(r[1]):n:!1},Cf=e=>e==="position"||e==="percentage",jf=e=>e==="image"||e==="url",Ef=e=>e==="length"||e==="size"||e==="bg-size",Nf=e=>e==="length",Y2=e=>e==="number",X2=e=>e==="family-name",Tf=e=>e==="shadow",Q2=()=>{const e=Qe("color"),t=Qe("font"),n=Qe("text"),r=Qe("font-weight"),o=Qe("tracking"),s=Qe("leading"),i=Qe("breakpoint"),l=Qe("container"),c=Qe("spacing"),u=Qe("radius"),d=Qe("shadow"),f=Qe("inset-shadow"),h=Qe("text-shadow"),p=Qe("drop-shadow"),x=Qe("blur"),m=Qe("perspective"),g=Qe("aspect"),b=Qe("ease"),v=Qe("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(),be,ye],j=()=>["auto","hidden","clip","visible","scroll"],N=()=>["auto","contain","none"],T=()=>[be,ye,c],A=()=>[Rn,"full","auto",...T()],O=()=>[nn,"none","subgrid",be,ye],$=()=>["auto",{span:["full",nn,be,ye]},nn,be,ye],E=()=>[nn,"auto",be,ye],L=()=>["auto","min","max","fr",be,ye],w=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],M=()=>["start","end","center","stretch","center-safe","end-safe"],U=()=>["auto",...T()],F=()=>[Rn,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...T()],B=()=>[e,be,ye],G=()=>[...S(),oc,rc,{position:[be,ye]}],I=()=>["no-repeat",{repeat:["","x","y","space","round"]}],H=()=>["auto","cover","contain",J2,Z2,{size:[be,ye]}],K=()=>[Os,hr,yn],z=()=>["","none","full",u,be,ye],se=()=>["",Ae,hr,yn],re=()=>["solid","dashed","dotted","double"],ue=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],ie=()=>[Ae,Os,oc,rc],de=()=>["","none",x,be,ye],pe=()=>["none",Ae,be,ye],he=()=>["none",Ae,be,ye],me=()=>[Ae,be,ye],ke=()=>[Rn,"full",...T()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[Kt],breakpoint:[Kt],color:[B2],container:[Kt],"drop-shadow":[Kt],ease:["in","out","in-out"],font:[H2],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[Kt],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[Kt],shadow:[Kt],spacing:["px",Ae],text:[Kt],"text-shadow":[Kt],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",Rn,ye,be,g]}],container:["container"],columns:[{columns:[Ae,ye,be,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:N()}],"overscroll-x":[{"overscroll-x":N()}],"overscroll-y":[{"overscroll-y":N()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:A()}],"inset-x":[{"inset-x":A()}],"inset-y":[{"inset-y":A()}],start:[{start:A()}],end:[{end:A()}],top:[{top:A()}],right:[{right:A()}],bottom:[{bottom:A()}],left:[{left:A()}],visibility:["visible","invisible","collapse"],z:[{z:[nn,"auto",be,ye]}],basis:[{basis:[Rn,"full","auto",l,...T()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[Ae,Rn,"auto","initial","none",ye]}],grow:[{grow:["",Ae,be,ye]}],shrink:[{shrink:["",Ae,be,ye]}],order:[{order:[nn,"first","last","none",be,ye]}],"grid-cols":[{"grid-cols":O()}],"col-start-end":[{col:$()}],"col-start":[{"col-start":E()}],"col-end":[{"col-end":E()}],"grid-rows":[{"grid-rows":O()}],"row-start-end":[{row:$()}],"row-start":[{"row-start":E()}],"row-end":[{"row-end":E()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":L()}],"auto-rows":[{"auto-rows":L()}],gap:[{gap:T()}],"gap-x":[{"gap-x":T()}],"gap-y":[{"gap-y":T()}],"justify-content":[{justify:[...w(),"normal"]}],"justify-items":[{"justify-items":[...M(),"normal"]}],"justify-self":[{"justify-self":["auto",...M()]}],"align-content":[{content:["normal",...w()]}],"align-items":[{items:[...M(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...M(),{baseline:["","last"]}]}],"place-content":[{"place-content":w()}],"place-items":[{"place-items":[...M(),"baseline"]}],"place-self":[{"place-self":["auto",...M()]}],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:U()}],mx:[{mx:U()}],my:[{my:U()}],ms:[{ms:U()}],me:[{me:U()}],mt:[{mt:U()}],mr:[{mr:U()}],mb:[{mb:U()}],ml:[{ml:U()}],"space-x":[{"space-x":T()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":T()}],"space-y-reverse":["space-y-reverse"],size:[{size:F()}],w:[{w:[l,"screen",...F()]}],"min-w":[{"min-w":[l,"screen","none",...F()]}],"max-w":[{"max-w":[l,"screen","none","prose",{screen:[i]},...F()]}],h:[{h:["screen","lh",...F()]}],"min-h":[{"min-h":["screen","lh","none",...F()]}],"max-h":[{"max-h":["screen","lh",...F()]}],"font-size":[{text:["base",n,hr,yn]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[r,be,Ms]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",Os,ye]}],"font-family":[{font:[K2,ye,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,be,ye]}],"line-clamp":[{"line-clamp":[Ae,"none",be,Ms]}],leading:[{leading:[s,...T()]}],"list-image":[{"list-image":["none",be,ye]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",be,ye]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:B()}],"text-color":[{text:B()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...re(),"wavy"]}],"text-decoration-thickness":[{decoration:[Ae,"from-font","auto",be,yn]}],"text-decoration-color":[{decoration:B()}],"underline-offset":[{"underline-offset":[Ae,"auto",be,ye]}],"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",be,ye]}],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",be,ye]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:G()}],"bg-repeat":[{bg:I()}],"bg-size":[{bg:H()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},nn,be,ye],radial:["",be,ye],conic:[nn,be,ye]},G2,q2]}],"bg-color":[{bg:B()}],"gradient-from-pos":[{from:K()}],"gradient-via-pos":[{via:K()}],"gradient-to-pos":[{to:K()}],"gradient-from":[{from:B()}],"gradient-via":[{via:B()}],"gradient-to":[{to:B()}],rounded:[{rounded:z()}],"rounded-s":[{"rounded-s":z()}],"rounded-e":[{"rounded-e":z()}],"rounded-t":[{"rounded-t":z()}],"rounded-r":[{"rounded-r":z()}],"rounded-b":[{"rounded-b":z()}],"rounded-l":[{"rounded-l":z()}],"rounded-ss":[{"rounded-ss":z()}],"rounded-se":[{"rounded-se":z()}],"rounded-ee":[{"rounded-ee":z()}],"rounded-es":[{"rounded-es":z()}],"rounded-tl":[{"rounded-tl":z()}],"rounded-tr":[{"rounded-tr":z()}],"rounded-br":[{"rounded-br":z()}],"rounded-bl":[{"rounded-bl":z()}],"border-w":[{border:se()}],"border-w-x":[{"border-x":se()}],"border-w-y":[{"border-y":se()}],"border-w-s":[{"border-s":se()}],"border-w-e":[{"border-e":se()}],"border-w-t":[{"border-t":se()}],"border-w-r":[{"border-r":se()}],"border-w-b":[{"border-b":se()}],"border-w-l":[{"border-l":se()}],"divide-x":[{"divide-x":se()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":se()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...re(),"hidden","none"]}],"divide-style":[{divide:[...re(),"hidden","none"]}],"border-color":[{border:B()}],"border-color-x":[{"border-x":B()}],"border-color-y":[{"border-y":B()}],"border-color-s":[{"border-s":B()}],"border-color-e":[{"border-e":B()}],"border-color-t":[{"border-t":B()}],"border-color-r":[{"border-r":B()}],"border-color-b":[{"border-b":B()}],"border-color-l":[{"border-l":B()}],"divide-color":[{divide:B()}],"outline-style":[{outline:[...re(),"none","hidden"]}],"outline-offset":[{"outline-offset":[Ae,be,ye]}],"outline-w":[{outline:["",Ae,hr,yn]}],"outline-color":[{outline:B()}],shadow:[{shadow:["","none",d,oo,ro]}],"shadow-color":[{shadow:B()}],"inset-shadow":[{"inset-shadow":["none",f,oo,ro]}],"inset-shadow-color":[{"inset-shadow":B()}],"ring-w":[{ring:se()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:B()}],"ring-offset-w":[{"ring-offset":[Ae,yn]}],"ring-offset-color":[{"ring-offset":B()}],"inset-ring-w":[{"inset-ring":se()}],"inset-ring-color":[{"inset-ring":B()}],"text-shadow":[{"text-shadow":["none",h,oo,ro]}],"text-shadow-color":[{"text-shadow":B()}],opacity:[{opacity:[Ae,be,ye]}],"mix-blend":[{"mix-blend":[...ue(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":ue()}],"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":[Ae]}],"mask-image-linear-from-pos":[{"mask-linear-from":ie()}],"mask-image-linear-to-pos":[{"mask-linear-to":ie()}],"mask-image-linear-from-color":[{"mask-linear-from":B()}],"mask-image-linear-to-color":[{"mask-linear-to":B()}],"mask-image-t-from-pos":[{"mask-t-from":ie()}],"mask-image-t-to-pos":[{"mask-t-to":ie()}],"mask-image-t-from-color":[{"mask-t-from":B()}],"mask-image-t-to-color":[{"mask-t-to":B()}],"mask-image-r-from-pos":[{"mask-r-from":ie()}],"mask-image-r-to-pos":[{"mask-r-to":ie()}],"mask-image-r-from-color":[{"mask-r-from":B()}],"mask-image-r-to-color":[{"mask-r-to":B()}],"mask-image-b-from-pos":[{"mask-b-from":ie()}],"mask-image-b-to-pos":[{"mask-b-to":ie()}],"mask-image-b-from-color":[{"mask-b-from":B()}],"mask-image-b-to-color":[{"mask-b-to":B()}],"mask-image-l-from-pos":[{"mask-l-from":ie()}],"mask-image-l-to-pos":[{"mask-l-to":ie()}],"mask-image-l-from-color":[{"mask-l-from":B()}],"mask-image-l-to-color":[{"mask-l-to":B()}],"mask-image-x-from-pos":[{"mask-x-from":ie()}],"mask-image-x-to-pos":[{"mask-x-to":ie()}],"mask-image-x-from-color":[{"mask-x-from":B()}],"mask-image-x-to-color":[{"mask-x-to":B()}],"mask-image-y-from-pos":[{"mask-y-from":ie()}],"mask-image-y-to-pos":[{"mask-y-to":ie()}],"mask-image-y-from-color":[{"mask-y-from":B()}],"mask-image-y-to-color":[{"mask-y-to":B()}],"mask-image-radial":[{"mask-radial":[be,ye]}],"mask-image-radial-from-pos":[{"mask-radial-from":ie()}],"mask-image-radial-to-pos":[{"mask-radial-to":ie()}],"mask-image-radial-from-color":[{"mask-radial-from":B()}],"mask-image-radial-to-color":[{"mask-radial-to":B()}],"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":[Ae]}],"mask-image-conic-from-pos":[{"mask-conic-from":ie()}],"mask-image-conic-to-pos":[{"mask-conic-to":ie()}],"mask-image-conic-from-color":[{"mask-conic-from":B()}],"mask-image-conic-to-color":[{"mask-conic-to":B()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:G()}],"mask-repeat":[{mask:I()}],"mask-size":[{mask:H()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",be,ye]}],filter:[{filter:["","none",be,ye]}],blur:[{blur:de()}],brightness:[{brightness:[Ae,be,ye]}],contrast:[{contrast:[Ae,be,ye]}],"drop-shadow":[{"drop-shadow":["","none",p,oo,ro]}],"drop-shadow-color":[{"drop-shadow":B()}],grayscale:[{grayscale:["",Ae,be,ye]}],"hue-rotate":[{"hue-rotate":[Ae,be,ye]}],invert:[{invert:["",Ae,be,ye]}],saturate:[{saturate:[Ae,be,ye]}],sepia:[{sepia:["",Ae,be,ye]}],"backdrop-filter":[{"backdrop-filter":["","none",be,ye]}],"backdrop-blur":[{"backdrop-blur":de()}],"backdrop-brightness":[{"backdrop-brightness":[Ae,be,ye]}],"backdrop-contrast":[{"backdrop-contrast":[Ae,be,ye]}],"backdrop-grayscale":[{"backdrop-grayscale":["",Ae,be,ye]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[Ae,be,ye]}],"backdrop-invert":[{"backdrop-invert":["",Ae,be,ye]}],"backdrop-opacity":[{"backdrop-opacity":[Ae,be,ye]}],"backdrop-saturate":[{"backdrop-saturate":[Ae,be,ye]}],"backdrop-sepia":[{"backdrop-sepia":["",Ae,be,ye]}],"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",be,ye]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[Ae,"initial",be,ye]}],ease:[{ease:["linear","initial",b,be,ye]}],delay:[{delay:[Ae,be,ye]}],animate:[{animate:["none",v,be,ye]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[m,be,ye]}],"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:[be,ye,"","none","gpu","cpu"]}],"transform-origin":[{origin:C()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:ke()}],"translate-x":[{"translate-x":ke()}],"translate-y":[{"translate-y":ke()}],"translate-z":[{"translate-z":ke()}],"translate-none":["translate-none"],accent:[{accent:B()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:B()}],"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",be,ye]}],"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",be,ye]}],fill:[{fill:["none",...B()]}],"stroke-w":[{stroke:[Ae,hr,yn,Ms]}],stroke:[{stroke:["none",...B()]}],"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"]}},ek=R2(Q2);function ve(...e){return ek(xf(e))}function Ve(e){return e>=1e6?(e/1e6).toFixed(1).replace(/\.0$/,"")+"M":(e/1e3).toFixed(1).replace(/\.0$/,"")+"K"}function Af(e){return e>=1024*1024?(e/(1024*1024)).toFixed(1).replace(/\.0$/,"")+"M":(e/1024).toFixed(1).replace(/\.0$/,"")+"K"}function sc(e,t,n){const r=e*10;return!Number.isSafeInteger(r)||r%t!==0?null:(r/t/10).toFixed(1).replace(/\.0$/,"")+n}function tk(e){if(!Number.isSafeInteger(e)||e<=0)return e.toString();if(e>=1024*1024){const n=sc(e,1048576,"M");if(n!==null)return n}const t=sc(e,1024,"K");return t!==null?t:e.toString()}function nk(e){if(e===void 0||e==="")return 1;switch(e.toLowerCase()){case"k":return 1024;case"m":return 1024*1024;default:return null}}function Ro(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=nk(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 rk(e){return e===null?"pending":e>=200&&e<300?"success":e>=400&&e<500?"client_error":e>=500?"server_error":"pending"}const ok=le({model:W().min(1),contextWindow:fe().int().positive().optional(),outputLimit:fe().int().positive().optional(),source:Xe(["manual","registry"]).optional(),sourceUrl:W().optional(),updatedAt:W().optional()}),Po=le({id:W(),name:W(),apiKey:W(),model:W().optional(),models:Ce(W()).min(1),format:Xe(["anthropic","openai"]).optional(),baseUrl:W().optional(),anthropicBaseUrl:W().optional(),openaiBaseUrl:W().optional(),authHeader:Xe(["bearer","x-api-key"]).optional().default("bearer"),apiDocsUrl:W().optional(),modelMetadataUrl:W().optional(),modelMetadata:Ce(ok).optional(),source:Xe(["company","personal"]).optional(),createdAt:W(),updatedAt:W()});async function sk(e){return Ur(e,Po.array(),void 0,t=>`Failed to fetch ${e}: ${t.status}`)}function If(){const e=ua("/api/providers?includeSecrets=1",sk,{revalidateOnFocus:!1,revalidateIfStale:!1});return{providers:e.data??[],isLoading:e.isLoading,isError:e.error,mutate:e.mutate}}const ik="2.0.28",ak={version:ik},ic=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,ac=xf,Ta=(e,t)=>n=>{var r;if(t?.variants==null)return ac(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=ic(d)||ic(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(x=>{let[m,g]=x;return Array.isArray(g)?g.includes({...s,...l}[m]):{...s,...l}[m]===g})?[...u,f,h]:u},[]);return ac(e,i,c,n?.class,n?.className)};function lc(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function zf(...e){return t=>{let n=!1;const r=e.map(o=>{const s=lc(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():lc(e[o],null)}}}}function Le(...e){return y.useCallback(zf(...e),e)}function er(e){const t=ck(e),n=y.forwardRef((r,o)=>{const{children:s,...i}=r,l=y.Children.toArray(s),c=l.find(dk);if(c){const u=c.props.children,d=l.map(f=>f===c?y.Children.count(u)>1?y.Children.only(null):y.isValidElement(u)?u.props.children:null:f);return a.jsx(t,{...i,ref:o,children:y.isValidElement(u)?y.cloneElement(u,void 0,d):null})}return a.jsx(t,{...i,ref:o,children:s})});return n.displayName=`${e}.Slot`,n}var lk=er("Slot");function ck(e){const t=y.forwardRef((n,r)=>{const{children:o,...s}=n;if(y.isValidElement(o)){const i=pk(o),l=fk(s,o.props);return o.type!==y.Fragment&&(l.ref=r?zf(r,i):i),y.cloneElement(o,l)}return y.Children.count(o)>1?y.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var Rf=Symbol("radix.slottable");function uk(e){const t=({children:n})=>a.jsx(a.Fragment,{children:n});return t.displayName=`${e}.Slottable`,t.__radixId=Rf,t}function dk(e){return y.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===Rf}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 pk(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 hk=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Te=hk.reduce((e,t)=>{const n=er(`Primitive.${t}`),r=y.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 mk(e,t){e&&Br.flushSync(()=>e.dispatchEvent(t))}var Pf=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"}),gk="VisuallyHidden",Of=y.forwardRef((e,t)=>a.jsx(Te.span,{...e,ref:t,style:{...Pf,...e.style}}));Of.displayName=gk;var xk=Of;function yk(e,t){const n=y.createContext(t),r=s=>{const{children:i,...l}=s,c=y.useMemo(()=>l,Object.values(l));return a.jsx(n.Provider,{value:c,children:i})};r.displayName=e+"Provider";function o(s){const i=y.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 tn(e,t=[]){let n=[];function r(s,i){const l=y.createContext(i),c=n.length;n=[...n,i];const u=f=>{const{scope:h,children:p,...x}=f,m=h?.[e]?.[c]||l,g=y.useMemo(()=>x,Object.values(x));return a.jsx(m.Provider,{value:g,children:p})};u.displayName=s+"Provider";function d(f,h){const p=h?.[e]?.[c]||l,x=y.useContext(p);if(x)return x;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=>y.createContext(i));return function(l){const c=l?.[e]||s;return y.useMemo(()=>({[`__scope${e}`]:{...l,[e]:c}}),[l,c])}};return o.scopeName=e,[r,bk(o,...t)]}function bk(...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 y.useMemo(()=>({[`__scope${t.scopeName}`]:i}),[i])}};return n.scopeName=t.scopeName,n}function Mf(e){const t=e+"CollectionProvider",[n,r]=tn(t),[o,s]=n(t,{collectionRef:{current:null},itemMap:new Map}),i=m=>{const{scope:g,children:b}=m,v=lt.useRef(null),k=lt.useRef(new Map).current;return a.jsx(o,{scope:g,itemMap:k,collectionRef:v,children:b})};i.displayName=t;const l=e+"CollectionSlot",c=er(l),u=lt.forwardRef((m,g)=>{const{scope:b,children:v}=m,k=s(l,b),S=Le(g,k.collectionRef);return a.jsx(c,{ref:S,children:v})});u.displayName=l;const d=e+"CollectionItemSlot",f="data-radix-collection-item",h=er(d),p=lt.forwardRef((m,g)=>{const{scope:b,children:v,...k}=m,S=lt.useRef(null),C=Le(g,S),j=s(d,b);return lt.useEffect(()=>(j.itemMap.set(S,{ref:S,...k}),()=>{j.itemMap.delete(S)})),a.jsx(h,{[f]:"",ref:C,children:v})});p.displayName=d;function x(m){const g=s(e+"CollectionConsumer",m);return lt.useCallback(()=>{const v=g.collectionRef.current;if(!v)return[];const k=Array.from(v.querySelectorAll(`[${f}]`));return Array.from(g.itemMap.values()).sort((j,N)=>k.indexOf(j.ref.current)-k.indexOf(N.ref.current))},[g.collectionRef,g.itemMap])}return[{Provider:i,Slot:u,ItemSlot:p},x,r]}function _e(e,t,{checkForDefaultPrevented:n=!0}={}){return function(o){if(e?.(o),n===!1||!o.defaultPrevented)return t?.(o)}}var tt=globalThis?.document?y.useLayoutEffect:()=>{},vk=hd[" useInsertionEffect ".trim().toString()]||tt;function _n({prop:e,defaultProp:t,onChange:n=()=>{},caller:r}){const[o,s,i]=wk({defaultProp:t,onChange:n}),l=e!==void 0,c=l?e:o;{const d=y.useRef(e!==void 0);y.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=y.useCallback(d=>{if(l){const f=kk(d)?d(e):d;f!==e&&i.current?.(f)}else s(d)},[l,e,s,i]);return[c,u]}function wk({defaultProp:e,onChange:t}){const[n,r]=y.useState(e),o=y.useRef(n),s=y.useRef(t);return vk(()=>{s.current=t},[t]),y.useEffect(()=>{o.current!==n&&(s.current?.(n),o.current=n)},[n,o]),[n,r,s]}function kk(e){return typeof e=="function"}function _k(e,t){return y.useReducer((n,r)=>t[n][r]??n,e)}var vt=e=>{const{present:t,children:n}=e,r=Sk(t),o=typeof n=="function"?n({present:r.isPresent}):y.Children.only(n),s=Le(r.ref,Ck(o));return typeof n=="function"||r.isPresent?y.cloneElement(o,{ref:s}):null};vt.displayName="Presence";function Sk(e){const[t,n]=y.useState(),r=y.useRef(null),o=y.useRef(e),s=y.useRef("none"),i=e?"mounted":"unmounted",[l,c]=_k(i,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return y.useEffect(()=>{const u=so(r.current);s.current=l==="mounted"?u:"none"},[l]),tt(()=>{const u=r.current,d=o.current;if(d!==e){const h=s.current,p=so(u);e?c("MOUNT"):p==="none"||u?.display==="none"?c("UNMOUNT"):c(d&&h!==p?"ANIMATION_OUT":"UNMOUNT"),o.current=e}},[e,c]),tt(()=>{if(t){let u;const d=t.ownerDocument.defaultView??window,f=p=>{const m=so(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=so(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:y.useCallback(u=>{r.current=u?getComputedStyle(u):null,n(u)},[])}}function so(e){return e?.animationName||"none"}function Ck(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 jk=hd[" useId ".trim().toString()]||(()=>{}),Ek=0;function Dt(e){const[t,n]=y.useState(jk());return tt(()=>{n(r=>r??String(Ek++))},[e]),e||(t?`radix-${t}`:"")}var is="Collapsible",[Nk]=tn(is),[Tk,Aa]=Nk(is),Lf=y.forwardRef((e,t)=>{const{__scopeCollapsible:n,open:r,defaultOpen:o,disabled:s,onOpenChange:i,...l}=e,[c,u]=_n({prop:r,defaultProp:o??!1,onChange:i,caller:is});return a.jsx(Tk,{scope:n,disabled:s,contentId:Dt(),open:c,onOpenToggle:y.useCallback(()=>u(d=>!d),[u]),children:a.jsx(Te.div,{"data-state":za(c),"data-disabled":s?"":void 0,...l,ref:t})})});Lf.displayName=is;var Df="CollapsibleTrigger",Ff=y.forwardRef((e,t)=>{const{__scopeCollapsible:n,...r}=e,o=Aa(Df,n);return a.jsx(Te.button,{type:"button","aria-controls":o.contentId,"aria-expanded":o.open||!1,"data-state":za(o.open),"data-disabled":o.disabled?"":void 0,disabled:o.disabled,...r,ref:t,onClick:_e(e.onClick,o.onOpenToggle)})});Ff.displayName=Df;var Ia="CollapsibleContent",$f=y.forwardRef((e,t)=>{const{forceMount:n,...r}=e,o=Aa(Ia,e.__scopeCollapsible);return a.jsx(vt,{present:n||o.open,children:({present:s})=>a.jsx(Ak,{...r,ref:t,present:s})})});$f.displayName=Ia;var Ak=y.forwardRef((e,t)=>{const{__scopeCollapsible:n,present:r,children:o,...s}=e,i=Aa(Ia,n),[l,c]=y.useState(r),u=y.useRef(null),d=Le(t,u),f=y.useRef(0),h=f.current,p=y.useRef(0),x=p.current,m=i.open||l,g=y.useRef(m),b=y.useRef(void 0);return y.useEffect(()=>{const v=requestAnimationFrame(()=>g.current=!1);return()=>cancelAnimationFrame(v)},[]),tt(()=>{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":za(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":x?`${x}px`:void 0,...e.style},children:m&&o})});function za(e){return e?"open":"closed"}var Ik=Lf,zk=y.createContext(void 0);function as(e){const t=y.useContext(zk);return e||t||"ltr"}function st(e){const t=y.useRef(e);return y.useEffect(()=>{t.current=e}),y.useMemo(()=>(...n)=>t.current?.(...n),[])}function Rk(e,t=globalThis?.document){const n=st(e);y.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 Pk="DismissableLayer",Ni="dismissableLayer.update",Ok="dismissableLayer.pointerDownOutside",Mk="dismissableLayer.focusOutside",cc,Bf=y.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),ls=y.forwardRef((e,t)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:r,onPointerDownOutside:o,onFocusOutside:s,onInteractOutside:i,onDismiss:l,...c}=e,u=y.useContext(Bf),[d,f]=y.useState(null),h=d?.ownerDocument??globalThis?.document,[,p]=y.useState({}),x=Le(t,N=>f(N)),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=Fk(N=>{const T=N.target,A=[...u.branches].some(O=>O.contains(T));!S||A||(o?.(N),i?.(N),N.defaultPrevented||l?.())},h),j=$k(N=>{const T=N.target;[...u.branches].some(O=>O.contains(T))||(s?.(N),i?.(N),N.defaultPrevented||l?.())},h);return Rk(N=>{v===u.layers.size-1&&(r?.(N),!N.defaultPrevented&&l&&(N.preventDefault(),l()))},h),y.useEffect(()=>{if(d)return n&&(u.layersWithOutsidePointerEventsDisabled.size===0&&(cc=h.body.style.pointerEvents,h.body.style.pointerEvents="none"),u.layersWithOutsidePointerEventsDisabled.add(d)),u.layers.add(d),uc(),()=>{n&&u.layersWithOutsidePointerEventsDisabled.size===1&&(h.body.style.pointerEvents=cc)}},[d,h,n,u]),y.useEffect(()=>()=>{d&&(u.layers.delete(d),u.layersWithOutsidePointerEventsDisabled.delete(d),uc())},[d,u]),y.useEffect(()=>{const N=()=>p({});return document.addEventListener(Ni,N),()=>document.removeEventListener(Ni,N)},[]),a.jsx(Te.div,{...c,ref:x,style:{pointerEvents:k?S?"auto":"none":void 0,...e.style},onFocusCapture:_e(e.onFocusCapture,j.onFocusCapture),onBlurCapture:_e(e.onBlurCapture,j.onBlurCapture),onPointerDownCapture:_e(e.onPointerDownCapture,C.onPointerDownCapture)})});ls.displayName=Pk;var Lk="DismissableLayerBranch",Dk=y.forwardRef((e,t)=>{const n=y.useContext(Bf),r=y.useRef(null),o=Le(t,r);return y.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})});Dk.displayName=Lk;function Fk(e,t=globalThis?.document){const n=st(e),r=y.useRef(!1),o=y.useRef(()=>{});return y.useEffect(()=>{const s=l=>{if(l.target&&!r.current){let c=function(){Uf(Ok,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 $k(e,t=globalThis?.document){const n=st(e),r=y.useRef(!1);return y.useEffect(()=>{const o=s=>{s.target&&!r.current&&Uf(Mk,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 uc(){const e=new CustomEvent(Ni);document.dispatchEvent(e)}function Uf(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?mk(o,s):o.dispatchEvent(s)}var Ls="focusScope.autoFocusOnMount",Ds="focusScope.autoFocusOnUnmount",dc={bubbles:!1,cancelable:!0},Bk="FocusScope",Ra=y.forwardRef((e,t)=>{const{loop:n=!1,trapped:r=!1,onMountAutoFocus:o,onUnmountAutoFocus:s,...i}=e,[l,c]=y.useState(null),u=st(o),d=st(s),f=y.useRef(null),h=Le(t,m=>c(m)),p=y.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;y.useEffect(()=>{if(r){let m=function(k){if(p.paused||!l)return;const S=k.target;l.contains(S)?f.current=S:sn(f.current,{select:!0})},g=function(k){if(p.paused||!l)return;const S=k.relatedTarget;S!==null&&(l.contains(S)||sn(f.current,{select:!0}))},b=function(k){if(document.activeElement===document.body)for(const C of k)C.removedNodes.length>0&&sn(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]),y.useEffect(()=>{if(l){pc.add(p);const m=document.activeElement;if(!l.contains(m)){const b=new CustomEvent(Ls,dc);l.addEventListener(Ls,u),l.dispatchEvent(b),b.defaultPrevented||(Uk(qk(Wf(l)),{select:!0}),document.activeElement===m&&sn(l))}return()=>{l.removeEventListener(Ls,u),setTimeout(()=>{const b=new CustomEvent(Ds,dc);l.addEventListener(Ds,d),l.dispatchEvent(b),b.defaultPrevented||sn(m??document.body,{select:!0}),l.removeEventListener(Ds,d),pc.remove(p)},0)}}},[l,u,d,p]);const x=y.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]=Wk(v);k&&S?!m.shiftKey&&b===S?(m.preventDefault(),n&&sn(k,{select:!0})):m.shiftKey&&b===k&&(m.preventDefault(),n&&sn(S,{select:!0})):b===v&&m.preventDefault()}},[n,r,p.paused]);return a.jsx(Te.div,{tabIndex:-1,...i,ref:h,onKeyDown:x})});Ra.displayName=Bk;function Uk(e,{select:t=!1}={}){const n=document.activeElement;for(const r of e)if(sn(r,{select:t}),document.activeElement!==n)return}function Wk(e){const t=Wf(e),n=fc(t,e),r=fc(t.reverse(),e);return[n,r]}function Wf(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 fc(e,t){for(const n of e)if(!Vk(n,{upTo:t}))return n}function Vk(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 Hk(e){return e instanceof HTMLInputElement&&"select"in e}function sn(e,{select:t=!1}={}){if(e&&e.focus){const n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&Hk(e)&&t&&e.select()}}var pc=Zk();function Zk(){let e=[];return{add(t){const n=e[0];t!==n&&n?.pause(),e=hc(e,t),e.unshift(t)},remove(t){e=hc(e,t),e[0]?.resume()}}}function hc(e,t){const n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}function qk(e){return e.filter(t=>t.tagName!=="A")}var Kk="Portal",cs=y.forwardRef((e,t)=>{const{container:n,...r}=e,[o,s]=y.useState(!1);tt(()=>s(!0),[]);const i=n||o&&globalThis?.document?.body;return i?Eg.createPortal(a.jsx(Te.div,{...r,ref:t}),i):null});cs.displayName=Kk;var Fs=0;function Vf(){y.useEffect(()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??mc()),document.body.insertAdjacentElement("beforeend",e[1]??mc()),Fs++,()=>{Fs===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(t=>t.remove()),Fs--}},[])}function mc(){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 Ot=function(){return Ot=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},Ot.apply(this,arguments)};function Hf(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 Jk(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 vo="right-scroll-bar-position",wo="width-before-scroll-bar",Gk="with-scroll-bars-hidden",Yk="--removed-body-scroll-bar-size";function $s(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}function Xk(e,t){var n=y.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 Qk=typeof window<"u"?y.useLayoutEffect:y.useEffect,gc=new WeakMap;function e_(e,t){var n=Xk(null,function(r){return e.forEach(function(o){return $s(o,r)})});return Qk(function(){var r=gc.get(n);if(r){var o=new Set(r),s=new Set(e),i=n.current;o.forEach(function(l){s.has(l)||$s(l,null)}),s.forEach(function(l){o.has(l)||$s(l,i)})}gc.set(n,e)},[e]),n}function t_(e){return e}function n_(e,t){t===void 0&&(t=t_);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 r_(e){e===void 0&&(e={});var t=n_(null);return t.options=Ot({async:!0,ssr:!1},e),t}var Zf=function(e){var t=e.sideCar,n=Hf(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 y.createElement(r,Ot({},n))};Zf.isSideCarExport=!0;function o_(e,t){return e.useMedium(t),Zf}var qf=r_(),Bs=function(){},us=y.forwardRef(function(e,t){var n=y.useRef(null),r=y.useState({onScrollCapture:Bs,onWheelCapture:Bs,onTouchMoveCapture:Bs}),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,x=e.noIsolation,m=e.inert,g=e.allowPinchZoom,b=e.as,v=b===void 0?"div":b,k=e.gapMode,S=Hf(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),C=h,j=e_([n,t]),N=Ot(Ot({},S),o);return y.createElement(y.Fragment,null,d&&y.createElement(C,{sideCar:qf,removeScrollBar:u,shards:f,noRelative:p,noIsolation:x,inert:m,setCallbacks:s,allowPinchZoom:!!g,lockRef:n,gapMode:k}),i?y.cloneElement(y.Children.only(l),Ot(Ot({},N),{ref:j})):y.createElement(v,Ot({},N,{className:c,ref:j}),l))});us.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};us.classNames={fullWidth:wo,zeroRight:vo};var s_=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function i_(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=s_();return t&&e.setAttribute("nonce",t),e}function a_(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 c_=function(){var e=0,t=null;return{add:function(n){e==0&&(t=i_())&&(a_(t,n),l_(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},u_=function(){var e=c_();return function(t,n){y.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},Kf=function(){var e=u_(),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},Us=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[Us(n),Us(r),Us(o)]},p_=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])}},h_=Kf(),Zn="data-scroll-locked",m_=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(Gk,` {
|
|
43
|
-
overflow: hidden `).concat(r,`;
|
|
44
|
-
padding-right: `).concat(l,"px ").concat(r,`;
|
|
45
|
-
}
|
|
46
|
-
body[`).concat(Zn,`] {
|
|
47
|
-
overflow: hidden `).concat(r,`;
|
|
48
|
-
overscroll-behavior: contain;
|
|
49
|
-
`).concat([t&&"position: relative ".concat(r,";"),n==="margin"&&`
|
|
50
|
-
padding-left: `.concat(o,`px;
|
|
51
|
-
padding-top: `).concat(s,`px;
|
|
52
|
-
padding-right: `).concat(i,`px;
|
|
53
|
-
margin-left:0;
|
|
54
|
-
margin-top:0;
|
|
55
|
-
margin-right: `).concat(l,"px ").concat(r,`;
|
|
56
|
-
`),n==="padding"&&"padding-right: ".concat(l,"px ").concat(r,";")].filter(Boolean).join(""),`
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
.`).concat(vo,` {
|
|
60
|
-
right: `).concat(l,"px ").concat(r,`;
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
.`).concat(wo,` {
|
|
64
|
-
margin-right: `).concat(l,"px ").concat(r,`;
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
.`).concat(vo," .").concat(vo,` {
|
|
68
|
-
right: 0 `).concat(r,`;
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
.`).concat(wo," .").concat(wo,` {
|
|
72
|
-
margin-right: 0 `).concat(r,`;
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
body[`).concat(Zn,`] {
|
|
76
|
-
`).concat(Yk,": ").concat(l,`px;
|
|
77
|
-
}
|
|
78
|
-
`)},xc=function(){var e=parseInt(document.body.getAttribute(Zn)||"0",10);return isFinite(e)?e:0},g_=function(){y.useEffect(function(){return document.body.setAttribute(Zn,(xc()+1).toString()),function(){var e=xc()-1;e<=0?document.body.removeAttribute(Zn):document.body.setAttribute(Zn,e.toString())}},[])},x_=function(e){var t=e.noRelative,n=e.noImportant,r=e.gapMode,o=r===void 0?"margin":r;g_();var s=y.useMemo(function(){return p_(o)},[o]);return y.createElement(h_,{styles:m_(s,!t,o,n?"":"!important")})},Ti=!1;if(typeof window<"u")try{var io=Object.defineProperty({},"passive",{get:function(){return Ti=!0,!0}});window.addEventListener("test",io,io),window.removeEventListener("test",io,io)}catch{Ti=!1}var Pn=Ti?{passive:!1}:!1,y_=function(e){return e.tagName==="TEXTAREA"},Jf=function(e,t){if(!(e instanceof Element))return!1;var n=window.getComputedStyle(e);return n[t]!=="hidden"&&!(n.overflowY===n.overflowX&&!y_(e)&&n[t]==="visible")},b_=function(e){return Jf(e,"overflowY")},v_=function(e){return Jf(e,"overflowX")},yc=function(e,t){var n=t.ownerDocument,r=t;do{typeof ShadowRoot<"u"&&r instanceof ShadowRoot&&(r=r.host);var o=Gf(e,r);if(o){var s=Yf(e,r),i=s[1],l=s[2];if(i>l)return!0}r=r.parentNode}while(r&&r!==n.body);return!1},w_=function(e){var t=e.scrollTop,n=e.scrollHeight,r=e.clientHeight;return[t,n,r]},k_=function(e){var t=e.scrollLeft,n=e.scrollWidth,r=e.clientWidth;return[t,n,r]},Gf=function(e,t){return e==="v"?b_(t):v_(t)},Yf=function(e,t){return e==="v"?w_(t):k_(t)},__=function(e,t){return e==="h"&&t==="rtl"?-1:1},S_=function(e,t,n,r,o){var s=__(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=Yf(e,l),x=p[0],m=p[1],g=p[2],b=m-g-s*x;(x||b)&&Gf(e,l)&&(f+=b,h+=x);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},ao=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},bc=function(e){return[e.deltaX,e.deltaY]},vc=function(e){return e&&"current"in e?e.current:e},C_=function(e,t){return e[0]===t[0]&&e[1]===t[1]},j_=function(e){return`
|
|
79
|
-
.block-interactivity-`.concat(e,` {pointer-events: none;}
|
|
80
|
-
.allow-interactivity-`).concat(e,` {pointer-events: all;}
|
|
81
|
-
`)},E_=0,On=[];function N_(e){var t=y.useRef([]),n=y.useRef([0,0]),r=y.useRef(),o=y.useState(E_++)[0],s=y.useState(Kf)[0],i=y.useRef(e);y.useEffect(function(){i.current=e},[e]),y.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(o));var m=Jk([e.lockRef.current],(e.shards||[]).map(vc),!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=y.useCallback(function(m,g){if("touches"in m&&m.touches.length===2||m.type==="wheel"&&m.ctrlKey)return!i.current.allowPinchZoom;var b=ao(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,N=Math.abs(k)>Math.abs(S)?"h":"v";if("touches"in m&&N==="h"&&j.type==="range")return!1;var T=window.getSelection(),A=T&&T.anchorNode,O=A?A===j||A.contains(j):!1;if(O)return!1;var $=yc(N,j);if(!$)return!0;if($?C=N:(C=N==="v"?"h":"v",$=yc(N,j)),!$)return!1;if(!r.current&&"changedTouches"in m&&(k||S)&&(r.current=C),!C)return!0;var E=r.current||C;return S_(E,g,m,E==="h"?k:S)},[]),c=y.useCallback(function(m){var g=m;if(!(!On.length||On[On.length-1]!==s)){var b="deltaY"in g?bc(g):ao(g),v=t.current.filter(function(C){return C.name===g.type&&(C.target===g.target||g.target===C.shadowParent)&&C_(C.delta,b)})[0];if(v&&v.should){g.cancelable&&g.preventDefault();return}if(!v){var k=(i.current.shards||[]).map(vc).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=y.useCallback(function(m,g,b,v){var k={name:m,delta:g,target:b,should:v,shadowParent:T_(b)};t.current.push(k),setTimeout(function(){t.current=t.current.filter(function(S){return S!==k})},1)},[]),d=y.useCallback(function(m){n.current=ao(m),r.current=void 0},[]),f=y.useCallback(function(m){u(m.type,bc(m),m.target,l(m,e.lockRef.current))},[]),h=y.useCallback(function(m){u(m.type,ao(m),m.target,l(m,e.lockRef.current))},[]);y.useEffect(function(){return On.push(s),e.setCallbacks({onScrollCapture:f,onWheelCapture:f,onTouchMoveCapture:h}),document.addEventListener("wheel",c,Pn),document.addEventListener("touchmove",c,Pn),document.addEventListener("touchstart",d,Pn),function(){On=On.filter(function(m){return m!==s}),document.removeEventListener("wheel",c,Pn),document.removeEventListener("touchmove",c,Pn),document.removeEventListener("touchstart",d,Pn)}},[]);var p=e.removeScrollBar,x=e.inert;return y.createElement(y.Fragment,null,x?y.createElement(s,{styles:j_(o)}):null,p?y.createElement(x_,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function T_(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const A_=o_(qf,N_);var Pa=y.forwardRef(function(e,t){return y.createElement(us,Ot({},e,{ref:t,sideCar:A_}))});Pa.classNames=us.classNames;var I_=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},Mn=new WeakMap,lo=new WeakMap,co={},Ws=0,Xf=function(e){return e&&(e.host||Xf(e.parentNode))},z_=function(e,t){return t.map(function(n){if(e.contains(n))return n;var r=Xf(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})},R_=function(e,t,n,r){var o=z_(t,Array.isArray(e)?e:[e]);co[n]||(co[n]=new WeakMap);var s=co[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),x=p!==null&&p!=="false",m=(Mn.get(h)||0)+1,g=(s.get(h)||0)+1;Mn.set(h,m),s.set(h,g),i.push(h),m===1&&x&&lo.set(h,!0),g===1&&h.setAttribute(n,"true"),x||h.setAttribute(r,"true")}catch(b){console.error("aria-hidden: cannot operate on ",h,b)}})};return d(t),l.clear(),Ws++,function(){i.forEach(function(f){var h=Mn.get(f)-1,p=s.get(f)-1;Mn.set(f,h),s.set(f,p),h||(lo.has(f)||f.removeAttribute(r),lo.delete(f)),p||f.removeAttribute(n)}),Ws--,Ws||(Mn=new WeakMap,Mn=new WeakMap,lo=new WeakMap,co={})}},Qf=function(e,t,n){n===void 0&&(n="data-aria-hidden");var r=Array.from(Array.isArray(e)?e:[e]),o=I_(e);return o?(r.push.apply(r,Array.from(o.querySelectorAll("[aria-live], script"))),R_(r,o,n,"aria-hidden")):function(){return null}},ds="Dialog",[ep]=tn(ds),[P_,It]=ep(ds),tp=e=>{const{__scopeDialog:t,children:n,open:r,defaultOpen:o,onOpenChange:s,modal:i=!0}=e,l=y.useRef(null),c=y.useRef(null),[u,d]=_n({prop:r,defaultProp:o??!1,onChange:s,caller:ds});return a.jsx(P_,{scope:t,triggerRef:l,contentRef:c,contentId:Dt(),titleId:Dt(),descriptionId:Dt(),open:u,onOpenChange:d,onOpenToggle:y.useCallback(()=>d(f=>!f),[d]),modal:i,children:n})};tp.displayName=ds;var np="DialogTrigger",rp=y.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=It(np,n),s=Le(t,o.triggerRef);return a.jsx(Te.button,{type:"button","aria-haspopup":"dialog","aria-expanded":o.open,"aria-controls":o.contentId,"data-state":La(o.open),...r,ref:s,onClick:_e(e.onClick,o.onOpenToggle)})});rp.displayName=np;var Oa="DialogPortal",[O_,op]=ep(Oa,{forceMount:void 0}),sp=e=>{const{__scopeDialog:t,forceMount:n,children:r,container:o}=e,s=It(Oa,t);return a.jsx(O_,{scope:t,forceMount:n,children:y.Children.map(r,i=>a.jsx(vt,{present:n||s.open,children:a.jsx(cs,{asChild:!0,container:o,children:i})}))})};sp.displayName=Oa;var Oo="DialogOverlay",ip=y.forwardRef((e,t)=>{const n=op(Oo,e.__scopeDialog),{forceMount:r=n.forceMount,...o}=e,s=It(Oo,e.__scopeDialog);return s.modal?a.jsx(vt,{present:r||s.open,children:a.jsx(L_,{...o,ref:t})}):null});ip.displayName=Oo;var M_=er("DialogOverlay.RemoveScroll"),L_=y.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=It(Oo,n);return a.jsx(Pa,{as:M_,allowPinchZoom:!0,shards:[o.contentRef],children:a.jsx(Te.div,{"data-state":La(o.open),...r,ref:t,style:{pointerEvents:"auto",...r.style}})})}),Sn="DialogContent",ap=y.forwardRef((e,t)=>{const n=op(Sn,e.__scopeDialog),{forceMount:r=n.forceMount,...o}=e,s=It(Sn,e.__scopeDialog);return a.jsx(vt,{present:r||s.open,children:s.modal?a.jsx(D_,{...o,ref:t}):a.jsx(F_,{...o,ref:t})})});ap.displayName=Sn;var D_=y.forwardRef((e,t)=>{const n=It(Sn,e.__scopeDialog),r=y.useRef(null),o=Le(t,n.contentRef,r);return y.useEffect(()=>{const s=r.current;if(s)return Qf(s)},[]),a.jsx(lp,{...e,ref:o,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:_e(e.onCloseAutoFocus,s=>{s.preventDefault(),n.triggerRef.current?.focus()}),onPointerDownOutside:_e(e.onPointerDownOutside,s=>{const i=s.detail.originalEvent,l=i.button===0&&i.ctrlKey===!0;(i.button===2||l)&&s.preventDefault()}),onFocusOutside:_e(e.onFocusOutside,s=>s.preventDefault())})}),F_=y.forwardRef((e,t)=>{const n=It(Sn,e.__scopeDialog),r=y.useRef(!1),o=y.useRef(!1);return a.jsx(lp,{...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()}})}),lp=y.forwardRef((e,t)=>{const{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:o,onCloseAutoFocus:s,...i}=e,l=It(Sn,n),c=y.useRef(null),u=Le(t,c);return Vf(),a.jsxs(a.Fragment,{children:[a.jsx(Ra,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:o,onUnmountAutoFocus:s,children:a.jsx(ls,{role:"dialog",id:l.contentId,"aria-describedby":l.descriptionId,"aria-labelledby":l.titleId,"data-state":La(l.open),...i,ref:u,onDismiss:()=>l.onOpenChange(!1)})}),a.jsxs(a.Fragment,{children:[a.jsx(B_,{titleId:l.titleId}),a.jsx(W_,{contentRef:c,descriptionId:l.descriptionId})]})]})}),Ma="DialogTitle",cp=y.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=It(Ma,n);return a.jsx(Te.h2,{id:o.titleId,...r,ref:t})});cp.displayName=Ma;var up="DialogDescription",$_=y.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=It(up,n);return a.jsx(Te.p,{id:o.descriptionId,...r,ref:t})});$_.displayName=up;var dp="DialogClose",fp=y.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=It(dp,n);return a.jsx(Te.button,{type:"button",...r,ref:t,onClick:_e(e.onClick,()=>o.onOpenChange(!1))})});fp.displayName=dp;function La(e){return e?"open":"closed"}var pp="DialogTitleWarning",[wP,hp]=yk(pp,{contentName:Sn,titleName:Ma,docsSlug:"dialog"}),B_=({titleId:e})=>{const t=hp(pp),n=`\`${t.contentName}\` requires a \`${t.titleName}\` for the component to be accessible for screen reader users.
|
|
82
|
-
|
|
83
|
-
If you want to hide the \`${t.titleName}\`, you can wrap it with our VisuallyHidden component.
|
|
84
|
-
|
|
85
|
-
For more information, see https://radix-ui.com/primitives/docs/components/${t.docsSlug}`;return y.useEffect(()=>{e&&(document.getElementById(e)||console.error(n))},[n,e]),null},U_="DialogDescriptionWarning",W_=({contentRef:e,descriptionId:t})=>{const r=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${hp(U_).contentName}}.`;return y.useEffect(()=>{const o=e.current?.getAttribute("aria-describedby");t&&o&&(document.getElementById(t)||console.warn(r))},[r,e,t]),null},V_=tp,H_=rp,Z_=sp,q_=ip,K_=ap,J_=cp,G_=fp;function Y_(e){const t=y.useRef({value:e,previous:e});return y.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}function X_(e){const[t,n]=y.useState(void 0);return tt(()=>{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 Q_=["top","right","bottom","left"],un=Math.min,mt=Math.max,Mo=Math.round,uo=Math.floor,Ft=e=>({x:e,y:e}),eS={left:"right",right:"left",bottom:"top",top:"bottom"},tS={start:"end",end:"start"};function Ai(e,t,n){return mt(e,un(t,n))}function Gt(e,t){return typeof e=="function"?e(t):e}function Yt(e){return e.split("-")[0]}function ar(e){return e.split("-")[1]}function Da(e){return e==="x"?"y":"x"}function Fa(e){return e==="y"?"height":"width"}const nS=new Set(["top","bottom"]);function Lt(e){return nS.has(Yt(e))?"y":"x"}function $a(e){return Da(Lt(e))}function rS(e,t,n){n===void 0&&(n=!1);const r=ar(e),o=$a(e),s=Fa(o);let i=o==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[s]>t.floating[s]&&(i=Lo(i)),[i,Lo(i)]}function oS(e){const t=Lo(e);return[Ii(e),t,Ii(t)]}function Ii(e){return e.replace(/start|end/g,t=>tS[t])}const wc=["left","right"],kc=["right","left"],sS=["top","bottom"],iS=["bottom","top"];function aS(e,t,n){switch(e){case"top":case"bottom":return n?t?kc:wc:t?wc:kc;case"left":case"right":return t?sS:iS;default:return[]}}function lS(e,t,n,r){const o=ar(e);let s=aS(Yt(e),n==="start",r);return o&&(s=s.map(i=>i+"-"+o),t&&(s=s.concat(s.map(Ii)))),s}function Lo(e){return e.replace(/left|right|bottom|top/g,t=>eS[t])}function cS(e){return{top:0,right:0,bottom:0,left:0,...e}}function mp(e){return typeof e!="number"?cS(e):{top:e,right:e,bottom:e,left:e}}function Do(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 _c(e,t,n){let{reference:r,floating:o}=e;const s=Lt(t),i=$a(t),l=Fa(i),c=Yt(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(ar(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 uS(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}=Gt(t,e),x=mp(p),g=l[h?f==="floating"?"reference":"floating":f],b=Do(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=Do(s.convertOffsetParentRelativeRectToViewportRelativeRect?await s.convertOffsetParentRelativeRectToViewportRelativeRect({elements:l,rect:v,offsetParent:k,strategy:c}):v);return{top:(b.top-C.top+x.top)/S.y,bottom:(C.bottom-b.bottom+x.bottom)/S.y,left:(b.left-C.left+x.left)/S.x,right:(C.right-b.right+x.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}=_c(u,r,c),h=r,p={},x=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:uS},elements:{reference:e,floating:t}});d=k??d,f=S??f,p={...p,[b]:{...p[b],...C}},j&&x<=50&&(x++,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}=_c(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}=Gt(e,t)||{};if(u==null)return{};const f=mp(d),h={x:n,y:r},p=$a(o),x=Fa(p),m=await i.getDimensions(u),g=p==="y",b=g?"top":"left",v=g?"bottom":"right",k=g?"clientHeight":"clientWidth",S=s.reference[x]+s.reference[p]-h[p]-s.floating[x],C=h[p]-s.reference[p],j=await(i.getOffsetParent==null?void 0:i.getOffsetParent(u));let N=j?j[k]:0;(!N||!await(i.isElement==null?void 0:i.isElement(j)))&&(N=l.floating[k]||s.floating[x]);const T=S/2-C/2,A=N/2-m[x]/2-1,O=un(f[b],A),$=un(f[v],A),E=O,L=N-m[x]-$,w=N/2-m[x]/2+T,M=Ai(E,w,L),U=!c.arrow&&ar(o)!=null&&w!==M&&s.reference[x]/2-(w<E?O:$)-m[x]/2<0,F=U?w<E?w-E:w-L:0;return{[p]:h[p]+F,data:{[p]:M,centerOffset:w-M-F,...U&&{alignmentOffset:F}},reset:U}}}),pS=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:x="none",flipAlignment:m=!0,...g}=Gt(e,t);if((n=s.arrow)!=null&&n.alignmentOffset)return{};const b=Yt(o),v=Lt(l),k=Yt(l)===l,S=await(c.isRTL==null?void 0:c.isRTL(u.floating)),C=h||(k||!m?[Lo(l)]:oS(l)),j=x!=="none";!h&&j&&C.push(...lS(l,m,x,S));const N=[l,...C],T=await c.detectOverflow(t,g),A=[];let O=((r=s.flip)==null?void 0:r.overflows)||[];if(d&&A.push(T[b]),f){const w=rS(o,i,S);A.push(T[w[0]],T[w[1]])}if(O=[...O,{placement:o,overflows:A}],!A.every(w=>w<=0)){var $,E;const w=((($=s.flip)==null?void 0:$.index)||0)+1,M=N[w];if(M&&(!(f==="alignment"?v!==Lt(M):!1)||O.every(B=>Lt(B.placement)===v?B.overflows[0]>0:!0)))return{data:{index:w,overflows:O},reset:{placement:M}};let U=(E=O.filter(F=>F.overflows[0]<=0).sort((F,B)=>F.overflows[1]-B.overflows[1])[0])==null?void 0:E.placement;if(!U)switch(p){case"bestFit":{var L;const F=(L=O.filter(B=>{if(j){const G=Lt(B.placement);return G===v||G==="y"}return!0}).map(B=>[B.placement,B.overflows.filter(G=>G>0).reduce((G,I)=>G+I,0)]).sort((B,G)=>B[1]-G[1])[0])==null?void 0:L[0];F&&(U=F);break}case"initialPlacement":U=l;break}if(o!==U)return{reset:{placement:U}}}return{}}}};function Sc(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function Cc(e){return Q_.some(t=>e[t]>=0)}const hS=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n,platform:r}=t,{strategy:o="referenceHidden",...s}=Gt(e,t);switch(o){case"referenceHidden":{const i=await r.detectOverflow(t,{...s,elementContext:"reference"}),l=Sc(i,n.reference);return{data:{referenceHiddenOffsets:l,referenceHidden:Cc(l)}}}case"escaped":{const i=await r.detectOverflow(t,{...s,altBoundary:!0}),l=Sc(i,n.floating);return{data:{escapedOffsets:l,escaped:Cc(l)}}}default:return{}}}}},gp=new Set(["left","top"]);async function mS(e,t){const{placement:n,platform:r,elements:o}=e,s=await(r.isRTL==null?void 0:r.isRTL(o.floating)),i=Yt(n),l=ar(n),c=Lt(n)==="y",u=gp.has(i)?-1:1,d=s&&c?-1:1,f=Gt(t,e);let{mainAxis:h,crossAxis:p,alignmentAxis:x}=typeof f=="number"?{mainAxis:f,crossAxis:0,alignmentAxis:null}:{mainAxis:f.mainAxis||0,crossAxis:f.crossAxis||0,alignmentAxis:f.alignmentAxis};return l&&typeof x=="number"&&(p=l==="end"?x*-1:x),c?{x:p*d,y:h*u}:{x:h*u,y:p*d}}const gS=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 mS(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}}}}},xS=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}=Gt(e,t),d={x:n,y:r},f=await s.detectOverflow(t,u),h=Lt(Yt(o)),p=Da(h);let x=d[p],m=d[h];if(i){const b=p==="y"?"top":"left",v=p==="y"?"bottom":"right",k=x+f[b],S=x-f[v];x=Ai(k,x,S)}if(l){const b=h==="y"?"top":"left",v=h==="y"?"bottom":"right",k=m+f[b],S=m-f[v];m=Ai(k,m,S)}const g=c.fn({...t,[p]:x,[h]:m});return{...g,data:{x:g.x-n,y:g.y-r,enabled:{[p]:i,[h]:l}}}}}},yS=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}=Gt(e,t),d={x:n,y:r},f=Lt(o),h=Da(f);let p=d[h],x=d[f];const m=Gt(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=gp.has(Yt(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);x<C?x=C:x>j&&(x=j)}return{[h]:p,[f]:x}}}},bS=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}=Gt(e,t),d=await i.detectOverflow(t,u),f=Yt(o),h=ar(o),p=Lt(o)==="y",{width:x,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=x-d.left-d.right,S=un(m-d[g],v),C=un(x-d[b],k),j=!t.middlewareData.shift;let N=S,T=C;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(T=k),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(N=v),j&&!h){const O=mt(d.left,0),$=mt(d.right,0),E=mt(d.top,0),L=mt(d.bottom,0);p?T=x-2*(O!==0||$!==0?O+$:mt(d.left,d.right)):N=m-2*(E!==0||L!==0?E+L:mt(d.top,d.bottom))}await c({...t,availableWidth:T,availableHeight:N});const A=await i.getDimensions(l.floating);return x!==A.width||m!==A.height?{reset:{rects:!0}}:{}}}};function fs(){return typeof window<"u"}function lr(e){return xp(e)?(e.nodeName||"").toLowerCase():"#document"}function xt(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function Vt(e){var t;return(t=(xp(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function xp(e){return fs()?e instanceof Node||e instanceof xt(e).Node:!1}function Tt(e){return fs()?e instanceof Element||e instanceof xt(e).Element:!1}function $t(e){return fs()?e instanceof HTMLElement||e instanceof xt(e).HTMLElement:!1}function jc(e){return!fs()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof xt(e).ShadowRoot}const vS=new Set(["inline","contents"]);function Vr(e){const{overflow:t,overflowX:n,overflowY:r,display:o}=At(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&!vS.has(o)}const wS=new Set(["table","td","th"]);function kS(e){return wS.has(lr(e))}const _S=[":popover-open",":modal"];function ps(e){return _S.some(t=>{try{return e.matches(t)}catch{return!1}})}const SS=["transform","translate","scale","rotate","perspective"],CS=["transform","translate","scale","rotate","perspective","filter"],jS=["paint","layout","strict","content"];function Ba(e){const t=Ua(),n=Tt(e)?At(e):e;return SS.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)||CS.some(r=>(n.willChange||"").includes(r))||jS.some(r=>(n.contain||"").includes(r))}function ES(e){let t=dn(e);for(;$t(t)&&!tr(t);){if(Ba(t))return t;if(ps(t))return null;t=dn(t)}return null}function Ua(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const NS=new Set(["html","body","#document"]);function tr(e){return NS.has(lr(e))}function At(e){return xt(e).getComputedStyle(e)}function hs(e){return Tt(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function dn(e){if(lr(e)==="html")return e;const t=e.assignedSlot||e.parentNode||jc(e)&&e.host||Vt(e);return jc(t)?t.host:t}function yp(e){const t=dn(e);return tr(t)?e.ownerDocument?e.ownerDocument.body:e.body:$t(t)&&Vr(t)?t:yp(t)}function Or(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);const o=yp(e),s=o===((r=e.ownerDocument)==null?void 0:r.body),i=xt(o);if(s){const l=zi(i);return t.concat(i,i.visualViewport||[],Vr(o)?o:[],l&&n?Or(l):[])}return t.concat(o,Or(o,[],n))}function zi(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function bp(e){const t=At(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const o=$t(e),s=o?e.offsetWidth:n,i=o?e.offsetHeight:r,l=Mo(n)!==s||Mo(r)!==i;return l&&(n=s,r=i),{width:n,height:r,$:l}}function Wa(e){return Tt(e)?e:e.contextElement}function qn(e){const t=Wa(e);if(!$t(t))return Ft(1);const n=t.getBoundingClientRect(),{width:r,height:o,$:s}=bp(t);let i=(s?Mo(n.width):n.width)/r,l=(s?Mo(n.height):n.height)/o;return(!i||!Number.isFinite(i))&&(i=1),(!l||!Number.isFinite(l))&&(l=1),{x:i,y:l}}const TS=Ft(0);function vp(e){const t=xt(e);return!Ua()||!t.visualViewport?TS:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function AS(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==xt(e)?!1:t}function Cn(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const o=e.getBoundingClientRect(),s=Wa(e);let i=Ft(1);t&&(r?Tt(r)&&(i=qn(r)):i=qn(e));const l=AS(s,n,r)?vp(s):Ft(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=xt(s),p=r&&Tt(r)?xt(r):r;let x=h,m=zi(x);for(;m&&r&&p!==x;){const g=qn(m),b=m.getBoundingClientRect(),v=At(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,x=xt(m),m=zi(x)}}return Do({width:d,height:f,x:c,y:u})}function ms(e,t){const n=hs(e).scrollLeft;return t?t.left+n:Cn(Vt(e)).left+n}function wp(e,t){const n=e.getBoundingClientRect(),r=n.left+t.scrollLeft-ms(e,n),o=n.top+t.scrollTop;return{x:r,y:o}}function IS(e){let{elements:t,rect:n,offsetParent:r,strategy:o}=e;const s=o==="fixed",i=Vt(r),l=t?ps(t.floating):!1;if(r===i||l&&s)return n;let c={scrollLeft:0,scrollTop:0},u=Ft(1);const d=Ft(0),f=$t(r);if((f||!f&&!s)&&((lr(r)!=="body"||Vr(i))&&(c=hs(r)),$t(r))){const p=Cn(r);u=qn(r),d.x=p.x+r.clientLeft,d.y=p.y+r.clientTop}const h=i&&!f&&!s?wp(i,c):Ft(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 zS(e){return Array.from(e.getClientRects())}function RS(e){const t=Vt(e),n=hs(e),r=e.ownerDocument.body,o=mt(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),s=mt(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let i=-n.scrollLeft+ms(e);const l=-n.scrollTop;return At(r).direction==="rtl"&&(i+=mt(t.clientWidth,r.clientWidth)-o),{width:o,height:s,x:i,y:l}}const Ec=25;function PS(e,t){const n=xt(e),r=Vt(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=Ua();(!d||d&&t==="fixed")&&(l=o.offsetLeft,c=o.offsetTop)}const u=ms(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,x=Math.abs(r.clientWidth-f.clientWidth-p);x<=Ec&&(s-=x)}else u<=Ec&&(s+=u);return{width:s,height:i,x:l,y:c}}const OS=new Set(["absolute","fixed"]);function MS(e,t){const n=Cn(e,!0,t==="fixed"),r=n.top+e.clientTop,o=n.left+e.clientLeft,s=$t(e)?qn(e):Ft(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 Nc(e,t,n){let r;if(t==="viewport")r=PS(e,n);else if(t==="document")r=RS(Vt(e));else if(Tt(t))r=MS(t,n);else{const o=vp(e);r={x:t.x-o.x,y:t.y-o.y,width:t.width,height:t.height}}return Do(r)}function kp(e,t){const n=dn(e);return n===t||!Tt(n)||tr(n)?!1:At(n).position==="fixed"||kp(n,t)}function LS(e,t){const n=t.get(e);if(n)return n;let r=Or(e,[],!1).filter(l=>Tt(l)&&lr(l)!=="body"),o=null;const s=At(e).position==="fixed";let i=s?dn(e):e;for(;Tt(i)&&!tr(i);){const l=At(i),c=Ba(i);!c&&l.position==="fixed"&&(o=null),(s?!c&&!o:!c&&l.position==="static"&&!!o&&OS.has(o.position)||Vr(i)&&!c&&kp(e,i))?r=r.filter(d=>d!==i):o=l,i=dn(i)}return t.set(e,r),r}function DS(e){let{element:t,boundary:n,rootBoundary:r,strategy:o}=e;const i=[...n==="clippingAncestors"?ps(t)?[]:LS(t,this._c):[].concat(n),r],l=i[0],c=i.reduce((u,d)=>{const f=Nc(t,d,o);return u.top=mt(f.top,u.top),u.right=un(f.right,u.right),u.bottom=un(f.bottom,u.bottom),u.left=mt(f.left,u.left),u},Nc(t,l,o));return{width:c.right-c.left,height:c.bottom-c.top,x:c.left,y:c.top}}function FS(e){const{width:t,height:n}=bp(e);return{width:t,height:n}}function $S(e,t,n){const r=$t(t),o=Vt(t),s=n==="fixed",i=Cn(e,!0,s,t);let l={scrollLeft:0,scrollTop:0};const c=Ft(0);function u(){c.x=ms(o)}if(r||!r&&!s)if((lr(t)!=="body"||Vr(o))&&(l=hs(t)),r){const p=Cn(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?wp(o,l):Ft(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 Vs(e){return At(e).position==="static"}function Tc(e,t){if(!$t(e)||At(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return Vt(e)===n&&(n=n.ownerDocument.body),n}function _p(e,t){const n=xt(e);if(ps(e))return n;if(!$t(e)){let o=dn(e);for(;o&&!tr(o);){if(Tt(o)&&!Vs(o))return o;o=dn(o)}return n}let r=Tc(e,t);for(;r&&kS(r)&&Vs(r);)r=Tc(r,t);return r&&tr(r)&&Vs(r)&&!Ba(r)?n:r||ES(e)||n}const BS=async function(e){const t=this.getOffsetParent||_p,n=this.getDimensions,r=await n(e.floating);return{reference:$S(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function US(e){return At(e).direction==="rtl"}const WS={convertOffsetParentRelativeRectToViewportRelativeRect:IS,getDocumentElement:Vt,getClippingRect:DS,getOffsetParent:_p,getElementRects:BS,getClientRects:zS,getDimensions:FS,getScale:qn,isElement:Tt,isRTL:US};function Sp(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function VS(e,t){let n=null,r;const o=Vt(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 x=uo(f),m=uo(o.clientWidth-(d+h)),g=uo(o.clientHeight-(f+p)),b=uo(d),k={rootMargin:-x+"px "+-m+"px "+-g+"px "+-b+"px",threshold:mt(0,un(1,c))||1};let S=!0;function C(j){const N=j[0].intersectionRatio;if(N!==c){if(!S)return i();N?i(!1,N):r=setTimeout(()=>{i(!1,1e-7)},1e3)}N===1&&!Sp(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 HS(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=Wa(e),d=o||s?[...u?Or(u):[],...Or(t)]:[];d.forEach(b=>{o&&b.addEventListener("scroll",n,{passive:!0}),s&&b.addEventListener("resize",n)});const f=u&&l?VS(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 x,m=c?Cn(e):null;c&&g();function g(){const b=Cn(e);m&&!Sp(m,b)&&n(),m=b,x=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(x)}}const ZS=gS,qS=xS,KS=pS,JS=bS,GS=hS,Ac=fS,YS=yS,XS=(e,t,n)=>{const r=new Map,o={platform:WS,...n},s={...o.platform,_c:r};return dS(e,t,{...o,platform:s})};var QS=typeof document<"u",eC=function(){},ko=QS?y.useLayoutEffect:eC;function Fo(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(!Fo(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)&&!Fo(e[s],t[s]))return!1}return!0}return e!==e&&t!==t}function Cp(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function Ic(e,t){const n=Cp(e);return Math.round(t*n)/n}function Hs(e){const t=y.useRef(e);return ko(()=>{t.current=e}),t}function tC(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]=y.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[h,p]=y.useState(r);Fo(h,r)||p(r);const[x,m]=y.useState(null),[g,b]=y.useState(null),v=y.useCallback(B=>{B!==j.current&&(j.current=B,m(B))},[]),k=y.useCallback(B=>{B!==N.current&&(N.current=B,b(B))},[]),S=s||x,C=i||g,j=y.useRef(null),N=y.useRef(null),T=y.useRef(d),A=c!=null,O=Hs(c),$=Hs(o),E=Hs(u),L=y.useCallback(()=>{if(!j.current||!N.current)return;const B={placement:t,strategy:n,middleware:h};$.current&&(B.platform=$.current),XS(j.current,N.current,B).then(G=>{const I={...G,isPositioned:E.current!==!1};w.current&&!Fo(T.current,I)&&(T.current=I,Br.flushSync(()=>{f(I)}))})},[h,t,n,$,E]);ko(()=>{u===!1&&T.current.isPositioned&&(T.current.isPositioned=!1,f(B=>({...B,isPositioned:!1})))},[u]);const w=y.useRef(!1);ko(()=>(w.current=!0,()=>{w.current=!1}),[]),ko(()=>{if(S&&(j.current=S),C&&(N.current=C),S&&C){if(O.current)return O.current(S,C,L);L()}},[S,C,L,O,A]);const M=y.useMemo(()=>({reference:j,floating:N,setReference:v,setFloating:k}),[v,k]),U=y.useMemo(()=>({reference:S,floating:C}),[S,C]),F=y.useMemo(()=>{const B={position:n,left:0,top:0};if(!U.floating)return B;const G=Ic(U.floating,d.x),I=Ic(U.floating,d.y);return l?{...B,transform:"translate("+G+"px, "+I+"px)",...Cp(U.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:G,top:I}},[n,l,U.floating,d.x,d.y]);return y.useMemo(()=>({...d,update:L,refs:M,elements:U,floatingStyles:F}),[d,L,M,U,F])}const nC=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?Ac({element:r.current,padding:o}).fn(n):{}:r?Ac({element:r,padding:o}).fn(n):{}}}},rC=(e,t)=>({...ZS(e),options:[e,t]}),oC=(e,t)=>({...qS(e),options:[e,t]}),sC=(e,t)=>({...YS(e),options:[e,t]}),iC=(e,t)=>({...KS(e),options:[e,t]}),aC=(e,t)=>({...JS(e),options:[e,t]}),lC=(e,t)=>({...GS(e),options:[e,t]}),cC=(e,t)=>({...nC(e),options:[e,t]});var uC="Arrow",jp=y.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"})})});jp.displayName=uC;var dC=jp,Va="Popper",[Ep,gs]=tn(Va),[fC,Np]=Ep(Va),Tp=e=>{const{__scopePopper:t,children:n}=e,[r,o]=y.useState(null);return a.jsx(fC,{scope:t,anchor:r,onAnchorChange:o,children:n})};Tp.displayName=Va;var Ap="PopperAnchor",Ip=y.forwardRef((e,t)=>{const{__scopePopper:n,virtualRef:r,...o}=e,s=Np(Ap,n),i=y.useRef(null),l=Le(t,i),c=y.useRef(null);return y.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})});Ip.displayName=Ap;var Ha="PopperContent",[pC,hC]=Ep(Ha),zp=y.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:x,...m}=e,g=Np(Ha,n),[b,v]=y.useState(null),k=Le(t,ie=>v(ie)),[S,C]=y.useState(null),j=X_(S),N=j?.width??0,T=j?.height??0,A=r+(s!=="center"?"-"+s:""),O=typeof d=="number"?d:{top:0,right:0,bottom:0,left:0,...d},$=Array.isArray(u)?u:[u],E=$.length>0,L={padding:O,boundary:$.filter(gC),altBoundary:E},{refs:w,floatingStyles:M,placement:U,isPositioned:F,middlewareData:B}=tC({strategy:"fixed",placement:A,whileElementsMounted:(...ie)=>HS(...ie,{animationFrame:p==="always"}),elements:{reference:g.anchor},middleware:[rC({mainAxis:o+T,alignmentAxis:i}),c&&oC({mainAxis:!0,crossAxis:!1,limiter:f==="partial"?sC():void 0,...L}),c&&iC({...L}),aC({...L,apply:({elements:ie,rects:de,availableWidth:pe,availableHeight:he})=>{const{width:me,height:ke}=de.reference,ze=ie.floating.style;ze.setProperty("--radix-popper-available-width",`${pe}px`),ze.setProperty("--radix-popper-available-height",`${he}px`),ze.setProperty("--radix-popper-anchor-width",`${me}px`),ze.setProperty("--radix-popper-anchor-height",`${ke}px`)}}),S&&cC({element:S,padding:l}),xC({arrowWidth:N,arrowHeight:T}),h&&lC({strategy:"referenceHidden",...L})]}),[G,I]=Op(U),H=st(x);tt(()=>{F&&H?.()},[F,H]);const K=B.arrow?.x,z=B.arrow?.y,se=B.arrow?.centerOffset!==0,[re,ue]=y.useState();return tt(()=>{b&&ue(window.getComputedStyle(b).zIndex)},[b]),a.jsx("div",{ref:w.setFloating,"data-radix-popper-content-wrapper":"",style:{...M,transform:F?M.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:re,"--radix-popper-transform-origin":[B.transformOrigin?.x,B.transformOrigin?.y].join(" "),...B.hide?.referenceHidden&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:a.jsx(pC,{scope:n,placedSide:G,onArrowChange:C,arrowX:K,arrowY:z,shouldHideArrow:se,children:a.jsx(Te.div,{"data-side":G,"data-align":I,...m,ref:k,style:{...m.style,animation:F?void 0:"none"}})})})});zp.displayName=Ha;var Rp="PopperArrow",mC={top:"bottom",right:"left",bottom:"top",left:"right"},Pp=y.forwardRef(function(t,n){const{__scopePopper:r,...o}=t,s=hC(Rp,r),i=mC[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"}})})});Pp.displayName=Rp;function gC(e){return e!==null}var xC=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]=Op(n),f={start:"0%",center:"50%",end:"100%"}[d],h=(o.arrow?.x??0)+l/2,p=(o.arrow?.y??0)+c/2;let x="",m="";return u==="bottom"?(x=i?f:`${h}px`,m=`${-c}px`):u==="top"?(x=i?f:`${h}px`,m=`${r.floating.height+c}px`):u==="right"?(x=`${-c}px`,m=i?f:`${p}px`):u==="left"&&(x=`${r.floating.width+c}px`,m=i?f:`${p}px`),{data:{x,y:m}}}});function Op(e){const[t,n="center"]=e.split("-");return[t,n]}var Mp=Tp,Lp=Ip,Dp=zp,Fp=Pp,Zs="rovingFocusGroup.onEntryFocus",yC={bubbles:!1,cancelable:!0},Hr="RovingFocusGroup",[Ri,$p,bC]=Mf(Hr),[vC,Bp]=tn(Hr,[bC]),[wC,kC]=vC(Hr),Up=y.forwardRef((e,t)=>a.jsx(Ri.Provider,{scope:e.__scopeRovingFocusGroup,children:a.jsx(Ri.Slot,{scope:e.__scopeRovingFocusGroup,children:a.jsx(_C,{...e,ref:t})})}));Up.displayName=Hr;var _C=y.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=y.useRef(null),p=Le(t,h),x=as(s),[m,g]=_n({prop:i,defaultProp:l??null,onChange:c,caller:Hr}),[b,v]=y.useState(!1),k=st(u),S=$p(n),C=y.useRef(!1),[j,N]=y.useState(0);return y.useEffect(()=>{const T=h.current;if(T)return T.addEventListener(Zs,k),()=>T.removeEventListener(Zs,k)},[k]),a.jsx(wC,{scope:n,orientation:r,dir:x,loop:o,currentTabStopId:m,onItemFocus:y.useCallback(T=>g(T),[g]),onItemShiftTab:y.useCallback(()=>v(!0),[]),onFocusableItemAdd:y.useCallback(()=>N(T=>T+1),[]),onFocusableItemRemove:y.useCallback(()=>N(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:_e(e.onMouseDown,()=>{C.current=!0}),onFocus:_e(e.onFocus,T=>{const A=!C.current;if(T.target===T.currentTarget&&A&&!b){const O=new CustomEvent(Zs,yC);if(T.currentTarget.dispatchEvent(O),!O.defaultPrevented){const $=S().filter(U=>U.focusable),E=$.find(U=>U.active),L=$.find(U=>U.id===m),M=[E,L,...$].filter(Boolean).map(U=>U.ref.current);Hp(M,d)}}C.current=!1}),onBlur:_e(e.onBlur,()=>v(!1))})})}),Wp="RovingFocusGroupItem",Vp=y.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,focusable:r=!0,active:o=!1,tabStopId:s,children:i,...l}=e,c=Dt(),u=s||c,d=kC(Wp,n),f=d.currentTabStopId===u,h=$p(n),{onFocusableItemAdd:p,onFocusableItemRemove:x,currentTabStopId:m}=d;return y.useEffect(()=>{if(r)return p(),()=>x()},[r,p,x]),a.jsx(Ri.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:_e(e.onMouseDown,g=>{r?d.onItemFocus(u):g.preventDefault()}),onFocus:_e(e.onFocus,()=>d.onItemFocus(u)),onKeyDown:_e(e.onKeyDown,g=>{if(g.key==="Tab"&&g.shiftKey){d.onItemShiftTab();return}if(g.target!==g.currentTarget)return;const b=jC(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?EC(k,S+1):k.slice(S+1)}setTimeout(()=>Hp(k))}}),children:typeof i=="function"?i({isCurrentTabStop:f,hasTabStop:m!=null}):i})})});Vp.displayName=Wp;var SC={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function CC(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function jC(e,t,n){const r=CC(e.key,n);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(r))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(r)))return SC[r]}function Hp(e,t=!1){const n=document.activeElement;for(const r of e)if(r===n||(r.focus({preventScroll:t}),document.activeElement!==n))return}function EC(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var NC=Up,TC=Vp;function Pi(e,[t,n]){return Math.min(n,Math.max(t,e))}function AC(e,t){return y.useReducer((n,r)=>t[n][r]??n,e)}var Za="ScrollArea",[Zp]=tn(Za),[IC,wt]=Zp(Za),qp=y.forwardRef((e,t)=>{const{__scopeScrollArea:n,type:r="hover",dir:o,scrollHideDelay:s=600,...i}=e,[l,c]=y.useState(null),[u,d]=y.useState(null),[f,h]=y.useState(null),[p,x]=y.useState(null),[m,g]=y.useState(null),[b,v]=y.useState(0),[k,S]=y.useState(0),[C,j]=y.useState(!1),[N,T]=y.useState(!1),A=Le(t,$=>c($)),O=as(o);return a.jsx(IC,{scope:n,type:r,dir:O,scrollHideDelay:s,scrollArea:l,viewport:u,onViewportChange:d,content:f,onContentChange:h,scrollbarX:p,onScrollbarXChange:x,scrollbarXEnabled:C,onScrollbarXEnabledChange:j,scrollbarY:m,onScrollbarYChange:g,scrollbarYEnabled:N,onScrollbarYEnabledChange:T,onCornerWidthChange:v,onCornerHeightChange:S,children:a.jsx(Te.div,{dir:O,...i,ref:A,style:{position:"relative","--radix-scroll-area-corner-width":b+"px","--radix-scroll-area-corner-height":k+"px",...e.style}})})});qp.displayName=Za;var Kp="ScrollAreaViewport",Jp=y.forwardRef((e,t)=>{const{__scopeScrollArea:n,children:r,nonce:o,...s}=e,i=wt(Kp,n),l=y.useRef(null),c=Le(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})})]})});Jp.displayName=Kp;var Ht="ScrollAreaScrollbar",Gp=y.forwardRef((e,t)=>{const{forceMount:n,...r}=e,o=wt(Ht,e.__scopeScrollArea),{onScrollbarXEnabledChange:s,onScrollbarYEnabledChange:i}=o,l=e.orientation==="horizontal";return y.useEffect(()=>(l?s(!0):i(!0),()=>{l?s(!1):i(!1)}),[l,s,i]),o.type==="hover"?a.jsx(zC,{...r,ref:t,forceMount:n}):o.type==="scroll"?a.jsx(RC,{...r,ref:t,forceMount:n}):o.type==="auto"?a.jsx(Yp,{...r,ref:t,forceMount:n}):o.type==="always"?a.jsx(qa,{...r,ref:t}):null});Gp.displayName=Ht;var zC=y.forwardRef((e,t)=>{const{forceMount:n,...r}=e,o=wt(Ht,e.__scopeScrollArea),[s,i]=y.useState(!1);return y.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(vt,{present:n||s,children:a.jsx(Yp,{"data-state":s?"visible":"hidden",...r,ref:t})})}),RC=y.forwardRef((e,t)=>{const{forceMount:n,...r}=e,o=wt(Ht,e.__scopeScrollArea),s=e.orientation==="horizontal",i=ys(()=>c("SCROLL_END"),100),[l,c]=AC("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 y.useEffect(()=>{if(l==="idle"){const u=window.setTimeout(()=>c("HIDE"),o.scrollHideDelay);return()=>window.clearTimeout(u)}},[l,o.scrollHideDelay,c]),y.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(vt,{present:n||l!=="hidden",children:a.jsx(qa,{"data-state":l==="hidden"?"hidden":"visible",...r,ref:t,onPointerEnter:_e(e.onPointerEnter,()=>c("POINTER_ENTER")),onPointerLeave:_e(e.onPointerLeave,()=>c("POINTER_LEAVE"))})})}),Yp=y.forwardRef((e,t)=>{const n=wt(Ht,e.__scopeScrollArea),{forceMount:r,...o}=e,[s,i]=y.useState(!1),l=e.orientation==="horizontal",c=ys(()=>{if(n.viewport){const u=n.viewport.offsetWidth<n.viewport.scrollWidth,d=n.viewport.offsetHeight<n.viewport.scrollHeight;i(l?u:d)}},10);return nr(n.viewport,c),nr(n.content,c),a.jsx(vt,{present:r||s,children:a.jsx(qa,{"data-state":s?"visible":"hidden",...o,ref:t})})}),qa=y.forwardRef((e,t)=>{const{orientation:n="vertical",...r}=e,o=wt(Ht,e.__scopeScrollArea),s=y.useRef(null),i=y.useRef(0),[l,c]=y.useState({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),u=nh(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 FC(h,i.current,l,p)}return n==="horizontal"?a.jsx(PC,{...d,ref:t,onThumbPositionChange:()=>{if(o.viewport&&s.current){const h=o.viewport.scrollLeft,p=zc(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(OC,{...d,ref:t,onThumbPositionChange:()=>{if(o.viewport&&s.current){const h=o.viewport.scrollTop,p=zc(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}),PC=y.forwardRef((e,t)=>{const{sizes:n,onSizesChange:r,...o}=e,s=wt(Ht,e.__scopeScrollArea),[i,l]=y.useState(),c=y.useRef(null),u=Le(t,c,s.onScrollbarXChange);return y.useEffect(()=>{c.current&&l(getComputedStyle(c.current))},[c]),a.jsx(Qp,{"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":xs(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),oh(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:Bo(i.paddingLeft),paddingEnd:Bo(i.paddingRight)}})}})}),OC=y.forwardRef((e,t)=>{const{sizes:n,onSizesChange:r,...o}=e,s=wt(Ht,e.__scopeScrollArea),[i,l]=y.useState(),c=y.useRef(null),u=Le(t,c,s.onScrollbarYChange);return y.useEffect(()=>{c.current&&l(getComputedStyle(c.current))},[c]),a.jsx(Qp,{"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":xs(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),oh(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:Bo(i.paddingTop),paddingEnd:Bo(i.paddingBottom)}})}})}),[MC,Xp]=Zp(Ht),Qp=y.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=wt(Ht,n),[x,m]=y.useState(null),g=Le(t,A=>m(A)),b=y.useRef(null),v=y.useRef(""),k=p.viewport,S=r.content-r.viewport,C=st(d),j=st(c),N=ys(f,10);function T(A){if(b.current){const O=A.clientX-b.current.left,$=A.clientY-b.current.top;u({x:O,y:$})}}return y.useEffect(()=>{const A=O=>{const $=O.target;x?.contains($)&&C(O,S)};return document.addEventListener("wheel",A,{passive:!1}),()=>document.removeEventListener("wheel",A,{passive:!1})},[k,x,S,C]),y.useEffect(j,[r,j]),nr(x,N),nr(p.content,N),a.jsx(MC,{scope:n,scrollbar:x,hasThumb:o,onThumbChange:st(s),onThumbPointerUp:st(i),onThumbPositionChange:j,onThumbPointerDown:st(l),children:a.jsx(Te.div,{...h,ref:g,style:{position:"absolute",...h.style},onPointerDown:_e(e.onPointerDown,A=>{A.button===0&&(A.target.setPointerCapture(A.pointerId),b.current=x.getBoundingClientRect(),v.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect="none",p.viewport&&(p.viewport.style.scrollBehavior="auto"),T(A))}),onPointerMove:_e(e.onPointerMove,T),onPointerUp:_e(e.onPointerUp,A=>{const O=A.target;O.hasPointerCapture(A.pointerId)&&O.releasePointerCapture(A.pointerId),document.body.style.webkitUserSelect=v.current,p.viewport&&(p.viewport.style.scrollBehavior=""),b.current=null})})})}),$o="ScrollAreaThumb",eh=y.forwardRef((e,t)=>{const{forceMount:n,...r}=e,o=Xp($o,e.__scopeScrollArea);return a.jsx(vt,{present:n||o.hasThumb,children:a.jsx(LC,{ref:t,...r})})}),LC=y.forwardRef((e,t)=>{const{__scopeScrollArea:n,style:r,...o}=e,s=wt($o,n),i=Xp($o,n),{onThumbPositionChange:l}=i,c=Le(t,f=>i.onThumbChange(f)),u=y.useRef(void 0),d=ys(()=>{u.current&&(u.current(),u.current=void 0)},100);return y.useEffect(()=>{const f=s.viewport;if(f){const h=()=>{if(d(),!u.current){const p=$C(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:_e(e.onPointerDownCapture,f=>{const p=f.target.getBoundingClientRect(),x=f.clientX-p.left,m=f.clientY-p.top;i.onThumbPointerDown({x,y:m})}),onPointerUp:_e(e.onPointerUp,i.onThumbPointerUp)})});eh.displayName=$o;var Ka="ScrollAreaCorner",th=y.forwardRef((e,t)=>{const n=wt(Ka,e.__scopeScrollArea),r=!!(n.scrollbarX&&n.scrollbarY);return n.type!=="scroll"&&r?a.jsx(DC,{...e,ref:t}):null});th.displayName=Ka;var DC=y.forwardRef((e,t)=>{const{__scopeScrollArea:n,...r}=e,o=wt(Ka,n),[s,i]=y.useState(0),[l,c]=y.useState(0),u=!!(s&&l);return nr(o.scrollbarX,()=>{const d=o.scrollbarX?.offsetHeight||0;o.onCornerHeightChange(d),c(d)}),nr(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 Bo(e){return e?parseInt(e,10):0}function nh(e,t){const n=e/t;return isNaN(n)?0:n}function xs(e){const t=nh(e.viewport,e.content),n=e.scrollbar.paddingStart+e.scrollbar.paddingEnd,r=(e.scrollbar.size-n)*t;return Math.max(r,18)}function FC(e,t,n,r="ltr"){const o=xs(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 rh([c,u],f)(e)}function zc(e,t,n="ltr"){const r=xs(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=Pi(e,c);return rh([0,i],[0,l])(u)}function rh(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 oh(e,t){return e>0&&e<t}var $C=(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 ys(e,t){const n=st(e),r=y.useRef(0);return y.useEffect(()=>()=>window.clearTimeout(r.current),[]),y.useCallback(()=>{window.clearTimeout(r.current),r.current=window.setTimeout(n,t)},[n,t])}function nr(e,t){const n=st(t);tt(()=>{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 BC=qp,UC=Jp,WC=th,VC=[" ","Enter","ArrowUp","ArrowDown"],HC=[" ","Enter"],jn="Select",[bs,vs,ZC]=Mf(jn),[cr]=tn(jn,[ZC,gs]),ws=gs(),[qC,hn]=cr(jn),[KC,JC]=cr(jn),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:x}=e,m=ws(t),[g,b]=y.useState(null),[v,k]=y.useState(null),[S,C]=y.useState(!1),j=as(u),[N,T]=_n({prop:r,defaultProp:o??!1,onChange:s,caller:jn}),[A,O]=_n({prop:i,defaultProp:l,onChange:c,caller:jn}),$=y.useRef(null),E=g?x||!!g.closest("form"):!0,[L,w]=y.useState(new Set),M=Array.from(L).map(U=>U.props.value).join(";");return a.jsx(Mp,{...m,children:a.jsxs(qC,{required:p,scope:t,trigger:g,onTriggerChange:b,valueNode:v,onValueNodeChange:k,valueNodeHasChildren:S,onValueNodeHasChildrenChange:C,contentId:Dt(),value:A,onValueChange:O,open:N,onOpenChange:T,dir:j,triggerPointerDownPosRef:$,disabled:h,children:[a.jsx(bs.Provider,{scope:t,children:a.jsx(KC,{scope:e.__scopeSelect,onNativeOptionAdd:y.useCallback(U=>{w(F=>new Set(F).add(U))},[]),onNativeOptionRemove:y.useCallback(U=>{w(F=>{const B=new Set(F);return B.delete(U),B})},[]),children:n})}),E?a.jsxs(Eh,{"aria-hidden":!0,required:p,tabIndex:-1,name:d,autoComplete:f,value:A,onChange:U=>O(U.target.value),disabled:h,form:x,children:[A===void 0?a.jsx("option",{value:""}):null,Array.from(L)]},M):null]})})};sh.displayName=jn;var ih="SelectTrigger",ah=y.forwardRef((e,t)=>{const{__scopeSelect:n,disabled:r=!1,...o}=e,s=ws(n),i=hn(ih,n),l=i.disabled||r,c=Le(t,i.onTriggerChange),u=vs(n),d=y.useRef("touch"),[f,h,p]=Th(m=>{const g=u().filter(k=>!k.disabled),b=g.find(k=>k.value===i.value),v=Ah(g,m,b);v!==void 0&&i.onValueChange(v.value)}),x=m=>{l||(i.onOpenChange(!0),p()),m&&(i.triggerPointerDownPosRef.current={x:Math.round(m.pageX),y:Math.round(m.pageY)})};return a.jsx(Lp,{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":Nh(i.value)?"":void 0,...o,ref:c,onClick:_e(o.onClick,m=>{m.currentTarget.focus(),d.current!=="mouse"&&x(m)}),onPointerDown:_e(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"&&(x(m),m.preventDefault())}),onKeyDown:_e(o.onKeyDown,m=>{const g=f.current!=="";!(m.ctrlKey||m.altKey||m.metaKey)&&m.key.length===1&&h(m.key),!(g&&m.key===" ")&&VC.includes(m.key)&&(x(),m.preventDefault())})})})});ah.displayName=ih;var lh="SelectValue",ch=y.forwardRef((e,t)=>{const{__scopeSelect:n,className:r,style:o,children:s,placeholder:i="",...l}=e,c=hn(lh,n),{onValueNodeHasChildrenChange:u}=c,d=s!==void 0,f=Le(t,c.onValueNodeChange);return tt(()=>{u(d)},[u,d]),a.jsx(Te.span,{...l,ref:f,style:{pointerEvents:"none"},children:Nh(c.value)?a.jsx(a.Fragment,{children:i}):s})});ch.displayName=lh;var GC="SelectIcon",uh=y.forwardRef((e,t)=>{const{__scopeSelect:n,children:r,...o}=e;return a.jsx(Te.span,{"aria-hidden":!0,...o,ref:t,children:r||"▼"})});uh.displayName=GC;var YC="SelectPortal",dh=e=>a.jsx(cs,{asChild:!0,...e});dh.displayName=YC;var En="SelectContent",fh=y.forwardRef((e,t)=>{const n=hn(En,e.__scopeSelect),[r,o]=y.useState();if(tt(()=>{o(new DocumentFragment)},[]),!n.open){const s=r;return s?Br.createPortal(a.jsx(ph,{scope:e.__scopeSelect,children:a.jsx(bs.Slot,{scope:e.__scopeSelect,children:a.jsx("div",{children:e.children})})}),s):null}return a.jsx(hh,{...e,ref:t})});fh.displayName=En;var St=10,[ph,mn]=cr(En),XC="SelectContentImpl",QC=er("SelectContent.RemoveScroll"),hh=y.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:x,hideWhenDetached:m,avoidCollisions:g,...b}=e,v=hn(En,n),[k,S]=y.useState(null),[C,j]=y.useState(null),N=Le(t,ie=>S(ie)),[T,A]=y.useState(null),[O,$]=y.useState(null),E=vs(n),[L,w]=y.useState(!1),M=y.useRef(!1);y.useEffect(()=>{if(k)return Qf(k)},[k]),Vf();const U=y.useCallback(ie=>{const[de,...pe]=E().map(ke=>ke.ref.current),[he]=pe.slice(-1),me=document.activeElement;for(const ke of ie)if(ke===me||(ke?.scrollIntoView({block:"nearest"}),ke===de&&C&&(C.scrollTop=0),ke===he&&C&&(C.scrollTop=C.scrollHeight),ke?.focus(),document.activeElement!==me))return},[E,C]),F=y.useCallback(()=>U([T,k]),[U,T,k]);y.useEffect(()=>{L&&F()},[L,F]);const{onOpenChange:B,triggerPointerDownPosRef:G}=v;y.useEffect(()=>{if(k){let ie={x:0,y:0};const de=he=>{ie={x:Math.abs(Math.round(he.pageX)-(G.current?.x??0)),y:Math.abs(Math.round(he.pageY)-(G.current?.y??0))}},pe=he=>{ie.x<=10&&ie.y<=10?he.preventDefault():k.contains(he.target)||B(!1),document.removeEventListener("pointermove",de),G.current=null};return G.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,B,G]),y.useEffect(()=>{const ie=()=>B(!1);return window.addEventListener("blur",ie),window.addEventListener("resize",ie),()=>{window.removeEventListener("blur",ie),window.removeEventListener("resize",ie)}},[B]);const[I,H]=Th(ie=>{const de=E().filter(me=>!me.disabled),pe=de.find(me=>me.ref.current===document.activeElement),he=Ah(de,ie,pe);he&&setTimeout(()=>he.ref.current.focus())}),K=y.useCallback((ie,de,pe)=>{const he=!M.current&&!pe;(v.value!==void 0&&v.value===de||he)&&(A(ie),he&&(M.current=!0))},[v.value]),z=y.useCallback(()=>k?.focus(),[k]),se=y.useCallback((ie,de,pe)=>{const he=!M.current&&!pe;(v.value!==void 0&&v.value===de||he)&&$(ie)},[v.value]),re=r==="popper"?Oi:mh,ue=re===Oi?{side:l,sideOffset:c,align:u,alignOffset:d,arrowPadding:f,collisionBoundary:h,collisionPadding:p,sticky:x,hideWhenDetached:m,avoidCollisions:g}:{};return a.jsx(ph,{scope:n,content:k,viewport:C,onViewportChange:j,itemRefCallback:K,selectedItem:T,onItemLeave:z,itemTextRefCallback:se,focusSelectedItem:F,selectedItemText:O,position:r,isPositioned:L,searchRef:I,children:a.jsx(Pa,{as:QC,allowPinchZoom:!0,children:a.jsx(Ra,{asChild:!0,trapped:v.open,onMountAutoFocus:ie=>{ie.preventDefault()},onUnmountAutoFocus:_e(o,ie=>{v.trigger?.focus({preventScroll:!0}),ie.preventDefault()}),children:a.jsx(ls,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:s,onPointerDownOutside:i,onFocusOutside:ie=>ie.preventDefault(),onDismiss:()=>v.onOpenChange(!1),children:a.jsx(re,{role:"listbox",id:v.contentId,"data-state":v.open?"open":"closed",dir:v.dir,onContextMenu:ie=>ie.preventDefault(),...b,...ue,onPlaced:()=>w(!0),ref:N,style:{display:"flex",flexDirection:"column",outline:"none",...b.style},onKeyDown:_e(b.onKeyDown,ie=>{const de=ie.ctrlKey||ie.altKey||ie.metaKey;if(ie.key==="Tab"&&ie.preventDefault(),!de&&ie.key.length===1&&H(ie.key),["ArrowUp","ArrowDown","Home","End"].includes(ie.key)){let he=E().filter(me=>!me.disabled).map(me=>me.ref.current);if(["ArrowUp","End"].includes(ie.key)&&(he=he.slice().reverse()),["ArrowUp","ArrowDown"].includes(ie.key)){const me=ie.target,ke=he.indexOf(me);he=he.slice(ke+1)}setTimeout(()=>U(he)),ie.preventDefault()}})})})})})})});hh.displayName=XC;var e5="SelectItemAlignedPosition",mh=y.forwardRef((e,t)=>{const{__scopeSelect:n,onPlaced:r,...o}=e,s=hn(En,n),i=mn(En,n),[l,c]=y.useState(null),[u,d]=y.useState(null),f=Le(t,N=>d(N)),h=vs(n),p=y.useRef(!1),x=y.useRef(!0),{viewport:m,selectedItem:g,selectedItemText:b,focusSelectedItem:v}=i,k=y.useCallback(()=>{if(s.trigger&&s.valueNode&&l&&u&&m&&g&&b){const N=s.trigger.getBoundingClientRect(),T=u.getBoundingClientRect(),A=s.valueNode.getBoundingClientRect(),O=b.getBoundingClientRect();if(s.dir!=="rtl"){const me=O.left-T.left,ke=A.left-me,ze=N.left-ke,_=N.width+ze,te=Math.max(_,T.width),Q=window.innerWidth-St,P=Pi(ke,[St,Math.max(St,Q-te)]);l.style.minWidth=_+"px",l.style.left=P+"px"}else{const me=T.right-O.right,ke=window.innerWidth-A.right-me,ze=window.innerWidth-N.right-ke,_=N.width+ze,te=Math.max(_,T.width),Q=window.innerWidth-St,P=Pi(ke,[St,Math.max(St,Q-te)]);l.style.minWidth=_+"px",l.style.right=P+"px"}const $=h(),E=window.innerHeight-St*2,L=m.scrollHeight,w=window.getComputedStyle(u),M=parseInt(w.borderTopWidth,10),U=parseInt(w.paddingTop,10),F=parseInt(w.borderBottomWidth,10),B=parseInt(w.paddingBottom,10),G=M+U+L+B+F,I=Math.min(g.offsetHeight*5,G),H=window.getComputedStyle(m),K=parseInt(H.paddingTop,10),z=parseInt(H.paddingBottom,10),se=N.top+N.height/2-St,re=E-se,ue=g.offsetHeight/2,ie=g.offsetTop+ue,de=M+U+ie,pe=G-de;if(de<=se){const me=$.length>0&&g===$[$.length-1].ref.current;l.style.bottom="0px";const ke=u.clientHeight-m.offsetTop-m.offsetHeight,ze=Math.max(re,ue+(me?z:0)+ke+F),_=de+ze;l.style.height=_+"px"}else{const me=$.length>0&&g===$[0].ref.current;l.style.top="0px";const ze=Math.max(se,M+m.offsetTop+(me?K:0)+ue)+pe;l.style.height=ze+"px",m.scrollTop=de-se+m.offsetTop}l.style.margin=`${St}px 0`,l.style.minHeight=I+"px",l.style.maxHeight=E+"px",r?.(),requestAnimationFrame(()=>p.current=!0)}},[h,s.trigger,s.valueNode,l,u,m,g,b,s.dir,r]);tt(()=>k(),[k]);const[S,C]=y.useState();tt(()=>{u&&C(window.getComputedStyle(u).zIndex)},[u]);const j=y.useCallback(N=>{N&&x.current===!0&&(k(),v?.(),x.current=!1)},[k,v]);return a.jsx(n5,{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}})})})});mh.displayName=e5;var t5="SelectPopperPosition",Oi=y.forwardRef((e,t)=>{const{__scopeSelect:n,align:r="start",collisionPadding:o=St,...s}=e,i=ws(n);return a.jsx(Dp,{...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)"}})});Oi.displayName=t5;var[n5,Ja]=cr(En,{}),Mi="SelectViewport",gh=y.forwardRef((e,t)=>{const{__scopeSelect:n,nonce:r,...o}=e,s=mn(Mi,n),i=Ja(Mi,n),l=Le(t,s.onViewportChange),c=y.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(bs.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:_e(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 x=window.innerHeight-St*2,m=parseFloat(f.style.minHeight),g=parseFloat(f.style.height),b=Math.max(m,g);if(b<x){const v=b+p,k=Math.min(x,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})})})]})});gh.displayName=Mi;var xh="SelectGroup",[r5,o5]=cr(xh),s5=y.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,o=Dt();return a.jsx(r5,{scope:n,id:o,children:a.jsx(Te.div,{role:"group","aria-labelledby":o,...r,ref:t})})});s5.displayName=xh;var yh="SelectLabel",i5=y.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,o=o5(yh,n);return a.jsx(Te.div,{id:o.id,...r,ref:t})});i5.displayName=yh;var Uo="SelectItem",[a5,bh]=cr(Uo),vh=y.forwardRef((e,t)=>{const{__scopeSelect:n,value:r,disabled:o=!1,textValue:s,...i}=e,l=hn(Uo,n),c=mn(Uo,n),u=l.value===r,[d,f]=y.useState(s??""),[h,p]=y.useState(!1),x=Le(t,v=>c.itemRefCallback?.(v,r,o)),m=Dt(),g=y.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(a5,{scope:n,value:r,disabled:o,textId:m,isSelected:u,onItemTextChange:y.useCallback(v=>{f(k=>k||(v?.textContent??"").trim())},[]),children:a.jsx(bs.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:x,onFocus:_e(i.onFocus,()=>p(!0)),onBlur:_e(i.onBlur,()=>p(!1)),onClick:_e(i.onClick,()=>{g.current!=="mouse"&&b()}),onPointerUp:_e(i.onPointerUp,()=>{g.current==="mouse"&&b()}),onPointerDown:_e(i.onPointerDown,v=>{g.current=v.pointerType}),onPointerMove:_e(i.onPointerMove,v=>{g.current=v.pointerType,o?c.onItemLeave?.():g.current==="mouse"&&v.currentTarget.focus({preventScroll:!0})}),onPointerLeave:_e(i.onPointerLeave,v=>{v.currentTarget===document.activeElement&&c.onItemLeave?.()}),onKeyDown:_e(i.onKeyDown,v=>{c.searchRef?.current!==""&&v.key===" "||(HC.includes(v.key)&&b(),v.key===" "&&v.preventDefault())})})})})});vh.displayName=Uo;var Sr="SelectItemText",wh=y.forwardRef((e,t)=>{const{__scopeSelect:n,className:r,style:o,...s}=e,i=hn(Sr,n),l=mn(Sr,n),c=bh(Sr,n),u=JC(Sr,n),[d,f]=y.useState(null),h=Le(t,b=>f(b),c.onItemTextChange,b=>l.itemTextRefCallback?.(b,c.value,c.disabled)),p=d?.textContent,x=y.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 tt(()=>(m(x),()=>g(x)),[m,g,x]),a.jsxs(a.Fragment,{children:[a.jsx(Te.span,{id:c.textId,...s,ref:h}),c.isSelected&&i.valueNode&&!i.valueNodeHasChildren?Br.createPortal(s.children,i.valueNode):null]})});wh.displayName=Sr;var kh="SelectItemIndicator",_h=y.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e;return bh(kh,n).isSelected?a.jsx(Te.span,{"aria-hidden":!0,...r,ref:t}):null});_h.displayName=kh;var Li="SelectScrollUpButton",Sh=y.forwardRef((e,t)=>{const n=mn(Li,e.__scopeSelect),r=Ja(Li,e.__scopeSelect),[o,s]=y.useState(!1),i=Le(t,r.onScrollButtonChange);return tt(()=>{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(jh,{...e,ref:i,onAutoScroll:()=>{const{viewport:l,selectedItem:c}=n;l&&c&&(l.scrollTop=l.scrollTop-c.offsetHeight)}}):null});Sh.displayName=Li;var Di="SelectScrollDownButton",Ch=y.forwardRef((e,t)=>{const n=mn(Di,e.__scopeSelect),r=Ja(Di,e.__scopeSelect),[o,s]=y.useState(!1),i=Le(t,r.onScrollButtonChange);return tt(()=>{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(jh,{...e,ref:i,onAutoScroll:()=>{const{viewport:l,selectedItem:c}=n;l&&c&&(l.scrollTop=l.scrollTop+c.offsetHeight)}}):null});Ch.displayName=Di;var jh=y.forwardRef((e,t)=>{const{__scopeSelect:n,onAutoScroll:r,...o}=e,s=mn("SelectScrollButton",n),i=y.useRef(null),l=vs(n),c=y.useCallback(()=>{i.current!==null&&(window.clearInterval(i.current),i.current=null)},[]);return y.useEffect(()=>()=>c(),[c]),tt(()=>{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:_e(o.onPointerDown,()=>{i.current===null&&(i.current=window.setInterval(r,50))}),onPointerMove:_e(o.onPointerMove,()=>{s.onItemLeave?.(),i.current===null&&(i.current=window.setInterval(r,50))}),onPointerLeave:_e(o.onPointerLeave,()=>{c()})})}),l5="SelectSeparator",c5=y.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e;return a.jsx(Te.div,{"aria-hidden":!0,...r,ref:t})});c5.displayName=l5;var Fi="SelectArrow",u5=y.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,o=ws(n),s=hn(Fi,n),i=mn(Fi,n);return s.open&&i.position==="popper"?a.jsx(Fp,{...o,...r,ref:t}):null});u5.displayName=Fi;var d5="SelectBubbleInput",Eh=y.forwardRef(({__scopeSelect:e,value:t,...n},r)=>{const o=y.useRef(null),s=Le(r,o),i=Y_(t);return y.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:{...Pf,...n.style},ref:s,defaultValue:t})});Eh.displayName=d5;function Nh(e){return e===""||e===void 0}function Th(e){const t=st(e),n=y.useRef(""),r=y.useRef(0),o=y.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=y.useCallback(()=>{n.current="",window.clearTimeout(r.current)},[]);return y.useEffect(()=>()=>window.clearTimeout(r.current),[]),[n,o,s]}function Ah(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=f5(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 f5(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var p5=sh,h5=ah,m5=ch,g5=uh,x5=dh,y5=fh,b5=gh,v5=vh,w5=wh,k5=_h,_5=Sh,S5=Ch,ks="Tabs",[C5]=tn(ks,[Bp]),Ih=Bp(),[j5,Ga]=C5(ks),zh=y.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,onValueChange:o,defaultValue:s,orientation:i="horizontal",dir:l,activationMode:c="automatic",...u}=e,d=as(l),[f,h]=_n({prop:r,onChange:o,defaultProp:s??"",caller:ks});return a.jsx(j5,{scope:n,baseId:Dt(),value:f,onValueChange:h,orientation:i,dir:d,activationMode:c,children:a.jsx(Te.div,{dir:d,"data-orientation":i,...u,ref:t})})});zh.displayName=ks;var Rh="TabsList",Ph=y.forwardRef((e,t)=>{const{__scopeTabs:n,loop:r=!0,...o}=e,s=Ga(Rh,n),i=Ih(n);return a.jsx(NC,{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})})});Ph.displayName=Rh;var Oh="TabsTrigger",Mh=y.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,disabled:o=!1,...s}=e,i=Ga(Oh,n),l=Ih(n),c=Fh(i.baseId,r),u=$h(i.baseId,r),d=r===i.value;return a.jsx(TC,{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:_e(e.onMouseDown,f=>{!o&&f.button===0&&f.ctrlKey===!1?i.onValueChange(r):f.preventDefault()}),onKeyDown:_e(e.onKeyDown,f=>{[" ","Enter"].includes(f.key)&&i.onValueChange(r)}),onFocus:_e(e.onFocus,()=>{const f=i.activationMode!=="manual";!d&&!o&&f&&i.onValueChange(r)})})})});Mh.displayName=Oh;var Lh="TabsContent",Dh=y.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,forceMount:o,children:s,...i}=e,l=Ga(Lh,n),c=Fh(l.baseId,r),u=$h(l.baseId,r),d=r===l.value,f=y.useRef(d);return y.useEffect(()=>{const h=requestAnimationFrame(()=>f.current=!1);return()=>cancelAnimationFrame(h)},[]),a.jsx(vt,{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})})});Dh.displayName=Lh;function Fh(e,t){return`${e}-trigger-${t}`}function $h(e,t){return`${e}-content-${t}`}var E5=zh,N5=Ph,T5=Mh,A5=Dh,[_s]=tn("Tooltip",[gs]),Ss=gs(),Bh="TooltipProvider",I5=700,$i="tooltip.open",[z5,Ya]=_s(Bh),Uh=e=>{const{__scopeTooltip:t,delayDuration:n=I5,skipDelayDuration:r=300,disableHoverableContent:o=!1,children:s}=e,i=y.useRef(!0),l=y.useRef(!1),c=y.useRef(0);return y.useEffect(()=>{const u=c.current;return()=>window.clearTimeout(u)},[]),a.jsx(z5,{scope:t,isOpenDelayedRef:i,delayDuration:n,onOpen:y.useCallback(()=>{window.clearTimeout(c.current),i.current=!1},[]),onClose:y.useCallback(()=>{window.clearTimeout(c.current),c.current=window.setTimeout(()=>i.current=!0,r)},[r]),isPointerInTransitRef:l,onPointerInTransitChange:y.useCallback(u=>{l.current=u},[]),disableHoverableContent:o,children:s})};Uh.displayName=Bh;var Mr="Tooltip",[R5,Zr]=_s(Mr),Wh=e=>{const{__scopeTooltip:t,children:n,open:r,defaultOpen:o,onOpenChange:s,disableHoverableContent:i,delayDuration:l}=e,c=Ya(Mr,e.__scopeTooltip),u=Ss(t),[d,f]=y.useState(null),h=Dt(),p=y.useRef(0),x=i??c.disableHoverableContent,m=l??c.delayDuration,g=y.useRef(!1),[b,v]=_n({prop:r,defaultProp:o??!1,onChange:N=>{N?(c.onOpen(),document.dispatchEvent(new CustomEvent($i))):c.onClose(),s?.(N)},caller:Mr}),k=y.useMemo(()=>b?g.current?"delayed-open":"instant-open":"closed",[b]),S=y.useCallback(()=>{window.clearTimeout(p.current),p.current=0,g.current=!1,v(!0)},[v]),C=y.useCallback(()=>{window.clearTimeout(p.current),p.current=0,v(!1)},[v]),j=y.useCallback(()=>{window.clearTimeout(p.current),p.current=window.setTimeout(()=>{g.current=!0,v(!0),p.current=0},m)},[m,v]);return y.useEffect(()=>()=>{p.current&&(window.clearTimeout(p.current),p.current=0)},[]),a.jsx(Mp,{...u,children:a.jsx(R5,{scope:t,contentId:h,open:b,stateAttribute:k,trigger:d,onTriggerChange:f,onTriggerEnter:y.useCallback(()=>{c.isOpenDelayedRef.current?j():S()},[c.isOpenDelayedRef,j,S]),onTriggerLeave:y.useCallback(()=>{x?C():(window.clearTimeout(p.current),p.current=0)},[C,x]),onOpen:S,onClose:C,disableHoverableContent:x,children:n})})};Wh.displayName=Mr;var Bi="TooltipTrigger",Vh=y.forwardRef((e,t)=>{const{__scopeTooltip:n,...r}=e,o=Zr(Bi,n),s=Ya(Bi,n),i=Ss(n),l=y.useRef(null),c=Le(t,l,o.onTriggerChange),u=y.useRef(!1),d=y.useRef(!1),f=y.useCallback(()=>u.current=!1,[]);return y.useEffect(()=>()=>document.removeEventListener("pointerup",f),[f]),a.jsx(Lp,{asChild:!0,...i,children:a.jsx(Te.button,{"aria-describedby":o.open?o.contentId:void 0,"data-state":o.stateAttribute,...r,ref:c,onPointerMove:_e(e.onPointerMove,h=>{h.pointerType!=="touch"&&!d.current&&!s.isPointerInTransitRef.current&&(o.onTriggerEnter(),d.current=!0)}),onPointerLeave:_e(e.onPointerLeave,()=>{o.onTriggerLeave(),d.current=!1}),onPointerDown:_e(e.onPointerDown,()=>{o.open&&o.onClose(),u.current=!0,document.addEventListener("pointerup",f,{once:!0})}),onFocus:_e(e.onFocus,()=>{u.current||o.onOpen()}),onBlur:_e(e.onBlur,o.onClose),onClick:_e(e.onClick,o.onClose)})})});Vh.displayName=Bi;var Xa="TooltipPortal",[P5,O5]=_s(Xa,{forceMount:void 0}),Hh=e=>{const{__scopeTooltip:t,forceMount:n,children:r,container:o}=e,s=Zr(Xa,t);return a.jsx(P5,{scope:t,forceMount:n,children:a.jsx(vt,{present:n||s.open,children:a.jsx(cs,{asChild:!0,container:o,children:r})})})};Hh.displayName=Xa;var rr="TooltipContent",Zh=y.forwardRef((e,t)=>{const n=O5(rr,e.__scopeTooltip),{forceMount:r=n.forceMount,side:o="top",...s}=e,i=Zr(rr,e.__scopeTooltip);return a.jsx(vt,{present:r||i.open,children:i.disableHoverableContent?a.jsx(qh,{side:o,...s,ref:t}):a.jsx(M5,{side:o,...s,ref:t})})}),M5=y.forwardRef((e,t)=>{const n=Zr(rr,e.__scopeTooltip),r=Ya(rr,e.__scopeTooltip),o=y.useRef(null),s=Le(t,o),[i,l]=y.useState(null),{trigger:c,onClose:u}=n,d=o.current,{onPointerInTransitChange:f}=r,h=y.useCallback(()=>{l(null),f(!1)},[f]),p=y.useCallback((x,m)=>{const g=x.currentTarget,b={x:x.clientX,y:x.clientY},v=$5(b,g.getBoundingClientRect()),k=B5(b,v),S=U5(m.getBoundingClientRect()),C=V5([...k,...S]);l(C),f(!0)},[f]);return y.useEffect(()=>()=>h(),[h]),y.useEffect(()=>{if(c&&d){const x=g=>p(g,d),m=g=>p(g,c);return c.addEventListener("pointerleave",x),d.addEventListener("pointerleave",m),()=>{c.removeEventListener("pointerleave",x),d.removeEventListener("pointerleave",m)}}},[c,d,p,h]),y.useEffect(()=>{if(i){const x=m=>{const g=m.target,b={x:m.clientX,y:m.clientY},v=c?.contains(g)||d?.contains(g),k=!W5(b,i);v?h():k&&(h(),u())};return document.addEventListener("pointermove",x),()=>document.removeEventListener("pointermove",x)}},[c,d,i,u,h]),a.jsx(qh,{...e,ref:s})}),[L5,D5]=_s(Mr,{isInside:!1}),F5=uk("TooltipContent"),qh=y.forwardRef((e,t)=>{const{__scopeTooltip:n,children:r,"aria-label":o,onEscapeKeyDown:s,onPointerDownOutside:i,...l}=e,c=Zr(rr,n),u=Ss(n),{onClose:d}=c;return y.useEffect(()=>(document.addEventListener($i,d),()=>document.removeEventListener($i,d)),[d]),y.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(ls,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:s,onPointerDownOutside:i,onFocusOutside:f=>f.preventDefault(),onDismiss:d,children:a.jsxs(Dp,{"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(L5,{scope:n,isInside:!0,children:a.jsx(xk,{id:c.contentId,role:"tooltip",children:o||r})})]})})});Zh.displayName=rr;var Kh="TooltipArrow",Jh=y.forwardRef((e,t)=>{const{__scopeTooltip:n,...r}=e,o=Ss(n);return D5(Kh,n).isInside?null:a.jsx(Fp,{...o,...r,ref:t})});Jh.displayName=Kh;function $5(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 B5(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 U5(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 W5(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 V5(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),H5(t)}function H5(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 Z5=Uh,q5=Wh,K5=Vh,J5=Hh,G5=Zh,Y5=Jh;const X5=Ta("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 Et({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(X5({variant:t}),e),...r})}function Qa({...e}){return a.jsx(V_,{"data-slot":"dialog",...e})}function Q5({...e}){return a.jsx(H_,{"data-slot":"dialog-trigger",...e})}function ej({...e}){return a.jsx(Z_,{"data-slot":"dialog-portal",...e})}function tj({className:e,...t}){return a.jsx(q_,{"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 el({className:e,children:t,...n}){return a.jsxs(ej,{children:[a.jsx(tj,{}),a.jsxs(K_,{"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(G_,{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(ja,{className:"size-4"}),a.jsx("span",{className:"sr-only",children:"Close"})]})]})]})}function tl({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 nl({className:e,...t}){return a.jsx(J_,{"data-slot":"dialog-title",className:ve("text-lg font-semibold leading-none tracking-tight",e),...t})}const nj=Ta("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 Re({className:e,variant:t,size:n,...r}){return a.jsx("button",{"data-slot":"button",className:ve(nj({variant:t,size:n,className:e})),...r})}function Gh({open:e,onOpenChange:t,title:n,description:r,confirmLabel:o="Confirm",variant:s="default",onConfirm:i}){return a.jsx(Qa,{open:e,onOpenChange:t,children:a.jsxs(el,{children:[a.jsx(tl,{children:a.jsx(nl,{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(Re,{variant:"outline",size:"sm",onClick:()=>t(!1),children:"Cancel"}),a.jsx(Re,{variant:s,size:"sm",onClick:()=>{i(),t(!1)},children:o})]})]})})}const rj={anthropic:"Anthropic",openai:"OpenAI",unknown:"Unknown"};function oj({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[x,m]=y.useState(!1),g=v=>{v.stopPropagation(),p!==void 0&&m(!0)},b=y.useCallback(v=>{v.stopPropagation(),window.open(Ng(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(Ut,{className:"size-4 text-muted-foreground shrink-0"}):d?a.jsx(Rr,{className:"size-4 animate-spin text-muted-foreground shrink-0"}):a.jsx(en,{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(Uw,{className:"size-3"}),a.jsx("span",{className:"font-mono tabular-nums truncate max-w-[120px]",children:f})]}),!u&&a.jsx(Et,{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:rj[i]}),a.jsxs("span",{className:"flex items-center gap-1 text-muted-foreground text-xs shrink-0",children:[a.jsx(cn,{className:"size-3"}),a.jsx("span",{className:"font-mono tabular-nums",children:Ea(t,n,h)})]}),a.jsxs("span",{className:"flex items-center gap-1 text-muted-foreground text-xs shrink-0",children:[a.jsx(ss,{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(Pr,{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(uf,{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(hf,{className:"size-3.5"})}),a.jsx(Gh,{open:x,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 sj(e){const t=e.find(n=>n.apiFormat!=="unknown");return t!==void 0?t.apiFormat:e[0]?.apiFormat??"unknown"}function ij(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 aj(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 lj(e){const t=new Map;for(const r of e){const o=aj(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 Rc(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function cj(e){if(e.responseText===null)return null;try{let t=JSON.parse(e.responseText);return typeof t=="string"&&(t=JSON.parse(t)),Rc(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&&Rc(t.choices[0])&&typeof t.choices[0].finish_reason=="string"&&t.choices[0].finish_reason==="stop"?"stop":null:null}catch{return null}}function Yh(e){return e==="end_turn"||e==="stop"}function kt({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 gn=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"})]}),Xh=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 Qh({className:e}){return a.jsx(kt,{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:gn,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 uj({className:e}){return a.jsx(kt,{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:Xh,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 dj({className:e}){return a.jsx(kt,{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:gn,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 fj({className:e}){return a.jsx(kt,{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 pj({className:e}){return a.jsx(kt,{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:gn,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 hj({className:e}){return a.jsx(kt,{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:gn,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 mj({className:e}){return a.jsx(kt,{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:Xh,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 gj({className:e}){return a.jsx(kt,{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:gn,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 xj({className:e}){return a.jsx(kt,{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:gn,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 yj({className:e}){return a.jsx(kt,{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:gn,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 bj({className:e}){return a.jsx(kt,{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:gn,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 vj({className:e}){return a.jsx(kt,{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 Lr=[Qh,uj,dj,fj,pj,hj,mj,gj,xj,yj,bj,vj];function Wo(e){return Lr[Math.abs(e)%Lr.length]??Qh}function wj(e){const t=Lr.length-2;return t<=0?0:1+((Number.isFinite(e)?Math.trunc(e):0)%t+t)%t}function kj(e){return Wo(wj(e))}const _j="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",Sj="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",Cj="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",jj="/assets/minimax-BPMzvuL-.jpeg",Ej="/assets/alibaba-TTwafVwX.svg",Nj="/assets/qwen-CONDcHqt.png",Tj="/assets/zhipuai-BPNAnxo-.svg",Aj={"claude-":"anthropic","gpt-":"openai","o1-":"openai","o3-":"openai","deepseek-":"deepseek",MiniMax:"minimax",qwen:"qwen","glm-":"zhipuai"};function em(e){if(e===null)return"unknown";const t=e.toLowerCase();for(const[n,r]of Object.entries(Aj))if(t.startsWith(n.toLowerCase()))return r;return"unknown"}const In={width:24,height:24,objectFit:"contain"},Ij=lt.memo(({className:e})=>a.jsx("img",{src:_j,alt:"Anthropic",className:e,style:In})),zj=lt.memo(({className:e})=>a.jsx("img",{src:Sj,alt:"OpenAI",className:e,style:{...In,background:"white",borderRadius:"4px"}})),Rj=lt.memo(({className:e})=>a.jsx("img",{src:Cj,alt:"DeepSeek",className:e,style:In})),Pj=lt.memo(({className:e})=>a.jsx("img",{src:jj,alt:"MiniMax",className:e,style:In})),Oj=lt.memo(({className:e})=>a.jsx("img",{src:Ej,alt:"Alibaba",className:e,style:In})),Mj=lt.memo(({className:e})=>a.jsx("img",{src:Nj,alt:"Qwen",className:e,style:In})),Lj=lt.memo(({className:e})=>a.jsx("img",{src:Tj,alt:"ZhipuAI",className:e,style:In}));function tm({provider:e,className:t}){switch(e){case"anthropic":return a.jsx(Ij,{className:t});case"openai":return a.jsx(zj,{className:t});case"deepseek":return a.jsx(Rj,{className:t});case"minimax":return a.jsx(Pj,{className:t});case"alibaba":return a.jsx(Oj,{className:t});case"qwen":return a.jsx(Mj,{className:t});case"zhipuai":return a.jsx(Lj,{className:t});case"unknown":return null}}function et({delayDuration:e=0,...t}){return a.jsx(Z5,{"data-slot":"tooltip-provider",delayDuration:e,...t})}function De({...e}){return a.jsx(q5,{"data-slot":"tooltip",...e})}function Fe({...e}){return a.jsx(K5,{"data-slot":"tooltip-trigger",...e})}function $e({className:e,sideOffset:t=0,children:n,...r}){return a.jsx(J5,{children:a.jsxs(G5,{"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(Y5,{className:"bg-foreground fill-foreground z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px]"})]})})}function rl(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function Oe(e,t){return e===null||typeof e!="object"||Array.isArray(e)?void 0:Object.getOwnPropertyDescriptor(e,t)?.value}const Dj="x-anthropic-billing-header:";function Fj(e){return e.trimStart().toLowerCase().startsWith(Dj)}function $j(e){return rl(e)?Object.prototype.hasOwnProperty.call(e,"system"):!1}function Bj(e){if(!rl(e))return!1;const t=Oe(e,"type"),n=Oe(e,"text");return typeof t!="string"||t!=="text"||typeof n!="string"?!1:Fj(n)}function Uj(e){let t;try{t=JSON.parse(e)}catch{return{body:e,removed:0}}if(!$j(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(Bj(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 Wj(e){return{depth:Number.POSITIVE_INFINITY}}function nm(e){try{const t=JSON.parse(e);return{kind:"json",data:Vo(t)}}catch{return{kind:"text"}}}function qs(e){const t=y.useMemo(()=>e===null?null:nm(e),[e]),n=t?.kind==="json"?t.data:null,r=y.useMemo(()=>n===null?null:Wj(),[n]),[o,s]=y.useState(!1),[i,l]=y.useState(0),[c,u]=y.useState(0),[d,f]=y.useTransition(),h=y.useCallback(()=>{const p=!o,x=p&&r!==null?r.depth:0;f(()=>{s(p),l(x),u(m=>m+1)})},[o,r]);return{parsedData:n,policy:r,isExpanded:o,toggle:h,isPending:d,bulkDepth:i,bulkRevision:c}}function Vo(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=>Vo(n));const t={};for(const n of Object.keys(e)){const r=Object.getOwnPropertyDescriptor(e,n);t[n]=Vo(r?.value)}return t}case"bigint":case"symbol":case"function":case"undefined":return String(e)}return null}function rm({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 Vj=Ta("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 om({className:e,variant:t="default",...n}){return a.jsx(N5,{"data-slot":"tabs-list","data-variant":t,className:ve(Vj({variant:t}),e),...n})}function Ct({className:e,...t}){return a.jsx(T5,{"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 jt({className:e,...t}){return a.jsx(A5,{"data-slot":"tabs-content",className:ve("flex-1 outline-none",e),...t})}function vn(e){const[t,n]=y.useState(!1),r=y.useRef(null);y.useEffect(()=>()=>{r.current!==null&&clearTimeout(r.current)},[]);const o=y.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 Hj=y.lazy(()=>Nn(()=>import("./CompareDrawer-CicCP3Hb.js"),__vite__mapDeps([0,1])).then(e=>({default:e.CompareDrawer}))),Zj=y.lazy(()=>Nn(()=>import("./ReplayDialog-Bc8q3ujm.js"),__vite__mapDeps([2,1,3])).then(e=>({default:e.ReplayDialog}))),qj=y.lazy(()=>Nn(()=>import("./RequestAnatomy-Coyy3zcH.js"),__vite__mapDeps([4,1])).then(e=>({default:e.RequestAnatomy}))),Kj=y.lazy(()=>Nn(()=>import("./ResponseView-BWJzgh0c.js"),__vite__mapDeps([3,1])).then(e=>({default:e.ResponseView}))),Jj=y.lazy(()=>Nn(()=>import("./StreamingChunkSequence-BSC3uuE5.js"),__vite__mapDeps([5,1])).then(e=>({default:e.StreamingChunkSequence}))),Pc=y.lazy(()=>Nn(()=>Promise.resolve().then(()=>Ym),void 0).then(e=>({default:e.JsonViewer}))),Gj=y.lazy(()=>Nn(()=>Promise.resolve().then(()=>Ym),void 0).then(e=>({default:e.JsonViewerFromString}))),Yj=1200,Xj=12;function Qj(e){const{containerRef:t,setExpandToPath:n,ensureTabActive:r,highlightMs:o}=e,s=y.useRef(null);return y.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??Yj)},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(Xj))},[t,r,o,n])}class sm{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 x=this.extractCommon(p[0],n,t,0,r);if(p[0].oldPos+1>=c&&x+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 N=S&&S.oldPos+1<c;if(!j&&!N){p[v]=void 0;continue}if(!N||j&&S.oldPos<C.oldPos?k=this.addToPath(C,!0,!1,0,r):k=this.addToPath(S,!1,!0,1,r),x=this.extractCommon(k,n,t,v,r),k.oldPos+1>=c&&x+1>=l)return i(this.buildValues(k.lastComponent,n,t))||!0;p[v]=k,k.oldPos+1>=c&&(g=Math.min(g,v-1)),x+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 x=r[u+p];return x.length>h.length?x: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 eE extends sm{constructor(){super(...arguments),this.tokenize=am}equals(t,n,r){return r.ignoreWhitespace?((!r.newlineIsToken||!t.includes(`
|
|
86
|
-
`))&&(t=t.trim()),(!r.newlineIsToken||!n.includes(`
|
|
87
|
-
`))&&(n=n.trim())):r.ignoreNewlineAtEof&&!r.newlineIsToken&&(t.endsWith(`
|
|
88
|
-
`)&&(t=t.slice(0,-1)),n.endsWith(`
|
|
89
|
-
`)&&(n=n.slice(0,-1))),super.equals(t,n,r)}}const tE=new eE;function im(e,t,n){return tE.diff(e,t,n)}function am(e,t){t.stripTrailingCr&&(e=e.replace(/\r\n/g,`
|
|
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 nE extends sm{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(Ui(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 rE=new nE;function oE(e,t,n){return rE.diff(e,t,n)}function Ui(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]=Ui(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]=Ui(e[c],t,n,r,c);t.pop(),n.pop()}else i=e;return i}function Oc(e){return e===void 0?[]:Object.entries(e).map(t=>[t[0].toLowerCase(),t[1]]).sort(([t],[n])=>t.localeCompare(n))}function Mc([e,t]){return`${e}: ${t}`}function Wi(e){const t=[];let n=0,r=0;for(const o of e){const s=o.value.split(`
|
|
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 sE(e,t){const n=Oc(e).map(Mc).join(`
|
|
92
|
-
`),r=Oc(t).map(Mc).join(`
|
|
93
|
-
`);if(n===r)return{lines:[],isEmpty:!0};const o=im(n,r);return{lines:Wi(o),isEmpty:!1}}function Lc(e){try{const t=JSON.parse(e);return t===null||typeof t=="string"||typeof t=="object"?t:null}catch{return null}}function iE(e,t){const n=e??"",r=t??"";if(n===r)return{lines:[],isEmpty:!0};const o=Lc(n),s=Lc(r);if(o!==null&&s!==null){const l=oE(o,s)??[];if(l.length===1){const c=l[0];if(c!==void 0&&!c.added&&!c.removed)return{lines:[],isEmpty:!0}}return{lines:Wi(l),isEmpty:!1}}const i=im(n,r);return{lines:Wi(i),isEmpty:!1}}function aE(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 Ln(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 Dc(e,t){if(e===void 0)throw new Error("Unexpected undefined");return e}const Fc=(e,t)=>Math.abs(e-t)<1.01,lE=(e,t,n)=>{let r;return function(...o){e.clearTimeout(r),r=e.setTimeout(()=>t.apply(this,o),n)}};let mr;const $c=()=>{if(mr!==void 0)return mr;if(typeof navigator>"u")return mr=!1;if(/iP(hone|od|ad)/.test(navigator.userAgent))return mr=!0;const e=navigator.maxTouchPoints;return mr=navigator.platform==="MacIntel"&&e!==void 0&&e>0},Bc=e=>{const{offsetWidth:t,offsetHeight:n}=e;return{width:t,height:n}},cE=e=>e,uE=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},dE=(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(Bc(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(Bc(n))};e.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(l):l()});return s.observe(n,{box:"border-box"}),()=>{s.unobserve(n)}},Dr={passive:!0},fE=(e,t)=>{const n=e.scrollElement;if(!n)return;const r=()=>{t({width:n.innerWidth,height:n.innerHeight})};return r(),n.addEventListener("resize",r,Dr),()=>{n.removeEventListener("resize",r)}},pE=typeof window>"u"?!0:"onscrollend"in window,lm=(e,t,n)=>{const r=e.scrollElement;if(!r)return;const o=e.targetWindow;if(!o)return;const s=e.options.useScrollendEvent&&pE;let i=0;const l=s?null:lE(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,Dr),s&&r.addEventListener("scrollend",d,Dr),()=>{r.removeEventListener("scroll",u),s&&r.removeEventListener("scrollend",d)}},hE=(e,t)=>lm(e,t,n=>{const{horizontal:r,isRtl:o}=e.options;return r?n.scrollLeft*(o&&-1||1):n.scrollTop}),mE=(e,t)=>lm(e,t,n=>e.options.horizontal?n.scrollX:n.scrollY),gE=(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"]},cm=(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})},xE=cm,yE=cm;class bE{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:cE,rangeExtractor:uE,onChange:()=>{},measureElement:gE,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=Ln(()=>(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,!(!$c()||this.targetWindow==null)&&(this._iosJustTouchEnded=!0,this._iosTouchEndTimerId=this.targetWindow.setTimeout(()=>{this._iosJustTouchEnded=!1,this._iosTouchEndTimerId=null,this._flushIosDeferredIfReady()},150))};s.addEventListener("touchstart",i,Dr),s.addEventListener("touchend",l,Dr),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();Fc(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=Ln(()=>[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=Ln(()=>[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 x of this.laneAssignments.keys())x>=n&&this.laneAssignments.delete(x);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(x=>{this.itemSizeCache.set(x.key,x.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 x=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]+x}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+x}const v=aE(n,g,s);return this.measurementsCache=v,v}const h=this.measurementsCache.slice(0,f),p=new Array(l).fill(void 0);for(let x=0;x<f;x++){const m=h[x];m&&(p[m.lane]=x)}for(let x=f;x<n;x++){const m=s(x),g=this.laneAssignments.get(x);let b,v;const k=c==="estimate"||d.has(m);if(g!==void 0&&this.options.lanes>1){b=g;const N=p[b],T=N!==void 0?h[N]:void 0;v=T?T.end+this.options.gap:r+o}else{const N=this.options.lanes===1?h[x-1]:this.getFurthestMeasurement(h,x);v=N?N.end+this.options.gap:r+o,b=N?N.lane:x%this.options.lanes,this.options.lanes>1&&k&&this.laneAssignments.set(x,b)}const S=d.get(m),C=typeof S=="number"?S:this.options.estimateSize(x),j=v+C;h[x]={index:x,start:v,size:C,end:j,key:m,lane:b},p[b]=x}return this.measurementsCache=h,h},{key:!1,debug:()=>this.options.debug}),this.calculateRange=Ln(()=>[this.getMeasurements(),this.getSize(),this.getScrollOffset(),this.options.lanes],(n,r,o,s)=>this.range=n.length>0&&r>0?vE({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=Ln(()=>{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,x=((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):x&&this.applyScrollAdjustment(f),this.notify(!1)}},this.getVirtualItems=Ln(()=>[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=um(0,r.length-1,s?l=>o[l*2]:l=>Dc(r[l]).start,n);return Dc(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&&($c()&&(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&&Fc(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 um=(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 vE({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=um(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 Uc=typeof document<"u"?y.useLayoutEffect:y.useEffect;function dm({useFlushSync:e=!0,...t}){const n=y.useReducer(s=>s+1,0)[1],r={...t,onChange:(s,i)=>{var l;e&&i?Br.flushSync(n):n(),(l=t.onChange)==null||l.call(t,s,i)}},[o]=y.useState(()=>new bE(r));return o.setOptions(r),Uc(()=>o._didMount(),[]),Uc(()=>o._willUpdate()),o}function wE(e){return dm({observeElementRect:dE,observeElementOffset:hE,scrollToFn:yE,...e})}function kE(e){return dm({getScrollElement:()=>typeof document<"u"?window:null,observeElementRect:fE,observeElementOffset:mE,scrollToFn:xE,initialOffset:()=>typeof document<"u"?window.scrollY:0,...e})}const _E=22,Ks=1e4;function SE(e){return e==="added"?"+":e==="removed"?"-":" "}function CE(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 jE=function({result:t,emptyLabel:n}){const[r,o]=y.useState("unified"),s=y.useRef(null),i=wE({count:t.lines.length,getScrollElement:()=>s.current,estimateSize:()=>_E,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>Ks,u=c?t.lines.slice(0,Ks):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 ${Ks.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(Sw,{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(Mv,{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(EE,{virtualizer:i,lines:u}):a.jsx(AE,{lines:u})})]})};function EE({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",CE(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:SE(r.kind)}),a.jsx("span",{className:"whitespace-pre-wrap break-all flex-1",children:r.text})]},n.key)})})}function NE(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 AE({lines:e}){const t=NE(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 fm=y.memo(jE),IE={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 Js(e){return e<1e3?`${e}ms`:`${(e/1e3).toFixed(1)}s`}function Wc({trend:e}){if(e===null)return null;const t=e.direction==="up",n=t?dv:sv,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 zE=y.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=rk(e.responseStatus),h=e.elapsedMs!==null&&u>0&&e.elapsedMs>u*1e3,p=e.inputTokens!==null||e.outputTokens!==null;return a.jsx(et,{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:x=>{(x.key==="Enter"||x.key===" ")&&(x.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(cn,{className:"size-3"}),a.jsx("span",{className:"font-mono tabular-nums",title:e.timestamp,children:ji(e.timestamp,d)})]}),e.model!==null&&a.jsxs(De,{children:[a.jsx(Fe,{asChild:!0,children:a.jsx("span",{className:"shrink-0",children:a.jsx(tm,{provider:em(e.model),className:"size-4"})})}),a.jsx($e,{children:e.model})]}),f!=="success"&&a.jsxs(Et,{variant:"outline",className:ve("text-[10px] px-1.5 py-0 h-5 font-mono tabular-nums gap-1",IE[f]),children:[f==="server_error"?a.jsx(hw,{className:"size-3","aria-label":"Server error"}):f==="client_error"?a.jsx(Io,{className:"size-3","aria-label":"Client error"}):f==="pending"?a.jsx(Rr,{className:"size-3 animate-spin","aria-label":"Pending"}):null,e.responseStatus]}),e.elapsedMs!==null&&a.jsxs(De,{children:[a.jsx(Fe,{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(cn,{className:"size-3"}),a.jsx("span",{className:"font-mono tabular-nums",children:Js(e.elapsedMs)}),h&&a.jsx(Io,{className:"size-3","aria-label":"Slow response"})]})}),a.jsx($e,{children:h?`Slow response: ${Js(e.elapsedMs)} exceeds ${Js(u*1e3)}`:"Elapsed response time"})]}),p&&a.jsxs("span",{className:"flex items-center gap-1 text-xs shrink-0",children:[a.jsx(Pr,{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(Wc,{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(Wc,{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(ss,{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(Wr,{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(df,{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(De,{children:[a.jsx(Fe,{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(Jv,{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($e,{children:e.clientCwd!==null?`PID: ${e.clientPid??"?"} CWD: ${e.clientCwd}`:`Process ID: ${e.clientPid??"?"}`})]}),e.streaming&&a.jsxs(De,{children:[a.jsx(Fe,{asChild:!0,children:a.jsx(yw,{className:"size-3 text-muted-foreground/60 shrink-0"})}),a.jsx($e,{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:x=>x.stopPropagation(),onKeyDown:x=>x.stopPropagation(),children:[l!==void 0&&i!==void 0&&(()=>{const x=l[i];return x===void 0?null:a.jsxs(a.Fragment,{children:[x.expansion!==null&&a.jsxs(De,{children:[a.jsx(Fe,{asChild:!0,children:a.jsx(Re,{variant:"outline",size:"icon",className:"size-8",onClick:x.expansion.onToggle,disabled:x.expansion.isPending,"aria-pressed":x.expansion.isExpanded,"aria-label":x.expansion.isExpanded?"Collapse all JSON":"Expand all JSON",children:x.expansion.isExpanded?a.jsx(kv,{className:"size-3.5"}):a.jsx(lf,{className:"size-3.5"})})}),a.jsx($e,{children:x.expansion.isExpanded?"Collapse all JSON nodes":"Expand all JSON nodes"})]}),x.diffWithRaw!==void 0&&a.jsxs(De,{children:[a.jsx(Fe,{asChild:!0,children:a.jsx(Re,{variant:"outline",size:"icon",className:ve("size-8",x.diffWithRaw.active&&"bg-accent text-accent-foreground"),onClick:x.diffWithRaw.onToggle,"aria-pressed":x.diffWithRaw.active,"aria-label":x.diffWithRaw.active?"Hide raw diff":"Diff with raw",children:a.jsx(Hv,{className:"size-3.5"})})}),a.jsx($e,{children:x.diffWithRaw.active?"Hide diff with raw request":"Show diff between displayed and raw request body"})]}),x.diffWithPrevious!==void 0&&a.jsxs(De,{children:[a.jsx(Fe,{asChild:!0,children:a.jsx(Re,{variant:"outline",size:"icon",className:"size-8",onClick:x.diffWithPrevious,"aria-label":"Diff with previous",children:a.jsx(ow,{className:"size-3.5"})})}),a.jsx($e,{children:"Compare this request with the immediately preceding one"})]}),x.copyText!==null&&a.jsxs(De,{children:[a.jsx(Fe,{asChild:!0,children:a.jsx(Re,{variant:"outline",size:"icon",className:"size-8",onClick:x.onCopy,"aria-label":x.copyCopied?"Copied":x.copyLabel,children:x.copyCopied?a.jsx(it,{className:"size-3.5 text-emerald-500"}):a.jsx(Wt,{className:"size-3.5"})})}),a.jsx($e,{children:x.copyCopied?"Copied to clipboard":x.copyLabel})]})]})})(),c!==void 0&&a.jsxs(De,{children:[a.jsx(Fe,{asChild:!0,children:a.jsx(Re,{variant:"outline",size:"icon",className:"size-8",onClick:c,"aria-label":"Replay request",children:a.jsx(ww,{className:"size-3.5"})})}),a.jsx($e,{children:"Re-send this request to the provider"})]})]}),r?a.jsx(Ut,{className:"size-4 text-muted-foreground shrink-0"}):a.jsx(en,{className:"size-4 text-muted-foreground shrink-0"})]})})});function RE({...e}){return a.jsx(Ik,{"data-slot":"collapsible",...e})}function kP({...e}){return a.jsx(Ff,{"data-slot":"collapsible-trigger",...e})}function PE({...e}){return a.jsx($f,{"data-slot":"collapsible-content",...e})}function OE(e,t){const n={};return(e[e.length-1]===""?[...e,""]:e).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const ME=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,LE=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,DE={};function Vc(e,t){return(DE.jsx?LE:ME).test(e)}const FE=/[ \t\n\f\r]/g;function $E(e){return typeof e=="object"?e.type==="text"?Hc(e.value):!1:Hc(e)}function Hc(e){return e.replace(FE,"")===""}class qr{constructor(t,n,r){this.normal=n,this.property=t,r&&(this.space=r)}}qr.prototype.normal={};qr.prototype.property={};qr.prototype.space=void 0;function pm(e,t){const n={},r={};for(const o of e)Object.assign(n,o.property),Object.assign(r,o.normal);return new qr(n,r,t)}function Vi(e){return e.toLowerCase()}class dt{constructor(t,n){this.attribute=n,this.property=t}}dt.prototype.attribute="";dt.prototype.booleanish=!1;dt.prototype.boolean=!1;dt.prototype.commaOrSpaceSeparated=!1;dt.prototype.commaSeparated=!1;dt.prototype.defined=!1;dt.prototype.mustUseProperty=!1;dt.prototype.number=!1;dt.prototype.overloadedBoolean=!1;dt.prototype.property="";dt.prototype.spaceSeparated=!1;dt.prototype.space=void 0;let BE=0;const Ne=zn(),Ye=zn(),Hi=zn(),ce=zn(),Ue=zn(),Kn=zn(),pt=zn();function zn(){return 2**++BE}const Zi=Object.freeze(Object.defineProperty({__proto__:null,boolean:Ne,booleanish:Ye,commaOrSpaceSeparated:pt,commaSeparated:Kn,number:ce,overloadedBoolean:Hi,spaceSeparated:Ue},Symbol.toStringTag,{value:"Module"})),Gs=Object.keys(Zi);class ol extends dt{constructor(t,n,r,o){let s=-1;if(super(t,n),Zc(this,"space",o),typeof r=="number")for(;++s<Gs.length;){const i=Gs[s];Zc(this,Gs[s],(r&Zi[i])===Zi[i])}}}ol.prototype.defined=!0;function Zc(e,t,n){n&&(e[t]=n)}function ur(e){const t={},n={};for(const[r,o]of Object.entries(e.properties)){const s=new ol(r,e.transform(e.attributes||{},r),o,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(s.mustUseProperty=!0),t[r]=s,n[Vi(r)]=r,n[Vi(s.attribute)]=r}return new qr(t,n,e.space)}const hm=ur({properties:{ariaActiveDescendant:null,ariaAtomic:Ye,ariaAutoComplete:null,ariaBusy:Ye,ariaChecked:Ye,ariaColCount:ce,ariaColIndex:ce,ariaColSpan:ce,ariaControls:Ue,ariaCurrent:null,ariaDescribedBy:Ue,ariaDetails:null,ariaDisabled:Ye,ariaDropEffect:Ue,ariaErrorMessage:null,ariaExpanded:Ye,ariaFlowTo:Ue,ariaGrabbed:Ye,ariaHasPopup:null,ariaHidden:Ye,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:Ue,ariaLevel:ce,ariaLive:null,ariaModal:Ye,ariaMultiLine:Ye,ariaMultiSelectable:Ye,ariaOrientation:null,ariaOwns:Ue,ariaPlaceholder:null,ariaPosInSet:ce,ariaPressed:Ye,ariaReadOnly:Ye,ariaRelevant:null,ariaRequired:Ye,ariaRoleDescription:Ue,ariaRowCount:ce,ariaRowIndex:ce,ariaRowSpan:ce,ariaSelected:Ye,ariaSetSize:ce,ariaSort:null,ariaValueMax:ce,ariaValueMin:ce,ariaValueNow:ce,ariaValueText:null,role:null},transform(e,t){return t==="role"?t:"aria-"+t.slice(4).toLowerCase()}});function mm(e,t){return t in e?e[t]:t}function gm(e,t){return mm(e,t.toLowerCase())}const UE=ur({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:Kn,acceptCharset:Ue,accessKey:Ue,action:null,allow:null,allowFullScreen:Ne,allowPaymentRequest:Ne,allowUserMedia:Ne,alt:null,as:null,async:Ne,autoCapitalize:null,autoComplete:Ue,autoFocus:Ne,autoPlay:Ne,blocking:Ue,capture:null,charSet:null,checked:Ne,cite:null,className:Ue,cols:ce,colSpan:null,content:null,contentEditable:Ye,controls:Ne,controlsList:Ue,coords:ce|Kn,crossOrigin:null,data:null,dateTime:null,decoding:null,default:Ne,defer:Ne,dir:null,dirName:null,disabled:Ne,download:Hi,draggable:Ye,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:Ne,formTarget:null,headers:Ue,height:ce,hidden:Hi,high:ce,href:null,hrefLang:null,htmlFor:Ue,httpEquiv:Ue,id:null,imageSizes:null,imageSrcSet:null,inert:Ne,inputMode:null,integrity:null,is:null,isMap:Ne,itemId:null,itemProp:Ue,itemRef:Ue,itemScope:Ne,itemType:Ue,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:Ne,low:ce,manifest:null,max:null,maxLength:ce,media:null,method:null,min:null,minLength:ce,multiple:Ne,muted:Ne,name:null,nonce:null,noModule:Ne,noValidate:Ne,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:Ne,optimum:ce,pattern:null,ping:Ue,placeholder:null,playsInline:Ne,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:Ne,referrerPolicy:null,rel:Ue,required:Ne,reversed:Ne,rows:ce,rowSpan:ce,sandbox:Ue,scope:null,scoped:Ne,seamless:Ne,selected:Ne,shadowRootClonable:Ne,shadowRootDelegatesFocus:Ne,shadowRootMode:null,shape:null,size:ce,sizes:null,slot:null,span:ce,spellCheck:Ye,src:null,srcDoc:null,srcLang:null,srcSet:null,start:ce,step:null,style:null,tabIndex:ce,target:null,title:null,translate:null,type:null,typeMustMatch:Ne,useMap:null,value:Ye,width:ce,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:Ue,axis:null,background:null,bgColor:null,border:ce,borderColor:null,bottomMargin:ce,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:Ne,declare:Ne,event:null,face:null,frame:null,frameBorder:null,hSpace:ce,leftMargin:ce,link:null,longDesc:null,lowSrc:null,marginHeight:ce,marginWidth:ce,noResize:Ne,noHref:Ne,noShade:Ne,noWrap:Ne,object:null,profile:null,prompt:null,rev:null,rightMargin:ce,rules:null,scheme:null,scrolling:Ye,standby:null,summary:null,text:null,topMargin:ce,valueType:null,version:null,vAlign:null,vLink:null,vSpace:ce,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:Ne,disableRemotePlayback:Ne,prefix:null,property:null,results:ce,security:null,unselectable:null},space:"html",transform:gm}),WE=ur({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:pt,accentHeight:ce,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:ce,amplitude:ce,arabicForm:null,ascent:ce,attributeName:null,attributeType:null,azimuth:ce,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:ce,by:null,calcMode:null,capHeight:ce,className:Ue,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:ce,diffuseConstant:ce,direction:null,display:null,dur:null,divisor:ce,dominantBaseline:null,download:Ne,dx:null,dy:null,edgeMode:null,editable:null,elevation:ce,enableBackground:null,end:null,event:null,exponent:ce,externalResourcesRequired:null,fill:null,fillOpacity:ce,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:Kn,g2:Kn,glyphName:Kn,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:ce,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:ce,horizOriginX:ce,horizOriginY:ce,id:null,ideographic:ce,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:ce,k:ce,k1:ce,k2:ce,k3:ce,k4:ce,kernelMatrix:pt,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:ce,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:ce,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:ce,overlineThickness:ce,paintOrder:null,panose1:null,path:null,pathLength:ce,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:Ue,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:ce,pointsAtY:ce,pointsAtZ:ce,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:pt,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:pt,rev:pt,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:pt,requiredFeatures:pt,requiredFonts:pt,requiredFormats:pt,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:ce,specularExponent:ce,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:ce,strikethroughThickness:ce,string:null,stroke:null,strokeDashArray:pt,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:ce,strokeOpacity:ce,strokeWidth:null,style:null,surfaceScale:ce,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:pt,tabIndex:ce,tableValues:null,target:null,targetX:ce,targetY:ce,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:pt,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:ce,underlineThickness:ce,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:ce,values:null,vAlphabetic:ce,vMathematical:ce,vectorEffect:null,vHanging:ce,vIdeographic:ce,version:null,vertAdvY:ce,vertOriginX:ce,vertOriginY:ce,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:ce,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:mm}),xm=ur({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()}}),ym=ur({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:gm}),bm=ur({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,t){return"xml:"+t.slice(3).toLowerCase()}}),VE={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"},HE=/[A-Z]/g,qc=/-[a-z]/g,ZE=/^data[-\w.:]+$/i;function qE(e,t){const n=Vi(t);let r=t,o=dt;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)==="data"&&ZE.test(t)){if(t.charAt(4)==="-"){const s=t.slice(5).replace(qc,JE);r="data"+s.charAt(0).toUpperCase()+s.slice(1)}else{const s=t.slice(4);if(!qc.test(s)){let i=s.replace(HE,KE);i.charAt(0)!=="-"&&(i="-"+i),t="data"+i}}o=ol}return new o(r,t)}function KE(e){return"-"+e.toLowerCase()}function JE(e){return e.charAt(1).toUpperCase()}const GE=pm([hm,UE,xm,ym,bm],"html"),sl=pm([hm,WE,xm,ym,bm],"svg");function YE(e){return e.join(" ").trim()}var Dn={},Ys,Kc;function XE(){if(Kc)return Ys;Kc=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 x(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 M=w.match(t);M&&(v+=M.length);var U=w.lastIndexOf(c);k=~U?w.length-U:k+w.length}function C(){var w={line:v,column:k};return function(M){return M.position=new j(w),A(),M}}function j(w){this.start=w,this.end={line:v,column:k},this.source=b.source}j.prototype.content=g;function N(w){var M=new Error(b.source+":"+v+":"+k+": "+w);if(M.reason=w,M.filename=b.source,M.line=v,M.column=k,M.source=g,!b.silent)throw M}function T(w){var M=w.exec(g);if(M){var U=M[0];return S(U),g=g.slice(U.length),M}}function A(){T(n)}function O(w){var M;for(w=w||[];M=$();)M!==!1&&w.push(M);return w}function $(){var w=C();if(!(u!=g.charAt(0)||d!=g.charAt(1))){for(var M=2;f!=g.charAt(M)&&(d!=g.charAt(M)||u!=g.charAt(M+1));)++M;if(M+=2,f===g.charAt(M-1))return N("End of comment missing");var U=g.slice(2,M-2);return k+=2,S(U),g=g.slice(M),k+=2,w({type:h,comment:U})}}function E(){var w=C(),M=T(r);if(M){if($(),!T(o))return N("property missing ':'");var U=T(s),F=w({type:p,property:m(M[0].replace(e,f)),value:U?m(U[0].replace(e,f)):f});return T(i),F}}function L(){var w=[];O(w);for(var M;M=E();)M!==!1&&(w.push(M),O(w));return w}return A(),L()}function m(g){return g?g.replace(l,f):f}return Ys=x,Ys}var Jc;function QE(){if(Jc)return Dn;Jc=1;var e=Dn&&Dn.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(Dn,"__esModule",{value:!0}),Dn.default=n;const t=e(XE());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 Dn}var gr={},Gc;function eN(){if(Gc)return gr;Gc=1,Object.defineProperty(gr,"__esModule",{value:!0}),gr.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 gr.camelCase=c,gr}var xr,Yc;function tN(){if(Yc)return xr;Yc=1;var e=xr&&xr.__importDefault||function(o){return o&&o.__esModule?o:{default:o}},t=e(QE()),n=eN();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,xr=r,xr}var nN=tN();const rN=da(nN),vm=wm("end"),il=wm("start");function wm(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 oN(e){const t=il(e),n=vm(e);if(t&&n)return{start:t,end:n}}function jr(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?Xc(e.position):"start"in e||"end"in e?Xc(e):"line"in e||"column"in e?qi(e):""}function qi(e){return Qc(e&&e.line)+":"+Qc(e&&e.column)}function Xc(e){return qi(e&&e.start)+"-"+qi(e&&e.end)}function Qc(e){return e&&typeof e=="number"?e:1}class rt 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=jr(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}}rt.prototype.file="";rt.prototype.name="";rt.prototype.reason="";rt.prototype.message="";rt.prototype.stack="";rt.prototype.column=void 0;rt.prototype.line=void 0;rt.prototype.ancestors=void 0;rt.prototype.cause=void 0;rt.prototype.fatal=void 0;rt.prototype.place=void 0;rt.prototype.ruleId=void 0;rt.prototype.source=void 0;const al={}.hasOwnProperty,sN=new Map,iN=/[A-Z]/g,aN=new Set(["table","tbody","thead","tfoot","tr"]),lN=new Set(["td","th"]),km="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function cN(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=xN(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=gN(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"?sl:GE,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},s=_m(o,e,void 0);return s&&typeof s!="string"?s:o.create(e,o.Fragment,{children:s||void 0},void 0)}function _m(e,t,n){if(t.type==="element")return uN(e,t,n);if(t.type==="mdxFlowExpression"||t.type==="mdxTextExpression")return dN(e,t);if(t.type==="mdxJsxFlowElement"||t.type==="mdxJsxTextElement")return pN(e,t,n);if(t.type==="mdxjsEsm")return fN(e,t);if(t.type==="root")return hN(e,t,n);if(t.type==="text")return mN(e,t)}function uN(e,t,n){const r=e.schema;let o=r;t.tagName.toLowerCase()==="svg"&&r.space==="html"&&(o=sl,e.schema=o),e.ancestors.push(t);const s=Cm(e,t.tagName,!1),i=yN(e,t);let l=cl(e,t);return aN.has(t.tagName)&&(l=l.filter(function(c){return typeof c=="string"?!$E(c):!0})),Sm(e,i,s,t),ll(i,l),e.ancestors.pop(),e.schema=r,e.create(t,s,i,n)}function dN(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)}Fr(e,t.position)}function fN(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);Fr(e,t.position)}function pN(e,t,n){const r=e.schema;let o=r;t.name==="svg"&&r.space==="html"&&(o=sl,e.schema=o),e.ancestors.push(t);const s=t.name===null?e.Fragment:Cm(e,t.name,!0),i=bN(e,t),l=cl(e,t);return Sm(e,i,s,t),ll(i,l),e.ancestors.pop(),e.schema=r,e.create(t,s,i,n)}function hN(e,t,n){const r={};return ll(r,cl(e,t)),e.create(t,e.Fragment,r,n)}function mN(e,t){return t.value}function Sm(e,t,n,r){typeof n!="string"&&n!==e.Fragment&&e.passNode&&(t.node=r)}function ll(e,t){if(t.length>0){const n=t.length>1?t:t[0];n&&(e.children=n)}}function gN(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 xN(e,t){return n;function n(r,o,s,i){const l=Array.isArray(s.children),c=il(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 yN(e,t){const n={};let r,o;for(o in t.properties)if(o!=="children"&&al.call(t.properties,o)){const s=vN(e,o,t.properties[o]);if(s){const[i,l]=s;e.tableCellAlignToStyle&&i==="align"&&typeof l=="string"&&lN.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 bN(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 Fr(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 Fr(e,t.position);else s=r.value===null?!0:r.value;n[o]=s}return n}function cl(e,t){const n=[];let r=-1;const o=e.passKeys?new Map:sN;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=_m(e,s,i);l!==void 0&&n.push(l)}return n}function vN(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?OE(n):YE(n)),r.property==="style"){let o=typeof n=="object"?n:wN(e,String(n));return e.stylePropertyNameCase==="css"&&(o=kN(o)),["style",o]}return[e.elementAttributeNameCase==="react"&&r.space?VE[r.property]||r.property:r.attribute,n]}}function wN(e,t){try{return rN(t,{reactCompat:!0})}catch(n){if(e.ignoreInvalidStyle)return{};const r=n,o=new rt("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=km+"#cannot-parse-style-attribute",o}}function Cm(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=Vc(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=Vc(t)&&!/^[a-z]/.test(t)?{type:"Identifier",name:t}:{type:"Literal",value:t};if(r.type==="Literal"){const o=r.value;return al.call(e.components,o)?e.components[o]:o}if(e.evaluater)return e.evaluater.evaluateExpression(r);Fr(e)}function Fr(e,t){const n=new rt("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=km+"#cannot-handle-mdx-estrees-without-createevaluater",n}function kN(e){const t={};let n;for(n in e)al.call(e,n)&&(t[_N(n)]=e[n]);return t}function _N(e){let t=e.replace(iN,SN);return t.slice(0,3)==="ms-"&&(t="-"+t),t}function SN(e){return"-"+e.toLowerCase()}const Xs={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"]},CN={};function jN(e,t){const n=CN,r=typeof n.includeImageAlt=="boolean"?n.includeImageAlt:!0,o=typeof n.includeHtml=="boolean"?n.includeHtml:!0;return jm(e,r,o)}function jm(e,t,n){if(EN(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 eu(e.children,t,n)}return Array.isArray(e)?eu(e,t,n):""}function eu(e,t,n){const r=[];let o=-1;for(;++o<e.length;)r[o]=jm(e[o],t,n);return r.join("")}function EN(e){return!!(e&&typeof e=="object")}const tu=document.createElement("i");function ul(e){const t="&"+e+";";tu.innerHTML=t;const n=tu.textContent;return n.charCodeAt(n.length-1)===59&&e!=="semi"||n===t?!1:n}function Bt(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 yt(e,t){return e.length>0?(Bt(e,e.length,0,t),e):t}const nu={}.hasOwnProperty;function NN(e){const t={};let n=-1;for(;++n<e.length;)TN(t,e[n]);return t}function TN(e,t){let n;for(n in t){const o=(nu.call(e,n)?e[n]:void 0)||(e[n]={}),s=t[n];let i;if(s)for(i in s){nu.call(o,i)||(o[i]=[]);const l=s[i];AN(o[i],Array.isArray(l)?l:l?[l]:[])}}}function AN(e,t){let n=-1;const r=[];for(;++n<t.length;)(t[n].add==="after"?e:r).push(t[n]);Bt(e,0,0,r)}function Em(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 Jn(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const Mt=xn(/[A-Za-z]/),gt=xn(/[\dA-Za-z]/),IN=xn(/[#-'*+\--9=?A-Z^-~]/);function Ki(e){return e!==null&&(e<32||e===127)}const Ji=xn(/\d/),zN=xn(/[\dA-Fa-f]/),RN=xn(/[!-/:-@[-`{-~]/);function Se(e){return e!==null&&e<-2}function ct(e){return e!==null&&(e<0||e===32)}function Me(e){return e===-2||e===-1||e===32}const PN=xn(new RegExp("\\p{P}|\\p{S}","u")),ON=xn(/\s/);function xn(e){return t;function t(n){return n!==null&&n>-1&&e.test(String.fromCharCode(n))}}function dr(e){const t=[];let n=-1,r=0,o=0;for(;++n<e.length;){const s=e.charCodeAt(n);let i="";if(s===37&>(e.charCodeAt(n+1))&>(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 We(e,t,n,r){const o=r?r-1:Number.POSITIVE_INFINITY;let s=0;return i;function i(c){return Me(c)?(e.enter(n),l(c)):t(c)}function l(c){return Me(c)&&s++<o?(e.consume(c),l):(e.exit(n),t(c))}}const MN={tokenize:LN};function LN(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"),We(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 Se(l)?(e.consume(l),e.exit("chunkText"),s):(e.consume(l),i)}}const DN={tokenize:FN},ru={tokenize:$N};function FN(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 N=S;for(;N<t.events.length;)t.events[N][1].end={...j},N++;return Bt(t.events,C+1,0,t.events.slice(S)),t.events.length=N,u(k)}return l(k)}function u(k){if(r===n.length){if(!o)return h(k);if(o.currentConstruct&&o.currentConstruct.concrete)return x(k);t.interrupt=!!(o.currentConstruct&&!o._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(ru,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,x(k)}function h(k){return t.containerState={},e.attempt(ru,p,x)(k)}function p(k){return r++,n.push([t.currentConstruct,t.containerState]),h(k)}function x(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 Se(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 N=t.events.length;let T=N,A,O;for(;T--;)if(t.events[T][0]==="exit"&&t.events[T][1].type==="chunkFlow"){if(A){O=t.events[T][1].end;break}A=!0}for(b(r),j=N;j<t.events.length;)t.events[j][1].end={...O},j++;Bt(t.events,T+1,0,t.events.slice(N)),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 $N(e,t,n){return We(e,e.attempt(this.parser.constructs.document,t,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function ou(e){if(e===null||ct(e)||ON(e))return 1;if(PN(e))return 2}function dl(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 Gi={name:"attention",resolveAll:BN,tokenize:UN};function BN(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=yt(u,[["enter",e[r][1],t],["exit",e[r][1],t]])),u=yt(u,[["enter",o,t],["enter",i,t],["exit",i,t],["enter",s,t]]),u=yt(u,dl(t.parser.constructs.insideSpan.null,e.slice(r+1,n),t)),u=yt(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=yt(u,[["enter",e[n][1],t],["exit",e[n][1],t]])):d=0,Bt(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 UN(e,t){const n=this.parser.constructs.attentionMarkers.null,r=this.previous,o=ou(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=ou(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 WN={name:"autolink",tokenize:VN};function VN(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 Mt(p)?(e.consume(p),i):p===64?n(p):u(p)}function i(p){return p===43||p===45||p===46||gt(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||gt(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||Ki(p)?n(p):(e.consume(p),c)}function u(p){return p===64?(e.consume(p),d):IN(p)?(e.consume(p),u):n(p)}function d(p){return gt(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||gt(p))&&r++<63){const x=p===45?h:f;return e.consume(p),x}return n(p)}}const Cs={partial:!0,tokenize:HN};function HN(e,t,n){return r;function r(s){return Me(s)?We(e,o,"linePrefix")(s):o(s)}function o(s){return s===null||Se(s)?t(s):n(s)}}const Nm={continuation:{tokenize:qN},exit:KN,name:"blockQuote",tokenize:ZN};function ZN(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 Me(i)?(e.enter("blockQuotePrefixWhitespace"),e.consume(i),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),t):(e.exit("blockQuotePrefix"),t(i))}}function qN(e,t,n){const r=this;return o;function o(i){return Me(i)?We(e,s,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(i):s(i)}function s(i){return e.attempt(Nm,t,n)(i)}}function KN(e){e.exit("blockQuote")}const Tm={name:"characterEscape",tokenize:JN};function JN(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 RN(s)?(e.enter("characterEscapeValue"),e.consume(s),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):n(s)}}const Am={name:"characterReference",tokenize:GN};function GN(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=gt,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=zN,d):(e.enter("characterReferenceValue"),s=7,i=Ji,d(f))}function d(f){if(f===59&&o){const h=e.exit("characterReferenceValue");return i===gt&&!ul(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 iu={partial:!0,tokenize:XN},au={concrete:!0,name:"codeFenced",tokenize:YN};function YN(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 N=r.events[r.events.length-1];return s=N&&N[1].type==="linePrefix"?N[2].sliceSerialize(N[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"),Me(j)?We(e,f,"whitespace")(j):f(j))}function f(j){return j===null||Se(j)?(e.exit("codeFencedFence"),r.interrupt?t(j):e.check(iu,m,S)(j)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),h(j))}function h(j){return j===null||Se(j)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),f(j)):Me(j)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),We(e,p,"whitespace")(j)):j===96&&j===l?n(j):(e.consume(j),h)}function p(j){return j===null||Se(j)?f(j):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),x(j))}function x(j){return j===null||Se(j)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),f(j)):j===96&&j===l?n(j):(e.consume(j),x)}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&&Me(j)?We(e,v,"linePrefix",s+1)(j):v(j)}function v(j){return j===null||Se(j)?e.check(iu,m,S)(j):(e.enter("codeFlowValue"),k(j))}function k(j){return j===null||Se(j)?(e.exit("codeFlowValue"),v(j)):(e.consume(j),k)}function S(j){return e.exit("codeFenced"),t(j)}function C(j,N,T){let A=0;return O;function O(M){return j.enter("lineEnding"),j.consume(M),j.exit("lineEnding"),$}function $(M){return j.enter("codeFencedFence"),Me(M)?We(j,E,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(M):E(M)}function E(M){return M===l?(j.enter("codeFencedFenceSequence"),L(M)):T(M)}function L(M){return M===l?(A++,j.consume(M),L):A>=i?(j.exit("codeFencedFenceSequence"),Me(M)?We(j,w,"whitespace")(M):w(M)):T(M)}function w(M){return M===null||Se(M)?(j.exit("codeFencedFence"),N(M)):T(M)}}}function XN(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 Qs={name:"codeIndented",tokenize:eT},QN={partial:!0,tokenize:tT};function eT(e,t,n){const r=this;return o;function o(u){return e.enter("codeIndented"),We(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):Se(u)?e.attempt(QN,i,c)(u):(e.enter("codeFlowValue"),l(u))}function l(u){return u===null||Se(u)?(e.exit("codeFlowValue"),i(u)):(e.consume(u),l)}function c(u){return e.exit("codeIndented"),t(u)}}function tT(e,t,n){const r=this;return o;function o(i){return r.parser.lazy[r.now().line]?n(i):Se(i)?(e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),o):We(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):Se(i)?o(i):n(i)}}const nT={name:"codeText",previous:oT,resolve:rT,tokenize:sT};function rT(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 oT(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function sT(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)):Se(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||Se(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 iT{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&&yr(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),yr(this.left,t)}unshift(t){this.setCursor(0),this.right.push(t)}unshiftMany(t){this.setCursor(0),yr(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);yr(this.right,n.reverse())}else{const n=this.right.splice(this.left.length+this.right.length-t,Number.POSITIVE_INFINITY);yr(this.left,n.reverse())}}}function yr(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 Im(e){const t={};let n=-1,r,o,s,i,l,c,u;const d=new iT(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,aT(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 Bt(e,0,Number.POSITIVE_INFINITY,d.slice(0)),!u}function aT(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,x=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[x+c[h][0]]=x+c[h][1],x+=c[h][1]-c[h][0]-1;return u}const lT={resolve:uT,tokenize:dT},cT={partial:!0,tokenize:fT};function uT(e){return Im(e),e}function dT(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):Se(l)?e.check(cT,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 fT(e,t,n){const r=this;return o;function o(i){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),We(e,s,"linePrefix")}function s(i){if(i===null||Se(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 zm(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||Ki(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||Se(b)?n(b):(e.consume(b),b===92?x:p)}function x(b){return b===60||b===62||b===92?(e.consume(b),p):p(b)}function m(b){return!d&&(b===null||b===41||ct(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||Ki(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 Rm(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):Se(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||Se(p)||l++>999?(e.exit("chunkString"),d(p)):(e.consume(p),c||(c=!Me(p)),p===92?h:f)}function h(p){return p===91||p===92||p===93?(e.consume(p),l++,f):f(p)}}function Pm(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):Se(h)?(e.enter("lineEnding"),e.consume(h),e.exit("lineEnding"),We(e,u,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),d(h))}function d(h){return h===i||h===null||Se(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 Er(e,t){let n;return r;function r(o){return Se(o)?(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),n=!0,r):Me(o)?We(e,r,n?"linePrefix":"lineSuffix")(o):t(o)}}const pT={name:"definition",tokenize:mT},hT={partial:!0,tokenize:gT};function mT(e,t,n){const r=this;let o;return s;function s(p){return e.enter("definition"),i(p)}function i(p){return Rm.call(r,e,l,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(p)}function l(p){return o=Jn(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 ct(p)?Er(e,u)(p):u(p)}function u(p){return zm(e,d,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(p)}function d(p){return e.attempt(hT,f,f)(p)}function f(p){return Me(p)?We(e,h,"whitespace")(p):h(p)}function h(p){return p===null||Se(p)?(e.exit("definition"),r.parser.defined.push(o),t(p)):n(p)}}function gT(e,t,n){return r;function r(l){return ct(l)?Er(e,o)(l):n(l)}function o(l){return Pm(e,s,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(l)}function s(l){return Me(l)?We(e,i,"whitespace")(l):i(l)}function i(l){return l===null||Se(l)?t(l):n(l)}}const xT={name:"hardBreakEscape",tokenize:yT};function yT(e,t,n){return r;function r(s){return e.enter("hardBreakEscape"),e.consume(s),o}function o(s){return Se(s)?(e.exit("hardBreakEscape"),t(s)):n(s)}}const bT={name:"headingAtx",resolve:vT,tokenize:wT};function vT(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"},Bt(e,r,n-r+1,[["enter",o,t],["enter",s,t],["exit",s,t],["exit",o,t]])),e}function wT(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||ct(d)?(e.exit("atxHeadingSequence"),l(d)):n(d)}function l(d){return d===35?(e.enter("atxHeadingSequence"),c(d)):d===null||Se(d)?(e.exit("atxHeading"),t(d)):Me(d)?We(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||ct(d)?(e.exit("atxHeadingText"),l(d)):(e.consume(d),u)}}const kT=["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"],lu=["pre","script","style","textarea"],_T={concrete:!0,name:"htmlFlow",resolveTo:jT,tokenize:ET},ST={partial:!0,tokenize:TT},CT={partial:!0,tokenize:NT};function jT(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(z){return d(z)}function d(z){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(z),f}function f(z){return z===33?(e.consume(z),h):z===47?(e.consume(z),s=!0,m):z===63?(e.consume(z),o=3,r.interrupt?t:I):Mt(z)?(e.consume(z),i=String.fromCharCode(z),g):n(z)}function h(z){return z===45?(e.consume(z),o=2,p):z===91?(e.consume(z),o=5,l=0,x):Mt(z)?(e.consume(z),o=4,r.interrupt?t:I):n(z)}function p(z){return z===45?(e.consume(z),r.interrupt?t:I):n(z)}function x(z){const se="CDATA[";return z===se.charCodeAt(l++)?(e.consume(z),l===se.length?r.interrupt?t:E:x):n(z)}function m(z){return Mt(z)?(e.consume(z),i=String.fromCharCode(z),g):n(z)}function g(z){if(z===null||z===47||z===62||ct(z)){const se=z===47,re=i.toLowerCase();return!se&&!s&&lu.includes(re)?(o=1,r.interrupt?t(z):E(z)):kT.includes(i.toLowerCase())?(o=6,se?(e.consume(z),b):r.interrupt?t(z):E(z)):(o=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(z):s?v(z):k(z))}return z===45||gt(z)?(e.consume(z),i+=String.fromCharCode(z),g):n(z)}function b(z){return z===62?(e.consume(z),r.interrupt?t:E):n(z)}function v(z){return Me(z)?(e.consume(z),v):O(z)}function k(z){return z===47?(e.consume(z),O):z===58||z===95||Mt(z)?(e.consume(z),S):Me(z)?(e.consume(z),k):O(z)}function S(z){return z===45||z===46||z===58||z===95||gt(z)?(e.consume(z),S):C(z)}function C(z){return z===61?(e.consume(z),j):Me(z)?(e.consume(z),C):k(z)}function j(z){return z===null||z===60||z===61||z===62||z===96?n(z):z===34||z===39?(e.consume(z),c=z,N):Me(z)?(e.consume(z),j):T(z)}function N(z){return z===c?(e.consume(z),c=null,A):z===null||Se(z)?n(z):(e.consume(z),N)}function T(z){return z===null||z===34||z===39||z===47||z===60||z===61||z===62||z===96||ct(z)?C(z):(e.consume(z),T)}function A(z){return z===47||z===62||Me(z)?k(z):n(z)}function O(z){return z===62?(e.consume(z),$):n(z)}function $(z){return z===null||Se(z)?E(z):Me(z)?(e.consume(z),$):n(z)}function E(z){return z===45&&o===2?(e.consume(z),U):z===60&&o===1?(e.consume(z),F):z===62&&o===4?(e.consume(z),H):z===63&&o===3?(e.consume(z),I):z===93&&o===5?(e.consume(z),G):Se(z)&&(o===6||o===7)?(e.exit("htmlFlowData"),e.check(ST,K,L)(z)):z===null||Se(z)?(e.exit("htmlFlowData"),L(z)):(e.consume(z),E)}function L(z){return e.check(CT,w,K)(z)}function w(z){return e.enter("lineEnding"),e.consume(z),e.exit("lineEnding"),M}function M(z){return z===null||Se(z)?L(z):(e.enter("htmlFlowData"),E(z))}function U(z){return z===45?(e.consume(z),I):E(z)}function F(z){return z===47?(e.consume(z),i="",B):E(z)}function B(z){if(z===62){const se=i.toLowerCase();return lu.includes(se)?(e.consume(z),H):E(z)}return Mt(z)&&i.length<8?(e.consume(z),i+=String.fromCharCode(z),B):E(z)}function G(z){return z===93?(e.consume(z),I):E(z)}function I(z){return z===62?(e.consume(z),H):z===45&&o===2?(e.consume(z),I):E(z)}function H(z){return z===null||Se(z)?(e.exit("htmlFlowData"),K(z)):(e.consume(z),H)}function K(z){return e.exit("htmlFlow"),t(z)}}function NT(e,t,n){const r=this;return o;function o(i){return Se(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 TT(e,t,n){return r;function r(o){return e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),e.attempt(Cs,t,n)}}const AT={name:"htmlText",tokenize:IT};function IT(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):Mt(I)?(e.consume(I),T):n(I)}function u(I){return I===45?(e.consume(I),d):I===91?(e.consume(I),s=0,x):Mt(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):Se(I)?(i=f,F(I)):(e.consume(I),f)}function h(I){return I===45?(e.consume(I),p):f(I)}function p(I){return I===62?U(I):I===45?h(I):f(I)}function x(I){const H="CDATA[";return I===H.charCodeAt(s++)?(e.consume(I),s===H.length?m:x):n(I)}function m(I){return I===null?n(I):I===93?(e.consume(I),g):Se(I)?(i=m,F(I)):(e.consume(I),m)}function g(I){return I===93?(e.consume(I),b):m(I)}function b(I){return I===62?U(I):I===93?(e.consume(I),b):m(I)}function v(I){return I===null||I===62?U(I):Se(I)?(i=v,F(I)):(e.consume(I),v)}function k(I){return I===null?n(I):I===63?(e.consume(I),S):Se(I)?(i=k,F(I)):(e.consume(I),k)}function S(I){return I===62?U(I):k(I)}function C(I){return Mt(I)?(e.consume(I),j):n(I)}function j(I){return I===45||gt(I)?(e.consume(I),j):N(I)}function N(I){return Se(I)?(i=N,F(I)):Me(I)?(e.consume(I),N):U(I)}function T(I){return I===45||gt(I)?(e.consume(I),T):I===47||I===62||ct(I)?A(I):n(I)}function A(I){return I===47?(e.consume(I),U):I===58||I===95||Mt(I)?(e.consume(I),O):Se(I)?(i=A,F(I)):Me(I)?(e.consume(I),A):U(I)}function O(I){return I===45||I===46||I===58||I===95||gt(I)?(e.consume(I),O):$(I)}function $(I){return I===61?(e.consume(I),E):Se(I)?(i=$,F(I)):Me(I)?(e.consume(I),$):A(I)}function E(I){return I===null||I===60||I===61||I===62||I===96?n(I):I===34||I===39?(e.consume(I),o=I,L):Se(I)?(i=E,F(I)):Me(I)?(e.consume(I),E):(e.consume(I),w)}function L(I){return I===o?(e.consume(I),o=void 0,M):I===null?n(I):Se(I)?(i=L,F(I)):(e.consume(I),L)}function w(I){return I===null||I===34||I===39||I===60||I===61||I===96?n(I):I===47||I===62||ct(I)?A(I):(e.consume(I),w)}function M(I){return I===47||I===62||ct(I)?A(I):n(I)}function U(I){return I===62?(e.consume(I),e.exit("htmlTextData"),e.exit("htmlText"),t):n(I)}function F(I){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(I),e.exit("lineEnding"),B}function B(I){return Me(I)?We(e,G,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(I):G(I)}function G(I){return e.enter("htmlTextData"),i(I)}}const fl={name:"labelEnd",resolveAll:OT,resolveTo:MT,tokenize:LT},zT={tokenize:DT},RT={tokenize:FT},PT={tokenize:$T};function OT(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&&Bt(e,0,e.length,n),e}function MT(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=yt(l,e.slice(s+1,s+r+3)),l=yt(l,[["enter",d,t]]),l=yt(l,dl(t.parser.constructs.insideSpan.null,e.slice(s+r+4,i-3),t)),l=yt(l,[["exit",d,t],e[i-2],e[i-1],["exit",u,t]]),l=yt(l,e.slice(i+1)),l=yt(l,[["exit",c,t]]),Bt(e,s,e.length,l),e}function LT(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(Jn(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(zT,d,i?d:f)(h):h===91?e.attempt(RT,d,i?u:f)(h):i?d(h):f(h)}function u(h){return e.attempt(PT,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 ct(f)?Er(e,s)(f):s(f)}function s(f){return f===41?d(f):zm(e,i,l,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(f)}function i(f){return ct(f)?Er(e,c)(f):d(f)}function l(f){return n(f)}function c(f){return f===34||f===39||f===40?Pm(e,u,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(f):d(f)}function u(f){return ct(f)?Er(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 Rm.call(r,e,s,i,"reference","referenceMarker","referenceString")(l)}function s(l){return r.parser.defined.includes(Jn(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?t(l):n(l)}function i(l){return n(l)}}function $T(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 BT={name:"labelStartImage",resolveAll:fl.resolveAll,tokenize:UT};function UT(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 WT={name:"labelStartLink",resolveAll:fl.resolveAll,tokenize:VT};function VT(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 ei={name:"lineEnding",tokenize:HT};function HT(e,t){return n;function n(r){return e.enter("lineEnding"),e.consume(r),e.exit("lineEnding"),We(e,t,"linePrefix")}}const _o={name:"thematicBreak",tokenize:ZT};function ZT(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||Se(u))?(e.exit("thematicBreak"),t(u)):n(u)}function c(u){return u===o?(e.consume(u),r++,c):(e.exit("thematicBreakSequence"),Me(u)?We(e,l,"whitespace")(u):l(u))}}const at={continuation:{tokenize:GT},exit:XT,name:"list",tokenize:JT},qT={partial:!0,tokenize:QT},KT={partial:!0,tokenize:YT};function JT(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 x=r.containerState.type||(p===42||p===43||p===45?"listUnordered":"listOrdered");if(x==="listUnordered"?!r.containerState.marker||p===r.containerState.marker:Ji(p)){if(r.containerState.type||(r.containerState.type=x,e.enter(x,{_container:!0})),x==="listUnordered")return e.enter("listItemPrefix"),p===42||p===45?e.check(_o,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 Ji(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(Cs,r.interrupt?n:d,e.attempt(qT,h,f))}function d(p){return r.containerState.initialBlankLine=!0,s++,h(p)}function f(p){return Me(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 GT(e,t,n){const r=this;return r.containerState._closeFlow=void 0,e.check(Cs,o,s);function o(l){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,We(e,t,"listItemIndent",r.containerState.size+1)(l)}function s(l){return r.containerState.furtherBlankLines||!Me(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(KT,t,i)(l))}function i(l){return r.containerState._closeFlow=!0,r.interrupt=void 0,We(e,e.attempt(at,t,n),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(l)}}function YT(e,t,n){const r=this;return We(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 XT(e){e.exit(this.containerState.type)}function QT(e,t,n){const r=this;return We(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!Me(s)&&i&&i[1].type==="listItemPrefixWhitespace"?t(s):n(s)}}const cu={name:"setextUnderline",resolveTo:e3,tokenize:t3};function e3(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 t3(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"),Me(u)?We(e,c,"lineSuffix")(u):c(u))}function c(u){return u===null||Se(u)?(e.exit("setextHeadingLine"),t(u)):n(u)}}const n3={tokenize:r3};function r3(e){const t=this,n=e.attempt(Cs,r,e.attempt(this.parser.constructs.flowInitial,o,We(e,e.attempt(this.parser.constructs.flow,o,e.attempt(lT,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 o3={resolveAll:Mm()},s3=Om("string"),i3=Om("text");function Om(e){return{resolveAll:Mm(e==="text"?a3: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 Mm(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 a3(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 l3={42:at,43:at,45:at,48:at,49:at,50:at,51:at,52:at,53:at,54:at,55:at,56:at,57:at,62:Nm},c3={91:pT},u3={[-2]:Qs,[-1]:Qs,32:Qs},d3={35:bT,42:_o,45:[cu,_o],60:_T,61:cu,95:_o,96:au,126:au},f3={38:Am,92:Tm},p3={[-5]:ei,[-4]:ei,[-3]:ei,33:BT,38:Am,42:Gi,60:[WN,AT],91:WT,92:[xT,Tm],93:fl,95:Gi,96:nT},h3={null:[Gi,o3]},m3={null:[42,95]},g3={null:[]},x3=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:m3,contentInitial:c3,disable:g3,document:l3,flow:d3,flowInitial:u3,insideSpan:h3,string:f3,text:p3},Symbol.toStringTag,{value:"Module"}));function y3(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:N(C),check:N(j),consume:v,enter:k,exit:S,interrupt:N(j,{interrupt:!0})},u={code:null,containerState:{},defineSkip:m,events:[],now:x,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($){return i=yt(i,$),g(),i[i.length-1]!==null?[]:(T(t,0),u.events=dl(s,u.events,u),u.events)}function h($,E){return v3(p($),E)}function p($){return b3(i,$)}function x(){const{_bufferIndex:$,_index:E,line:L,column:w,offset:M}=r;return{_bufferIndex:$,_index:E,line:L,column:w,offset:M}}function m($){o[$.line]=$.column,O()}function g(){let $;for(;r._index<i.length;){const E=i[r._index];if(typeof E=="string")for($=r._index,r._bufferIndex<0&&(r._bufferIndex=0);r._index===$&&r._bufferIndex<E.length;)b(E.charCodeAt(r._bufferIndex));else b(E)}}function b($){d=d($)}function v($){Se($)?(r.line++,r.column=1,r.offset+=$===-3?2:1,O()):$!==-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=$}function k($,E){const L=E||{};return L.type=$,L.start=x(),u.events.push(["enter",L,u]),l.push(L),L}function S($){const E=l.pop();return E.end=x(),u.events.push(["exit",E,u]),E}function C($,E){T($,E.from)}function j($,E){E.restore()}function N($,E){return L;function L(w,M,U){let F,B,G,I;return Array.isArray(w)?K(w):"tokenize"in w?K([w]):H(w);function H(ue){return ie;function ie(de){const pe=de!==null&&ue[de],he=de!==null&&ue.null,me=[...Array.isArray(pe)?pe:pe?[pe]:[],...Array.isArray(he)?he:he?[he]:[]];return K(me)(de)}}function K(ue){return F=ue,B=0,ue.length===0?U:z(ue[B])}function z(ue){return ie;function ie(de){return I=A(),G=ue,ue.partial||(u.currentConstruct=ue),ue.name&&u.parser.constructs.disable.null.includes(ue.name)?re():ue.tokenize.call(E?Object.assign(Object.create(u),E):u,c,se,re)(de)}}function se(ue){return $(G,I),M}function re(ue){return I.restore(),++B<F.length?z(F[B]):U}}}function T($,E){$.resolveAll&&!s.includes($)&&s.push($),$.resolve&&Bt(u.events,E,u.events.length-E,$.resolve(u.events.slice(E),u)),$.resolveTo&&(u.events=$.resolveTo(u.events,u))}function A(){const $=x(),E=u.previous,L=u.currentConstruct,w=u.events.length,M=Array.from(l);return{from:w,restore:U};function U(){r=$,u.previous=E,u.currentConstruct=L,u.events.length=w,l=M,O()}}function O(){r.line in o&&r.column<2&&(r.column=o[r.line],r.offset+=o[r.line]-1)}}function b3(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 v3(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
|
-
`;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 w3(e){const r={constructs:NN([x3,...(e||{}).extensions||[]]),content:o(MN),defined:[],document:o(DN),flow:o(n3),lazy:{},string:o(s3),text:o(i3)};return r;function o(s){return i;function i(l){return y3(r,s,l)}}}function k3(e){for(;!Im(e););return e}const uu=/[\0\t\n\r]/g;function _3(){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(uu.lastIndex=f,u=uu.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 S3=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function C3(e){return e.replace(S3,j3)}function j3(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){const o=n.charCodeAt(1),s=o===120||o===88;return Em(n.slice(s?2:1),s?16:10)}return ul(n)||e}const Lm={}.hasOwnProperty;function E3(e,t,n){return typeof t!="string"&&(n=t,t=void 0),N3(n)(k3(w3(n).document().write(_3()(e,t,!0))))}function N3(e){const t={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:s(q),autolinkProtocol:A,autolinkEmail:A,atxHeading:s(te),blockQuote:s(he),characterEscape:A,characterReference:A,codeFenced:s(me),codeFencedFenceInfo:i,codeFencedFenceMeta:i,codeIndented:s(me,i),codeText:s(ke,i),codeTextData:A,data:A,codeFlowValue:A,definition:s(ze),definitionDestinationString:i,definitionLabelString:i,definitionTitleString:i,emphasis:s(_),hardBreakEscape:s(Q),hardBreakTrailing:s(Q),htmlFlow:s(P,i),htmlFlowData:A,htmlText:s(P,i),htmlTextData:A,image:s(R),label:i,link:s(q),listItem:s(J),listItemValue:h,listOrdered:s(Z,f),listUnordered:s(Z),paragraph:s(V),reference:z,referenceString:i,resourceDestinationString:i,resourceTitleString:i,setextHeading:s(te),strong:s(oe),thematicBreak:s(ee)},exit:{atxHeading:c(),atxHeadingSequence:C,autolink:c(),autolinkEmail:pe,autolinkProtocol:de,blockQuote:c(),characterEscapeValue:O,characterReferenceMarkerHexadecimal:re,characterReferenceMarkerNumeric:re,characterReferenceValue:ue,characterReference:ie,codeFenced:c(g),codeFencedFence:m,codeFencedFenceInfo:p,codeFencedFenceMeta:x,codeFlowValue:O,codeIndented:c(b),codeText:c(M),codeTextData:O,data:O,definition:c(),definitionDestinationString:S,definitionLabelString:v,definitionTitleString:k,emphasis:c(),hardBreakEscape:c(E),hardBreakTrailing:c(E),htmlFlow:c(L),htmlFlowData:O,htmlText:c(w),htmlTextData:O,image:c(F),label:G,labelText:B,lineEnding:$,link:c(U),listItem:c(),listOrdered:c(),listUnordered:c(),paragraph:c(),referenceString:se,resourceDestinationString:I,resourceTitleString:H,resource:K,setextHeading:c(T),setextHeadingLineSequence:N,setextHeadingText:j,strong:c(),thematicBreak:c()}};Dm(t,(e||{}).mdastExtensions||[]);const n={};return r;function r(D){let X={type:"root",children:[]};const ae={stack:[X],tokenStack:[],config:t,enter:l,exit:u,buffer:i,resume:d,data:n},ge=[];let Ee=-1;for(;++Ee<D.length;)if(D[Ee][1].type==="listOrdered"||D[Ee][1].type==="listUnordered")if(D[Ee][0]==="enter")ge.push(Ee);else{const Be=ge.pop();Ee=o(D,Be,Ee)}for(Ee=-1;++Ee<D.length;){const Be=t[D[Ee][0]];Lm.call(Be,D[Ee][1].type)&&Be[D[Ee][1].type].call(Object.assign({sliceSerialize:D[Ee][2].sliceSerialize},ae),D[Ee][1])}if(ae.tokenStack.length>0){const Be=ae.tokenStack[ae.tokenStack.length-1];(Be[1]||du).call(ae,void 0,Be[0])}for(X.position={start:rn(D.length>0?D[0][1].start:{line:1,column:1,offset:0}),end:rn(D.length>0?D[D.length-2][1].end:{line:1,column:1,offset:0})},Ee=-1;++Ee<t.transforms.length;)X=t.transforms[Ee](X)||X;return X}function o(D,X,ae){let ge=X-1,Ee=-1,Be=!1,ft,Pe,zt,Zt;for(;++ge<=ae;){const Ke=D[ge];switch(Ke[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{Ke[0]==="enter"?Ee++:Ee--,Zt=void 0;break}case"lineEndingBlank":{Ke[0]==="enter"&&(ft&&!Zt&&!Ee&&!zt&&(zt=ge),Zt=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:Zt=void 0}if(!Ee&&Ke[0]==="enter"&&Ke[1].type==="listItemPrefix"||Ee===-1&&Ke[0]==="exit"&&(Ke[1].type==="listUnordered"||Ke[1].type==="listOrdered")){if(ft){let qt=ge;for(Pe=void 0;qt--;){const _t=D[qt];if(_t[1].type==="lineEnding"||_t[1].type==="lineEndingBlank"){if(_t[0]==="exit")continue;Pe&&(D[Pe][1].type="lineEndingBlank",Be=!0),_t[1].type="lineEnding",Pe=qt}else if(!(_t[1].type==="linePrefix"||_t[1].type==="blockQuotePrefix"||_t[1].type==="blockQuotePrefixWhitespace"||_t[1].type==="blockQuoteMarker"||_t[1].type==="listItemIndent"))break}zt&&(!Pe||zt<Pe)&&(ft._spread=!0),ft.end=Object.assign({},Pe?D[Pe][1].start:Ke[1].end),D.splice(Pe||ge,0,["exit",ft,Ke[2]]),ge++,ae++}if(Ke[1].type==="listItemPrefix"){const qt={type:"listItem",_spread:!1,start:Object.assign({},Ke[1].start),end:void 0};ft=qt,D.splice(ge,0,["enter",qt,Ke[2]]),ge++,ae++,zt=void 0,Zt=!0}}}return D[X][1]._spread=Be,ae}function s(D,X){return ae;function ae(ge){l.call(this,D(ge),ge),X&&X.call(this,ge)}}function i(){this.stack.push({type:"fragment",children:[]})}function l(D,X,ae){this.stack[this.stack.length-1].children.push(D),this.stack.push(D),this.tokenStack.push([X,ae||void 0]),D.position={start:rn(X.start),end:void 0}}function c(D){return X;function X(ae){D&&D.call(this,ae),u.call(this,ae)}}function u(D,X){const ae=this.stack.pop(),ge=this.tokenStack.pop();if(ge)ge[0].type!==D.type&&(X?X.call(this,D,ge[0]):(ge[1]||du).call(this,D,ge[0]));else throw new Error("Cannot close `"+D.type+"` ("+jr({start:D.start,end:D.end})+"): it’s not open");ae.position.end=rn(D.end)}function d(){return jN(this.stack.pop())}function f(){this.data.expectingFirstListItemValue=!0}function h(D){if(this.data.expectingFirstListItemValue){const X=this.stack[this.stack.length-2];X.start=Number.parseInt(this.sliceSerialize(D),10),this.data.expectingFirstListItemValue=void 0}}function p(){const D=this.resume(),X=this.stack[this.stack.length-1];X.lang=D}function x(){const D=this.resume(),X=this.stack[this.stack.length-1];X.meta=D}function m(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function g(){const D=this.resume(),X=this.stack[this.stack.length-1];X.value=D.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function b(){const D=this.resume(),X=this.stack[this.stack.length-1];X.value=D.replace(/(\r?\n|\r)$/g,"")}function v(D){const X=this.resume(),ae=this.stack[this.stack.length-1];ae.label=X,ae.identifier=Jn(this.sliceSerialize(D)).toLowerCase()}function k(){const D=this.resume(),X=this.stack[this.stack.length-1];X.title=D}function S(){const D=this.resume(),X=this.stack[this.stack.length-1];X.url=D}function C(D){const X=this.stack[this.stack.length-1];if(!X.depth){const ae=this.sliceSerialize(D).length;X.depth=ae}}function j(){this.data.setextHeadingSlurpLineEnding=!0}function N(D){const X=this.stack[this.stack.length-1];X.depth=this.sliceSerialize(D).codePointAt(0)===61?1:2}function T(){this.data.setextHeadingSlurpLineEnding=void 0}function A(D){const ae=this.stack[this.stack.length-1].children;let ge=ae[ae.length-1];(!ge||ge.type!=="text")&&(ge=Y(),ge.position={start:rn(D.start),end:void 0},ae.push(ge)),this.stack.push(ge)}function O(D){const X=this.stack.pop();X.value+=this.sliceSerialize(D),X.position.end=rn(D.end)}function $(D){const X=this.stack[this.stack.length-1];if(this.data.atHardBreak){const ae=X.children[X.children.length-1];ae.position.end=rn(D.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(X.type)&&(A.call(this,D),O.call(this,D))}function E(){this.data.atHardBreak=!0}function L(){const D=this.resume(),X=this.stack[this.stack.length-1];X.value=D}function w(){const D=this.resume(),X=this.stack[this.stack.length-1];X.value=D}function M(){const D=this.resume(),X=this.stack[this.stack.length-1];X.value=D}function U(){const D=this.stack[this.stack.length-1];if(this.data.inReference){const X=this.data.referenceType||"shortcut";D.type+="Reference",D.referenceType=X,delete D.url,delete D.title}else delete D.identifier,delete D.label;this.data.referenceType=void 0}function F(){const D=this.stack[this.stack.length-1];if(this.data.inReference){const X=this.data.referenceType||"shortcut";D.type+="Reference",D.referenceType=X,delete D.url,delete D.title}else delete D.identifier,delete D.label;this.data.referenceType=void 0}function B(D){const X=this.sliceSerialize(D),ae=this.stack[this.stack.length-2];ae.label=C3(X),ae.identifier=Jn(X).toLowerCase()}function G(){const D=this.stack[this.stack.length-1],X=this.resume(),ae=this.stack[this.stack.length-1];if(this.data.inReference=!0,ae.type==="link"){const ge=D.children;ae.children=ge}else ae.alt=X}function I(){const D=this.resume(),X=this.stack[this.stack.length-1];X.url=D}function H(){const D=this.resume(),X=this.stack[this.stack.length-1];X.title=D}function K(){this.data.inReference=void 0}function z(){this.data.referenceType="collapsed"}function se(D){const X=this.resume(),ae=this.stack[this.stack.length-1];ae.label=X,ae.identifier=Jn(this.sliceSerialize(D)).toLowerCase(),this.data.referenceType="full"}function re(D){this.data.characterReferenceType=D.type}function ue(D){const X=this.sliceSerialize(D),ae=this.data.characterReferenceType;let ge;ae?(ge=Em(X,ae==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):ge=ul(X);const Ee=this.stack[this.stack.length-1];Ee.value+=ge}function ie(D){const X=this.stack.pop();X.position.end=rn(D.end)}function de(D){O.call(this,D);const X=this.stack[this.stack.length-1];X.url=this.sliceSerialize(D)}function pe(D){O.call(this,D);const X=this.stack[this.stack.length-1];X.url="mailto:"+this.sliceSerialize(D)}function he(){return{type:"blockquote",children:[]}}function me(){return{type:"code",lang:null,meta:null,value:""}}function ke(){return{type:"inlineCode",value:""}}function ze(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function _(){return{type:"emphasis",children:[]}}function te(){return{type:"heading",depth:0,children:[]}}function Q(){return{type:"break"}}function P(){return{type:"html",value:""}}function R(){return{type:"image",title:null,url:"",alt:null}}function q(){return{type:"link",title:null,url:"",children:[]}}function Z(D){return{type:"list",ordered:D.type==="listOrdered",start:null,spread:D._spread,children:[]}}function J(D){return{type:"listItem",spread:D._spread,checked:null,children:[]}}function V(){return{type:"paragraph",children:[]}}function oe(){return{type:"strong",children:[]}}function Y(){return{type:"text",value:""}}function ee(){return{type:"thematicBreak"}}}function rn(e){return{line:e.line,column:e.column,offset:e.offset}}function Dm(e,t){let n=-1;for(;++n<t.length;){const r=t[n];Array.isArray(r)?Dm(e,r):T3(e,r)}}function T3(e,t){let n;for(n in t)if(Lm.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 du(e,t){throw e?new Error("Cannot close `"+e.type+"` ("+jr({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+jr({start:t.start,end:t.end})+") is open"):new Error("Cannot close document, a token (`"+t.type+"`, "+jr({start:t.start,end:t.end})+") is still open")}function A3(e){const t=this;t.parser=n;function n(r){return E3(r,{...t.data("settings"),...e,extensions:t.data("micromarkExtensions")||[],mdastExtensions:t.data("fromMarkdownExtensions")||[]})}}function I3(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 z3(e,t){const n={type:"element",tagName:"br",properties:{},children:[]};return e.patch(t,n),[e.applyData(t,n),{type:"text",value:`
|
|
97
|
-
`}]}function R3(e,t){const n=t.value?t.value+`
|
|
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 P3(e,t){const n={type:"element",tagName:"del",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function O3(e,t){const n={type:"element",tagName:"em",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function M3(e,t){const n=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",r=String(t.identifier).toUpperCase(),o=dr(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 L3(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 D3(e,t){if(e.options.allowDangerousHtml){const n={type:"raw",value:t.value};return e.patch(t,n),e.applyData(t,n)}}function Fm(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 F3(e,t){const n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return Fm(e,t);const o={src:dr(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 $3(e,t){const n={src:dr(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 B3(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 U3(e,t){const n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return Fm(e,t);const o={href:dr(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 W3(e,t){const n={href:dr(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 V3(e,t,n){const r=e.all(t),o=n?H3(n):$m(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
|
-
`}),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 H3(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=$m(n[r])}return t}function $m(e){const t=e.spread;return t??e.children.length>1}function Z3(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 q3(e,t){const n={type:"element",tagName:"p",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function K3(e,t){const n={type:"root",children:e.wrap(e.all(t))};return e.patch(t,n),e.applyData(t,n)}function J3(e,t){const n={type:"element",tagName:"strong",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function G3(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=il(t.children[1]),c=vm(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 Y3(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 x={type:"element",tagName:s,properties:h,children:[]};f&&(x.children=e.all(f),e.patch(f,x),x=e.applyData(f,x)),u.push(x)}const d={type:"element",tagName:"tr",properties:{},children:e.wrap(u,!0)};return e.patch(t,d),e.applyData(t,d)}function X3(e,t){const n={type:"element",tagName:"td",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}const fu=9,pu=32;function Q3(e){const t=String(e),n=/\r?\n|\r/g;let r=n.exec(t),o=0;const s=[];for(;r;)s.push(hu(t.slice(o,r.index),o>0,!0),r[0]),o=r.index+r[0].length,r=n.exec(t);return s.push(hu(t.slice(o),o>0,!1)),s.join("")}function hu(e,t,n){let r=0,o=e.length;if(t){let s=e.codePointAt(r);for(;s===fu||s===pu;)r++,s=e.codePointAt(r)}if(n){let s=e.codePointAt(o-1);for(;s===fu||s===pu;)o--,s=e.codePointAt(o-1)}return o>r?e.slice(r,o):""}function e4(e,t){const n={type:"text",value:Q3(String(t.value))};return e.patch(t,n),e.applyData(t,n)}function t4(e,t){const n={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(t,n),e.applyData(t,n)}const n4={blockquote:I3,break:z3,code:R3,delete:P3,emphasis:O3,footnoteReference:M3,heading:L3,html:D3,imageReference:F3,image:$3,inlineCode:B3,linkReference:U3,link:W3,listItem:V3,list:Z3,paragraph:q3,root:K3,strong:J3,table:G3,tableCell:X3,tableRow:Y3,text:e4,thematicBreak:t4,toml:fo,yaml:fo,definition:fo,footnoteDefinition:fo};function fo(){}const Bm=-1,js=0,Nr=1,Ho=2,pl=3,hl=4,ml=5,gl=6,Um=7,Wm=8,mu=typeof self=="object"?self:globalThis,r4=(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 js:case Bm:return n(i,o);case Nr:{const l=n([],o);for(const c of i)l.push(r(c));return l}case Ho:{const l=n({},o);for(const[c,u]of i)l[r(c)]=r(u);return l}case pl:return n(new Date(i),o);case hl:{const{source:l,flags:c}=i;return n(new RegExp(l,c),o)}case ml:{const l=n(new Map,o);for(const[c,u]of i)l.set(r(c),r(u));return l}case gl:{const l=n(new Set,o);for(const c of i)l.add(r(c));return l}case Um:{const{name:l,message:c}=i;return n(new mu[l](c),o)}case Wm: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 mu[s](i),o)};return r},gu=e=>r4(new Map,e)(0),Fn="",{toString:o4}={},{keys:s4}=Object,br=e=>{const t=typeof e;if(t!=="object"||!e)return[js,t];const n=o4.call(e).slice(8,-1);switch(n){case"Array":return[Nr,Fn];case"Object":return[Ho,Fn];case"Date":return[pl,Fn];case"RegExp":return[hl,Fn];case"Map":return[ml,Fn];case"Set":return[gl,Fn];case"DataView":return[Nr,n]}return n.includes("Array")?[Nr,n]:n.includes("Error")?[Um,n]:[Ho,n]},po=([e,t])=>e===js&&(t==="function"||t==="symbol"),i4=(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]=br(i);switch(l){case js:{let d=i;switch(c){case"bigint":l=Wm,d=i.toString();break;case"function":case"symbol":if(e)throw new TypeError("unable to serialize "+c);d=null;break;case"undefined":return o([Bm],i)}return o([l,d],i)}case Nr:{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 Ho:{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 s4(i))(e||!po(br(i[h])))&&d.push([s(h),s(i[h])]);return f}case pl:return o([l,i.toISOString()],i);case hl:{const{source:d,flags:f}=i;return o([l,{source:d,flags:f}],i)}case ml:{const d=[],f=o([l,d],i);for(const[h,p]of i)(e||!(po(br(h))||po(br(p))))&&d.push([s(h),s(p)]);return f}case gl:{const d=[],f=o([l,d],i);for(const h of i)(e||!po(br(h)))&&d.push(s(h));return f}}const{message:u}=i;return o([l,{name:c,message:u}],i)};return s},xu=(e,{json:t,lossy:n}={})=>{const r=[];return i4(!(t||n),!!t,new Map,r)(e),r},Zo=typeof structuredClone=="function"?(e,t)=>t&&("json"in t||"lossy"in t)?gu(xu(e,t)):structuredClone(e):(e,t)=>gu(xu(e,t));function a4(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 l4(e,t){return"Back to reference "+(e+1)+(t>1?"-"+t:"")}function c4(e){const t=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",n=e.options.footnoteBackContent||a4,r=e.options.footnoteBackLabel||l4,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=dr(f.toLowerCase());let p=0;const x=[],m=e.footnoteCounts.get(f);for(;m!==void 0&&++p<=m;){x.length>0&&x.push({type:"text",value:" "});let v=typeof n=="string"?n:n(c,p);typeof v=="string"&&(v={type:"text",value:v}),x.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(...x)}else d.push(...x);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:{...Zo(i),id:"footnote-label"},children:[{type:"text",value:o}]},{type:"text",value:`
|
|
101
|
-
`},{type:"element",tagName:"ol",properties:{},children:e.wrap(l,!0)},{type:"text",value:`
|
|
102
|
-
`}]}}const Vm=(function(e){if(e==null)return p4;if(typeof e=="function")return Es(e);if(typeof e=="object")return Array.isArray(e)?u4(e):d4(e);if(typeof e=="string")return f4(e);throw new Error("Expected function, string, or object as test")});function u4(e){const t=[];let n=-1;for(;++n<e.length;)t[n]=Vm(e[n]);return Es(r);function r(...o){let s=-1;for(;++s<t.length;)if(t[s].apply(this,o))return!0;return!1}}function d4(e){const t=e;return Es(n);function n(r){const o=r;let s;for(s in e)if(o[s]!==t[s])return!1;return!0}}function f4(e){return Es(t);function t(n){return n&&n.type===e}}function Es(e){return t;function t(n,r,o){return!!(h4(n)&&e.call(this,n,typeof r=="number"?r:void 0,o||void 0))}}function p4(){return!0}function h4(e){return e!==null&&typeof e=="object"&&"type"in e}const Hm=[],m4=!0,yu=!1,g4="skip";function x4(e,t,n,r){let o;typeof t=="function"&&typeof n!="function"?(r=n,n=t):o=t;const s=Vm(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=Hm,x,m,g;if((!t||s(c,u,d[d.length-1]||void 0))&&(p=y4(n(c,d)),p[0]===yu))return p;if("children"in c&&c.children){const b=c;if(b.children&&p[0]!==g4)for(m=(r?b.children.length:-1)+i,g=d.concat(b);m>-1&&m<b.children.length;){const v=b.children[m];if(x=l(v,m,g)(),x[0]===yu)return x;m=typeof x[1]=="number"?x[1]:m+i}}return p}}}function y4(e){return Array.isArray(e)?e:typeof e=="number"?[m4,e]:e==null?Hm:[e]}function Zm(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),x4(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 Yi={}.hasOwnProperty,b4={};function v4(e,t){const n=t||b4,r=new Map,o=new Map,s=new Map,i={...n4,...n.handlers},l={all:u,applyData:k4,definitionById:r,footnoteById:o,footnoteCounts:s,footnoteOrder:[],handlers:i,one:c,options:n,patch:w4,wrap:S4};return Zm(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(Yi.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=Zo(g);return b.children=l.all(d),b}return Zo(d)}return(l.options.unknownHandler||_4)(l,d,f)}function u(d){const f=[];if("children"in d){const h=d.children;let p=-1;for(;++p<h.length;){const x=l.one(h[p],d);if(x){if(p&&h[p-1].type==="break"&&(!Array.isArray(x)&&x.type==="text"&&(x.value=bu(x.value)),!Array.isArray(x)&&x.type==="element")){const m=x.children[0];m&&m.type==="text"&&(m.value=bu(m.value))}Array.isArray(x)?f.push(...x):f.push(x)}}}return f}}function w4(e,t){e.position&&(t.position=oN(e))}function k4(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,Zo(s)),"children"in n&&n.children&&o!==null&&o!==void 0&&(n.children=o)}return n}function _4(e,t){const n=t.data||{},r="value"in t&&!(Yi.call(n,"hProperties")||Yi.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 S4(e,t){const n=[];let r=-1;for(t&&n.push({type:"text",value:`
|
|
103
|
-
`});++r<e.length;)r&&n.push({type:"text",value:`
|
|
104
|
-
`}),n.push(e[r]);return t&&e.length>0&&n.push({type:"text",value:`
|
|
105
|
-
`}),n}function bu(e){let t=0,n=e.charCodeAt(t);for(;n===9||n===32;)t++,n=e.charCodeAt(t);return e.slice(t)}function vu(e,t){const n=v4(e,t),r=n.one(e,void 0),o=c4(n),s=Array.isArray(r)?{type:"root",children:r}:r||{type:"root",children:[]};return o&&s.children.push({type:"text",value:`
|
|
106
|
-
`},o),s}function C4(e,t){return e&&"run"in e?async function(n,r){const o=vu(n,{file:r,...t});await e.run(o,r)}:function(n,r){return vu(n,{file:r,...e||t})}}function wu(e){if(e)throw e}var ti,ku;function j4(){if(ku)return ti;ku=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 ti=function c(){var u,d,f,h,p,x,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,x=f&&o(f)?f:[]):x=f&&s(f)?f:{},i(m,{name:d,newValue:c(v,x,h)})):typeof h<"u"&&i(m,{name:d,newValue:h}));return m},ti}var E4=j4();const ni=da(E4);function Xi(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 N4(){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?T4(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 T4(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 Rt={basename:A4,dirname:I4,extname:z4,join:R4,sep:"/"};function A4(e,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');Kr(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 I4(e){if(Kr(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 z4(e){Kr(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 R4(...e){let t=-1,n;for(;++t<e.length;)Kr(e[t]),e[t]&&(n=n===void 0?e[t]:n+"/"+e[t]);return n===void 0?".":P4(n)}function P4(e){Kr(e);const t=e.codePointAt(0)===47;let n=O4(e,!t);return n.length===0&&!t&&(n="."),n.length>0&&e.codePointAt(e.length-1)===47&&(n+="/"),t?"/"+n:n}function O4(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 Kr(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const M4={cwd:L4};function L4(){return"/"}function Qi(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function D4(e){if(typeof e=="string")e=new URL(e);else if(!Qi(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 F4(e)}function F4(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 ri=["history","path","basename","stem","extname","dirname"];class qm{constructor(t){let n;t?Qi(t)?n={path:t}:typeof t=="string"||$4(t)?n={value:t}:n=t:n={},this.cwd="cwd"in n?"":M4.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let r=-1;for(;++r<ri.length;){const s=ri[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)ri.includes(o)||(this[o]=n[o])}get basename(){return typeof this.path=="string"?Rt.basename(this.path):void 0}set basename(t){si(t,"basename"),oi(t,"basename"),this.path=Rt.join(this.dirname||"",t)}get dirname(){return typeof this.path=="string"?Rt.dirname(this.path):void 0}set dirname(t){_u(this.basename,"dirname"),this.path=Rt.join(t||"",this.basename)}get extname(){return typeof this.path=="string"?Rt.extname(this.path):void 0}set extname(t){if(oi(t,"extname"),_u(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=Rt.join(this.dirname,this.stem+(t||""))}get path(){return this.history[this.history.length-1]}set path(t){Qi(t)&&(t=D4(t)),si(t,"path"),this.path!==t&&this.history.push(t)}get stem(){return typeof this.path=="string"?Rt.basename(this.path,this.extname):void 0}set stem(t){si(t,"stem"),oi(t,"stem"),this.path=Rt.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 rt(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 oi(e,t){if(e&&e.includes(Rt.sep))throw new Error("`"+t+"` cannot be a path: did not expect `"+Rt.sep+"`")}function si(e,t){if(!e)throw new Error("`"+t+"` cannot be empty")}function _u(e,t){if(!e)throw new Error("Setting `"+t+"` requires `path` to be set too")}function $4(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const B4=(function(e){const r=this.constructor.prototype,o=r[e],s=function(){return o.apply(s,arguments)};return Object.setPrototypeOf(s,r),s}),U4={}.hasOwnProperty;class xl extends B4{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=N4()}copy(){const t=new xl;let n=-1;for(;++n<this.attachers.length;){const r=this.attachers[n];t.use(...r)}return t.data(ni(!0,{},this.namespace)),t}data(t,n){return typeof t=="string"?arguments.length===2?(li("data",this.frozen),this.namespace[t]=n,this):U4.call(this.namespace,t)&&this.namespace[t]||void 0:t?(li("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=ho(t),r=this.parser||this.Parser;return ii("parse",r),r(String(n),n)}process(t,n){const r=this;return this.freeze(),ii("process",this.parser||this.Parser),ai("process",this.compiler||this.Compiler),n?o(void 0,n):new Promise(o);function o(s,i){const l=ho(t),c=r.parse(l);r.run(c,l,function(d,f,h){if(d||!f||!h)return u(d);const p=f,x=r.stringify(p,h);H4(x)?h.value=x:h.result=x,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(),ii("processSync",this.parser||this.Parser),ai("processSync",this.compiler||this.Compiler),this.process(t,o),Cu("processSync","process",n),r;function o(s,i){n=!0,wu(s),r=i}}run(t,n,r){Su(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=ho(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),Cu("runSync","run",r),o;function s(i,l){wu(i),o=l,r=!0}}stringify(t,n){this.freeze();const r=ho(n),o=this.compiler||this.Compiler;return ai("stringify",o),Su(t),o(t,r)}use(t,...n){const r=this.attachers,o=this.namespace;if(li("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=ni(!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,...x]=d;const m=r[h][1];Xi(m)&&Xi(p)&&(p=ni(!0,m,p)),r[h]=[u,p,...x]}}}}const W4=new xl().freeze();function ii(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function ai(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function li(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 Su(e){if(!Xi(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function Cu(e,t,n){if(!n)throw new Error("`"+e+"` finished async. Use `"+t+"` instead")}function ho(e){return V4(e)?e:new qm(e)}function V4(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function H4(e){return typeof e=="string"||Z4(e)}function Z4(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const q4="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",ju=[],Eu={allowDangerousHtml:!0},K4=/^(https?|ircs?|mailto|xmpp)$/i,J4=[{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 Nu(e){const t=G4(e),n=Y4(e);return X4(t.runSync(t.parse(n),n),e)}function G4(e){const t=e.rehypePlugins||ju,n=e.remarkPlugins||ju,r=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...Eu}:Eu;return W4().use(A3).use(n).use(C4,r).use(t)}function Y4(e){const t=e.children||"",n=new qm;return typeof t=="string"&&(n.value=t),n}function X4(e,t){const n=t.allowedElements,r=t.allowElement,o=t.components,s=t.disallowedElements,i=t.skipHtml,l=t.unwrapDisallowed,c=t.urlTransform||Q4;for(const d of J4)Object.hasOwn(t,d.from)&&(""+d.from+(d.to?"use `"+d.to+"` instead":"remove it")+q4+d.id,void 0);return Zm(e,u),cN(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 Xs)if(Object.hasOwn(Xs,p)&&Object.hasOwn(d.properties,p)){const x=d.properties[p],m=Xs[p];(m===null||m.includes(d.tagName))&&(d.properties[p]=c(String(x||""),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 Q4(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||K4.test(e.slice(0,t))?e:""}function Km(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 Cr(e){return e!==null&&(Array.isArray(e)||typeof e=="object")}function Jm(e){return Array.isArray(e)?e.map((t,n)=>[String(n),t]):typeof e=="object"&&e!==null?Object.entries(e):[]}const Tu=120;function eA({text:e}){const[t,n]=y.useState(!1);return e.length>Tu?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(Nu,{children:e})}):a.jsxs(De,{delayDuration:300,children:[a.jsxs(Fe,{onClick:o=>{o.stopPropagation(),n(!0)},className:"text-left cursor-pointer",children:[a.jsx("span",{children:e.slice(0,Tu)}),a.jsx("span",{className:"text-emerald-400/50",children:"…"})]}),a.jsxs($e,{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(Nu,{children:e})}),'"']})}function Gm({value:e}){if(e===null)return a.jsx("span",{className:"text-rose-400 italic",children:"null"});switch(typeof e){case"string":return a.jsx(eA,{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 Au({value:e}){const[t,n]=y.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(it,{className:"size-3 text-green-500"}):a.jsx(Wt,{className:"size-3"})})}function tA({value:e}){const[t,n]=y.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(it,{className:"size-3 text-green-500"}):a.jsx(Wt,{className:"size-3 text-muted-foreground"})})}function nA({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(lf,{className:"size-3.5 text-muted-foreground"})})}const rA=y.memo(function e({name:t,value:n,level:r,defaultExpandDepth:o,isArrayItem:s,path:i,expandTargetPath:l,anatomyPaths:c}){const u=y.useMemo(()=>l===null?!1:i===""?l.length>0:l===i||l.startsWith(`${i}/`),[l,i]),d=r<o||u&&Cr(n),[f,h]=y.useState(d);y.useEffect(()=>{u&&Cr(n)&&!f&&h(!0)},[l]);const[p,x]=y.useState(0),[m,g]=y.useState(null),b=Cr(n),v=m===Number.POSITIVE_INFINITY,k=y.useMemo(()=>Jm(n),[n]),S=y.useMemo(()=>k.some(([,w])=>Cr(w)),[k]),C=Km(n),j=C==="array"?"[":"{",N=C==="array"?"]":"}",T=c!==null&&c.has(i);function A(){h(!0),g(Number.POSITIVE_INFINITY),x(w=>w+1)}function O(){h(!1),g(0),x(w=>w+1)}function $(){v?O():h(!f)}function E(w){w.stopPropagation(),A()}const L=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?$:void 0,onKeyDown:b?w=>{(w.key==="Enter"||w.key===" ")&&(w.preventDefault(),$())}:void 0,onDoubleClick:b&&S?()=>A():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(Ut,{className:"size-3 text-muted-foreground"}):a.jsx(en,{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"," ",N]})]}):a.jsx("span",{className:"min-w-0",children:a.jsx(Gm,{value:n})}),b&&S&&!v&&a.jsx(nA,{onClick:E}),a.jsx(tA,{value:n})]}),b&&f&&a.jsxs("div",{className:"pl-4",children:[k.map(([w,M])=>a.jsx(e,{name:w,value:M,level:r+1,defaultExpandDepth:L,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:N})]},p)]})});function yl({data:e,defaultExpandDepth:t=0,className:n,showCopy:r=!1,bulkDepth:o,bulkRevision:s,anatomyPaths:i=null,expandToPath:l=null}){const c=Cr(e),u=y.useMemo(()=>Jm(e),[e]),d=o??t,f=s??0;if(!c)return a.jsx(et,{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(Gm,{value:e}),r&&a.jsx(Au,{value:e})]})})});const p=Km(e)==="array";return a.jsx(et,{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(Au,{value:e})}),a.jsx("div",{children:u.map(([x,m])=>a.jsx(rA,{name:x,value:m,level:0,defaultExpandDepth:d,isArrayItem:p,path:`/${x}`,expandTargetPath:l,anatomyPaths:i},x))},f)]})})}const oA=y.memo(function({text:t,defaultExpandDepth:n=0,className:r,bulkDepth:o,bulkRevision:s}){const i=y.useMemo(()=>nm(t),[t]);return i.kind==="json"?a.jsx(yl,{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})}),Ym=Object.freeze(Object.defineProperty({__proto__:null,JsonViewer:yl,JsonViewerFromString:oA},Symbol.toStringTag,{value:"Module"}));function sA({className:e,children:t,...n}){return a.jsxs(BC,{"data-slot":"scroll-area",className:ve("relative overflow-hidden",e),...n,children:[a.jsx(UC,{"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(iA,{}),a.jsx(WC,{})]})}function iA({className:e,orientation:t="vertical",...n}){return a.jsx(Gp,{"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(eh,{"data-slot":"scroll-area-thumb",className:"bg-border relative flex-1 rounded-full"})})}const Xm={file:"file",shell:"shell",browser:"browser",web:"web",mcp:"MCP",code:"code",other:"other"},aA={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 lA({category:e}){switch(e){case"file":return a.jsx(Yv,{className:"size-3.5"});case"shell":return a.jsx(pf,{className:"size-3.5"});case"browser":return a.jsx(fw,{className:"size-3.5"});case"web":return a.jsx(df,{className:"size-3.5"});case"mcp":return a.jsx(pv,{className:"size-3.5"});case"code":return a.jsx(Pv,{className:"size-3.5"});case"other":return a.jsx($v,{className:"size-3.5"})}}function cA({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(Et,{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 uA({tool:e,called:t}){const[n,r]=y.useState(!1),o=vn(e.name),s=e.description!==null||e.requiredParameters.length>0||e.schema!==null;return a.jsx(RE,{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(lA,{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(Et,{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(Ut,{className:"size-3.5 shrink-0 text-muted-foreground"}):a.jsx(en,{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(it,{className:"size-3.5 text-emerald-400"}):a.jsx(Wt,{className:"size-3.5"})})]}),a.jsx(PE,{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(cA,{names:e.requiredParameters}),e.schema!==null&&a.jsx(sA,{className:"max-h-64 rounded-md border border-border/60 bg-muted/20 p-2",children:a.jsx(yl,{data:Vo(e.schema),defaultExpandDepth:0})})]})})]})})}function dA(e,t){return t.length===0?!0:`${e.name} ${e.description??""} ${Xm[e.category]}`.toLowerCase().trim().includes(t)}const fA=y.memo(function({summary:t,calledToolNames:n}){const[r,o]=y.useState(!1),[s,i]=y.useState(""),l=y.useMemo(()=>new Set(n),[n]),c=s.trim().toLowerCase(),u=y.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(Wr,{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(Et,{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(Et,{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(Et,{variant:"outline",className:ve("h-5 rounded-md px-1.5 py-0 font-mono text-[10px]",aA[h.category]),children:[h.count," ",Xm[h.category]]},h.category))})]})]}),a.jsxs(Re,{type:"button",variant:"ghost",size:"sm",className:"h-7 px-2",onClick:()=>o(h=>!h),"aria-expanded":r,children:[r?a.jsx(Ut,{className:"size-3.5"}):a.jsx(en,{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(Et,{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(Aw,{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(uA,{tool:h,called:l.has(h.name)},h.name)):a.jsx("p",{className:"py-2 text-xs text-muted-foreground",children:"No matching tools"})})]})]})}),pA="/v1/chat/completions",hA="/chat/completions",mA="/v1/messages";class gA{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 fr=new gA;function xA(e){return fr.getByPath(e)??null}function yA(e){return xA(e)?.format??"unknown"}fr.registerPath(mA,"anthropic");fr.registerPath(pA,"openai");fr.registerPath(hA,"openai");function bA(e){if(e==="")return{};try{const t=JSON.parse(e);return t!==null&&typeof t=="object"&&!Array.isArray(t)?{...t}:{}}catch{return{}}}function vA(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:bA(e.inputJson)}}}function Qm(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 x=[];for(const g of e.split(`
|
|
107
|
-
`)){const b=g.trim();if(b.startsWith("data: "))try{const v=JSON.parse(b.slice(6)),k=$b.safeParse(v);if(!k.success)continue;const S=k.data;switch(h===0&&(p=Date.now()),r===!0&&x.length<f&&x.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:x,truncated:h>f});const m=[...o.entries()].sort(([g],[b])=>g-b).map(([,g])=>vA(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 wA={format:"anthropic",parseRequest(e,t){try{const n=JSON.parse(e),r=Gd.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=Yd.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 Qm(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}}};fr.register(wA);class kA{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 Ns=new kA,_A="https://api.anthropic.com",SA={MiniMax:"https://api.minimaxi.com/anthropic"},CA={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(SA))if(t.startsWith(n.toLowerCase()))return!0;return!0},getUpstreamBase(e,t){return t?.baseUrl!==void 0?t.baseUrl:_A},extractStream(e,t,n,r){return Qm(e,t,n,r)}};Ns.register(CA);function Ts(e,t,n,r=!0){let o="",s="",i="",l="",c=null,u=0,d=0,f=!1,h=!1;const p=new Map,x=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 A=Object.getOwnPropertyDescriptor(j,"error");if(A!==void 0&&typeof A.value=="object"&&A.value!==null){const O=Object.getOwnPropertyDescriptor(A.value,"message");O!==void 0&&typeof O.value=="string"&&(t.error=O.value);continue}}const N=Zb.safeParse(j);if(!N.success)continue;const T=N.data;if(m===0&&(g=Date.now()),r===!0&&b.length<x&&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 A=Object.getOwnPropertyDescriptor(j,"usage");if(A!==void 0&&typeof A.value=="object"&&A.value!==null){const O=Object.getOwnPropertyDescriptor(A.value,"prompt_tokens_details");if(O!==void 0&&typeof O.value=="object"&&O.value!==null){const $=Object.getOwnPropertyDescriptor(O.value,"cached_tokens");$!==void 0&&typeof $.value=="number"&&(t.cacheReadInputTokens=$.value)}}}f=!0}for(const A of T.choices){const O=A.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 $=O.think;if($!=null&&(l+=$),A.finish_reason!==void 0&&A.finish_reason!==null&&(c=A.finish_reason),O.tool_calls!==void 0&&O.tool_calls!==null)for(const E of O.tool_calls){let L=p.get(E.index);L===void 0&&(L={index:E.index,type:"function",function:{name:"",arguments:""}},p.set(E.index,L)),E.id!==void 0&&(L.id=E.id),E.function?.name!==void 0&&(L.function.name+=E.function.name),E.function?.arguments!==void 0&&(L.function.arguments+=E.function.arguments)}}}catch{}}r===!0&&(t.streamingChunks={chunks:b,truncated:m>x}),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 jA={format:"openai",parseRequest(e,t){try{const n=JSON.parse(e),r=ef.safeParse(n);return r.success?{model:r.data.model,sessionId:t?.get("x-session-affinity")??null}:null}catch{return null}},extractTokens(e){const t=nf(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 Ts(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}}};fr.register(jA);const EA="https://api.openai.com/v1",NA={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:EA},extractStream(e,t,n,r){return Ts(e,t,n,r)}};Ns.register(NA);const TA="https://open.bigmodel.cn/api/paas/v4",AA=["glm-","charglm-","cogview-","embedding-","rerank-"],IA={name:"zhipu",matches(e){const t=e.toLowerCase().replace(/\s+/g,"-");return AA.some(n=>t.startsWith(n))},getUpstreamBase(e,t){return t?.baseUrl??TA},extractStream(e,t,n,r){return Ts(e,t,n,r)}};Ns.register(IA);const zA="https://dashscope.aliyuncs.com/compatible-mode/v1",RA={name:"alibaba",matches(e){const t=e.toLowerCase().replace(/\s+/g,"-");return!!(t.startsWith("glm-5")||t.startsWith("qwen"))},getUpstreamBase(e,t){return zA},extractStream(e,t,n){return Ts(e,t,n)}};Ns.register(RA);function eg(e,t){for(const n of Array.from(e))t(n)}const PA=/[\u3000-\u9FFF\uAC00-\uD7FF\uF900-\uFAFF\uFF00-\uFFEF\u{1F300}-\u{1FAFF}]/u;function bl(e){if(e.length===0)return 0;let t=0,n=0;return eg(e,r=>{PA.test(r)?t+=1:n+=1}),Math.ceil(t*1)+Math.ceil(n/4)}function vl(e){if(e.length===0)return 0;let t=0;return eg(e,()=>{t+=1}),t}function kn(e){return{parsed:null,comparisonValue:e,messageCount:null,toolCount:null}}const Gn={parsed:null,toolNames:null};function OA(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 MA(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 LA(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 ci(e,t,n,r){return{role:e,label:t,text:n,size:bl(n),characters:vl(n),path:r}}const DA={format:"anthropic",analyzeRequest(e){if(e===null)return kn(e);try{const t=Gd.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}:kn(e)}catch{return kn(e)}},analyzeResponse(e){if(e===null)return Gn;try{let t=JSON.parse(e);typeof t=="string"&&(t=JSON.parse(t));const n=Yd.safeParse(t);if(!n.success)return Gn;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 Gn}},anatomySegments(e){if(e===null||typeof e!="object")return null;const t=e,n=[];if(t.system!==void 0){const r=MA(t.system);r.length>0&&n.push(ci("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=OA(s.content);n.push(ci(i,`[${o}] ${i}`,l,`/messages/${o}`))}),Array.isArray(t.tools)&&t.tools.length>0){const r=LA(t.tools);n.push(ci("tools","tools",r,"/tools"))}return n.length>0?n:null}};function FA(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 $A(e){const t=[],n=FA(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 BA(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 Iu(e,t,n,r){return{role:e,label:t,text:n,size:bl(n),characters:vl(n),path:r}}const UA={format:"openai",analyzeRequest(e){if(e===null)return kn(e);try{const t=ef.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}:kn(e)}catch{return kn(e)}},analyzeResponse(e){if(e===null)return Gn;const t=nf(e);if(t===null)return Gn;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=$A(s);n.push(Iu(i,`[${o}] ${i}`,l,`/messages/${o}`))}),Array.isArray(t.tools)&&t.tools.length>0){const r=BA(t.tools);n.push(Iu("tools","tools",r,"/tools"))}return n.length>0?n:null}},WA={format:"unknown",analyzeRequest(e){return kn(e)},analyzeResponse(){return Gn},anatomySegments(){return null}},VA={anthropic:DA,openai:UA,unknown:WA};function tg(e){return VA[e]}function $r(e){const t=yA(e.path);return t==="unknown"?e.apiFormat:t}const Xt="agent-inspector:focus-log";function ea(e){window.dispatchEvent(new CustomEvent(Xt,{detail:e}))}function As(e){if(typeof CustomEvent>"u"||!(e instanceof CustomEvent))return null;const t=e.detail,n=Oe(t,"logId");if(typeof n!="number"||!Number.isInteger(n)||n<0)return null;const r=Oe(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 zu(e,t,n){return e==="anthropic"&&t==="full"&&n}function HA(e,t){return e==="full"&&t}function ZA(e,t,n,r){return e==="anthropic"&&t==="full"&&n&&r}const qA=["file","shell","browser","web","mcp","code","other"];function ta(e){const t=e.replace(/\s+/g," ").trim();return t.length<=120?t:`${t.slice(0,119)}...`}function ng(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?ta(t.slice(0,n+1)):ta(t)}function KA(e,t){return`${e} ${t??""}`.toLowerCase()}function $n(e,t){return t.some(n=>e.includes(n))}function rg(e,t){const n=KA(e,t);return e.startsWith("mcp__")||e.startsWith("inspector_")||$n(n,[" mcp","model context protocol"])?"mcp":$n(n,["bash","shell","terminal","command","powershell","exec","process"])?"shell":$n(n,["browser","playwright","screenshot","click","navigate","page","tab"])?"browser":$n(n,["read","write","edit","file","glob","grep","patch","filesystem","directory"])?"file":$n(n,["web","search","http","url","fetch"])?"web":$n(n,["code","typescript","javascript","python","repl"])?"code":"other"}function og(e){const t=Oe(e,"properties");return t===null||typeof t!="object"||Array.isArray(t)?[]:Object.keys(t).sort((n,r)=>n.localeCompare(r))}function sg(e){const t=Oe(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 JA(e){const t=Oe(e,"name");if(typeof t!="string"||t.length===0)return null;const n=Oe(e,"description"),r=Oe(e,"input_schema")??null,o=typeof n=="string"?n:null;return{name:t,description:o,descriptionPreview:ng(o),category:rg(t,o),parameterCount:og(r).length,requiredParameters:sg(r),schema:r}}function GA(e){const t=Oe(e,"function"),n=Oe(t,"name");if(typeof n!="string"||n.length===0)return null;const r=Oe(t,"description"),o=Oe(t,"parameters")??null,s=typeof r=="string"?r:null;return{name:n,description:s,descriptionPreview:ng(s),category:rg(n,s),parameterCount:og(o).length,requiredParameters:sg(o),schema:o}}function YA(e){const t=GA(e);return t!==null?t:JA(e)}function XA(e){if(e==null)return null;if(typeof e=="string")return e;const t=Oe(e,"type"),n=Oe(e,"name"),r=Oe(Oe(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:ta(o)}function QA(e){const t=new Map;for(const n of e)t.set(n.category,(t.get(n.category)??0)+1);return qA.flatMap(n=>{const r=t.get(n)??0;return r>0?[{category:n,count:r}]:[]})}function eI(e){const t=Oe(e,"tools");if(!Array.isArray(t)||t.length===0)return null;const n=[];for(const r of t){const o=YA(r);o!==null&&n.push(o)}return n.length===0?null:{tools:n,toolChoiceLabel:XA(Oe(e,"tool_choice")),categories:QA(n)}}function Bn(){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 nI({active:e,onClick:t}){return a.jsxs(De,{children:[a.jsx(Fe,{asChild:!0,children:a.jsxs(Re,{variant:e?"default":"outline",size:"sm",className:"h-8 text-xs",onClick:t,"aria-pressed":e,children:[a.jsx(tw,{className:"size-3.5 mr-1"}),e?"Showing diff":"Diff with Raw"]})}),a.jsx($e,{children:e?"Hide diff view":"Compare proxy output against the original raw version"})]})}const rI=y.memo(function({rawBody:e,displayedBody:t,emptyLabel:n}){const r=y.useMemo(()=>iE(e,t),[e,t]);return a.jsx(fm,{result:r,emptyLabel:n})}),oI=y.memo(function({rawHeaders:e,headers:t,emptyLabel:n}){const r=y.useMemo(()=>sE(e,t),[e,t]);return a.jsx(fm,{result:r,emptyLabel:n})}),sI=y.memo(function({log:e,viewMode:t="simple",strip:n,slowResponseThresholdSeconds:r,timeDisplayFormat:o,cacheTrend:s=null,onCompareWithPrevious:i}){const[l,c]=y.useState(!1),[u,d]=y.useState(!1),[f,h]=y.useState(!1),[p,x]=y.useState(!1),[m,g]=y.useState("request"),[b,v]=y.useState(null),k=y.useRef(null),S=$r(e),C=tg(S),j=y.useMemo(()=>C.analyzeRequest(e.rawRequestBody),[C,e.rawRequestBody]),N=y.useMemo(()=>C.analyzeResponse(e.responseText),[C,e.responseText]),A=y.useMemo(()=>!n||S!=="anthropic"||e.rawRequestBody===null?null:Uj(e.rawRequestBody).body,[e.rawRequestBody,S,n])??e.rawRequestBody,O=qs(A),$=qs(e.rawRequestBody),E=qs(e.responseText),L=y.useMemo(()=>e.headers&&Object.keys(e.headers).length>0?JSON.stringify(e.headers,null,2):null,[e.headers]),w=y.useMemo(()=>e.rawHeaders&&Object.keys(e.rawHeaders).length>0?JSON.stringify(e.rawHeaders,null,2):null,[e.rawHeaders]),M=vn(A),U=vn(e.rawRequestBody),F=vn(L),B=vn(w),G=vn(e.responseText),I=y.useMemo(()=>({request:{copyLabel:"Copy request body",copyText:A,copyCopied:M.copied,onCopy:M.copy,expansion:{isExpanded:O.isExpanded,isPending:O.isPending,onToggle:O.toggle},diffWithRaw:ZA(S,t,n,e.rawRequestBody!==null)?{active:p,onToggle:()=>x(!p)}:void 0,diffWithPrevious:i===void 0?void 0:()=>{i(e)}},"raw-request":{copyLabel:"Copy raw request",copyText:e.rawRequestBody,copyCopied:U.copied,onCopy:U.copy,expansion:{isExpanded:$.isExpanded,isPending:$.isPending,onToggle:$.toggle}},headers:{copyLabel:"Copy headers",copyText:L,copyCopied:F.copied,onCopy:F.copy,expansion:null},"raw-headers":{copyLabel:"Copy raw headers",copyText:w,copyCopied:B.copied,onCopy:B.copy,expansion:null},raw:{copyLabel:"Copy response",copyText:e.responseText,copyCopied:G.copied,onCopy:G.copy,expansion:{isExpanded:E.isExpanded,isPending:E.isPending,onToggle:E.toggle}}}),[A,M,O,p,e.rawRequestBody,U,$,L,F,w,B,e.responseText,G,E,S,t,n,i]),H=y.useMemo(()=>O.parsedData!==null?C.anatomySegments(O.parsedData):null,[C,O.parsedData]),K=y.useMemo(()=>eI(O.parsedData),[O.parsedData]),z=y.useMemo(()=>{if(H!==null)return new Set(H.map(re=>re.path))},[H]),se=Qj({containerRef:k,setExpandToPath:v,ensureTabActive:()=>{m!=="request"&&g("request")}});return y.useEffect(()=>{l&&g(H!==null?"anatomy":"request")},[H,l]),y.useEffect(()=>{const re=ue=>{const ie=As(ue);ie!==null&&ie.logId===e.id&&(c(!0),g(tI(ie.tab,H)))};return window.addEventListener(Xt,re),()=>{window.removeEventListener(Xt,re)}},[H,e.id]),a.jsxs(et,{children:[a.jsxs("div",{className:"border border-border rounded-lg mb-1 overflow-hidden",children:[a.jsx(zE,{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(rm,{value:m,onValueChange:g,children:[a.jsxs(om,{className:"mx-4 mt-2",children:[t==="full"&&a.jsx(Ct,{value:"raw-headers",children:"Raw Headers"}),t==="full"&&a.jsx(Ct,{value:"headers",children:"Headers"}),H!==null&&a.jsx(Ct,{value:"anatomy",children:"Context"}),zu(S,t,n)&&a.jsx(Ct,{value:"raw-request",children:"Raw Request"}),a.jsx(Ct,{value:"request",children:"Request"}),t==="full"&&a.jsx(Ct,{value:"raw",children:"Raw Response"}),a.jsx(Ct,{value:"parsed",children:"Response"})]}),zu(S,t,n)&&a.jsx(jt,{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"}):$.parsedData!==null?a.jsx(y.Suspense,{fallback:a.jsx(Bn,{}),children:a.jsx(Pc,{data:$.parsedData,bulkDepth:$.bulkDepth,bulkRevision:$.bulkRevision})}):a.jsx("pre",{className:"font-mono text-xs whitespace-pre-wrap break-words",children:e.rawRequestBody})})}),a.jsx(jt,{value:"request",children:m==="request"&&a.jsxs("div",{className:"px-4 pt-1 pb-3",children:[a.jsx(fA,{summary:K,calledToolNames:N.toolNames??[]}),p?a.jsx(rI,{rawBody:e.rawRequestBody,displayedBody:A,emptyLabel:"No transformation applied; raw and sent request bodies are identical."}):a.jsx("div",{ref:k,children:A===null?a.jsx("p",{className:"text-xs text-muted-foreground italic",children:"No request body"}):O.parsedData!==null?a.jsx(y.Suspense,{fallback:a.jsx(Bn,{}),children:a.jsx(Pc,{data:O.parsedData,bulkDepth:O.bulkDepth,bulkRevision:O.bulkRevision,anatomyPaths:z,expandToPath:b})}):a.jsx("pre",{className:"font-mono text-xs whitespace-pre-wrap break-words",children:A})})]})}),H!==null&&a.jsx(jt,{value:"anatomy",children:m==="anatomy"&&a.jsx(y.Suspense,{fallback:a.jsx(Bn,{}),children:a.jsx(qj,{parsed:O.parsedData,inputTokens:e.inputTokens??null,model:e.model,segments:H,onSegmentActivate:se})})}),t==="full"&&a.jsx(jt,{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:HA(t,e.rawHeaders!==void 0&&Object.keys(e.rawHeaders).length>0)&&a.jsx(nI,{active:f,onClick:re=>{re.stopPropagation(),h(!f)}})}),f?a.jsx(oI,{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],[ue])=>re.localeCompare(ue)).map(([re,ue])=>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:ue,children:ue})]},re))}):a.jsx("p",{className:"text-xs text-muted-foreground italic",children:"No headers captured"})]})}),t==="full"&&a.jsx(jt,{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],[ue])=>re.localeCompare(ue)).map(([re,ue])=>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:ue,children:ue})]},re))}):a.jsx("p",{className:"text-xs text-muted-foreground italic",children:"No raw headers captured"})})}),a.jsx(jt,{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(y.Suspense,{fallback:a.jsx(Bn,{}),children:a.jsx(Gj,{text:e.responseText,defaultExpandDepth:0,bulkDepth:E.bulkDepth,bulkRevision:E.bulkRevision})}):a.jsx("p",{className:"text-xs text-muted-foreground italic",children:"No response"}),e.streaming===!0&&a.jsx(y.Suspense,{fallback:a.jsx(Bn,{}),children:a.jsx(Jj,{logId:e.id,truncated:e.streamingChunksPath!==null})})]})}),a.jsx(jt,{value:"parsed",children:m==="parsed"&&a.jsx("div",{className:"px-4 pt-1 pb-3",children:a.jsx(y.Suspense,{fallback:a.jsx(Bn,{}),children:a.jsx(Kj,{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(y.Suspense,{fallback:null,children:a.jsx(Zj,{log:e,open:u,onOpenChange:d})})]})});function iI({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=y.useMemo(()=>Wo(s),[s]),h=y.useMemo(()=>kj(s),[s]),p=i&&l?{role:"button",tabIndex:0,className:"cursor-pointer",onClick:x=>{x.stopPropagation(),l()},onKeyDown:x=>{(x.key==="Enter"||x.key===" ")&&(x.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 aI({event:e}){const t=vn(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(Wr,{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(en,{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(it,{className:"size-3.5"}):a.jsx(Wt,{className:"size-3.5"})})]},e.id)}function lI({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(aI,{event:t},t.id))})}const Ru=180;function cI(e,t){return e||t}function uI(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:cj(o)});const s=n[n.length-1];s!==void 0&&Yh(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=$r(o),l=$r(s);i==="unknown"||i!==l||t.set(o.id,s)}return t}function ig(e){if(e===null)return null;try{const t=JSON.parse(e);return typeof t=="string"?JSON.parse(t):t}catch{return null}}function ag(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>Ru?`${n.slice(0,Ru-1)}...`:n}function lg(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 pI(e){const t=ig(e.responseText),n=Oe(t,"content");if(!Array.isArray(n))return[];const r=[];for(const o of n){if(Oe(o,"type")!=="tool_use")continue;const i=Oe(o,"name");if(typeof i!="string"||i.length===0)continue;const l=Oe(o,"input");r.push({id:`${String(e.id)}-anthropic-tool-${String(r.length)}`,logId:e.id,index:r.length,provider:"anthropic",name:i,argumentsText:lg(l),argumentsPreview:ag(l)})}return r}function hI(e){const t=ig(e.responseText),n=Oe(t,"choices");if(!Array.isArray(n))return[];const r=[];for(const o of n){const s=Oe(o,"message"),i=Oe(s,"tool_calls");if(Array.isArray(i))for(const l of i){const c=Oe(l,"function"),u=Oe(c,"name");if(typeof u!="string"||u.length===0)continue;const d=Oe(c,"arguments");r.push({id:`${String(e.id)}-openai-tool-${String(r.length)}`,logId:e.id,index:r.length,provider:"openai",name:u,argumentsText:lg(d),argumentsPreview:ag(d)})}}return r}function wl(e){switch($r(e)){case"anthropic":return pI(e);case"openai":return hI(e);case"unknown":return[]}}function mI(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+=wl(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 ui(e){return e<1e3?`${e}ms`:`${(e/1e3).toFixed(1)}s`}const gI=y.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?Yh(f):!1,p=t[d]?.log.responseStatus===null,x=t.length===1,m=uI(t.length,h,p),[g,b]=y.useState(!1),v=y.useRef(!1);y.useEffect(()=>{m?h&&!v.current&&b(!0):b(!1),v.current=h},[m,h]),y.useEffect(()=>{const U=F=>{const B=As(F);B!==null&&t.some(G=>G.log.id===B.logId)&&m&&b(!1)};return window.addEventListener(Xt,U),()=>{window.removeEventListener(Xt,U)}},[m,t]);const k=y.useCallback(()=>{m&&b(U=>!U)},[m]),S=y.useMemo(()=>{let U=0,F=0,B=null,G=!1;for(const I of t)I.log.inputTokens!==null&&(U+=I.log.inputTokens,G=!0),I.log.outputTokens!==null&&(F+=I.log.outputTokens,G=!0),I.log.elapsedMs!==null&&(B=B===null?I.log.elapsedMs:Math.max(B,I.log.elapsedMs));return{totalInput:U,totalOutput:F,hasTokens:G,maxElapsed:B}},[t,d]),C=y.useMemo(()=>{const U=new Set;for(const F of t){const B=em(F.log.model);B!=="unknown"&&U.add(B)}return[...U]},[t]),j=y.useMemo(()=>Wo(t[0]?.log.id??0),[t]),N=y.useMemo(()=>Wo(t[d]?.log.id??0),[t,d]),T=c%2===0?"bg-muted/10":"bg-muted/25",A=S.maxElapsed!==null&&o>0&&S.maxElapsed>o*1e3,O=y.useMemo(()=>{const U=new Map;for(const F of t){const B=wl(F.log);B.length>0&&U.set(F.log.id,B)}return U},[t]),[$,E]=y.useState(0),L=y.useRef(null);y.useEffect(()=>{const U=L.current;if(!U)return;let F=0;const B=new ResizeObserver(()=>{window.cancelAnimationFrame(F),F=window.requestAnimationFrame(()=>E(G=>G+1))});return B.observe(U),()=>{B.disconnect(),window.cancelAnimationFrame(F)}},[]);const w=t[0]?.log.id??c,M=`Turn ${String(c+1)}`;return a.jsx("div",{ref:L,tabIndex:g?void 0:0,role:g?void 0:"group","aria-label":g?void 0:M,"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:U=>{(U.key==="Enter"||U.key===" ")&&(U.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:U=>{U.stopPropagation(),k()},onKeyDown:U=>{(U.key==="Enter"||U.key===" ")&&(U.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:U=>{U.stopPropagation(),k()},onKeyDown:U=>{(U.key==="Enter"||U.key===" ")&&(U.preventDefault(),k())},children:a.jsx(N,{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(U=>a.jsx(tm,{provider:U,className:"size-4"},U))}),S.maxElapsed!==null&&a.jsx(et,{children:a.jsxs(De,{children:[a.jsx(Fe,{asChild:!0,children:a.jsxs("span",{className:ve("flex items-center gap-1 shrink-0",A?"text-amber-400":"text-muted-foreground"),children:[a.jsx(cn,{className:"size-3"}),a.jsx("span",{className:"font-mono tabular-nums",children:ui(S.maxElapsed)}),A&&a.jsx(Io,{className:"size-3","aria-label":"Slow response"})]})}),a.jsx($e,{children:A?`Slow response: ${ui(S.maxElapsed)} exceeds ${ui(o*1e3)}`:"Slowest request in this turn"})]})}),S.hasTokens&&a.jsxs("span",{className:"flex items-center gap-1 shrink-0",children:[a.jsx(Pr,{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(en,{className:"size-4 text-muted-foreground shrink-0"})]})]}):t.map((U,F)=>{const{log:B,stopReason:G}=U,I=F===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(iI,{stopReason:G,isPending:B.responseStatus===null,isFirst:F===0,isTurnStart:I,isOnlyEntry:x,crabIndex:B.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(sI,{log:B,viewMode:n,strip:r,slowResponseThresholdSeconds:o,timeDisplayFormat:u,cacheTrend:s?.get(B.id)??null,onCompareWithPrevious:l.has(B.id)?i:void 0}),a.jsx(lI,{events:O.get(B.id)??[]})]})]},B.id)})})}),kl=Xe(["episode","procedure","preference","project-fact"]),xI=Xe(["draft","promoted","failed"]),cg=le({source:je("agent-inspector"),sessionId:W(),logIds:Ce(fe().int().positive()),project:W().nullable(),models:Ce(W())}),yI=le({redacted:nt(),patterns:Ce(W())}),Jr=le({id:W(),type:kl,title:W(),content:W(),tags:Ce(W()),source:je("agent-inspector"),sessionId:W(),logIds:Ce(fe().int().positive()),evidence:cg,status:xI,createdAt:W(),updatedAt:W(),openClawMemoryId:W().nullable(),error:W().nullable(),redaction:yI});le({idempotencyKey:W(),type:kl,title:W(),content:W(),tags:Ce(W()),source:je("agent-inspector"),project:W().nullable(),evidence:cg});const bI=le({id:W(),type:kl.or(W()),title:W(),content:W(),score:fe().nullable(),source:W().nullable(),project:W().nullable(),evidence:yi().optional()});le({results:Ce(bI),warning:W().nullable()});const vI=le({candidates:Ce(Jr)}),wI=le({candidate:Jr}),kI=le({error:W().optional(),candidate:Jr.optional()}),_I=le({candidate:Jr}),SI={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 na(e){return e===null?"-":e<1e3?`${String(e)}ms`:`${(e/1e3).toFixed(1)}s`}function CI(e,t,n){return e===null||t===null?null:Ea(e,t,n)}function jI(e){return`${String(e)} candidate${e===1?"":"s"}`}function ug(e){return`log-${String(e)}`}function dg(e){const t=ug(e),n=document.getElementById(t);window.history.replaceState(null,"",`#${t}`),n instanceof HTMLElement&&(n.scrollIntoView({block:"center",behavior:"smooth"}),n.focus({preventScroll:!0}))}function EI(e){for(const t of e)if(t.responseStatus!==null&&t.responseStatus>=400)return t;return null}function NI(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 TI(e){for(const t of e)if(wl(t).length>0)return t;return null}function AI(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=TI(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=EI(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=NI(e.logs);if(o!==null&&e.summary.maxElapsedMs!==null&&t.push({kind:"slow",title:`Slowest ${na(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 II(e){switch(e){case"session":return a.jsx(ss,{className:"size-3.5 text-blue-400"});case"tool":return a.jsx(Wr,{className:"size-3.5 text-sky-400/70"});case"slow":return a.jsx(cn,{className:"size-3.5 text-amber-400"});case"failure":return a.jsx(cf,{className:"size-3.5 text-destructive"});case"candidate":return a.jsx(af,{className:"size-3.5 text-emerald-400"})}}function zI({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&&dg(t.logId)},disabled:t.logId===null,children:[II(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 RI(e){switch(e){case"draft":return"Draft";case"promoted":return"Promoted";case"failed":return"Failed"}}function PI(e,t){if(t)return"Promoting";switch(e.status){case"draft":return"Promote";case"failed":return"Retry";case"promoted":return"Promoted"}}function OI(e){return e.redaction.redacted?`Redacted ${e.redaction.patterns.join(", ")}`:"No sensitive pattern matched"}function MI(e,t){const n=e.replace(/\s+/g," ").trim();return n.length<=t?n:`${n.slice(0,t-3)}...`}function LI(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 Pu(e){return e.join(", ")}function DI(e){return e.split(",").map(t=>t.trim()).filter(t=>t.length>0)}function FI({candidate:e,isPromoting:t,isUpdating:n,onPromoteCandidate:r,onUpdateCandidate:o}){const[s,i]=y.useState(!1),[l,c]=y.useState(e.type),[u,d]=y.useState(e.title),[f,h]=y.useState(e.content),[p,x]=y.useState(Pu(e.tags)),[m,g]=y.useState(null),b=e.status!=="promoted",v=e.status!=="promoted",k=y.useCallback(()=>{c(e.type),d(e.title),h(e.content),x(Pu(e.tags)),g(null)},[e.content,e.tags,e.title,e.type]),S=y.useCallback(async()=>{const C=u.trim(),j=f.trim(),N=DI(p);if(C.length===0){g("Title is required.");return}if(j.length===0){g("Content is required.");return}if(N.length===0){g("At least one tag is required.");return}g(null),await o(e.id,{type:l,title:C,content:j,tags:N})&&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=Jr.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=>x(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(Gl,{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(Re,{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(ja,{className:"size-3.5"}),"Cancel"]}),a.jsxs(Re,{type:"button",variant:"outline",size:"sm",className:"h-7 gap-1.5 px-2 text-xs",disabled:n,onClick:()=>{S()},children:[n?a.jsx(Jl,{className:"size-3.5 animate-spin"}):a.jsx(jw,{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(Et,{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(Et,{variant:"outline",className:ve("h-5 shrink-0 px-1.5 text-[10px] font-mono",SI[e.status]),children:RI(e.status)})]}),a.jsx("p",{className:"mt-1 text-[11px] leading-relaxed text-muted-foreground",title:e.content,children:MI(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(qv,{className:"size-3"}),LI(e.logIds)]}),a.jsxs("span",{className:"inline-flex items-center gap-1",children:[a.jsx(Gl,{className:"size-3"}),OI(e)]}),e.status==="promoted"&&a.jsxs("span",{className:"inline-flex items-center gap-1 text-emerald-500",children:[a.jsx(Kl,{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(cf,{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:`#${ug(C)}`,onClick:j=>{j.preventDefault(),dg(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(Re,{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(ff,{className:"size-3"}),"Review"]}),a.jsxs(Re,{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(Jl,{className:"size-3 animate-spin"}):b?a.jsx(zv,{className:"size-3"}):a.jsx(Kl,{className:"size-3"}),PI(e,t)]})]})]})}function $I({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(FI,{candidate:s,isPromoting:t.has(s.id),isUpdating:n.has(s.id),onPromoteCandidate:r,onUpdateCandidate:o},s.id))})}function BI({logs:e,scopeId:t,slowResponseThresholdSeconds:n,showRollupMetrics:r,timeDisplayFormat:o}){const[s,i]=y.useState([]),[l,c]=y.useState(!0),[u,d]=y.useState({status:"idle",error:null}),[f,h]=y.useState(()=>new Set),[p,x]=y.useState(()=>new Set),m=s.length>0,g=y.useMemo(()=>mI(e,n,s.length),[s.length,e,n]),b=y.useMemo(()=>AI({logs:e,scopeId:t,summary:g,candidates:s}),[s,e,t,g]),v=r||g.maxElapsedMs!==null,k=y.useMemo(()=>CI(g.startedAt,g.endedAt,o),[g.endedAt,g.startedAt,o]),S=y.useCallback(()=>{e.length===0||u.status==="loading"||(d({status:"loading",error:null}),(async()=>{try{const N=await fetch(`/api/knowledge/sessions/${encodeURIComponent(t)}/candidates`,{method:"POST"});if(!N.ok){const A=await wn(N,`Candidate generation failed with ${String(N.status)}`);d({status:"failed",error:A});return}const T=await Jt(N,vI);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(N){d({status:"failed",error:N instanceof Error?N.message:"Candidate response was invalid"})}})())},[u.status,e.length,t]),C=y.useCallback(N=>{h(T=>{if(T.has(N))return T;const A=new Set(T);return A.add(N),A}),(async()=>{try{const T=await fetch(`/api/knowledge/candidates/${encodeURIComponent(N)}/promote`,{method:"POST"}),A=await T.json().catch(()=>null),O=wI.safeParse(A);if(T.ok&&O.success){i(E=>E.map(L=>L.id===O.data.candidate.id?O.data.candidate:L)),d({status:"ready",error:null});return}const $=kI.safeParse(A);$.success&&$.data.candidate!==void 0&&i(E=>E.map(L=>L.id===$.data.candidate?.id?$.data.candidate:L)),d({status:"failed",error:$.success?$.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 A=new Set(T);return A.delete(N),A})}})()},[]),j=y.useCallback(async(N,T)=>{x(A=>{if(A.has(N))return A;const O=new Set(A);return O.add(N),O});try{const A=await fetch(`/api/knowledge/candidates/${encodeURIComponent(N)}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify(T)});if(!A.ok){const $=await wn(A,`Candidate update failed with ${String(A.status)}`);return d({status:"failed",error:$}),!1}const O=await Jt(A,_I);return i($=>$.map(E=>E.id===O.candidate.id?O.candidate:E)),d({status:"ready",error:null}),!0}catch(A){return d({status:"failed",error:A instanceof Error?A.message:"Candidate update failed"}),!1}finally{x(A=>{const O=new Set(A);return O.delete(N),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(ss,{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(Wr,{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(Pr,{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(Pr,{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(cn,{className:"size-3.5"}),r&&a.jsx("span",{className:"font-mono",children:na(g.totalElapsedMs)}),g.maxElapsedMs!==null&&a.jsxs("span",{className:"font-mono text-muted-foreground/70",children:["max ",na(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(Io,{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(Et,{variant:"outline",className:"h-6 px-2 text-[10px] font-mono",children:jI(g.knowledgeCandidateCount)}),a.jsxs(Re,{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(Rr,{className:"size-3.5 animate-spin"}):a.jsx(af,{className:"size-3.5"}),"Candidate"]}),m&&a.jsx(Re,{type:"button",variant:"ghost",size:"icon",className:"size-7 text-muted-foreground",onClick:()=>c(N=>!N),"aria-expanded":l,"aria-label":l?"Collapse memory candidates":"Expand memory candidates",children:l?a.jsx(Ut,{className:"size-3.5"}):a.jsx(en,{className:"size-3.5"})})]}),u.status==="failed"&&a.jsx("p",{className:"mt-2 text-xs text-destructive",children:u.error}),a.jsx(zI,{insights:b}),l&&a.jsx($I,{candidates:s,promotingCandidateIds:f,updatingCandidateIds:p,onPromoteCandidate:C,onUpdateCandidate:j})]})}function UI(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 fg=y.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,x]=y.useState(!1),m=f??p,g=y.useCallback(T=>{if(h!==void 0){h(T);return}x(T)},[h]),b=y.useMemo(()=>UI(e.logs),[e.logs]),v=e.logs[0]?.timestamp??new Date().toISOString(),k=e.logs[e.logs.length-1]?.timestamp??new Date().toISOString(),S=ij(e.logs),C=e.logs.some(T=>T.responseStatus===null),j=c&&!u,N=y.useMemo(()=>dI(e.logs),[e.logs]);return y.useEffect(()=>{const T=A=>{if(c)return;const O=As(A);O!==null&&e.logs.some($=>$.id===O.logId)&&g(!0)};return window.addEventListener(Xt,T),()=>{window.removeEventListener(Xt,T)}},[e.logs,g,c]),a.jsxs("div",{className:"mb-2",children:[!c&&a.jsx(oj,{conversationId:e.conversationId,startTime:v,endTime:k,totalCalls:e.logs.length,totalInputTokens:b.totalInputTokens,totalOutputTokens:b.totalOutputTokens,apiFormat:sj(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))}),cI(c,m)&&a.jsxs("div",{children:[a.jsx(BI,{logs:e.logs,scopeId:e.conversationId,slowResponseThresholdSeconds:r,showRollupMetrics:j,timeDisplayFormat:d}),N.map(T=>a.jsx(gI,{entries:T.entries,viewMode:t,strip:n,slowResponseThresholdSeconds:r,timeDisplayFormat:d,cacheTrends:o,onCompareWithPrevious:s,comparisonPredecessors:i,turnIndex:T.turnIndex},T.turnIndex))]})]})});function WI({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 VI="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 HI({className:e}){return a.jsx("img",{src:VI,alt:"Model Context Protocol","aria-hidden":"true",className:ve("inline-block size-8 object-contain invert",e)})}function qo({...e}){return a.jsx(p5,{"data-slot":"select",...e})}function Ko({...e}){return a.jsx(m5,{"data-slot":"select-value",...e})}function Jo({className:e,size:t="default",children:n,...r}){return a.jsxs(h5,{"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(g5,{asChild:!0,children:a.jsx(Ut,{className:"size-4 opacity-50"})})]})}function Go({className:e,children:t,position:n="popper",align:r="center",...o}){return a.jsx(x5,{children:a.jsxs(y5,{"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(ZI,{}),a.jsx(b5,{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(qI,{})]})})}function Pt({className:e,children:t,...n}){return a.jsxs(v5,{"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(k5,{children:a.jsx(it,{className:"size-4"})})}),a.jsx(w5,{children:t})]})}function ZI({className:e,...t}){return a.jsx(_5,{"data-slot":"select-scroll-up-button",className:ve("flex cursor-default items-center justify-center py-1",e),...t,children:a.jsx(bv,{className:"size-4"})})}function qI({className:e,...t}){return a.jsx(S5,{"data-slot":"select-scroll-down-button",className:ve("flex cursor-default items-center justify-center py-1",e),...t,children:a.jsx(Ut,{className:"size-4"})})}function KI(){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 JI(){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 GI(){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 YI=le({name:W(),apiKey:W(),format:Xe(["anthropic","openai"]),anthropicBaseUrl:W(),openaiBaseUrl:W(),models:Ce(W()),sourceTool:Xe(["claude-code","opencode","mimo-code"]),alreadyExists:nt()}),XI=le({providers:Ce(YI),warnings:Ce(W()).optional()}),QI=le({success:nt().optional(),imported:fe().optional(),message:W().optional(),errors:Ce(W()).optional()}),ez={"claude-code":KI,opencode:JI,"mimo-code":GI};function tz({open:e,onOpenChange:t,onImportComplete:n}){const[r,o]=y.useState(!1),[s,i]=y.useState(null),[l,c]=y.useState([]),[u,d]=y.useState([]),[f,h]=y.useState(new Set),[p,x]=y.useState(!1),[m,g]=y.useState(null),[b,v]=y.useState(null),k=y.useCallback(()=>{o(!0),i(null),d([]),c([]),h(new Set),g(null),v(null),fetch("/api/providers/scan").then(N=>N.ok?N.json().then(T=>{const A=XI.safeParse(T);if(!A.success){i(`Invalid response: ${A.error.message}`);return}c(A.data.providers),d(A.data.warnings??[]);const O=new Set;A.data.providers.forEach(($,E)=>{$.alreadyExists||O.add(E)}),h(O)}):N.text().then(T=>{i(`Scan failed (${N.status}): ${T}`)})).catch(N=>{i(N instanceof Error?N.message:String(N))}).finally(()=>{o(!1)})},[]);y.useEffect(()=>{e&&k()},[e,k]);const S=y.useCallback(N=>{h(T=>{const A=new Set(T);return A.has(N)?A.delete(N):A.add(N),A})},[]),C=y.useCallback(()=>{const N=l.filter((O,$)=>f.has($));if(N.length===0)return;x(!0),v(null),g(null);const T=new Date().toISOString(),A=N.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:A})}).then(O=>O.json()).then(O=>{const $=QI.safeParse(O);if(!$.success){v(`Invalid response: ${$.error.message}`);return}const E=$.data;c(L=>L.map((w,M)=>f.has(M)?{...w,alreadyExists:!0}:w)),h(new Set),E.errors!==void 0&&E.errors.length>0&&E.message!==void 0?g(E.message):g(`Imported ${E.imported??N.length} provider(s)`),n()}).catch(O=>{v(O instanceof Error?O.message:String(O))}).finally(()=>{x(!1)})},[l,f,n]),j=l.some(N=>!N.alreadyExists);return a.jsx(Qa,{open:e,onOpenChange:t,children:a.jsxs(el,{className:"max-w-xl max-h-[80vh] overflow-hidden flex flex-col",children:[a.jsxs(tl,{children:[a.jsx(nl,{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(Rr,{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(zr,{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((N,T)=>a.jsxs("label",{className:`flex items-start gap-3 p-3 border rounded-md ${N.alreadyExists?"":"cursor-pointer hover:bg-muted/50"}`,children:[!N.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 A=ez[N.sourceTool];return A===void 0?null:a.jsx(A,{})})(),N.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:[N.models.slice(0,4).join(", "),N.models.length>4?` +${N.models.length-4} more`:""]}),a.jsx("div",{className:"text-xs text-muted-foreground mt-0.5 truncate",children:N.format==="anthropic"?N.anthropicBaseUrl:N.openaiBaseUrl}),a.jsx("div",{className:"text-xs text-muted-foreground mt-0.5 font-mono",children:N.apiKey.length>8?`${N.apiKey.slice(0,4)}••••${N.apiKey.slice(-4)}`:"••••"})]})]},`${N.sourceTool}-${N.name}`)),u.length>0&&a.jsx("div",{className:"text-xs text-muted-foreground space-y-1 border-t pt-2",children:u.map((N,T)=>a.jsxs("div",{className:"flex items-center gap-1",children:[a.jsx(zr,{className:"size-3"}),N]},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(Re,{variant:"outline",size:"sm",onClick:k,disabled:r,children:[a.jsx(Rr,{className:`size-3 mr-1 ${r?"animate-spin":""}`}),"Rescan"]}),a.jsxs(Re,{size:"sm",onClick:C,disabled:!j||f.size===0||p,children:[a.jsx(_a,{className:"size-3 mr-1"}),p?"Importing...":`Import Selected (${f.size})`]})]})]})})}function pg(e){return e.length<=8?"••••••••":e.slice(0,4)+"••••••••"+e.slice(-4)}const hg=le({id:W().min(1),aliases:Ce(W()).optional().default([]),contextWindow:fe().int().positive().optional(),outputLimit:fe().int().positive().optional(),sourceUrl:W().optional()}),nz=le({name:W().min(1).optional(),aliases:Ce(W()).optional().default([]),baseUrls:Ce(W()).optional().default([]),models:Ce(hg).min(1)});le({version:fe().int().positive().optional(),updatedAt:W().optional(),providers:Ce(nz).optional().default([]),models:Ce(hg).optional().default([])});function Ou(e){return e.trim().toLowerCase().replace(/\s+/g,"-")}function rz(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=Ou(t);return(e.modelMetadata??[]).find(o=>Ou(o.model)===n)??null}function oz(e){const t=rz(e);return t.length===0?!1:t.every(n=>{const r=_l(e,n);return r!==null&&r.contextWindow!==void 0})}function sz(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 iz={deepseek:"https://api-docs.deepseek.com/zh-cn/"};function az(e){return Object.prototype.hasOwnProperty.call(e,"success")}function lz(e){return Object.prototype.hasOwnProperty.call(e,"notConfigured")}function ht(e){return e!==void 0&&e.trim()!==""}function ra(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 Mu(e){return ra(e)!==void 0}function cz(e){const t=e.debug;return ht(e.error?.hint)||ht(e.error?.details)||ht(e.rawResponse)||ht(t?.requestUrl)||ht(t?.requestBody)||ht(t?.responseBody)||Mu(t?.requestHeaders)||Mu(t?.responseHeaders)||t?.responseStatus!==void 0}function on({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 vr({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 uz({result:e}){const t=e.debug,n=t?.requestUrl,r=t?.requestMethod??"POST",o=ra(t?.requestHeaders),s=ra(t?.responseHeaders),i=t?.responseStatus!==void 0?`${t.responseStatus}${ht(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:[ht(e.error?.hint)&&a.jsx(on,{title:"Hint",children:a.jsx("div",{children:e.error.hint})}),ht(e.error?.details)&&a.jsx(on,{title:"Error",children:a.jsx(vr,{value:e.error.details})}),ht(n)&&a.jsx(on,{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(on,{title:"Request Headers",children:a.jsx(vr,{value:o})}),ht(t?.requestBody)&&a.jsx(on,{title:"Request Body",children:a.jsx(vr,{value:t.requestBody})}),ht(i)&&a.jsx(on,{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(on,{title:"Response Headers",children:a.jsx(vr,{value:s})}),ht(l)&&a.jsx(on,{title:"Response Body",children:a.jsx(vr,{value:l})})]})}function mo({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(Lu,{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(Lu,{result:e.streaming})]})]})}function dz(e){const t={className:"size-3",strokeWidth:2};switch(e){case"timeout":return a.jsx(cn,{...t});case"network_unreachable":return a.jsx(Vw,{...t});case"connection_refused":return a.jsx(Zw,{...t});case"auth_failed":return a.jsx(aw,{...t});case"rate_limited":return a.jsx(Qv,{...t});case"server_error":return a.jsx(zw,{...t});case"invalid_response":return a.jsx(Nv,{...t});case"unknown":return a.jsx(zr,{...t});default:return a.jsx(zr,{...t})}}function Lu({result:e}){const[t,n]=y.useState(!1);if(!az(e))return lz(e)?a.jsxs("div",{className:"flex items-center gap-1 text-xs text-muted-foreground shrink-0",children:[a.jsx(uw,{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(_i,{className:"size-3 animate-spin"}),a.jsx("span",{children:"Testing..."})]});if(e.success){const l=[];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"));const c=[];for(let u=0;u<l.length;u++)u>0&&c.push(", "),c.push(l[u]);return a.jsx(et,{children:a.jsxs(De,{children:[a.jsx(Fe,{asChild:!0,children:a.jsxs("div",{className:"flex items-center gap-1 text-xs text-green-600 shrink-0",children:[a.jsx(Cv,{className:"size-3"}),a.jsx("span",{children:"Connected"}),l.length>0&&a.jsxs("span",{className:"text-muted-foreground",children:["(",c,")"]})]})}),a.jsx($e,{children:"Connection test passed"})]})})}const r=e.error,o=r?.message??"Connection failed",s=r?.type??"unknown",i=cz(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:[dz(s),a.jsx(et,{children:a.jsxs(De,{children:[a.jsx(Fe,{asChild:!0,children:a.jsx("span",{className:"truncate",children:o})}),a.jsx($e,{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(Sa,{className:"size-3"}):a.jsx(Ca,{className:"size-3"}),a.jsx("span",{children:t?"Hide":"Details"})]})]}),t&&i&&a.jsx(uz,{result:e})]})}function fz(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 pz(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 hz({provider:e,testResults:t,isTesting:n,testingTimeLeft:r,isHighlighted:o,onEdit:s,onDelete:i,onTest:l,onRefreshMetadata:c,isRefreshingMetadata:u=!1}){const[d,f]=y.useState(!1),[h,p]=y.useState(!1),[x,m]=y.useState(!1);function g(){navigator.clipboard.writeText(e.apiKey).catch(()=>{}),p(!0),setTimeout(()=>p(!1),2e3)}const b=e.apiDocsUrl??Object.entries(iz).find(([C])=>e.name.toLowerCase().includes(C))?.[1],v=oz(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(et,{children:a.jsxs(De,{children:[a.jsx(Fe,{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($e,{children:"Company-provided API key"})]})}),e.source==="personal"&&a.jsx(et,{children:a.jsxs(De,{children:[a.jsx(Fe,{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($e,{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(uf,{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),N=pz(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:Af(j.contextWindow)}),N!==null&&a.jsx(et,{children:a.jsxs(De,{children:[a.jsx(Fe,{asChild:!0,children:a.jsx("a",{href:N.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":N.title,children:N.label})}),a.jsx($e,{children:N.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(Re,{type:"button",variant:"outline",size:"sm",onClick:()=>c?.(e.id),className:"h-6 gap-1 px-2 text-xs",disabled:u,children:[a.jsx(_i,{className:`size-3 ${u?"animate-spin":""}`}),S]}),!k&&a.jsx(Re,{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:pg(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(Sa,{className:"size-4"}):a.jsx(Ca,{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(it,{className:"size-4 text-green-500"}):a.jsx(Wt,{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(mo,{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(mo,{results:t.openai})]}),t?.testedAt!==void 0&&a.jsxs("div",{className:"text-xs text-muted-foreground flex items-center gap-1",children:[a.jsx(cn,{className:"size-3"}),a.jsxs("span",{children:["Tested ",fz(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:[x?a.jsx(Ut,{className:"size-3"}):a.jsx(en,{className:"size-3"}),"Model Test Results (",Object.keys(t.models).length,")"]}),x&&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(mo,{results:j.anthropic})}),e.openaiBaseUrl!==void 0&&e.openaiBaseUrl!==""&&a.jsx("td",{className:"py-1 px-2 align-top",children:a.jsx(mo,{results:j.openai})})]},C))})]})})]}),a.jsxs("div",{className:"flex gap-2 pt-1 border-t",children:[l!==void 0&&a.jsxs(Re,{variant:"outline",size:"sm",onClick:()=>l(e.id),className:"text-xs h-7 gap-1",disabled:n??!1,children:[a.jsx(_i,{className:`size-3 ${n??!1?"animate-spin":""}`}),n??!1?r!==void 0?`Testing (${r}s)`:"Testing...":"Test"]}),a.jsxs(Re,{variant:"outline",size:"sm",onClick:()=>s(e),className:"text-xs h-7 gap-1",disabled:n??!1,children:[a.jsx(ff,{className:"size-3"}),"Edit"]}),a.jsxs(Re,{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(hf,{className:"size-3"}),"Delete"]})]})]})}const Du=["zhipu","zhipuai","bigmodel","z.ai","zai","glm"],Fu=["zhipu coding","glm coding","bigmodel coding","z.ai coding","zai coding"],mz={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"}},$u=["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"],Bu=["glm-5","glm-5.1","glm-5.2","qwen3.6-plus","qwen3.7-max"],Uu=["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"],oa="__unset__",Yo="__custom__",mg=[{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 bn(){return{contextWindow:"",contextWindowMode:"unset",outputLimit:""}}function Wu(e){return e.trim().toLowerCase().replace(/\s+/g,"-")}function gg(e,t){const n=Wu(t);return e?.modelMetadata?.find(r=>Wu(r.model)===n)??null}function xg(e){const t=Ro(e);if(t===null)return null;for(const n of mg)if(Ro(n.value)===t)return n.value;return null}function gz(e){return e.trim()===""?"unset":xg(e)!==null?"preset":"custom"}function xz(e){switch(e.contextWindowMode){case"unset":return oa;case"custom":return Yo;case"preset":return xg(e.contextWindow)??Yo}}function di(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 Vu(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 Hu(e,t){return t.map(n=>{const r=gg(e,n),o=r?.contextWindow!==void 0?tk(r.contextWindow):"";return{contextWindow:o,contextWindowMode:gz(o),outputLimit:r?.outputLimit?.toString()??""}})}function Zu(e){const t=e.trim();if(t==="")return null;const n=Number(t);return!Number.isInteger(n)||n<=0?null:n}function yz({provider:e,onSubmit:t,onCancel:n}){const[r,o]=y.useState(e?.name??""),[s,i]=y.useState(e?.apiKey??""),[l,c]=y.useState(!1),[u,d]=y.useState(!1),f=e?.models,[h,p]=y.useState(f!==void 0&&f.length>0?f:[""]),[x,m]=y.useState(()=>Hu(e,f!==void 0&&f.length>0?f:[""])),[g,b]=y.useState("anthropic"),[v,k]=y.useState(e?.anthropicBaseUrl??""),[S,C]=y.useState(e?.openaiBaseUrl??""),[j,N]=y.useState(e?.apiDocsUrl??""),[T,A]=y.useState(e?.modelMetadataUrl??""),[O,$]=y.useState(e?.source),[E,L]=y.useState({}),[w,M]=y.useState(!1),[U,F]=y.useState(null),B=y.useRef([]);y.useEffect(()=>{if(U===null)return;const Z=U;function J(V){if(!(V.target instanceof Node))return;const oe=B.current[Z];oe!=null&&!oe.contains(V.target)&&F(null)}return document.addEventListener("mousedown",J),()=>document.removeEventListener("mousedown",J)},[U]);const[G,I]=y.useState(!1),[H,K]=y.useState(!1),z=r.toLowerCase().includes("minimax"),se=r.toLowerCase().includes("alibaba"),re=[...Du,...Fu].some(Z=>r.toLowerCase().includes(Z)),ue=z?$u:re?Uu:se?Bu:[],ie=e?.modelMetadata?.some(Z=>Z.contextWindow!==void 0)??!1;function de(){navigator.clipboard.writeText(s).catch(()=>{}),d(!0),setTimeout(()=>d(!1),2e3)}y.useEffect(()=>{if(e){o(e.name),i(e.apiKey);const Z=(e.models?.length??0)>0?e.models:[""];p(Z),m(Hu(e,Z)),k(e.anthropicBaseUrl??""),C(e.openaiBaseUrl??""),N(e.apiDocsUrl??""),A(e.modelMetadataUrl??""),$(e.source),I(!1),K(!1)}},[e]),y.useEffect(()=>{const Z=r.toLowerCase();for(const[J,V]of Object.entries(mz))if(Z.includes(J)){V.anthropicBaseUrl!==void 0&&!G&&k(V.anthropicBaseUrl),V.openaiBaseUrl!==void 0&&!H&&C(V.openaiBaseUrl),V.apiDocsUrl!==void 0&&!j&&N(V.apiDocsUrl),J==="minimax"&&h.length===1&&h[0]===""&&p([$u[0]??""]),J==="alibaba"&&h.length===1&&h[0]===""&&p([Bu[0]??""]),(Du.includes(J)||Fu.includes(J))&&h.length===1&&h[0]===""&&p([Uu[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"),x.forEach((J,V)=>{const oe=Ro(J.contextWindow),Y=Zu(J.outputLimit);J.contextWindow.trim()!==""&&oe===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"),oe!==null&&Y!==null&&Y>oe&&(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"),L(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 oe=[...V];return oe[Z]=J,oe})}function ke(Z,J){m(V=>{const oe=[...V];return oe[Z]={...oe[Z]??bn(),...J},oe})}function ze(Z,J){switch(J){case oa:ke(Z,{contextWindow:"",contextWindowMode:"unset"});return;case Yo:{const V=x[Z]??bn();ke(Z,{contextWindow:V.contextWindow,contextWindowMode:"custom"});return}default:ke(Z,{contextWindow:J,contextWindowMode:"preset"});return}}function _(Z,J){const V=x[Z]??bn(),oe=di(V.contextWindow);ke(Z,{contextWindow:Vu(J,oe.unit),contextWindowMode:"custom"})}function te(Z,J){const V=x[Z]??bn(),oe=di(V.contextWindow);switch(J){case"K":case"M":case"tokens":ke(Z,{contextWindow:Vu(oe.amount,J),contextWindowMode:"custom"});return;default:return}}function Q(Z){p(J=>J.filter((V,oe)=>oe!==Z)),m(J=>J.filter((V,oe)=>oe!==Z))}function P(){p(Z=>[...Z,""]),m(Z=>[...Z,bn()])}function R(){const Z=new Date().toISOString(),J=[];return h.forEach((V,oe)=>{const Y=V.trim();if(Y==="")return;const ee=x[oe]??bn(),D=Ro(ee.contextWindow),X=Zu(ee.outputLimit);if(D===null&&X===null)return;const ae=gg(e,Y);if(ae!==null&&ae.contextWindow===(D??void 0)&&ae.outputLimit===(X??void 0)){J.push({...ae,model:Y});return}const ge={model:Y,source:"manual",updatedAt:Z};D!==null&&(ge.contextWindow=D),X!==null&&(ge.outputLimit=X),J.push(ge)}),J.length>0?J:e?.modelMetadata!==void 0?[]:void 0}function q(Z){if(Z.preventDefault(),!!pe()){M(!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:R(),source:O})}finally{M(!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"}),E.name!==void 0&&a.jsx("p",{className:"text-xs text-destructive",children:E.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=>$(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=>A(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"}),E.modelMetadataUrl!==void 0&&a.jsx("p",{className:"text-xs text-destructive",children:E.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&&!ie&&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:pg(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(Sa,{className:"size-4"}):a.jsx(Ca,{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(it,{className:"size-4 text-green-500"}):a.jsx(Wt,{className:"size-4"})})]}),E.apiKey!==void 0&&a.jsx("p",{className:"text-xs text-destructive",children:E.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=x[J]??bn(),oe=E[`modelMetadata.${J}.contextWindow`],Y=E[`modelMetadata.${J}.outputLimit`],ee=xz(V),D=di(V.contextWindow);return a.jsxs("div",{ref:X=>{B.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:ue.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"}),ue.length>0&&a.jsxs(a.Fragment,{children:[a.jsx("button",{type:"button",onClick:()=>F(U===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(Ut,{className:"size-4"})}),U===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:ue.map(X=>a.jsx("button",{type:"button",onClick:()=>{me(J,X),F(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=>ze(J,X),children:[a.jsx(Jo,{size:"sm",className:"w-full bg-background font-mono text-xs",children:a.jsx(Ko,{})}),a.jsxs(Go,{className:"max-h-64",children:[a.jsx(Pt,{value:oa,children:"Not set"}),mg.map(X=>a.jsxs(Pt,{value:X.value,children:[X.label," · ",X.value]},X.value)),a.jsx(Pt,{value:Yo,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:D.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:D.unit,onValueChange:X=>te(J,X),children:[a.jsx(Jo,{size:"sm",className:"w-full bg-background font-mono text-xs",children:a.jsx(Ko,{})}),a.jsxs(Go,{children:[a.jsx(Pt,{value:"K",children:"K"}),a.jsx(Pt,{value:"M",children:"M"}),a.jsx(Pt,{value:"tokens",children:"tokens"})]})]})]}),oe!==void 0&&a.jsx("span",{className:"block text-destructive",children:oe})]}),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=>ke(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:P,className:"text-xs text-primary hover:underline flex items-center gap-1",children:"+ Add Model"}),E.models!==void 0&&a.jsx("p",{className:"text-xs text-destructive",children:E.models})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsxs("div",{className:"flex gap-1 border-b border-border",children:[a.jsx(et,{children:a.jsxs(De,{children:[a.jsx(Fe,{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($e,{children:"Anthropic Messages API protocol"})]})}),a.jsx(et,{children:a.jsxs(De,{children:[a.jsx(Fe,{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($e,{children:"OpenAI Chat Completions API protocol"})]})})]}),E.format!==void 0&&a.jsx("p",{className:"text-xs text-destructive",children:E.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"}),E.anthropicBaseUrl!==void 0&&a.jsx("p",{className:"text-xs text-destructive",children:E.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=>{K(!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"}),E.openaiBaseUrl!==void 0&&a.jsx("p",{className:"text-xs text-destructive",children:E.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=>N(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(Re,{type:"button",variant:"outline",onClick:n,disabled:w,children:"Cancel"}),a.jsx(Re,{type:"submit",disabled:w,children:w?"Saving...":e?"Update Provider":"Add Provider"})]})]})}const bz=Xe(["timeout","network_unreachable","connection_refused","auth_failed","rate_limited","server_error","invalid_response","unknown"]),vz=le({message:W(),type:bz,details:W().optional(),hint:W().optional()}),wz=le({type:Xe(["text","thinking"]),text:W().optional(),thinking:W().optional()}),kz=le({requestUrl:W().optional(),requestMethod:W().optional(),requestHeaders:Nt(W(),W()).optional(),requestBody:W().optional(),responseStatus:fe().optional(),responseStatusText:W().optional(),responseHeaders:Nt(W(),W()).optional(),responseBody:W().optional()}),_z=le({success:nt(),error:vz.optional(),model:W().optional(),inputTokens:fe().optional(),outputTokens:fe().optional(),cacheCreationInputTokens:fe().optional(),cacheReadInputTokens:fe().optional(),latencyMs:fe().optional(),content:Ce(wz).optional(),rawResponse:W().optional(),streaming:nt().optional(),streamingChunks:le({chunks:Ce(rf),truncated:nt().default(!1)}).optional(),requestHeaders:Nt(W(),W()).optional(),debug:kz.optional()}),qu=Qt([_z,le({notConfigured:je(!0)}),le({testing:je(!0)})]),Xo=le({nonStreaming:qu,streaming:qu}),Sz=le({anthropic:Xo,openai:Xo}),Cz=le({anthropic:Xo,openai:Xo,models:Nt(W(),Sz).optional(),testedAt:W().optional()});function jz(){return{anthropic:{nonStreaming:{testing:!0},streaming:{testing:!0}},openai:{nonStreaming:{testing:!0},streaming:{testing:!0}}}}function Ku(e,t){const n=()=>({nonStreaming:{success:!1,error:{message:e,type:t}},streaming:{notConfigured:!0}});return{anthropic:n(),openai:n()}}const Ez=le({providerConfig:W()}),Nz=le({success:nt().optional(),imported:fe().optional(),message:W().optional(),errors:Ce(W()).optional()}),Tz=le({provider:Po,imported:fe(),matchedModels:Ce(W()),missingModels:Ce(W()),sourceUrl:W()}),go="Network error: could not reach the server. Is the proxy running?";function Ju(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 Az(e,t){const n=e?.models?.map(r=>r.trim()).filter(r=>r!=="").length??0;return Math.max(1,n)*t}async function Iz(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 zz({externalProviders:e,isLoading:t=!1,externalTestResults:n,externalTestingProviders:r,externalTestingTimeLeft:o,onProvidersMutate:s,onTestResultsChange:i,onTestingProvidersChange:l,onTestingTimeLeftChange:c}){const[u,d]=y.useState(!1),[f,h]=y.useState(),[p,x]=y.useState(null),[m,g]=y.useState({}),[b,v]=y.useState(new Set),[k,S]=y.useState({}),[C,j]=y.useState(null),[N,T]=y.useState(!1),[A,O]=y.useState(null),[$,E]=y.useState(!1),[L,w]=y.useState(!1),[M,U]=y.useState(null),[F,B]=y.useState("all"),[G,I]=y.useState(new Set),{providerTestTimeoutSeconds:H}=ka(),K=y.useRef(null),z=y.useRef(null),se=e??[],re=y.useMemo(()=>{const Y=F==="all"?se:se.filter(ee=>ee.source===F);return F==="all"?[...Y].sort((ee,D)=>{const X={personal:0,company:1};return(X[ee.source??""]??2)-(X[D.source??""]??2)}):Y},[se,F]),ue=n??m,ie=r??b,de=o??k,pe=c?(Y,ee)=>c(Y,ee):(Y,ee)=>{S(ee===void 0?D=>{const X={...D};return delete X[Y],X}:D=>({...D,[Y]:ee}))};y.useEffect(()=>{(async()=>{try{const Y=await fetch("/api/config/paths");if(Y.ok){const ee=await Jt(Y,Ez);j(ee.providerConfig)}}catch{}})()},[]);const he=y.useCallback(Y=>{z.current!==null&&clearTimeout(z.current),O(Y),K.current?.scrollTo({top:K.current.scrollHeight,behavior:"smooth"}),z.current=setTimeout(()=>{O(null),z.current=null},2e3)},[]);y.useEffect(()=>()=>{z.current!==null&&clearTimeout(z.current)},[]);const me=y.useCallback(()=>{s?.().catch(()=>{})},[s]),ke=y.useCallback((Y,ee)=>{i?i(Y,ee):g(D=>({...D,[Y]:ee}))},[i]),ze=y.useCallback((Y,ee)=>{if(l){l(Y,ee);return}v(D=>{const X=new Set(D);return ee?X.add(Y):X.delete(Y),X})},[l]),_=y.useCallback(async Y=>{ke(Y,jz()),ze(Y,!0);const ee=new AbortController,D=se.find(Ee=>Ee.id===Y);let ae=Az(D,H);pe(Y,ae);const ge=setInterval(()=>{ae--,pe(Y,ae),ae<=0&&(clearInterval(ge),ee.abort())},1e3);try{const Ee=await fetch(`/api/providers/${Y}/test`,{method:"POST",signal:ee.signal});if(Ee.ok){const Be=await Jt(Ee,Cz);ke(Y,Be),await Iz(Y,Be)}else ke(Y,Ku(`HTTP ${Ee.status}: ${Ee.statusText}`,"server_error"))}catch(Ee){Ee instanceof Error&&Ee.name==="AbortError"&&ke(Y,Ku("Request timed out","timeout"))}finally{clearInterval(ge),pe(Y,void 0),ze(Y,!1)}},[H,se,pe,ke,ze]),te=y.useCallback(async(Y,ee,D=!0)=>{I(X=>{const ae=new Set(X);return ae.add(Y),ae});try{const X=ee!==void 0&&ee.trim()!==""?{url:ee}:{},ae=await fetch(`/api/providers/${Y}/model-metadata`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(X)});if(!ae.ok)return D&&x(await wn(ae,"Failed to refresh model metadata")),!1;const ge=await Jt(ae,Tz);return ge.imported===0&&D?x("No matching model metadata found for this provider."):x(null),he(ge.provider.id),me(),ge.imported>0}catch{return D&&x(go),!1}finally{I(X=>{const ae=new Set(X);return ae.delete(Y),ae})}},[me,he]);function Q(Y){(async()=>{try{const ee=await fetch("/api/providers",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(Ju(Y))});if(!ee.ok){x(await wn(ee,"Failed to add provider"));return}const D=await Jt(ee,Po);d(!1),he(D.id),Y.modelMetadataUrl!==void 0&&Y.modelMetadataUrl.trim()!==""&&await te(D.id,Y.modelMetadataUrl,!1),me(),await _(D.id)}catch{x(go)}})()}function P(Y){f&&(async()=>{try{const ee=await fetch(`/api/providers/${f.id}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(Ju(Y))});if(!ee.ok){x(await wn(ee,"Failed to update provider"));return}const D=await Jt(ee,Po);h(void 0),he(D.id),Y.modelMetadataUrl!==void 0&&Y.modelMetadataUrl.trim()!==""&&await te(D.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 _(D.id)}catch{x(go)}})()}function R(Y){U(Y),w(!0)}function q(){const Y=M;Y!==null&&(async()=>{let ee;try{ee=await fetch(`/api/providers/${Y}`,{method:"DELETE"})}catch{x(go);return}if(!ee.ok){x(await wn(ee,"Failed to delete provider"));return}me()})()}const Z=y.useRef(null);function J(Y){const ee="/api/providers/export";(async()=>{try{const D=await fetch(ee);if(!D.ok){x("Failed to export providers");return}const X=await D.blob(),ae=URL.createObjectURL(X),ge=document.createElement("a");ge.href=ae,ge.download=D.headers.get("Content-Disposition")?.match(/filename="(.+)"/)?.[1]??"providers.json",document.body.appendChild(ge),ge.click(),document.body.removeChild(ge),URL.revokeObjectURL(ae)}catch{x("Failed to export providers")}})()}function V(){Z.current?.click()}function oe(Y){const ee=Y.target.files?.[0];ee&&(async()=>{try{const D=await ee.text(),X=await fetch("/api/providers/import",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(D)}),ae=await Jt(X,Nz);X.ok&&ae.imported!==void 0&&ae.imported>0?(me(),x(null)):ae.errors&&ae.errors.length>0?x(ae.errors.join("; ")):x(ae.message??"Import failed")}catch{x("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(yz,{provider:f,onSubmit:f?P: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(et,{children:a.jsxs(De,{children:[a.jsx(Fe,{asChild:!0,children:a.jsxs(Re,{variant:"outline",size:"sm",onClick:()=>J(),className:"gap-1 hover:bg-muted",children:[a.jsx(_a,{className:"size-3"}),"Export"]})}),a.jsx($e,{children:"Download providers as JSON for backup or sharing"})]})}),a.jsx(et,{children:a.jsxs(De,{children:[a.jsx(Fe,{asChild:!0,children:a.jsxs(Re,{variant:"outline",size:"sm",onClick:V,className:"gap-1 hover:bg-muted",children:[a.jsx($w,{className:"size-3"}),"Import"]})}),a.jsx($e,{children:"Import providers from an exported JSON file"})]})}),a.jsx("input",{type:"file",ref:Z,accept:".json",onChange:oe,style:{display:"none"}}),a.jsx(et,{children:a.jsxs(De,{children:[a.jsx(Fe,{asChild:!0,children:a.jsxs(Re,{variant:"outline",size:"sm",onClick:()=>E(!0),className:"gap-1",children:[a.jsx(Nw,{className:"size-3"}),"Scan"]})}),a.jsx($e,{children:"Detect and import provider configs from Claude Code and OpenCode"})]})}),a.jsxs(Re,{onClick:()=>d(!0),size:"sm",className:"gap-1",children:[a.jsx(ki,{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(et,{children:a.jsxs(De,{children:[a.jsx(Fe,{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:N?a.jsx(it,{className:"size-3 text-green-500"}):a.jsx(Wt,{className:"size-3"})})}),a.jsx($e,{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(zr,{className:"size-4 shrink-0"}),p]}),se.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(Re,{onClick:()=>d(!0),variant:"outline",size:"sm",children:[a.jsx(ki,{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(et,{children:a.jsxs(De,{children:[a.jsx(Fe,{asChild:!0,children:a.jsx("button",{type:"button",onClick:()=>B(Y),className:`px-3 py-2 text-sm font-medium border-b-2 transition-colors ${F===Y?"border-primary text-primary":"border-transparent text-muted-foreground hover:text-foreground"}`,children:Y==="all"?"All":Y==="personal"?"Personal":"Company"})}),a.jsx($e,{children:Y==="all"?"Show all providers":Y==="personal"?"Providers you configured yourself":"Providers set by your organization"})]})},Y))}),a.jsx("div",{ref:K,className:"space-y-3",children:re.map(Y=>a.jsx(hz,{provider:Y,testResults:ue[Y.id],isTesting:ie.has(Y.id),testingTimeLeft:de[Y.id],isHighlighted:Y.id===A,onEdit:ee=>h(ee),onDelete:R,onRefreshMetadata:ee=>{te(ee)},isRefreshingMetadata:G.has(Y.id),onTest:ee=>{_(ee)}},Y.id))})]}),a.jsx(tz,{open:$,onOpenChange:E,onImportComplete:()=>{s!==void 0&&s()}}),a.jsx(Gh,{open:L,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 Rz(){const[e,t]=y.useState(!1),[n,r]=y.useState("providers"),{providers:o,isLoading:s,mutate:i}=If(),[l,c]=y.useState({}),[u,d]=y.useState(new Set),[f,h]=y.useState({}),p=y.useCallback((g,b)=>{c(v=>({...v,[g]:b}))},[]),x=y.useCallback((g,b)=>{d(v=>{const k=new Set(v);return b?k.add(g):k.delete(g),k})},[]),m=y.useCallback((g,b)=>{h(v=>{if(b===void 0){const k={...v};return delete k[g],k}return{...v,[g]:b}})},[]);return a.jsxs(Qa,{open:e,onOpenChange:t,children:[a.jsx(Q5,{asChild:!0,children:a.jsxs(Re,{variant:"ghost",size:"icon",className:"size-8",children:[a.jsx(Pw,{className:"size-4"}),a.jsx("span",{className:"sr-only",children:"Settings"})]})}),a.jsxs(el,{className:"max-w-2xl max-h-[80vh] overflow-hidden flex flex-col",children:[a.jsx(tl,{children:a.jsx(nl,{children:"Settings"})}),a.jsxs(rm,{value:n,onValueChange:r,className:"flex-1 overflow-hidden",children:[a.jsxs(om,{children:[a.jsx(Ct,{value:"providers",children:"Providers"}),a.jsx(Ct,{value:"proxy",children:"Proxy"}),a.jsx(Ct,{value:"storage",children:"Storage"}),a.jsx(Ct,{value:"onboarding",children:"Onboarding"})]}),a.jsxs("div",{className:"mt-4 flex-1 overflow-x-hidden overflow-y-auto pr-3",children:[a.jsx(jt,{value:"providers",children:a.jsx(zz,{externalProviders:o,isLoading:s,externalTestResults:l,externalTestingProviders:u,externalTestingTimeLeft:f,onProvidersMutate:()=>i(),onTestResultsChange:p,onTestingProvidersChange:x,onTestingTimeLeftChange:m})}),a.jsx(jt,{value:"proxy",children:a.jsx(Lz,{})}),a.jsx(jt,{value:"storage",children:a.jsx(Oz,{})}),a.jsx(jt,{value:"onboarding",children:a.jsx(Mz,{})})]})]})]})]})}const Pz=le({memoryCount:fe(),logDir:W(),logFileCount:fe(),logBytes:fe(),chunkDir:W(),chunkFileCount:fe(),chunkBytes:fe()});function Gu(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 Oz(){const[e,t]=y.useState(null),[n,r]=y.useState(null),[o,s]=y.useState(!1),[i,l]=y.useState(null),c=y.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=Pz.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)}},[]);y.useEffect(()=>{c()},[c]);const u=y.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(Re,{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(sa,{id:"log-dir",label:"Log storage path",value:e.logDir,copiedId:i,onCopy:u}),a.jsx(sa,{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 / ",Gu(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 / ",Gu(e.chunkBytes)]})]})]}),n!==null&&a.jsx("p",{className:"text-xs text-destructive",children:n})]})}function sa({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(Re,{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(it,{className:"size-3.5 text-emerald-500"}):a.jsx(Wt,{className:"size-3.5"})})]})]})}function Mz(){const[e,t]=y.useState(null),n=y.useMemo(()=>typeof window>"u"?"http://localhost:25947":window.location.origin,[]),r=y.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=y.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(pf,{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(sa,{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(it,{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(it,{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(it,{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 Lz(){const{strip:e,captureMode:t,slowResponseThresholdSeconds:n,providerTestTimeoutSeconds:r,timeDisplayFormat:o,isLoading:s,setStrip:i,setSlowResponseThresholdSeconds:l,setProviderTestTimeoutSeconds:c,setTimeDisplayFormat:u}=ka(),[d,f]=y.useState(null),[h,p]=y.useState(!1),x=t==="full"?"simple":"full",m=y.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=y.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=y.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=y.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 ",x]})," 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:vi,step:1,value:n,disabled:s||h,onChange:k=>{const S=Number(k.currentTarget.value);Number.isInteger(S)&&(S<0||S>vi||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:wi,step:1,value:r,disabled:s||h,onChange:k=>{const S=Number(k.currentTarget.value);Number.isInteger(S)&&(S<1||S>wi||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=of.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 Dz(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:Yu(s.cacheCreationInputTokens,i.cacheCreationInputTokens),read:Yu(s.cacheReadInputTokens,i.cacheReadInputTokens)})}}return t}function Yu(e,t){return t===null||e===null?null:t>e?{direction:"up",delta:t-e}:t<e?{direction:"down",delta:e-t}:null}const Fz=30,$z=112,Bz=6;function Uz(e){return e>Fz}function Wz({groups:e,standalone:t,...n}){return Uz(e.length)?a.jsx(Vz,{groups:e,standalone:t,...n}):a.jsx(a.Fragment,{children:e.map(r=>a.jsx(fg,{group:r,standalone:t,...n},r.id))})}function Vz({groups:e,standalone:t,...n}){const[r,o]=y.useState(()=>new Map),s=kE({count:e.length,estimateSize:()=>$z,overscan:Bz,getItemKey:c=>e[c]?.id??c}),i=y.useCallback((c,u)=>{o(d=>{const f=new Map(d);return u?f.set(c,!0):f.delete(c),f})},[]),l=y.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 y.useEffect(()=>{const c=u=>{const d=As(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(Xt,c),()=>{window.removeEventListener(Xt,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(fg,{group:u,standalone:t,expanded:r.get(u.id)??!1,onExpandedChange:d=>i(u.id,d),...n})},c.key)})})}const Qo="data-nav-id",Hz="data-nav-action";function Xu(e){return Array.from(e.querySelectorAll(`[${Qo}]`))}function Qu(e){return e instanceof HTMLElement}function Zz(e,t){let n=e;for(;n!==null&&n!==t;){if(n.hasAttribute(Qo))return n;n=n.parentElement}return e.hasAttribute(Qo)?e:null}function fi(e){const t=e.getAttribute(Hz);return t==="toggle"||t==="expand"||t==="collapse"?t:null}function wr(e){e.focus({preventScroll:!0}),e.scrollIntoView({block:"nearest",behavior:"smooth"})}function kr(e,t){return e[t]??null}function yg(e){const t=e.tagName;return!!(t==="INPUT"||t==="TEXTAREA"||t==="SELECT"||e.isContentEditable)}function ed(e){const t=e.tagName;return t==="BUTTON"||t==="A"||yg(e)?!0:e.closest("[role='button'],[role='menuitem'],[role='option']")!==null}function qz(e){return e.closest("[role='dialog'],[role='menu'],[role='listbox']")!==null?!0:document.querySelector("[role='dialog'],[role='menu'],[role='listbox']")!==null}function Kz(){const e=window.getSelection();return e===null?!1:e.type==="Range"&&e.toString().length>0}function xo(e,t){return e.key===t&&e.shiftKey}function Jz(e,t,n={}){const r=t??e,o=n.pageWide===!0,s=y.useCallback(i=>{const l=e.current,c=r.current;if(!l||!c)return;const u=i.target;if(!Qu(u)||u!==c)return;const d=Xu(l),f=kr(d,0);f!==null&&wr(f)},[e,r]);y.useEffect(()=>{const i=l=>{if(l.altKey||l.ctrlKey||l.metaKey)return;const c=e.current;if(!c)return;const u=l.target;if(!Qu(u)||yg(u)||Kz())return;const d=c.contains(u);if(d&&ed(u)&&!u.hasAttribute(Qo)||!d&&(!o||ed(u)||qz(u)))return;const f=Xu(c);if(f.length===0)return;const h=Zz(u,c),p=h!==null?f.indexOf(h):-1;let x=!1;switch(l.key){case"ArrowUp":case"W":{if(l.shiftKey&&l.key==="ArrowUp"||l.key==="W"&&!xo(l,"W"))break;l.preventDefault();const m=p>0?p-1:p===-1?f.length-1:-1;if(m!==-1){const g=kr(f,m);g!==null&&wr(g)}x=!0;break}case"ArrowDown":case"S":{if(l.shiftKey&&l.key==="ArrowDown"||l.key==="S"&&!xo(l,"S"))break;l.preventDefault();const m=p<f.length-1?p+1:p===-1?0:-1;if(m!==-1){const g=kr(f,m);g!==null&&wr(g)}x=!0;break}case"ArrowLeft":case"A":{if(l.shiftKey&&l.key==="ArrowLeft"||l.key==="A"&&!xo(l,"A")||h===null)break;if(l.preventDefault(),fi(h)==="collapse")h.click();else if(p>0){const g=kr(f,p-1);g!==null&&wr(g)}x=!0;break}case"ArrowRight":case"D":{if(l.shiftKey&&l.key==="ArrowRight"||l.key==="D"&&!xo(l,"D")||h===null)break;if(l.preventDefault(),fi(h)==="expand")h.click();else if(p<f.length-1){const g=kr(f,p+1);g!==null&&wr(g)}x=!0;break}case" ":{if(h===null)break;l.preventDefault(),fi(h)!==null&&h.click(),x=!0;break}}x&&l.stopPropagation()};return document.addEventListener("keydown",i,{capture:!0}),()=>document.removeEventListener("keydown",i,{capture:!0})},[e,o,r]),y.useEffect(()=>(document.addEventListener("focusin",s),()=>document.removeEventListener("focusin",s)),[s])}const Gz={system:"System",user:"User",assistant:"Assistant",tool:"Tool Results",tools:"Tool Definitions"},Yz={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"},Xz={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"},pi=12,yo=1,td=80,nd=24;function Qz(e){return e.length<=nd?e:`${e.slice(0,nd-3)}...`}function eR(e){const t=e.replace(/\s+/g," ").trim();return t.length<=td?t:`${t.slice(0,td)}...`}function bo(e){return e>=10?`${e.toFixed(0)}%`:e>=1?`${e.toFixed(1)}%`:e>0?"<1%":"0%"}const tR=y.memo(function({segments:t,totalTokens:n,showLabels:r=!0,onActivate:o}){const s=y.useMemo(()=>n>0?n:t.reduce((g,b)=>g+b.size,0),[t,n]),i=t.slice(0,pi),l=t.slice(pi),c=l.reduce((g,b)=>g+b.size,0),u=l.length,d=pi,f=d+u-1,h=u>0,p=o!==void 0,x=y.useMemo(()=>i.reduce((g,b)=>g+b.size,0),[i]),m=y.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(et,{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(yo,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",Yz[g.role],p?Xz[g.role]:""),C={width:`${k}%`},j=`${g.label}, ${bo(v)}, ~${Ve(g.size)} tokens`;return a.jsxs(De,{children:[a.jsx(Fe,{asChild:!0,children:p?a.jsx("button",{type:"button",role:"button",tabIndex:0,onClick:()=>o(g),onKeyDown:N=>{(N.key==="Enter"||N.key===" ")&&(N.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($e,{side:"bottom",className:"max-w-sm text-xs p-2 space-y-0.5",children:[a.jsxs("div",{className:"font-semibold",children:[g.label," - ",bo(v)," - ~",Ve(g.size)," ","tokens"]}),a.jsx("div",{className:"text-muted-foreground",children:Gz[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:eR(g.text)})]})]},`${g.path}-${b}`)}),h&&a.jsxs(De,{children:[a.jsx(Fe,{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(yo,c/s*100)}%`},children:["... +",u]})}),a.jsxs($e,{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(yo,v);return a.jsxs("div",{className:"flex flex-col gap-0.5 truncate",style:{width:`${k}%`},title:`${g.label} - ${bo(v)} - ~${Ve(g.size)} tokens`,children:[a.jsx("span",{className:"truncate font-mono text-foreground/80",children:Qz(g.label)}),a.jsxs("span",{className:"truncate font-mono text-muted-foreground/70",children:[bo(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(yo,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)]})]})]}),x<s*.1&&a.jsx("div",{className:"h-0"})]})})}),bg=.75,vg=.9,ia=8e3,nR=.35,wg=40,kg=160,rR=5,oR=8,sR=18,iR=6e4,aR=.7,rd=3e3,lR=.3,od=160,cR=new Set(["answer","body","content","data","error","message","markdown","output","response","result","stderr","stdout","text","transcript"]),uR=["context_window","contextWindow","context_length","contextLength","max_context_length","maxContextLength","max_input_tokens","maxInputTokens"],dR=["max_tokens","maxTokens","max_completion_tokens","maxCompletionTokens","max_output_tokens","maxOutputTokens"],fR=[{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"]}],pR={system:"System",user:"User messages",assistant:"Assistant messages",tool:"Tool results",tools:"Tool definitions"};function hR(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 _g(e,t){for(const n of t){const r=hR(Oe(e,n));if(r!==null)return r}return null}function mR(e){const t=Oe(e,"model");if(typeof t!="string")return null;const n=t.trim();return n===""?null:n}function gR(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 xR(e,t,n=[]){const r=_g(t,uR);if(r!==null)return{tokens:r,label:"Request metadata",source:"request"};const o=sz(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 fR)if(gR(s,i))return{tokens:i.tokens,label:`${i.family} local rule`,source:"model-rule"};return{tokens:null,label:"No local rule",source:"unknown"}}function yR(e){return e<0?0:e>1?1:e}function bR(e){return e===null?"unknown":e>=vg?"danger":e>=bg?"watch":"ok"}function vR(e,t){return e.filter(n=>n.role===t).reduce((n,r)=>n+r.size,0)}function wR(e,t){return["system","user","assistant","tool","tools"].map(r=>{const o=vR(e,r);return{role:r,label:pR[r],tokens:o,percent:t>0?o/t:0}}).filter(r=>r.tokens>0).sort((r,o)=>o.tokens-r.tokens)}function aa(e){return e.replace(/\s+/g," ").trim().toLowerCase()}function kR(e){const t=e.replace(/\s+/g," ").trim();return t.length<=od?t:`${t.slice(0,od-3)}...`}function _R(e){return{role:e.role,label:e.label,path:e.path,tokens:e.tokens,characters:e.characters}}function SR(e){return{role:e.role,label:e.label,path:e.path,tokens:e.size,characters:e.characters,text:e.text}}function CR(e){const t=e.trim();return t.startsWith("{")||t.startsWith("[")}function jR(e){if(!CR(e))return null;try{return JSON.parse(e)}catch{return null}}function ER(e){return e.toLowerCase().replace(/[^a-z0-9]/g,"")}function NR(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 TR(e){const t=NR(e);return t===null?!1:cR.has(ER(t))}function AR(e){return e.map(t=>t.startsWith("[")?t:`.${t}`).join("").replace(/^\./,"")}function IR(e,t,n){const r=vl(t);if(r<kg)return null;const o=bl(t);return o<wg?null:{role:e.role,label:`${e.label} ${AR(n)}`,path:e.path,tokens:o,characters:r,text:t}}function la({value:e,segment:t,path:n,depth:r,candidates:o}){if(!(o.length>=oR)&&!(r>rR)){if(typeof e=="string"){if(!TR(n))return;const s=IR(t,e,n);s!==null&&o.push(s);return}if(Array.isArray(e)){e.forEach((s,i)=>la({value:s,segment:t,path:[...n,`[${String(i)}]`],depth:r+1,candidates:o}));return}rl(e)&&Object.entries(e).forEach(([s,i])=>la({value:i,segment:t,path:[...n,s],depth:r+1,candidates:o}))}}function zR(e){const t=SR(e),n=jR(e.text);if(n===null)return[t];const r=[];la({value:n,segment:e,path:[],depth:0,candidates:r});const o=aa(e.text),s=new Set([o]),i=r.filter(l=>{const c=aa(l.text);return c===""||s.has(c)?!1:(s.add(c),!0)});return[t,...i]}function RR(e){const t=new Map;for(const r of e){const o=zR(r);for(const s of o){if(s.tokens<wg||s.characters<kg)continue;const i=aa(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:kR(o.text),firstLabel:o.label,segments:r.candidates.map(_R)})}return n.sort((r,o)=>o.repeatedTokens-r.repeatedTokens||o.totalTokens-r.totalTokens)}function PR(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>=ia?"danger":"watch",title:"Duplicate context",detail:`${String(n)} repeated blocks across ${String(t)} group${t===1?"":"s"}, ~${String(r)} repeated tokens.`}}function OR(e){return e.reduce((t,n)=>t+n.repeatedTokens,0)}function MR(e,t,n){const r=[],o=e.find(c=>c.role==="tools")??null;o!==null&&(o.tokens>=ia||o.percent>=nR&&o.tokens>=rd)&&r.push({kind:"tool-schema",severity:o.tokens>=ia?"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>=rd&&s.percent>=lR&&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>=sR&&(i>=iR||l>=aR)&&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 LR({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:OR(r)}}function DR({segments:e,inputTokens:t,parsed:n,model:r,providers:o=[]}){const s=e.reduce((j,N)=>j+N.size,0),i=r??mR(n),l=t??s,c=_g(n,dR),u=xR(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,x=u.tokens===null||f===null?null:yR(f/u.tokens),m=wR(e,s),g=m[0]??null,b=e.filter(j=>j.role!=="tools").length,v=RR(e),k=PR(v),S=MR(m,s,b);k!==null&&S.unshift(k);const C=bR(x);return{model:i,contextWindow:u,estimatedInputTokens:l,outputReserveTokens:c,windowUsedTokens:f,remainingInputTokens:h,remainingAfterReserveTokens:p,usagePercent:x,riskLevel:C,roleUsages:m,largestRole:g,diagnostics:S,duplicateGroups:v,health:LR({risk:C,contextWindow:u,diagnostics:S,duplicateGroups:v})}}const _P={watch:bg,danger:vg};function FR(e){if(e===null)return null;try{return JSON.parse(e)}catch{return null}}function $R(e){return{role:e.role,label:e.label,size:e.tokens,characters:e.tokens*4,text:"",path:`role:${e.role}`}}function BR(e,t){const n=FR(e.rawRequestBody);if(n===null)return null;const o=tg($r(e)).anatomySegments(n);if(o===null)return null;const s=DR({segments:o,inputTokens:e.inputTokens??null,parsed:n,model:e.model,providers:t}),i=s.model??e.model??"Unknown model",l=s.roleUsages.map($R);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 UR(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 WR(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 VR(e,t){return e.usagePercent===null||t.usagePercent===null?null:(t.usagePercent-e.usagePercent)*100}function HR(e,t=[]){const n=[...e].sort((s,i)=>s.id-i.id),r=new Map;for(const s of n){const i=BR(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:UR(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:VR(s.first,s.latest)})).sort(WR)}}function So(e){return e.length<=30?e:`${e.slice(0,12)}...${e.slice(-12)}`}function id(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 ZR(e,t){const n=e[0],r=e[e.length-1];return n===void 0||r===void 0?null:Ea(n.timestamp,r.timestamp,t)}function qR(e){for(const t of e)if(t.userAgent!==null&&t.userAgent!==void 0&&t.userAgent!=="")return t.userAgent;return null}function KR({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 Tr(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 JR(e){return e===null?"n/a":Math.abs(e)<.1?"0%":`${e>0?"+":""}${e.toFixed(1)}%`}function ca(e){return e===null||!Number.isFinite(e)?0:Math.min(Math.max(e*100,0),100)}function GR(e,t){if(t===null)return null;const n=ca(e),r=ca(t);return r<=0||Math.abs(r-n)<.5?null:r}function YR(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 XR(e){const t=e.latest.contextWindow.tokens;return t===null?"Context window unknown":`Context window ${Af(t)}`}function QR(e){return`${e} ${e===1?"request":"requests"}`}function ad(e){return`#${String(e)}`}function ld(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 eP(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 tP(e){switch(e){case"risk":return"Risk";case"optimizable":return"Optimizable";case"ok":return"OK"}}const nP=10,rP=80;function oP(e){e.setAttribute("data-deep-link-highlight","true"),window.setTimeout(()=>{e.removeAttribute("data-deep-link-highlight")},1800)}function sP(e){const t=document.getElementById(`log-${String(e)}`);return t instanceof HTMLElement?(t.scrollIntoView({block:"center",behavior:"smooth"}),t.focus({preventScroll:!0}),oP(t),!0):!1}function Sg(e){ea({logId:e,tab:"anatomy"});let t=0;const n=()=>{ea({logId:e,tab:"anatomy"}),!sP(e)&&(t+=1,t<nP&&window.setTimeout(n,rP))};window.setTimeout(n,0)}function cd({command:e}){const[t,n]=y.useState(!1),r=y.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 iP(){return a.jsx(et,{children:a.jsxs(De,{children:[a.jsx(Fe,{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($e,{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 ud({label:e,logId:t}){return a.jsxs("button",{type:"button",onClick:()=>Sg(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 ${ad(t)}`,children:[e," ",ad(t)]})}function aP({latestPercent:e,peakPercent:t,risk:n,onOpenContext:r}){const o=ca(e),s=GR(e,t),i=t===null?`Latest context window usage ${Tr(e)}`:`Latest context window usage ${Tr(e)}, peak ${Tr(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]",YR(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 lP({summary:e}){const t=e.trendPercent,n=t===null||Math.abs(t)<.1?null:t>0?cv:rv,r=e.latest.diagnostics[0]??null,o=Tr(e.latest.usagePercent),s=Tr(e.peak.usagePercent),i=()=>{Sg(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]",eP(e.latest.health.level)),children:tP(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:QR(e.requestCount)}),a.jsx("span",{children:XR(e)})]})]}),a.jsxs("div",{className:"min-w-0 space-y-2 text-xs",children:[a.jsx(aP,{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",ld(e.latest.riskLevel)),children:o}),a.jsx(ud,{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",ld(e.peak.riskLevel)),children:s}),a.jsx(ud,{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")}),JR(t)]}),a.jsx("div",{className:"h-5","aria-hidden":"true"})]})]})]}),a.jsxs("div",{className:"min-w-0 space-y-1.5",children:[a.jsx(tR,{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 cP({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(lP,{summary:t},t.model))})]})}function uP({label:e,logs:t,totalIn:n,totalOut:r,timeDisplayFormat:o,contextSummary:s,showBackLink:i}){const[l,c]=y.useState(!1),u=y.useMemo(()=>ZR(t,o),[t,o]),d=y.useMemo(()=>qR(t),[t]),f=y.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(av,{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:So(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(it,{className:"size-3.5"}):a.jsx(Wt,{className:"size-3.5"})})]}),a.jsx(cP,{summary:s})]})}function dP({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:x,hideSessionFilter:m=!1,pinnedSessionId:g}){const{totalIn:b,totalOut:v}=y.useMemo(()=>id(e),[e]),{providers:k}=If(),[S,C]=y.useState(null),[j,N]=y.useState(null),[T,A]=y.useState(null),[O,$]=y.useState("hidden"),E=y.useRef(null),L=y.useRef(null);Jz(E,L,{pageWide:!0}),y.useEffect(()=>{const de=50+Lr.length*400,pe=setTimeout(()=>$("playing"),50),he=setTimeout(()=>$("done"),de);return()=>{clearTimeout(pe),clearTimeout(he)}},[]),y.useEffect(()=>{if(g===void 0){document.title="Agent Inspector";return}const ue=e.length===1?"1 req":`${e.length} req`;document.title=`${So(g)} - ${ue} - Agent Inspector`},[e.length,g]);const w=y.useCallback(async ue=>{C(ue),N(null);try{const ie=await f2(e,ue);ie.ok||N(ie.message)}finally{C(null)}},[e]);y.useEffect(()=>{A(null)},[r,o]);const M=y.useCallback(()=>{A(null)},[]),U=y.useMemo(()=>lj(e),[e]),F=y.useMemo(()=>KR({pinnedSessionId:g,selectedSession:r,sessions:t,logs:e}),[e,g,r,t]),B=F?.logs??[],G=F!==null&&B.length>0,{totalIn:I,totalOut:H}=y.useMemo(()=>id(B),[B]),K=y.useMemo(()=>HR(B,k),[B,k]),z=y.useMemo(()=>Dz(U),[U]),se=y.useMemo(()=>fI(U),[U]),re=y.useCallback(ue=>{const ie=se.get(ue.id);ie!==void 0&&A([ie,ue])},[se]);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(WI,{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:Lr.map((ue,ie)=>{const de=["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"][ie],pe=O==="hidden"?"opacity-0 scale-0":O==="playing"?"animate-crab-piano-pop":"";return a.jsx(ue,{className:`size-5 ${de} transition-all duration-300 ease-out group-hover:scale-125 group-hover:-translate-y-1 ${pe}`,style:{transitionDelay:`${ie*50}ms`,...O==="playing"?{animationDelay:`${ie*400}ms`}:{}}},ie)})})]}),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",ak.version]})]}),a.jsx(ki,{className:"size-4 shrink-0 text-muted-foreground/70","aria-hidden":"true"}),a.jsx(HI,{className:"size-10 shrink-0"})]}),a.jsx(iP,{})]}),a.jsx("div",{className:"justify-self-end",children:a.jsx(Rz,{})})]}),G&&F!==null&&a.jsx(uP,{label:F.label,logs:B,totalIn:I,totalOut:H,timeDisplayFormat:x,contextSummary:K,showBackLink:F.showBackLink}),a.jsxs("div",{className:"flex items-center gap-3 mb-4",children:[!m&&a.jsxs(qo,{value:r,onValueChange:s,children:[a.jsx(Jo,{className:"flex-1 max-w-[350px] text-xs",children:a.jsx(Ko,{placeholder:"All sessions"})}),a.jsxs(Go,{children:[a.jsx(Pt,{value:"__all__",children:"All sessions"}),t.map(ue=>a.jsx(Pt,{value:ue,children:So(ue)},ue))]})]}),a.jsxs(qo,{value:o,onValueChange:i,children:[a.jsx(Jo,{className:"flex-1 max-w-[250px] text-xs",children:a.jsx(Ko,{placeholder:"All models"})}),a.jsxs(Go,{children:[a.jsx(Pt,{value:"__all__",children:"All models"}),n.map(ue=>a.jsx(Pt,{value:ue,children:ue},ue))]})]}),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"}),!G&&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&&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(_a,{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:So(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(cd,{command:"ANTHROPIC_BASE_URL=http://localhost:25947/proxy <your-tool>"}),a.jsx(cd,{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:L,tabIndex:0,className:"flex flex-col gap-2 focus:outline-none",children:a.jsx("div",{ref:E,children:a.jsx(Wz,{groups:U,viewMode:u,strip:h,slowResponseThresholdSeconds:p,cacheTrends:z,onCompareWithPrevious:re,comparisonPredecessors:se,onClearGroup:c,standalone:U.length===1,hasPinnedSessionContext:G,timeDisplayFormat:x})})})}),T!==null&&a.jsx(y.Suspense,{fallback:null,children:a.jsx(Hj,{left:T[0],right:T[1],onClose:M})})]})}const fP=Qt([le({type:je("init"),logs:Ce(Zl)}),le({type:je("update"),log:Zl})]);function pP(e){const t=new Set;for(const n of e)n.sessionId!==null&&n.sessionId!==""&&t.add(n.sessionId);return[...t]}function hP(e){const t=new Set;for(const n of e)n.model!==null&&n.model!==""&&t.add(n.model);return[...t]}function mP(e,t,n){return t==="__all__"&&n==="__all__"?e:e.filter(r=>!(t!=="__all__"&&r.sessionId!==t||n!=="__all__"&&r.model!==n))}const gP=50,xP=12,yP=1800,dd=500;function bP(e){return e===void 0?"/api/logs/stream":`/api/logs/stream?${new URLSearchParams({sessionId:e}).toString()}`}function hi(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 fd(e){return e.length<=dd?e:e.slice(e.length-dd)}function SP({initialSessionId:e}={}){const[t,n]=y.useState([]),[r,o]=y.useState(e??"__all__"),[s,i]=y.useState("__all__"),[l,c]=y.useState("simple"),[u,d]=y.useState(null),f=y.useRef(null),h=y.useRef(null),p=y.useRef(null),x=y.useRef(new Map),m=y.useRef([]),g=y.useRef(null),b=y.useMemo(()=>mP(t,r,s),[t,r,s]),v=y.useMemo(()=>pP(t),[t]),k=y.useMemo(()=>hP(t),[t]),S=y.useCallback(()=>{g.current=null;const L=m.current;m.current=[],L.length!==0&&n(w=>{let M=w;for(const U of L){const F=x.current.get(U.id);F!==void 0?M=[...M.slice(0,F),U,...M.slice(F+1)]:(x.current.set(U.id,M.length),M=[...M,U])}return M=fd(M),x.current=hi(M),M})},[]),C=y.useCallback(L=>{m.current.push(L),g.current===null&&(g.current=setTimeout(S,gP))},[S]),j=y.useCallback(()=>{f.current&&f.current.close();const L=new EventSource(bP(e));f.current=L,L.onmessage=w=>{try{const M=String(w.data),U=JSON.parse(M),F=fP.safeParse(U);if(!F.success){d("Failed to parse SSE data");return}const B=F.data;if(B.type==="init"){g.current!==null&&(clearTimeout(g.current),g.current=null),m.current=[];const G=fd(B.logs);x.current=hi(G),n(G),d(null)}else B.type==="update"&&C(B.log)}catch{d("Failed to parse SSE data")}},L.onerror=()=>{d("SSE connection lost, reconnecting..."),L.close(),h.current!==null&&clearTimeout(h.current),h.current=setTimeout(j,3e3)}},[e,C]);y.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]),y.useEffect(()=>{const L=window.location.hash;if(!L.startsWith("#log-")||p.current===L)return;const w=L.slice(1),M=Number(w.replace(/^log-/,""));Number.isInteger(M)&&M>0&&ea({logId:M,tab:"request"});let U=!1,F=0,B=null,G=null;const I=()=>{if(U)return;const H=document.getElementById(w);if(H!==null){p.current=L,H.scrollIntoView({block:"center",behavior:"smooth"}),H instanceof HTMLElement&&(B=H,H.setAttribute("data-deep-link-highlight","true"),G=window.setTimeout(()=>{H.removeAttribute("data-deep-link-highlight")},yP),H.focus({preventScroll:!0}),H.getAttribute("data-nav-action")==="expand"&&H.click());return}F+=1,F<xP&&window.setTimeout(I,100)};return I(),()=>{U=!0,G!==null&&window.clearTimeout(G),B!==null&&B.removeAttribute("data-deep-link-highlight")}},[b.length]);const N=y.useCallback(()=>{e!==void 0&&t.length===0||(async()=>{try{const L=e===void 0?void 0:JSON.stringify({ids:t.map(M=>M.id)});if(!(await fetch("/api/logs",{method:"DELETE",...L===void 0?{}:{headers:{"Content-Type":"application/json"},body:L}})).ok){d("Failed to clear logs");return}x.current.clear(),n([]),d(null)}catch(L){d(L instanceof Error?L.message:"Unknown error clearing logs")}})()},[t,e]),T=y.useCallback(L=>{L.length!==0&&(async()=>{try{if(!(await fetch("/api/logs",{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({ids:L})})).ok){d("Failed to clear group");return}const M=new Set(L);n(U=>{const F=U.filter(B=>!M.has(B.id));return x.current=hi(F),F}),d(null)}catch(w){d(w instanceof Error?w.message:"Unknown error clearing group")}})()},[]),{strip:A,captureMode:O,slowResponseThresholdSeconds:$,timeDisplayFormat:E}=ka();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(Qw,{}),a.jsx(dP,{logs:b,sessions:v,models:k,selectedSession:r,selectedModel:s,onSessionChange:o,onModelChange:i,onClearAll:N,onClearGroup:T,viewMode:l,onViewModeChange:c,captureMode:O,strip:A,slowResponseThresholdSeconds:$,timeDisplayFormat:E,hideSessionFilter:e!==void 0,pinnedSessionId:e})]})}export{sA as $,Ce as A,Et as B,Mv as C,Qa as D,ea as E,nt as F,W as G,Zl as H,DR as I,oA as J,Yz as K,Gz as L,uw as M,Af as N,_P as O,SP as P,Ut as Q,Sw as R,tR as S,rm as T,Te as U,Nu as V,RE as W,ja as X,kP as Y,af as Z,PE as _,aj as a,pf as a0,yl as a1,Vo as a2,Pr as a3,Io as a4,rk as a5,Rr as a6,ve as b,xe as c,ki as d,ff as e,Ve as f,tg as g,en as h,it as i,Wt as j,el as k,tl as l,nl as m,ww as n,om as o,Ct as p,jt as q,$r as r,Re as s,et as t,If as u,De as v,Fe as w,$e as x,le as y,fe as z};
|