@tonyclaw/agent-inspector 2.0.21 → 2.0.23
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/cli.js +10 -0
- package/.output/nitro.json +1 -1
- package/.output/public/assets/{CompareDrawer-ztKMd-FE.js → CompareDrawer-DnYQtd8R.js} +1 -1
- package/.output/public/assets/ProxyViewerContainer-BTYGkg36.js +115 -0
- package/.output/public/assets/{ReplayDialog-RNhfLSsW.js → ReplayDialog-B-3V95xT.js} +1 -1
- package/.output/public/assets/{RequestAnatomy-fsUI5HhH.js → RequestAnatomy-CT8hLGLa.js} +1 -1
- package/.output/public/assets/{ResponseView-B3YTDBBX.js → ResponseView-DK3CYom0.js} +1 -1
- package/.output/public/assets/{StreamingChunkSequence-CbGqQ0mO.js → StreamingChunkSequence-D3jJutjp.js} +1 -1
- package/.output/public/assets/_sessionId-DpdfAzbo.js +1 -0
- package/.output/public/assets/index-780zTVwp.css +1 -0
- package/.output/public/assets/index-BpJNbm9G.js +1 -0
- package/.output/public/assets/{main-lTQKpxiU.js → main-hF_572U6.js} +2 -2
- package/.output/server/_libs/lucide-react.mjs +27 -27
- package/.output/server/{_sessionId-DsF6LFJG.mjs → _sessionId-BqhNE2M8.mjs} +2 -2
- package/.output/server/_ssr/{CompareDrawer-DgdZcMpg.mjs → CompareDrawer-C4LQW4S1.mjs} +3 -3
- package/.output/server/_ssr/{ProxyViewerContainer-DaFW1IVu.mjs → ProxyViewerContainer-BKInvawk.mjs} +214 -41
- package/.output/server/_ssr/{ReplayDialog-BOaTX1ir.mjs → ReplayDialog-C3ZiRihL.mjs} +4 -4
- package/.output/server/_ssr/{RequestAnatomy-C-2_dejd.mjs → RequestAnatomy-DlVAPIQZ.mjs} +3 -3
- package/.output/server/_ssr/{ResponseView-BtRVhgzy.mjs → ResponseView-nMS0rkxu.mjs} +3 -3
- package/.output/server/_ssr/{StreamingChunkSequence-DZaerowX.mjs → StreamingChunkSequence-PDWqrNiO.mjs} +3 -3
- package/.output/server/_ssr/{index-B3_fgwFy.mjs → index-Cd1zD-lo.mjs} +2 -2
- package/.output/server/_ssr/index.mjs +2 -2
- package/.output/server/_ssr/{router-CDOnHAWy.mjs → router-R9gm7_sh.mjs} +394 -151
- package/.output/server/{_tanstack-start-manifest_v-Brrx1NEa.mjs → _tanstack-start-manifest_v-BnLVH_EX.mjs} +1 -1
- package/.output/server/index.mjs +60 -60
- package/package.json +1 -1
- package/src/cli/templates/codex-skill-onboard.ts +5 -0
- package/src/cli/templates/skill-onboard.ts +5 -0
- package/src/components/OnboardingBanner.tsx +4 -0
- package/src/components/ProxyViewer.tsx +5 -0
- package/src/components/providers/ProviderCard.tsx +178 -38
- package/src/components/providers/ProvidersPanel.tsx +21 -3
- package/src/components/providers/SettingsDialog.tsx +76 -2
- package/src/lib/providerTestContract.ts +13 -0
- package/src/lib/runtimeConfig.ts +8 -0
- package/src/lib/useOnboarding.ts +3 -0
- package/src/lib/useStripConfig.ts +22 -0
- package/src/proxy/config.ts +4 -0
- package/src/proxy/store.ts +198 -135
- package/src/routes/api/config.ts +7 -0
- package/src/routes/api/logs.stream.ts +1 -1
- package/src/routes/api/providers.$providerId.test.log.ts +28 -12
- package/.output/public/assets/ProxyViewerContainer-BT8Ilsbs.js +0 -114
- package/.output/public/assets/_sessionId-C9cpyfLX.js +0 -1
- package/.output/public/assets/index-0mTTpvA2.js +0 -1
- package/.output/public/assets/index-DynnYt7S.css +0 -1
|
@@ -1,114 +0,0 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/CompareDrawer-ztKMd-FE.js","assets/main-lTQKpxiU.js","assets/ReplayDialog-RNhfLSsW.js","assets/ResponseView-B3YTDBBX.js","assets/RequestAnatomy-fsUI5HhH.js","assets/StreamingChunkSequence-CbGqQ0mO.js"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{u as Ji,a as Zu,r as b,j as l,c as Zr,g as Gi,b as Mr,d as at,e as qu,f as sg,h as ig,_ as Sn}from"./main-lTQKpxiU.js";function te(e,t,n){function r(a,c){if(a._zod||Object.defineProperty(a,"_zod",{value:{def:c,constr:i,traits:new Set},enumerable:!1}),a._zod.traits.has(e))return;a._zod.traits.add(e),t(a,c);const u=i.prototype,d=Object.keys(u);for(let f=0;f<d.length;f++){const h=d[f];h in a||(a[h]=u[h].bind(a))}}const o=n?.Parent??Object;class s extends o{}Object.defineProperty(s,"name",{value:e});function i(a){var c;const u=n?.Parent?new s:this;r(u,a),(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:a=>n?.Parent&&a instanceof n.Parent?!0:a?._zod?.traits?.has(e)}),Object.defineProperty(i,"name",{value:e}),i}class $n extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class Ku extends Error{constructor(t){super(`Encountered unidirectional transform during encode: ${t}`),this.name="ZodEncodeError"}}const Ju={};function nn(e){return Ju}function Gu(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 oi(e,t){return typeof t=="bigint"?t.toString():t}function Ho(e){return{get value(){{const t=e();return Object.defineProperty(this,"value",{value:t}),t}}}}function Yi(e){return e==null}function Xi(e){const t=e.startsWith("^")?1:0,n=e.endsWith("$")?e.length-1:e.length;return e.slice(t,n)}function ag(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(".","")),a=Number.parseInt(t.toFixed(s).replace(".",""));return i%a/10**s}const cl=Symbol("evaluating");function Ae(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 Cn(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function ln(...e){const t={};for(const n of e){const r=Object.getOwnPropertyDescriptors(n);Object.assign(t,r)}return Object.defineProperties({},t)}function ul(e){return JSON.stringify(e)}function lg(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}const Yu="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function Cr(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}const cg=Ho(()=>{if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{const e=Function;return new e(""),!0}catch{return!1}});function Zn(e){if(Cr(e)===!1)return!1;const t=e.constructor;if(t===void 0||typeof t!="function")return!0;const n=t.prototype;return!(Cr(n)===!1||Object.prototype.hasOwnProperty.call(n,"isPrototypeOf")===!1)}function Xu(e){return Zn(e)?{...e}:Array.isArray(e)?[...e]:e}const ug=new Set(["string","number","symbol"]);function qn(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function cn(e,t,n){const r=new e._zod.constr(t??e._zod.def);return(!t||n?.parent)&&(r._zod.parent=e),r}function ve(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 dg(e){return Object.keys(e).filter(t=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}const fg={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 pg(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=ln(e._zod.def,{get shape(){const i={};for(const a in t){if(!(a in n.shape))throw new Error(`Unrecognized key: "${a}"`);t[a]&&(i[a]=n.shape[a])}return Cn(this,"shape",i),i},checks:[]});return cn(e,s)}function hg(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=ln(e._zod.def,{get shape(){const i={...e._zod.def.shape};for(const a in t){if(!(a in n.shape))throw new Error(`Unrecognized key: "${a}"`);t[a]&&delete i[a]}return Cn(this,"shape",i),i},checks:[]});return cn(e,s)}function mg(e,t){if(!Zn(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=ln(e._zod.def,{get shape(){const s={...e._zod.def.shape,...t};return Cn(this,"shape",s),s}});return cn(e,o)}function gg(e,t){if(!Zn(t))throw new Error("Invalid input to safeExtend: expected a plain object");const n=ln(e._zod.def,{get shape(){const r={...e._zod.def.shape,...t};return Cn(this,"shape",r),r}});return cn(e,n)}function xg(e,t){const n=ln(e._zod.def,{get shape(){const r={...e._zod.def.shape,...t._zod.def.shape};return Cn(this,"shape",r),r},get catchall(){return t._zod.def.catchall},checks:[]});return cn(e,n)}function yg(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=ln(t._zod.def,{get shape(){const a=t._zod.def.shape,c={...a};if(n)for(const u in n){if(!(u in a))throw new Error(`Unrecognized key: "${u}"`);n[u]&&(c[u]=e?new e({type:"optional",innerType:a[u]}):a[u])}else for(const u in a)c[u]=e?new e({type:"optional",innerType:a[u]}):a[u];return Cn(this,"shape",c),c},checks:[]});return cn(t,i)}function bg(e,t,n){const r=ln(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 Cn(this,"shape",s),s}});return cn(t,r)}function Dn(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 Fn(e,t){return t.map(n=>{var r;return(r=n).path??(r.path=[]),n.path.unshift(e),n})}function qr(e){return typeof e=="string"?e:e?.message}function rn(e,t,n){const r={...e,path:e.path??[]};if(!e.message){const o=qr(e.inst?._zod.def?.error?.(e))??qr(t?.error?.(e))??qr(n.customError?.(e))??qr(n.localeError?.(e))??"Invalid input";r.message=o}return delete r.inst,delete r.continue,t?.reportInput||delete r.input,r}function Qi(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}function jr(...e){const[t,n,r]=e;return typeof t=="string"?{message:t,code:"custom",input:n,inst:r}:{...t}}const Qu=(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,oi,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},ed=te("$ZodError",Qu),td=te("$ZodError",Qu,{Parent:Error});function vg(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,a=0;for(;a<s.path.length;){const c=s.path[a];a===s.path.length-1?(i[c]=i[c]||{_errors:[]},i[c]._errors.push(t(s))):i[c]=i[c]||{_errors:[]},i=i[c],a++}}};return r(e),n}const ea=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 $n;if(i.issues.length){const a=new(o?.Err??e)(i.issues.map(c=>rn(c,s,nn())));throw Yu(a,o?.callee),a}return i.value},ta=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 a=new(o?.Err??e)(i.issues.map(c=>rn(c,s,nn())));throw Yu(a,o?.callee),a}return i.value},Wo=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 $n;return s.issues.length?{success:!1,error:new(e??ed)(s.issues.map(i=>rn(i,o,nn())))}:{success:!0,data:s.value}},kg=Wo(td),Zo=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=>rn(i,o,nn())))}:{success:!0,data:s.value}},_g=Zo(td),Sg=e=>(t,n,r)=>{const o=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return ea(e)(t,n,o)},Cg=e=>(t,n,r)=>ea(e)(t,n,r),jg=e=>async(t,n,r)=>{const o=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return ta(e)(t,n,o)},Eg=e=>async(t,n,r)=>ta(e)(t,n,r),Ng=e=>(t,n,r)=>{const o=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return Wo(e)(t,n,o)},Tg=e=>(t,n,r)=>Wo(e)(t,n,r),Ag=e=>async(t,n,r)=>{const o=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return Zo(e)(t,n,o)},Ig=e=>async(t,n,r)=>Zo(e)(t,n,r),zg=/^[cC][^\s-]{8,}$/,Rg=/^[0-9a-z]+$/,Pg=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,Og=/^[0-9a-vA-V]{20}$/,Mg=/^[A-Za-z0-9]{27}$/,Lg=/^[a-zA-Z0-9_-]{21}$/,Dg=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,Fg=/^([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})$/,dl=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)$/,$g=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,Bg="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function Ug(){return new RegExp(Bg,"u")}const Vg=/^(?:(?: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])$/,Hg=/^(([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}|:))$/,Wg=/^((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])$/,Zg=/^(([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])$/,qg=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,nd=/^[A-Za-z0-9_-]*$/,Kg=/^\+[1-9]\d{6,14}$/,rd="(?:(?:\\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])))",Jg=new RegExp(`^${rd}$`);function od(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 Gg(e){return new RegExp(`^${od(e)}$`)}function Yg(e){const t=od({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(`^${rd}T(?:${r})$`)}const Xg=e=>{const t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${t}$`)},Qg=/^-?\d+$/,sd=/^-?\d+(?:\.\d+)?$/,ex=/^(?:true|false)$/i,tx=/^null$/i,nx=/^[^A-Z]*$/,rx=/^[^a-z]*$/,ut=te("$ZodCheck",(e,t)=>{var n;e._zod??(e._zod={}),e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),id={number:"number",bigint:"bigint",object:"date"},ad=te("$ZodCheckLessThan",(e,t)=>{ut.init(e,t);const n=id[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})}}),ld=te("$ZodCheckGreaterThan",(e,t)=>{ut.init(e,t);const n=id[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})}}),ox=te("$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):ag(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})}}),sx=te("$ZodCheckNumberFormat",(e,t)=>{ut.init(e,t),t.format=t.format||"float64";const n=t.format?.includes("int"),r=n?"int":"number",[o,s]=fg[t.format];e._zod.onattach.push(i=>{const a=i._zod.bag;a.format=t.format,a.minimum=o,a.maximum=s,n&&(a.pattern=Qg)}),e._zod.check=i=>{const a=i.value;if(n){if(!Number.isInteger(a)){i.issues.push({expected:r,format:t.format,code:"invalid_type",continue:!1,input:a,inst:e});return}if(!Number.isSafeInteger(a)){a>0?i.issues.push({input:a,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:r,inclusive:!0,continue:!t.abort}):i.issues.push({input:a,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:r,inclusive:!0,continue:!t.abort});return}}a<o&&i.issues.push({origin:"number",input:a,code:"too_small",minimum:o,inclusive:!0,inst:e,continue:!t.abort}),a>s&&i.issues.push({origin:"number",input:a,code:"too_big",maximum:s,inclusive:!0,inst:e,continue:!t.abort})}}),ix=te("$ZodCheckMaxLength",(e,t)=>{var n;ut.init(e,t),(n=e._zod.def).when??(n.when=r=>{const o=r.value;return!Yi(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=Qi(o);r.issues.push({origin:i,code:"too_big",maximum:t.maximum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),ax=te("$ZodCheckMinLength",(e,t)=>{var n;ut.init(e,t),(n=e._zod.def).when??(n.when=r=>{const o=r.value;return!Yi(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=Qi(o);r.issues.push({origin:i,code:"too_small",minimum:t.minimum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),lx=te("$ZodCheckLengthEquals",(e,t)=>{var n;ut.init(e,t),(n=e._zod.def).when??(n.when=r=>{const o=r.value;return!Yi(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=Qi(o),a=s>t.length;r.issues.push({origin:i,...a?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:r.value,inst:e,continue:!t.abort})}}),qo=te("$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=()=>{})}),cx=te("$ZodCheckRegex",(e,t)=>{qo.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})}}),ux=te("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=nx),qo.init(e,t)}),dx=te("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=rx),qo.init(e,t)}),fx=te("$ZodCheckIncludes",(e,t)=>{ut.init(e,t);const n=qn(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})}}),px=te("$ZodCheckStartsWith",(e,t)=>{ut.init(e,t);const n=new RegExp(`^${qn(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})}}),hx=te("$ZodCheckEndsWith",(e,t)=>{ut.init(e,t);const n=new RegExp(`.*${qn(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})}}),mx=te("$ZodCheckOverwrite",(e,t)=>{ut.init(e,t),e._zod.check=n=>{n.value=t.tx(n.value)}});class gx{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 xx={major:4,minor:3,patch:6},He=te("$ZodType",(e,t)=>{var n;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=xx;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,a,c)=>{let u=Dn(i),d;for(const f of a){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 $n;if(d||p instanceof Promise)d=(d??Promise.resolve()).then(async()=>{await p,i.issues.length!==h&&(u||(u=Dn(i,h)))});else{if(i.issues.length===h)continue;u||(u=Dn(i,h))}}return d?d.then(()=>i):i},s=(i,a,c)=>{if(Dn(i))return i.aborted=!0,i;const u=o(a,r,c);if(u instanceof Promise){if(c.async===!1)throw new $n;return u.then(d=>e._zod.parse(d,c))}return e._zod.parse(u,c)};e._zod.run=(i,a)=>{if(a.skipChecks)return e._zod.parse(i,a);if(a.direction==="backward"){const u=e._zod.parse({value:i.value,issues:[]},{...a,skipChecks:!0});return u instanceof Promise?u.then(d=>s(d,i,a)):s(u,i,a)}const c=e._zod.parse(i,a);if(c instanceof Promise){if(a.async===!1)throw new $n;return c.then(u=>o(u,r,a))}return o(c,r,a)}}Ae(e,"~standard",()=>({validate:o=>{try{const s=kg(e,o);return s.success?{value:s.data}:{issues:s.error?.issues}}catch{return _g(e,o).then(i=>i.success?{value:i.data}:{issues:i.error?.issues})}},vendor:"zod",version:1}))}),na=te("$ZodString",(e,t)=>{He.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??Xg(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}}),Ze=te("$ZodStringFormat",(e,t)=>{qo.init(e,t),na.init(e,t)}),yx=te("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=Fg),Ze.init(e,t)}),bx=te("$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=dl(r))}else t.pattern??(t.pattern=dl());Ze.init(e,t)}),vx=te("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=$g),Ze.init(e,t)}),wx=te("$ZodURL",(e,t)=>{Ze.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})}}}),kx=te("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=Ug()),Ze.init(e,t)}),_x=te("$ZodNanoID",(e,t)=>{t.pattern??(t.pattern=Lg),Ze.init(e,t)}),Sx=te("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=zg),Ze.init(e,t)}),Cx=te("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=Rg),Ze.init(e,t)}),jx=te("$ZodULID",(e,t)=>{t.pattern??(t.pattern=Pg),Ze.init(e,t)}),Ex=te("$ZodXID",(e,t)=>{t.pattern??(t.pattern=Og),Ze.init(e,t)}),Nx=te("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=Mg),Ze.init(e,t)}),Tx=te("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=Yg(t)),Ze.init(e,t)}),Ax=te("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=Jg),Ze.init(e,t)}),Ix=te("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=Gg(t)),Ze.init(e,t)}),zx=te("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=Dg),Ze.init(e,t)}),Rx=te("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=Vg),Ze.init(e,t),e._zod.bag.format="ipv4"}),Px=te("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=Hg),Ze.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})}}}),Ox=te("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=Wg),Ze.init(e,t)}),Mx=te("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=Zg),Ze.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 cd(e){if(e==="")return!0;if(e.length%4!==0)return!1;try{return atob(e),!0}catch{return!1}}const Lx=te("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=qg),Ze.init(e,t),e._zod.bag.contentEncoding="base64",e._zod.check=n=>{cd(n.value)||n.issues.push({code:"invalid_format",format:"base64",input:n.value,inst:e,continue:!t.abort})}});function Dx(e){if(!nd.test(e))return!1;const t=e.replace(/[-_]/g,r=>r==="-"?"+":"/"),n=t.padEnd(Math.ceil(t.length/4)*4,"=");return cd(n)}const Fx=te("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=nd),Ze.init(e,t),e._zod.bag.contentEncoding="base64url",e._zod.check=n=>{Dx(n.value)||n.issues.push({code:"invalid_format",format:"base64url",input:n.value,inst:e,continue:!t.abort})}}),$x=te("$ZodE164",(e,t)=>{t.pattern??(t.pattern=Kg),Ze.init(e,t)});function Bx(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 Ux=te("$ZodJWT",(e,t)=>{Ze.init(e,t),e._zod.check=n=>{Bx(n.value,t.alg)||n.issues.push({code:"invalid_format",format:"jwt",input:n.value,inst:e,continue:!t.abort})}}),ud=te("$ZodNumber",(e,t)=>{He.init(e,t),e._zod.pattern=e._zod.bag.pattern??sd,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}}),Vx=te("$ZodNumberFormat",(e,t)=>{sx.init(e,t),ud.init(e,t)}),Hx=te("$ZodBoolean",(e,t)=>{He.init(e,t),e._zod.pattern=ex,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}}),Wx=te("$ZodNull",(e,t)=>{He.init(e,t),e._zod.pattern=tx,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}}),Zx=te("$ZodUnknown",(e,t)=>{He.init(e,t),e._zod.parse=n=>n}),qx=te("$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 fl(e,t,n){e.issues.length&&t.issues.push(...Fn(n,e.issues)),t.value[n]=e.value}const Kx=te("$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 a=o[i],c=t.element._zod.run({value:a,issues:[]},r);c instanceof Promise?s.push(c.then(u=>fl(u,n,i))):fl(c,n,i)}return s.length?Promise.all(s).then(()=>n):n}});function ko(e,t,n,r,o){if(e.issues.length){if(o&&!(n in r))return;t.issues.push(...Fn(n,e.issues))}e.value===void 0?n in r&&(t.value[n]=void 0):t.value[n]=e.value}function dd(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=dg(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(n)}}function fd(e,t,n,r,o,s){const i=[],a=o.keySet,c=o.catchall._zod,u=c.def.type,d=c.optout==="optional";for(const f in t){if(a.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=>ko(p,n,f,t,d))):ko(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 Jx=te("$ZodObject",(e,t)=>{if(He.init(e,t),!Object.getOwnPropertyDescriptor(t,"shape")?.get){const a=t.shape;Object.defineProperty(t,"shape",{get:()=>{const c={...a};return Object.defineProperty(t,"shape",{value:c}),c}})}const r=Ho(()=>dd(t));Ae(e._zod,"propValues",()=>{const a=t.shape,c={};for(const u in a){const d=a[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=Cr,s=t.catchall;let i;e._zod.parse=(a,c)=>{i??(i=r.value);const u=a.value;if(!o(u))return a.issues.push({expected:"object",code:"invalid_type",input:u,inst:e}),a;a.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=>ko(g,a,h,u,x))):ko(m,a,h,u,x)}return s?fd(d,u,a,c,r.value,e):d.length?Promise.all(d).then(()=>a):a}}),Gx=te("$ZodObjectJIT",(e,t)=>{Jx.init(e,t);const n=e._zod.parse,r=Ho(()=>dd(t)),o=h=>{const p=new gx(["shape","payload","ctx"]),x=r.value,m=k=>{const S=ul(k);return`shape[${S}]._zod.run({ value: input[${S}], issues: [] }, ctx)`};p.write("const input = payload.value;");const g=Object.create(null);let y=0;for(const k of x.keys)g[k]=`key_${y++}`;p.write("const newResult = {};");for(const k of x.keys){const S=g[k],C=ul(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=Cr,a=!Ju.jitless,u=a&&cg.value,d=t.catchall;let f;e._zod.parse=(h,p)=>{f??(f=r.value);const x=h.value;return i(x)?a&&u&&p?.async===!1&&p.jitless!==!0?(s||(s=o(t.shape)),h=s(h,p),d?fd([],x,h,p,f,e):h):n(h,p):(h.issues.push({expected:"object",code:"invalid_type",input:x,inst:e}),h)}});function pl(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=>!Dn(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=>rn(i,r,nn())))}),t)}const pd=te("$ZodUnion",(e,t)=>{He.init(e,t),Ae(e._zod,"optin",()=>t.options.some(o=>o._zod.optin==="optional")?"optional":void 0),Ae(e._zod,"optout",()=>t.options.some(o=>o._zod.optout==="optional")?"optional":void 0),Ae(e._zod,"values",()=>{if(t.options.every(o=>o._zod.values))return new Set(t.options.flatMap(o=>Array.from(o._zod.values)))}),Ae(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=>Xi(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 a=[];for(const c of t.options){const u=c._zod.run({value:o.value,issues:[]},s);if(u instanceof Promise)a.push(u),i=!0;else{if(u.issues.length===0)return u;a.push(u)}}return i?Promise.all(a).then(c=>pl(c,o,e,s)):pl(a,o,e,s)}}),Yx=te("$ZodDiscriminatedUnion",(e,t)=>{t.inclusive=!1,pd.init(e,t);const n=e._zod.parse;Ae(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[a,c]of Object.entries(i)){o[a]||(o[a]=new Set);for(const u of c)o[a].add(u)}}return o});const r=Ho(()=>{const o=t.options,s=new Map;for(const i of o){const a=i._zod.propValues?.[t.discriminator];if(!a||a.size===0)throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(i)}"`);for(const c of a){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(!Cr(i))return o.issues.push({code:"invalid_type",expected:"object",input:i,inst:e}),o;const a=r.value.get(i?.[t.discriminator]);return a?a._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)}}),Xx=te("$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])=>hl(n,c,u)):hl(n,s,i)}});function si(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(Zn(e)&&Zn(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=si(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=si(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 hl(e,t,n){const r=new Map;let o;for(const a of t.issues)if(a.code==="unrecognized_keys"){o??(o=a);for(const c of a.keys)r.has(c)||r.set(c,{}),r.get(c).l=!0}else e.issues.push(a);for(const a of n.issues)if(a.code==="unrecognized_keys")for(const c of a.keys)r.has(c)||r.set(c,{}),r.get(c).r=!0;else e.issues.push(a);const s=[...r].filter(([,a])=>a.l&&a.r).map(([a])=>a);if(s.length&&o&&e.issues.push({...o,keys:s}),Dn(e))return e;const i=si(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 Qx=te("$ZodRecord",(e,t)=>{He.init(e,t),e._zod.parse=(n,r)=>{const o=n.value;if(!Zn(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 a=new Set;for(const u of i)if(typeof u=="string"||typeof u=="number"||typeof u=="symbol"){a.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(...Fn(u,f.issues)),n.value[u]=f.value})):(d.issues.length&&n.issues.push(...Fn(u,d.issues)),n.value[u]=d.value)}let c;for(const u in o)a.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 a of Reflect.ownKeys(o)){if(a==="__proto__")continue;let c=t.keyType._zod.run({value:a,issues:[]},r);if(c instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(typeof a=="string"&&sd.test(a)&&c.issues.length){const f=t.keyType._zod.run({value:Number(a),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[a]=o[a]:n.issues.push({code:"invalid_key",origin:"record",issues:c.issues.map(f=>rn(f,r,nn())),input:a,path:[a],inst:e});continue}const d=t.valueType._zod.run({value:o[a],issues:[]},r);d instanceof Promise?s.push(d.then(f=>{f.issues.length&&n.issues.push(...Fn(a,f.issues)),n.value[c.value]=f.value})):(d.issues.length&&n.issues.push(...Fn(a,d.issues)),n.value[c.value]=d.value)}}return s.length?Promise.all(s).then(()=>n):n}}),e0=te("$ZodEnum",(e,t)=>{He.init(e,t);const n=Gu(t.entries),r=new Set(n);e._zod.values=r,e._zod.pattern=new RegExp(`^(${n.filter(o=>ug.has(typeof o)).map(o=>typeof o=="string"?qn(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}}),t0=te("$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"?qn(r):r?qn(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}}),n0=te("$ZodTransform",(e,t)=>{He.init(e,t),e._zod.parse=(n,r)=>{if(r.direction==="backward")throw new Ku(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 $n;return n.value=o,n}});function ml(e,t){return e.issues.length&&t===void 0?{issues:[],value:void 0}:e}const hd=te("$ZodOptional",(e,t)=>{He.init(e,t),e._zod.optin="optional",e._zod.optout="optional",Ae(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),Ae(e._zod,"pattern",()=>{const n=t.innerType._zod.pattern;return n?new RegExp(`^(${Xi(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=>ml(s,n.value)):ml(o,n.value)}return n.value===void 0?n:t.innerType._zod.run(n,r)}}),r0=te("$ZodExactOptional",(e,t)=>{hd.init(e,t),Ae(e._zod,"values",()=>t.innerType._zod.values),Ae(e._zod,"pattern",()=>t.innerType._zod.pattern),e._zod.parse=(n,r)=>t.innerType._zod.run(n,r)}),o0=te("$ZodNullable",(e,t)=>{He.init(e,t),Ae(e._zod,"optin",()=>t.innerType._zod.optin),Ae(e._zod,"optout",()=>t.innerType._zod.optout),Ae(e._zod,"pattern",()=>{const n=t.innerType._zod.pattern;return n?new RegExp(`^(${Xi(n.source)}|null)$`):void 0}),Ae(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)}),s0=te("$ZodDefault",(e,t)=>{He.init(e,t),e._zod.optin="optional",Ae(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(n,r)=>{if(r.direction==="backward")return t.innerType._zod.run(n,r);if(n.value===void 0)return n.value=t.defaultValue,n;const o=t.innerType._zod.run(n,r);return o instanceof Promise?o.then(s=>gl(s,t)):gl(o,t)}});function gl(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}const i0=te("$ZodPrefault",(e,t)=>{He.init(e,t),e._zod.optin="optional",Ae(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))}),a0=te("$ZodNonOptional",(e,t)=>{He.init(e,t),Ae(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=>xl(s,e)):xl(o,e)}});function xl(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 l0=te("$ZodCatch",(e,t)=>{He.init(e,t),Ae(e._zod,"optin",()=>t.innerType._zod.optin),Ae(e._zod,"optout",()=>t.innerType._zod.optout),Ae(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=>rn(i,r,nn()))},input:n.value}),n.issues=[]),n)):(n.value=o.value,o.issues.length&&(n.value=t.catchValue({...n,error:{issues:o.issues.map(s=>rn(s,r,nn()))},input:n.value}),n.issues=[]),n)}}),c0=te("$ZodPipe",(e,t)=>{He.init(e,t),Ae(e._zod,"values",()=>t.in._zod.values),Ae(e._zod,"optin",()=>t.in._zod.optin),Ae(e._zod,"optout",()=>t.out._zod.optout),Ae(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=>Kr(i,t.in,r)):Kr(s,t.in,r)}const o=t.in._zod.run(n,r);return o instanceof Promise?o.then(s=>Kr(s,t.out,r)):Kr(o,t.out,r)}});function Kr(e,t,n){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},n)}const u0=te("$ZodReadonly",(e,t)=>{He.init(e,t),Ae(e._zod,"propValues",()=>t.innerType._zod.propValues),Ae(e._zod,"values",()=>t.innerType._zod.values),Ae(e._zod,"optin",()=>t.innerType?._zod?.optin),Ae(e._zod,"optout",()=>t.innerType?._zod?.optout),e._zod.parse=(n,r)=>{if(r.direction==="backward")return t.innerType._zod.run(n,r);const o=t.innerType._zod.run(n,r);return o instanceof Promise?o.then(yl):yl(o)}});function yl(e){return e.value=Object.freeze(e.value),e}const d0=te("$ZodLazy",(e,t)=>{He.init(e,t),Ae(e._zod,"innerType",()=>t.getter()),Ae(e._zod,"pattern",()=>e._zod.innerType?._zod?.pattern),Ae(e._zod,"propValues",()=>e._zod.innerType?._zod?.propValues),Ae(e._zod,"optin",()=>e._zod.innerType?._zod?.optin??void 0),Ae(e._zod,"optout",()=>e._zod.innerType?._zod?.optout??void 0),e._zod.parse=(n,r)=>e._zod.innerType._zod.run(n,r)}),f0=te("$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=>bl(s,n,r,e));bl(o,n,r,e)}});function bl(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(jr(o))}}var vl;class p0{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 h0(){return new p0}(vl=globalThis).__zod_globalRegistry??(vl.__zod_globalRegistry=h0());const xr=globalThis.__zod_globalRegistry;function m0(e,t){return new e({type:"string",...ve(t)})}function g0(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...ve(t)})}function wl(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...ve(t)})}function x0(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...ve(t)})}function y0(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...ve(t)})}function b0(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...ve(t)})}function v0(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...ve(t)})}function w0(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...ve(t)})}function k0(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...ve(t)})}function _0(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...ve(t)})}function S0(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...ve(t)})}function C0(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...ve(t)})}function j0(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...ve(t)})}function E0(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...ve(t)})}function N0(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...ve(t)})}function T0(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...ve(t)})}function A0(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...ve(t)})}function I0(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...ve(t)})}function z0(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...ve(t)})}function R0(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...ve(t)})}function P0(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...ve(t)})}function O0(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...ve(t)})}function M0(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...ve(t)})}function L0(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...ve(t)})}function D0(e,t){return new e({type:"string",format:"date",check:"string_format",...ve(t)})}function F0(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...ve(t)})}function $0(e,t){return new e({type:"string",format:"duration",check:"string_format",...ve(t)})}function B0(e,t){return new e({type:"number",checks:[],...ve(t)})}function U0(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...ve(t)})}function V0(e,t){return new e({type:"boolean",...ve(t)})}function H0(e,t){return new e({type:"null",...ve(t)})}function W0(e){return new e({type:"unknown"})}function Z0(e,t){return new e({type:"never",...ve(t)})}function kl(e,t){return new ad({check:"less_than",...ve(t),value:e,inclusive:!1})}function ws(e,t){return new ad({check:"less_than",...ve(t),value:e,inclusive:!0})}function _l(e,t){return new ld({check:"greater_than",...ve(t),value:e,inclusive:!1})}function ks(e,t){return new ld({check:"greater_than",...ve(t),value:e,inclusive:!0})}function Sl(e,t){return new ox({check:"multiple_of",...ve(t),value:e})}function md(e,t){return new ix({check:"max_length",...ve(t),maximum:e})}function _o(e,t){return new ax({check:"min_length",...ve(t),minimum:e})}function gd(e,t){return new lx({check:"length_equals",...ve(t),length:e})}function q0(e,t){return new cx({check:"string_format",format:"regex",...ve(t),pattern:e})}function K0(e){return new ux({check:"string_format",format:"lowercase",...ve(e)})}function J0(e){return new dx({check:"string_format",format:"uppercase",...ve(e)})}function G0(e,t){return new fx({check:"string_format",format:"includes",...ve(t),includes:e})}function Y0(e,t){return new px({check:"string_format",format:"starts_with",...ve(t),prefix:e})}function X0(e,t){return new hx({check:"string_format",format:"ends_with",...ve(t),suffix:e})}function Qn(e){return new mx({check:"overwrite",tx:e})}function Q0(e){return Qn(t=>t.normalize(e))}function e1(){return Qn(e=>e.trim())}function t1(){return Qn(e=>e.toLowerCase())}function n1(){return Qn(e=>e.toUpperCase())}function r1(){return Qn(e=>lg(e))}function o1(e,t,n){return new e({type:"array",element:t,...ve(n)})}function s1(e,t,n){return new e({type:"custom",check:"custom",fn:t,...ve(n)})}function i1(e){const t=a1(n=>(n.addIssue=r=>{if(typeof r=="string")n.issues.push(jr(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(jr(o))}},e(n.value,n)));return t}function a1(e,t){const n=new ut({check:"custom",...ve(t)});return n._zod.check=e,n}function xd(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??xr,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 a=e._zod.toJSONSchema?.();if(a)i.schema=a;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 yd(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 a=e.metadataRegistry.get(i[0])?.id;if(a){const c=r.get(a);if(c&&c!==i[0])throw new Error(`Duplicate schema id "${a}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);r.set(a,i[0])}}const o=i=>{const a=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")}#/${a}/${p}`}}if(i[1]===n)return{ref:"#"};const u=`#/${a}/`,d=i[1].schema.id??`__schema${e.counter++}`;return{defId:d,ref:u+d}},s=i=>{if(i[1].schema.$ref)return;const a=i[1],{ref:c,defId:u}=o(i);a.def={...a.schema},u&&(a.defId=u);const d=a.schema;for(const f in d)delete d[f];d.$ref=c};if(e.cycles==="throw")for(const i of e.seen.entries()){const a=i[1];if(a.cycle)throw new Error(`Cycle detected: #/${a.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 a=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(a.cycle){s(i);continue}if(a.count>1&&e.reused==="ref"){s(i);continue}}}function bd(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 a=e.seen.get(i);if(a.ref===null)return;const c=a.def??a.schema,u={...c},d=a.ref;if(a.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:a.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 a=i[1];a.def&&a.defId&&(s[a.defId]=a.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:So(t,"input",e.processors),output:So(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 l1=(e,t={})=>n=>{const r=xd({...n,processors:t});return Ge(e,r),yd(r,e),bd(r,e)},So=(e,t,n={})=>r=>{const{libraryOptions:o,target:s}=r??{},i=xd({...o??{},target:s,io:t,processors:n});return Ge(e,i),yd(i,e),bd(i,e)},c1={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},u1=(e,t,n,r)=>{const o=n;o.type="string";const{minimum:s,maximum:i,format:a,patterns:c,contentEncoding:u}=e._zod.bag;if(typeof s=="number"&&(o.minLength=s),typeof i=="number"&&(o.maxLength=i),a&&(o.format=c1[a]??a,o.format===""&&delete o.format,a==="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}))])}},d1=(e,t,n,r)=>{const o=n,{minimum:s,maximum:i,format:a,multipleOf:c,exclusiveMaximum:u,exclusiveMinimum:d}=e._zod.bag;typeof a=="string"&&a.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)},f1=(e,t,n,r)=>{n.type="boolean"},p1=(e,t,n,r)=>{t.target==="openapi-3.0"?(n.type="string",n.nullable=!0,n.enum=[null]):n.type="null"},h1=(e,t,n,r)=>{n.not={}},m1=(e,t,n,r)=>{},g1=(e,t,n,r)=>{const o=e._zod.def,s=Gu(o.entries);s.every(i=>typeof i=="number")&&(n.type="number"),s.every(i=>typeof i=="string")&&(n.type="string"),n.enum=s},x1=(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},y1=(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")},v1=(e,t,n,r)=>{const o=n,s=e._zod.def,{minimum:i,maximum:a}=e._zod.bag;typeof i=="number"&&(o.minItems=i),typeof a=="number"&&(o.maxItems=a),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 a=new Set(Object.keys(i)),c=new Set([...a].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)},k1=(e,t,n,r)=>{const o=e._zod.def,s=o.inclusive===!1,i=o.options.map((a,c)=>Ge(a,t,{...r,path:[...r.path,s?"oneOf":"anyOf",c]}));s?n.oneOf=i:n.anyOf=i},_1=(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]}),a=u=>"allOf"in u&&Object.keys(u).length===1,c=[...a(s)?s.allOf:[s],...a(i)?i.allOf:[i]];n.allOf=c},S1=(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)}},C1=(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"}]},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},E1=(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))},N1=(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)))},T1=(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},A1=(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},I1=(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},vd=(e,t,n,r)=>{const o=e._zod.def;Ge(o.innerType,t,r);const s=t.seen.get(e);s.ref=o.innerType},z1=(e,t,n,r)=>{const o=e._zod.innerType;Ge(o,t,r);const s=t.seen.get(e);s.ref=o},R1=te("ZodISODateTime",(e,t)=>{Tx.init(e,t),Ke.init(e,t)});function P1(e){return L0(R1,e)}const O1=te("ZodISODate",(e,t)=>{Ax.init(e,t),Ke.init(e,t)});function M1(e){return D0(O1,e)}const L1=te("ZodISOTime",(e,t)=>{Ix.init(e,t),Ke.init(e,t)});function D1(e){return F0(L1,e)}const F1=te("ZodISODuration",(e,t)=>{zx.init(e,t),Ke.init(e,t)});function $1(e){return $0(F1,e)}const B1=(e,t)=>{ed.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:n=>wg(e,n)},flatten:{value:n=>vg(e,n)},addIssue:{value:n=>{e.issues.push(n),e.message=JSON.stringify(e.issues,oi,2)}},addIssues:{value:n=>{e.issues.push(...n),e.message=JSON.stringify(e.issues,oi,2)}},isEmpty:{get(){return e.issues.length===0}}})},yt=te("ZodError",B1,{Parent:Error}),U1=ea(yt),V1=ta(yt),H1=Wo(yt),W1=Zo(yt),Z1=Sg(yt),q1=Cg(yt),K1=jg(yt),J1=Eg(yt),G1=Ng(yt),Y1=Tg(yt),X1=Ag(yt),Q1=Ig(yt),We=te("ZodType",(e,t)=>(He.init(e,t),Object.assign(e["~standard"],{jsonSchema:{input:So(e,"input"),output:So(e,"output")}}),e.toJSONSchema=l1(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.check=(...n)=>e.clone(ln(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)=>cn(e,n,r),e.brand=()=>e,e.register=((n,r)=>(n.add(e,r),e)),e.parse=(n,r)=>U1(e,n,r,{callee:e.parse}),e.safeParse=(n,r)=>H1(e,n,r),e.parseAsync=async(n,r)=>V1(e,n,r,{callee:e.parseAsync}),e.safeParseAsync=async(n,r)=>W1(e,n,r),e.spa=e.safeParseAsync,e.encode=(n,r)=>Z1(e,n,r),e.decode=(n,r)=>q1(e,n,r),e.encodeAsync=async(n,r)=>K1(e,n,r),e.decodeAsync=async(n,r)=>J1(e,n,r),e.safeEncode=(n,r)=>G1(e,n,r),e.safeDecode=(n,r)=>Y1(e,n,r),e.safeEncodeAsync=async(n,r)=>X1(e,n,r),e.safeDecodeAsync=async(n,r)=>Q1(e,n,r),e.refine=(n,r)=>e.check(Jy(n,r)),e.superRefine=n=>e.check(Gy(n)),e.overwrite=n=>e.check(Qn(n)),e.optional=()=>El(e),e.exactOptional=()=>Py(e),e.nullable=()=>Nl(e),e.nullish=()=>El(Nl(e)),e.nonoptional=n=>$y(e,n),e.array=()=>Se(e),e.or=n=>Gt([e,n]),e.and=n=>Ny(e,n),e.transform=n=>Tl(e,zy(n)),e.default=n=>Ly(e,n),e.prefault=n=>Fy(e,n),e.catch=n=>Uy(e,n),e.pipe=n=>Tl(e,n),e.readonly=()=>Wy(e),e.describe=n=>{const r=e.clone();return xr.add(r,{description:n}),r},Object.defineProperty(e,"description",{get(){return xr.get(e)?.description},configurable:!0}),e.meta=(...n)=>{if(n.length===0)return xr.get(e);const r=e.clone();return xr.add(r,n[0]),r},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e.apply=n=>n(e),e)),wd=te("_ZodString",(e,t)=>{na.init(e,t),We.init(e,t),e._zod.processJSONSchema=(r,o,s)=>u1(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(q0(...r)),e.includes=(...r)=>e.check(G0(...r)),e.startsWith=(...r)=>e.check(Y0(...r)),e.endsWith=(...r)=>e.check(X0(...r)),e.min=(...r)=>e.check(_o(...r)),e.max=(...r)=>e.check(md(...r)),e.length=(...r)=>e.check(gd(...r)),e.nonempty=(...r)=>e.check(_o(1,...r)),e.lowercase=r=>e.check(K0(r)),e.uppercase=r=>e.check(J0(r)),e.trim=()=>e.check(e1()),e.normalize=(...r)=>e.check(Q0(...r)),e.toLowerCase=()=>e.check(t1()),e.toUpperCase=()=>e.check(n1()),e.slugify=()=>e.check(r1())}),ey=te("ZodString",(e,t)=>{na.init(e,t),wd.init(e,t),e.email=n=>e.check(g0(ty,n)),e.url=n=>e.check(w0(ny,n)),e.jwt=n=>e.check(M0(xy,n)),e.emoji=n=>e.check(k0(ry,n)),e.guid=n=>e.check(wl(Cl,n)),e.uuid=n=>e.check(x0(Jr,n)),e.uuidv4=n=>e.check(y0(Jr,n)),e.uuidv6=n=>e.check(b0(Jr,n)),e.uuidv7=n=>e.check(v0(Jr,n)),e.nanoid=n=>e.check(_0(oy,n)),e.guid=n=>e.check(wl(Cl,n)),e.cuid=n=>e.check(S0(sy,n)),e.cuid2=n=>e.check(C0(iy,n)),e.ulid=n=>e.check(j0(ay,n)),e.base64=n=>e.check(R0(hy,n)),e.base64url=n=>e.check(P0(my,n)),e.xid=n=>e.check(E0(ly,n)),e.ksuid=n=>e.check(N0(cy,n)),e.ipv4=n=>e.check(T0(uy,n)),e.ipv6=n=>e.check(A0(dy,n)),e.cidrv4=n=>e.check(I0(fy,n)),e.cidrv6=n=>e.check(z0(py,n)),e.e164=n=>e.check(O0(gy,n)),e.datetime=n=>e.check(P1(n)),e.date=n=>e.check(M1(n)),e.time=n=>e.check(D1(n)),e.duration=n=>e.check($1(n))});function W(e){return m0(ey,e)}const Ke=te("ZodStringFormat",(e,t)=>{Ze.init(e,t),wd.init(e,t)}),ty=te("ZodEmail",(e,t)=>{vx.init(e,t),Ke.init(e,t)}),Cl=te("ZodGUID",(e,t)=>{yx.init(e,t),Ke.init(e,t)}),Jr=te("ZodUUID",(e,t)=>{bx.init(e,t),Ke.init(e,t)}),ny=te("ZodURL",(e,t)=>{wx.init(e,t),Ke.init(e,t)}),ry=te("ZodEmoji",(e,t)=>{kx.init(e,t),Ke.init(e,t)}),oy=te("ZodNanoID",(e,t)=>{_x.init(e,t),Ke.init(e,t)}),sy=te("ZodCUID",(e,t)=>{Sx.init(e,t),Ke.init(e,t)}),iy=te("ZodCUID2",(e,t)=>{Cx.init(e,t),Ke.init(e,t)}),ay=te("ZodULID",(e,t)=>{jx.init(e,t),Ke.init(e,t)}),ly=te("ZodXID",(e,t)=>{Ex.init(e,t),Ke.init(e,t)}),cy=te("ZodKSUID",(e,t)=>{Nx.init(e,t),Ke.init(e,t)}),uy=te("ZodIPv4",(e,t)=>{Rx.init(e,t),Ke.init(e,t)}),dy=te("ZodIPv6",(e,t)=>{Px.init(e,t),Ke.init(e,t)}),fy=te("ZodCIDRv4",(e,t)=>{Ox.init(e,t),Ke.init(e,t)}),py=te("ZodCIDRv6",(e,t)=>{Mx.init(e,t),Ke.init(e,t)}),hy=te("ZodBase64",(e,t)=>{Lx.init(e,t),Ke.init(e,t)}),my=te("ZodBase64URL",(e,t)=>{Fx.init(e,t),Ke.init(e,t)}),gy=te("ZodE164",(e,t)=>{$x.init(e,t),Ke.init(e,t)}),xy=te("ZodJWT",(e,t)=>{Ux.init(e,t),Ke.init(e,t)}),kd=te("ZodNumber",(e,t)=>{ud.init(e,t),We.init(e,t),e._zod.processJSONSchema=(r,o,s)=>d1(e,r,o),e.gt=(r,o)=>e.check(_l(r,o)),e.gte=(r,o)=>e.check(ks(r,o)),e.min=(r,o)=>e.check(ks(r,o)),e.lt=(r,o)=>e.check(kl(r,o)),e.lte=(r,o)=>e.check(ws(r,o)),e.max=(r,o)=>e.check(ws(r,o)),e.int=r=>e.check(jl(r)),e.safe=r=>e.check(jl(r)),e.positive=r=>e.check(_l(0,r)),e.nonnegative=r=>e.check(ks(0,r)),e.negative=r=>e.check(kl(0,r)),e.nonpositive=r=>e.check(ws(0,r)),e.multipleOf=(r,o)=>e.check(Sl(r,o)),e.step=(r,o)=>e.check(Sl(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 pe(e){return B0(kd,e)}const yy=te("ZodNumberFormat",(e,t)=>{Vx.init(e,t),kd.init(e,t)});function jl(e){return U0(yy,e)}const by=te("ZodBoolean",(e,t)=>{Hx.init(e,t),We.init(e,t),e._zod.processJSONSchema=(n,r,o)=>f1(e,n,r)});function nt(e){return V0(by,e)}const vy=te("ZodNull",(e,t)=>{Wx.init(e,t),We.init(e,t),e._zod.processJSONSchema=(n,r,o)=>p1(e,n,r)});function ii(e){return H0(vy,e)}const wy=te("ZodUnknown",(e,t)=>{Zx.init(e,t),We.init(e,t),e._zod.processJSONSchema=(n,r,o)=>m1()});function ai(){return W0(wy)}const ky=te("ZodNever",(e,t)=>{qx.init(e,t),We.init(e,t),e._zod.processJSONSchema=(n,r,o)=>h1(e,n,r)});function _y(e){return Z0(ky,e)}const Sy=te("ZodArray",(e,t)=>{Kx.init(e,t),We.init(e,t),e._zod.processJSONSchema=(n,r,o)=>v1(e,n,r,o),e.element=t.element,e.min=(n,r)=>e.check(_o(n,r)),e.nonempty=n=>e.check(_o(1,n)),e.max=(n,r)=>e.check(md(n,r)),e.length=(n,r)=>e.check(gd(n,r)),e.unwrap=()=>e.element});function Se(e,t){return o1(Sy,e,t)}const Cy=te("ZodObject",(e,t)=>{Gx.init(e,t),We.init(e,t),e._zod.processJSONSchema=(n,r,o)=>w1(e,n,r,o),Ae(e,"shape",()=>t.shape),e.keyof=()=>et(Object.keys(e._zod.def.shape)),e.catchall=n=>e.clone({...e._zod.def,catchall:n}),e.passthrough=()=>e.clone({...e._zod.def,catchall:ai()}),e.loose=()=>e.clone({...e._zod.def,catchall:ai()}),e.strict=()=>e.clone({...e._zod.def,catchall:_y()}),e.strip=()=>e.clone({...e._zod.def,catchall:void 0}),e.extend=n=>mg(e,n),e.safeExtend=n=>gg(e,n),e.merge=n=>xg(e,n),e.pick=n=>pg(e,n),e.omit=n=>hg(e,n),e.partial=(...n)=>yg(Sd,e,n[0]),e.required=(...n)=>bg(Cd,e,n[0])});function ie(e,t){const n={type:"object",shape:e??{},...ve(t)};return new Cy(n)}const _d=te("ZodUnion",(e,t)=>{pd.init(e,t),We.init(e,t),e._zod.processJSONSchema=(n,r,o)=>k1(e,n,r,o),e.options=t.options});function Gt(e,t){return new _d({type:"union",options:e,...ve(t)})}const jy=te("ZodDiscriminatedUnion",(e,t)=>{_d.init(e,t),Yx.init(e,t)});function jn(e,t,n){return new jy({type:"union",options:t,discriminator:e,...ve(n)})}const Ey=te("ZodIntersection",(e,t)=>{Xx.init(e,t),We.init(e,t),e._zod.processJSONSchema=(n,r,o)=>_1(e,n,r,o)});function Ny(e,t){return new Ey({type:"intersection",left:e,right:t})}const Ty=te("ZodRecord",(e,t)=>{Qx.init(e,t),We.init(e,t),e._zod.processJSONSchema=(n,r,o)=>S1(e,n,r,o),e.keyType=t.keyType,e.valueType=t.valueType});function Zt(e,t,n){return new Ty({type:"record",keyType:e,valueType:t,...ve(n)})}const li=te("ZodEnum",(e,t)=>{e0.init(e,t),We.init(e,t),e._zod.processJSONSchema=(r,o,s)=>g1(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 li({...t,checks:[],...ve(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 li({...t,checks:[],...ve(o),entries:s})}});function et(e,t){const n=Array.isArray(e)?Object.fromEntries(e.map(r=>[r,r])):e;return new li({type:"enum",entries:n,...ve(t)})}const Ay=te("ZodLiteral",(e,t)=>{t0.init(e,t),We.init(e,t),e._zod.processJSONSchema=(n,r,o)=>x1(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 Ay({type:"literal",values:Array.isArray(e)?e:[e],...ve(t)})}const Iy=te("ZodTransform",(e,t)=>{n0.init(e,t),We.init(e,t),e._zod.processJSONSchema=(n,r,o)=>b1(e,n),e._zod.parse=(n,r)=>{if(r.direction==="backward")throw new Ku(e.constructor.name);n.addIssue=s=>{if(typeof s=="string")n.issues.push(jr(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(jr(i))}};const o=t.transform(n.value,n);return o instanceof Promise?o.then(s=>(n.value=s,n)):(n.value=o,n)}});function zy(e){return new Iy({type:"transform",transform:e})}const Sd=te("ZodOptional",(e,t)=>{hd.init(e,t),We.init(e,t),e._zod.processJSONSchema=(n,r,o)=>vd(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function El(e){return new Sd({type:"optional",innerType:e})}const Ry=te("ZodExactOptional",(e,t)=>{r0.init(e,t),We.init(e,t),e._zod.processJSONSchema=(n,r,o)=>vd(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function Py(e){return new Ry({type:"optional",innerType:e})}const Oy=te("ZodNullable",(e,t)=>{o0.init(e,t),We.init(e,t),e._zod.processJSONSchema=(n,r,o)=>C1(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function Nl(e){return new Oy({type:"nullable",innerType:e})}const My=te("ZodDefault",(e,t)=>{s0.init(e,t),We.init(e,t),e._zod.processJSONSchema=(n,r,o)=>E1(e,n,r,o),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function Ly(e,t){return new My({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():Xu(t)}})}const Dy=te("ZodPrefault",(e,t)=>{i0.init(e,t),We.init(e,t),e._zod.processJSONSchema=(n,r,o)=>N1(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function Fy(e,t){return new Dy({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():Xu(t)}})}const Cd=te("ZodNonOptional",(e,t)=>{a0.init(e,t),We.init(e,t),e._zod.processJSONSchema=(n,r,o)=>j1(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function $y(e,t){return new Cd({type:"nonoptional",innerType:e,...ve(t)})}const By=te("ZodCatch",(e,t)=>{l0.init(e,t),We.init(e,t),e._zod.processJSONSchema=(n,r,o)=>T1(e,n,r,o),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function Uy(e,t){return new By({type:"catch",innerType:e,catchValue:typeof t=="function"?t:()=>t})}const Vy=te("ZodPipe",(e,t)=>{c0.init(e,t),We.init(e,t),e._zod.processJSONSchema=(n,r,o)=>A1(e,n,r,o),e.in=t.in,e.out=t.out});function Tl(e,t){return new Vy({type:"pipe",in:e,out:t})}const Hy=te("ZodReadonly",(e,t)=>{u0.init(e,t),We.init(e,t),e._zod.processJSONSchema=(n,r,o)=>I1(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function Wy(e){return new Hy({type:"readonly",innerType:e})}const Zy=te("ZodLazy",(e,t)=>{d0.init(e,t),We.init(e,t),e._zod.processJSONSchema=(n,r,o)=>z1(e,n,r,o),e.unwrap=()=>e._zod.def.getter()});function qy(e){return new Zy({type:"lazy",getter:e})}const Ky=te("ZodCustom",(e,t)=>{f0.init(e,t),We.init(e,t),e._zod.processJSONSchema=(n,r,o)=>y1(e,n)});function Jy(e,t={}){return s1(Ky,e,t)}function Gy(e){return i1(e)}const Kn=qy(()=>Gt([W(),pe(),nt(),ii(),Se(Kn),Zt(W(),Kn)]));const ra=ie({type:W(),ttl:W().optional(),scope:W().optional()}),oa=ie({type:je("text"),text:W(),cache_control:ra.optional()}),jd=ie({type:je("thinking"),thinking:W(),signature:W().optional()}),Yy=ie({type:je("think"),thinking:W(),signature:W().optional()}),Xy=ie({type:je("base64"),media_type:W(),data:W()}),Ed=ie({type:je("image"),source:Xy}),Nd=ie({type:je("tool_use"),id:W(),name:W(),input:Zt(W(),Kn)}),Qy=jn("type",[oa,Ed]),eb=ie({type:je("tool_result"),tool_use_id:W().optional(),content:Gt([W(),Se(Qy)]),is_error:nt().optional()}),tb=jn("type",[oa,jd,Ed,Nd,eb]),nb=Gt([W(),Se(tb)]),rb=ie({role:et(["user","assistant"]),content:nb}),ob=ie({type:je("text"),text:W(),cache_control:ra.optional()}),sb=ie({type:W(),properties:Zt(W(),Zt(W(),Kn)).optional(),required:Se(W()).optional(),additionalProperties:nt().optional(),$schema:W().optional()}),ib=ie({name:W(),description:W().optional(),input_schema:sb.optional(),cache_control:ra.optional()}),ab=jn("type",[ie({type:je("enabled"),budget_tokens:pe()}),ie({type:je("disabled")}),ie({type:je("adaptive")})]),Td=ie({model:W(),messages:Se(rb),system:Se(ob).optional(),tools:Se(ib).optional(),max_tokens:pe().optional(),temperature:pe().optional(),stream:nt().optional(),thinking:ab.optional(),metadata:ie({user_id:W().optional()}).optional()}),sa=jn("type",[oa,jd,Yy,Nd]),lb=ie({input_tokens:pe().nullable().optional(),output_tokens:pe().nullable().optional(),cache_creation_input_tokens:pe().nullable().optional(),cache_read_input_tokens:pe().nullable().optional()}).passthrough(),Ad=ie({id:W(),type:je("message"),model:W(),role:je("assistant"),content:Se(sa),stop_reason:W().nullable(),stop_sequence:W().nullable().optional(),usage:lb}).passthrough(),cb=ie({type:je("message_start"),message:ie({id:W(),type:je("message"),model:W(),role:je("assistant"),content:Se(sa),stop_reason:ii(),stop_sequence:ii(),usage:ie({input_tokens:pe(),cache_creation_input_tokens:pe().optional(),cache_read_input_tokens:pe().optional()}).passthrough()})}),ub=ie({type:je("content_block_start"),index:pe(),content_block:sa}),db=jn("type",[ie({type:je("text_delta"),text:W()}),ie({type:je("input_json_delta"),partial_json:W()}),ie({type:je("thinking_delta"),thinking:W()}),ie({type:je("signature_delta"),signature:W()})]),fb=ie({type:je("content_block_delta"),index:pe(),delta:db}),pb=ie({type:je("content_block_stop"),index:pe()}),hb=ie({type:je("message_delta"),delta:ie({stop_reason:W().nullable(),stop_sequence:W().nullable().optional()}),usage:ie({output_tokens:pe(),input_tokens:pe().optional(),cache_creation_input_tokens:pe().optional(),cache_read_input_tokens:pe().optional()}).passthrough()}),mb=ie({type:je("message_stop")}),gb=ie({type:je("ping")}),xb=ie({type:je("error"),error:ie({type:W(),message:W()})}),yb=jn("type",[cb,ub,fb,pb,hb,mb,gb,xb]),bb=Gt([W(),Se(jn("type",[ie({type:je("text"),text:W()}),ie({type:je("image_url"),image_url:ie({url:W(),detail:W().optional()})})]))]),Id=ie({role:et(["system","user","assistant","tool"]),content:bb,name:W().optional(),reasoning_content:W().optional(),thinking:W().optional(),think:W().optional()}),vb=ie({name:W(),arguments:W()}),zd=ie({index:pe().optional(),id:W().optional(),type:je("function").optional(),function:ie({name:W().optional(),arguments:W().optional()})});Id.extend({content:Gt([W(),Se(ie({type:je("text"),text:W()}))]).optional(),function_call:vb.optional(),tool_calls:Se(zd).optional()});const wb=ie({type:je("function"),function:ie({name:W(),description:W().optional(),parameters:Zt(W(),Kn)})}),Rd=ie({model:W(),messages:Se(Id),temperature:pe().optional(),max_tokens:pe().optional(),stream:nt().optional(),tools:Se(wb).optional(),tool_choice:Gt([et(["auto","none","required"]),ie({type:je("auto")}),ie({type:je("none")}),ie({type:je("function"),function:ie({name:W()})})]).optional(),user:W().optional()}),Pd=ie({role:et(["assistant"]).optional(),content:W().nullable().optional(),reasoning_content:W().nullable().optional(),thinking:W().nullable().optional(),think:W().nullable().optional(),function_call:ie({name:W().optional(),arguments:W().optional()}).nullable().optional(),tool_calls:Se(ie({index:pe(),id:W().optional(),type:je("function").optional(),function:ie({name:W().optional(),arguments:W().optional()})})).nullable().optional()}),kb=ie({index:pe(),message:ie({role:et(["assistant"]),content:W().nullable(),reasoning_content:W().optional(),thinking:W().optional(),think:W().optional(),function_call:ie({name:W(),arguments:W()}).nullable().optional(),tool_calls:Se(zd).optional()}).optional(),delta:Pd.optional(),finish_reason:W().nullable()}),_b=ie({id:W(),object:je("chat.completion"),created:pe(),model:W(),choices:Se(kb),usage:ie({prompt_tokens:pe().nullable().optional(),completion_tokens:pe().nullable().optional(),total_tokens:pe().nullable().optional()}).passthrough(),service_tier:W().nullable().optional(),system_fingerprint:W().nullable().optional()}).passthrough(),Sb=ie({id:W(),object:je("chat.completion.chunk"),created:pe(),model:W(),choices:Se(ie({index:pe(),delta:Pd,finish_reason:W().nullable().optional()})),usage:ie({prompt_tokens:pe().nullable().optional(),completion_tokens:pe().nullable().optional(),total_tokens:pe().nullable().optional()}).passthrough().nullable().optional()}).passthrough();function Od(e){try{const t=JSON.parse(e),n=_b.safeParse(t);return n.success?n.data:null}catch{return null}}const Md=ie({index:pe(),timestamp:pe(),type:W(),data:Kn}),Cb=ie({chunks:Se(Md),truncated:nt().optional().default(!1)}),Al=ie({id:pe(),timestamp:W(),method:W(),path:W(),model:W().nullable(),sessionId:W().nullable(),rawRequestBody:W().nullable(),responseStatus:pe().nullable(),responseText:W().nullable(),inputTokens:pe().nullable(),outputTokens:pe().nullable(),cacheCreationInputTokens:pe().nullable(),cacheReadInputTokens:pe().nullable(),elapsedMs:pe().nullable(),streaming:nt(),userAgent:W().nullable(),origin:W().nullable(),rawHeaders:Zt(W(),W()).optional(),headers:Zt(W(),W()).optional(),apiFormat:et(["anthropic","openai","unknown"]).default("unknown"),isTest:nt().optional().default(!1),replayOfLogId:pe().nullable().optional(),providerName:W().nullable().optional(),clientPort:pe().nullable().optional(),clientPid:pe().nullable().optional(),clientCwd:W().nullable().optional(),clientProjectFolder:W().nullable().optional(),streamingChunks:Cb.optional(),streamingChunksPath:W().nullable().optional(),error:W().nullable().optional()});ie({model:W()});ie({model:W().optional(),metadata:ie({user_id:W().optional()}).passthrough().optional()});const jb=ie({error:W()});async function Wt(e,t){const n=await e.json();return t.parse(n)}async function xn(e,t){try{const n=await e.json(),r=jb.safeParse(n);return r.success?r.data.error:t}catch{return t}}async function Lr(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 xn(o,s))}return Wt(o,t)}const Co=10,ci=600,jo="time",ia="simple",Ld=et(["time","full"]),Eb=et(["simple","full"]),Ko=ie({stripClaudeCodeBillingHeader:nt(),hasSeenOnboarding:nt().default(!1),slowResponseThresholdSeconds:pe().int().min(0).max(ci).default(Co),timeDisplayFormat:Ld.default(jo),captureMode:Eb.default(ia)}),yr="/api/config";async function Nb(e){return Lr(e,Ko,void 0,t=>`Failed to fetch ${e}: ${t.status}`)}async function _s(e){return Lr(yr,Ko,{method:"PATCH",headers:{"content-type":"application/json"},body:JSON.stringify(e)},t=>`PATCH failed with status ${t.status}`)}function Dd(){const e=Ji(yr,Nb,{revalidateOnFocus:!1,revalidateIfStale:!1}),{mutate:t}=Zu(),n=e.data?.stripClaudeCodeBillingHeader??!1,r=e.data?.captureMode??ia,o=e.data?.slowResponseThresholdSeconds??Co,s=e.data?.timeDisplayFormat??jo,i=d=>({stripClaudeCodeBillingHeader:e.data?.stripClaudeCodeBillingHeader??!1,hasSeenOnboarding:e.data?.hasSeenOnboarding??!1,slowResponseThresholdSeconds:e.data?.slowResponseThresholdSeconds??Co,timeDisplayFormat:e.data?.timeDisplayFormat??jo,captureMode:r,...d}),a=async d=>{await t(yr,_s({stripClaudeCodeBillingHeader:d}),{optimisticData:i({stripClaudeCodeBillingHeader:d}),rollbackOnError:!0,revalidate:!1})},c=async d=>{await t(yr,_s({slowResponseThresholdSeconds:d}),{optimisticData:i({slowResponseThresholdSeconds:d}),rollbackOnError:!0,revalidate:!1})},u=async d=>{await t(yr,_s({timeDisplayFormat:d}),{optimisticData:i({timeDisplayFormat:d}),rollbackOnError:!0,revalidate:!1})};return{strip:n,captureMode:r,slowResponseThresholdSeconds:o,timeDisplayFormat:s,isLoading:e.isLoading,isError:e.error!==void 0,setStrip:a,setSlowResponseThresholdSeconds:c,setTimeDisplayFormat:u}}const Fd=(...e)=>e.filter((t,n,r)=>!!t&&t.trim()!==""&&r.indexOf(t)===n).join(" ").trim();const Tb=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();const Ab=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(t,n,r)=>r?r.toUpperCase():n.toLowerCase());const Il=e=>{const t=Ab(e);return t.charAt(0).toUpperCase()+t.slice(1)};var Ib={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 zb=e=>{for(const t in e)if(t.startsWith("aria-")||t==="role"||t==="title")return!0;return!1};const Rb=b.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:n=2,absoluteStrokeWidth:r,className:o="",children:s,iconNode:i,...a},c)=>b.createElement("svg",{ref:c,...Ib,width:t,height:t,stroke:e,strokeWidth:r?Number(n)*24/Number(t):n,className:Fd("lucide",o),...!s&&!zb(a)&&{"aria-hidden":"true"},...a},[...i.map(([u,d])=>b.createElement(u,d)),...Array.isArray(s)?s:[s]]));const me=(e,t)=>{const n=b.forwardRef(({className:r,...o},s)=>b.createElement(Rb,{ref:s,iconNode:t,className:Fd(`lucide-${Tb(Il(e))}`,`lucide-${e}`,r),...o}));return n.displayName=Il(e),n};const Pb=[["path",{d:"m7 7 10 10",key:"1fmybs"}],["path",{d:"M17 7v10H7",key:"6fjiku"}]],Ob=me("arrow-down-right",Pb);const Mb=[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]],Lb=me("arrow-down",Mb);const Db=[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]],Fb=me("arrow-left",Db);const $b=[["path",{d:"M7 7h10v10",key:"1tivn9"}],["path",{d:"M7 17 17 7",key:"1vkiza"}]],Bb=me("arrow-up-right",$b);const Ub=[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]],Vb=me("arrow-up",Ub);const Hb=[["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"}]],Wb=me("blocks",Hb);const Zb=[["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"}]],$d=me("brain",Zb);const qb=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],ct=me("check",qb);const Kb=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],Yt=me("chevron-down",Kb);const Jb=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],un=me("chevron-right",Jb);const Gb=[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]],Yb=me("chevron-up",Gb);const Xb=[["path",{d:"m7 6 5 5 5-5",key:"1lc07p"}],["path",{d:"m7 13 5 5 5-5",key:"1d48rs"}]],Bd=me("chevrons-down",Xb);const Qb=[["path",{d:"m17 11-5-5-5 5",key:"e8nh98"}],["path",{d:"m17 18-5-5-5 5",key:"2avn1x"}]],ev=me("chevrons-up",Qb);const tv=[["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"}]],Er=me("circle-alert",tv);const nv=[["path",{d:"M21.801 10A10 10 0 1 1 17 3.335",key:"yps3ct"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]],rv=me("circle-check-big",nv);const ov=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],zl=me("circle-check",ov);const sv=[["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"}]],iv=me("circle-question-mark",sv);const av=[["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"}]],Ud=me("circle-x",av);const lv=[["path",{d:"M12 6v6l4 2",key:"mmk7yg"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],on=me("clock",lv);const cv=[["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"}]],uv=me("cloud-upload",cv);const dv=[["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"}]],fv=me("code-xml",dv);const pv=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M12 3v18",key:"108xh3"}]],hv=me("columns-2",pv);const mv=[["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"}]],Ft=me("copy",mv);const gv=[["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"}]],aa=me("download",gv);const xv=[["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"}]],yv=me("ellipsis",xv);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"}]],Vd=me("external-link",bv);const vv=[["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"}]],la=me("eye-off",vv);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=me("eye",wv);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:"M9 10h6",key:"9gxzsh"}],["path",{d:"M12 13V7",key:"h0r20n"}],["path",{d:"M9 17h6",key:"r8uit2"}]],_v=me("file-diff",kv);const Sv=[["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"}]],Cv=me("file-search",Sv);const jv=[["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"}]],Ev=me("file-terminal",jv);const Nv=[["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"}]],Tv=me("file-text",Nv);const Av=[["path",{d:"m12 14 4-4",key:"9kzdfg"}],["path",{d:"M3.34 19a10 10 0 1 1 17.32 0",key:"19p75a"}]],Iv=me("gauge",Av);const zv=[["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"}]],Rv=me("git-compare-arrows",zv);const Pv=[["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"}]],Hd=me("globe",Pv);const Ov=[["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"}]],Mv=me("history",Ov);const Lv=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],Nr=me("loader-circle",Lv);const Dv=[["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"}]],Fv=me("lock",Dv);const $v=[["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"}]],Jo=me("message-square",$v);const Bv=[["path",{d:"M5 12h14",key:"1ays0h"}]],Uv=me("minus",Bv);const Vv=[["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"}]],Hv=me("mouse-pointer-click",Vv);const Wv=[["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"}]],Zv=me("octagon-alert",Wv);const qv=[["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"}]],Wd=me("pencil",qv);const Kv=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],ui=me("plus",Kv);const Jv=[["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"}]],Gv=me("radio",Jv);const Yv=[["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"}]],Rl=me("refresh-cw",Yv);const Xv=[["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"}]],Qv=me("rotate-ccw",Xv);const e2=[["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"}]],di=me("rotate-cw",e2);const t2=[["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"}]],n2=me("rows-3",t2);const r2=[["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"}]],o2=me("save",r2);const s2=[["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"}]],i2=me("scan",s2);const a2=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],l2=me("search",a2);const c2=[["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"}]],u2=me("server",c2);const d2=[["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"}]],f2=me("settings",d2);const p2=[["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"}]],Pl=me("shield-check",p2);const h2=[["path",{d:"M12 19h8",key:"baeox8"}],["path",{d:"m4 17 6-6-6-6",key:"1yngyt"}]],Zd=me("terminal",h2);const m2=[["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"}]],qd=me("trash-2",m2);const g2=[["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"}]],Eo=me("triangle-alert",g2);const x2=[["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"}]],y2=me("upload",x2);const b2=[["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"}]],v2=me("user",b2);const w2=[["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"}]],k2=me("wifi-off",w2);const _2=[["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"}]],S2=me("wifi",_2);const C2=[["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"}]],Dr=me("wrench",C2);const j2=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],ua=me("x",j2);const E2=[["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"}]],Tr=me("zap",E2),fi="/api/config";async function N2(e){return Lr(e,Ko,void 0,t=>`Failed to fetch ${e}: ${t.status}`)}async function T2(e){return Lr(fi,Ko,{method:"PATCH",headers:{"content-type":"application/json"},body:JSON.stringify(e)},t=>`PATCH failed with status ${t.status}`)}function A2(){const e=Ji(fi,N2,{revalidateOnFocus:!1,revalidateIfStale:!1}),{mutate:t}=Zu(),n=e.data?.hasSeenOnboarding??!1,r=e.data?.captureMode??ia,o=async()=>{await t(fi,T2({hasSeenOnboarding:!0}),{optimisticData:{stripClaudeCodeBillingHeader:e.data?.stripClaudeCodeBillingHeader??!1,hasSeenOnboarding:!0,slowResponseThresholdSeconds:e.data?.slowResponseThresholdSeconds??Co,timeDisplayFormat:e.data?.timeDisplayFormat??jo,captureMode:r},rollbackOnError:!0,revalidate:!1})};return{hasSeenOnboarding:n,captureMode:r,isLoading:e.isLoading,markSeen:o}}function I2(){const{hasSeenOnboarding:e,captureMode:t,isLoading:n,markSeen:r}=A2();if(n||e)return null;const o=t==="full";return l.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:[l.jsxs("div",{className:"min-w-0 flex-1",children:[l.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"}),l.jsxs("ol",{className:"space-y-0.5 text-xs leading-relaxed text-muted-foreground",children:[l.jsxs("li",{children:[l.jsx("strong",{children:"1. Start in the right mode"}),": this process is currently running in"," ",l.jsx("code",{children:t}),". Mode is fixed at startup."]}),o?l.jsxs(l.Fragment,{children:[l.jsxs("li",{children:[l.jsx("strong",{children:"2. Full diagnostics"}),": raw headers, raw response, and SSE chunks are captured for deep investigations."]}),l.jsxs("li",{children:[l.jsx("strong",{children:"3. Daily work"}),": restart with"," ",l.jsx("code",{children:"agent-inspector --mode simple"})," to reduce capture overhead."]})]}):l.jsxs(l.Fragment,{children:[l.jsxs("li",{children:[l.jsx("strong",{children:"2. Simple capture"}),": requests, responses, tools, timing, tokens, replay, and memory candidates are available with lower overhead."]}),l.jsxs("li",{children:[l.jsx("strong",{children:"3. Need raw diagnostics?"})," Restart with"," ",l.jsx("code",{children:"agent-inspector --mode full"})," for raw headers, raw response, and SSE chunks."]})]}),l.jsxs("li",{children:[l.jsx("strong",{children:"Agent setup"}),": run ",l.jsx("code",{children:"agent-inspector onboard --status"}),", then use ",l.jsx("code",{children:"/agent-inspector:onboard"})," in Claude Code or ask Codex to use"," ",l.jsx("code",{children:"agent-inspector-onboard"}),"."]})]})]}),l.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:[l.jsx(ct,{className:"size-3.5"}),"Got it"]}),l.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:l.jsx(ua,{className:"size-3.5"})})]})}function Gr(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 Ss={exports:{}};var Ol;function z2(){return Ol||(Ol=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 Gr=="function"&&Gr;if(!d&&f)return f(u,!0);if(a)return a(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 a=typeof Gr=="function"&&Gr,c=0;c<s.length;c++)i(s[c]);return i})({1:[function(n,r,o){var s=n("./utils"),i=n("./support"),a="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";o.encode=function(c){for(var u,d,f,h,p,x,m,g=[],y=0,v=c.length,k=v,S=s.getTypeOf(c)!=="string";y<c.length;)k=v-y,f=S?(u=c[y++],d=y<v?c[y++]:0,y<v?c[y++]:0):(u=c.charCodeAt(y++),d=y<v?c.charCodeAt(y++):0,y<v?c.charCodeAt(y++):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(a.charAt(h)+a.charAt(p)+a.charAt(x)+a.charAt(m));return g.join("")},o.decode=function(c){var u,d,f,h,p,x,m=0,g=0,y="data:";if(c.substr(0,y.length)===y)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)===a.charAt(64)&&k--,c.charAt(c.length-2)===a.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=a.indexOf(c.charAt(m++))<<2|(h=a.indexOf(c.charAt(m++)))>>4,d=(15&h)<<4|(p=a.indexOf(c.charAt(m++)))>>2,f=(3&p)<<6|(x=a.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"),a=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 a).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 a,c=[],u=0;u<256;u++){a=u;for(var d=0;d<8;d++)a=1&a?3988292384^a>>>1:a>>>1;c[u]=a}return c})();r.exports=function(a,c){return a!==void 0&&a.length?s.getTypeOf(a)!=="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,a,a.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,a,a.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"),a=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",a.inherits(d,c),d.prototype.processChunk=function(f){this.meta=f.meta,this._pako===null&&this._createPako(),this._pako.push(a.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,y,v){var k,S,C=p.file,j=p.compression,N=v!==u.utf8encode,I=a.transformTo("string",v(C.name)),R=a.transformTo("string",u.utf8encode(C.name)),O=C.comment,$=a.transformTo("string",v(O)),E=a.transformTo("string",u.utf8encode(O)),L=R.length!==C.name.length,w=E.length!==O.length,M="",U="",F="",V=C.dir,J=C.date,z={crc32:0,compressedSize:0,uncompressedSize:0};x&&!m||(z.crc32=p.crc32,z.compressedSize=p.compressedSize,z.uncompressedSize=p.uncompressedSize);var H=0;x&&(H|=8),N||!L&&!w||(H|=2048);var Z=0,P=0;V&&(Z|=16),y==="UNIX"?(P=798,Z|=(function(Q,de){var ae=Q;return Q||(ae=de?16893:33204),(65535&ae)<<16})(C.unixPermissions,V)):(P=20,Z|=(function(Q){return 63&(Q||0)})(C.dosPermissions)),k=J.getUTCHours(),k<<=6,k|=J.getUTCMinutes(),k<<=5,k|=J.getUTCSeconds()/2,S=J.getUTCFullYear()-1980,S<<=4,S|=J.getUTCMonth()+1,S<<=5,S|=J.getUTCDate(),L&&(U=s(1,1)+s(d(I),4)+R,M+="up"+s(U.length,2)+U),w&&(F=s(1,1)+s(d($),4)+E,M+="uc"+s(F.length,2)+F);var ee="";return ee+=`
|
|
41
|
-
\0`,ee+=s(H,2),ee+=j.magic,ee+=s(k,2),ee+=s(S,2),ee+=s(z.crc32,4),ee+=s(z.compressedSize,4),ee+=s(z.uncompressedSize,4),ee+=s(I.length,2),ee+=s(M.length,2),{fileRecord:f.LOCAL_FILE_HEADER+ee+I+M,dirRecord:f.CENTRAL_FILE_HEADER+s(P,2)+ee+s($.length,2)+"\0\0\0\0"+s(Z,4)+s(g,4)+I+M+$}}var a=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=[]}a.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(y,v,k,S,C){var j=a.transformTo("string",C(S));return f.CENTRAL_DIRECTORY_END+"\0\0\0\0"+s(y,2)+s(y,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(a,c,u){var d=new i(c.streamFiles,u,c.platform,c.encodeFileName),f=0;try{a.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,y=p.date;p._compressWorker(x,m).withStreamInfo("file",{name:h,dir:g,date:y,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 a in this)typeof this[a]!="function"&&(i[a]=this[a]);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,a){return new s().loadAsync(i,a)},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"),a=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:a.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)],y=m.files;if(p.checkCRC32)for(var v=0;v<y.length;v++)g.push(f(y[v]));return i.Promise.all(g)}).then(function(m){for(var g=m.shift(),y=g.files,v=0;v<y.length;v++){var k=y[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 a(c,u){i.call(this,"Nodejs stream input adapter for "+c),this._upstreamEnded=!1,this._bindStream(u)}s.inherits(a,i),a.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()})},a.prototype.pause=function(){return!!i.prototype.pause.call(this)&&(this._stream.pause(),!0)},a.prototype.resume=function(){return!!i.prototype.resume.call(this)&&(this._upstreamEnded?this.end():this._stream.resume(),!0)},r.exports=a},{"../stream/GenericWorker":28,"../utils":32}],13:[function(n,r,o){var s=n("readable-stream").Readable;function i(a,c,u){s.call(this,c),this._helper=a;var d=this;a.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 I,R=a.getTypeOf(j),O=a.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=y(C)),O.createFolders&&(I=g(C))&&v.call(this,I,!0);var $=R==="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",R="string");var E=null;E=j instanceof f||j instanceof c?j:x.isNode&&x.isStream(j)?new m(C,j):a.prepareContent(C,j,O.binary,O.optimizedBinaryString,O.base64);var L=new h(C,E,O);this.files[C]=L}var i=n("./utf8"),a=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):""},y=function(C){return C.slice(-1)!=="/"&&(C+="/"),C},v=function(C,j){return j=j!==void 0?j:d.createFolders,C=y(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,I;for(j in this.files)I=this.files[j],(N=j.slice(this.root.length,j.length))&&j.slice(0,this.root.length)===this.root&&C(N,I)},filter:function(C){var j=[];return this.forEach(function(N,I){C(N,I)&&j.push(I)}),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 I=C;return this.filter(function(O,$){return!$.dir&&I.test(O)})}var R=this.files[this.root+C];return R&&!R.dir?R:null},folder:function(C){if(!C)return this;if(k(C))return this.filter(function(R,O){return O.dir&&C.test(R)});var j=this.root+C,N=v.call(this,j),I=this.clone();return I.root=N.name,I},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(R,O){return O.name.slice(0,C.length)===C}),I=0;I<N.length;I++)delete this.files[N[I].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=a.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.");a.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 I=N.comment||this.comment||"";j=p.generateWorker(this,N,I)}catch(R){(j=new c("error")).error(R)}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(a){s.call(this,a);for(var c=0;c<this.data.length;c++)a[c]=255&a[c]}n("../utils").inherits(i,s),i.prototype.byteAt=function(a){return this.data[this.zero+a]},i.prototype.lastIndexOfSignature=function(a){for(var c=a.charCodeAt(0),u=a.charCodeAt(1),d=a.charCodeAt(2),f=a.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(a){var c=a.charCodeAt(0),u=a.charCodeAt(1),d=a.charCodeAt(2),f=a.charCodeAt(3),h=this.readData(4);return c===h[0]&&u===h[1]&&d===h[2]&&f===h[3]},i.prototype.readData=function(a){if(this.checkOffset(a),a===0)return[];var c=this.data.slice(this.zero+this.index,this.zero+this.index+a);return this.index+=a,c},r.exports=i},{"../utils":32,"./DataReader":18}],18:[function(n,r,o){var s=n("../utils");function i(a){this.data=a,this.length=a.length,this.index=0,this.zero=0}i.prototype={checkOffset:function(a){this.checkIndex(this.index+a)},checkIndex:function(a){if(this.length<this.zero+a||a<0)throw new Error("End of data reached (data length = "+this.length+", asked index = "+a+"). Corrupted zip ?")},setIndex:function(a){this.checkIndex(a),this.index=a},skip:function(a){this.setIndex(this.index+a)},byteAt:function(){},readInt:function(a){var c,u=0;for(this.checkOffset(a),c=this.index+a-1;c>=this.index;c--)u=(u<<8)+this.byteAt(c);return this.index+=a,u},readString:function(a){return s.transformTo("string",this.readData(a))},readData:function(){},lastIndexOfSignature:function(){},readAndCheckSignature:function(){},readDate:function(){var a=this.readInt(4);return new Date(Date.UTC(1980+(a>>25&127),(a>>21&15)-1,a>>16&31,a>>11&31,a>>5&63,(31&a)<<1))}},r.exports=i},{"../utils":32}],19:[function(n,r,o){var s=n("./Uint8ArrayReader");function i(a){s.call(this,a)}n("../utils").inherits(i,s),i.prototype.readData=function(a){this.checkOffset(a);var c=this.data.slice(this.zero+this.index,this.zero+this.index+a);return this.index+=a,c},r.exports=i},{"../utils":32,"./Uint8ArrayReader":21}],20:[function(n,r,o){var s=n("./DataReader");function i(a){s.call(this,a)}n("../utils").inherits(i,s),i.prototype.byteAt=function(a){return this.data.charCodeAt(this.zero+a)},i.prototype.lastIndexOfSignature=function(a){return this.data.lastIndexOf(a)-this.zero},i.prototype.readAndCheckSignature=function(a){return a===this.readData(4)},i.prototype.readData=function(a){this.checkOffset(a);var c=this.data.slice(this.zero+this.index,this.zero+this.index+a);return this.index+=a,c},r.exports=i},{"../utils":32,"./DataReader":18}],21:[function(n,r,o){var s=n("./ArrayReader");function i(a){s.call(this,a)}n("../utils").inherits(i,s),i.prototype.readData=function(a){if(this.checkOffset(a),a===0)return new Uint8Array(0);var c=this.data.subarray(this.zero+this.index,this.zero+this.index+a);return this.index+=a,c},r.exports=i},{"../utils":32,"./ArrayReader":17}],22:[function(n,r,o){var s=n("../utils"),i=n("../support"),a=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 a(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 a(c){s.call(this,"ConvertWorker to "+c),this.destType=c}i.inherits(a,s),a.prototype.processChunk=function(c){this.push({data:i.transformTo(this.destType,c.data),meta:c.meta})},r.exports=a},{"../utils":32,"./GenericWorker":28}],25:[function(n,r,o){var s=n("./GenericWorker"),i=n("../crc32");function a(){s.call(this,"Crc32Probe"),this.withStreamInfo("crc32",0)}n("../utils").inherits(a,s),a.prototype.processChunk=function(c){this.streamInfo.crc32=i(c.data,this.streamInfo.crc32||0),this.push(c)},r.exports=a},{"../crc32":4,"../utils":32,"./GenericWorker":28}],26:[function(n,r,o){var s=n("../utils"),i=n("./GenericWorker");function a(c){i.call(this,"DataLengthProbe for "+c),this.propName=c,this.withStreamInfo(c,0)}s.inherits(a,i),a.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=a},{"../utils":32,"./GenericWorker":28}],27:[function(n,r,o){var s=n("../utils"),i=n("./GenericWorker");function a(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(a,i),a.prototype.cleanUp=function(){i.prototype.cleanUp.call(this),this.data=null},a.prototype.resume=function(){return!!i.prototype.resume.call(this)&&(!this._tickScheduled&&this.dataIsReady&&(this._tickScheduled=!0,s.delay(this._tickAndRepeat,[],this)),!0)},a.prototype._tickAndRepeat=function(){this._tickScheduled=!1,this.isPaused||this.isFinished||(this._tick(),this.isFinished||(s.delay(this._tickAndRepeat,[],this),this._tickScheduled=!0))},a.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=a},{"../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,a){return this._listeners[i].push(a),this},cleanUp:function(){this.streamInfo=this.generatedError=this.extraStreamInfo=null,this._listeners=[]},emit:function(i,a){if(this._listeners[i])for(var c=0;c<this._listeners[i].length;c++)this._listeners[i][c].call(this,a)},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 a=this;return i.on("data",function(c){a.processChunk(c)}),i.on("end",function(){a.end()}),i.on("error",function(c){a.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,a){return this.extraStreamInfo[i]=a,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"),a=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,y){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=[],y(j)}).on("end",function(){try{var j=(function(N,I,R){switch(N){case"blob":return s.newBlob(s.transformTo("arraybuffer",I),R);case"base64":return c.encode(I);default:return s.transformTo(N,I)}})(S,(function(N,I){var R,O=0,$=null,E=0;for(R=0;R<I.length;R++)E+=I[R].length;switch(N){case"string":return I.join("");case"array":return Array.prototype.concat.apply([],I);case"uint8array":for($=new Uint8Array(E),R=0;R<I.length;R++)$.set(I[R],O),O+=I[R].length;return $;case"nodebuffer":return Buffer.concat(I);default:throw new Error("concat : unsupported type '"+N+"'")}})(k,v),C);g(j)}catch(N){y(N)}v=[]}).resume()})}function p(x,m,g){var y=m;switch(m){case"blob":case"arraybuffer":y="uint8array";break;case"base64":y="string"}try{this._internalType=y,this._outputType=m,this._mimeType=g,s.checkSupport(y),this._worker=x.pipe(new i(y)),x.lock()}catch(v){this._worker=new a("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(y){m.call(g,y.data,y.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"),a=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?a.newBufferFrom(p,"utf-8"):(function(x){var m,g,y,v,k,S=x.length,C=0;for(v=0;v<S;v++)(64512&(g=x.charCodeAt(v)))==55296&&v+1<S&&(64512&(y=x.charCodeAt(v+1)))==56320&&(g=65536+(g-55296<<10)+(y-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&(y=x.charCodeAt(v+1)))==56320&&(g=65536+(g-55296<<10)+(y-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,y,v,k=x.length,S=new Array(2*k);for(m=g=0;m<k;)if((y=x[m++])<128)S[g++]=y;else if(4<(v=u[y]))S[g++]=65533,m+=v-1;else{for(y&=v===2?31:v===3?15:7;1<v&&m<k;)y=y<<6|63&x[m++],v--;1<v?S[g++]=65533:y<65536?S[g++]=y:(y-=65536,S[g++]=55296|y>>10&1023,S[g++]=56320|1023&y)}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),y=x;g!==x.length&&(i.uint8array?(y=x.subarray(0,g),this.leftOver=x.subarray(g,x.length)):(y=x.slice(0,g),this.leftOver=x.slice(g,x.length))),this.push({data:o.utf8decode(y),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"),a=n("./nodejsUtils"),c=n("./external");function u(m){return m}function d(m,g){for(var y=0;y<m.length;++y)g[y]=255&m.charCodeAt(y);return g}n("setimmediate"),o.newBlob=function(m,g){o.checkSupport("blob");try{return new Blob([m],{type:g})}catch{try{var y=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);return y.append(m),y.getBlob(g)}catch{throw new Error("Bug : can't construct the Blob.")}}};var f={stringifyByChunk:function(m,g,y){var v=[],k=0,S=m.length;if(S<=y)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+y,S)))):v.push(String.fromCharCode.apply(null,m.subarray(k,Math.min(k+y,S)))),k+=y;return v.join("")},stringifyByChar:function(m){for(var g="",y=0;y<m.length;y++)g+=String.fromCharCode(m[y]);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,a.allocBuffer(1)).length===1}catch{return!1}})()}};function h(m){var g=65536,y=o.getTypeOf(m),v=!0;if(y==="uint8array"?v=f.applyCanBeUsed.uint8array:y==="nodebuffer"&&(v=f.applyCanBeUsed.nodebuffer),v)for(;1<g;)try{return f.stringifyByChunk(m,y,g)}catch{g=Math.floor(g/2)}return f.stringifyByChar(m)}function p(m,g){for(var y=0;y<m.length;y++)g[y]=m[y];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,a.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 a.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 a.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 a.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 y=o.getTypeOf(g);return x[y][m](g)},o.resolve=function(m){for(var g=m.split("/"),y=[],v=0;v<g.length;v++){var k=g[v];k==="."||k===""&&v!==0&&v!==g.length-1||(k===".."?y.pop():y.push(k))}return y.join("/")},o.getTypeOf=function(m){return typeof m=="string"?"string":Object.prototype.toString.call(m)==="[object Array]"?"array":s.nodebuffer&&a.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,y,v="";for(y=0;y<(m||"").length;y++)v+="\\x"+((g=m.charCodeAt(y))<16?"0":"")+g.toString(16).toUpperCase();return v},o.delay=function(m,g,y){setImmediate(function(){m.apply(y||null,g||[])})},o.inherits=function(m,g){function y(){}y.prototype=g.prototype,m.prototype=new y},o.extend=function(){var m,g,y={};for(m=0;m<arguments.length;m++)for(g in arguments[m])Object.prototype.hasOwnProperty.call(arguments[m],g)&&y[g]===void 0&&(y[g]=arguments[m][g]);return y},o.prepareContent=function(m,g,y,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(I){C(I.target.result)},N.onerror=function(I){j(I.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):y&&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"),a=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(a.LOCAL_FILE_HEADER),h.readLocalPart(this.reader),h.handleUTF8(),h.processAttributes()},readCentralDir:function(){var f;for(this.reader.setIndex(this.centralDirOffset);this.reader.readAndCheckSignature(a.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(a.CENTRAL_DIRECTORY_END);if(f<0)throw this.isSignature(0,a.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(a.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(a.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(a.ZIP64_CENTRAL_DIRECTORY_LOCATOR),this.readBlockZip64EndOfCentralLocator(),!this.isSignature(this.relativeOffsetEndOfZip64CentralDir,a.ZIP64_CENTRAL_DIRECTORY_END)&&(this.relativeOffsetEndOfZip64CentralDir=this.reader.lastIndexOfSignature(a.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(a.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,a.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"),a=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 y in d)if(Object.prototype.hasOwnProperty.call(d,y)&&d[y].magic===g)return d[y];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 a(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,y=p.index+this.extraFieldsLength;for(this.extraFields||(this.extraFields={});p.index+4<y;)x=p.readInt(2),m=p.readInt(2),g=p.readData(m),this.extraFields[x]={id:x,length:m,value:g};p.setIndex(y)},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 y=i.transformTo(p,this.fileComment);this.fileCommentStr=this.loadOptions.decodeFileName(y)}}},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"),a=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 y=(g=x.toLowerCase())==="string"||g==="text";g!=="binarystring"&&g!=="text"||(g="string"),m=this._decompressWorker();var v=!this._dataBinary;v&&!y&&(m=m.pipe(new c.Utf8EncodeWorker)),!v&&y&&(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 a(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,a,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;a=!0;for(var y=p.length;y;){for(g=p,p=[],m=-1;++m<y;)g[m]();y=p.length}a=!1}r.exports=function(m){p.push(m)!==1||a||i()}}).call(this,typeof Zr<"u"?Zr:typeof self<"u"?self:typeof window<"u"?window:{})},{}],37:[function(n,r,o){var s=n("immediate");function i(){}var a={},c=["REJECTED"],u=["FULFILLED"],d=["PENDING"];function f(y){if(typeof y!="function")throw new TypeError("resolver must be a function");this.state=d,this.queue=[],this.outcome=void 0,y!==i&&m(this,y)}function h(y,v,k){this.promise=y,typeof v=="function"&&(this.onFulfilled=v,this.callFulfilled=this.otherCallFulfilled),typeof k=="function"&&(this.onRejected=k,this.callRejected=this.otherCallRejected)}function p(y,v,k){s(function(){var S;try{S=v(k)}catch(C){return a.reject(y,C)}S===y?a.reject(y,new TypeError("Cannot resolve promise with itself")):a.resolve(y,S)})}function x(y){var v=y&&y.then;if(y&&(typeof y=="object"||typeof y=="function")&&typeof v=="function")return function(){v.apply(y,arguments)}}function m(y,v){var k=!1;function S(N){k||(k=!0,a.reject(y,N))}function C(N){k||(k=!0,a.resolve(y,N))}var j=g(function(){v(C,S)});j.status==="error"&&S(j.value)}function g(y,v){var k={};try{k.value=y(v),k.status="success"}catch(S){k.status="error",k.value=S}return k}(r.exports=f).prototype.finally=function(y){if(typeof y!="function")return this;var v=this.constructor;return this.then(function(k){return v.resolve(y()).then(function(){return k})},function(k){return v.resolve(y()).then(function(){throw k})})},f.prototype.catch=function(y){return this.then(null,y)},f.prototype.then=function(y,v){if(typeof y!="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?y:v,this.outcome):this.queue.push(new h(k,y,v)),k},h.prototype.callFulfilled=function(y){a.resolve(this.promise,y)},h.prototype.otherCallFulfilled=function(y){p(this.promise,this.onFulfilled,y)},h.prototype.callRejected=function(y){a.reject(this.promise,y)},h.prototype.otherCallRejected=function(y){p(this.promise,this.onRejected,y)},a.resolve=function(y,v){var k=g(x,v);if(k.status==="error")return a.reject(y,k.value);var S=k.value;if(S)m(y,S);else{y.state=u,y.outcome=v;for(var C=-1,j=y.queue.length;++C<j;)y.queue[C].callFulfilled(v)}return y},a.reject=function(y,v){y.state=c,y.outcome=v;for(var k=-1,S=y.queue.length;++k<S;)y.queue[k].callRejected(v);return y},f.resolve=function(y){return y instanceof this?y:a.resolve(new this(i),y)},f.reject=function(y){var v=new this(i);return a.reject(v,y)},f.all=function(y){var v=this;if(Object.prototype.toString.call(y)!=="[object Array]")return this.reject(new TypeError("must be an array"));var k=y.length,S=!1;if(!k)return this.resolve([]);for(var C=new Array(k),j=0,N=-1,I=new this(i);++N<k;)R(y[N],N);return I;function R(O,$){v.resolve(O).then(function(E){C[$]=E,++j!==k||S||(S=!0,a.resolve(I,C))},function(E){S||(S=!0,a.reject(I,E))})}},f.race=function(y){var v=this;if(Object.prototype.toString.call(y)!=="[object Array]")return this.reject(new TypeError("must be an array"));var k=y.length,S=!1;if(!k)return this.resolve([]);for(var C=-1,j=new this(i);++C<k;)N=y[C],v.resolve(N).then(function(I){S||(S=!0,a.resolve(j,I))},function(I){S||(S=!0,a.reject(j,I))});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"),a=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(y){if(!(this instanceof m))return new m(y);this.options=i.assign({level:h,method:x,chunkSize:16384,windowBits:15,memLevel:8,strategy:p,to:""},y||{});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"?a.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(y,v){var k=new m(v);if(k.push(y,!0),k.err)throw k.msg||c[k.err];return k.result}m.prototype.push=function(y,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 y=="string"?C.input=a.string2buf(y):d.call(y)==="[object ArrayBuffer]"?C.input=new Uint8Array(y):C.input=y,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(a.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(y){this.chunks.push(y)},m.prototype.onEnd=function(y){y===f&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=i.flattenChunks(this.chunks)),this.chunks=[],this.err=y,this.msg=this.strm.msg},o.Deflate=m,o.deflate=g,o.deflateRaw=function(y,v){return(v=v||{}).raw=!0,g(y,v)},o.gzip=function(y,v){return(v=v||{}).gzip=!0,g(y,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"),a=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 y=s.inflateInit2(this.strm,g.windowBits);if(y!==c.Z_OK)throw new Error(u[y]);this.header=new f,s.inflateGetHeader(this.strm,this.header)}function x(m,g){var y=new p(g);if(y.push(m,!0),y.err)throw y.msg||u[y.err];return y.result}p.prototype.push=function(m,g){var y,v,k,S,C,j,N=this.strm,I=this.options.chunkSize,R=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=a.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(I),N.next_out=0,N.avail_out=I),(y=s.inflate(N,c.Z_NO_FLUSH))===c.Z_NEED_DICT&&R&&(j=typeof R=="string"?a.string2buf(R):h.call(R)==="[object ArrayBuffer]"?new Uint8Array(R):R,y=s.inflateSetDictionary(this.strm,j)),y===c.Z_BUF_ERROR&&O===!0&&(y=c.Z_OK,O=!1),y!==c.Z_STREAM_END&&y!==c.Z_OK)return this.onEnd(y),!(this.ended=!0);N.next_out&&(N.avail_out!==0&&y!==c.Z_STREAM_END&&(N.avail_in!==0||v!==c.Z_FINISH&&v!==c.Z_SYNC_FLUSH)||(this.options.to==="string"?(k=a.utf8border(N.output,N.next_out),S=N.next_out-k,C=a.buf2string(N.output,k),N.next_out=S,N.avail_out=I-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)&&y!==c.Z_STREAM_END);return y===c.Z_STREAM_END&&(v=c.Z_FINISH),v===c.Z_FINISH?(y=s.inflateEnd(this.strm),this.onEnd(y),this.ended=!0,y===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}},a={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,a))},o.setTyped(s)},{}],42:[function(n,r,o){var s=n("./common"),i=!0,a=!0;try{String.fromCharCode.apply(null,[0])}catch{i=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch{a=!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&&a||!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,y=f.length,v=0;for(m=0;m<y;m++)(64512&(p=f.charCodeAt(m)))==55296&&m+1<y&&(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<y&&(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,y=h||f.length,v=new Array(2*y);for(p=x=0;p<y;)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<y;)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,a,c){for(var u=65535&s|0,d=s>>>16&65535|0,f=0;a!==0;){for(a-=f=2e3<a?2e3:a;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,a=[],c=0;c<256;c++){i=c;for(var u=0;u<8;u++)i=1&i?3988292384^i>>>1:i>>>1;a[c]=i}return a})();r.exports=function(i,a,c,u){var d=s,f=u+c;i^=-1;for(var h=u;h<f;h++)i=i>>>8^d[255&(i^a[h])];return-1^i}},{}],46:[function(n,r,o){var s,i=n("../utils/common"),a=n("./trees"),c=n("./adler32"),u=n("./crc32"),d=n("./messages"),f=0,h=4,p=0,x=-2,m=-1,g=4,y=2,v=8,k=9,S=286,C=30,j=19,N=2*S+1,I=15,R=3,O=258,$=O+R+1,E=42,L=113,w=1,M=2,U=3,F=4;function V(_,ne){return _.msg=d[ne],ne}function J(_){return(_<<1)-(4<_?9:0)}function z(_){for(var ne=_.length;0<=--ne;)_[ne]=0}function H(_){var ne=_.state,G=ne.pending;G>_.avail_out&&(G=_.avail_out),G!==0&&(i.arraySet(_.output,ne.pending_buf,ne.pending_out,G,_.next_out),_.next_out+=G,ne.pending_out+=G,_.total_out+=G,_.avail_out-=G,ne.pending-=G,ne.pending===0&&(ne.pending_out=0))}function Z(_,ne){a._tr_flush_block(_,0<=_.block_start?_.block_start:-1,_.strstart-_.block_start,ne),_.block_start=_.strstart,H(_.strm)}function P(_,ne){_.pending_buf[_.pending++]=ne}function ee(_,ne){_.pending_buf[_.pending++]=ne>>>8&255,_.pending_buf[_.pending++]=255&ne}function Q(_,ne){var G,A,T=_.max_chain_length,D=_.strstart,X=_.prev_length,se=_.nice_match,q=_.strstart>_.w_size-$?_.strstart-(_.w_size-$):0,K=_.window,oe=_.w_mask,re=_.prev,B=_.strstart+O,Y=K[D+X-1],le=K[D+X];_.prev_length>=_.good_match&&(T>>=2),se>_.lookahead&&(se=_.lookahead);do if(K[(G=ne)+X]===le&&K[G+X-1]===Y&&K[G]===K[D]&&K[++G]===K[D+1]){D+=2,G++;do;while(K[++D]===K[++G]&&K[++D]===K[++G]&&K[++D]===K[++G]&&K[++D]===K[++G]&&K[++D]===K[++G]&&K[++D]===K[++G]&&K[++D]===K[++G]&&K[++D]===K[++G]&&D<B);if(A=O-(B-D),D=B-O,X<A){if(_.match_start=ne,se<=(X=A))break;Y=K[D+X-1],le=K[D+X]}}while((ne=re[ne&oe])>q&&--T!=0);return X<=_.lookahead?X:_.lookahead}function de(_){var ne,G,A,T,D,X,se,q,K,oe,re=_.w_size;do{if(T=_.window_size-_.lookahead-_.strstart,_.strstart>=re+(re-$)){for(i.arraySet(_.window,_.window,re,re,0),_.match_start-=re,_.strstart-=re,_.block_start-=re,ne=G=_.hash_size;A=_.head[--ne],_.head[ne]=re<=A?A-re:0,--G;);for(ne=G=re;A=_.prev[--ne],_.prev[ne]=re<=A?A-re:0,--G;);T+=re}if(_.strm.avail_in===0)break;if(X=_.strm,se=_.window,q=_.strstart+_.lookahead,K=T,oe=void 0,oe=X.avail_in,K<oe&&(oe=K),G=oe===0?0:(X.avail_in-=oe,i.arraySet(se,X.input,X.next_in,oe,q),X.state.wrap===1?X.adler=c(X.adler,se,oe,q):X.state.wrap===2&&(X.adler=u(X.adler,se,oe,q)),X.next_in+=oe,X.total_in+=oe,oe),_.lookahead+=G,_.lookahead+_.insert>=R)for(D=_.strstart-_.insert,_.ins_h=_.window[D],_.ins_h=(_.ins_h<<_.hash_shift^_.window[D+1])&_.hash_mask;_.insert&&(_.ins_h=(_.ins_h<<_.hash_shift^_.window[D+R-1])&_.hash_mask,_.prev[D&_.w_mask]=_.head[_.ins_h],_.head[_.ins_h]=D,D++,_.insert--,!(_.lookahead+_.insert<R)););}while(_.lookahead<$&&_.strm.avail_in!==0)}function ae(_,ne){for(var G,A;;){if(_.lookahead<$){if(de(_),_.lookahead<$&&ne===f)return w;if(_.lookahead===0)break}if(G=0,_.lookahead>=R&&(_.ins_h=(_.ins_h<<_.hash_shift^_.window[_.strstart+R-1])&_.hash_mask,G=_.prev[_.strstart&_.w_mask]=_.head[_.ins_h],_.head[_.ins_h]=_.strstart),G!==0&&_.strstart-G<=_.w_size-$&&(_.match_length=Q(_,G)),_.match_length>=R)if(A=a._tr_tally(_,_.strstart-_.match_start,_.match_length-R),_.lookahead-=_.match_length,_.match_length<=_.max_lazy_match&&_.lookahead>=R){for(_.match_length--;_.strstart++,_.ins_h=(_.ins_h<<_.hash_shift^_.window[_.strstart+R-1])&_.hash_mask,G=_.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 A=a._tr_tally(_,0,_.window[_.strstart]),_.lookahead--,_.strstart++;if(A&&(Z(_,!1),_.strm.avail_out===0))return w}return _.insert=_.strstart<R-1?_.strstart:R-1,ne===h?(Z(_,!0),_.strm.avail_out===0?U:F):_.last_lit&&(Z(_,!1),_.strm.avail_out===0)?w:M}function ue(_,ne){for(var G,A,T;;){if(_.lookahead<$){if(de(_),_.lookahead<$&&ne===f)return w;if(_.lookahead===0)break}if(G=0,_.lookahead>=R&&(_.ins_h=(_.ins_h<<_.hash_shift^_.window[_.strstart+R-1])&_.hash_mask,G=_.prev[_.strstart&_.w_mask]=_.head[_.ins_h],_.head[_.ins_h]=_.strstart),_.prev_length=_.match_length,_.prev_match=_.match_start,_.match_length=R-1,G!==0&&_.prev_length<_.max_lazy_match&&_.strstart-G<=_.w_size-$&&(_.match_length=Q(_,G),_.match_length<=5&&(_.strategy===1||_.match_length===R&&4096<_.strstart-_.match_start)&&(_.match_length=R-1)),_.prev_length>=R&&_.match_length<=_.prev_length){for(T=_.strstart+_.lookahead-R,A=a._tr_tally(_,_.strstart-1-_.prev_match,_.prev_length-R),_.lookahead-=_.prev_length-1,_.prev_length-=2;++_.strstart<=T&&(_.ins_h=(_.ins_h<<_.hash_shift^_.window[_.strstart+R-1])&_.hash_mask,G=_.prev[_.strstart&_.w_mask]=_.head[_.ins_h],_.head[_.ins_h]=_.strstart),--_.prev_length!=0;);if(_.match_available=0,_.match_length=R-1,_.strstart++,A&&(Z(_,!1),_.strm.avail_out===0))return w}else if(_.match_available){if((A=a._tr_tally(_,0,_.window[_.strstart-1]))&&Z(_,!1),_.strstart++,_.lookahead--,_.strm.avail_out===0)return w}else _.match_available=1,_.strstart++,_.lookahead--}return _.match_available&&(A=a._tr_tally(_,0,_.window[_.strstart-1]),_.match_available=0),_.insert=_.strstart<R-1?_.strstart:R-1,ne===h?(Z(_,!0),_.strm.avail_out===0?U:F):_.last_lit&&(Z(_,!1),_.strm.avail_out===0)?w:M}function he(_,ne,G,A,T){this.good_length=_,this.max_lazy=ne,this.nice_length=G,this.max_chain=A,this.func=T}function fe(){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)),z(this.dyn_ltree),z(this.dyn_dtree),z(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new i.Buf16(I+1),this.heap=new i.Buf16(2*S+1),z(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new i.Buf16(2*S+1),z(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 ge(_){var ne;return _&&_.state?(_.total_in=_.total_out=0,_.data_type=y,(ne=_.state).pending=0,ne.pending_out=0,ne.wrap<0&&(ne.wrap=-ne.wrap),ne.status=ne.wrap?E:L,_.adler=ne.wrap===2?0:1,ne.last_flush=f,a._tr_init(ne),p):V(_,x)}function Ce(_){var ne=ge(_);return ne===p&&(function(G){G.window_size=2*G.w_size,z(G.head),G.max_lazy_match=s[G.level].max_lazy,G.good_match=s[G.level].good_length,G.nice_match=s[G.level].nice_length,G.max_chain_length=s[G.level].max_chain,G.strstart=0,G.block_start=0,G.lookahead=0,G.insert=0,G.match_length=G.prev_length=R-1,G.match_available=0,G.ins_h=0})(_.state),ne}function ze(_,ne,G,A,T,D){if(!_)return x;var X=1;if(ne===m&&(ne=6),A<0?(X=0,A=-A):15<A&&(X=2,A-=16),T<1||k<T||G!==v||A<8||15<A||ne<0||9<ne||D<0||g<D)return V(_,x);A===8&&(A=9);var se=new fe;return(_.state=se).strm=_,se.wrap=X,se.gzhead=null,se.w_bits=A,se.w_size=1<<se.w_bits,se.w_mask=se.w_size-1,se.hash_bits=T+7,se.hash_size=1<<se.hash_bits,se.hash_mask=se.hash_size-1,se.hash_shift=~~((se.hash_bits+R-1)/R),se.window=new i.Buf8(2*se.w_size),se.head=new i.Buf16(se.hash_size),se.prev=new i.Buf16(se.w_size),se.lit_bufsize=1<<T+6,se.pending_buf_size=4*se.lit_bufsize,se.pending_buf=new i.Buf8(se.pending_buf_size),se.d_buf=1*se.lit_bufsize,se.l_buf=3*se.lit_bufsize,se.level=ne,se.strategy=D,se.method=G,Ce(_)}s=[new he(0,0,0,0,function(_,ne){var G=65535;for(G>_.pending_buf_size-5&&(G=_.pending_buf_size-5);;){if(_.lookahead<=1){if(de(_),_.lookahead===0&&ne===f)return w;if(_.lookahead===0)break}_.strstart+=_.lookahead,_.lookahead=0;var A=_.block_start+G;if((_.strstart===0||_.strstart>=A)&&(_.lookahead=_.strstart-A,_.strstart=A,Z(_,!1),_.strm.avail_out===0)||_.strstart-_.block_start>=_.w_size-$&&(Z(_,!1),_.strm.avail_out===0))return w}return _.insert=0,ne===h?(Z(_,!0),_.strm.avail_out===0?U:F):(_.strstart>_.block_start&&(Z(_,!1),_.strm.avail_out),w)}),new he(4,4,8,4,ae),new he(4,5,16,8,ae),new he(4,6,32,32,ae),new he(4,4,16,16,ue),new he(8,16,32,32,ue),new he(8,16,128,128,ue),new he(8,32,128,256,ue),new he(32,128,258,1024,ue),new he(32,258,258,4096,ue)],o.deflateInit=function(_,ne){return ze(_,ne,v,15,8,0)},o.deflateInit2=ze,o.deflateReset=Ce,o.deflateResetKeep=ge,o.deflateSetHeader=function(_,ne){return _&&_.state?_.state.wrap!==2?x:(_.state.gzhead=ne,p):x},o.deflate=function(_,ne){var G,A,T,D;if(!_||!_.state||5<ne||ne<0)return _?V(_,x):x;if(A=_.state,!_.output||!_.input&&_.avail_in!==0||A.status===666&&ne!==h)return V(_,_.avail_out===0?-5:x);if(A.strm=_,G=A.last_flush,A.last_flush=ne,A.status===E)if(A.wrap===2)_.adler=0,P(A,31),P(A,139),P(A,8),A.gzhead?(P(A,(A.gzhead.text?1:0)+(A.gzhead.hcrc?2:0)+(A.gzhead.extra?4:0)+(A.gzhead.name?8:0)+(A.gzhead.comment?16:0)),P(A,255&A.gzhead.time),P(A,A.gzhead.time>>8&255),P(A,A.gzhead.time>>16&255),P(A,A.gzhead.time>>24&255),P(A,A.level===9?2:2<=A.strategy||A.level<2?4:0),P(A,255&A.gzhead.os),A.gzhead.extra&&A.gzhead.extra.length&&(P(A,255&A.gzhead.extra.length),P(A,A.gzhead.extra.length>>8&255)),A.gzhead.hcrc&&(_.adler=u(_.adler,A.pending_buf,A.pending,0)),A.gzindex=0,A.status=69):(P(A,0),P(A,0),P(A,0),P(A,0),P(A,0),P(A,A.level===9?2:2<=A.strategy||A.level<2?4:0),P(A,3),A.status=L);else{var X=v+(A.w_bits-8<<4)<<8;X|=(2<=A.strategy||A.level<2?0:A.level<6?1:A.level===6?2:3)<<6,A.strstart!==0&&(X|=32),X+=31-X%31,A.status=L,ee(A,X),A.strstart!==0&&(ee(A,_.adler>>>16),ee(A,65535&_.adler)),_.adler=1}if(A.status===69)if(A.gzhead.extra){for(T=A.pending;A.gzindex<(65535&A.gzhead.extra.length)&&(A.pending!==A.pending_buf_size||(A.gzhead.hcrc&&A.pending>T&&(_.adler=u(_.adler,A.pending_buf,A.pending-T,T)),H(_),T=A.pending,A.pending!==A.pending_buf_size));)P(A,255&A.gzhead.extra[A.gzindex]),A.gzindex++;A.gzhead.hcrc&&A.pending>T&&(_.adler=u(_.adler,A.pending_buf,A.pending-T,T)),A.gzindex===A.gzhead.extra.length&&(A.gzindex=0,A.status=73)}else A.status=73;if(A.status===73)if(A.gzhead.name){T=A.pending;do{if(A.pending===A.pending_buf_size&&(A.gzhead.hcrc&&A.pending>T&&(_.adler=u(_.adler,A.pending_buf,A.pending-T,T)),H(_),T=A.pending,A.pending===A.pending_buf_size)){D=1;break}D=A.gzindex<A.gzhead.name.length?255&A.gzhead.name.charCodeAt(A.gzindex++):0,P(A,D)}while(D!==0);A.gzhead.hcrc&&A.pending>T&&(_.adler=u(_.adler,A.pending_buf,A.pending-T,T)),D===0&&(A.gzindex=0,A.status=91)}else A.status=91;if(A.status===91)if(A.gzhead.comment){T=A.pending;do{if(A.pending===A.pending_buf_size&&(A.gzhead.hcrc&&A.pending>T&&(_.adler=u(_.adler,A.pending_buf,A.pending-T,T)),H(_),T=A.pending,A.pending===A.pending_buf_size)){D=1;break}D=A.gzindex<A.gzhead.comment.length?255&A.gzhead.comment.charCodeAt(A.gzindex++):0,P(A,D)}while(D!==0);A.gzhead.hcrc&&A.pending>T&&(_.adler=u(_.adler,A.pending_buf,A.pending-T,T)),D===0&&(A.status=103)}else A.status=103;if(A.status===103&&(A.gzhead.hcrc?(A.pending+2>A.pending_buf_size&&H(_),A.pending+2<=A.pending_buf_size&&(P(A,255&_.adler),P(A,_.adler>>8&255),_.adler=0,A.status=L)):A.status=L),A.pending!==0){if(H(_),_.avail_out===0)return A.last_flush=-1,p}else if(_.avail_in===0&&J(ne)<=J(G)&&ne!==h)return V(_,-5);if(A.status===666&&_.avail_in!==0)return V(_,-5);if(_.avail_in!==0||A.lookahead!==0||ne!==f&&A.status!==666){var se=A.strategy===2?(function(q,K){for(var oe;;){if(q.lookahead===0&&(de(q),q.lookahead===0)){if(K===f)return w;break}if(q.match_length=0,oe=a._tr_tally(q,0,q.window[q.strstart]),q.lookahead--,q.strstart++,oe&&(Z(q,!1),q.strm.avail_out===0))return w}return q.insert=0,K===h?(Z(q,!0),q.strm.avail_out===0?U:F):q.last_lit&&(Z(q,!1),q.strm.avail_out===0)?w:M})(A,ne):A.strategy===3?(function(q,K){for(var oe,re,B,Y,le=q.window;;){if(q.lookahead<=O){if(de(q),q.lookahead<=O&&K===f)return w;if(q.lookahead===0)break}if(q.match_length=0,q.lookahead>=R&&0<q.strstart&&(re=le[B=q.strstart-1])===le[++B]&&re===le[++B]&&re===le[++B]){Y=q.strstart+O;do;while(re===le[++B]&&re===le[++B]&&re===le[++B]&&re===le[++B]&&re===le[++B]&&re===le[++B]&&re===le[++B]&&re===le[++B]&&B<Y);q.match_length=O-(Y-B),q.match_length>q.lookahead&&(q.match_length=q.lookahead)}if(q.match_length>=R?(oe=a._tr_tally(q,1,q.match_length-R),q.lookahead-=q.match_length,q.strstart+=q.match_length,q.match_length=0):(oe=a._tr_tally(q,0,q.window[q.strstart]),q.lookahead--,q.strstart++),oe&&(Z(q,!1),q.strm.avail_out===0))return w}return q.insert=0,K===h?(Z(q,!0),q.strm.avail_out===0?U:F):q.last_lit&&(Z(q,!1),q.strm.avail_out===0)?w:M})(A,ne):s[A.level].func(A,ne);if(se!==U&&se!==F||(A.status=666),se===w||se===U)return _.avail_out===0&&(A.last_flush=-1),p;if(se===M&&(ne===1?a._tr_align(A):ne!==5&&(a._tr_stored_block(A,0,0,!1),ne===3&&(z(A.head),A.lookahead===0&&(A.strstart=0,A.block_start=0,A.insert=0))),H(_),_.avail_out===0))return A.last_flush=-1,p}return ne!==h?p:A.wrap<=0?1:(A.wrap===2?(P(A,255&_.adler),P(A,_.adler>>8&255),P(A,_.adler>>16&255),P(A,_.adler>>24&255),P(A,255&_.total_in),P(A,_.total_in>>8&255),P(A,_.total_in>>16&255),P(A,_.total_in>>24&255)):(ee(A,_.adler>>>16),ee(A,65535&_.adler)),H(_),0<A.wrap&&(A.wrap=-A.wrap),A.pending!==0?p:1)},o.deflateEnd=function(_){var ne;return _&&_.state?(ne=_.state.status)!==E&&ne!==69&&ne!==73&&ne!==91&&ne!==103&&ne!==L&&ne!==666?V(_,x):(_.state=null,ne===L?V(_,-3):p):x},o.deflateSetDictionary=function(_,ne){var G,A,T,D,X,se,q,K,oe=ne.length;if(!_||!_.state||(D=(G=_.state).wrap)===2||D===1&&G.status!==E||G.lookahead)return x;for(D===1&&(_.adler=c(_.adler,ne,oe,0)),G.wrap=0,oe>=G.w_size&&(D===0&&(z(G.head),G.strstart=0,G.block_start=0,G.insert=0),K=new i.Buf8(G.w_size),i.arraySet(K,ne,oe-G.w_size,G.w_size,0),ne=K,oe=G.w_size),X=_.avail_in,se=_.next_in,q=_.input,_.avail_in=oe,_.next_in=0,_.input=ne,de(G);G.lookahead>=R;){for(A=G.strstart,T=G.lookahead-(R-1);G.ins_h=(G.ins_h<<G.hash_shift^G.window[A+R-1])&G.hash_mask,G.prev[A&G.w_mask]=G.head[G.ins_h],G.head[G.ins_h]=A,A++,--T;);G.strstart=A,G.lookahead=R-1,de(G)}return G.strstart+=G.lookahead,G.block_start=G.strstart,G.insert=G.lookahead,G.lookahead=0,G.match_length=G.prev_length=R-1,G.match_available=0,_.next_in=se,_.input=q,_.avail_in=X,G.wrap=D,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 a,c,u,d,f,h,p,x,m,g,y,v,k,S,C,j,N,I,R,O,$,E,L,w,M;a=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=a.dmax,x=a.wsize,m=a.whave,g=a.wnext,y=a.window,v=a.hold,k=a.bits,S=a.lencode,C=a.distcode,j=(1<<a.lenbits)-1,N=(1<<a.distbits)-1;e:do{k<15&&(v+=w[c++]<<k,k+=8,v+=w[c++]<<k,k+=8),I=S[v&j];t:for(;;){if(v>>>=R=I>>>24,k-=R,(R=I>>>16&255)===0)M[d++]=65535&I;else{if(!(16&R)){if((64&R)==0){I=S[(65535&I)+(v&(1<<R)-1)];continue t}if(32&R){a.mode=12;break e}s.msg="invalid literal/length code",a.mode=30;break e}O=65535&I,(R&=15)&&(k<R&&(v+=w[c++]<<k,k+=8),O+=v&(1<<R)-1,v>>>=R,k-=R),k<15&&(v+=w[c++]<<k,k+=8,v+=w[c++]<<k,k+=8),I=C[v&N];n:for(;;){if(v>>>=R=I>>>24,k-=R,!(16&(R=I>>>16&255))){if((64&R)==0){I=C[(65535&I)+(v&(1<<R)-1)];continue n}s.msg="invalid distance code",a.mode=30;break e}if($=65535&I,k<(R&=15)&&(v+=w[c++]<<k,(k+=8)<R&&(v+=w[c++]<<k,k+=8)),p<($+=v&(1<<R)-1)){s.msg="invalid distance too far back",a.mode=30;break e}if(v>>>=R,k-=R,(R=d-f)<$){if(m<(R=$-R)&&a.sane){s.msg="invalid distance too far back",a.mode=30;break e}if(L=y,(E=0)===g){if(E+=x-R,R<O){for(O-=R;M[d++]=y[E++],--R;);E=d-$,L=M}}else if(g<R){if(E+=x+g-R,(R-=g)<O){for(O-=R;M[d++]=y[E++],--R;);if(E=0,g<O){for(O-=R=g;M[d++]=y[E++],--R;);E=d-$,L=M}}}else if(E+=g-R,R<O){for(O-=R;M[d++]=y[E++],--R;);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),a.hold=v,a.bits=k}},{}],49:[function(n,r,o){var s=n("../utils/common"),i=n("./adler32"),a=n("./crc32"),c=n("./inffast"),u=n("./inftrees"),d=1,f=2,h=0,p=-2,x=1,m=852,g=592;function y(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,I,R=!0;function O(E){if(R){var L;for(N=new s.Buf32(512),I=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,I,0,E.work,{bits:5}),R=!1}E.lencode=N,E.lenbits=9,E.distcode=I,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,V,J,z,H,Z,P,ee,Q,de,ae,ue,he,fe,ge,Ce,ze,_,ne,G,A,T=0,D=new s.Buf8(4),X=[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),V=E.next_out,U=E.output,z=E.avail_out,F=E.next_in,M=E.input,J=E.avail_in,H=w.hold,Z=w.bits,P=J,ee=z,ne=h;e:for(;;)switch(w.mode){case x:if(w.wrap===0){w.mode=13;break}for(;Z<16;){if(J===0)break e;J--,H+=M[F++]<<Z,Z+=8}if(2&w.wrap&&H===35615){D[w.check=0]=255&H,D[1]=H>>>8&255,w.check=a(w.check,D,2,0),Z=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(Z-=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,Z=H=0;break;case 2:for(;Z<16;){if(J===0)break e;J--,H+=M[F++]<<Z,Z+=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&&(D[0]=255&H,D[1]=H>>>8&255,w.check=a(w.check,D,2,0)),Z=H=0,w.mode=3;case 3:for(;Z<32;){if(J===0)break e;J--,H+=M[F++]<<Z,Z+=8}w.head&&(w.head.time=H),512&w.flags&&(D[0]=255&H,D[1]=H>>>8&255,D[2]=H>>>16&255,D[3]=H>>>24&255,w.check=a(w.check,D,4,0)),Z=H=0,w.mode=4;case 4:for(;Z<16;){if(J===0)break e;J--,H+=M[F++]<<Z,Z+=8}w.head&&(w.head.xflags=255&H,w.head.os=H>>8),512&w.flags&&(D[0]=255&H,D[1]=H>>>8&255,w.check=a(w.check,D,2,0)),Z=H=0,w.mode=5;case 5:if(1024&w.flags){for(;Z<16;){if(J===0)break e;J--,H+=M[F++]<<Z,Z+=8}w.length=H,w.head&&(w.head.extra_len=H),512&w.flags&&(D[0]=255&H,D[1]=H>>>8&255,w.check=a(w.check,D,2,0)),Z=H=0}else w.head&&(w.head.extra=null);w.mode=6;case 6:if(1024&w.flags&&(J<(Q=w.length)&&(Q=J),Q&&(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,Q,_)),512&w.flags&&(w.check=a(w.check,M,Q,F)),J-=Q,F+=Q,w.length-=Q),w.length))break e;w.length=0,w.mode=7;case 7:if(2048&w.flags){if(J===0)break e;for(Q=0;_=M[F+Q++],w.head&&_&&w.length<65536&&(w.head.name+=String.fromCharCode(_)),_&&Q<J;);if(512&w.flags&&(w.check=a(w.check,M,Q,F)),J-=Q,F+=Q,_)break e}else w.head&&(w.head.name=null);w.length=0,w.mode=8;case 8:if(4096&w.flags){if(J===0)break e;for(Q=0;_=M[F+Q++],w.head&&_&&w.length<65536&&(w.head.comment+=String.fromCharCode(_)),_&&Q<J;);if(512&w.flags&&(w.check=a(w.check,M,Q,F)),J-=Q,F+=Q,_)break e}else w.head&&(w.head.comment=null);w.mode=9;case 9:if(512&w.flags){for(;Z<16;){if(J===0)break e;J--,H+=M[F++]<<Z,Z+=8}if(H!==(65535&w.check)){E.msg="header crc mismatch",w.mode=30;break}Z=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(;Z<32;){if(J===0)break e;J--,H+=M[F++]<<Z,Z+=8}E.adler=w.check=y(H),Z=H=0,w.mode=11;case 11:if(w.havedict===0)return E.next_out=V,E.avail_out=z,E.next_in=F,E.avail_in=J,w.hold=H,w.bits=Z,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&Z,Z-=7&Z,w.mode=27;break}for(;Z<3;){if(J===0)break e;J--,H+=M[F++]<<Z,Z+=8}switch(w.last=1&H,Z-=1,3&(H>>>=1)){case 0:w.mode=14;break;case 1:if(O(w),w.mode=20,L!==6)break;H>>>=2,Z-=2;break e;case 2:w.mode=17;break;case 3:E.msg="invalid block type",w.mode=30}H>>>=2,Z-=2;break;case 14:for(H>>>=7&Z,Z-=7&Z;Z<32;){if(J===0)break e;J--,H+=M[F++]<<Z,Z+=8}if((65535&H)!=(H>>>16^65535)){E.msg="invalid stored block lengths",w.mode=30;break}if(w.length=65535&H,Z=H=0,w.mode=15,L===6)break e;case 15:w.mode=16;case 16:if(Q=w.length){if(J<Q&&(Q=J),z<Q&&(Q=z),Q===0)break e;s.arraySet(U,M,F,Q,V),J-=Q,F+=Q,z-=Q,V+=Q,w.length-=Q;break}w.mode=12;break;case 17:for(;Z<14;){if(J===0)break e;J--,H+=M[F++]<<Z,Z+=8}if(w.nlen=257+(31&H),H>>>=5,Z-=5,w.ndist=1+(31&H),H>>>=5,Z-=5,w.ncode=4+(15&H),H>>>=4,Z-=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(;Z<3;){if(J===0)break e;J--,H+=M[F++]<<Z,Z+=8}w.lens[X[w.have++]]=7&H,H>>>=3,Z-=3}for(;w.have<19;)w.lens[X[w.have++]]=0;if(w.lencode=w.lendyn,w.lenbits=7,G={bits:w.lenbits},ne=u(0,w.lens,0,19,w.lencode,0,w.work,G),w.lenbits=G.bits,ne){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(;he=(T=w.lencode[H&(1<<w.lenbits)-1])>>>16&255,fe=65535&T,!((ue=T>>>24)<=Z);){if(J===0)break e;J--,H+=M[F++]<<Z,Z+=8}if(fe<16)H>>>=ue,Z-=ue,w.lens[w.have++]=fe;else{if(fe===16){for(A=ue+2;Z<A;){if(J===0)break e;J--,H+=M[F++]<<Z,Z+=8}if(H>>>=ue,Z-=ue,w.have===0){E.msg="invalid bit length repeat",w.mode=30;break}_=w.lens[w.have-1],Q=3+(3&H),H>>>=2,Z-=2}else if(fe===17){for(A=ue+3;Z<A;){if(J===0)break e;J--,H+=M[F++]<<Z,Z+=8}Z-=ue,_=0,Q=3+(7&(H>>>=ue)),H>>>=3,Z-=3}else{for(A=ue+7;Z<A;){if(J===0)break e;J--,H+=M[F++]<<Z,Z+=8}Z-=ue,_=0,Q=11+(127&(H>>>=ue)),H>>>=7,Z-=7}if(w.have+Q>w.nlen+w.ndist){E.msg="invalid bit length repeat",w.mode=30;break}for(;Q--;)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,G={bits:w.lenbits},ne=u(d,w.lens,0,w.nlen,w.lencode,0,w.work,G),w.lenbits=G.bits,ne){E.msg="invalid literal/lengths set",w.mode=30;break}if(w.distbits=6,w.distcode=w.distdyn,G={bits:w.distbits},ne=u(f,w.lens,w.nlen,w.ndist,w.distcode,0,w.work,G),w.distbits=G.bits,ne){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<=J&&258<=z){E.next_out=V,E.avail_out=z,E.next_in=F,E.avail_in=J,w.hold=H,w.bits=Z,c(E,ee),V=E.next_out,U=E.output,z=E.avail_out,F=E.next_in,M=E.input,J=E.avail_in,H=w.hold,Z=w.bits,w.mode===12&&(w.back=-1);break}for(w.back=0;he=(T=w.lencode[H&(1<<w.lenbits)-1])>>>16&255,fe=65535&T,!((ue=T>>>24)<=Z);){if(J===0)break e;J--,H+=M[F++]<<Z,Z+=8}if(he&&(240&he)==0){for(ge=ue,Ce=he,ze=fe;he=(T=w.lencode[ze+((H&(1<<ge+Ce)-1)>>ge)])>>>16&255,fe=65535&T,!(ge+(ue=T>>>24)<=Z);){if(J===0)break e;J--,H+=M[F++]<<Z,Z+=8}H>>>=ge,Z-=ge,w.back+=ge}if(H>>>=ue,Z-=ue,w.back+=ue,w.length=fe,he===0){w.mode=26;break}if(32&he){w.back=-1,w.mode=12;break}if(64&he){E.msg="invalid literal/length code",w.mode=30;break}w.extra=15&he,w.mode=22;case 22:if(w.extra){for(A=w.extra;Z<A;){if(J===0)break e;J--,H+=M[F++]<<Z,Z+=8}w.length+=H&(1<<w.extra)-1,H>>>=w.extra,Z-=w.extra,w.back+=w.extra}w.was=w.length,w.mode=23;case 23:for(;he=(T=w.distcode[H&(1<<w.distbits)-1])>>>16&255,fe=65535&T,!((ue=T>>>24)<=Z);){if(J===0)break e;J--,H+=M[F++]<<Z,Z+=8}if((240&he)==0){for(ge=ue,Ce=he,ze=fe;he=(T=w.distcode[ze+((H&(1<<ge+Ce)-1)>>ge)])>>>16&255,fe=65535&T,!(ge+(ue=T>>>24)<=Z);){if(J===0)break e;J--,H+=M[F++]<<Z,Z+=8}H>>>=ge,Z-=ge,w.back+=ge}if(H>>>=ue,Z-=ue,w.back+=ue,64&he){E.msg="invalid distance code",w.mode=30;break}w.offset=fe,w.extra=15&he,w.mode=24;case 24:if(w.extra){for(A=w.extra;Z<A;){if(J===0)break e;J--,H+=M[F++]<<Z,Z+=8}w.offset+=H&(1<<w.extra)-1,H>>>=w.extra,Z-=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(z===0)break e;if(Q=ee-z,w.offset>Q){if((Q=w.offset-Q)>w.whave&&w.sane){E.msg="invalid distance too far back",w.mode=30;break}de=Q>w.wnext?(Q-=w.wnext,w.wsize-Q):w.wnext-Q,Q>w.length&&(Q=w.length),ae=w.window}else ae=U,de=V-w.offset,Q=w.length;for(z<Q&&(Q=z),z-=Q,w.length-=Q;U[V++]=ae[de++],--Q;);w.length===0&&(w.mode=21);break;case 26:if(z===0)break e;U[V++]=w.length,z--,w.mode=21;break;case 27:if(w.wrap){for(;Z<32;){if(J===0)break e;J--,H|=M[F++]<<Z,Z+=8}if(ee-=z,E.total_out+=ee,w.total+=ee,ee&&(E.adler=w.check=w.flags?a(w.check,U,ee,V-ee):i(w.check,U,ee,V-ee)),ee=z,(w.flags?H:y(H))!==w.check){E.msg="incorrect data check",w.mode=30;break}Z=H=0}w.mode=28;case 28:if(w.wrap&&w.flags){for(;Z<32;){if(J===0)break e;J--,H+=M[F++]<<Z,Z+=8}if(H!==(4294967295&w.total)){E.msg="incorrect length check",w.mode=30;break}Z=H=0}w.mode=29;case 29:ne=1;break e;case 30:ne=-3;break e;case 31:return-4;default:return p}return E.next_out=V,E.avail_out=z,E.next_in=F,E.avail_in=J,w.hold=H,w.bits=Z,(w.wsize||ee!==E.avail_out&&w.mode<30&&(w.mode<27||L!==4))&&$(E,E.output,E.next_out,ee-E.avail_out)?(w.mode=31,-4):(P-=E.avail_in,ee-=E.avail_out,E.total_in+=P,E.total_out+=ee,w.total+=ee,w.wrap&&ee&&(E.adler=w.check=w.flags?a(w.check,U,ee,E.next_out-ee):i(w.check,U,ee,E.next_out-ee)),E.data_type=w.bits+(w.last?64:0)+(w.mode===12?128:0)+(w.mode===20||w.mode===15?256:0),(P==0&&ee===0||L===4)&&ne===h&&(ne=-5),ne)},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],a=[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,y){var v,k,S,C,j,N,I,R,O,$=y.bits,E=0,L=0,w=0,M=0,U=0,F=0,V=0,J=0,z=0,H=0,Z=null,P=0,ee=new s.Buf16(16),Q=new s.Buf16(16),de=null,ae=0;for(E=0;E<=15;E++)ee[E]=0;for(L=0;L<p;L++)ee[f[h+L]]++;for(U=$,M=15;1<=M&&ee[M]===0;M--);if(M<U&&(U=M),M===0)return x[m++]=20971520,x[m++]=20971520,y.bits=1,0;for(w=1;w<M&&ee[w]===0;w++);for(U<w&&(U=w),E=J=1;E<=15;E++)if(J<<=1,(J-=ee[E])<0)return-1;if(0<J&&(d===0||M!==1))return-1;for(Q[1]=0,E=1;E<15;E++)Q[E+1]=Q[E]+ee[E];for(L=0;L<p;L++)f[h+L]!==0&&(g[Q[f[h+L]]++]=L);if(N=d===0?(Z=de=g,19):d===1?(Z=i,P-=257,de=a,ae-=257,256):(Z=c,de=u,-1),E=w,j=m,V=L=H=0,S=-1,C=(z=1<<(F=U))-1,d===1&&852<z||d===2&&592<z)return 1;for(;;){for(I=E-V,O=g[L]<N?(R=0,g[L]):g[L]>N?(R=de[ae+g[L]],Z[P+g[L]]):(R=96,0),v=1<<E-V,w=k=1<<F;x[j+(H>>V)+(k-=v)]=I<<24|R<<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++,--ee[E]==0){if(E===M)break;E=f[h+g[L]]}if(U<E&&(H&C)!==S){for(V===0&&(V=U),j+=w,J=1<<(F=E-V);F+V<M&&!((J-=ee[F+V])<=0);)F++,J<<=1;if(z+=1<<F,d===1&&852<z||d===2&&592<z)return 1;x[S=H&C]=U<<24|F<<16|j-m|0}}return H!==0&&(x[j+H]=E-V<<24|64<<16|0),y.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,a=1;function c(T){for(var D=T.length;0<=--D;)T[D]=0}var u=0,d=29,f=256,h=f+1+d,p=30,x=19,m=2*h+1,g=15,y=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],I=[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],R=[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,V,J=new Array(p);function z(T,D,X,se,q){this.static_tree=T,this.extra_bits=D,this.extra_base=X,this.elems=se,this.max_length=q,this.has_stree=T&&T.length}function H(T,D){this.dyn_tree=T,this.max_code=0,this.stat_desc=D}function Z(T){return T<256?L[T]:L[256+(T>>>7)]}function P(T,D){T.pending_buf[T.pending++]=255&D,T.pending_buf[T.pending++]=D>>>8&255}function ee(T,D,X){T.bi_valid>y-X?(T.bi_buf|=D<<T.bi_valid&65535,P(T,T.bi_buf),T.bi_buf=D>>y-T.bi_valid,T.bi_valid+=X-y):(T.bi_buf|=D<<T.bi_valid&65535,T.bi_valid+=X)}function Q(T,D,X){ee(T,X[2*D],X[2*D+1])}function de(T,D){for(var X=0;X|=1&T,T>>>=1,X<<=1,0<--D;);return X>>>1}function ae(T,D,X){var se,q,K=new Array(g+1),oe=0;for(se=1;se<=g;se++)K[se]=oe=oe+X[se-1]<<1;for(q=0;q<=D;q++){var re=T[2*q+1];re!==0&&(T[2*q]=de(K[re]++,re))}}function ue(T){var D;for(D=0;D<h;D++)T.dyn_ltree[2*D]=0;for(D=0;D<p;D++)T.dyn_dtree[2*D]=0;for(D=0;D<x;D++)T.bl_tree[2*D]=0;T.dyn_ltree[2*k]=1,T.opt_len=T.static_len=0,T.last_lit=T.matches=0}function he(T){8<T.bi_valid?P(T,T.bi_buf):0<T.bi_valid&&(T.pending_buf[T.pending++]=T.bi_buf),T.bi_buf=0,T.bi_valid=0}function fe(T,D,X,se){var q=2*D,K=2*X;return T[q]<T[K]||T[q]===T[K]&&se[D]<=se[X]}function ge(T,D,X){for(var se=T.heap[X],q=X<<1;q<=T.heap_len&&(q<T.heap_len&&fe(D,T.heap[q+1],T.heap[q],T.depth)&&q++,!fe(D,se,T.heap[q],T.depth));)T.heap[X]=T.heap[q],X=q,q<<=1;T.heap[X]=se}function Ce(T,D,X){var se,q,K,oe,re=0;if(T.last_lit!==0)for(;se=T.pending_buf[T.d_buf+2*re]<<8|T.pending_buf[T.d_buf+2*re+1],q=T.pending_buf[T.l_buf+re],re++,se===0?Q(T,q,D):(Q(T,(K=w[q])+f+1,D),(oe=N[K])!==0&&ee(T,q-=M[K],oe),Q(T,K=Z(--se),X),(oe=I[K])!==0&&ee(T,se-=J[K],oe)),re<T.last_lit;);Q(T,k,D)}function ze(T,D){var X,se,q,K=D.dyn_tree,oe=D.stat_desc.static_tree,re=D.stat_desc.has_stree,B=D.stat_desc.elems,Y=-1;for(T.heap_len=0,T.heap_max=m,X=0;X<B;X++)K[2*X]!==0?(T.heap[++T.heap_len]=Y=X,T.depth[X]=0):K[2*X+1]=0;for(;T.heap_len<2;)K[2*(q=T.heap[++T.heap_len]=Y<2?++Y:0)]=1,T.depth[q]=0,T.opt_len--,re&&(T.static_len-=oe[2*q+1]);for(D.max_code=Y,X=T.heap_len>>1;1<=X;X--)ge(T,K,X);for(q=B;X=T.heap[1],T.heap[1]=T.heap[T.heap_len--],ge(T,K,1),se=T.heap[1],T.heap[--T.heap_max]=X,T.heap[--T.heap_max]=se,K[2*q]=K[2*X]+K[2*se],T.depth[q]=(T.depth[X]>=T.depth[se]?T.depth[X]:T.depth[se])+1,K[2*X+1]=K[2*se+1]=q,T.heap[1]=q++,ge(T,K,1),2<=T.heap_len;);T.heap[--T.heap_max]=T.heap[1],(function(le,we){var Ie,Je,ft,Pe,At,Ut,qe=we.dyn_tree,Vt=we.max_code,kt=we.stat_desc.static_tree,rg=we.stat_desc.has_stree,og=we.stat_desc.extra_bits,ll=we.stat_desc.extra_base,lr=we.stat_desc.max_length,Wr=0;for(Pe=0;Pe<=g;Pe++)le.bl_count[Pe]=0;for(qe[2*le.heap[le.heap_max]+1]=0,Ie=le.heap_max+1;Ie<m;Ie++)lr<(Pe=qe[2*qe[2*(Je=le.heap[Ie])+1]+1]+1)&&(Pe=lr,Wr++),qe[2*Je+1]=Pe,Vt<Je||(le.bl_count[Pe]++,At=0,ll<=Je&&(At=og[Je-ll]),Ut=qe[2*Je],le.opt_len+=Ut*(Pe+At),rg&&(le.static_len+=Ut*(kt[2*Je+1]+At)));if(Wr!==0){do{for(Pe=lr-1;le.bl_count[Pe]===0;)Pe--;le.bl_count[Pe]--,le.bl_count[Pe+1]+=2,le.bl_count[lr]--,Wr-=2}while(0<Wr);for(Pe=lr;Pe!==0;Pe--)for(Je=le.bl_count[Pe];Je!==0;)Vt<(ft=le.heap[--Ie])||(qe[2*ft+1]!==Pe&&(le.opt_len+=(Pe-qe[2*ft+1])*qe[2*ft],qe[2*ft+1]=Pe),Je--)}})(T,D),ae(K,Y,T.bl_count)}function _(T,D,X){var se,q,K=-1,oe=D[1],re=0,B=7,Y=4;for(oe===0&&(B=138,Y=3),D[2*(X+1)+1]=65535,se=0;se<=X;se++)q=oe,oe=D[2*(se+1)+1],++re<B&&q===oe||(re<Y?T.bl_tree[2*q]+=re:q!==0?(q!==K&&T.bl_tree[2*q]++,T.bl_tree[2*S]++):re<=10?T.bl_tree[2*C]++:T.bl_tree[2*j]++,K=q,Y=(re=0)===oe?(B=138,3):q===oe?(B=6,3):(B=7,4))}function ne(T,D,X){var se,q,K=-1,oe=D[1],re=0,B=7,Y=4;for(oe===0&&(B=138,Y=3),se=0;se<=X;se++)if(q=oe,oe=D[2*(se+1)+1],!(++re<B&&q===oe)){if(re<Y)for(;Q(T,q,T.bl_tree),--re!=0;);else q!==0?(q!==K&&(Q(T,q,T.bl_tree),re--),Q(T,S,T.bl_tree),ee(T,re-3,2)):re<=10?(Q(T,C,T.bl_tree),ee(T,re-3,3)):(Q(T,j,T.bl_tree),ee(T,re-11,7));K=q,Y=(re=0)===oe?(B=138,3):q===oe?(B=6,3):(B=7,4)}}c(J);var G=!1;function A(T,D,X,se){ee(T,(u<<1)+(se?1:0),3),(function(q,K,oe,re){he(q),P(q,oe),P(q,~oe),s.arraySet(q.pending_buf,q.window,K,oe,q.pending),q.pending+=oe})(T,D,X)}o._tr_init=function(T){G||((function(){var D,X,se,q,K,oe=new Array(g+1);for(q=se=0;q<d-1;q++)for(M[q]=se,D=0;D<1<<N[q];D++)w[se++]=q;for(w[se-1]=q,q=K=0;q<16;q++)for(J[q]=K,D=0;D<1<<I[q];D++)L[K++]=q;for(K>>=7;q<p;q++)for(J[q]=K<<7,D=0;D<1<<I[q]-7;D++)L[256+K++]=q;for(X=0;X<=g;X++)oe[X]=0;for(D=0;D<=143;)$[2*D+1]=8,D++,oe[8]++;for(;D<=255;)$[2*D+1]=9,D++,oe[9]++;for(;D<=279;)$[2*D+1]=7,D++,oe[7]++;for(;D<=287;)$[2*D+1]=8,D++,oe[8]++;for(ae($,h+1,oe),D=0;D<p;D++)E[2*D+1]=5,E[2*D]=de(D,5);U=new z($,N,f+1,h,g),F=new z(E,I,0,p,g),V=new z(new Array(0),R,0,x,v)})(),G=!0),T.l_desc=new H(T.dyn_ltree,U),T.d_desc=new H(T.dyn_dtree,F),T.bl_desc=new H(T.bl_tree,V),T.bi_buf=0,T.bi_valid=0,ue(T)},o._tr_stored_block=A,o._tr_flush_block=function(T,D,X,se){var q,K,oe=0;0<T.level?(T.strm.data_type===2&&(T.strm.data_type=(function(re){var B,Y=4093624447;for(B=0;B<=31;B++,Y>>>=1)if(1&Y&&re.dyn_ltree[2*B]!==0)return i;if(re.dyn_ltree[18]!==0||re.dyn_ltree[20]!==0||re.dyn_ltree[26]!==0)return a;for(B=32;B<f;B++)if(re.dyn_ltree[2*B]!==0)return a;return i})(T)),ze(T,T.l_desc),ze(T,T.d_desc),oe=(function(re){var B;for(_(re,re.dyn_ltree,re.l_desc.max_code),_(re,re.dyn_dtree,re.d_desc.max_code),ze(re,re.bl_desc),B=x-1;3<=B&&re.bl_tree[2*O[B]+1]===0;B--);return re.opt_len+=3*(B+1)+5+5+4,B})(T),q=T.opt_len+3+7>>>3,(K=T.static_len+3+7>>>3)<=q&&(q=K)):q=K=X+5,X+4<=q&&D!==-1?A(T,D,X,se):T.strategy===4||K===q?(ee(T,2+(se?1:0),3),Ce(T,$,E)):(ee(T,4+(se?1:0),3),(function(re,B,Y,le){var we;for(ee(re,B-257,5),ee(re,Y-1,5),ee(re,le-4,4),we=0;we<le;we++)ee(re,re.bl_tree[2*O[we]+1],3);ne(re,re.dyn_ltree,B-1),ne(re,re.dyn_dtree,Y-1)})(T,T.l_desc.max_code+1,T.d_desc.max_code+1,oe+1),Ce(T,T.dyn_ltree,T.dyn_dtree)),ue(T),se&&he(T)},o._tr_tally=function(T,D,X){return T.pending_buf[T.d_buf+2*T.last_lit]=D>>>8&255,T.pending_buf[T.d_buf+2*T.last_lit+1]=255&D,T.pending_buf[T.l_buf+T.last_lit]=255&X,T.last_lit++,D===0?T.dyn_ltree[2*X]++:(T.matches++,D--,T.dyn_ltree[2*(w[X]+f+1)]++,T.dyn_dtree[2*Z(D)]++),T.last_lit===T.lit_bufsize-1},o._tr_align=function(T){ee(T,2,3),Q(T,k,$),(function(D){D.bi_valid===16?(P(D,D.bi_buf),D.bi_buf=0,D.bi_valid=0):8<=D.bi_valid&&(D.pending_buf[D.pending++]=255&D.bi_buf,D.bi_buf>>=8,D.bi_valid-=8)})(T)}},{"../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,a){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=y}function y(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,I=j.args;switch(I.length){case 0:N();break;case 1:N(I[0]);break;case 2:N(I[0],I[1]);break;case 3:N(I[0],I[1],I[2]);break;default:N.apply(a,I)}})(C)}finally{y(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 Zr<"u"?Zr:typeof self<"u"?self:typeof window<"u"?window:{})},{}]},{},[10])(10)})})(Ss)),Ss.exports}var R2=z2();const P2=Gi(R2),Kd="[REDACTED]",O2=/(^|[-_])(api[-_]?key|authorization|cookie|token|secret|password|access[-_]?token|refresh[-_]?token)([-_]|$)/i,M2=[/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];async function L2(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 D2(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function pi(e){if(Array.isArray(e))return e.map(n=>pi(n));if(!D2(e))return e;const t={};for(const[n,r]of Object.entries(e))t[n]=O2.test(n)?Kd:pi(r);return t}function F2(e){const t=n=>{let r=n;for(const o of M2)r=r.replace(o,Kd);return r};try{const n=JSON.parse(e);return t(JSON.stringify(pi(n),null,2))}catch{return t(e)}}function Cs(e,t){return t==="redacted"?F2(e):e}async function $2(e,t="redacted"){const n=new P2,r=t==="redacted"?"redacted":"raw";n.file("manifest.json",JSON.stringify({exportedAt:new Date().toISOString(),mode:t,redacted:t==="redacted",logCount:e.length,logIds:e.map(c=>c.id)},null,2));for(const c of e)c.rawRequestBody!==null&&n.file(`#${c.id}.Request.json`,Cs(c.rawRequestBody,t)),c.responseText!==null&&n.file(`#${c.id}.Response.json`,Cs(c.responseText,t));const o=e.filter(c=>c.streaming);await Promise.allSettled(o.map(async c=>{const u=await L2(c.id);u!==null&&n.file(`#${c.id}.SSE.Response.json`,Cs(u,t))}));const s=await n.generateAsync({type:"blob"}),i=URL.createObjectURL(s),a=document.createElement("a");a.href=i,a.download=`agent-inspector-export-${r}-${new Date().toISOString().slice(0,10)}.zip`,document.body.appendChild(a),a.click(),document.body.removeChild(a),URL.revokeObjectURL(i)}function hi(e,t){switch(t){case"full":return e;case"time":return new Date(e).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",second:"2-digit"})}}function da(e,t,n){return`${hi(e,n)} - ${hi(t,n)}`}function Jd(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=Jd(e[t]))&&(r&&(r+=" "),r+=n)}else for(n in e)e[n]&&(r&&(r+=" "),r+=n);return r}function Gd(){for(var e,t,n=0,r="",o=arguments.length;n<o;n++)(e=arguments[n])&&(t=Jd(e))&&(r&&(r+=" "),r+=t);return r}const B2=(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},U2=(e,t)=>({classGroupId:e,validator:t}),Yd=(e=new Map,t=null,n)=>({nextPart:e,validators:t,classGroupId:n}),No="-",Ml=[],V2="arbitrary..",H2=e=>{const t=Z2(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=e;return{getClassGroupId:i=>{if(i.startsWith("[")&&i.endsWith("]"))return W2(i);const a=i.split(No),c=a[0]===""&&a.length>1?1:0;return Xd(a,c,t)},getConflictingClassGroupIds:(i,a)=>{if(a){const c=r[i],u=n[i];return c?u?B2(u,c):c:u||Ml}return n[i]||Ml}}},Xd=(e,t,n)=>{if(e.length-t===0)return n.classGroupId;const o=e[t],s=n.nextPart.get(o);if(s){const u=Xd(e,t+1,s);if(u)return u}const i=n.validators;if(i===null)return;const a=t===0?e.join(No):e.slice(t).join(No),c=i.length;for(let u=0;u<c;u++){const d=i[u];if(d.validator(a))return d.classGroupId}},W2=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?V2+r:void 0})(),Z2=e=>{const{theme:t,classGroups:n}=e;return q2(n,t)},q2=(e,t)=>{const n=Yd();for(const r in e){const o=e[r];fa(o,n,r,t)}return n},fa=(e,t,n,r)=>{const o=e.length;for(let s=0;s<o;s++){const i=e[s];K2(i,t,n,r)}},K2=(e,t,n,r)=>{if(typeof e=="string"){J2(e,t,n);return}if(typeof e=="function"){G2(e,t,n,r);return}Y2(e,t,n,r)},J2=(e,t,n)=>{const r=e===""?t:Qd(t,e);r.classGroupId=n},G2=(e,t,n,r)=>{if(X2(e)){fa(e(r),t,n,r);return}t.validators===null&&(t.validators=[]),t.validators.push(U2(n,e))},Y2=(e,t,n,r)=>{const o=Object.entries(e),s=o.length;for(let i=0;i<s;i++){const[a,c]=o[i];fa(c,Qd(t,a),n,r)}},Qd=(e,t)=>{let n=e;const r=t.split(No),o=r.length;for(let s=0;s<o;s++){const i=r[s];let a=n.nextPart.get(i);a||(a=Yd(),n.nextPart.set(i,a)),n=a}return n},X2=e=>"isThemeGetter"in e&&e.isThemeGetter===!0,Q2=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)}}},mi="!",Ll=":",ew=[],Dl=(e,t,n,r,o)=>({modifiers:e,hasImportantModifier:t,baseClassName:n,maybePostfixModifierPosition:r,isExternal:o}),tw=e=>{const{prefix:t,experimentalParseClassName:n}=e;let r=o=>{const s=[];let i=0,a=0,c=0,u;const d=o.length;for(let m=0;m<d;m++){const g=o[m];if(i===0&&a===0){if(g===Ll){s.push(o.slice(c,m)),c=m+1;continue}if(g==="/"){u=m;continue}}g==="["?i++:g==="]"?i--:g==="("?a++:g===")"&&a--}const f=s.length===0?o:o.slice(c);let h=f,p=!1;f.endsWith(mi)?(h=f.slice(0,-1),p=!0):f.startsWith(mi)&&(h=f.slice(1),p=!0);const x=u&&u>c?u-c:void 0;return Dl(s,p,h,x)};if(t){const o=t+Ll,s=r;r=i=>i.startsWith(o)?s(i.slice(o.length)):Dl(ew,!1,i,void 0,!0)}if(n){const o=r;r=s=>n({className:s,parseClassName:o})}return r},nw=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],a=i[0]==="[",c=t.has(i);a||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}},rw=e=>({cache:Q2(e.cacheSize),parseClassName:tw(e),sortModifiers:nw(e),...H2(e)}),ow=/\s+/,sw=(e,t)=>{const{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:o,sortModifiers:s}=t,i=[],a=e.trim().split(ow);let c="";for(let u=a.length-1;u>=0;u-=1){const d=a[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,y=r(g?x.substring(0,m):x);if(!y){if(!g){c=d+(c.length>0?" "+c:c);continue}if(y=r(x),!y){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+mi:v,S=k+y;if(i.indexOf(S)>-1)continue;i.push(S);const C=o(y,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},iw=(...e)=>{let t=0,n,r,o="";for(;t<e.length;)(n=e[t++])&&(r=ef(n))&&(o&&(o+=" "),o+=r);return o},ef=e=>{if(typeof e=="string")return e;let t,n="";for(let r=0;r<e.length;r++)e[r]&&(t=ef(e[r]))&&(n&&(n+=" "),n+=t);return n},aw=(e,...t)=>{let n,r,o,s;const i=c=>{const u=t.reduce((d,f)=>f(d),e());return n=rw(u),r=n.cache.get,o=n.cache.set,s=a,a(c)},a=c=>{const u=r(c);if(u)return u;const d=sw(c,n);return o(c,d),d};return s=i,(...c)=>s(iw(...c))},lw=[],Qe=e=>{const t=n=>n[e]||lw;return t.isThemeGetter=!0,t},tf=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,nf=/^\((?:(\w[\w-]*):)?(.+)\)$/i,cw=/^\d+\/\d+$/,uw=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,dw=/\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$/,fw=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,pw=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,hw=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Tn=e=>cw.test(e),Te=e=>!!e&&!Number.isNaN(Number(e)),Qt=e=>!!e&&Number.isInteger(Number(e)),js=e=>e.endsWith("%")&&Te(e.slice(0,-1)),Ht=e=>uw.test(e),mw=()=>!0,gw=e=>dw.test(e)&&!fw.test(e),rf=()=>!1,xw=e=>pw.test(e),yw=e=>hw.test(e),bw=e=>!xe(e)&&!ye(e),vw=e=>er(e,af,rf),xe=e=>tf.test(e),mn=e=>er(e,lf,gw),Es=e=>er(e,Cw,Te),Fl=e=>er(e,of,rf),ww=e=>er(e,sf,yw),Yr=e=>er(e,cf,xw),ye=e=>nf.test(e),cr=e=>tr(e,lf),kw=e=>tr(e,jw),$l=e=>tr(e,of),_w=e=>tr(e,af),Sw=e=>tr(e,sf),Xr=e=>tr(e,cf,!0),er=(e,t,n)=>{const r=tf.exec(e);return r?r[1]?t(r[1]):n(r[2]):!1},tr=(e,t,n=!1)=>{const r=nf.exec(e);return r?r[1]?t(r[1]):n:!1},of=e=>e==="position"||e==="percentage",sf=e=>e==="image"||e==="url",af=e=>e==="length"||e==="size"||e==="bg-size",lf=e=>e==="length",Cw=e=>e==="number",jw=e=>e==="family-name",cf=e=>e==="shadow",Ew=()=>{const e=Qe("color"),t=Qe("font"),n=Qe("text"),r=Qe("font-weight"),o=Qe("tracking"),s=Qe("leading"),i=Qe("breakpoint"),a=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"),y=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(),ye,xe],j=()=>["auto","hidden","clip","visible","scroll"],N=()=>["auto","contain","none"],I=()=>[ye,xe,c],R=()=>[Tn,"full","auto",...I()],O=()=>[Qt,"none","subgrid",ye,xe],$=()=>["auto",{span:["full",Qt,ye,xe]},Qt,ye,xe],E=()=>[Qt,"auto",ye,xe],L=()=>["auto","min","max","fr",ye,xe],w=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],M=()=>["start","end","center","stretch","center-safe","end-safe"],U=()=>["auto",...I()],F=()=>[Tn,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...I()],V=()=>[e,ye,xe],J=()=>[...S(),$l,Fl,{position:[ye,xe]}],z=()=>["no-repeat",{repeat:["","x","y","space","round"]}],H=()=>["auto","cover","contain",_w,vw,{size:[ye,xe]}],Z=()=>[js,cr,mn],P=()=>["","none","full",u,ye,xe],ee=()=>["",Te,cr,mn],Q=()=>["solid","dashed","dotted","double"],de=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],ae=()=>[Te,js,$l,Fl],ue=()=>["","none",x,ye,xe],he=()=>["none",Te,ye,xe],fe=()=>["none",Te,ye,xe],ge=()=>[Te,ye,xe],Ce=()=>[Tn,"full",...I()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[Ht],breakpoint:[Ht],color:[mw],container:[Ht],"drop-shadow":[Ht],ease:["in","out","in-out"],font:[bw],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[Ht],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[Ht],shadow:[Ht],spacing:["px",Te],text:[Ht],"text-shadow":[Ht],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",Tn,xe,ye,g]}],container:["container"],columns:[{columns:[Te,xe,ye,a]}],"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:R()}],"inset-x":[{"inset-x":R()}],"inset-y":[{"inset-y":R()}],start:[{start:R()}],end:[{end:R()}],top:[{top:R()}],right:[{right:R()}],bottom:[{bottom:R()}],left:[{left:R()}],visibility:["visible","invisible","collapse"],z:[{z:[Qt,"auto",ye,xe]}],basis:[{basis:[Tn,"full","auto",a,...I()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[Te,Tn,"auto","initial","none",xe]}],grow:[{grow:["",Te,ye,xe]}],shrink:[{shrink:["",Te,ye,xe]}],order:[{order:[Qt,"first","last","none",ye,xe]}],"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:I()}],"gap-x":[{"gap-x":I()}],"gap-y":[{"gap-y":I()}],"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:I()}],px:[{px:I()}],py:[{py:I()}],ps:[{ps:I()}],pe:[{pe:I()}],pt:[{pt:I()}],pr:[{pr:I()}],pb:[{pb:I()}],pl:[{pl:I()}],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":I()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":I()}],"space-y-reverse":["space-y-reverse"],size:[{size:F()}],w:[{w:[a,"screen",...F()]}],"min-w":[{"min-w":[a,"screen","none",...F()]}],"max-w":[{"max-w":[a,"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,cr,mn]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[r,ye,Es]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",js,xe]}],"font-family":[{font:[kw,xe,t]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:[o,ye,xe]}],"line-clamp":[{"line-clamp":[Te,"none",ye,Es]}],leading:[{leading:[s,...I()]}],"list-image":[{"list-image":["none",ye,xe]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",ye,xe]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:V()}],"text-color":[{text:V()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...Q(),"wavy"]}],"text-decoration-thickness":[{decoration:[Te,"from-font","auto",ye,mn]}],"text-decoration-color":[{decoration:V()}],"underline-offset":[{"underline-offset":[Te,"auto",ye,xe]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:I()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",ye,xe]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",ye,xe]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:J()}],"bg-repeat":[{bg:z()}],"bg-size":[{bg:H()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},Qt,ye,xe],radial:["",ye,xe],conic:[Qt,ye,xe]},Sw,ww]}],"bg-color":[{bg:V()}],"gradient-from-pos":[{from:Z()}],"gradient-via-pos":[{via:Z()}],"gradient-to-pos":[{to:Z()}],"gradient-from":[{from:V()}],"gradient-via":[{via:V()}],"gradient-to":[{to:V()}],rounded:[{rounded:P()}],"rounded-s":[{"rounded-s":P()}],"rounded-e":[{"rounded-e":P()}],"rounded-t":[{"rounded-t":P()}],"rounded-r":[{"rounded-r":P()}],"rounded-b":[{"rounded-b":P()}],"rounded-l":[{"rounded-l":P()}],"rounded-ss":[{"rounded-ss":P()}],"rounded-se":[{"rounded-se":P()}],"rounded-ee":[{"rounded-ee":P()}],"rounded-es":[{"rounded-es":P()}],"rounded-tl":[{"rounded-tl":P()}],"rounded-tr":[{"rounded-tr":P()}],"rounded-br":[{"rounded-br":P()}],"rounded-bl":[{"rounded-bl":P()}],"border-w":[{border:ee()}],"border-w-x":[{"border-x":ee()}],"border-w-y":[{"border-y":ee()}],"border-w-s":[{"border-s":ee()}],"border-w-e":[{"border-e":ee()}],"border-w-t":[{"border-t":ee()}],"border-w-r":[{"border-r":ee()}],"border-w-b":[{"border-b":ee()}],"border-w-l":[{"border-l":ee()}],"divide-x":[{"divide-x":ee()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":ee()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...Q(),"hidden","none"]}],"divide-style":[{divide:[...Q(),"hidden","none"]}],"border-color":[{border:V()}],"border-color-x":[{"border-x":V()}],"border-color-y":[{"border-y":V()}],"border-color-s":[{"border-s":V()}],"border-color-e":[{"border-e":V()}],"border-color-t":[{"border-t":V()}],"border-color-r":[{"border-r":V()}],"border-color-b":[{"border-b":V()}],"border-color-l":[{"border-l":V()}],"divide-color":[{divide:V()}],"outline-style":[{outline:[...Q(),"none","hidden"]}],"outline-offset":[{"outline-offset":[Te,ye,xe]}],"outline-w":[{outline:["",Te,cr,mn]}],"outline-color":[{outline:V()}],shadow:[{shadow:["","none",d,Xr,Yr]}],"shadow-color":[{shadow:V()}],"inset-shadow":[{"inset-shadow":["none",f,Xr,Yr]}],"inset-shadow-color":[{"inset-shadow":V()}],"ring-w":[{ring:ee()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:V()}],"ring-offset-w":[{"ring-offset":[Te,mn]}],"ring-offset-color":[{"ring-offset":V()}],"inset-ring-w":[{"inset-ring":ee()}],"inset-ring-color":[{"inset-ring":V()}],"text-shadow":[{"text-shadow":["none",h,Xr,Yr]}],"text-shadow-color":[{"text-shadow":V()}],opacity:[{opacity:[Te,ye,xe]}],"mix-blend":[{"mix-blend":[...de(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":de()}],"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":[Te]}],"mask-image-linear-from-pos":[{"mask-linear-from":ae()}],"mask-image-linear-to-pos":[{"mask-linear-to":ae()}],"mask-image-linear-from-color":[{"mask-linear-from":V()}],"mask-image-linear-to-color":[{"mask-linear-to":V()}],"mask-image-t-from-pos":[{"mask-t-from":ae()}],"mask-image-t-to-pos":[{"mask-t-to":ae()}],"mask-image-t-from-color":[{"mask-t-from":V()}],"mask-image-t-to-color":[{"mask-t-to":V()}],"mask-image-r-from-pos":[{"mask-r-from":ae()}],"mask-image-r-to-pos":[{"mask-r-to":ae()}],"mask-image-r-from-color":[{"mask-r-from":V()}],"mask-image-r-to-color":[{"mask-r-to":V()}],"mask-image-b-from-pos":[{"mask-b-from":ae()}],"mask-image-b-to-pos":[{"mask-b-to":ae()}],"mask-image-b-from-color":[{"mask-b-from":V()}],"mask-image-b-to-color":[{"mask-b-to":V()}],"mask-image-l-from-pos":[{"mask-l-from":ae()}],"mask-image-l-to-pos":[{"mask-l-to":ae()}],"mask-image-l-from-color":[{"mask-l-from":V()}],"mask-image-l-to-color":[{"mask-l-to":V()}],"mask-image-x-from-pos":[{"mask-x-from":ae()}],"mask-image-x-to-pos":[{"mask-x-to":ae()}],"mask-image-x-from-color":[{"mask-x-from":V()}],"mask-image-x-to-color":[{"mask-x-to":V()}],"mask-image-y-from-pos":[{"mask-y-from":ae()}],"mask-image-y-to-pos":[{"mask-y-to":ae()}],"mask-image-y-from-color":[{"mask-y-from":V()}],"mask-image-y-to-color":[{"mask-y-to":V()}],"mask-image-radial":[{"mask-radial":[ye,xe]}],"mask-image-radial-from-pos":[{"mask-radial-from":ae()}],"mask-image-radial-to-pos":[{"mask-radial-to":ae()}],"mask-image-radial-from-color":[{"mask-radial-from":V()}],"mask-image-radial-to-color":[{"mask-radial-to":V()}],"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":[Te]}],"mask-image-conic-from-pos":[{"mask-conic-from":ae()}],"mask-image-conic-to-pos":[{"mask-conic-to":ae()}],"mask-image-conic-from-color":[{"mask-conic-from":V()}],"mask-image-conic-to-color":[{"mask-conic-to":V()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:J()}],"mask-repeat":[{mask:z()}],"mask-size":[{mask:H()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",ye,xe]}],filter:[{filter:["","none",ye,xe]}],blur:[{blur:ue()}],brightness:[{brightness:[Te,ye,xe]}],contrast:[{contrast:[Te,ye,xe]}],"drop-shadow":[{"drop-shadow":["","none",p,Xr,Yr]}],"drop-shadow-color":[{"drop-shadow":V()}],grayscale:[{grayscale:["",Te,ye,xe]}],"hue-rotate":[{"hue-rotate":[Te,ye,xe]}],invert:[{invert:["",Te,ye,xe]}],saturate:[{saturate:[Te,ye,xe]}],sepia:[{sepia:["",Te,ye,xe]}],"backdrop-filter":[{"backdrop-filter":["","none",ye,xe]}],"backdrop-blur":[{"backdrop-blur":ue()}],"backdrop-brightness":[{"backdrop-brightness":[Te,ye,xe]}],"backdrop-contrast":[{"backdrop-contrast":[Te,ye,xe]}],"backdrop-grayscale":[{"backdrop-grayscale":["",Te,ye,xe]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[Te,ye,xe]}],"backdrop-invert":[{"backdrop-invert":["",Te,ye,xe]}],"backdrop-opacity":[{"backdrop-opacity":[Te,ye,xe]}],"backdrop-saturate":[{"backdrop-saturate":[Te,ye,xe]}],"backdrop-sepia":[{"backdrop-sepia":["",Te,ye,xe]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":I()}],"border-spacing-x":[{"border-spacing-x":I()}],"border-spacing-y":[{"border-spacing-y":I()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",ye,xe]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[Te,"initial",ye,xe]}],ease:[{ease:["linear","initial",y,ye,xe]}],delay:[{delay:[Te,ye,xe]}],animate:[{animate:["none",v,ye,xe]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[m,ye,xe]}],"perspective-origin":[{"perspective-origin":C()}],rotate:[{rotate:he()}],"rotate-x":[{"rotate-x":he()}],"rotate-y":[{"rotate-y":he()}],"rotate-z":[{"rotate-z":he()}],scale:[{scale:fe()}],"scale-x":[{"scale-x":fe()}],"scale-y":[{"scale-y":fe()}],"scale-z":[{"scale-z":fe()}],"scale-3d":["scale-3d"],skew:[{skew:ge()}],"skew-x":[{"skew-x":ge()}],"skew-y":[{"skew-y":ge()}],transform:[{transform:[ye,xe,"","none","gpu","cpu"]}],"transform-origin":[{origin:C()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:Ce()}],"translate-x":[{"translate-x":Ce()}],"translate-y":[{"translate-y":Ce()}],"translate-z":[{"translate-z":Ce()}],"translate-none":["translate-none"],accent:[{accent:V()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:V()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",ye,xe]}],"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":I()}],"scroll-mx":[{"scroll-mx":I()}],"scroll-my":[{"scroll-my":I()}],"scroll-ms":[{"scroll-ms":I()}],"scroll-me":[{"scroll-me":I()}],"scroll-mt":[{"scroll-mt":I()}],"scroll-mr":[{"scroll-mr":I()}],"scroll-mb":[{"scroll-mb":I()}],"scroll-ml":[{"scroll-ml":I()}],"scroll-p":[{"scroll-p":I()}],"scroll-px":[{"scroll-px":I()}],"scroll-py":[{"scroll-py":I()}],"scroll-ps":[{"scroll-ps":I()}],"scroll-pe":[{"scroll-pe":I()}],"scroll-pt":[{"scroll-pt":I()}],"scroll-pr":[{"scroll-pr":I()}],"scroll-pb":[{"scroll-pb":I()}],"scroll-pl":[{"scroll-pl":I()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",ye,xe]}],fill:[{fill:["none",...V()]}],"stroke-w":[{stroke:[Te,cr,mn,Es]}],stroke:[{stroke:["none",...V()]}],"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"]}},Nw=aw(Ew);function be(...e){return Nw(Gd(e))}function Ve(e){return e>=1e6?(e/1e6).toFixed(1).replace(/\.0$/,"")+"M":(e/1e3).toFixed(1).replace(/\.0$/,"")+"K"}function uf(e){return e>=1024*1024?(e/(1024*1024)).toFixed(1).replace(/\.0$/,"")+"M":(e/1024).toFixed(1).replace(/\.0$/,"")+"K"}function Tw(e){return e===null?"pending":e>=200&&e<300?"success":e>=400&&e<500?"client_error":e>=500?"server_error":"pending"}const Aw=ie({model:W().min(1),contextWindow:pe().int().positive().optional(),outputLimit:pe().int().positive().optional(),source:et(["manual","registry"]).optional(),sourceUrl:W().optional(),updatedAt:W().optional()}),To=ie({id:W(),name:W(),apiKey:W(),model:W().optional(),models:Se(W()).min(1),format:et(["anthropic","openai"]).optional(),baseUrl:W().optional(),anthropicBaseUrl:W().optional(),openaiBaseUrl:W().optional(),authHeader:et(["bearer","x-api-key"]).optional().default("bearer"),apiDocsUrl:W().optional(),modelMetadataUrl:W().optional(),modelMetadata:Se(Aw).optional(),source:et(["company","personal"]).optional(),createdAt:W(),updatedAt:W()});async function Iw(e){return Lr(e,To.array(),void 0,t=>`Failed to fetch ${e}: ${t.status}`)}function df(){const e=Ji("/api/providers?includeSecrets=1",Iw,{revalidateOnFocus:!1,revalidateIfStale:!1});return{providers:e.data??[],isLoading:e.isLoading,isError:e.error,mutate:e.mutate}}const zw="2.0.21",Rw={version:zw},Bl=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,Ul=Gd,pa=(e,t)=>n=>{var r;if(t?.variants==null)return Ul(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=Bl(d)||Bl(f);return o[u][h]}),a=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,...a}[m]):{...s,...a}[m]===g})?[...u,f,h]:u},[]);return Ul(e,i,c,n?.class,n?.className)};function Vl(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function ff(...e){return t=>{let n=!1;const r=e.map(o=>{const s=Vl(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():Vl(e[o],null)}}}}function Le(...e){return b.useCallback(ff(...e),e)}function Jn(e){const t=Ow(e),n=b.forwardRef((r,o)=>{const{children:s,...i}=r,a=b.Children.toArray(s),c=a.find(Lw);if(c){const u=c.props.children,d=a.map(f=>f===c?b.Children.count(u)>1?b.Children.only(null):b.isValidElement(u)?u.props.children:null:f);return l.jsx(t,{...i,ref:o,children:b.isValidElement(u)?b.cloneElement(u,void 0,d):null})}return l.jsx(t,{...i,ref:o,children:s})});return n.displayName=`${e}.Slot`,n}var Pw=Jn("Slot");function Ow(e){const t=b.forwardRef((n,r)=>{const{children:o,...s}=n;if(b.isValidElement(o)){const i=Fw(o),a=Dw(s,o.props);return o.type!==b.Fragment&&(a.ref=r?ff(r,i):i),b.cloneElement(o,a)}return b.Children.count(o)>1?b.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var pf=Symbol("radix.slottable");function Mw(e){const t=({children:n})=>l.jsx(l.Fragment,{children:n});return t.displayName=`${e}.Slottable`,t.__radixId=pf,t}function Lw(e){return b.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===pf}function Dw(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]=(...a)=>{const c=s(...a);return o(...a),c}:o&&(n[r]=o):r==="style"?n[r]={...o,...s}:r==="className"&&(n[r]=[o,s].filter(Boolean).join(" "))}return{...e,...n}}function Fw(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 $w=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Ne=$w.reduce((e,t)=>{const n=Jn(`Primitive.${t}`),r=b.forwardRef((o,s)=>{const{asChild:i,...a}=o,c=i?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),l.jsx(c,{...a,ref:s})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{});function Bw(e,t){e&&Mr.flushSync(()=>e.dispatchEvent(t))}var hf=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"}),Uw="VisuallyHidden",mf=b.forwardRef((e,t)=>l.jsx(Ne.span,{...e,ref:t,style:{...hf,...e.style}}));mf.displayName=Uw;var Vw=mf;function Hw(e,t){const n=b.createContext(t),r=s=>{const{children:i,...a}=s,c=b.useMemo(()=>a,Object.values(a));return l.jsx(n.Provider,{value:c,children:i})};r.displayName=e+"Provider";function o(s){const i=b.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 Xt(e,t=[]){let n=[];function r(s,i){const a=b.createContext(i),c=n.length;n=[...n,i];const u=f=>{const{scope:h,children:p,...x}=f,m=h?.[e]?.[c]||a,g=b.useMemo(()=>x,Object.values(x));return l.jsx(m.Provider,{value:g,children:p})};u.displayName=s+"Provider";function d(f,h){const p=h?.[e]?.[c]||a,x=b.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=>b.createContext(i));return function(a){const c=a?.[e]||s;return b.useMemo(()=>({[`__scope${e}`]:{...a,[e]:c}}),[a,c])}};return o.scopeName=e,[r,Ww(o,...t)]}function Ww(...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((a,{useScope:c,scopeName:u})=>{const f=c(s)[`__scope${u}`];return{...a,...f}},{});return b.useMemo(()=>({[`__scope${t.scopeName}`]:i}),[i])}};return n.scopeName=t.scopeName,n}function gf(e){const t=e+"CollectionProvider",[n,r]=Xt(t),[o,s]=n(t,{collectionRef:{current:null},itemMap:new Map}),i=m=>{const{scope:g,children:y}=m,v=at.useRef(null),k=at.useRef(new Map).current;return l.jsx(o,{scope:g,itemMap:k,collectionRef:v,children:y})};i.displayName=t;const a=e+"CollectionSlot",c=Jn(a),u=at.forwardRef((m,g)=>{const{scope:y,children:v}=m,k=s(a,y),S=Le(g,k.collectionRef);return l.jsx(c,{ref:S,children:v})});u.displayName=a;const d=e+"CollectionItemSlot",f="data-radix-collection-item",h=Jn(d),p=at.forwardRef((m,g)=>{const{scope:y,children:v,...k}=m,S=at.useRef(null),C=Le(g,S),j=s(d,y);return at.useEffect(()=>(j.itemMap.set(S,{ref:S,...k}),()=>{j.itemMap.delete(S)})),l.jsx(h,{[f]:"",ref:C,children:v})});p.displayName=d;function x(m){const g=s(e+"CollectionConsumer",m);return at.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 ke(e,t,{checkForDefaultPrevented:n=!0}={}){return function(o){if(e?.(o),n===!1||!o.defaultPrevented)return t?.(o)}}var tt=globalThis?.document?b.useLayoutEffect:()=>{},Zw=qu[" useInsertionEffect ".trim().toString()]||tt;function bn({prop:e,defaultProp:t,onChange:n=()=>{},caller:r}){const[o,s,i]=qw({defaultProp:t,onChange:n}),a=e!==void 0,c=a?e:o;{const d=b.useRef(e!==void 0);b.useEffect(()=>{const f=d.current;f!==a&&console.warn(`${r} is changing from ${f?"controlled":"uncontrolled"} to ${a?"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=a},[a,r])}const u=b.useCallback(d=>{if(a){const f=Kw(d)?d(e):d;f!==e&&i.current?.(f)}else s(d)},[a,e,s,i]);return[c,u]}function qw({defaultProp:e,onChange:t}){const[n,r]=b.useState(e),o=b.useRef(n),s=b.useRef(t);return Zw(()=>{s.current=t},[t]),b.useEffect(()=>{o.current!==n&&(s.current?.(n),o.current=n)},[n,o]),[n,r,s]}function Kw(e){return typeof e=="function"}function Jw(e,t){return b.useReducer((n,r)=>t[n][r]??n,e)}var bt=e=>{const{present:t,children:n}=e,r=Gw(t),o=typeof n=="function"?n({present:r.isPresent}):b.Children.only(n),s=Le(r.ref,Yw(o));return typeof n=="function"||r.isPresent?b.cloneElement(o,{ref:s}):null};bt.displayName="Presence";function Gw(e){const[t,n]=b.useState(),r=b.useRef(null),o=b.useRef(e),s=b.useRef("none"),i=e?"mounted":"unmounted",[a,c]=Jw(i,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return b.useEffect(()=>{const u=Qr(r.current);s.current=a==="mounted"?u:"none"},[a]),tt(()=>{const u=r.current,d=o.current;if(d!==e){const h=s.current,p=Qr(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=Qr(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=Qr(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(a),ref:b.useCallback(u=>{r.current=u?getComputedStyle(u):null,n(u)},[])}}function Qr(e){return e?.animationName||"none"}function Yw(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 Xw=qu[" useId ".trim().toString()]||(()=>{}),Qw=0;function Ot(e){const[t,n]=b.useState(Xw());return tt(()=>{n(r=>r??String(Qw++))},[e]),e||(t?`radix-${t}`:"")}var Go="Collapsible",[ek]=Xt(Go),[tk,ha]=ek(Go),xf=b.forwardRef((e,t)=>{const{__scopeCollapsible:n,open:r,defaultOpen:o,disabled:s,onOpenChange:i,...a}=e,[c,u]=bn({prop:r,defaultProp:o??!1,onChange:i,caller:Go});return l.jsx(tk,{scope:n,disabled:s,contentId:Ot(),open:c,onOpenToggle:b.useCallback(()=>u(d=>!d),[u]),children:l.jsx(Ne.div,{"data-state":ga(c),"data-disabled":s?"":void 0,...a,ref:t})})});xf.displayName=Go;var yf="CollapsibleTrigger",bf=b.forwardRef((e,t)=>{const{__scopeCollapsible:n,...r}=e,o=ha(yf,n);return l.jsx(Ne.button,{type:"button","aria-controls":o.contentId,"aria-expanded":o.open||!1,"data-state":ga(o.open),"data-disabled":o.disabled?"":void 0,disabled:o.disabled,...r,ref:t,onClick:ke(e.onClick,o.onOpenToggle)})});bf.displayName=yf;var ma="CollapsibleContent",vf=b.forwardRef((e,t)=>{const{forceMount:n,...r}=e,o=ha(ma,e.__scopeCollapsible);return l.jsx(bt,{present:n||o.open,children:({present:s})=>l.jsx(nk,{...r,ref:t,present:s})})});vf.displayName=ma;var nk=b.forwardRef((e,t)=>{const{__scopeCollapsible:n,present:r,children:o,...s}=e,i=ha(ma,n),[a,c]=b.useState(r),u=b.useRef(null),d=Le(t,u),f=b.useRef(0),h=f.current,p=b.useRef(0),x=p.current,m=i.open||a,g=b.useRef(m),y=b.useRef(void 0);return b.useEffect(()=>{const v=requestAnimationFrame(()=>g.current=!1);return()=>cancelAnimationFrame(v)},[]),tt(()=>{const v=u.current;if(v){y.current=y.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=y.current.transitionDuration,v.style.animationName=y.current.animationName),c(r)}},[i.open,r]),l.jsx(Ne.div,{"data-state":ga(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 ga(e){return e?"open":"closed"}var rk=xf,ok=b.createContext(void 0);function Yo(e){const t=b.useContext(ok);return e||t||"ltr"}function st(e){const t=b.useRef(e);return b.useEffect(()=>{t.current=e}),b.useMemo(()=>(...n)=>t.current?.(...n),[])}function sk(e,t=globalThis?.document){const n=st(e);b.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 ik="DismissableLayer",gi="dismissableLayer.update",ak="dismissableLayer.pointerDownOutside",lk="dismissableLayer.focusOutside",Hl,wf=b.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),Xo=b.forwardRef((e,t)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:r,onPointerDownOutside:o,onFocusOutside:s,onInteractOutside:i,onDismiss:a,...c}=e,u=b.useContext(wf),[d,f]=b.useState(null),h=d?.ownerDocument??globalThis?.document,[,p]=b.useState({}),x=Le(t,N=>f(N)),m=Array.from(u.layers),[g]=[...u.layersWithOutsidePointerEventsDisabled].slice(-1),y=m.indexOf(g),v=d?m.indexOf(d):-1,k=u.layersWithOutsidePointerEventsDisabled.size>0,S=v>=y,C=dk(N=>{const I=N.target,R=[...u.branches].some(O=>O.contains(I));!S||R||(o?.(N),i?.(N),N.defaultPrevented||a?.())},h),j=fk(N=>{const I=N.target;[...u.branches].some(O=>O.contains(I))||(s?.(N),i?.(N),N.defaultPrevented||a?.())},h);return sk(N=>{v===u.layers.size-1&&(r?.(N),!N.defaultPrevented&&a&&(N.preventDefault(),a()))},h),b.useEffect(()=>{if(d)return n&&(u.layersWithOutsidePointerEventsDisabled.size===0&&(Hl=h.body.style.pointerEvents,h.body.style.pointerEvents="none"),u.layersWithOutsidePointerEventsDisabled.add(d)),u.layers.add(d),Wl(),()=>{n&&u.layersWithOutsidePointerEventsDisabled.size===1&&(h.body.style.pointerEvents=Hl)}},[d,h,n,u]),b.useEffect(()=>()=>{d&&(u.layers.delete(d),u.layersWithOutsidePointerEventsDisabled.delete(d),Wl())},[d,u]),b.useEffect(()=>{const N=()=>p({});return document.addEventListener(gi,N),()=>document.removeEventListener(gi,N)},[]),l.jsx(Ne.div,{...c,ref:x,style:{pointerEvents:k?S?"auto":"none":void 0,...e.style},onFocusCapture:ke(e.onFocusCapture,j.onFocusCapture),onBlurCapture:ke(e.onBlurCapture,j.onBlurCapture),onPointerDownCapture:ke(e.onPointerDownCapture,C.onPointerDownCapture)})});Xo.displayName=ik;var ck="DismissableLayerBranch",uk=b.forwardRef((e,t)=>{const n=b.useContext(wf),r=b.useRef(null),o=Le(t,r);return b.useEffect(()=>{const s=r.current;if(s)return n.branches.add(s),()=>{n.branches.delete(s)}},[n.branches]),l.jsx(Ne.div,{...e,ref:o})});uk.displayName=ck;function dk(e,t=globalThis?.document){const n=st(e),r=b.useRef(!1),o=b.useRef(()=>{});return b.useEffect(()=>{const s=a=>{if(a.target&&!r.current){let c=function(){kf(ak,n,u,{discrete:!0})};const u={originalEvent:a};a.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 fk(e,t=globalThis?.document){const n=st(e),r=b.useRef(!1);return b.useEffect(()=>{const o=s=>{s.target&&!r.current&&kf(lk,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 Wl(){const e=new CustomEvent(gi);document.dispatchEvent(e)}function kf(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?Bw(o,s):o.dispatchEvent(s)}var Ns="focusScope.autoFocusOnMount",Ts="focusScope.autoFocusOnUnmount",Zl={bubbles:!1,cancelable:!0},pk="FocusScope",xa=b.forwardRef((e,t)=>{const{loop:n=!1,trapped:r=!1,onMountAutoFocus:o,onUnmountAutoFocus:s,...i}=e,[a,c]=b.useState(null),u=st(o),d=st(s),f=b.useRef(null),h=Le(t,m=>c(m)),p=b.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;b.useEffect(()=>{if(r){let m=function(k){if(p.paused||!a)return;const S=k.target;a.contains(S)?f.current=S:tn(f.current,{select:!0})},g=function(k){if(p.paused||!a)return;const S=k.relatedTarget;S!==null&&(a.contains(S)||tn(f.current,{select:!0}))},y=function(k){if(document.activeElement===document.body)for(const C of k)C.removedNodes.length>0&&tn(a)};document.addEventListener("focusin",m),document.addEventListener("focusout",g);const v=new MutationObserver(y);return a&&v.observe(a,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",m),document.removeEventListener("focusout",g),v.disconnect()}}},[r,a,p.paused]),b.useEffect(()=>{if(a){Kl.add(p);const m=document.activeElement;if(!a.contains(m)){const y=new CustomEvent(Ns,Zl);a.addEventListener(Ns,u),a.dispatchEvent(y),y.defaultPrevented||(hk(bk(_f(a)),{select:!0}),document.activeElement===m&&tn(a))}return()=>{a.removeEventListener(Ns,u),setTimeout(()=>{const y=new CustomEvent(Ts,Zl);a.addEventListener(Ts,d),a.dispatchEvent(y),y.defaultPrevented||tn(m??document.body,{select:!0}),a.removeEventListener(Ts,d),Kl.remove(p)},0)}}},[a,u,d,p]);const x=b.useCallback(m=>{if(!n&&!r||p.paused)return;const g=m.key==="Tab"&&!m.altKey&&!m.ctrlKey&&!m.metaKey,y=document.activeElement;if(g&&y){const v=m.currentTarget,[k,S]=mk(v);k&&S?!m.shiftKey&&y===S?(m.preventDefault(),n&&tn(k,{select:!0})):m.shiftKey&&y===k&&(m.preventDefault(),n&&tn(S,{select:!0})):y===v&&m.preventDefault()}},[n,r,p.paused]);return l.jsx(Ne.div,{tabIndex:-1,...i,ref:h,onKeyDown:x})});xa.displayName=pk;function hk(e,{select:t=!1}={}){const n=document.activeElement;for(const r of e)if(tn(r,{select:t}),document.activeElement!==n)return}function mk(e){const t=_f(e),n=ql(t,e),r=ql(t.reverse(),e);return[n,r]}function _f(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 ql(e,t){for(const n of e)if(!gk(n,{upTo:t}))return n}function gk(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 xk(e){return e instanceof HTMLInputElement&&"select"in e}function tn(e,{select:t=!1}={}){if(e&&e.focus){const n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&xk(e)&&t&&e.select()}}var Kl=yk();function yk(){let e=[];return{add(t){const n=e[0];t!==n&&n?.pause(),e=Jl(e,t),e.unshift(t)},remove(t){e=Jl(e,t),e[0]?.resume()}}}function Jl(e,t){const n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}function bk(e){return e.filter(t=>t.tagName!=="A")}var vk="Portal",Qo=b.forwardRef((e,t)=>{const{container:n,...r}=e,[o,s]=b.useState(!1);tt(()=>s(!0),[]);const i=n||o&&globalThis?.document?.body;return i?sg.createPortal(l.jsx(Ne.div,{...r,ref:t}),i):null});Qo.displayName=vk;var As=0;function Sf(){b.useEffect(()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??Gl()),document.body.insertAdjacentElement("beforeend",e[1]??Gl()),As++,()=>{As===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(t=>t.remove()),As--}},[])}function Gl(){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 zt=function(){return zt=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},zt.apply(this,arguments)};function Cf(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 wk(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 xo="right-scroll-bar-position",yo="width-before-scroll-bar",kk="with-scroll-bars-hidden",_k="--removed-body-scroll-bar-size";function Is(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}function Sk(e,t){var n=b.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 Ck=typeof window<"u"?b.useLayoutEffect:b.useEffect,Yl=new WeakMap;function jk(e,t){var n=Sk(null,function(r){return e.forEach(function(o){return Is(o,r)})});return Ck(function(){var r=Yl.get(n);if(r){var o=new Set(r),s=new Set(e),i=n.current;o.forEach(function(a){s.has(a)||Is(a,null)}),s.forEach(function(a){o.has(a)||Is(a,i)})}Yl.set(n,e)},[e]),n}function Ek(e){return e}function Nk(e,t){t===void 0&&(t=Ek);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(a){return a!==i})}},assignSyncMedium:function(s){for(r=!0;n.length;){var i=n;n=[],i.forEach(s)}n={push:function(a){return s(a)},filter:function(){return n}}},assignMedium:function(s){r=!0;var i=[];if(n.length){var a=n;n=[],a.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 Tk(e){e===void 0&&(e={});var t=Nk(null);return t.options=zt({async:!0,ssr:!1},e),t}var jf=function(e){var t=e.sideCar,n=Cf(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 b.createElement(r,zt({},n))};jf.isSideCarExport=!0;function Ak(e,t){return e.useMedium(t),jf}var Ef=Tk(),zs=function(){},es=b.forwardRef(function(e,t){var n=b.useRef(null),r=b.useState({onScrollCapture:zs,onWheelCapture:zs,onTouchMoveCapture:zs}),o=r[0],s=r[1],i=e.forwardProps,a=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,y=e.as,v=y===void 0?"div":y,k=e.gapMode,S=Cf(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),C=h,j=jk([n,t]),N=zt(zt({},S),o);return b.createElement(b.Fragment,null,d&&b.createElement(C,{sideCar:Ef,removeScrollBar:u,shards:f,noRelative:p,noIsolation:x,inert:m,setCallbacks:s,allowPinchZoom:!!g,lockRef:n,gapMode:k}),i?b.cloneElement(b.Children.only(a),zt(zt({},N),{ref:j})):b.createElement(v,zt({},N,{className:c,ref:j}),a))});es.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};es.classNames={fullWidth:yo,zeroRight:xo};var Ik=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function zk(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=Ik();return t&&e.setAttribute("nonce",t),e}function Rk(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function Pk(e){var t=document.head||document.getElementsByTagName("head")[0];t.appendChild(e)}var Ok=function(){var e=0,t=null;return{add:function(n){e==0&&(t=zk())&&(Rk(t,n),Pk(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},Mk=function(){var e=Ok();return function(t,n){b.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},Nf=function(){var e=Mk(),t=function(n){var r=n.styles,o=n.dynamic;return e(r,o),null};return t},Lk={left:0,top:0,right:0,gap:0},Rs=function(e){return parseInt(e||"",10)||0},Dk=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[Rs(n),Rs(r),Rs(o)]},Fk=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return Lk;var t=Dk(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])}},$k=Nf(),Bn="data-scroll-locked",Bk=function(e,t,n,r){var o=e.left,s=e.top,i=e.right,a=e.gap;return n===void 0&&(n="margin"),`
|
|
42
|
-
.`.concat(kk,` {
|
|
43
|
-
overflow: hidden `).concat(r,`;
|
|
44
|
-
padding-right: `).concat(a,"px ").concat(r,`;
|
|
45
|
-
}
|
|
46
|
-
body[`).concat(Bn,`] {
|
|
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(a,"px ").concat(r,`;
|
|
56
|
-
`),n==="padding"&&"padding-right: ".concat(a,"px ").concat(r,";")].filter(Boolean).join(""),`
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
.`).concat(xo,` {
|
|
60
|
-
right: `).concat(a,"px ").concat(r,`;
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
.`).concat(yo,` {
|
|
64
|
-
margin-right: `).concat(a,"px ").concat(r,`;
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
.`).concat(xo," .").concat(xo,` {
|
|
68
|
-
right: 0 `).concat(r,`;
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
.`).concat(yo," .").concat(yo,` {
|
|
72
|
-
margin-right: 0 `).concat(r,`;
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
body[`).concat(Bn,`] {
|
|
76
|
-
`).concat(_k,": ").concat(a,`px;
|
|
77
|
-
}
|
|
78
|
-
`)},Xl=function(){var e=parseInt(document.body.getAttribute(Bn)||"0",10);return isFinite(e)?e:0},Uk=function(){b.useEffect(function(){return document.body.setAttribute(Bn,(Xl()+1).toString()),function(){var e=Xl()-1;e<=0?document.body.removeAttribute(Bn):document.body.setAttribute(Bn,e.toString())}},[])},Vk=function(e){var t=e.noRelative,n=e.noImportant,r=e.gapMode,o=r===void 0?"margin":r;Uk();var s=b.useMemo(function(){return Fk(o)},[o]);return b.createElement($k,{styles:Bk(s,!t,o,n?"":"!important")})},xi=!1;if(typeof window<"u")try{var eo=Object.defineProperty({},"passive",{get:function(){return xi=!0,!0}});window.addEventListener("test",eo,eo),window.removeEventListener("test",eo,eo)}catch{xi=!1}var An=xi?{passive:!1}:!1,Hk=function(e){return e.tagName==="TEXTAREA"},Tf=function(e,t){if(!(e instanceof Element))return!1;var n=window.getComputedStyle(e);return n[t]!=="hidden"&&!(n.overflowY===n.overflowX&&!Hk(e)&&n[t]==="visible")},Wk=function(e){return Tf(e,"overflowY")},Zk=function(e){return Tf(e,"overflowX")},Ql=function(e,t){var n=t.ownerDocument,r=t;do{typeof ShadowRoot<"u"&&r instanceof ShadowRoot&&(r=r.host);var o=Af(e,r);if(o){var s=If(e,r),i=s[1],a=s[2];if(i>a)return!0}r=r.parentNode}while(r&&r!==n.body);return!1},qk=function(e){var t=e.scrollTop,n=e.scrollHeight,r=e.clientHeight;return[t,n,r]},Kk=function(e){var t=e.scrollLeft,n=e.scrollWidth,r=e.clientWidth;return[t,n,r]},Af=function(e,t){return e==="v"?Wk(t):Zk(t)},If=function(e,t){return e==="v"?qk(t):Kk(t)},Jk=function(e,t){return e==="h"&&t==="rtl"?-1:1},Gk=function(e,t,n,r,o){var s=Jk(e,window.getComputedStyle(t).direction),i=s*r,a=n.target,c=t.contains(a),u=!1,d=i>0,f=0,h=0;do{if(!a)break;var p=If(e,a),x=p[0],m=p[1],g=p[2],y=m-g-s*x;(x||y)&&Af(e,a)&&(f+=y,h+=x);var v=a.parentNode;a=v&&v.nodeType===Node.DOCUMENT_FRAGMENT_NODE?v.host:v}while(!c&&a!==document.body||c&&(t.contains(a)||t===a));return(d&&Math.abs(f)<1||!d&&Math.abs(h)<1)&&(u=!0),u},to=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},ec=function(e){return[e.deltaX,e.deltaY]},tc=function(e){return e&&"current"in e?e.current:e},Yk=function(e,t){return e[0]===t[0]&&e[1]===t[1]},Xk=function(e){return`
|
|
79
|
-
.block-interactivity-`.concat(e,` {pointer-events: none;}
|
|
80
|
-
.allow-interactivity-`).concat(e,` {pointer-events: all;}
|
|
81
|
-
`)},Qk=0,In=[];function e_(e){var t=b.useRef([]),n=b.useRef([0,0]),r=b.useRef(),o=b.useState(Qk++)[0],s=b.useState(Nf)[0],i=b.useRef(e);b.useEffect(function(){i.current=e},[e]),b.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(o));var m=wk([e.lockRef.current],(e.shards||[]).map(tc),!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 a=b.useCallback(function(m,g){if("touches"in m&&m.touches.length===2||m.type==="wheel"&&m.ctrlKey)return!i.current.allowPinchZoom;var y=to(m),v=n.current,k="deltaX"in m?m.deltaX:v[0]-y[0],S="deltaY"in m?m.deltaY:v[1]-y[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 I=window.getSelection(),R=I&&I.anchorNode,O=R?R===j||R.contains(j):!1;if(O)return!1;var $=Ql(N,j);if(!$)return!0;if($?C=N:(C=N==="v"?"h":"v",$=Ql(N,j)),!$)return!1;if(!r.current&&"changedTouches"in m&&(k||S)&&(r.current=C),!C)return!0;var E=r.current||C;return Gk(E,g,m,E==="h"?k:S)},[]),c=b.useCallback(function(m){var g=m;if(!(!In.length||In[In.length-1]!==s)){var y="deltaY"in g?ec(g):to(g),v=t.current.filter(function(C){return C.name===g.type&&(C.target===g.target||g.target===C.shadowParent)&&Yk(C.delta,y)})[0];if(v&&v.should){g.cancelable&&g.preventDefault();return}if(!v){var k=(i.current.shards||[]).map(tc).filter(Boolean).filter(function(C){return C.contains(g.target)}),S=k.length>0?a(g,k[0]):!i.current.noIsolation;S&&g.cancelable&&g.preventDefault()}}},[]),u=b.useCallback(function(m,g,y,v){var k={name:m,delta:g,target:y,should:v,shadowParent:t_(y)};t.current.push(k),setTimeout(function(){t.current=t.current.filter(function(S){return S!==k})},1)},[]),d=b.useCallback(function(m){n.current=to(m),r.current=void 0},[]),f=b.useCallback(function(m){u(m.type,ec(m),m.target,a(m,e.lockRef.current))},[]),h=b.useCallback(function(m){u(m.type,to(m),m.target,a(m,e.lockRef.current))},[]);b.useEffect(function(){return In.push(s),e.setCallbacks({onScrollCapture:f,onWheelCapture:f,onTouchMoveCapture:h}),document.addEventListener("wheel",c,An),document.addEventListener("touchmove",c,An),document.addEventListener("touchstart",d,An),function(){In=In.filter(function(m){return m!==s}),document.removeEventListener("wheel",c,An),document.removeEventListener("touchmove",c,An),document.removeEventListener("touchstart",d,An)}},[]);var p=e.removeScrollBar,x=e.inert;return b.createElement(b.Fragment,null,x?b.createElement(s,{styles:Xk(o)}):null,p?b.createElement(Vk,{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 n_=Ak(Ef,e_);var ya=b.forwardRef(function(e,t){return b.createElement(es,zt({},e,{ref:t,sideCar:n_}))});ya.classNames=es.classNames;var r_=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},zn=new WeakMap,no=new WeakMap,ro={},Ps=0,zf=function(e){return e&&(e.host||zf(e.parentNode))},o_=function(e,t){return t.map(function(n){if(e.contains(n))return n;var r=zf(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})},s_=function(e,t,n,r){var o=o_(t,Array.isArray(e)?e:[e]);ro[n]||(ro[n]=new WeakMap);var s=ro[n],i=[],a=new Set,c=new Set(o),u=function(f){!f||a.has(f)||(a.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(a.has(h))d(h);else try{var p=h.getAttribute(r),x=p!==null&&p!=="false",m=(zn.get(h)||0)+1,g=(s.get(h)||0)+1;zn.set(h,m),s.set(h,g),i.push(h),m===1&&x&&no.set(h,!0),g===1&&h.setAttribute(n,"true"),x||h.setAttribute(r,"true")}catch(y){console.error("aria-hidden: cannot operate on ",h,y)}})};return d(t),a.clear(),Ps++,function(){i.forEach(function(f){var h=zn.get(f)-1,p=s.get(f)-1;zn.set(f,h),s.set(f,p),h||(no.has(f)||f.removeAttribute(r),no.delete(f)),p||f.removeAttribute(n)}),Ps--,Ps||(zn=new WeakMap,zn=new WeakMap,no=new WeakMap,ro={})}},Rf=function(e,t,n){n===void 0&&(n="data-aria-hidden");var r=Array.from(Array.isArray(e)?e:[e]),o=r_(e);return o?(r.push.apply(r,Array.from(o.querySelectorAll("[aria-live], script"))),s_(r,o,n,"aria-hidden")):function(){return null}},ts="Dialog",[Pf]=Xt(ts),[i_,Tt]=Pf(ts),Of=e=>{const{__scopeDialog:t,children:n,open:r,defaultOpen:o,onOpenChange:s,modal:i=!0}=e,a=b.useRef(null),c=b.useRef(null),[u,d]=bn({prop:r,defaultProp:o??!1,onChange:s,caller:ts});return l.jsx(i_,{scope:t,triggerRef:a,contentRef:c,contentId:Ot(),titleId:Ot(),descriptionId:Ot(),open:u,onOpenChange:d,onOpenToggle:b.useCallback(()=>d(f=>!f),[d]),modal:i,children:n})};Of.displayName=ts;var Mf="DialogTrigger",Lf=b.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=Tt(Mf,n),s=Le(t,o.triggerRef);return l.jsx(Ne.button,{type:"button","aria-haspopup":"dialog","aria-expanded":o.open,"aria-controls":o.contentId,"data-state":wa(o.open),...r,ref:s,onClick:ke(e.onClick,o.onOpenToggle)})});Lf.displayName=Mf;var ba="DialogPortal",[a_,Df]=Pf(ba,{forceMount:void 0}),Ff=e=>{const{__scopeDialog:t,forceMount:n,children:r,container:o}=e,s=Tt(ba,t);return l.jsx(a_,{scope:t,forceMount:n,children:b.Children.map(r,i=>l.jsx(bt,{present:n||s.open,children:l.jsx(Qo,{asChild:!0,container:o,children:i})}))})};Ff.displayName=ba;var Ao="DialogOverlay",$f=b.forwardRef((e,t)=>{const n=Df(Ao,e.__scopeDialog),{forceMount:r=n.forceMount,...o}=e,s=Tt(Ao,e.__scopeDialog);return s.modal?l.jsx(bt,{present:r||s.open,children:l.jsx(c_,{...o,ref:t})}):null});$f.displayName=Ao;var l_=Jn("DialogOverlay.RemoveScroll"),c_=b.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=Tt(Ao,n);return l.jsx(ya,{as:l_,allowPinchZoom:!0,shards:[o.contentRef],children:l.jsx(Ne.div,{"data-state":wa(o.open),...r,ref:t,style:{pointerEvents:"auto",...r.style}})})}),vn="DialogContent",Bf=b.forwardRef((e,t)=>{const n=Df(vn,e.__scopeDialog),{forceMount:r=n.forceMount,...o}=e,s=Tt(vn,e.__scopeDialog);return l.jsx(bt,{present:r||s.open,children:s.modal?l.jsx(u_,{...o,ref:t}):l.jsx(d_,{...o,ref:t})})});Bf.displayName=vn;var u_=b.forwardRef((e,t)=>{const n=Tt(vn,e.__scopeDialog),r=b.useRef(null),o=Le(t,n.contentRef,r);return b.useEffect(()=>{const s=r.current;if(s)return Rf(s)},[]),l.jsx(Uf,{...e,ref:o,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:ke(e.onCloseAutoFocus,s=>{s.preventDefault(),n.triggerRef.current?.focus()}),onPointerDownOutside:ke(e.onPointerDownOutside,s=>{const i=s.detail.originalEvent,a=i.button===0&&i.ctrlKey===!0;(i.button===2||a)&&s.preventDefault()}),onFocusOutside:ke(e.onFocusOutside,s=>s.preventDefault())})}),d_=b.forwardRef((e,t)=>{const n=Tt(vn,e.__scopeDialog),r=b.useRef(!1),o=b.useRef(!1);return l.jsx(Uf,{...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()}})}),Uf=b.forwardRef((e,t)=>{const{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:o,onCloseAutoFocus:s,...i}=e,a=Tt(vn,n),c=b.useRef(null),u=Le(t,c);return Sf(),l.jsxs(l.Fragment,{children:[l.jsx(xa,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:o,onUnmountAutoFocus:s,children:l.jsx(Xo,{role:"dialog",id:a.contentId,"aria-describedby":a.descriptionId,"aria-labelledby":a.titleId,"data-state":wa(a.open),...i,ref:u,onDismiss:()=>a.onOpenChange(!1)})}),l.jsxs(l.Fragment,{children:[l.jsx(p_,{titleId:a.titleId}),l.jsx(m_,{contentRef:c,descriptionId:a.descriptionId})]})]})}),va="DialogTitle",Vf=b.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=Tt(va,n);return l.jsx(Ne.h2,{id:o.titleId,...r,ref:t})});Vf.displayName=va;var Hf="DialogDescription",f_=b.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=Tt(Hf,n);return l.jsx(Ne.p,{id:o.descriptionId,...r,ref:t})});f_.displayName=Hf;var Wf="DialogClose",Zf=b.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=Tt(Wf,n);return l.jsx(Ne.button,{type:"button",...r,ref:t,onClick:ke(e.onClick,()=>o.onOpenChange(!1))})});Zf.displayName=Wf;function wa(e){return e?"open":"closed"}var qf="DialogTitleWarning",[VR,Kf]=Hw(qf,{contentName:vn,titleName:va,docsSlug:"dialog"}),p_=({titleId:e})=>{const t=Kf(qf),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 b.useEffect(()=>{e&&(document.getElementById(e)||console.error(n))},[n,e]),null},h_="DialogDescriptionWarning",m_=({contentRef:e,descriptionId:t})=>{const r=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${Kf(h_).contentName}}.`;return b.useEffect(()=>{const o=e.current?.getAttribute("aria-describedby");t&&o&&(document.getElementById(t)||console.warn(r))},[r,e,t]),null},g_=Of,x_=Lf,y_=Ff,b_=$f,v_=Bf,w_=Vf,k_=Zf;function __(e){const t=b.useRef({value:e,previous:e});return b.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}function S_(e){const[t,n]=b.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,a;if("borderBoxSize"in s){const c=s.borderBoxSize,u=Array.isArray(c)?c[0]:c;i=u.inlineSize,a=u.blockSize}else i=e.offsetWidth,a=e.offsetHeight;n({width:i,height:a})});return r.observe(e,{box:"border-box"}),()=>r.unobserve(e)}else n(void 0)},[e]),t}const C_=["top","right","bottom","left"],sn=Math.min,ht=Math.max,Io=Math.round,oo=Math.floor,Mt=e=>({x:e,y:e}),j_={left:"right",right:"left",bottom:"top",top:"bottom"},E_={start:"end",end:"start"};function yi(e,t,n){return ht(e,sn(t,n))}function qt(e,t){return typeof e=="function"?e(t):e}function Kt(e){return e.split("-")[0]}function nr(e){return e.split("-")[1]}function ka(e){return e==="x"?"y":"x"}function _a(e){return e==="y"?"height":"width"}const N_=new Set(["top","bottom"]);function Pt(e){return N_.has(Kt(e))?"y":"x"}function Sa(e){return ka(Pt(e))}function T_(e,t,n){n===void 0&&(n=!1);const r=nr(e),o=Sa(e),s=_a(o);let i=o==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[s]>t.floating[s]&&(i=zo(i)),[i,zo(i)]}function A_(e){const t=zo(e);return[bi(e),t,bi(t)]}function bi(e){return e.replace(/start|end/g,t=>E_[t])}const nc=["left","right"],rc=["right","left"],I_=["top","bottom"],z_=["bottom","top"];function R_(e,t,n){switch(e){case"top":case"bottom":return n?t?rc:nc:t?nc:rc;case"left":case"right":return t?I_:z_;default:return[]}}function P_(e,t,n,r){const o=nr(e);let s=R_(Kt(e),n==="start",r);return o&&(s=s.map(i=>i+"-"+o),t&&(s=s.concat(s.map(bi)))),s}function zo(e){return e.replace(/left|right|bottom|top/g,t=>j_[t])}function O_(e){return{top:0,right:0,bottom:0,left:0,...e}}function Jf(e){return typeof e!="number"?O_(e):{top:e,right:e,bottom:e,left:e}}function Ro(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 oc(e,t,n){let{reference:r,floating:o}=e;const s=Pt(t),i=Sa(t),a=_a(i),c=Kt(t),u=s==="y",d=r.x+r.width/2-o.width/2,f=r.y+r.height/2-o.height/2,h=r[a]/2-o[a]/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(nr(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 M_(e,t){var n;t===void 0&&(t={});const{x:r,y:o,platform:s,rects:i,elements:a,strategy:c}=e,{boundary:u="clippingAncestors",rootBoundary:d="viewport",elementContext:f="floating",altBoundary:h=!1,padding:p=0}=qt(t,e),x=Jf(p),g=a[h?f==="floating"?"reference":"floating":f],y=Ro(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(a.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(a.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=Ro(s.convertOffsetParentRelativeRectToViewportRelativeRect?await s.convertOffsetParentRelativeRectToViewportRelativeRect({elements:a,rect:v,offsetParent:k,strategy:c}):v);return{top:(y.top-C.top+x.top)/S.y,bottom:(C.bottom-y.bottom+x.bottom)/S.y,left:(y.left-C.left+x.left)/S.x,right:(C.right-y.right+x.right)/S.x}}const L_=async(e,t,n)=>{const{placement:r="bottom",strategy:o="absolute",middleware:s=[],platform:i}=n,a=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}=oc(u,r,c),h=r,p={},x=0;for(let g=0;g<a.length;g++){var m;const{name:y,fn:v}=a[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:M_},elements:{reference:e,floating:t}});d=k??d,f=S??f,p={...p,[y]:{...p[y],...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}=oc(u,h,c)),g=-1)}return{x:d,y:f,placement:h,strategy:o,middlewareData:p}},D_=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:r,placement:o,rects:s,platform:i,elements:a,middlewareData:c}=t,{element:u,padding:d=0}=qt(e,t)||{};if(u==null)return{};const f=Jf(d),h={x:n,y:r},p=Sa(o),x=_a(p),m=await i.getDimensions(u),g=p==="y",y=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=a.floating[k]||s.floating[x]);const I=S/2-C/2,R=N/2-m[x]/2-1,O=sn(f[y],R),$=sn(f[v],R),E=O,L=N-m[x]-$,w=N/2-m[x]/2+I,M=yi(E,w,L),U=!c.arrow&&nr(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}}}),F_=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:a,platform:c,elements:u}=t,{mainAxis:d=!0,crossAxis:f=!0,fallbackPlacements:h,fallbackStrategy:p="bestFit",fallbackAxisSideDirection:x="none",flipAlignment:m=!0,...g}=qt(e,t);if((n=s.arrow)!=null&&n.alignmentOffset)return{};const y=Kt(o),v=Pt(a),k=Kt(a)===a,S=await(c.isRTL==null?void 0:c.isRTL(u.floating)),C=h||(k||!m?[zo(a)]:A_(a)),j=x!=="none";!h&&j&&C.push(...P_(a,m,x,S));const N=[a,...C],I=await c.detectOverflow(t,g),R=[];let O=((r=s.flip)==null?void 0:r.overflows)||[];if(d&&R.push(I[y]),f){const w=T_(o,i,S);R.push(I[w[0]],I[w[1]])}if(O=[...O,{placement:o,overflows:R}],!R.every(w=>w<=0)){var $,E;const w=((($=s.flip)==null?void 0:$.index)||0)+1,M=N[w];if(M&&(!(f==="alignment"?v!==Pt(M):!1)||O.every(V=>Pt(V.placement)===v?V.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,V)=>F.overflows[1]-V.overflows[1])[0])==null?void 0:E.placement;if(!U)switch(p){case"bestFit":{var L;const F=(L=O.filter(V=>{if(j){const J=Pt(V.placement);return J===v||J==="y"}return!0}).map(V=>[V.placement,V.overflows.filter(J=>J>0).reduce((J,z)=>J+z,0)]).sort((V,J)=>V[1]-J[1])[0])==null?void 0:L[0];F&&(U=F);break}case"initialPlacement":U=a;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 ic(e){return C_.some(t=>e[t]>=0)}const $_=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n,platform:r}=t,{strategy:o="referenceHidden",...s}=qt(e,t);switch(o){case"referenceHidden":{const i=await r.detectOverflow(t,{...s,elementContext:"reference"}),a=sc(i,n.reference);return{data:{referenceHiddenOffsets:a,referenceHidden:ic(a)}}}case"escaped":{const i=await r.detectOverflow(t,{...s,altBoundary:!0}),a=sc(i,n.floating);return{data:{escapedOffsets:a,escaped:ic(a)}}}default:return{}}}}},Gf=new Set(["left","top"]);async function B_(e,t){const{placement:n,platform:r,elements:o}=e,s=await(r.isRTL==null?void 0:r.isRTL(o.floating)),i=Kt(n),a=nr(n),c=Pt(n)==="y",u=Gf.has(i)?-1:1,d=s&&c?-1:1,f=qt(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 a&&typeof x=="number"&&(p=a==="end"?x*-1:x),c?{x:p*d,y:h*u}:{x:h*u,y:p*d}}const U_=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:a}=t,c=await B_(t,e);return i===((n=a.offset)==null?void 0:n.placement)&&(r=a.arrow)!=null&&r.alignmentOffset?{}:{x:o+c.x,y:s+c.y,data:{...c,placement:i}}}}},V_=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:a=!1,limiter:c={fn:y=>{let{x:v,y:k}=y;return{x:v,y:k}}},...u}=qt(e,t),d={x:n,y:r},f=await s.detectOverflow(t,u),h=Pt(Kt(o)),p=ka(h);let x=d[p],m=d[h];if(i){const y=p==="y"?"top":"left",v=p==="y"?"bottom":"right",k=x+f[y],S=x-f[v];x=yi(k,x,S)}if(a){const y=h==="y"?"top":"left",v=h==="y"?"bottom":"right",k=m+f[y],S=m-f[v];m=yi(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]:a}}}}}},H_=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:n,y:r,placement:o,rects:s,middlewareData:i}=t,{offset:a=0,mainAxis:c=!0,crossAxis:u=!0}=qt(e,t),d={x:n,y:r},f=Pt(o),h=ka(f);let p=d[h],x=d[f];const m=qt(a,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 y,v;const k=h==="y"?"width":"height",S=Gf.has(Kt(o)),C=s.reference[f]-s.floating[k]+(S&&((y=i.offset)==null?void 0:y[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}}}},W_=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:a}=t,{apply:c=()=>{},...u}=qt(e,t),d=await i.detectOverflow(t,u),f=Kt(o),h=nr(o),p=Pt(o)==="y",{width:x,height:m}=s.floating;let g,y;f==="top"||f==="bottom"?(g=f,y=h===(await(i.isRTL==null?void 0:i.isRTL(a.floating))?"start":"end")?"left":"right"):(y=f,g=h==="end"?"top":"bottom");const v=m-d.top-d.bottom,k=x-d.left-d.right,S=sn(m-d[g],v),C=sn(x-d[y],k),j=!t.middlewareData.shift;let N=S,I=C;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(I=k),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(N=v),j&&!h){const O=ht(d.left,0),$=ht(d.right,0),E=ht(d.top,0),L=ht(d.bottom,0);p?I=x-2*(O!==0||$!==0?O+$:ht(d.left,d.right)):N=m-2*(E!==0||L!==0?E+L:ht(d.top,d.bottom))}await c({...t,availableWidth:I,availableHeight:N});const R=await i.getDimensions(a.floating);return x!==R.width||m!==R.height?{reset:{rects:!0}}:{}}}};function ns(){return typeof window<"u"}function rr(e){return Yf(e)?(e.nodeName||"").toLowerCase():"#document"}function gt(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function $t(e){var t;return(t=(Yf(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function Yf(e){return ns()?e instanceof Node||e instanceof gt(e).Node:!1}function Et(e){return ns()?e instanceof Element||e instanceof gt(e).Element:!1}function Lt(e){return ns()?e instanceof HTMLElement||e instanceof gt(e).HTMLElement:!1}function ac(e){return!ns()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof gt(e).ShadowRoot}const Z_=new Set(["inline","contents"]);function Fr(e){const{overflow:t,overflowX:n,overflowY:r,display:o}=Nt(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&!Z_.has(o)}const q_=new Set(["table","td","th"]);function K_(e){return q_.has(rr(e))}const J_=[":popover-open",":modal"];function rs(e){return J_.some(t=>{try{return e.matches(t)}catch{return!1}})}const G_=["transform","translate","scale","rotate","perspective"],Y_=["transform","translate","scale","rotate","perspective","filter"],X_=["paint","layout","strict","content"];function Ca(e){const t=ja(),n=Et(e)?Nt(e):e;return G_.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)||Y_.some(r=>(n.willChange||"").includes(r))||X_.some(r=>(n.contain||"").includes(r))}function Q_(e){let t=an(e);for(;Lt(t)&&!Gn(t);){if(Ca(t))return t;if(rs(t))return null;t=an(t)}return null}function ja(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const eS=new Set(["html","body","#document"]);function Gn(e){return eS.has(rr(e))}function Nt(e){return gt(e).getComputedStyle(e)}function os(e){return Et(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function an(e){if(rr(e)==="html")return e;const t=e.assignedSlot||e.parentNode||ac(e)&&e.host||$t(e);return ac(t)?t.host:t}function Xf(e){const t=an(e);return Gn(t)?e.ownerDocument?e.ownerDocument.body:e.body:Lt(t)&&Fr(t)?t:Xf(t)}function Ar(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);const o=Xf(e),s=o===((r=e.ownerDocument)==null?void 0:r.body),i=gt(o);if(s){const a=vi(i);return t.concat(i,i.visualViewport||[],Fr(o)?o:[],a&&n?Ar(a):[])}return t.concat(o,Ar(o,[],n))}function vi(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function Qf(e){const t=Nt(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const o=Lt(e),s=o?e.offsetWidth:n,i=o?e.offsetHeight:r,a=Io(n)!==s||Io(r)!==i;return a&&(n=s,r=i),{width:n,height:r,$:a}}function Ea(e){return Et(e)?e:e.contextElement}function Un(e){const t=Ea(e);if(!Lt(t))return Mt(1);const n=t.getBoundingClientRect(),{width:r,height:o,$:s}=Qf(t);let i=(s?Io(n.width):n.width)/r,a=(s?Io(n.height):n.height)/o;return(!i||!Number.isFinite(i))&&(i=1),(!a||!Number.isFinite(a))&&(a=1),{x:i,y:a}}const tS=Mt(0);function ep(e){const t=gt(e);return!ja()||!t.visualViewport?tS:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function nS(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==gt(e)?!1:t}function wn(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const o=e.getBoundingClientRect(),s=Ea(e);let i=Mt(1);t&&(r?Et(r)&&(i=Un(r)):i=Un(e));const a=nS(s,n,r)?ep(s):Mt(0);let c=(o.left+a.x)/i.x,u=(o.top+a.y)/i.y,d=o.width/i.x,f=o.height/i.y;if(s){const h=gt(s),p=r&&Et(r)?gt(r):r;let x=h,m=vi(x);for(;m&&r&&p!==x;){const g=Un(m),y=m.getBoundingClientRect(),v=Nt(m),k=y.left+(m.clientLeft+parseFloat(v.paddingLeft))*g.x,S=y.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=gt(m),m=vi(x)}}return Ro({width:d,height:f,x:c,y:u})}function ss(e,t){const n=os(e).scrollLeft;return t?t.left+n:wn($t(e)).left+n}function tp(e,t){const n=e.getBoundingClientRect(),r=n.left+t.scrollLeft-ss(e,n),o=n.top+t.scrollTop;return{x:r,y:o}}function rS(e){let{elements:t,rect:n,offsetParent:r,strategy:o}=e;const s=o==="fixed",i=$t(r),a=t?rs(t.floating):!1;if(r===i||a&&s)return n;let c={scrollLeft:0,scrollTop:0},u=Mt(1);const d=Mt(0),f=Lt(r);if((f||!f&&!s)&&((rr(r)!=="body"||Fr(i))&&(c=os(r)),Lt(r))){const p=wn(r);u=Un(r),d.x=p.x+r.clientLeft,d.y=p.y+r.clientTop}const h=i&&!f&&!s?tp(i,c):Mt(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 oS(e){return Array.from(e.getClientRects())}function sS(e){const t=$t(e),n=os(e),r=e.ownerDocument.body,o=ht(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),s=ht(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let i=-n.scrollLeft+ss(e);const a=-n.scrollTop;return Nt(r).direction==="rtl"&&(i+=ht(t.clientWidth,r.clientWidth)-o),{width:o,height:s,x:i,y:a}}const lc=25;function iS(e,t){const n=gt(e),r=$t(e),o=n.visualViewport;let s=r.clientWidth,i=r.clientHeight,a=0,c=0;if(o){s=o.width,i=o.height;const d=ja();(!d||d&&t==="fixed")&&(a=o.offsetLeft,c=o.offsetTop)}const u=ss(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<=lc&&(s-=x)}else u<=lc&&(s+=u);return{width:s,height:i,x:a,y:c}}const aS=new Set(["absolute","fixed"]);function lS(e,t){const n=wn(e,!0,t==="fixed"),r=n.top+e.clientTop,o=n.left+e.clientLeft,s=Lt(e)?Un(e):Mt(1),i=e.clientWidth*s.x,a=e.clientHeight*s.y,c=o*s.x,u=r*s.y;return{width:i,height:a,x:c,y:u}}function cc(e,t,n){let r;if(t==="viewport")r=iS(e,n);else if(t==="document")r=sS($t(e));else if(Et(t))r=lS(t,n);else{const o=ep(e);r={x:t.x-o.x,y:t.y-o.y,width:t.width,height:t.height}}return Ro(r)}function np(e,t){const n=an(e);return n===t||!Et(n)||Gn(n)?!1:Nt(n).position==="fixed"||np(n,t)}function cS(e,t){const n=t.get(e);if(n)return n;let r=Ar(e,[],!1).filter(a=>Et(a)&&rr(a)!=="body"),o=null;const s=Nt(e).position==="fixed";let i=s?an(e):e;for(;Et(i)&&!Gn(i);){const a=Nt(i),c=Ca(i);!c&&a.position==="fixed"&&(o=null),(s?!c&&!o:!c&&a.position==="static"&&!!o&&aS.has(o.position)||Fr(i)&&!c&&np(e,i))?r=r.filter(d=>d!==i):o=a,i=an(i)}return t.set(e,r),r}function uS(e){let{element:t,boundary:n,rootBoundary:r,strategy:o}=e;const i=[...n==="clippingAncestors"?rs(t)?[]:cS(t,this._c):[].concat(n),r],a=i[0],c=i.reduce((u,d)=>{const f=cc(t,d,o);return u.top=ht(f.top,u.top),u.right=sn(f.right,u.right),u.bottom=sn(f.bottom,u.bottom),u.left=ht(f.left,u.left),u},cc(t,a,o));return{width:c.right-c.left,height:c.bottom-c.top,x:c.left,y:c.top}}function dS(e){const{width:t,height:n}=Qf(e);return{width:t,height:n}}function fS(e,t,n){const r=Lt(t),o=$t(t),s=n==="fixed",i=wn(e,!0,s,t);let a={scrollLeft:0,scrollTop:0};const c=Mt(0);function u(){c.x=ss(o)}if(r||!r&&!s)if((rr(t)!=="body"||Fr(o))&&(a=os(t)),r){const p=wn(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?tp(o,a):Mt(0),f=i.left+a.scrollLeft-c.x-d.x,h=i.top+a.scrollTop-c.y-d.y;return{x:f,y:h,width:i.width,height:i.height}}function Os(e){return Nt(e).position==="static"}function uc(e,t){if(!Lt(e)||Nt(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return $t(e)===n&&(n=n.ownerDocument.body),n}function rp(e,t){const n=gt(e);if(rs(e))return n;if(!Lt(e)){let o=an(e);for(;o&&!Gn(o);){if(Et(o)&&!Os(o))return o;o=an(o)}return n}let r=uc(e,t);for(;r&&K_(r)&&Os(r);)r=uc(r,t);return r&&Gn(r)&&Os(r)&&!Ca(r)?n:r||Q_(e)||n}const pS=async function(e){const t=this.getOffsetParent||rp,n=this.getDimensions,r=await n(e.floating);return{reference:fS(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function hS(e){return Nt(e).direction==="rtl"}const mS={convertOffsetParentRelativeRectToViewportRelativeRect:rS,getDocumentElement:$t,getClippingRect:uS,getOffsetParent:rp,getElementRects:pS,getClientRects:oS,getDimensions:dS,getScale:Un,isElement:Et,isRTL:hS};function op(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function gS(e,t){let n=null,r;const o=$t(e);function s(){var a;clearTimeout(r),(a=n)==null||a.disconnect(),n=null}function i(a,c){a===void 0&&(a=!1),c===void 0&&(c=1),s();const u=e.getBoundingClientRect(),{left:d,top:f,width:h,height:p}=u;if(a||t(),!h||!p)return;const x=oo(f),m=oo(o.clientWidth-(d+h)),g=oo(o.clientHeight-(f+p)),y=oo(d),k={rootMargin:-x+"px "+-m+"px "+-g+"px "+-y+"px",threshold:ht(0,sn(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&&!op(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 xS(e,t,n,r){r===void 0&&(r={});const{ancestorScroll:o=!0,ancestorResize:s=!0,elementResize:i=typeof ResizeObserver=="function",layoutShift:a=typeof IntersectionObserver=="function",animationFrame:c=!1}=r,u=Ea(e),d=o||s?[...u?Ar(u):[],...Ar(t)]:[];d.forEach(y=>{o&&y.addEventListener("scroll",n,{passive:!0}),s&&y.addEventListener("resize",n)});const f=u&&a?gS(u,n):null;let h=-1,p=null;i&&(p=new ResizeObserver(y=>{let[v]=y;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?wn(e):null;c&&g();function g(){const y=wn(e);m&&!op(m,y)&&n(),m=y,x=requestAnimationFrame(g)}return n(),()=>{var y;d.forEach(v=>{o&&v.removeEventListener("scroll",n),s&&v.removeEventListener("resize",n)}),f?.(),(y=p)==null||y.disconnect(),p=null,c&&cancelAnimationFrame(x)}}const yS=U_,bS=V_,vS=F_,wS=W_,kS=$_,dc=D_,_S=H_,SS=(e,t,n)=>{const r=new Map,o={platform:mS,...n},s={...o.platform,_c:r};return L_(e,t,{...o,platform:s})};var CS=typeof document<"u",jS=function(){},bo=CS?b.useLayoutEffect:jS;function Po(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(!Po(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)&&!Po(e[s],t[s]))return!1}return!0}return e!==e&&t!==t}function sp(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function fc(e,t){const n=sp(e);return Math.round(t*n)/n}function Ms(e){const t=b.useRef(e);return bo(()=>{t.current=e}),t}function ES(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:r=[],platform:o,elements:{reference:s,floating:i}={},transform:a=!0,whileElementsMounted:c,open:u}=e,[d,f]=b.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[h,p]=b.useState(r);Po(h,r)||p(r);const[x,m]=b.useState(null),[g,y]=b.useState(null),v=b.useCallback(V=>{V!==j.current&&(j.current=V,m(V))},[]),k=b.useCallback(V=>{V!==N.current&&(N.current=V,y(V))},[]),S=s||x,C=i||g,j=b.useRef(null),N=b.useRef(null),I=b.useRef(d),R=c!=null,O=Ms(c),$=Ms(o),E=Ms(u),L=b.useCallback(()=>{if(!j.current||!N.current)return;const V={placement:t,strategy:n,middleware:h};$.current&&(V.platform=$.current),SS(j.current,N.current,V).then(J=>{const z={...J,isPositioned:E.current!==!1};w.current&&!Po(I.current,z)&&(I.current=z,Mr.flushSync(()=>{f(z)}))})},[h,t,n,$,E]);bo(()=>{u===!1&&I.current.isPositioned&&(I.current.isPositioned=!1,f(V=>({...V,isPositioned:!1})))},[u]);const w=b.useRef(!1);bo(()=>(w.current=!0,()=>{w.current=!1}),[]),bo(()=>{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,R]);const M=b.useMemo(()=>({reference:j,floating:N,setReference:v,setFloating:k}),[v,k]),U=b.useMemo(()=>({reference:S,floating:C}),[S,C]),F=b.useMemo(()=>{const V={position:n,left:0,top:0};if(!U.floating)return V;const J=fc(U.floating,d.x),z=fc(U.floating,d.y);return a?{...V,transform:"translate("+J+"px, "+z+"px)",...sp(U.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:J,top:z}},[n,a,U.floating,d.x,d.y]);return b.useMemo(()=>({...d,update:L,refs:M,elements:U,floatingStyles:F}),[d,L,M,U,F])}const NS=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?dc({element:r.current,padding:o}).fn(n):{}:r?dc({element:r,padding:o}).fn(n):{}}}},TS=(e,t)=>({...yS(e),options:[e,t]}),AS=(e,t)=>({...bS(e),options:[e,t]}),IS=(e,t)=>({..._S(e),options:[e,t]}),zS=(e,t)=>({...vS(e),options:[e,t]}),RS=(e,t)=>({...wS(e),options:[e,t]}),PS=(e,t)=>({...kS(e),options:[e,t]}),OS=(e,t)=>({...NS(e),options:[e,t]});var MS="Arrow",ip=b.forwardRef((e,t)=>{const{children:n,width:r=10,height:o=5,...s}=e;return l.jsx(Ne.svg,{...s,ref:t,width:r,height:o,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?n:l.jsx("polygon",{points:"0,0 30,0 15,10"})})});ip.displayName=MS;var LS=ip,Na="Popper",[ap,is]=Xt(Na),[DS,lp]=ap(Na),cp=e=>{const{__scopePopper:t,children:n}=e,[r,o]=b.useState(null);return l.jsx(DS,{scope:t,anchor:r,onAnchorChange:o,children:n})};cp.displayName=Na;var up="PopperAnchor",dp=b.forwardRef((e,t)=>{const{__scopePopper:n,virtualRef:r,...o}=e,s=lp(up,n),i=b.useRef(null),a=Le(t,i),c=b.useRef(null);return b.useEffect(()=>{const u=c.current;c.current=r?.current||i.current,u!==c.current&&s.onAnchorChange(c.current)}),r?null:l.jsx(Ne.div,{...o,ref:a})});dp.displayName=up;var Ta="PopperContent",[FS,$S]=ap(Ta),fp=b.forwardRef((e,t)=>{const{__scopePopper:n,side:r="bottom",sideOffset:o=0,align:s="center",alignOffset:i=0,arrowPadding:a=0,avoidCollisions:c=!0,collisionBoundary:u=[],collisionPadding:d=0,sticky:f="partial",hideWhenDetached:h=!1,updatePositionStrategy:p="optimized",onPlaced:x,...m}=e,g=lp(Ta,n),[y,v]=b.useState(null),k=Le(t,ae=>v(ae)),[S,C]=b.useState(null),j=S_(S),N=j?.width??0,I=j?.height??0,R=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(US),altBoundary:E},{refs:w,floatingStyles:M,placement:U,isPositioned:F,middlewareData:V}=ES({strategy:"fixed",placement:R,whileElementsMounted:(...ae)=>xS(...ae,{animationFrame:p==="always"}),elements:{reference:g.anchor},middleware:[TS({mainAxis:o+I,alignmentAxis:i}),c&&AS({mainAxis:!0,crossAxis:!1,limiter:f==="partial"?IS():void 0,...L}),c&&zS({...L}),RS({...L,apply:({elements:ae,rects:ue,availableWidth:he,availableHeight:fe})=>{const{width:ge,height:Ce}=ue.reference,ze=ae.floating.style;ze.setProperty("--radix-popper-available-width",`${he}px`),ze.setProperty("--radix-popper-available-height",`${fe}px`),ze.setProperty("--radix-popper-anchor-width",`${ge}px`),ze.setProperty("--radix-popper-anchor-height",`${Ce}px`)}}),S&&OS({element:S,padding:a}),VS({arrowWidth:N,arrowHeight:I}),h&&PS({strategy:"referenceHidden",...L})]}),[J,z]=mp(U),H=st(x);tt(()=>{F&&H?.()},[F,H]);const Z=V.arrow?.x,P=V.arrow?.y,ee=V.arrow?.centerOffset!==0,[Q,de]=b.useState();return tt(()=>{y&&de(window.getComputedStyle(y).zIndex)},[y]),l.jsx("div",{ref:w.setFloating,"data-radix-popper-content-wrapper":"",style:{...M,transform:F?M.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:Q,"--radix-popper-transform-origin":[V.transformOrigin?.x,V.transformOrigin?.y].join(" "),...V.hide?.referenceHidden&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:l.jsx(FS,{scope:n,placedSide:J,onArrowChange:C,arrowX:Z,arrowY:P,shouldHideArrow:ee,children:l.jsx(Ne.div,{"data-side":J,"data-align":z,...m,ref:k,style:{...m.style,animation:F?void 0:"none"}})})})});fp.displayName=Ta;var pp="PopperArrow",BS={top:"bottom",right:"left",bottom:"top",left:"right"},hp=b.forwardRef(function(t,n){const{__scopePopper:r,...o}=t,s=$S(pp,r),i=BS[s.placedSide];return l.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:l.jsx(LS,{...o,ref:n,style:{...o.style,display:"block"}})})});hp.displayName=pp;function US(e){return e!==null}var VS=e=>({name:"transformOrigin",options:e,fn(t){const{placement:n,rects:r,middlewareData:o}=t,i=o.arrow?.centerOffset!==0,a=i?0:e.arrowWidth,c=i?0:e.arrowHeight,[u,d]=mp(n),f={start:"0%",center:"50%",end:"100%"}[d],h=(o.arrow?.x??0)+a/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 mp(e){const[t,n="center"]=e.split("-");return[t,n]}var gp=cp,xp=dp,yp=fp,bp=hp,Ls="rovingFocusGroup.onEntryFocus",HS={bubbles:!1,cancelable:!0},$r="RovingFocusGroup",[wi,vp,WS]=gf($r),[ZS,wp]=Xt($r,[WS]),[qS,KS]=ZS($r),kp=b.forwardRef((e,t)=>l.jsx(wi.Provider,{scope:e.__scopeRovingFocusGroup,children:l.jsx(wi.Slot,{scope:e.__scopeRovingFocusGroup,children:l.jsx(JS,{...e,ref:t})})}));kp.displayName=$r;var JS=b.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,orientation:r,loop:o=!1,dir:s,currentTabStopId:i,defaultCurrentTabStopId:a,onCurrentTabStopIdChange:c,onEntryFocus:u,preventScrollOnEntryFocus:d=!1,...f}=e,h=b.useRef(null),p=Le(t,h),x=Yo(s),[m,g]=bn({prop:i,defaultProp:a??null,onChange:c,caller:$r}),[y,v]=b.useState(!1),k=st(u),S=vp(n),C=b.useRef(!1),[j,N]=b.useState(0);return b.useEffect(()=>{const I=h.current;if(I)return I.addEventListener(Ls,k),()=>I.removeEventListener(Ls,k)},[k]),l.jsx(qS,{scope:n,orientation:r,dir:x,loop:o,currentTabStopId:m,onItemFocus:b.useCallback(I=>g(I),[g]),onItemShiftTab:b.useCallback(()=>v(!0),[]),onFocusableItemAdd:b.useCallback(()=>N(I=>I+1),[]),onFocusableItemRemove:b.useCallback(()=>N(I=>I-1),[]),children:l.jsx(Ne.div,{tabIndex:y||j===0?-1:0,"data-orientation":r,...f,ref:p,style:{outline:"none",...e.style},onMouseDown:ke(e.onMouseDown,()=>{C.current=!0}),onFocus:ke(e.onFocus,I=>{const R=!C.current;if(I.target===I.currentTarget&&R&&!y){const O=new CustomEvent(Ls,HS);if(I.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);Cp(M,d)}}C.current=!1}),onBlur:ke(e.onBlur,()=>v(!1))})})}),_p="RovingFocusGroupItem",Sp=b.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,focusable:r=!0,active:o=!1,tabStopId:s,children:i,...a}=e,c=Ot(),u=s||c,d=KS(_p,n),f=d.currentTabStopId===u,h=vp(n),{onFocusableItemAdd:p,onFocusableItemRemove:x,currentTabStopId:m}=d;return b.useEffect(()=>{if(r)return p(),()=>x()},[r,p,x]),l.jsx(wi.ItemSlot,{scope:n,id:u,focusable:r,active:o,children:l.jsx(Ne.span,{tabIndex:f?0:-1,"data-orientation":d.orientation,...a,ref:t,onMouseDown:ke(e.onMouseDown,g=>{r?d.onItemFocus(u):g.preventDefault()}),onFocus:ke(e.onFocus,()=>d.onItemFocus(u)),onKeyDown:ke(e.onKeyDown,g=>{if(g.key==="Tab"&&g.shiftKey){d.onItemShiftTab();return}if(g.target!==g.currentTarget)return;const y=XS(g,d.orientation,d.dir);if(y!==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(y==="last")k.reverse();else if(y==="prev"||y==="next"){y==="prev"&&k.reverse();const S=k.indexOf(g.currentTarget);k=d.loop?QS(k,S+1):k.slice(S+1)}setTimeout(()=>Cp(k))}}),children:typeof i=="function"?i({isCurrentTabStop:f,hasTabStop:m!=null}):i})})});Sp.displayName=_p;var GS={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function YS(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function XS(e,t,n){const r=YS(e.key,n);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(r))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(r)))return GS[r]}function Cp(e,t=!1){const n=document.activeElement;for(const r of e)if(r===n||(r.focus({preventScroll:t}),document.activeElement!==n))return}function QS(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var eC=kp,tC=Sp;function ki(e,[t,n]){return Math.min(n,Math.max(t,e))}function nC(e,t){return b.useReducer((n,r)=>t[n][r]??n,e)}var Aa="ScrollArea",[jp]=Xt(Aa),[rC,vt]=jp(Aa),Ep=b.forwardRef((e,t)=>{const{__scopeScrollArea:n,type:r="hover",dir:o,scrollHideDelay:s=600,...i}=e,[a,c]=b.useState(null),[u,d]=b.useState(null),[f,h]=b.useState(null),[p,x]=b.useState(null),[m,g]=b.useState(null),[y,v]=b.useState(0),[k,S]=b.useState(0),[C,j]=b.useState(!1),[N,I]=b.useState(!1),R=Le(t,$=>c($)),O=Yo(o);return l.jsx(rC,{scope:n,type:r,dir:O,scrollHideDelay:s,scrollArea:a,viewport:u,onViewportChange:d,content:f,onContentChange:h,scrollbarX:p,onScrollbarXChange:x,scrollbarXEnabled:C,onScrollbarXEnabledChange:j,scrollbarY:m,onScrollbarYChange:g,scrollbarYEnabled:N,onScrollbarYEnabledChange:I,onCornerWidthChange:v,onCornerHeightChange:S,children:l.jsx(Ne.div,{dir:O,...i,ref:R,style:{position:"relative","--radix-scroll-area-corner-width":y+"px","--radix-scroll-area-corner-height":k+"px",...e.style}})})});Ep.displayName=Aa;var Np="ScrollAreaViewport",Tp=b.forwardRef((e,t)=>{const{__scopeScrollArea:n,children:r,nonce:o,...s}=e,i=vt(Np,n),a=b.useRef(null),c=Le(t,a,i.onViewportChange);return l.jsxs(l.Fragment,{children:[l.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}),l.jsx(Ne.div,{"data-radix-scroll-area-viewport":"",...s,ref:c,style:{overflowX:i.scrollbarXEnabled?"scroll":"hidden",overflowY:i.scrollbarYEnabled?"scroll":"hidden",...e.style},children:l.jsx("div",{ref:i.onContentChange,style:{minWidth:"100%",display:"table"},children:r})})]})});Tp.displayName=Np;var Bt="ScrollAreaScrollbar",Ap=b.forwardRef((e,t)=>{const{forceMount:n,...r}=e,o=vt(Bt,e.__scopeScrollArea),{onScrollbarXEnabledChange:s,onScrollbarYEnabledChange:i}=o,a=e.orientation==="horizontal";return b.useEffect(()=>(a?s(!0):i(!0),()=>{a?s(!1):i(!1)}),[a,s,i]),o.type==="hover"?l.jsx(oC,{...r,ref:t,forceMount:n}):o.type==="scroll"?l.jsx(sC,{...r,ref:t,forceMount:n}):o.type==="auto"?l.jsx(Ip,{...r,ref:t,forceMount:n}):o.type==="always"?l.jsx(Ia,{...r,ref:t}):null});Ap.displayName=Bt;var oC=b.forwardRef((e,t)=>{const{forceMount:n,...r}=e,o=vt(Bt,e.__scopeScrollArea),[s,i]=b.useState(!1);return b.useEffect(()=>{const a=o.scrollArea;let c=0;if(a){const u=()=>{window.clearTimeout(c),i(!0)},d=()=>{c=window.setTimeout(()=>i(!1),o.scrollHideDelay)};return a.addEventListener("pointerenter",u),a.addEventListener("pointerleave",d),()=>{window.clearTimeout(c),a.removeEventListener("pointerenter",u),a.removeEventListener("pointerleave",d)}}},[o.scrollArea,o.scrollHideDelay]),l.jsx(bt,{present:n||s,children:l.jsx(Ip,{"data-state":s?"visible":"hidden",...r,ref:t})})}),sC=b.forwardRef((e,t)=>{const{forceMount:n,...r}=e,o=vt(Bt,e.__scopeScrollArea),s=e.orientation==="horizontal",i=ls(()=>c("SCROLL_END"),100),[a,c]=nC("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 b.useEffect(()=>{if(a==="idle"){const u=window.setTimeout(()=>c("HIDE"),o.scrollHideDelay);return()=>window.clearTimeout(u)}},[a,o.scrollHideDelay,c]),b.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]),l.jsx(bt,{present:n||a!=="hidden",children:l.jsx(Ia,{"data-state":a==="hidden"?"hidden":"visible",...r,ref:t,onPointerEnter:ke(e.onPointerEnter,()=>c("POINTER_ENTER")),onPointerLeave:ke(e.onPointerLeave,()=>c("POINTER_LEAVE"))})})}),Ip=b.forwardRef((e,t)=>{const n=vt(Bt,e.__scopeScrollArea),{forceMount:r,...o}=e,[s,i]=b.useState(!1),a=e.orientation==="horizontal",c=ls(()=>{if(n.viewport){const u=n.viewport.offsetWidth<n.viewport.scrollWidth,d=n.viewport.offsetHeight<n.viewport.scrollHeight;i(a?u:d)}},10);return Yn(n.viewport,c),Yn(n.content,c),l.jsx(bt,{present:r||s,children:l.jsx(Ia,{"data-state":s?"visible":"hidden",...o,ref:t})})}),Ia=b.forwardRef((e,t)=>{const{orientation:n="vertical",...r}=e,o=vt(Bt,e.__scopeScrollArea),s=b.useRef(null),i=b.useRef(0),[a,c]=b.useState({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),u=Mp(a.viewport,a.content),d={...r,sizes:a,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 dC(h,i.current,a,p)}return n==="horizontal"?l.jsx(iC,{...d,ref:t,onThumbPositionChange:()=>{if(o.viewport&&s.current){const h=o.viewport.scrollLeft,p=pc(h,a,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"?l.jsx(aC,{...d,ref:t,onThumbPositionChange:()=>{if(o.viewport&&s.current){const h=o.viewport.scrollTop,p=pc(h,a);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}),iC=b.forwardRef((e,t)=>{const{sizes:n,onSizesChange:r,...o}=e,s=vt(Bt,e.__scopeScrollArea),[i,a]=b.useState(),c=b.useRef(null),u=Le(t,c,s.onScrollbarXChange);return b.useEffect(()=>{c.current&&a(getComputedStyle(c.current))},[c]),l.jsx(Rp,{"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":as(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),Dp(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:Mo(i.paddingLeft),paddingEnd:Mo(i.paddingRight)}})}})}),aC=b.forwardRef((e,t)=>{const{sizes:n,onSizesChange:r,...o}=e,s=vt(Bt,e.__scopeScrollArea),[i,a]=b.useState(),c=b.useRef(null),u=Le(t,c,s.onScrollbarYChange);return b.useEffect(()=>{c.current&&a(getComputedStyle(c.current))},[c]),l.jsx(Rp,{"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":as(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),Dp(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:Mo(i.paddingTop),paddingEnd:Mo(i.paddingBottom)}})}})}),[lC,zp]=jp(Bt),Rp=b.forwardRef((e,t)=>{const{__scopeScrollArea:n,sizes:r,hasThumb:o,onThumbChange:s,onThumbPointerUp:i,onThumbPointerDown:a,onThumbPositionChange:c,onDragScroll:u,onWheelScroll:d,onResize:f,...h}=e,p=vt(Bt,n),[x,m]=b.useState(null),g=Le(t,R=>m(R)),y=b.useRef(null),v=b.useRef(""),k=p.viewport,S=r.content-r.viewport,C=st(d),j=st(c),N=ls(f,10);function I(R){if(y.current){const O=R.clientX-y.current.left,$=R.clientY-y.current.top;u({x:O,y:$})}}return b.useEffect(()=>{const R=O=>{const $=O.target;x?.contains($)&&C(O,S)};return document.addEventListener("wheel",R,{passive:!1}),()=>document.removeEventListener("wheel",R,{passive:!1})},[k,x,S,C]),b.useEffect(j,[r,j]),Yn(x,N),Yn(p.content,N),l.jsx(lC,{scope:n,scrollbar:x,hasThumb:o,onThumbChange:st(s),onThumbPointerUp:st(i),onThumbPositionChange:j,onThumbPointerDown:st(a),children:l.jsx(Ne.div,{...h,ref:g,style:{position:"absolute",...h.style},onPointerDown:ke(e.onPointerDown,R=>{R.button===0&&(R.target.setPointerCapture(R.pointerId),y.current=x.getBoundingClientRect(),v.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect="none",p.viewport&&(p.viewport.style.scrollBehavior="auto"),I(R))}),onPointerMove:ke(e.onPointerMove,I),onPointerUp:ke(e.onPointerUp,R=>{const O=R.target;O.hasPointerCapture(R.pointerId)&&O.releasePointerCapture(R.pointerId),document.body.style.webkitUserSelect=v.current,p.viewport&&(p.viewport.style.scrollBehavior=""),y.current=null})})})}),Oo="ScrollAreaThumb",Pp=b.forwardRef((e,t)=>{const{forceMount:n,...r}=e,o=zp(Oo,e.__scopeScrollArea);return l.jsx(bt,{present:n||o.hasThumb,children:l.jsx(cC,{ref:t,...r})})}),cC=b.forwardRef((e,t)=>{const{__scopeScrollArea:n,style:r,...o}=e,s=vt(Oo,n),i=zp(Oo,n),{onThumbPositionChange:a}=i,c=Le(t,f=>i.onThumbChange(f)),u=b.useRef(void 0),d=ls(()=>{u.current&&(u.current(),u.current=void 0)},100);return b.useEffect(()=>{const f=s.viewport;if(f){const h=()=>{if(d(),!u.current){const p=fC(f,a);u.current=p,a()}};return a(),f.addEventListener("scroll",h),()=>f.removeEventListener("scroll",h)}},[s.viewport,d,a]),l.jsx(Ne.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:ke(e.onPointerDownCapture,f=>{const p=f.target.getBoundingClientRect(),x=f.clientX-p.left,m=f.clientY-p.top;i.onThumbPointerDown({x,y:m})}),onPointerUp:ke(e.onPointerUp,i.onThumbPointerUp)})});Pp.displayName=Oo;var za="ScrollAreaCorner",Op=b.forwardRef((e,t)=>{const n=vt(za,e.__scopeScrollArea),r=!!(n.scrollbarX&&n.scrollbarY);return n.type!=="scroll"&&r?l.jsx(uC,{...e,ref:t}):null});Op.displayName=za;var uC=b.forwardRef((e,t)=>{const{__scopeScrollArea:n,...r}=e,o=vt(za,n),[s,i]=b.useState(0),[a,c]=b.useState(0),u=!!(s&&a);return Yn(o.scrollbarX,()=>{const d=o.scrollbarX?.offsetHeight||0;o.onCornerHeightChange(d),c(d)}),Yn(o.scrollbarY,()=>{const d=o.scrollbarY?.offsetWidth||0;o.onCornerWidthChange(d),i(d)}),u?l.jsx(Ne.div,{...r,ref:t,style:{width:s,height:a,position:"absolute",right:o.dir==="ltr"?0:void 0,left:o.dir==="rtl"?0:void 0,bottom:0,...e.style}}):null});function Mo(e){return e?parseInt(e,10):0}function Mp(e,t){const n=e/t;return isNaN(n)?0:n}function as(e){const t=Mp(e.viewport,e.content),n=e.scrollbar.paddingStart+e.scrollbar.paddingEnd,r=(e.scrollbar.size-n)*t;return Math.max(r,18)}function dC(e,t,n,r="ltr"){const o=as(n),s=o/2,i=t||s,a=o-i,c=n.scrollbar.paddingStart+i,u=n.scrollbar.size-n.scrollbar.paddingEnd-a,d=n.content-n.viewport,f=r==="ltr"?[0,d]:[d*-1,0];return Lp([c,u],f)(e)}function pc(e,t,n="ltr"){const r=as(t),o=t.scrollbar.paddingStart+t.scrollbar.paddingEnd,s=t.scrollbar.size-o,i=t.content-t.viewport,a=s-r,c=n==="ltr"?[0,i]:[i*-1,0],u=ki(e,c);return Lp([0,i],[0,a])(u)}function Lp(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 Dp(e,t){return e>0&&e<t}var fC=(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,a=n.top!==s.top;(i||a)&&t(),n=s,r=window.requestAnimationFrame(o)})(),()=>window.cancelAnimationFrame(r)};function ls(e,t){const n=st(e),r=b.useRef(0);return b.useEffect(()=>()=>window.clearTimeout(r.current),[]),b.useCallback(()=>{window.clearTimeout(r.current),r.current=window.setTimeout(n,t)},[n,t])}function Yn(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 pC=Ep,hC=Tp,mC=Op,gC=[" ","Enter","ArrowUp","ArrowDown"],xC=[" ","Enter"],kn="Select",[cs,us,yC]=gf(kn),[or]=Xt(kn,[yC,is]),ds=is(),[bC,dn]=or(kn),[vC,wC]=or(kn),Fp=e=>{const{__scopeSelect:t,children:n,open:r,defaultOpen:o,onOpenChange:s,value:i,defaultValue:a,onValueChange:c,dir:u,name:d,autoComplete:f,disabled:h,required:p,form:x}=e,m=ds(t),[g,y]=b.useState(null),[v,k]=b.useState(null),[S,C]=b.useState(!1),j=Yo(u),[N,I]=bn({prop:r,defaultProp:o??!1,onChange:s,caller:kn}),[R,O]=bn({prop:i,defaultProp:a,onChange:c,caller:kn}),$=b.useRef(null),E=g?x||!!g.closest("form"):!0,[L,w]=b.useState(new Set),M=Array.from(L).map(U=>U.props.value).join(";");return l.jsx(gp,{...m,children:l.jsxs(bC,{required:p,scope:t,trigger:g,onTriggerChange:y,valueNode:v,onValueNodeChange:k,valueNodeHasChildren:S,onValueNodeHasChildrenChange:C,contentId:Ot(),value:R,onValueChange:O,open:N,onOpenChange:I,dir:j,triggerPointerDownPosRef:$,disabled:h,children:[l.jsx(cs.Provider,{scope:t,children:l.jsx(vC,{scope:e.__scopeSelect,onNativeOptionAdd:b.useCallback(U=>{w(F=>new Set(F).add(U))},[]),onNativeOptionRemove:b.useCallback(U=>{w(F=>{const V=new Set(F);return V.delete(U),V})},[]),children:n})}),E?l.jsxs(ah,{"aria-hidden":!0,required:p,tabIndex:-1,name:d,autoComplete:f,value:R,onChange:U=>O(U.target.value),disabled:h,form:x,children:[R===void 0?l.jsx("option",{value:""}):null,Array.from(L)]},M):null]})})};Fp.displayName=kn;var $p="SelectTrigger",Bp=b.forwardRef((e,t)=>{const{__scopeSelect:n,disabled:r=!1,...o}=e,s=ds(n),i=dn($p,n),a=i.disabled||r,c=Le(t,i.onTriggerChange),u=us(n),d=b.useRef("touch"),[f,h,p]=ch(m=>{const g=u().filter(k=>!k.disabled),y=g.find(k=>k.value===i.value),v=uh(g,m,y);v!==void 0&&i.onValueChange(v.value)}),x=m=>{a||(i.onOpenChange(!0),p()),m&&(i.triggerPointerDownPosRef.current={x:Math.round(m.pageX),y:Math.round(m.pageY)})};return l.jsx(xp,{asChild:!0,...s,children:l.jsx(Ne.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:a,"data-disabled":a?"":void 0,"data-placeholder":lh(i.value)?"":void 0,...o,ref:c,onClick:ke(o.onClick,m=>{m.currentTarget.focus(),d.current!=="mouse"&&x(m)}),onPointerDown:ke(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:ke(o.onKeyDown,m=>{const g=f.current!=="";!(m.ctrlKey||m.altKey||m.metaKey)&&m.key.length===1&&h(m.key),!(g&&m.key===" ")&&gC.includes(m.key)&&(x(),m.preventDefault())})})})});Bp.displayName=$p;var Up="SelectValue",Vp=b.forwardRef((e,t)=>{const{__scopeSelect:n,className:r,style:o,children:s,placeholder:i="",...a}=e,c=dn(Up,n),{onValueNodeHasChildrenChange:u}=c,d=s!==void 0,f=Le(t,c.onValueNodeChange);return tt(()=>{u(d)},[u,d]),l.jsx(Ne.span,{...a,ref:f,style:{pointerEvents:"none"},children:lh(c.value)?l.jsx(l.Fragment,{children:i}):s})});Vp.displayName=Up;var kC="SelectIcon",Hp=b.forwardRef((e,t)=>{const{__scopeSelect:n,children:r,...o}=e;return l.jsx(Ne.span,{"aria-hidden":!0,...o,ref:t,children:r||"▼"})});Hp.displayName=kC;var _C="SelectPortal",Wp=e=>l.jsx(Qo,{asChild:!0,...e});Wp.displayName=_C;var _n="SelectContent",Zp=b.forwardRef((e,t)=>{const n=dn(_n,e.__scopeSelect),[r,o]=b.useState();if(tt(()=>{o(new DocumentFragment)},[]),!n.open){const s=r;return s?Mr.createPortal(l.jsx(qp,{scope:e.__scopeSelect,children:l.jsx(cs.Slot,{scope:e.__scopeSelect,children:l.jsx("div",{children:e.children})})}),s):null}return l.jsx(Kp,{...e,ref:t})});Zp.displayName=_n;var _t=10,[qp,fn]=or(_n),SC="SelectContentImpl",CC=Jn("SelectContent.RemoveScroll"),Kp=b.forwardRef((e,t)=>{const{__scopeSelect:n,position:r="item-aligned",onCloseAutoFocus:o,onEscapeKeyDown:s,onPointerDownOutside:i,side:a,sideOffset:c,align:u,alignOffset:d,arrowPadding:f,collisionBoundary:h,collisionPadding:p,sticky:x,hideWhenDetached:m,avoidCollisions:g,...y}=e,v=dn(_n,n),[k,S]=b.useState(null),[C,j]=b.useState(null),N=Le(t,ae=>S(ae)),[I,R]=b.useState(null),[O,$]=b.useState(null),E=us(n),[L,w]=b.useState(!1),M=b.useRef(!1);b.useEffect(()=>{if(k)return Rf(k)},[k]),Sf();const U=b.useCallback(ae=>{const[ue,...he]=E().map(Ce=>Ce.ref.current),[fe]=he.slice(-1),ge=document.activeElement;for(const Ce of ae)if(Ce===ge||(Ce?.scrollIntoView({block:"nearest"}),Ce===ue&&C&&(C.scrollTop=0),Ce===fe&&C&&(C.scrollTop=C.scrollHeight),Ce?.focus(),document.activeElement!==ge))return},[E,C]),F=b.useCallback(()=>U([I,k]),[U,I,k]);b.useEffect(()=>{L&&F()},[L,F]);const{onOpenChange:V,triggerPointerDownPosRef:J}=v;b.useEffect(()=>{if(k){let ae={x:0,y:0};const ue=fe=>{ae={x:Math.abs(Math.round(fe.pageX)-(J.current?.x??0)),y:Math.abs(Math.round(fe.pageY)-(J.current?.y??0))}},he=fe=>{ae.x<=10&&ae.y<=10?fe.preventDefault():k.contains(fe.target)||V(!1),document.removeEventListener("pointermove",ue),J.current=null};return J.current!==null&&(document.addEventListener("pointermove",ue),document.addEventListener("pointerup",he,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",ue),document.removeEventListener("pointerup",he,{capture:!0})}}},[k,V,J]),b.useEffect(()=>{const ae=()=>V(!1);return window.addEventListener("blur",ae),window.addEventListener("resize",ae),()=>{window.removeEventListener("blur",ae),window.removeEventListener("resize",ae)}},[V]);const[z,H]=ch(ae=>{const ue=E().filter(ge=>!ge.disabled),he=ue.find(ge=>ge.ref.current===document.activeElement),fe=uh(ue,ae,he);fe&&setTimeout(()=>fe.ref.current.focus())}),Z=b.useCallback((ae,ue,he)=>{const fe=!M.current&&!he;(v.value!==void 0&&v.value===ue||fe)&&(R(ae),fe&&(M.current=!0))},[v.value]),P=b.useCallback(()=>k?.focus(),[k]),ee=b.useCallback((ae,ue,he)=>{const fe=!M.current&&!he;(v.value!==void 0&&v.value===ue||fe)&&$(ae)},[v.value]),Q=r==="popper"?_i:Jp,de=Q===_i?{side:a,sideOffset:c,align:u,alignOffset:d,arrowPadding:f,collisionBoundary:h,collisionPadding:p,sticky:x,hideWhenDetached:m,avoidCollisions:g}:{};return l.jsx(qp,{scope:n,content:k,viewport:C,onViewportChange:j,itemRefCallback:Z,selectedItem:I,onItemLeave:P,itemTextRefCallback:ee,focusSelectedItem:F,selectedItemText:O,position:r,isPositioned:L,searchRef:z,children:l.jsx(ya,{as:CC,allowPinchZoom:!0,children:l.jsx(xa,{asChild:!0,trapped:v.open,onMountAutoFocus:ae=>{ae.preventDefault()},onUnmountAutoFocus:ke(o,ae=>{v.trigger?.focus({preventScroll:!0}),ae.preventDefault()}),children:l.jsx(Xo,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:s,onPointerDownOutside:i,onFocusOutside:ae=>ae.preventDefault(),onDismiss:()=>v.onOpenChange(!1),children:l.jsx(Q,{role:"listbox",id:v.contentId,"data-state":v.open?"open":"closed",dir:v.dir,onContextMenu:ae=>ae.preventDefault(),...y,...de,onPlaced:()=>w(!0),ref:N,style:{display:"flex",flexDirection:"column",outline:"none",...y.style},onKeyDown:ke(y.onKeyDown,ae=>{const ue=ae.ctrlKey||ae.altKey||ae.metaKey;if(ae.key==="Tab"&&ae.preventDefault(),!ue&&ae.key.length===1&&H(ae.key),["ArrowUp","ArrowDown","Home","End"].includes(ae.key)){let fe=E().filter(ge=>!ge.disabled).map(ge=>ge.ref.current);if(["ArrowUp","End"].includes(ae.key)&&(fe=fe.slice().reverse()),["ArrowUp","ArrowDown"].includes(ae.key)){const ge=ae.target,Ce=fe.indexOf(ge);fe=fe.slice(Ce+1)}setTimeout(()=>U(fe)),ae.preventDefault()}})})})})})})});Kp.displayName=SC;var jC="SelectItemAlignedPosition",Jp=b.forwardRef((e,t)=>{const{__scopeSelect:n,onPlaced:r,...o}=e,s=dn(_n,n),i=fn(_n,n),[a,c]=b.useState(null),[u,d]=b.useState(null),f=Le(t,N=>d(N)),h=us(n),p=b.useRef(!1),x=b.useRef(!0),{viewport:m,selectedItem:g,selectedItemText:y,focusSelectedItem:v}=i,k=b.useCallback(()=>{if(s.trigger&&s.valueNode&&a&&u&&m&&g&&y){const N=s.trigger.getBoundingClientRect(),I=u.getBoundingClientRect(),R=s.valueNode.getBoundingClientRect(),O=y.getBoundingClientRect();if(s.dir!=="rtl"){const ge=O.left-I.left,Ce=R.left-ge,ze=N.left-Ce,_=N.width+ze,ne=Math.max(_,I.width),G=window.innerWidth-_t,A=ki(Ce,[_t,Math.max(_t,G-ne)]);a.style.minWidth=_+"px",a.style.left=A+"px"}else{const ge=I.right-O.right,Ce=window.innerWidth-R.right-ge,ze=window.innerWidth-N.right-Ce,_=N.width+ze,ne=Math.max(_,I.width),G=window.innerWidth-_t,A=ki(Ce,[_t,Math.max(_t,G-ne)]);a.style.minWidth=_+"px",a.style.right=A+"px"}const $=h(),E=window.innerHeight-_t*2,L=m.scrollHeight,w=window.getComputedStyle(u),M=parseInt(w.borderTopWidth,10),U=parseInt(w.paddingTop,10),F=parseInt(w.borderBottomWidth,10),V=parseInt(w.paddingBottom,10),J=M+U+L+V+F,z=Math.min(g.offsetHeight*5,J),H=window.getComputedStyle(m),Z=parseInt(H.paddingTop,10),P=parseInt(H.paddingBottom,10),ee=N.top+N.height/2-_t,Q=E-ee,de=g.offsetHeight/2,ae=g.offsetTop+de,ue=M+U+ae,he=J-ue;if(ue<=ee){const ge=$.length>0&&g===$[$.length-1].ref.current;a.style.bottom="0px";const Ce=u.clientHeight-m.offsetTop-m.offsetHeight,ze=Math.max(Q,de+(ge?P:0)+Ce+F),_=ue+ze;a.style.height=_+"px"}else{const ge=$.length>0&&g===$[0].ref.current;a.style.top="0px";const ze=Math.max(ee,M+m.offsetTop+(ge?Z:0)+de)+he;a.style.height=ze+"px",m.scrollTop=ue-ee+m.offsetTop}a.style.margin=`${_t}px 0`,a.style.minHeight=z+"px",a.style.maxHeight=E+"px",r?.(),requestAnimationFrame(()=>p.current=!0)}},[h,s.trigger,s.valueNode,a,u,m,g,y,s.dir,r]);tt(()=>k(),[k]);const[S,C]=b.useState();tt(()=>{u&&C(window.getComputedStyle(u).zIndex)},[u]);const j=b.useCallback(N=>{N&&x.current===!0&&(k(),v?.(),x.current=!1)},[k,v]);return l.jsx(NC,{scope:n,contentWrapper:a,shouldExpandOnScrollRef:p,onScrollButtonChange:j,children:l.jsx("div",{ref:c,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:S},children:l.jsx(Ne.div,{...o,ref:f,style:{boxSizing:"border-box",maxHeight:"100%",...o.style}})})})});Jp.displayName=jC;var EC="SelectPopperPosition",_i=b.forwardRef((e,t)=>{const{__scopeSelect:n,align:r="start",collisionPadding:o=_t,...s}=e,i=ds(n);return l.jsx(yp,{...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)"}})});_i.displayName=EC;var[NC,Ra]=or(_n,{}),Si="SelectViewport",Gp=b.forwardRef((e,t)=>{const{__scopeSelect:n,nonce:r,...o}=e,s=fn(Si,n),i=Ra(Si,n),a=Le(t,s.onViewportChange),c=b.useRef(0);return l.jsxs(l.Fragment,{children:[l.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}),l.jsx(cs.Slot,{scope:n,children:l.jsx(Ne.div,{"data-radix-select-viewport":"",role:"presentation",...o,ref:a,style:{position:"relative",flex:1,overflow:"hidden auto",...o.style},onScroll:ke(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-_t*2,m=parseFloat(f.style.minHeight),g=parseFloat(f.style.height),y=Math.max(m,g);if(y<x){const v=y+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})})})]})});Gp.displayName=Si;var Yp="SelectGroup",[TC,AC]=or(Yp),IC=b.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,o=Ot();return l.jsx(TC,{scope:n,id:o,children:l.jsx(Ne.div,{role:"group","aria-labelledby":o,...r,ref:t})})});IC.displayName=Yp;var Xp="SelectLabel",zC=b.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,o=AC(Xp,n);return l.jsx(Ne.div,{id:o.id,...r,ref:t})});zC.displayName=Xp;var Lo="SelectItem",[RC,Qp]=or(Lo),eh=b.forwardRef((e,t)=>{const{__scopeSelect:n,value:r,disabled:o=!1,textValue:s,...i}=e,a=dn(Lo,n),c=fn(Lo,n),u=a.value===r,[d,f]=b.useState(s??""),[h,p]=b.useState(!1),x=Le(t,v=>c.itemRefCallback?.(v,r,o)),m=Ot(),g=b.useRef("touch"),y=()=>{o||(a.onValueChange(r),a.onOpenChange(!1))};if(r==="")throw new Error("A <Select.Item /> must have a value prop that is not an empty string. This is because the Select value can be set to an empty string to clear the selection and show the placeholder.");return l.jsx(RC,{scope:n,value:r,disabled:o,textId:m,isSelected:u,onItemTextChange:b.useCallback(v=>{f(k=>k||(v?.textContent??"").trim())},[]),children:l.jsx(cs.ItemSlot,{scope:n,value:r,disabled:o,textValue:d,children:l.jsx(Ne.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:ke(i.onFocus,()=>p(!0)),onBlur:ke(i.onBlur,()=>p(!1)),onClick:ke(i.onClick,()=>{g.current!=="mouse"&&y()}),onPointerUp:ke(i.onPointerUp,()=>{g.current==="mouse"&&y()}),onPointerDown:ke(i.onPointerDown,v=>{g.current=v.pointerType}),onPointerMove:ke(i.onPointerMove,v=>{g.current=v.pointerType,o?c.onItemLeave?.():g.current==="mouse"&&v.currentTarget.focus({preventScroll:!0})}),onPointerLeave:ke(i.onPointerLeave,v=>{v.currentTarget===document.activeElement&&c.onItemLeave?.()}),onKeyDown:ke(i.onKeyDown,v=>{c.searchRef?.current!==""&&v.key===" "||(xC.includes(v.key)&&y(),v.key===" "&&v.preventDefault())})})})})});eh.displayName=Lo;var br="SelectItemText",th=b.forwardRef((e,t)=>{const{__scopeSelect:n,className:r,style:o,...s}=e,i=dn(br,n),a=fn(br,n),c=Qp(br,n),u=wC(br,n),[d,f]=b.useState(null),h=Le(t,y=>f(y),c.onItemTextChange,y=>a.itemTextRefCallback?.(y,c.value,c.disabled)),p=d?.textContent,x=b.useMemo(()=>l.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]),l.jsxs(l.Fragment,{children:[l.jsx(Ne.span,{id:c.textId,...s,ref:h}),c.isSelected&&i.valueNode&&!i.valueNodeHasChildren?Mr.createPortal(s.children,i.valueNode):null]})});th.displayName=br;var nh="SelectItemIndicator",rh=b.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e;return Qp(nh,n).isSelected?l.jsx(Ne.span,{"aria-hidden":!0,...r,ref:t}):null});rh.displayName=nh;var Ci="SelectScrollUpButton",oh=b.forwardRef((e,t)=>{const n=fn(Ci,e.__scopeSelect),r=Ra(Ci,e.__scopeSelect),[o,s]=b.useState(!1),i=Le(t,r.onScrollButtonChange);return tt(()=>{if(n.viewport&&n.isPositioned){let a=function(){const u=c.scrollTop>0;s(u)};const c=n.viewport;return a(),c.addEventListener("scroll",a),()=>c.removeEventListener("scroll",a)}},[n.viewport,n.isPositioned]),o?l.jsx(ih,{...e,ref:i,onAutoScroll:()=>{const{viewport:a,selectedItem:c}=n;a&&c&&(a.scrollTop=a.scrollTop-c.offsetHeight)}}):null});oh.displayName=Ci;var ji="SelectScrollDownButton",sh=b.forwardRef((e,t)=>{const n=fn(ji,e.__scopeSelect),r=Ra(ji,e.__scopeSelect),[o,s]=b.useState(!1),i=Le(t,r.onScrollButtonChange);return tt(()=>{if(n.viewport&&n.isPositioned){let a=function(){const u=c.scrollHeight-c.clientHeight,d=Math.ceil(c.scrollTop)<u;s(d)};const c=n.viewport;return a(),c.addEventListener("scroll",a),()=>c.removeEventListener("scroll",a)}},[n.viewport,n.isPositioned]),o?l.jsx(ih,{...e,ref:i,onAutoScroll:()=>{const{viewport:a,selectedItem:c}=n;a&&c&&(a.scrollTop=a.scrollTop+c.offsetHeight)}}):null});sh.displayName=ji;var ih=b.forwardRef((e,t)=>{const{__scopeSelect:n,onAutoScroll:r,...o}=e,s=fn("SelectScrollButton",n),i=b.useRef(null),a=us(n),c=b.useCallback(()=>{i.current!==null&&(window.clearInterval(i.current),i.current=null)},[]);return b.useEffect(()=>()=>c(),[c]),tt(()=>{a().find(d=>d.ref.current===document.activeElement)?.ref.current?.scrollIntoView({block:"nearest"})},[a]),l.jsx(Ne.div,{"aria-hidden":!0,...o,ref:t,style:{flexShrink:0,...o.style},onPointerDown:ke(o.onPointerDown,()=>{i.current===null&&(i.current=window.setInterval(r,50))}),onPointerMove:ke(o.onPointerMove,()=>{s.onItemLeave?.(),i.current===null&&(i.current=window.setInterval(r,50))}),onPointerLeave:ke(o.onPointerLeave,()=>{c()})})}),PC="SelectSeparator",OC=b.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e;return l.jsx(Ne.div,{"aria-hidden":!0,...r,ref:t})});OC.displayName=PC;var Ei="SelectArrow",MC=b.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,o=ds(n),s=dn(Ei,n),i=fn(Ei,n);return s.open&&i.position==="popper"?l.jsx(bp,{...o,...r,ref:t}):null});MC.displayName=Ei;var LC="SelectBubbleInput",ah=b.forwardRef(({__scopeSelect:e,value:t,...n},r)=>{const o=b.useRef(null),s=Le(r,o),i=__(t);return b.useEffect(()=>{const a=o.current;if(!a)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(a,t),a.dispatchEvent(f)}},[i,t]),l.jsx(Ne.select,{...n,style:{...hf,...n.style},ref:s,defaultValue:t})});ah.displayName=LC;function lh(e){return e===""||e===void 0}function ch(e){const t=st(e),n=b.useRef(""),r=b.useRef(0),o=b.useCallback(i=>{const a=n.current+i;t(a),(function c(u){n.current=u,window.clearTimeout(r.current),u!==""&&(r.current=window.setTimeout(()=>c(""),1e3))})(a)},[t]),s=b.useCallback(()=>{n.current="",window.clearTimeout(r.current)},[]);return b.useEffect(()=>()=>window.clearTimeout(r.current),[]),[n,o,s]}function uh(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=DC(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 DC(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var FC=Fp,$C=Bp,BC=Vp,UC=Hp,VC=Wp,HC=Zp,WC=Gp,ZC=eh,qC=th,KC=rh,JC=oh,GC=sh,fs="Tabs",[YC]=Xt(fs,[wp]),dh=wp(),[XC,Pa]=YC(fs),fh=b.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,onValueChange:o,defaultValue:s,orientation:i="horizontal",dir:a,activationMode:c="automatic",...u}=e,d=Yo(a),[f,h]=bn({prop:r,onChange:o,defaultProp:s??"",caller:fs});return l.jsx(XC,{scope:n,baseId:Ot(),value:f,onValueChange:h,orientation:i,dir:d,activationMode:c,children:l.jsx(Ne.div,{dir:d,"data-orientation":i,...u,ref:t})})});fh.displayName=fs;var ph="TabsList",hh=b.forwardRef((e,t)=>{const{__scopeTabs:n,loop:r=!0,...o}=e,s=Pa(ph,n),i=dh(n);return l.jsx(eC,{asChild:!0,...i,orientation:s.orientation,dir:s.dir,loop:r,children:l.jsx(Ne.div,{role:"tablist","aria-orientation":s.orientation,...o,ref:t})})});hh.displayName=ph;var mh="TabsTrigger",gh=b.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,disabled:o=!1,...s}=e,i=Pa(mh,n),a=dh(n),c=bh(i.baseId,r),u=vh(i.baseId,r),d=r===i.value;return l.jsx(tC,{asChild:!0,...a,focusable:!o,active:d,children:l.jsx(Ne.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:ke(e.onMouseDown,f=>{!o&&f.button===0&&f.ctrlKey===!1?i.onValueChange(r):f.preventDefault()}),onKeyDown:ke(e.onKeyDown,f=>{[" ","Enter"].includes(f.key)&&i.onValueChange(r)}),onFocus:ke(e.onFocus,()=>{const f=i.activationMode!=="manual";!d&&!o&&f&&i.onValueChange(r)})})})});gh.displayName=mh;var xh="TabsContent",yh=b.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,forceMount:o,children:s,...i}=e,a=Pa(xh,n),c=bh(a.baseId,r),u=vh(a.baseId,r),d=r===a.value,f=b.useRef(d);return b.useEffect(()=>{const h=requestAnimationFrame(()=>f.current=!1);return()=>cancelAnimationFrame(h)},[]),l.jsx(bt,{present:o||d,children:({present:h})=>l.jsx(Ne.div,{"data-state":d?"active":"inactive","data-orientation":a.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})})});yh.displayName=xh;function bh(e,t){return`${e}-trigger-${t}`}function vh(e,t){return`${e}-content-${t}`}var QC=fh,e5=hh,t5=gh,n5=yh,[ps]=Xt("Tooltip",[is]),hs=is(),wh="TooltipProvider",r5=700,Ni="tooltip.open",[o5,Oa]=ps(wh),kh=e=>{const{__scopeTooltip:t,delayDuration:n=r5,skipDelayDuration:r=300,disableHoverableContent:o=!1,children:s}=e,i=b.useRef(!0),a=b.useRef(!1),c=b.useRef(0);return b.useEffect(()=>{const u=c.current;return()=>window.clearTimeout(u)},[]),l.jsx(o5,{scope:t,isOpenDelayedRef:i,delayDuration:n,onOpen:b.useCallback(()=>{window.clearTimeout(c.current),i.current=!1},[]),onClose:b.useCallback(()=>{window.clearTimeout(c.current),c.current=window.setTimeout(()=>i.current=!0,r)},[r]),isPointerInTransitRef:a,onPointerInTransitChange:b.useCallback(u=>{a.current=u},[]),disableHoverableContent:o,children:s})};kh.displayName=wh;var Ir="Tooltip",[s5,Br]=ps(Ir),_h=e=>{const{__scopeTooltip:t,children:n,open:r,defaultOpen:o,onOpenChange:s,disableHoverableContent:i,delayDuration:a}=e,c=Oa(Ir,e.__scopeTooltip),u=hs(t),[d,f]=b.useState(null),h=Ot(),p=b.useRef(0),x=i??c.disableHoverableContent,m=a??c.delayDuration,g=b.useRef(!1),[y,v]=bn({prop:r,defaultProp:o??!1,onChange:N=>{N?(c.onOpen(),document.dispatchEvent(new CustomEvent(Ni))):c.onClose(),s?.(N)},caller:Ir}),k=b.useMemo(()=>y?g.current?"delayed-open":"instant-open":"closed",[y]),S=b.useCallback(()=>{window.clearTimeout(p.current),p.current=0,g.current=!1,v(!0)},[v]),C=b.useCallback(()=>{window.clearTimeout(p.current),p.current=0,v(!1)},[v]),j=b.useCallback(()=>{window.clearTimeout(p.current),p.current=window.setTimeout(()=>{g.current=!0,v(!0),p.current=0},m)},[m,v]);return b.useEffect(()=>()=>{p.current&&(window.clearTimeout(p.current),p.current=0)},[]),l.jsx(gp,{...u,children:l.jsx(s5,{scope:t,contentId:h,open:y,stateAttribute:k,trigger:d,onTriggerChange:f,onTriggerEnter:b.useCallback(()=>{c.isOpenDelayedRef.current?j():S()},[c.isOpenDelayedRef,j,S]),onTriggerLeave:b.useCallback(()=>{x?C():(window.clearTimeout(p.current),p.current=0)},[C,x]),onOpen:S,onClose:C,disableHoverableContent:x,children:n})})};_h.displayName=Ir;var Ti="TooltipTrigger",Sh=b.forwardRef((e,t)=>{const{__scopeTooltip:n,...r}=e,o=Br(Ti,n),s=Oa(Ti,n),i=hs(n),a=b.useRef(null),c=Le(t,a,o.onTriggerChange),u=b.useRef(!1),d=b.useRef(!1),f=b.useCallback(()=>u.current=!1,[]);return b.useEffect(()=>()=>document.removeEventListener("pointerup",f),[f]),l.jsx(xp,{asChild:!0,...i,children:l.jsx(Ne.button,{"aria-describedby":o.open?o.contentId:void 0,"data-state":o.stateAttribute,...r,ref:c,onPointerMove:ke(e.onPointerMove,h=>{h.pointerType!=="touch"&&!d.current&&!s.isPointerInTransitRef.current&&(o.onTriggerEnter(),d.current=!0)}),onPointerLeave:ke(e.onPointerLeave,()=>{o.onTriggerLeave(),d.current=!1}),onPointerDown:ke(e.onPointerDown,()=>{o.open&&o.onClose(),u.current=!0,document.addEventListener("pointerup",f,{once:!0})}),onFocus:ke(e.onFocus,()=>{u.current||o.onOpen()}),onBlur:ke(e.onBlur,o.onClose),onClick:ke(e.onClick,o.onClose)})})});Sh.displayName=Ti;var Ma="TooltipPortal",[i5,a5]=ps(Ma,{forceMount:void 0}),Ch=e=>{const{__scopeTooltip:t,forceMount:n,children:r,container:o}=e,s=Br(Ma,t);return l.jsx(i5,{scope:t,forceMount:n,children:l.jsx(bt,{present:n||s.open,children:l.jsx(Qo,{asChild:!0,container:o,children:r})})})};Ch.displayName=Ma;var Xn="TooltipContent",jh=b.forwardRef((e,t)=>{const n=a5(Xn,e.__scopeTooltip),{forceMount:r=n.forceMount,side:o="top",...s}=e,i=Br(Xn,e.__scopeTooltip);return l.jsx(bt,{present:r||i.open,children:i.disableHoverableContent?l.jsx(Eh,{side:o,...s,ref:t}):l.jsx(l5,{side:o,...s,ref:t})})}),l5=b.forwardRef((e,t)=>{const n=Br(Xn,e.__scopeTooltip),r=Oa(Xn,e.__scopeTooltip),o=b.useRef(null),s=Le(t,o),[i,a]=b.useState(null),{trigger:c,onClose:u}=n,d=o.current,{onPointerInTransitChange:f}=r,h=b.useCallback(()=>{a(null),f(!1)},[f]),p=b.useCallback((x,m)=>{const g=x.currentTarget,y={x:x.clientX,y:x.clientY},v=f5(y,g.getBoundingClientRect()),k=p5(y,v),S=h5(m.getBoundingClientRect()),C=g5([...k,...S]);a(C),f(!0)},[f]);return b.useEffect(()=>()=>h(),[h]),b.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]),b.useEffect(()=>{if(i){const x=m=>{const g=m.target,y={x:m.clientX,y:m.clientY},v=c?.contains(g)||d?.contains(g),k=!m5(y,i);v?h():k&&(h(),u())};return document.addEventListener("pointermove",x),()=>document.removeEventListener("pointermove",x)}},[c,d,i,u,h]),l.jsx(Eh,{...e,ref:s})}),[c5,u5]=ps(Ir,{isInside:!1}),d5=Mw("TooltipContent"),Eh=b.forwardRef((e,t)=>{const{__scopeTooltip:n,children:r,"aria-label":o,onEscapeKeyDown:s,onPointerDownOutside:i,...a}=e,c=Br(Xn,n),u=hs(n),{onClose:d}=c;return b.useEffect(()=>(document.addEventListener(Ni,d),()=>document.removeEventListener(Ni,d)),[d]),b.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]),l.jsx(Xo,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:s,onPointerDownOutside:i,onFocusOutside:f=>f.preventDefault(),onDismiss:d,children:l.jsxs(yp,{"data-state":c.stateAttribute,...u,...a,ref:t,style:{...a.style,"--radix-tooltip-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-tooltip-content-available-width":"var(--radix-popper-available-width)","--radix-tooltip-content-available-height":"var(--radix-popper-available-height)","--radix-tooltip-trigger-width":"var(--radix-popper-anchor-width)","--radix-tooltip-trigger-height":"var(--radix-popper-anchor-height)"},children:[l.jsx(d5,{children:r}),l.jsx(c5,{scope:n,isInside:!0,children:l.jsx(Vw,{id:c.contentId,role:"tooltip",children:o||r})})]})})});jh.displayName=Xn;var Nh="TooltipArrow",Th=b.forwardRef((e,t)=>{const{__scopeTooltip:n,...r}=e,o=hs(n);return u5(Nh,n).isInside?null:l.jsx(bp,{...o,...r,ref:t})});Th.displayName=Nh;function f5(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 p5(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 h5(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 m5(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 a=t[s],c=t[i],u=a.x,d=a.y,f=c.x,h=c.y;d>r!=h>r&&n<(f-u)*(r-d)/(h-d)+u&&(o=!o)}return o}function g5(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),x5(t)}function x5(e){if(e.length<=1)return e.slice();const t=[];for(let r=0;r<e.length;r++){const o=e[r];for(;t.length>=2;){const s=t[t.length-1],i=t[t.length-2];if((s.x-i.x)*(o.y-i.y)>=(s.y-i.y)*(o.x-i.x))t.pop();else break}t.push(o)}t.pop();const n=[];for(let r=e.length-1;r>=0;r--){const o=e[r];for(;n.length>=2;){const s=n[n.length-1],i=n[n.length-2];if((s.x-i.x)*(o.y-i.y)>=(s.y-i.y)*(o.x-i.x))n.pop();else break}n.push(o)}return n.pop(),t.length===1&&n.length===1&&t[0].x===n[0].x&&t[0].y===n[0].y?t:t.concat(n)}var y5=kh,b5=_h,v5=Sh,w5=Ch,k5=jh,_5=Th;const S5=pa("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 jt({className:e,variant:t="default",asChild:n=!1,...r}){const o=n?Pw:"span";return l.jsx(o,{"data-slot":"badge","data-variant":t,className:be(S5({variant:t}),e),...r})}function La({...e}){return l.jsx(g_,{"data-slot":"dialog",...e})}function C5({...e}){return l.jsx(x_,{"data-slot":"dialog-trigger",...e})}function j5({...e}){return l.jsx(y_,{"data-slot":"dialog-portal",...e})}function E5({className:e,...t}){return l.jsx(b_,{"data-slot":"dialog-overlay",className:be("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 Da({className:e,children:t,...n}){return l.jsxs(j5,{children:[l.jsx(E5,{}),l.jsxs(v_,{"data-slot":"dialog-content",className:be("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,l.jsxs(k_,{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:[l.jsx(ua,{className:"size-4"}),l.jsx("span",{className:"sr-only",children:"Close"})]})]})]})}function Fa({className:e,...t}){return l.jsx("div",{"data-slot":"dialog-header",className:be("flex flex-col space-y-1.5 text-center sm:text-left",e),...t})}function $a({className:e,...t}){return l.jsx(w_,{"data-slot":"dialog-title",className:be("text-lg font-semibold leading-none tracking-tight",e),...t})}const N5=pa("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 l.jsx("button",{"data-slot":"button",className:be(N5({variant:t,size:n,className:e})),...r})}function Ah({open:e,onOpenChange:t,title:n,description:r,confirmLabel:o="Confirm",variant:s="default",onConfirm:i}){return l.jsx(La,{open:e,onOpenChange:t,children:l.jsxs(Da,{children:[l.jsx(Fa,{children:l.jsx($a,{children:n})}),l.jsx("p",{className:"text-sm text-muted-foreground",children:r}),l.jsxs("div",{className:"flex justify-end gap-2 pt-2",children:[l.jsx(Re,{variant:"outline",size:"sm",onClick:()=>t(!1),children:"Cancel"}),l.jsx(Re,{variant:s,size:"sm",onClick:()=>{i(),t(!1)},children:o})]})]})})}const T5={anthropic:"Anthropic",openai:"OpenAI",unknown:"Unknown"};function A5({conversationId:e,startTime:t,endTime:n,totalCalls:r,totalInputTokens:o,totalOutputTokens:s,apiFormat:i,expanded:a,onToggle:c,hideApiFormat:u=!1,isLoading:d=!1,userAgent:f,timeDisplayFormat:h,onClear:p}){const[x,m]=b.useState(!1),g=v=>{v.stopPropagation(),p!==void 0&&m(!0)},y=b.useCallback(v=>{v.stopPropagation(),window.open(ig(e),"_blank","noopener,noreferrer")},[e]);return l.jsxs("div",{role:"button",tabIndex:0,"data-nav-id":`conv-${e}`,"data-nav-action":a?"collapse":"expand",className:be("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:[a?l.jsx(Yt,{className:"size-4 text-muted-foreground shrink-0"}):d?l.jsx(Nr,{className:"size-4 animate-spin text-muted-foreground shrink-0"}):l.jsx(un,{className:"size-4 text-muted-foreground shrink-0"}),l.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!==""&&l.jsxs("span",{className:"flex items-center gap-1 text-muted-foreground text-xs shrink-0",title:f,children:[l.jsx(v2,{className:"size-3"}),l.jsx("span",{className:"font-mono tabular-nums truncate max-w-[120px]",children:f})]}),!u&&l.jsx(jt,{variant:"outline",className:be("text-[10px] px-1.5 py-0 h-5 font-mono shrink-0",i==="openai"&&"border-blue-500/40 text-blue-400",i==="anthropic"&&"border-orange-500/40 text-orange-400",i==="unknown"&&"border-muted text-muted-foreground"),children:T5[i]}),l.jsxs("span",{className:"flex items-center gap-1 text-muted-foreground text-xs shrink-0",children:[l.jsx(on,{className:"size-3"}),l.jsx("span",{className:"font-mono tabular-nums",children:da(t,n,h)})]}),l.jsxs("span",{className:"flex items-center gap-1 text-muted-foreground text-xs shrink-0",children:[l.jsx(Jo,{className:"size-3"}),l.jsxs("span",{className:"font-mono tabular-nums",children:[r," call",r!==1?"s":""]})]}),l.jsxs("span",{className:"flex items-center gap-1 text-xs shrink-0",children:[l.jsx(Tr,{className:"size-3 text-muted-foreground"}),l.jsxs("span",{className:"font-mono tabular-nums",children:[l.jsx("span",{className:"text-blue-400",children:Ve(o)})," / ",l.jsx("span",{className:"text-amber-400",children:Ve(s)})]})]}),l.jsx("span",{className:"flex-1 min-w-0"}),l.jsx("button",{type:"button",onClick:y,onKeyDown:v=>{(v.key==="Enter"||v.key===" ")&&y(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:l.jsx(Vd,{className:"size-3.5"})}),p!==void 0&&l.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:l.jsx(qd,{className:"size-3.5"})}),l.jsx(Ah,{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 I5(e){const t=e.find(n=>n.apiFormat!=="unknown");return t!==void 0?t.apiFormat:e[0]?.apiFormat??"unknown"}function z5(e){let t=!1,n=!1;for(const r of e)if(r.apiFormat==="anthropic"?t=!0:r.apiFormat==="openai"&&(n=!0),t&&n)return!0;return!1}function R5(e){if(e.isTest===!0)return"provider-test";if(e.sessionId!==null&&e.sessionId!==""&&e.sessionId!==void 0)return e.sessionId;const t=e.clientPid!==null&&e.clientPid!==void 0,n=e.clientProjectFolder!==null&&e.clientProjectFolder!==void 0;if(!t&&!n)return"default";const r=t?`PID:${e.clientPid}`:"unknown",o=n?e.clientProjectFolder:"no-folder";return`${r}|${o}`}function P5(e){const t=new Map;for(const r of e){const o=R5(r),s=t.get(o);s!==void 0?s.push(r):t.set(o,[r])}const n=[];for(const[r,o]of t){const s=[...o].sort((i,a)=>i.timestamp.localeCompare(a.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 hc(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function O5(e){if(e.responseText===null)return null;try{let t=JSON.parse(e.responseText);return typeof t=="string"&&(t=JSON.parse(t)),hc(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&&hc(t.choices[0])&&typeof t.choices[0].finish_reason=="string"&&t.choices[0].finish_reason==="stop"?"stop":null:null}catch{return null}}function Ih(e){return e==="end_turn"||e==="stop"}function wt({className:e,style:t,d:n,eyeStalks:r,eyes:o,legs:s,extras:i}){return l.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",style:t,className:be("inline-block size-5",e),children:[l.jsx("path",{d:n}),r,o,s,i]})}const pn=l.jsxs(l.Fragment,{children:[l.jsx("line",{x1:"6.5",y1:"16",x2:"4.5",y2:"19.5"}),l.jsx("line",{x1:"9",y1:"17.5",x2:"8",y2:"20.5"}),l.jsx("line",{x1:"15",y1:"17.5",x2:"16",y2:"20.5"}),l.jsx("line",{x1:"17.5",y1:"16",x2:"19.5",y2:"19.5"})]}),zh=l.jsxs(l.Fragment,{children:[l.jsx("line",{x1:"7",y1:"16",x2:"5.5",y2:"18.5"}),l.jsx("line",{x1:"9.5",y1:"17",x2:"8.5",y2:"19.5"}),l.jsx("line",{x1:"14.5",y1:"17",x2:"15.5",y2:"19.5"}),l.jsx("line",{x1:"17",y1:"16",x2:"18.5",y2:"18.5"})]});function Rh({className:e}){return l.jsx(wt,{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:l.jsxs(l.Fragment,{children:[l.jsx("line",{x1:"10",y1:"7",x2:"9.5",y2:"5"}),l.jsx("line",{x1:"14",y1:"7",x2:"14.5",y2:"5"})]}),eyes:l.jsxs(l.Fragment,{children:[l.jsx("circle",{cx:"9.5",cy:"4.5",r:"0.9",fill:"currentColor",stroke:"none"}),l.jsx("circle",{cx:"14.5",cy:"4.5",r:"0.9",fill:"currentColor",stroke:"none"})]}),legs:pn,extras:l.jsxs(l.Fragment,{children:[l.jsx("path",{d:"M5 11 C3.5 9.5 1.5 10 2 12.5 C2.5 14 4 13.5 5 12.5"}),l.jsx("path",{d:"M19 11 C20.5 9.5 22.5 10 22 12.5 C21.5 14 20 13.5 19 12.5"})]})})}function M5({className:e}){return l.jsx(wt,{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:l.jsxs(l.Fragment,{children:[l.jsx("line",{x1:"9.5",y1:"6.5",x2:"9.5",y2:"4.5"}),l.jsx("line",{x1:"14.5",y1:"6.5",x2:"14.5",y2:"4.5"})]}),eyes:l.jsxs(l.Fragment,{children:[l.jsx("circle",{cx:"9.5",cy:"4",r:"1.1",fill:"currentColor",stroke:"none"}),l.jsx("circle",{cx:"14.5",cy:"4",r:"1.1",fill:"currentColor",stroke:"none"})]}),legs:zh,extras:l.jsxs(l.Fragment,{children:[l.jsx("path",{d:"M5 11 C4 9.5 2.5 10 3 12 C3.5 13.5 4.5 13 5 12"}),l.jsx("path",{d:"M19 11 C20 9.5 21.5 10 21 12 C20.5 13.5 19.5 13 19 12"})]})})}function L5({className:e}){return l.jsx(wt,{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:l.jsxs(l.Fragment,{children:[l.jsx("line",{x1:"7",y1:"7",x2:"6.5",y2:"4.5"}),l.jsx("line",{x1:"17",y1:"7",x2:"17.5",y2:"4.5"})]}),eyes:l.jsxs(l.Fragment,{children:[l.jsx("circle",{cx:"6.5",cy:"4",r:"0.8",fill:"currentColor",stroke:"none"}),l.jsx("circle",{cx:"17.5",cy:"4",r:"0.8",fill:"currentColor",stroke:"none"})]}),legs:pn,extras:l.jsxs(l.Fragment,{children:[l.jsx("path",{d:"M4 12 C2.5 10.5 1 11 1.5 13 C2 14.5 3.5 14 4.5 13"}),l.jsx("path",{d:"M20 12 C21.5 10.5 23 11 22.5 13 C22 14.5 20.5 14 19.5 13"})]})})}function D5({className:e}){return l.jsx(wt,{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:l.jsxs(l.Fragment,{children:[l.jsx("line",{x1:"10",y1:"6.5",x2:"10",y2:"3.5"}),l.jsx("line",{x1:"14",y1:"6.5",x2:"14",y2:"3.5"})]}),eyes:l.jsxs(l.Fragment,{children:[l.jsx("circle",{cx:"10",cy:"3",r:"0.7",fill:"currentColor",stroke:"none"}),l.jsx("circle",{cx:"14",cy:"3",r:"0.7",fill:"currentColor",stroke:"none"})]}),legs:l.jsxs(l.Fragment,{children:[l.jsx("line",{x1:"7",y1:"17",x2:"5",y2:"20.5"}),l.jsx("line",{x1:"9.5",y1:"18.5",x2:"8.5",y2:"21.5"}),l.jsx("line",{x1:"14.5",y1:"18.5",x2:"15.5",y2:"21.5"}),l.jsx("line",{x1:"17",y1:"17",x2:"19",y2:"20.5"})]}),extras:l.jsxs(l.Fragment,{children:[l.jsx("path",{d:"M6.5 11 C5 8.5 3 9 3.5 11.5 C4 13.5 5 13 6 12"}),l.jsx("path",{d:"M17.5 11 C19 8.5 21 9 20.5 11.5 C20 13.5 19 13 18 12"})]})})}function F5({className:e}){return l.jsx(wt,{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:l.jsxs(l.Fragment,{children:[l.jsx("line",{x1:"10",y1:"7",x2:"9.5",y2:"5"}),l.jsx("line",{x1:"14",y1:"7",x2:"14.5",y2:"5"})]}),eyes:l.jsxs(l.Fragment,{children:[l.jsx("circle",{cx:"9.5",cy:"4.5",r:"0.8",fill:"currentColor",stroke:"none"}),l.jsx("circle",{cx:"14.5",cy:"4.5",r:"0.8",fill:"currentColor",stroke:"none"})]}),legs:pn,extras:l.jsxs(l.Fragment,{children:[l.jsx("path",{d:"M5 11 C3.5 9.5 1.5 10 2 12.5 C2.5 14 4 13.5 5 12.5"}),l.jsx("path",{d:"M19 11 C20.5 9.5 22.5 10 22 12.5 C21.5 14 20 13.5 19 12.5"})]})})}function $5({className:e}){return l.jsx(wt,{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:l.jsxs(l.Fragment,{children:[l.jsx("line",{x1:"10",y1:"7",x2:"9.5",y2:"5"}),l.jsx("line",{x1:"14",y1:"7",x2:"14.5",y2:"5"})]}),eyes:l.jsxs(l.Fragment,{children:[l.jsx("circle",{cx:"9.5",cy:"4.5",r:"0.9",fill:"currentColor",stroke:"none"}),l.jsx("line",{x1:"13.5",y1:"4",x2:"15.5",y2:"5"})]}),legs:pn,extras:l.jsxs(l.Fragment,{children:[l.jsx("path",{d:"M5 11 C3.5 9.5 1.5 10 2 12.5 C2.5 14 4 13.5 5 12.5"}),l.jsx("path",{d:"M19 11 C20.5 9.5 22.5 10 22 12.5 C21.5 14 20 13.5 19 12.5"})]})})}function B5({className:e}){return l.jsx(wt,{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:l.jsxs(l.Fragment,{children:[l.jsx("line",{x1:"10",y1:"8",x2:"10",y2:"6"}),l.jsx("line",{x1:"14",y1:"8",x2:"14",y2:"6"})]}),eyes:l.jsxs(l.Fragment,{children:[l.jsx("line",{x1:"9",y1:"6",x2:"11",y2:"6.5"}),l.jsx("line",{x1:"13",y1:"6",x2:"15",y2:"6.5"})]}),legs:zh,extras:l.jsxs(l.Fragment,{children:[l.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"}),l.jsx("path",{d:"M18 11.5 C19.5 10.5 21 11 20.5 12.5 C20 13.5 19 13 18.5 12.5"})]})})}function U5({className:e}){return l.jsx(wt,{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:l.jsxs(l.Fragment,{children:[l.jsx("line",{x1:"10",y1:"7",x2:"9.5",y2:"5"}),l.jsx("line",{x1:"14",y1:"7",x2:"14.5",y2:"5"})]}),eyes:l.jsxs(l.Fragment,{children:[l.jsx("circle",{cx:"9.5",cy:"4.5",r:"0.7",fill:"currentColor",stroke:"none"}),l.jsx("circle",{cx:"14.5",cy:"4.5",r:"0.7",fill:"currentColor",stroke:"none"})]}),legs:pn,extras:l.jsxs(l.Fragment,{children:[l.jsx("path",{d:"M5 11 C3.5 9.5 1.5 10 2 12.5 C2.5 14 4 13.5 5 12.5"}),l.jsx("path",{d:"M19 11 C20.5 9.5 22.5 10 22 12.5 C21.5 14 20 13.5 19 12.5"}),l.jsx("line",{x1:"8.5",y1:"4",x2:"10.5",y2:"4.5"}),l.jsx("line",{x1:"15.5",y1:"4",x2:"13.5",y2:"4.5"}),l.jsx("path",{d:"M9 15.5 C10 14.5 14 14.5 15 15.5"})]})})}function V5({className:e}){return l.jsx(wt,{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:l.jsxs(l.Fragment,{children:[l.jsx("line",{x1:"10",y1:"7",x2:"9.5",y2:"5"}),l.jsx("line",{x1:"14",y1:"7",x2:"14.5",y2:"5"})]}),eyes:l.jsxs(l.Fragment,{children:[l.jsx("circle",{cx:"9.5",cy:"4.5",r:"1.2",fill:"none",stroke:"currentColor"}),l.jsx("circle",{cx:"14.5",cy:"4.5",r:"1.2",fill:"none",stroke:"currentColor"})]}),legs:pn,extras:l.jsxs(l.Fragment,{children:[l.jsx("path",{d:"M5 11 C3.5 9.5 1.5 10 2 12.5 C2.5 14 4 13.5 5 12.5"}),l.jsx("path",{d:"M19 11 C20.5 9.5 22.5 10 22 12.5 C21.5 14 20 13.5 19 12.5"}),l.jsx("ellipse",{cx:"12",cy:"15",rx:"2",ry:"1.5",fill:"currentColor",stroke:"none"})]})})}function H5({className:e}){return l.jsx(wt,{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:l.jsxs(l.Fragment,{children:[l.jsx("line",{x1:"9.5",y1:"7",x2:"9",y2:"5"}),l.jsx("line",{x1:"14.5",y1:"7",x2:"15",y2:"5"})]}),eyes:l.jsxs(l.Fragment,{children:[l.jsx("circle",{cx:"9",cy:"4.5",r:"1",fill:"currentColor",stroke:"none"}),l.jsx("circle",{cx:"15",cy:"4.5",r:"1",fill:"currentColor",stroke:"none"})]}),legs:pn,extras:l.jsxs(l.Fragment,{children:[l.jsx("path",{d:"M5 11 C3.5 9 2 9.5 2.5 12 C3 14 4 13 5 12"}),l.jsx("path",{d:"M19 11 C20.5 9 22 9.5 21.5 12 C21 14 20 13 19 12"}),l.jsx("path",{d:"M9 14.5 C10 16 14 16 15 14.5"}),l.jsx("circle",{cx:"7",cy:"13",r:"1",fill:"currentColor",stroke:"none",opacity:"0.3"}),l.jsx("circle",{cx:"17",cy:"13",r:"1",fill:"currentColor",stroke:"none",opacity:"0.3"})]})})}function W5({className:e}){return l.jsx(wt,{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:l.jsxs(l.Fragment,{children:[l.jsx("line",{x1:"10",y1:"7",x2:"9.5",y2:"5.5"}),l.jsx("line",{x1:"14",y1:"7",x2:"14.5",y2:"5.5"})]}),eyes:l.jsxs(l.Fragment,{children:[l.jsx("line",{x1:"7.5",y1:"5.5",x2:"16.5",y2:"5.5"}),l.jsx("rect",{x:"7",y:"5",width:"4",height:"2",rx:"0.5",fill:"currentColor",stroke:"none"}),l.jsx("rect",{x:"13",y:"5",width:"4",height:"2",rx:"0.5",fill:"currentColor",stroke:"none"})]}),legs:pn,extras:l.jsxs(l.Fragment,{children:[l.jsx("path",{d:"M5 11 C3.5 9.5 1.5 10 2 12.5 C2.5 14 4 13.5 5 12.5"}),l.jsx("path",{d:"M19 11 C20.5 9.5 22.5 10 22 12.5 C21.5 14 20 13.5 19 12.5"}),l.jsx("path",{d:"M9.5 15 C10.5 16 13.5 16 14.5 15"})]})})}function Z5({className:e}){return l.jsx(wt,{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:l.jsxs(l.Fragment,{children:[l.jsx("line",{x1:"10.5",y1:"9.5",x2:"10.5",y2:"8"}),l.jsx("line",{x1:"13.5",y1:"9.5",x2:"13.5",y2:"8"})]}),eyes:l.jsxs(l.Fragment,{children:[l.jsx("circle",{cx:"10.5",cy:"7.5",r:"0.8",fill:"currentColor",stroke:"none"}),l.jsx("circle",{cx:"13.5",cy:"7.5",r:"0.8",fill:"currentColor",stroke:"none"})]}),legs:l.jsxs(l.Fragment,{children:[l.jsx("line",{x1:"8",y1:"16",x2:"6.5",y2:"18"}),l.jsx("line",{x1:"10",y1:"17",x2:"9.5",y2:"19"}),l.jsx("line",{x1:"14",y1:"17",x2:"14.5",y2:"19"}),l.jsx("line",{x1:"16",y1:"16",x2:"17.5",y2:"18"})]}),extras:l.jsxs(l.Fragment,{children:[l.jsx("path",{d:"M7.5 12 C6.5 11 5.5 11.5 6 13 C6.5 14 7 13.5 7.5 13"}),l.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 zr=[Rh,M5,L5,D5,F5,$5,B5,U5,V5,H5,W5,Z5];function Do(e){return zr[Math.abs(e)%zr.length]??Rh}function q5(e){const t=zr.length-2;return t<=0?0:1+((Number.isFinite(e)?Math.trunc(e):0)%t+t)%t}function K5(e){return Do(q5(e))}const J5="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",G5="data:image/svg+xml,%3csvg%20height='2500'%20viewBox='-1%20-.1%20949.1%20959.8'%20width='2474'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='m925.8%20456.3c10.4%2023.2%2017%2048%2019.7%2073.3%202.6%2025.3%201.3%2050.9-4.1%2075.8-5.3%2024.9-14.5%2048.8-27.3%2070.8-8.4%2014.7-18.3%2028.5-29.7%2041.2-11.3%2012.6-23.9%2024-37.6%2034-13.8%2010-28.5%2018.4-44.1%2025.3-15.5%206.8-31.7%2012-48.3%2015.4-7.8%2024.2-19.4%2047.1-34.4%2067.7-14.9%2020.6-33%2038.7-53.6%2053.6-20.6%2015-43.4%2026.6-67.6%2034.4-24.2%207.9-49.5%2011.8-75%2011.8-16.9.1-33.9-1.7-50.5-5.1-16.5-3.5-32.7-8.8-48.2-15.7s-30.2-15.5-43.9-25.5c-13.6-10-26.2-21.5-37.4-34.2-25%205.4-50.6%206.7-75.9%204.1-25.3-2.7-50.1-9.3-73.4-19.7-23.2-10.3-44.7-24.3-63.6-41.4s-35-37.1-47.7-59.1c-8.5-14.7-15.5-30.2-20.8-46.3s-8.8-32.7-10.6-49.6c-1.8-16.8-1.7-33.8.1-50.7%201.8-16.8%205.5-33.4%2010.8-49.5-17-18.9-31-40.4-41.4-63.6-10.3-23.3-17-48-19.6-73.3-2.7-25.3-1.3-50.9%204-75.8s14.5-48.8%2027.3-70.8c8.4-14.7%2018.3-28.6%2029.6-41.2s24-24%2037.7-34%2028.5-18.5%2044-25.3c15.6-6.9%2031.8-12%2048.4-15.4%207.8-24.3%2019.4-47.1%2034.3-67.7%2015-20.6%2033.1-38.7%2053.7-53.7%2020.6-14.9%2043.4-26.5%2067.6-34.4%2024.2-7.8%2049.5-11.8%2075-11.7%2016.9-.1%2033.9%201.6%2050.5%205.1s32.8%208.7%2048.3%2015.6c15.5%207%2030.2%2015.5%2043.9%2025.5%2013.7%2010.1%2026.3%2021.5%2037.5%2034.2%2024.9-5.3%2050.5-6.6%2075.8-4s50%209.3%2073.3%2019.6c23.2%2010.4%2044.7%2024.3%2063.6%2041.4%2018.9%2017%2035%2036.9%2047.7%2059%208.5%2014.6%2015.5%2030.1%2020.8%2046.3%205.3%2016.1%208.9%2032.7%2010.6%2049.6%201.8%2016.9%201.8%2033.9-.1%2050.8-1.8%2016.9-5.5%2033.5-10.8%2049.6%2017.1%2018.9%2031%2040.3%2041.4%2063.6zm-333.2%20426.9c21.8-9%2041.6-22.3%2058.3-39s30-36.5%2039-58.4c9-21.8%2013.7-45.2%2013.7-68.8v-223q-.1-.3-.2-.7-.1-.3-.3-.6-.2-.3-.5-.5-.3-.3-.6-.4l-80.7-46.6v269.4c0%202.7-.4%205.5-1.1%208.1-.7%202.7-1.7%205.2-3.1%207.6s-3%204.6-5%206.5a32.1%2032.1%200%200%201%20-6.5%205l-191.1%20110.3c-1.6%201-4.3%202.4-5.7%203.2%207.9%206.7%2016.5%2012.6%2025.5%2017.8%209.1%205.2%2018.5%209.6%2028.3%2013.2%209.8%203.5%2019.9%206.2%2030.1%208%2010.3%201.8%2020.7%202.7%2031.1%202.7%2023.6%200%2047-4.7%2068.8-13.8zm-455.1-151.4c11.9%2020.5%2027.6%2038.3%2046.3%2052.7%2018.8%2014.4%2040.1%2024.9%2062.9%2031s46.6%207.7%2070%204.6%2045.9-10.7%2066.4-22.5l193.2-111.5.5-.5q.2-.2.3-.6.2-.3.3-.6v-94l-233.2%20134.9c-2.4%201.4-4.9%202.4-7.5%203.2-2.7.7-5.4%201-8.2%201-2.7%200-5.4-.3-8.1-1-2.6-.8-5.2-1.8-7.6-3.2l-191.1-110.4c-1.7-1-4.2-2.5-5.6-3.4-1.8%2010.3-2.7%2020.7-2.7%2031.1s1%2020.8%202.8%2031.1c1.8%2010.2%204.6%2020.3%208.1%2030.1%203.6%209.8%208%2019.2%2013.2%2028.2zm-50.2-417c-11.8%2020.5-19.4%2043.1-22.5%2066.5s-1.5%2047.1%204.6%2070c6.1%2022.8%2016.6%2044.1%2031%2062.9%2014.4%2018.7%2032.3%2034.4%2052.7%2046.2l193.1%20111.6q.3.1.7.2h.7q.4%200%20.7-.2.3-.1.6-.3l81-46.8-233.2-134.6c-2.3-1.4-4.5-3.1-6.5-5a32.1%2032.1%200%200%201%20-5-6.5c-1.3-2.4-2.4-4.9-3.1-7.6-.7-2.6-1.1-5.3-1-8.1v-227.1c-9.8%203.6-19.3%208-28.3%2013.2-9%205.3-17.5%2011.3-25.5%2018-7.9%206.7-15.3%2014.1-22%2022.1-6.7%207.9-12.6%2016.5-17.8%2025.5zm663.3%20154.4c2.4%201.4%204.6%203%206.6%205%201.9%201.9%203.6%204.1%205%206.5%201.3%202.4%202.4%205%203.1%207.6.6%202.7%201%205.4.9%208.2v227.1c32.1-11.8%2060.1-32.5%2080.8-59.7%2020.8-27.2%2033.3-59.7%2036.2-93.7s-3.9-68.2-19.7-98.5-39.9-55.5-69.5-72.5l-193.1-111.6q-.3-.1-.7-.2h-.7q-.3.1-.7.2-.3.1-.6.3l-80.6%2046.6%20233.2%20134.7zm80.5-121h-.1v.1zm-.1-.1c5.8-33.6%201.9-68.2-11.3-99.7-13.1-31.5-35-58.6-63-78.2-28-19.5-61-30.7-95.1-32.2-34.2-1.4-68%206.9-97.6%2023.9l-193.1%20111.5q-.3.2-.5.5l-.4.6q-.1.3-.2.7-.1.3-.1.7v93.2l233.2-134.7c2.4-1.4%205-2.4%207.6-3.2%202.7-.7%205.4-1%208.1-1%202.8%200%205.5.3%208.2%201%202.6.8%205.1%201.8%207.5%203.2l191.1%20110.4c1.7%201%204.2%202.4%205.6%203.3zm-505.3-103.2c0-2.7.4-5.4%201.1-8.1.7-2.6%201.7-5.2%203.1-7.6%201.4-2.3%203-4.5%205-6.5%201.9-1.9%204.1-3.6%206.5-4.9l191.1-110.3c1.8-1.1%204.3-2.5%205.7-3.2-26.2-21.9-58.2-35.9-92.1-40.2-33.9-4.4-68.3%201-99.2%2015.5-31%2014.5-57.2%2037.6-75.5%2066.4-18.3%2028.9-28%2062.3-28%2096.5v223q.1.4.2.7.1.3.3.6.2.3.5.6.2.2.6.4l80.7%2046.6zm43.8%20294.7%20103.9%2060%20103.9-60v-119.9l-103.8-60-103.9%2060z'/%3e%3c/svg%3e",Y5="data:image/svg+xml,%3csvg%20fill='none'%20height='1320'%20viewBox='3.771%206.973%2023.993%2017.652'%20width='2500'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='m27.501%208.469c-.252-.123-.36.111-.508.23-.05.04-.093.09-.135.135-.368.395-.797.652-1.358.621-.821-.045-1.521.213-2.14.842-.132-.776-.57-1.238-1.235-1.535-.349-.155-.701-.309-.944-.645-.171-.238-.217-.504-.303-.765-.054-.159-.108-.32-.29-.348-.197-.031-.274.135-.352.273-.31.567-.43%201.192-.419%201.825.028%201.421.628%202.554%201.82%203.36.136.093.17.186.128.321-.081.278-.178.547-.264.824-.054.178-.135.217-.324.14a5.448%205.448%200%200%201%20-1.719-1.169c-.848-.82-1.614-1.726-2.57-2.435-.225-.166-.449-.32-.681-.467-.976-.95.128-1.729.383-1.82.267-.096.093-.428-.77-.424s-1.653.293-2.659.677a2.782%202.782%200%200%201%20-.46.135%209.554%209.554%200%200%200%20-2.853-.1c-1.866.21-3.356%201.092-4.452%202.6-1.315%201.81-1.625%203.87-1.246%206.018.399%202.261%201.552%204.136%203.326%205.601%201.837%201.518%203.955%202.262%206.37%202.12%201.466-.085%203.1-.282%204.942-1.842.465.23.952.322%201.762.392.623.059%201.223-.031%201.687-.127.728-.154.677-.828.414-.953-2.132-.994-1.665-.59-2.09-.916%201.084-1.285%202.717-2.619%203.356-6.94.05-.343.007-.558%200-.837-.004-.168.034-.235.228-.254a4.084%204.084%200%200%200%201.529-.47c1.382-.757%201.938-1.997%202.07-3.485.02-.227-.004-.463-.243-.582zm-12.041%2013.391c-2.067-1.627-3.07-2.162-3.483-2.138-.387.021-.318.465-.233.754.089.285.205.482.368.732.113.166.19.414-.112.598-.666.414-1.823-.139-1.878-.166-1.347-.793-2.473-1.842-3.267-3.276-.765-1.38-1.21-2.861-1.284-4.441-.02-.383.093-.518.472-.586a4.692%204.692%200%200%201%201.514-.04c2.109.31%203.905%201.255%205.41%202.749.86.853%201.51%201.871%202.18%202.865.711%201.057%201.478%202.063%202.454%202.887.343.289.619.51.881.672-.792.088-2.117.107-3.022-.61zm.99-6.38a.304.304%200%201%201%20.609%200c0%20.17-.136.304-.306.304a.3.3%200%200%201%20-.303-.305zm3.077%201.581c-.197.08-.394.15-.584.159a1.246%201.246%200%200%201%20-.79-.252c-.27-.227-.463-.354-.546-.752a1.752%201.752%200%200%201%20.016-.582c.07-.324-.008-.531-.235-.72-.187-.155-.422-.196-.682-.196a.551.551%200%200%201%20-.252-.078c-.108-.055-.197-.19-.112-.356.027-.053.159-.183.19-.207.352-.201.758-.135%201.134.016.349.142.611.404.99.773.388.448.457.573.678.906.174.264.333.534.441.842.066.192-.02.35-.248.448z'%20fill='%234d6bfe'/%3e%3c/svg%3e",X5="/assets/minimax-BPMzvuL-.jpeg",Q5="/assets/alibaba-TTwafVwX.svg",ej="/assets/qwen-CONDcHqt.png",tj="/assets/zhipuai-BPNAnxo-.svg",nj={"claude-":"anthropic","gpt-":"openai","o1-":"openai","o3-":"openai","deepseek-":"deepseek",MiniMax:"minimax",qwen:"qwen","glm-":"zhipuai"};function Ph(e){if(e===null)return"unknown";const t=e.toLowerCase();for(const[n,r]of Object.entries(nj))if(t.startsWith(n.toLowerCase()))return r;return"unknown"}const En={width:24,height:24,objectFit:"contain"},rj=at.memo(({className:e})=>l.jsx("img",{src:J5,alt:"Anthropic",className:e,style:En})),oj=at.memo(({className:e})=>l.jsx("img",{src:G5,alt:"OpenAI",className:e,style:{...En,background:"white",borderRadius:"4px"}})),sj=at.memo(({className:e})=>l.jsx("img",{src:Y5,alt:"DeepSeek",className:e,style:En})),ij=at.memo(({className:e})=>l.jsx("img",{src:X5,alt:"MiniMax",className:e,style:En})),aj=at.memo(({className:e})=>l.jsx("img",{src:Q5,alt:"Alibaba",className:e,style:En})),lj=at.memo(({className:e})=>l.jsx("img",{src:ej,alt:"Qwen",className:e,style:En})),cj=at.memo(({className:e})=>l.jsx("img",{src:tj,alt:"ZhipuAI",className:e,style:En}));function Oh({provider:e,className:t}){switch(e){case"anthropic":return l.jsx(rj,{className:t});case"openai":return l.jsx(oj,{className:t});case"deepseek":return l.jsx(sj,{className:t});case"minimax":return l.jsx(ij,{className:t});case"alibaba":return l.jsx(aj,{className:t});case"qwen":return l.jsx(lj,{className:t});case"zhipuai":return l.jsx(cj,{className:t});case"unknown":return null}}function Xe({delayDuration:e=0,...t}){return l.jsx(y5,{"data-slot":"tooltip-provider",delayDuration:e,...t})}function De({...e}){return l.jsx(b5,{"data-slot":"tooltip",...e})}function Fe({...e}){return l.jsx(v5,{"data-slot":"tooltip-trigger",...e})}function $e({className:e,sideOffset:t=0,children:n,...r}){return l.jsx(w5,{children:l.jsxs(k5,{"data-slot":"tooltip-content",sideOffset:t,className:be("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,l.jsx(_5,{className:"bg-foreground fill-foreground z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px]"})]})})}function Ba(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 uj="x-anthropic-billing-header:";function dj(e){return e.trimStart().toLowerCase().startsWith(uj)}function fj(e){return Ba(e)?Object.prototype.hasOwnProperty.call(e,"system"):!1}function pj(e){if(!Ba(e))return!1;const t=Oe(e,"type"),n=Oe(e,"text");return typeof t!="string"||t!=="text"||typeof n!="string"?!1:dj(n)}function hj(e){let t;try{t=JSON.parse(e)}catch{return{body:e,removed:0}}if(!fj(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(pj(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 mj(e){return{depth:Number.POSITIVE_INFINITY}}function Mh(e){try{const t=JSON.parse(e);return{kind:"json",data:Fo(t)}}catch{return{kind:"text"}}}function Ds(e){const t=b.useMemo(()=>e===null?null:Mh(e),[e]),n=t?.kind==="json"?t.data:null,r=b.useMemo(()=>n===null?null:mj(),[n]),[o,s]=b.useState(!1),[i,a]=b.useState(0),[c,u]=b.useState(0),[d,f]=b.useTransition(),h=b.useCallback(()=>{const p=!o,x=p&&r!==null?r.depth:0;f(()=>{s(p),a(x),u(m=>m+1)})},[o,r]);return{parsedData:n,policy:r,isExpanded:o,toggle:h,isPending:d,bulkDepth:i,bulkRevision:c}}function Fo(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=>Fo(n));const t={};for(const n of Object.keys(e)){const r=Object.getOwnPropertyDescriptor(e,n);t[n]=Fo(r?.value)}return t}case"bigint":case"symbol":case"function":case"undefined":return String(e)}return null}function Lh({className:e,orientation:t="horizontal",...n}){return l.jsx(QC,{"data-slot":"tabs","data-orientation":t,orientation:t,className:be("group/tabs flex gap-2 data-[orientation=horizontal]:flex-col",e),...n})}const gj=pa("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 Dh({className:e,variant:t="default",...n}){return l.jsx(e5,{"data-slot":"tabs-list","data-variant":t,className:be(gj({variant:t}),e),...n})}function St({className:e,...t}){return l.jsx(t5,{"data-slot":"tabs-trigger",className:be("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 Ct({className:e,...t}){return l.jsx(n5,{"data-slot":"tabs-content",className:be("flex-1 outline-none",e),...t})}function gn(e){const[t,n]=b.useState(!1),r=b.useRef(null);b.useEffect(()=>()=>{r.current!==null&&clearTimeout(r.current)},[]);const o=b.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 xj=b.lazy(()=>Sn(()=>import("./CompareDrawer-ztKMd-FE.js"),__vite__mapDeps([0,1])).then(e=>({default:e.CompareDrawer}))),yj=b.lazy(()=>Sn(()=>import("./ReplayDialog-RNhfLSsW.js"),__vite__mapDeps([2,1,3])).then(e=>({default:e.ReplayDialog}))),bj=b.lazy(()=>Sn(()=>import("./RequestAnatomy-fsUI5HhH.js"),__vite__mapDeps([4,1])).then(e=>({default:e.RequestAnatomy}))),vj=b.lazy(()=>Sn(()=>import("./ResponseView-B3YTDBBX.js"),__vite__mapDeps([3,1])).then(e=>({default:e.ResponseView}))),wj=b.lazy(()=>Sn(()=>import("./StreamingChunkSequence-CbGqQ0mO.js"),__vite__mapDeps([5,1])).then(e=>({default:e.StreamingChunkSequence}))),mc=b.lazy(()=>Sn(()=>Promise.resolve().then(()=>Im),void 0).then(e=>({default:e.JsonViewer}))),kj=b.lazy(()=>Sn(()=>Promise.resolve().then(()=>Im),void 0).then(e=>({default:e.JsonViewerFromString}))),_j=1200,Sj=12;function Cj(e){const{containerRef:t,setExpandToPath:n,ensureTabActive:r,highlightMs:o}=e,s=b.useRef(null);return b.useCallback(i=>{r?.(),n(i.path);const a=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??_j)},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){a(p);return}}f>0?window.requestAnimationFrame(()=>d(f-1)):n(null)};window.requestAnimationFrame(()=>d(Sj))},[t,r,o,n])}class Fh{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),a=this.removeEmpty(this.tokenize(s,r)),c=this.removeEmpty(this.tokenize(i,r));return this.diffWithOptionsObj(a,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},a=n.length,c=t.length;let u=1,d=a+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>=a)return i(this.buildValues(p[0].lastComponent,n,t));let m=-1/0,g=1/0;const y=()=>{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 I=C.oldPos-v;j=C&&0<=I&&I<a}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>=a)return i(this.buildValues(k.lastComponent,n,t))||!0;p[v]=k,k.oldPos+1>=c&&(g=Math.min(g,v-1)),x+1>=a&&(m=Math.max(m,v+1))}u++};if(o)(function v(){setTimeout(function(){if(u>d||Date.now()>h)return o(void 0);y()||v()},0)})();else for(;u<=d&&Date.now()<=h;){const v=y();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,a=r.length;let c=t.oldPos,u=c-o,d=0;for(;u+1<i&&c+1<a&&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 a=0,c=0,u=0;for(;a<i;a++){const d=o[a];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 jj extends Fh{constructor(){super(...arguments),this.tokenize=Bh}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 Ej=new jj;function $h(e,t,n){return Ej.diff(e,t,n)}function Bh(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 Nj extends Fh{constructor(){super(...arguments),this.tokenize=Bh}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(Ai(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 Tj=new Nj;function Aj(e,t,n){return Tj.diff(e,t,n)}function Ai(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]=Ai(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 a=[];let c;for(c in e)Object.prototype.hasOwnProperty.call(e,c)&&a.push(c);for(a.sort(),s=0;s<a.length;s+=1)c=a[s],i[c]=Ai(e[c],t,n,r,c);t.pop(),n.pop()}else i=e;return i}function gc(e){return e===void 0?[]:Object.entries(e).map(t=>[t[0].toLowerCase(),t[1]]).sort(([t],[n])=>t.localeCompare(n))}function xc([e,t]){return`${e}: ${t}`}function Ii(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 Ij(e,t){const n=gc(e).map(xc).join(`
|
|
92
|
-
`),r=gc(t).map(xc).join(`
|
|
93
|
-
`);if(n===r)return{lines:[],isEmpty:!0};const o=$h(n,r);return{lines:Ii(o),isEmpty:!1}}function yc(e){try{const t=JSON.parse(e);return t===null||typeof t=="string"||typeof t=="object"?t:null}catch{return null}}function zj(e,t){const n=e??"",r=t??"";if(n===r)return{lines:[],isEmpty:!0};const o=yc(n),s=yc(r);if(o!==null&&s!==null){const a=Aj(o,s)??[];if(a.length===1){const c=a[0];if(c!==void 0&&!c.added&&!c.removed)return{lines:[],isEmpty:!0}}return{lines:Ii(a),isEmpty:!1}}const i=$h(n,r);return{lines:Ii(i),isEmpty:!1}}function Rj(e,t,n){const r=new Array(e);return new Proxy(r,{get(o,s,i){if(typeof s=="string"){const a=s.charCodeAt(0);if(a>=48&&a<=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 Rn(e,t,n){let r=n.initialDeps??[],o,s=!0;function i(){const a=e();return(a.length!==r.length||a.some((u,d)=>r[d]!==u))&&(r=a,o=t(...a),n?.onChange&&!(s&&n.skipInitialOnChange)&&n.onChange(o),s=!1),o}return i.updateDeps=a=>{r=a},i}function bc(e,t){if(e===void 0)throw new Error("Unexpected undefined");return e}const vc=(e,t)=>Math.abs(e-t)<1.01,Pj=(e,t,n)=>{let r;return function(...o){e.clearTimeout(r),r=e.setTimeout(()=>t.apply(this,o),n)}};let ur;const wc=()=>{if(ur!==void 0)return ur;if(typeof navigator>"u")return ur=!1;if(/iP(hone|od|ad)/.test(navigator.userAgent))return ur=!0;const e=navigator.maxTouchPoints;return ur=navigator.platform==="MacIntel"&&e!==void 0&&e>0},kc=e=>{const{offsetWidth:t,offsetHeight:n}=e;return{width:t,height:n}},Oj=e=>e,Mj=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},Lj=(e,t)=>{const n=e.scrollElement;if(!n)return;const r=e.targetWindow;if(!r)return;const o=i=>{const{width:a,height:c}=i;t({width:Math.round(a),height:Math.round(c)})};if(o(kc(n)),!r.ResizeObserver)return()=>{};const s=new r.ResizeObserver(i=>{const a=()=>{const c=i[0];if(c?.borderBoxSize){const u=c.borderBoxSize[0];if(u){o({width:u.inlineSize,height:u.blockSize});return}}o(kc(n))};e.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(a):a()});return s.observe(n,{box:"border-box"}),()=>{s.unobserve(n)}},Rr={passive:!0},Dj=(e,t)=>{const n=e.scrollElement;if(!n)return;const r=()=>{t({width:n.innerWidth,height:n.innerHeight})};return r(),n.addEventListener("resize",r,Rr),()=>{n.removeEventListener("resize",r)}},Fj=typeof window>"u"?!0:"onscrollend"in window,Uh=(e,t,n)=>{const r=e.scrollElement;if(!r)return;const o=e.targetWindow;if(!o)return;const s=e.options.useScrollendEvent&&Fj;let i=0;const a=s?null:Pj(o,()=>t(i,!1),e.options.isScrollingResetDelay),c=f=>()=>{i=n(r),a?.(),t(i,f)},u=c(!0),d=c(!1);return r.addEventListener("scroll",u,Rr),s&&r.addEventListener("scrollend",d,Rr),()=>{r.removeEventListener("scroll",u),s&&r.removeEventListener("scrollend",d)}},$j=(e,t)=>Uh(e,t,n=>{const{horizontal:r,isRtl:o}=e.options;return r?n.scrollLeft*(o&&-1||1):n.scrollTop}),Bj=(e,t)=>Uh(e,t,n=>e.options.horizontal?n.scrollX:n.scrollY),Uj=(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"]},Vh=(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})},Vj=Vh,Hj=Vh;class Wj{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 a=s.target,c=this.indexFromElement(a);if(!a.isConnected){this.observer.unobserve(a);for(const[u,d]of this.elementsCache)if(d===a){this.elementsCache.delete(u);break}return}this.shouldMeasureDuringScroll(c)&&this.resizeItem(c,this.options.measureElement(a,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:Oj,rangeExtractor:Mj,onChange:()=>{},measureElement:Uj,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 a=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&&(a=[g.key,this.getScrollOffset()-g.start]);const y=s.followOnAppend===!0?"auto":s.followOnAppend||null;y&&d>u&&this.isAtEnd(i.scrollEndThreshold)&&(u===0||s.getItemKey(d-1)!==p)&&(c=y)}}this.options=s,(a||c)&&(this.pendingScrollAnchor=[a?.[0]??null,a?.[1]??0,c])},this.notify=n=>{var r,o;(o=(r=this.options).onChange)==null||o.call(r,this,n)},this.maybeNotify=Rn(()=>(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)},a=()=>{this._iosTouching=!1,!(!wc()||this.targetWindow==null)&&(this._iosJustTouchEnded=!0,this._iosTouchEndTimerId=this.targetWindow.setTimeout(()=>{this._iosJustTouchEnded=!1,this._iosTouchEndTimerId=null,this._flushIosDeferredIfReady()},150))};s.addEventListener("touchstart",i,Rr),s.addEventListener("touchend",a,Rr),this.unsubs.push(()=>{s.removeEventListener("touchstart",i),s.removeEventListener("touchend",a),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,a]=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();vc(h,0)||this.applyScrollAdjustment(h)}}a&&this.scrollToEnd({behavior:a})}},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 a=n[i];if(o.has(a.lane))continue;const c=s.get(a.lane);if(c==null||a.end>c.end?s.set(a.lane,a):a.end<c.end&&o.set(a.lane,!0),o.size===this.options.lanes)break}return s.size===this.options.lanes?Array.from(s.values()).sort((i,a)=>i.end===a.end?i.index-a.index:i.end-a.end)[0]:void 0},this.getMeasurementOptions=Rn(()=>[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,a,c)=>(this.prevLanes!==void 0&&this.prevLanes!==a&&(this.lanesChangedFlag=!0),this.prevLanes=a,this.pendingMin=null,{count:n,paddingStart:r,scrollMargin:o,getItemKey:s,enabled:i,lanes:a,laneAssignmentMode:c}),{key:!1}),this.getMeasurements=Rn(()=>[this.getMeasurementOptions(),this.itemSizeCacheVersion],({count:n,paddingStart:r,scrollMargin:o,getItemKey:s,enabled:i,lanes:a,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),a===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 y;if(f===0)y=r+o;else{const k=f-1;y=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]=y,g[k*2+1]=j,y+=j+x}const v=Rj(n,g,s);return this.measurementsCache=v,v}const h=this.measurementsCache.slice(0,f),p=new Array(a).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 y,v;const k=c==="estimate"||d.has(m);if(g!==void 0&&this.options.lanes>1){y=g;const N=p[y],I=N!==void 0?h[N]:void 0;v=I?I.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,y=N?N.lane:x%this.options.lanes,this.options.lanes>1&&k&&this.laneAssignments.set(x,y)}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:y},p[y]=x}return this.measurementsCache=h,h},{key:!1,debug:()=>this.options.debug}),this.calculateRange=Rn(()=>[this.getMeasurements(),this.getSize(),this.getScrollOffset(),this.options.lanes],(n,r,o,s)=>this.range=n.length>0&&r>0?Zj({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=Rn(()=>{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),a=Math.min(this.options.count-1,o+s);return n>=i&&n<=a}return!0},this.measureElement=n=>{if(!n){this.elementsCache.forEach((i,a)=>{i.isConnected||(this.observer.unobserve(i),this.elementsCache.delete(a))});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,a,c;const u=this._flatMeasurements;if(this.options.lanes===1&&u!==null)c=this.options.getItemKey(n),a=u[n*2],i=u[n*2+1];else{const h=this.measurementsCache[n];if(!h)return;c=h.key,a=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:a,size:i,end:a+i,lane:0},f,this):a<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=Rn(()=>[this.getVirtualIndexes(),this.getMeasurements()],(n,r)=>{const o=[];for(let s=0,i=n.length;s<i;s++){const a=n[s],c=r[a];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=Hh(0,r.length-1,s?a=>o[a*2]:a=>bc(r[a]).start,n);return bc(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 a=this.getMaxScrollOffset();return Math.max(Math.min(a,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 a=r==="end"?i.end+this.options.scrollPaddingEnd:i.start-this.options.scrollPaddingStart;return[this.getOffsetForAlignment(a,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,a]=s,c=this.now();this.scrollState={index:n,align:a,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(a=>a===null);){const a=r[i];s[a.lane]===null&&(s[a.lane]=a.end),i--}o=Math.max(...s.filter(a=>a!==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&&(wc()&&(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&&vc(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 a=this.getSize()||600,c=Math.abs(o-this.getScrollOffset()),u=this.scrollState.behavior==="smooth"&&c>a;this.scrollState.lastTargetOffset=o,u||(this.scrollState.behavior="auto"),this._scrollToOffset(o,{adjustments:void 0,behavior:u?"smooth":"auto"})}this.scheduleScrollReconcile()}}const Hh=(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 Zj({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,a=o?d=>o[d*2]+o[d*2+1]:d=>e[d].end;if(e.length<=r)return{startIndex:0,endIndex:s};let c=Hh(0,s,i,n),u=c;if(r===1)for(;u<s&&a(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 _c=typeof document<"u"?b.useLayoutEffect:b.useEffect;function Wh({useFlushSync:e=!0,...t}){const n=b.useReducer(s=>s+1,0)[1],r={...t,onChange:(s,i)=>{var a;e&&i?Mr.flushSync(n):n(),(a=t.onChange)==null||a.call(t,s,i)}},[o]=b.useState(()=>new Wj(r));return o.setOptions(r),_c(()=>o._didMount(),[]),_c(()=>o._willUpdate()),o}function qj(e){return Wh({observeElementRect:Lj,observeElementOffset:$j,scrollToFn:Hj,...e})}function Kj(e){return Wh({getScrollElement:()=>typeof document<"u"?window:null,observeElementRect:Dj,observeElementOffset:Bj,scrollToFn:Vj,initialOffset:()=>typeof document<"u"?window.scrollY:0,...e})}const Jj=22,Fs=1e4;function Gj(e){return e==="added"?"+":e==="removed"?"-":" "}function Yj(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 Xj=function({result:t,emptyLabel:n}){const[r,o]=b.useState("unified"),s=b.useRef(null),i=qj({count:t.lines.length,getScrollElement:()=>s.current,estimateSize:()=>Jj,overscan:10});if(t.isEmpty)return l.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 a=t.lines.length,c=a>Fs,u=c?t.lines.slice(0,Fs):t.lines;return l.jsxs("div",{className:"space-y-2",children:[l.jsxs("div",{className:"flex items-center justify-between text-xs text-muted-foreground",children:[l.jsxs("span",{children:[a.toLocaleString()," line",a===1?"":"s",c&&` (showing first ${Fs.toLocaleString()})`]}),l.jsxs("div",{className:"inline-flex rounded-md border border-border overflow-hidden",children:[l.jsxs("button",{type:"button",onClick:()=>o("unified"),"aria-pressed":r==="unified",className:be("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:[l.jsx(n2,{className:"size-3"}),"Unified"]}),l.jsxs("button",{type:"button",onClick:()=>o("split"),"aria-pressed":r==="split",className:be("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:[l.jsx(hv,{className:"size-3"}),"Split"]})]})]}),l.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"?l.jsx(Qj,{virtualizer:i,lines:u}):l.jsx(nE,{lines:u})})]})};function Qj({virtualizer:e,lines:t}){return l.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:l.jsxs("div",{"data-index":n.index,ref:e.measureElement,className:be("flex items-start gap-3 px-2",Yj(r.kind)),style:{position:"absolute",top:0,left:0,width:"100%",transform:`translateY(${n.start}px)`},children:[l.jsx("span",{className:"select-none text-muted-foreground/60 w-10 text-right tabular-nums",children:r.oldLineNumber??""}),l.jsx("span",{className:"select-none text-muted-foreground/60 w-10 text-right tabular-nums",children:r.newLineNumber??""}),l.jsx("span",{className:be("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:Gj(r.kind)}),l.jsx("span",{className:"whitespace-pre-wrap break-all flex-1",children:r.text})]},n.key)})})}function eE(e){const t=[];let n=0;for(;n<e.length;){const r=e[n];if(r===void 0)break;if(r.kind==="context"){t.push({left:{text:r.text,lineNumber:r.oldLineNumber},right:{text:r.text,lineNumber:r.newLineNumber},kind:"equal"}),n+=1;continue}const o=[],s=[];for(;n<e.length&&e[n]?.kind==="removed";){const a=e[n];a!==void 0&&o.push(a),n+=1}for(;n<e.length&&e[n]?.kind==="added";){const a=e[n];a!==void 0&&s.push(a),n+=1}const i=Math.max(o.length,s.length);for(let a=0;a<i;a+=1){const c=o[a],u=s[a];c!==void 0&&u!==void 0?t.push({left:{text:c.text,lineNumber:c.oldLineNumber},right:{text:u.text,lineNumber:u.newLineNumber},kind:"changed"}):c!==void 0?t.push({left:{text:c.text,lineNumber:c.oldLineNumber},right:null,kind:"removed"}):u!==void 0&&t.push({left:null,right:{text:u.text,lineNumber:u.newLineNumber},kind:"added"})}}return t}function tE(e){switch(e){case"changed":return"bg-amber-500/10";case"removed":return"bg-red-500/10";case"added":return"bg-green-500/10";case"equal":return""}}function nE({lines:e}){const t=eE(e);return l.jsx("div",{"data-testid":"diff-split",children:t.map((n,r)=>l.jsxs("div",{className:be("grid grid-cols-2 font-mono text-xs",tE(n.kind)),children:[l.jsxs("div",{className:"flex items-start gap-2 px-2 border-r border-border/50",children:[l.jsx("span",{className:"select-none text-muted-foreground/60 w-8 text-right tabular-nums",children:n.left?.lineNumber??""}),l.jsx("span",{className:be("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?"-":" "}),l.jsx("span",{className:"whitespace-pre-wrap break-all flex-1",children:n.left?.text??""})]}),l.jsxs("div",{className:"flex items-start gap-2 px-2",children:[l.jsx("span",{className:"select-none text-muted-foreground/60 w-8 text-right tabular-nums",children:n.right?.lineNumber??""}),l.jsx("span",{className:be("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?"+":" "}),l.jsx("span",{className:"whitespace-pre-wrap break-all flex-1",children:n.right?.text??""})]})]},r))})}const Zh=b.memo(Xj),rE={success:"bg-emerald-500/15 text-emerald-400 border-emerald-500/25",client_error:"bg-amber-500/15 text-amber-400 border-amber-500/25",server_error:"bg-rose-500/15 text-rose-400 border-rose-500/25",pending:"bg-muted text-muted-foreground border-border"};function $s(e){return e<1e3?`${e}ms`:`${(e/1e3).toFixed(1)}s`}function Sc({trend:e}){if(e===null)return null;const t=e.direction==="up",n=t?Vb:Lb,r=t?"+":"-";return l.jsxs("span",{className:"flex items-center gap-0.5 text-muted-foreground tabular-nums",children:[l.jsx(n,{className:t?"size-3 text-emerald-400":"size-3 text-rose-400"}),l.jsxs("span",{className:"font-mono",children:[r,Ve(e.delta)]})]})}const oE=b.memo(function({log:e,messageCount:t=null,toolCount:n=null,expanded:r,onToggle:o,cacheTrend:s=null,activeTab:i,tabActions:a,onReplay:c,slowResponseThresholdSeconds:u=0,timeDisplayFormat:d}){const f=Tw(e.responseStatus),h=e.elapsedMs!==null&&u>0&&e.elapsedMs>u*1e3,p=e.inputTokens!==null||e.outputTokens!==null;return l.jsx(Xe,{children:l.jsxs("div",{id:`log-${e.id}`,role:"button",tabIndex:0,"data-nav-id":`log-${e.id}`,"data-nav-action":r?"collapse":"expand",className:be("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:[l.jsxs("span",{className:"text-blue-400/80 font-mono text-xs font-semibold tabular-nums shrink-0",children:["#",e.id]}),l.jsxs("span",{className:"flex items-center gap-1 text-muted-foreground text-xs shrink-0",children:[l.jsx(on,{className:"size-3"}),l.jsx("span",{className:"font-mono tabular-nums",title:e.timestamp,children:hi(e.timestamp,d)})]}),e.model!==null&&l.jsxs(De,{children:[l.jsx(Fe,{asChild:!0,children:l.jsx("span",{className:"shrink-0",children:l.jsx(Oh,{provider:Ph(e.model),className:"size-4"})})}),l.jsx($e,{children:e.model})]}),f!=="success"&&l.jsxs(jt,{variant:"outline",className:be("text-[10px] px-1.5 py-0 h-5 font-mono tabular-nums gap-1",rE[f]),children:[f==="server_error"?l.jsx(Zv,{className:"size-3","aria-label":"Server error"}):f==="client_error"?l.jsx(Eo,{className:"size-3","aria-label":"Client error"}):f==="pending"?l.jsx(Nr,{className:"size-3 animate-spin","aria-label":"Pending"}):null,e.responseStatus]}),e.elapsedMs!==null&&l.jsxs(De,{children:[l.jsx(Fe,{asChild:!0,children:l.jsxs("span",{className:be("flex items-center gap-1 text-xs shrink-0",h?"text-amber-400":"text-muted-foreground"),children:[l.jsx(on,{className:"size-3"}),l.jsx("span",{className:"font-mono tabular-nums",children:$s(e.elapsedMs)}),h&&l.jsx(Eo,{className:"size-3","aria-label":"Slow response"})]})}),l.jsx($e,{children:h?`Slow response: ${$s(e.elapsedMs)} exceeds ${$s(u*1e3)}`:"Elapsed response time"})]}),p&&l.jsxs("span",{className:"flex items-center gap-1 text-xs shrink-0",children:[l.jsx(Tr,{className:"size-3 text-muted-foreground"}),l.jsxs("span",{className:"font-mono tabular-nums",children:[l.jsxs("span",{className:e.inputTokens!==null?"text-blue-400":"text-muted-foreground",children:["IN ",e.inputTokens!==null?Ve(e.inputTokens):"—"]})," / ",l.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&&l.jsxs("span",{className:"flex items-center gap-1 text-xs shrink-0",children:[l.jsx(Sc,{trend:s?.creation??null}),l.jsxs("span",{className:"font-mono tabular-nums text-emerald-400",children:["KV Cache +",Ve(e.cacheCreationInputTokens)]})]}),e.cacheReadInputTokens!==null&&e.cacheReadInputTokens>0&&l.jsxs("span",{className:"flex items-center gap-1 text-xs shrink-0",children:[l.jsx(Sc,{trend:s?.read??null}),l.jsxs("span",{className:"font-mono tabular-nums text-purple-400",children:["KV Cache ~",Ve(e.cacheReadInputTokens)]})]}),t!==null&&l.jsxs("span",{className:"flex items-center gap-1 text-muted-foreground text-xs shrink-0",children:[l.jsx(Jo,{className:"size-3"}),l.jsx("span",{className:"font-mono tabular-nums",children:t})]}),n!==null&&l.jsxs("span",{className:"flex items-center gap-1 text-muted-foreground text-xs shrink-0",children:[l.jsx(Dr,{className:"size-3"}),l.jsx("span",{className:"font-mono tabular-nums",children:n})]}),e.origin!==null&&l.jsxs("span",{className:"hidden xl:flex items-center gap-1 text-muted-foreground text-xs shrink-0",title:`Origin: ${e.origin}`,children:[l.jsx(Hd,{className:"size-3"}),l.jsx("span",{className:"font-mono tabular-nums truncate max-w-[120px]",title:e.origin,children:e.origin})]}),(e.clientPid!==null||e.clientProjectFolder!==null)&&l.jsxs(De,{children:[l.jsx(Fe,{asChild:!0,children:l.jsxs("span",{className:"hidden xl:flex items-center gap-1 text-purple-400/80 text-xs shrink-0",children:[l.jsx(Ev,{className:"size-3"}),e.clientProjectFolder!==null?l.jsx("span",{className:"font-mono tabular-nums",children:e.clientProjectFolder}):l.jsxs("span",{className:"font-mono tabular-nums",children:["PID ",e.clientPid]})]})}),l.jsx($e,{children:e.clientCwd!==null?`PID: ${e.clientPid??"?"} CWD: ${e.clientCwd}`:`Process ID: ${e.clientPid??"?"}`})]}),e.streaming&&l.jsxs(De,{children:[l.jsx(Fe,{asChild:!0,children:l.jsx(Gv,{className:"size-3 text-muted-foreground/60 shrink-0"})}),l.jsx($e,{children:"Request used SSE streaming"})]}),l.jsx("span",{className:"flex-1 min-w-0"}),r&&l.jsxs("span",{className:"flex items-center gap-1.5 shrink-0",onClick:x=>x.stopPropagation(),onKeyDown:x=>x.stopPropagation(),children:[a!==void 0&&i!==void 0&&(()=>{const x=a[i];return x===void 0?null:l.jsxs(l.Fragment,{children:[x.expansion!==null&&l.jsxs(De,{children:[l.jsx(Fe,{asChild:!0,children:l.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?l.jsx(ev,{className:"size-3.5"}):l.jsx(Bd,{className:"size-3.5"})})}),l.jsx($e,{children:x.expansion.isExpanded?"Collapse all JSON nodes":"Expand all JSON nodes"})]}),x.diffWithRaw!==void 0&&l.jsxs(De,{children:[l.jsx(Fe,{asChild:!0,children:l.jsx(Re,{variant:"outline",size:"icon",className:be("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:l.jsx(_v,{className:"size-3.5"})})}),l.jsx($e,{children:x.diffWithRaw.active?"Hide diff with raw request":"Show diff between displayed and raw request body"})]}),x.diffWithPrevious!==void 0&&l.jsxs(De,{children:[l.jsx(Fe,{asChild:!0,children:l.jsx(Re,{variant:"outline",size:"icon",className:"size-8",onClick:x.diffWithPrevious,"aria-label":"Diff with previous",children:l.jsx(Mv,{className:"size-3.5"})})}),l.jsx($e,{children:"Compare this request with the immediately preceding one"})]}),x.copyText!==null&&l.jsxs(De,{children:[l.jsx(Fe,{asChild:!0,children:l.jsx(Re,{variant:"outline",size:"icon",className:"size-8",onClick:x.onCopy,"aria-label":x.copyCopied?"Copied":x.copyLabel,children:x.copyCopied?l.jsx(ct,{className:"size-3.5 text-emerald-500"}):l.jsx(Ft,{className:"size-3.5"})})}),l.jsx($e,{children:x.copyCopied?"Copied to clipboard":x.copyLabel})]})]})})(),c!==void 0&&l.jsxs(De,{children:[l.jsx(Fe,{asChild:!0,children:l.jsx(Re,{variant:"outline",size:"icon",className:"size-8",onClick:c,"aria-label":"Replay request",children:l.jsx(Qv,{className:"size-3.5"})})}),l.jsx($e,{children:"Re-send this request to the provider"})]})]}),r?l.jsx(Yt,{className:"size-4 text-muted-foreground shrink-0"}):l.jsx(un,{className:"size-4 text-muted-foreground shrink-0"})]})})});function sE({...e}){return l.jsx(rk,{"data-slot":"collapsible",...e})}function HR({...e}){return l.jsx(bf,{"data-slot":"collapsible-trigger",...e})}function iE({...e}){return l.jsx(vf,{"data-slot":"collapsible-content",...e})}function aE(e,t){const n={};return(e[e.length-1]===""?[...e,""]:e).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const lE=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,cE=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,uE={};function Cc(e,t){return(uE.jsx?cE:lE).test(e)}const dE=/[ \t\n\f\r]/g;function fE(e){return typeof e=="object"?e.type==="text"?jc(e.value):!1:jc(e)}function jc(e){return e.replace(dE,"")===""}class Ur{constructor(t,n,r){this.normal=n,this.property=t,r&&(this.space=r)}}Ur.prototype.normal={};Ur.prototype.property={};Ur.prototype.space=void 0;function qh(e,t){const n={},r={};for(const o of e)Object.assign(n,o.property),Object.assign(r,o.normal);return new Ur(n,r,t)}function zi(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 pE=0;const Ee=Nn(),Ye=Nn(),Ri=Nn(),ce=Nn(),Be=Nn(),Vn=Nn(),pt=Nn();function Nn(){return 2**++pE}const Pi=Object.freeze(Object.defineProperty({__proto__:null,boolean:Ee,booleanish:Ye,commaOrSpaceSeparated:pt,commaSeparated:Vn,number:ce,overloadedBoolean:Ri,spaceSeparated:Be},Symbol.toStringTag,{value:"Module"})),Bs=Object.keys(Pi);class Ua extends dt{constructor(t,n,r,o){let s=-1;if(super(t,n),Ec(this,"space",o),typeof r=="number")for(;++s<Bs.length;){const i=Bs[s];Ec(this,Bs[s],(r&Pi[i])===Pi[i])}}}Ua.prototype.defined=!0;function Ec(e,t,n){n&&(e[t]=n)}function sr(e){const t={},n={};for(const[r,o]of Object.entries(e.properties)){const s=new Ua(r,e.transform(e.attributes||{},r),o,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(s.mustUseProperty=!0),t[r]=s,n[zi(r)]=r,n[zi(s.attribute)]=r}return new Ur(t,n,e.space)}const Kh=sr({properties:{ariaActiveDescendant:null,ariaAtomic:Ye,ariaAutoComplete:null,ariaBusy:Ye,ariaChecked:Ye,ariaColCount:ce,ariaColIndex:ce,ariaColSpan:ce,ariaControls:Be,ariaCurrent:null,ariaDescribedBy:Be,ariaDetails:null,ariaDisabled:Ye,ariaDropEffect:Be,ariaErrorMessage:null,ariaExpanded:Ye,ariaFlowTo:Be,ariaGrabbed:Ye,ariaHasPopup:null,ariaHidden:Ye,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:Be,ariaLevel:ce,ariaLive:null,ariaModal:Ye,ariaMultiLine:Ye,ariaMultiSelectable:Ye,ariaOrientation:null,ariaOwns:Be,ariaPlaceholder:null,ariaPosInSet:ce,ariaPressed:Ye,ariaReadOnly:Ye,ariaRelevant:null,ariaRequired:Ye,ariaRoleDescription:Be,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 Jh(e,t){return t in e?e[t]:t}function Gh(e,t){return Jh(e,t.toLowerCase())}const hE=sr({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:Vn,acceptCharset:Be,accessKey:Be,action:null,allow:null,allowFullScreen:Ee,allowPaymentRequest:Ee,allowUserMedia:Ee,alt:null,as:null,async:Ee,autoCapitalize:null,autoComplete:Be,autoFocus:Ee,autoPlay:Ee,blocking:Be,capture:null,charSet:null,checked:Ee,cite:null,className:Be,cols:ce,colSpan:null,content:null,contentEditable:Ye,controls:Ee,controlsList:Be,coords:ce|Vn,crossOrigin:null,data:null,dateTime:null,decoding:null,default:Ee,defer:Ee,dir:null,dirName:null,disabled:Ee,download:Ri,draggable:Ye,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:Ee,formTarget:null,headers:Be,height:ce,hidden:Ri,high:ce,href:null,hrefLang:null,htmlFor:Be,httpEquiv:Be,id:null,imageSizes:null,imageSrcSet:null,inert:Ee,inputMode:null,integrity:null,is:null,isMap:Ee,itemId:null,itemProp:Be,itemRef:Be,itemScope:Ee,itemType:Be,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:Ee,low:ce,manifest:null,max:null,maxLength:ce,media:null,method:null,min:null,minLength:ce,multiple:Ee,muted:Ee,name:null,nonce:null,noModule:Ee,noValidate:Ee,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:Ee,optimum:ce,pattern:null,ping:Be,placeholder:null,playsInline:Ee,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:Ee,referrerPolicy:null,rel:Be,required:Ee,reversed:Ee,rows:ce,rowSpan:ce,sandbox:Be,scope:null,scoped:Ee,seamless:Ee,selected:Ee,shadowRootClonable:Ee,shadowRootDelegatesFocus:Ee,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:Ee,useMap:null,value:Ye,width:ce,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:Be,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:Ee,declare:Ee,event:null,face:null,frame:null,frameBorder:null,hSpace:ce,leftMargin:ce,link:null,longDesc:null,lowSrc:null,marginHeight:ce,marginWidth:ce,noResize:Ee,noHref:Ee,noShade:Ee,noWrap:Ee,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:Ee,disableRemotePlayback:Ee,prefix:null,property:null,results:ce,security:null,unselectable:null},space:"html",transform:Gh}),mE=sr({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:Be,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:Ee,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:Vn,g2:Vn,glyphName:Vn,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:Be,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:Jh}),Yh=sr({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()}}),Xh=sr({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:Gh}),Qh=sr({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,t){return"xml:"+t.slice(3).toLowerCase()}}),gE={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"},xE=/[A-Z]/g,Nc=/-[a-z]/g,yE=/^data[-\w.:]+$/i;function bE(e,t){const n=zi(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"&&yE.test(t)){if(t.charAt(4)==="-"){const s=t.slice(5).replace(Nc,wE);r="data"+s.charAt(0).toUpperCase()+s.slice(1)}else{const s=t.slice(4);if(!Nc.test(s)){let i=s.replace(xE,vE);i.charAt(0)!=="-"&&(i="-"+i),t="data"+i}}o=Ua}return new o(r,t)}function vE(e){return"-"+e.toLowerCase()}function wE(e){return e.charAt(1).toUpperCase()}const kE=qh([Kh,hE,Yh,Xh,Qh],"html"),Va=qh([Kh,mE,Yh,Xh,Qh],"svg");function _E(e){return e.join(" ").trim()}var Pn={},Us,Tc;function SE(){if(Tc)return Us;Tc=1;var e=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,t=/\n/g,n=/^\s*/,r=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,o=/^:\s*/,s=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,i=/^[;\s]*/,a=/^\s+|\s+$/g,c=`
|
|
94
|
-
`,u="/",d="*",f="",h="comment",p="declaration";function x(g,y){if(typeof g!="string")throw new TypeError("First argument must be a string");if(!g)return[];y=y||{};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),R(),M}}function j(w){this.start=w,this.end={line:v,column:k},this.source=y.source}j.prototype.content=g;function N(w){var M=new Error(y.source+":"+v+":"+k+": "+w);if(M.reason=w,M.filename=y.source,M.line=v,M.column=k,M.source=g,!y.silent)throw M}function I(w){var M=w.exec(g);if(M){var U=M[0];return S(U),g=g.slice(U.length),M}}function R(){I(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=I(r);if(M){if($(),!I(o))return N("property missing ':'");var U=I(s),F=w({type:p,property:m(M[0].replace(e,f)),value:U?m(U[0].replace(e,f)):f});return I(i),F}}function L(){var w=[];O(w);for(var M;M=E();)M!==!1&&(w.push(M),O(w));return w}return R(),L()}function m(g){return g?g.replace(a,f):f}return Us=x,Us}var Ac;function CE(){if(Ac)return Pn;Ac=1;var e=Pn&&Pn.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(Pn,"__esModule",{value:!0}),Pn.default=n;const t=e(SE());function n(r,o){let s=null;if(!r||typeof r!="string")return s;const i=(0,t.default)(r),a=typeof o=="function";return i.forEach(c=>{if(c.type!=="declaration")return;const{property:u,value:d}=c;a?o(u,d,c):d&&(s=s||{},s[u]=d)}),s}return Pn}var dr={},Ic;function jE(){if(Ic)return dr;Ic=1,Object.defineProperty(dr,"__esModule",{value:!0}),dr.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()},a=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,a):u=u.replace(r,a),u.replace(t,i))};return dr.camelCase=c,dr}var fr,zc;function EE(){if(zc)return fr;zc=1;var e=fr&&fr.__importDefault||function(o){return o&&o.__esModule?o:{default:o}},t=e(CE()),n=jE();function r(o,s){var i={};return!o||typeof o!="string"||(0,t.default)(o,function(a,c){a&&c&&(i[(0,n.camelCase)(a,s)]=c)}),i}return r.default=r,fr=r,fr}var NE=EE();const TE=Gi(NE),em=tm("end"),Ha=tm("start");function tm(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 AE(e){const t=Ha(e),n=em(e);if(t&&n)return{start:t,end:n}}function wr(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?Rc(e.position):"start"in e||"end"in e?Rc(e):"line"in e||"column"in e?Oi(e):""}function Oi(e){return Pc(e&&e.line)+":"+Pc(e&&e.column)}function Rc(e){return Oi(e&&e.start)+"-"+Oi(e&&e.end)}function Pc(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 a=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=a?a.column:void 0,this.fatal=void 0,this.file="",this.message=o,this.line=a?a.line:void 0,this.name=wr(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 Wa={}.hasOwnProperty,IE=new Map,zE=/[A-Z]/g,RE=new Set(["table","tbody","thead","tfoot","tr"]),PE=new Set(["td","th"]),nm="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function OE(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=VE(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=UE(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"?Va:kE,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},s=rm(o,e,void 0);return s&&typeof s!="string"?s:o.create(e,o.Fragment,{children:s||void 0},void 0)}function rm(e,t,n){if(t.type==="element")return ME(e,t,n);if(t.type==="mdxFlowExpression"||t.type==="mdxTextExpression")return LE(e,t);if(t.type==="mdxJsxFlowElement"||t.type==="mdxJsxTextElement")return FE(e,t,n);if(t.type==="mdxjsEsm")return DE(e,t);if(t.type==="root")return $E(e,t,n);if(t.type==="text")return BE(e,t)}function ME(e,t,n){const r=e.schema;let o=r;t.tagName.toLowerCase()==="svg"&&r.space==="html"&&(o=Va,e.schema=o),e.ancestors.push(t);const s=sm(e,t.tagName,!1),i=HE(e,t);let a=qa(e,t);return RE.has(t.tagName)&&(a=a.filter(function(c){return typeof c=="string"?!fE(c):!0})),om(e,i,s,t),Za(i,a),e.ancestors.pop(),e.schema=r,e.create(t,s,i,n)}function LE(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)}Pr(e,t.position)}function DE(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);Pr(e,t.position)}function FE(e,t,n){const r=e.schema;let o=r;t.name==="svg"&&r.space==="html"&&(o=Va,e.schema=o),e.ancestors.push(t);const s=t.name===null?e.Fragment:sm(e,t.name,!0),i=WE(e,t),a=qa(e,t);return om(e,i,s,t),Za(i,a),e.ancestors.pop(),e.schema=r,e.create(t,s,i,n)}function $E(e,t,n){const r={};return Za(r,qa(e,t)),e.create(t,e.Fragment,r,n)}function BE(e,t){return t.value}function om(e,t,n,r){typeof n!="string"&&n!==e.Fragment&&e.passNode&&(t.node=r)}function Za(e,t){if(t.length>0){const n=t.length>1?t:t[0];n&&(e.children=n)}}function UE(e,t,n){return r;function r(o,s,i,a){const u=Array.isArray(i.children)?n:t;return a?u(s,i,a):u(s,i)}}function VE(e,t){return n;function n(r,o,s,i){const a=Array.isArray(s.children),c=Ha(r);return t(o,s,i,a,{columnNumber:c?c.column-1:void 0,fileName:e,lineNumber:c?c.line:void 0},void 0)}}function HE(e,t){const n={};let r,o;for(o in t.properties)if(o!=="children"&&Wa.call(t.properties,o)){const s=ZE(e,o,t.properties[o]);if(s){const[i,a]=s;e.tableCellAlignToStyle&&i==="align"&&typeof a=="string"&&PE.has(t.tagName)?r=a:n[i]=a}}if(r){const s=n.style||(n.style={});s[e.stylePropertyNameCase==="css"?"text-align":"textAlign"]=r}return n}function WE(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 a=i.properties[0];a.type,Object.assign(n,e.evaluater.evaluateExpression(a.argument))}else Pr(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 a=r.value.data.estree.body[0];a.type,s=e.evaluater.evaluateExpression(a.expression)}else Pr(e,t.position);else s=r.value===null?!0:r.value;n[o]=s}return n}function qa(e,t){const n=[];let r=-1;const o=e.passKeys?new Map:IE;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 a=rm(e,s,i);a!==void 0&&n.push(a)}return n}function ZE(e,t,n){const r=bE(e.schema,t);if(!(n==null||typeof n=="number"&&Number.isNaN(n))){if(Array.isArray(n)&&(n=r.commaSeparated?aE(n):_E(n)),r.property==="style"){let o=typeof n=="object"?n:qE(e,String(n));return e.stylePropertyNameCase==="css"&&(o=KE(o)),["style",o]}return[e.elementAttributeNameCase==="react"&&r.space?gE[r.property]||r.property:r.attribute,n]}}function qE(e,t){try{return TE(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=nm+"#cannot-parse-style-attribute",o}}function sm(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 a=Cc(o[s])?{type:"Identifier",name:o[s]}:{type:"Literal",value:o[s]};i=i?{type:"MemberExpression",object:i,property:a,computed:!!(s&&a.type==="Literal"),optional:!1}:a}r=i}else r=Cc(t)&&!/^[a-z]/.test(t)?{type:"Identifier",name:t}:{type:"Literal",value:t};if(r.type==="Literal"){const o=r.value;return Wa.call(e.components,o)?e.components[o]:o}if(e.evaluater)return e.evaluater.evaluateExpression(r);Pr(e)}function Pr(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=nm+"#cannot-handle-mdx-estrees-without-createevaluater",n}function KE(e){const t={};let n;for(n in e)Wa.call(e,n)&&(t[JE(n)]=e[n]);return t}function JE(e){let t=e.replace(zE,GE);return t.slice(0,3)==="ms-"&&(t="-"+t),t}function GE(e){return"-"+e.toLowerCase()}const Vs={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"]},YE={};function XE(e,t){const n=YE,r=typeof n.includeImageAlt=="boolean"?n.includeImageAlt:!0,o=typeof n.includeHtml=="boolean"?n.includeHtml:!0;return im(e,r,o)}function im(e,t,n){if(QE(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 Oc(e.children,t,n)}return Array.isArray(e)?Oc(e,t,n):""}function Oc(e,t,n){const r=[];let o=-1;for(;++o<e.length;)r[o]=im(e[o],t,n);return r.join("")}function QE(e){return!!(e&&typeof e=="object")}const Mc=document.createElement("i");function Ka(e){const t="&"+e+";";Mc.innerHTML=t;const n=Mc.textContent;return n.charCodeAt(n.length-1)===59&&e!=="semi"||n===t?!1:n}function Dt(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 xt(e,t){return e.length>0?(Dt(e,e.length,0,t),e):t}const Lc={}.hasOwnProperty;function eN(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=(Lc.call(e,n)?e[n]:void 0)||(e[n]={}),s=t[n];let i;if(s)for(i in s){Lc.call(o,i)||(o[i]=[]);const a=s[i];nN(o[i],Array.isArray(a)?a:a?[a]:[])}}}function nN(e,t){let n=-1;const r=[];for(;++n<t.length;)(t[n].add==="after"?e:r).push(t[n]);Dt(e,0,0,r)}function am(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 Hn(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const Rt=hn(/[A-Za-z]/),mt=hn(/[\dA-Za-z]/),rN=hn(/[#-'*+\--9=?A-Z^-~]/);function Mi(e){return e!==null&&(e<32||e===127)}const Li=hn(/\d/),oN=hn(/[\dA-Fa-f]/),sN=hn(/[!-/:-@[-`{-~]/);function _e(e){return e!==null&&e<-2}function lt(e){return e!==null&&(e<0||e===32)}function Me(e){return e===-2||e===-1||e===32}const iN=hn(new RegExp("\\p{P}|\\p{S}","u")),aN=hn(/\s/);function hn(e){return t;function t(n){return n!==null&&n>-1&&e.test(String.fromCharCode(n))}}function ir(e){const t=[];let n=-1,r=0,o=0;for(;++n<e.length;){const s=e.charCodeAt(n);let i="";if(s===37&&mt(e.charCodeAt(n+1))&&mt(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 a=e.charCodeAt(n+1);s<56320&&a>56319&&a<57344?(i=String.fromCharCode(s,a),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 Ue(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),a(c)):t(c)}function a(c){return Me(c)&&s++<o?(e.consume(c),a):(e.exit(n),t(c))}}const lN={tokenize:cN};function cN(e){const t=e.attempt(this.parser.constructs.contentInitial,r,o);let n;return t;function r(a){if(a===null){e.consume(a);return}return e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),Ue(e,t,"linePrefix")}function o(a){return e.enter("paragraph"),s(a)}function s(a){const c=e.enter("chunkText",{contentType:"text",previous:n});return n&&(n.next=c),n=c,i(a)}function i(a){if(a===null){e.exit("chunkText"),e.exit("paragraph"),e.consume(a);return}return _e(a)?(e.consume(a),e.exit("chunkText"),s):(e.consume(a),i)}}const uN={tokenize:dN},Dc={tokenize:fN};function dN(e){const t=this,n=[];let r=0,o,s,i;return a;function a(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}y(r);let N=S;for(;N<t.events.length;)t.events[N][1].end={...j},N++;return Dt(t.events,C+1,0,t.events.slice(S)),t.events.length=N,u(k)}return a(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(Dc,d,f)(k)}function d(k){return o&&v(),y(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(Dc,p,x)(k)}function p(k){return r++,n.push([t.currentConstruct,t.containerState]),h(k)}function x(k){if(k===null){o&&v(),y(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),y(0),e.consume(k);return}return _e(k)?(e.consume(k),g(e.exit("chunkFlow")),r=0,t.interrupt=void 0,a):(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 I=N,R,O;for(;I--;)if(t.events[I][0]==="exit"&&t.events[I][1].type==="chunkFlow"){if(R){O=t.events[I][1].end;break}R=!0}for(y(r),j=N;j<t.events.length;)t.events[j][1].end={...O},j++;Dt(t.events,I+1,0,t.events.slice(N)),t.events.length=j}}function y(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 fN(e,t,n){return Ue(e,e.attempt(this.parser.constructs.document,t,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function Fc(e){if(e===null||lt(e)||aN(e))return 1;if(iN(e))return 2}function Ja(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 Di={name:"attention",resolveAll:pN,tokenize:hN};function pN(e,t){let n=-1,r,o,s,i,a,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};$c(f,-c),$c(h,c),i={type:c>1?"strongSequence":"emphasisSequence",start:f,end:{...e[r][1].end}},a={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:{...a.end}},e[r][1].end={...i.start},e[n][1].start={...a.end},u=[],e[r][1].end.offset-e[r][1].start.offset&&(u=xt(u,[["enter",e[r][1],t],["exit",e[r][1],t]])),u=xt(u,[["enter",o,t],["enter",i,t],["exit",i,t],["enter",s,t]]),u=xt(u,Ja(t.parser.constructs.insideSpan.null,e.slice(r+1,n),t)),u=xt(u,[["exit",s,t],["enter",a,t],["exit",a,t],["exit",o,t]]),e[n][1].end.offset-e[n][1].start.offset?(d=2,u=xt(u,[["enter",e[n][1],t],["exit",e[n][1],t]])):d=0,Dt(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 hN(e,t){const n=this.parser.constructs.attentionMarkers.null,r=this.previous,o=Fc(r);let s;return i;function i(c){return s=c,e.enter("attentionSequence"),a(c)}function a(c){if(c===s)return e.consume(c),a;const u=e.exit("attentionSequence"),d=Fc(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 $c(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}const mN={name:"autolink",tokenize:gN};function gN(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 Rt(p)?(e.consume(p),i):p===64?n(p):u(p)}function i(p){return p===43||p===45||p===46||mt(p)?(r=1,a(p)):u(p)}function a(p){return p===58?(e.consume(p),r=0,c):(p===43||p===45||p===46||mt(p))&&r++<32?(e.consume(p),a):(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||Mi(p)?n(p):(e.consume(p),c)}function u(p){return p===64?(e.consume(p),d):rN(p)?(e.consume(p),u):n(p)}function d(p){return mt(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||mt(p))&&r++<63){const x=p===45?h:f;return e.consume(p),x}return n(p)}}const ms={partial:!0,tokenize:xN};function xN(e,t,n){return r;function r(s){return Me(s)?Ue(e,o,"linePrefix")(s):o(s)}function o(s){return s===null||_e(s)?t(s):n(s)}}const lm={continuation:{tokenize:bN},exit:vN,name:"blockQuote",tokenize:yN};function yN(e,t,n){const r=this;return o;function o(i){if(i===62){const a=r.containerState;return a.open||(e.enter("blockQuote",{_container:!0}),a.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 bN(e,t,n){const r=this;return o;function o(i){return Me(i)?Ue(e,s,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(i):s(i)}function s(i){return e.attempt(lm,t,n)(i)}}function vN(e){e.exit("blockQuote")}const cm={name:"characterEscape",tokenize:wN};function wN(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 sN(s)?(e.enter("characterEscapeValue"),e.consume(s),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):n(s)}}const um={name:"characterReference",tokenize:kN};function kN(e,t,n){const r=this;let o=0,s,i;return a;function a(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=mt,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=oN,d):(e.enter("characterReferenceValue"),s=7,i=Li,d(f))}function d(f){if(f===59&&o){const h=e.exit("characterReferenceValue");return i===mt&&!Ka(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 Bc={partial:!0,tokenize:SN},Uc={concrete:!0,name:"codeFenced",tokenize:_N};function _N(e,t,n){const r=this,o={partial:!0,tokenize:C};let s=0,i=0,a;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,a=j,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),d(j)}function d(j){return j===a?(i++,e.consume(j),d):i<3?n(j):(e.exit("codeFencedFenceSequence"),Me(j)?Ue(e,f,"whitespace")(j):f(j))}function f(j){return j===null||_e(j)?(e.exit("codeFencedFence"),r.interrupt?t(j):e.check(Bc,m,S)(j)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),h(j))}function h(j){return j===null||_e(j)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),f(j)):Me(j)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),Ue(e,p,"whitespace")(j)):j===96&&j===a?n(j):(e.consume(j),h)}function p(j){return j===null||_e(j)?f(j):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),x(j))}function x(j){return j===null||_e(j)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),f(j)):j===96&&j===a?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"),y}function y(j){return s>0&&Me(j)?Ue(e,v,"linePrefix",s+1)(j):v(j)}function v(j){return j===null||_e(j)?e.check(Bc,m,S)(j):(e.enter("codeFlowValue"),k(j))}function k(j){return j===null||_e(j)?(e.exit("codeFlowValue"),v(j)):(e.consume(j),k)}function S(j){return e.exit("codeFenced"),t(j)}function C(j,N,I){let R=0;return O;function O(M){return j.enter("lineEnding"),j.consume(M),j.exit("lineEnding"),$}function $(M){return j.enter("codeFencedFence"),Me(M)?Ue(j,E,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(M):E(M)}function E(M){return M===a?(j.enter("codeFencedFenceSequence"),L(M)):I(M)}function L(M){return M===a?(R++,j.consume(M),L):R>=i?(j.exit("codeFencedFenceSequence"),Me(M)?Ue(j,w,"whitespace")(M):w(M)):I(M)}function w(M){return M===null||_e(M)?(j.exit("codeFencedFence"),N(M)):I(M)}}}function SN(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 Hs={name:"codeIndented",tokenize:jN},CN={partial:!0,tokenize:EN};function jN(e,t,n){const r=this;return o;function o(u){return e.enter("codeIndented"),Ue(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):_e(u)?e.attempt(CN,i,c)(u):(e.enter("codeFlowValue"),a(u))}function a(u){return u===null||_e(u)?(e.exit("codeFlowValue"),i(u)):(e.consume(u),a)}function c(u){return e.exit("codeIndented"),t(u)}}function EN(e,t,n){const r=this;return o;function o(i){return r.parser.lazy[r.now().line]?n(i):_e(i)?(e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),o):Ue(e,s,"linePrefix",5)(i)}function s(i){const a=r.events[r.events.length-1];return a&&a[1].type==="linePrefix"&&a[2].sliceSerialize(a[1],!0).length>=4?t(i):_e(i)?o(i):n(i)}}const NN={name:"codeText",previous:AN,resolve:TN,tokenize:IN};function TN(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 AN(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function IN(e,t,n){let r=0,o,s;return i;function i(f){return e.enter("codeText"),e.enter("codeTextSequence"),a(f)}function a(f){return f===96?(e.consume(f),r++,a):(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)):_e(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||_e(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 zN{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&&pr(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),pr(this.left,t)}unshift(t){this.setCursor(0),this.right.push(t)}unshiftMany(t){this.setCursor(0),pr(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);pr(this.right,n.reverse())}else{const n=this.right.splice(this.left.length+this.right.length-t,Number.POSITIVE_INFINITY);pr(this.left,n.reverse())}}}function pr(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 dm(e){const t={};let n=-1,r,o,s,i,a,c,u;const d=new zN(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,RN(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},a=d.slice(o,n),a.unshift(r),d.splice(o,n-o+1,a))}}return Dt(e,0,Number.POSITIVE_INFINITY,d.slice(0)),!u}function RN(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 a=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<a.length;)a[h][0]==="exit"&&a[h-1][0]==="enter"&&a[h][1].type===a[h-1][1].type&&a[h][1].start.line!==a[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 y=a.slice(g[h],g[h+1]),v=s.pop();c.push([v,v+y.length-1]),e.splice(v,2,y)}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 PN={resolve:MN,tokenize:LN},ON={partial:!0,tokenize:DN};function MN(e){return dm(e),e}function LN(e,t){let n;return r;function r(a){return e.enter("content"),n=e.enter("chunkContent",{contentType:"content"}),o(a)}function o(a){return a===null?s(a):_e(a)?e.check(ON,i,s)(a):(e.consume(a),o)}function s(a){return e.exit("chunkContent"),e.exit("content"),t(a)}function i(a){return e.consume(a),e.exit("chunkContent"),n.next=e.enter("chunkContent",{contentType:"content",previous:n}),n=n.next,o}}function DN(e,t,n){const r=this;return o;function o(i){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),Ue(e,s,"linePrefix")}function s(i){if(i===null||_e(i))return n(i);const a=r.events[r.events.length-1];return!r.parser.constructs.disable.null.includes("codeIndented")&&a&&a[1].type==="linePrefix"&&a[2].sliceSerialize(a[1],!0).length>=4?t(i):e.interrupt(r.parser.constructs.flow,n,t)(i)}}function fm(e,t,n,r,o,s,i,a,c){const u=c||Number.POSITIVE_INFINITY;let d=0;return f;function f(y){return y===60?(e.enter(r),e.enter(o),e.enter(s),e.consume(y),e.exit(s),h):y===null||y===32||y===41||Mi(y)?n(y):(e.enter(r),e.enter(i),e.enter(a),e.enter("chunkString",{contentType:"string"}),m(y))}function h(y){return y===62?(e.enter(s),e.consume(y),e.exit(s),e.exit(o),e.exit(r),t):(e.enter(a),e.enter("chunkString",{contentType:"string"}),p(y))}function p(y){return y===62?(e.exit("chunkString"),e.exit(a),h(y)):y===null||y===60||_e(y)?n(y):(e.consume(y),y===92?x:p)}function x(y){return y===60||y===62||y===92?(e.consume(y),p):p(y)}function m(y){return!d&&(y===null||y===41||lt(y))?(e.exit("chunkString"),e.exit(a),e.exit(i),e.exit(r),t(y)):d<u&&y===40?(e.consume(y),d++,m):y===41?(e.consume(y),d--,m):y===null||y===32||y===40||Mi(y)?n(y):(e.consume(y),y===92?g:m)}function g(y){return y===40||y===41||y===92?(e.consume(y),m):m(y)}}function pm(e,t,n,r,o,s){const i=this;let a=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 a>999||p===null||p===91||p===93&&!c||p===94&&!a&&"_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):_e(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||_e(p)||a++>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),a++,f):f(p)}}function hm(e,t,n,r,o,s){let i;return a;function a(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):_e(h)?(e.enter("lineEnding"),e.consume(h),e.exit("lineEnding"),Ue(e,u,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),d(h))}function d(h){return h===i||h===null||_e(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 kr(e,t){let n;return r;function r(o){return _e(o)?(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),n=!0,r):Me(o)?Ue(e,r,n?"linePrefix":"lineSuffix")(o):t(o)}}const FN={name:"definition",tokenize:BN},$N={partial:!0,tokenize:UN};function BN(e,t,n){const r=this;let o;return s;function s(p){return e.enter("definition"),i(p)}function i(p){return pm.call(r,e,a,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(p)}function a(p){return o=Hn(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 lt(p)?kr(e,u)(p):u(p)}function u(p){return fm(e,d,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(p)}function d(p){return e.attempt($N,f,f)(p)}function f(p){return Me(p)?Ue(e,h,"whitespace")(p):h(p)}function h(p){return p===null||_e(p)?(e.exit("definition"),r.parser.defined.push(o),t(p)):n(p)}}function UN(e,t,n){return r;function r(a){return lt(a)?kr(e,o)(a):n(a)}function o(a){return hm(e,s,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(a)}function s(a){return Me(a)?Ue(e,i,"whitespace")(a):i(a)}function i(a){return a===null||_e(a)?t(a):n(a)}}const VN={name:"hardBreakEscape",tokenize:HN};function HN(e,t,n){return r;function r(s){return e.enter("hardBreakEscape"),e.consume(s),o}function o(s){return _e(s)?(e.exit("hardBreakEscape"),t(s)):n(s)}}const WN={name:"headingAtx",resolve:ZN,tokenize:qN};function ZN(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"},Dt(e,r,n-r+1,[["enter",o,t],["enter",s,t],["exit",s,t],["exit",o,t]])),e}function qN(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||lt(d)?(e.exit("atxHeadingSequence"),a(d)):n(d)}function a(d){return d===35?(e.enter("atxHeadingSequence"),c(d)):d===null||_e(d)?(e.exit("atxHeading"),t(d)):Me(d)?Ue(e,a,"whitespace")(d):(e.enter("atxHeadingText"),u(d))}function c(d){return d===35?(e.consume(d),c):(e.exit("atxHeadingSequence"),a(d))}function u(d){return d===null||d===35||lt(d)?(e.exit("atxHeadingText"),a(d)):(e.consume(d),u)}}const KN=["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"],Vc=["pre","script","style","textarea"],JN={concrete:!0,name:"htmlFlow",resolveTo:XN,tokenize:QN},GN={partial:!0,tokenize:t3},YN={partial:!0,tokenize:e3};function XN(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 QN(e,t,n){const r=this;let o,s,i,a,c;return u;function u(P){return d(P)}function d(P){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(P),f}function f(P){return P===33?(e.consume(P),h):P===47?(e.consume(P),s=!0,m):P===63?(e.consume(P),o=3,r.interrupt?t:z):Rt(P)?(e.consume(P),i=String.fromCharCode(P),g):n(P)}function h(P){return P===45?(e.consume(P),o=2,p):P===91?(e.consume(P),o=5,a=0,x):Rt(P)?(e.consume(P),o=4,r.interrupt?t:z):n(P)}function p(P){return P===45?(e.consume(P),r.interrupt?t:z):n(P)}function x(P){const ee="CDATA[";return P===ee.charCodeAt(a++)?(e.consume(P),a===ee.length?r.interrupt?t:E:x):n(P)}function m(P){return Rt(P)?(e.consume(P),i=String.fromCharCode(P),g):n(P)}function g(P){if(P===null||P===47||P===62||lt(P)){const ee=P===47,Q=i.toLowerCase();return!ee&&!s&&Vc.includes(Q)?(o=1,r.interrupt?t(P):E(P)):KN.includes(i.toLowerCase())?(o=6,ee?(e.consume(P),y):r.interrupt?t(P):E(P)):(o=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(P):s?v(P):k(P))}return P===45||mt(P)?(e.consume(P),i+=String.fromCharCode(P),g):n(P)}function y(P){return P===62?(e.consume(P),r.interrupt?t:E):n(P)}function v(P){return Me(P)?(e.consume(P),v):O(P)}function k(P){return P===47?(e.consume(P),O):P===58||P===95||Rt(P)?(e.consume(P),S):Me(P)?(e.consume(P),k):O(P)}function S(P){return P===45||P===46||P===58||P===95||mt(P)?(e.consume(P),S):C(P)}function C(P){return P===61?(e.consume(P),j):Me(P)?(e.consume(P),C):k(P)}function j(P){return P===null||P===60||P===61||P===62||P===96?n(P):P===34||P===39?(e.consume(P),c=P,N):Me(P)?(e.consume(P),j):I(P)}function N(P){return P===c?(e.consume(P),c=null,R):P===null||_e(P)?n(P):(e.consume(P),N)}function I(P){return P===null||P===34||P===39||P===47||P===60||P===61||P===62||P===96||lt(P)?C(P):(e.consume(P),I)}function R(P){return P===47||P===62||Me(P)?k(P):n(P)}function O(P){return P===62?(e.consume(P),$):n(P)}function $(P){return P===null||_e(P)?E(P):Me(P)?(e.consume(P),$):n(P)}function E(P){return P===45&&o===2?(e.consume(P),U):P===60&&o===1?(e.consume(P),F):P===62&&o===4?(e.consume(P),H):P===63&&o===3?(e.consume(P),z):P===93&&o===5?(e.consume(P),J):_e(P)&&(o===6||o===7)?(e.exit("htmlFlowData"),e.check(GN,Z,L)(P)):P===null||_e(P)?(e.exit("htmlFlowData"),L(P)):(e.consume(P),E)}function L(P){return e.check(YN,w,Z)(P)}function w(P){return e.enter("lineEnding"),e.consume(P),e.exit("lineEnding"),M}function M(P){return P===null||_e(P)?L(P):(e.enter("htmlFlowData"),E(P))}function U(P){return P===45?(e.consume(P),z):E(P)}function F(P){return P===47?(e.consume(P),i="",V):E(P)}function V(P){if(P===62){const ee=i.toLowerCase();return Vc.includes(ee)?(e.consume(P),H):E(P)}return Rt(P)&&i.length<8?(e.consume(P),i+=String.fromCharCode(P),V):E(P)}function J(P){return P===93?(e.consume(P),z):E(P)}function z(P){return P===62?(e.consume(P),H):P===45&&o===2?(e.consume(P),z):E(P)}function H(P){return P===null||_e(P)?(e.exit("htmlFlowData"),Z(P)):(e.consume(P),H)}function Z(P){return e.exit("htmlFlow"),t(P)}}function e3(e,t,n){const r=this;return o;function o(i){return _e(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 t3(e,t,n){return r;function r(o){return e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),e.attempt(ms,t,n)}}const n3={name:"htmlText",tokenize:r3};function r3(e,t,n){const r=this;let o,s,i;return a;function a(z){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(z),c}function c(z){return z===33?(e.consume(z),u):z===47?(e.consume(z),C):z===63?(e.consume(z),k):Rt(z)?(e.consume(z),I):n(z)}function u(z){return z===45?(e.consume(z),d):z===91?(e.consume(z),s=0,x):Rt(z)?(e.consume(z),v):n(z)}function d(z){return z===45?(e.consume(z),p):n(z)}function f(z){return z===null?n(z):z===45?(e.consume(z),h):_e(z)?(i=f,F(z)):(e.consume(z),f)}function h(z){return z===45?(e.consume(z),p):f(z)}function p(z){return z===62?U(z):z===45?h(z):f(z)}function x(z){const H="CDATA[";return z===H.charCodeAt(s++)?(e.consume(z),s===H.length?m:x):n(z)}function m(z){return z===null?n(z):z===93?(e.consume(z),g):_e(z)?(i=m,F(z)):(e.consume(z),m)}function g(z){return z===93?(e.consume(z),y):m(z)}function y(z){return z===62?U(z):z===93?(e.consume(z),y):m(z)}function v(z){return z===null||z===62?U(z):_e(z)?(i=v,F(z)):(e.consume(z),v)}function k(z){return z===null?n(z):z===63?(e.consume(z),S):_e(z)?(i=k,F(z)):(e.consume(z),k)}function S(z){return z===62?U(z):k(z)}function C(z){return Rt(z)?(e.consume(z),j):n(z)}function j(z){return z===45||mt(z)?(e.consume(z),j):N(z)}function N(z){return _e(z)?(i=N,F(z)):Me(z)?(e.consume(z),N):U(z)}function I(z){return z===45||mt(z)?(e.consume(z),I):z===47||z===62||lt(z)?R(z):n(z)}function R(z){return z===47?(e.consume(z),U):z===58||z===95||Rt(z)?(e.consume(z),O):_e(z)?(i=R,F(z)):Me(z)?(e.consume(z),R):U(z)}function O(z){return z===45||z===46||z===58||z===95||mt(z)?(e.consume(z),O):$(z)}function $(z){return z===61?(e.consume(z),E):_e(z)?(i=$,F(z)):Me(z)?(e.consume(z),$):R(z)}function E(z){return z===null||z===60||z===61||z===62||z===96?n(z):z===34||z===39?(e.consume(z),o=z,L):_e(z)?(i=E,F(z)):Me(z)?(e.consume(z),E):(e.consume(z),w)}function L(z){return z===o?(e.consume(z),o=void 0,M):z===null?n(z):_e(z)?(i=L,F(z)):(e.consume(z),L)}function w(z){return z===null||z===34||z===39||z===60||z===61||z===96?n(z):z===47||z===62||lt(z)?R(z):(e.consume(z),w)}function M(z){return z===47||z===62||lt(z)?R(z):n(z)}function U(z){return z===62?(e.consume(z),e.exit("htmlTextData"),e.exit("htmlText"),t):n(z)}function F(z){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(z),e.exit("lineEnding"),V}function V(z){return Me(z)?Ue(e,J,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(z):J(z)}function J(z){return e.enter("htmlTextData"),i(z)}}const Ga={name:"labelEnd",resolveAll:a3,resolveTo:l3,tokenize:c3},o3={tokenize:u3},s3={tokenize:d3},i3={tokenize:f3};function a3(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&&Dt(e,0,e.length,n),e}function l3(e,t){let n=e.length,r=0,o,s,i,a;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 a=[["enter",c,t],["enter",u,t]],a=xt(a,e.slice(s+1,s+r+3)),a=xt(a,[["enter",d,t]]),a=xt(a,Ja(t.parser.constructs.insideSpan.null,e.slice(s+r+4,i-3),t)),a=xt(a,[["exit",d,t],e[i-2],e[i-1],["exit",u,t]]),a=xt(a,e.slice(i+1)),a=xt(a,[["exit",c,t]]),Dt(e,s,e.length,a),e}function c3(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 a;function a(h){return s?s._inactive?f(h):(i=r.parser.defined.includes(Hn(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(o3,d,i?d:f)(h):h===91?e.attempt(s3,d,i?u:f)(h):i?d(h):f(h)}function u(h){return e.attempt(i3,d,f)(h)}function d(h){return t(h)}function f(h){return s._balanced=!0,n(h)}}function u3(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 lt(f)?kr(e,s)(f):s(f)}function s(f){return f===41?d(f):fm(e,i,a,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(f)}function i(f){return lt(f)?kr(e,c)(f):d(f)}function a(f){return n(f)}function c(f){return f===34||f===39||f===40?hm(e,u,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(f):d(f)}function u(f){return lt(f)?kr(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 d3(e,t,n){const r=this;return o;function o(a){return pm.call(r,e,s,i,"reference","referenceMarker","referenceString")(a)}function s(a){return r.parser.defined.includes(Hn(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?t(a):n(a)}function i(a){return n(a)}}function f3(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 p3={name:"labelStartImage",resolveAll:Ga.resolveAll,tokenize:h3};function h3(e,t,n){const r=this;return o;function o(a){return e.enter("labelImage"),e.enter("labelImageMarker"),e.consume(a),e.exit("labelImageMarker"),s}function s(a){return a===91?(e.enter("labelMarker"),e.consume(a),e.exit("labelMarker"),e.exit("labelImage"),i):n(a)}function i(a){return a===94&&"_hiddenFootnoteSupport"in r.parser.constructs?n(a):t(a)}}const m3={name:"labelStartLink",resolveAll:Ga.resolveAll,tokenize:g3};function g3(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 Ws={name:"lineEnding",tokenize:x3};function x3(e,t){return n;function n(r){return e.enter("lineEnding"),e.consume(r),e.exit("lineEnding"),Ue(e,t,"linePrefix")}}const vo={name:"thematicBreak",tokenize:y3};function y3(e,t,n){let r=0,o;return s;function s(u){return e.enter("thematicBreak"),i(u)}function i(u){return o=u,a(u)}function a(u){return u===o?(e.enter("thematicBreakSequence"),c(u)):r>=3&&(u===null||_e(u))?(e.exit("thematicBreak"),t(u)):n(u)}function c(u){return u===o?(e.consume(u),r++,c):(e.exit("thematicBreakSequence"),Me(u)?Ue(e,a,"whitespace")(u):a(u))}}const it={continuation:{tokenize:k3},exit:S3,name:"list",tokenize:w3},b3={partial:!0,tokenize:C3},v3={partial:!0,tokenize:_3};function w3(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 a;function a(p){const x=r.containerState.type||(p===42||p===43||p===45?"listUnordered":"listOrdered");if(x==="listUnordered"?!r.containerState.marker||p===r.containerState.marker:Li(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(vo,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 Li(p)&&++i<10?(e.consume(p),c):(!r.interrupt||i<2)&&(r.containerState.marker?p===r.containerState.marker:p===41||p===46)?(e.exit("listItemValue"),u(p)):n(p)}function u(p){return e.enter("listItemMarker"),e.consume(p),e.exit("listItemMarker"),r.containerState.marker=r.containerState.marker||p,e.check(ms,r.interrupt?n:d,e.attempt(b3,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 k3(e,t,n){const r=this;return r.containerState._closeFlow=void 0,e.check(ms,o,s);function o(a){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,Ue(e,t,"listItemIndent",r.containerState.size+1)(a)}function s(a){return r.containerState.furtherBlankLines||!Me(a)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,i(a)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,e.attempt(v3,t,i)(a))}function i(a){return r.containerState._closeFlow=!0,r.interrupt=void 0,Ue(e,e.attempt(it,t,n),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(a)}}function _3(e,t,n){const r=this;return Ue(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 S3(e){e.exit(this.containerState.type)}function C3(e,t,n){const r=this;return Ue(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 Hc={name:"setextUnderline",resolveTo:j3,tokenize:E3};function j3(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 E3(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"),a(u)}function a(u){return u===o?(e.consume(u),a):(e.exit("setextHeadingLineSequence"),Me(u)?Ue(e,c,"lineSuffix")(u):c(u))}function c(u){return u===null||_e(u)?(e.exit("setextHeadingLine"),t(u)):n(u)}}const N3={tokenize:T3};function T3(e){const t=this,n=e.attempt(ms,r,e.attempt(this.parser.constructs.flowInitial,o,Ue(e,e.attempt(this.parser.constructs.flow,o,e.attempt(PN,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 A3={resolveAll:gm()},I3=mm("string"),z3=mm("text");function mm(e){return{resolveAll:gm(e==="text"?R3:void 0),tokenize:t};function t(n){const r=this,o=this.parser.constructs[e],s=n.attempt(o,i,a);return i;function i(d){return u(d)?s(d):a(d)}function a(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 gm(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 R3(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,a=0,c;for(;s--;){const u=o[s];if(typeof u=="string"){for(i=u.length;u.charCodeAt(i-1)===32;)a++,i--;if(i)break;i=-1}else if(u===-2)c=!0,a++;else if(u!==-1){s++;break}}if(t._contentTypeTextTrailing&&n===e.length&&(a=0),a){const u={type:n===e.length||c||a<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:s?i:r.start._bufferIndex+i,_index:r.start._index+s,line:r.end.line,column:r.end.column-a,offset:r.end.offset-a},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 P3={42:it,43:it,45:it,48:it,49:it,50:it,51:it,52:it,53:it,54:it,55:it,56:it,57:it,62:lm},O3={91:FN},M3={[-2]:Hs,[-1]:Hs,32:Hs},L3={35:WN,42:vo,45:[Hc,vo],60:JN,61:Hc,95:vo,96:Uc,126:Uc},D3={38:um,92:cm},F3={[-5]:Ws,[-4]:Ws,[-3]:Ws,33:p3,38:um,42:Di,60:[mN,n3],91:m3,92:[VN,cm],93:Ga,95:Di,96:NN},$3={null:[Di,A3]},B3={null:[42,95]},U3={null:[]},V3=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:B3,contentInitial:O3,disable:U3,document:P3,flow:L3,flowInitial:M3,insideSpan:$3,string:D3,text:F3},Symbol.toStringTag,{value:"Module"}));function H3(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=[],a=[];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=xt(i,$),g(),i[i.length-1]!==null?[]:(I(t,0),u.events=Ja(s,u.events,u),u.events)}function h($,E){return Z3(p($),E)}function p($){return W3(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;)y(E.charCodeAt(r._bufferIndex));else y(E)}}function y($){d=d($)}function v($){_e($)?(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]),a.push(L),L}function S($){const E=a.pop();return E.end=x(),u.events.push(["exit",E,u]),E}function C($,E){I($,E.from)}function j($,E){E.restore()}function N($,E){return L;function L(w,M,U){let F,V,J,z;return Array.isArray(w)?Z(w):"tokenize"in w?Z([w]):H(w);function H(de){return ae;function ae(ue){const he=ue!==null&&de[ue],fe=ue!==null&&de.null,ge=[...Array.isArray(he)?he:he?[he]:[],...Array.isArray(fe)?fe:fe?[fe]:[]];return Z(ge)(ue)}}function Z(de){return F=de,V=0,de.length===0?U:P(de[V])}function P(de){return ae;function ae(ue){return z=R(),J=de,de.partial||(u.currentConstruct=de),de.name&&u.parser.constructs.disable.null.includes(de.name)?Q():de.tokenize.call(E?Object.assign(Object.create(u),E):u,c,ee,Q)(ue)}}function ee(de){return $(J,z),M}function Q(de){return z.restore(),++V<F.length?P(F[V]):U}}}function I($,E){$.resolveAll&&!s.includes($)&&s.push($),$.resolve&&Dt(u.events,E,u.events.length-E,$.resolve(u.events.slice(E),u)),$.resolveTo&&(u.events=$.resolveTo(u.events,u))}function R(){const $=x(),E=u.previous,L=u.currentConstruct,w=u.events.length,M=Array.from(a);return{from:w,restore:U};function U(){r=$,u.previous=E,u.currentConstruct=L,u.events.length=w,a=M,O()}}function O(){r.line in o&&r.column<2&&(r.column=o[r.line],r.offset+=o[r.line]-1)}}function W3(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 a=i[0];typeof a=="string"?i[0]=a.slice(r):i.shift()}s>0&&i.push(e[o].slice(0,s))}return i}function Z3(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 q3(e){const r={constructs:eN([V3,...(e||{}).extensions||[]]),content:o(lN),defined:[],document:o(uN),flow:o(N3),lazy:{},string:o(I3),text:o(z3)};return r;function o(s){return i;function i(a){return H3(r,s,a)}}}function K3(e){for(;!dm(e););return e}const Wc=/[\0\t\n\r]/g;function J3(){let e=1,t="",n=!0,r;return o;function o(s,i,a){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(Wc.lastIndex=f,u=Wc.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 a&&(r&&c.push(-5),t&&c.push(t),c.push(null)),c}}const G3=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function Y3(e){return e.replace(G3,X3)}function X3(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){const o=n.charCodeAt(1),s=o===120||o===88;return am(n.slice(s?2:1),s?16:10)}return Ka(n)||e}const xm={}.hasOwnProperty;function Q3(e,t,n){return typeof t!="string"&&(n=t,t=void 0),eT(n)(K3(q3(n).document().write(J3()(e,t,!0))))}function eT(e){const t={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:s(D),autolinkProtocol:R,autolinkEmail:R,atxHeading:s(ne),blockQuote:s(fe),characterEscape:R,characterReference:R,codeFenced:s(ge),codeFencedFenceInfo:i,codeFencedFenceMeta:i,codeIndented:s(ge,i),codeText:s(Ce,i),codeTextData:R,data:R,codeFlowValue:R,definition:s(ze),definitionDestinationString:i,definitionLabelString:i,definitionTitleString:i,emphasis:s(_),hardBreakEscape:s(G),hardBreakTrailing:s(G),htmlFlow:s(A,i),htmlFlowData:R,htmlText:s(A,i),htmlTextData:R,image:s(T),label:i,link:s(D),listItem:s(se),listItemValue:h,listOrdered:s(X,f),listUnordered:s(X),paragraph:s(q),reference:P,referenceString:i,resourceDestinationString:i,resourceTitleString:i,setextHeading:s(ne),strong:s(K),thematicBreak:s(re)},exit:{atxHeading:c(),atxHeadingSequence:C,autolink:c(),autolinkEmail:he,autolinkProtocol:ue,blockQuote:c(),characterEscapeValue:O,characterReferenceMarkerHexadecimal:Q,characterReferenceMarkerNumeric:Q,characterReferenceValue:de,characterReference:ae,codeFenced:c(g),codeFencedFence:m,codeFencedFenceInfo:p,codeFencedFenceMeta:x,codeFlowValue:O,codeIndented:c(y),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:J,labelText:V,lineEnding:$,link:c(U),listItem:c(),listOrdered:c(),listUnordered:c(),paragraph:c(),referenceString:ee,resourceDestinationString:z,resourceTitleString:H,resource:Z,setextHeading:c(I),setextHeadingLineSequence:N,setextHeadingText:j,strong:c(),thematicBreak:c()}};ym(t,(e||{}).mdastExtensions||[]);const n={};return r;function r(B){let Y={type:"root",children:[]};const le={stack:[Y],tokenStack:[],config:t,enter:a,exit:u,buffer:i,resume:d,data:n},we=[];let Ie=-1;for(;++Ie<B.length;)if(B[Ie][1].type==="listOrdered"||B[Ie][1].type==="listUnordered")if(B[Ie][0]==="enter")we.push(Ie);else{const Je=we.pop();Ie=o(B,Je,Ie)}for(Ie=-1;++Ie<B.length;){const Je=t[B[Ie][0]];xm.call(Je,B[Ie][1].type)&&Je[B[Ie][1].type].call(Object.assign({sliceSerialize:B[Ie][2].sliceSerialize},le),B[Ie][1])}if(le.tokenStack.length>0){const Je=le.tokenStack[le.tokenStack.length-1];(Je[1]||Zc).call(le,void 0,Je[0])}for(Y.position={start:en(B.length>0?B[0][1].start:{line:1,column:1,offset:0}),end:en(B.length>0?B[B.length-2][1].end:{line:1,column:1,offset:0})},Ie=-1;++Ie<t.transforms.length;)Y=t.transforms[Ie](Y)||Y;return Y}function o(B,Y,le){let we=Y-1,Ie=-1,Je=!1,ft,Pe,At,Ut;for(;++we<=le;){const qe=B[we];switch(qe[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{qe[0]==="enter"?Ie++:Ie--,Ut=void 0;break}case"lineEndingBlank":{qe[0]==="enter"&&(ft&&!Ut&&!Ie&&!At&&(At=we),Ut=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:Ut=void 0}if(!Ie&&qe[0]==="enter"&&qe[1].type==="listItemPrefix"||Ie===-1&&qe[0]==="exit"&&(qe[1].type==="listUnordered"||qe[1].type==="listOrdered")){if(ft){let Vt=we;for(Pe=void 0;Vt--;){const kt=B[Vt];if(kt[1].type==="lineEnding"||kt[1].type==="lineEndingBlank"){if(kt[0]==="exit")continue;Pe&&(B[Pe][1].type="lineEndingBlank",Je=!0),kt[1].type="lineEnding",Pe=Vt}else if(!(kt[1].type==="linePrefix"||kt[1].type==="blockQuotePrefix"||kt[1].type==="blockQuotePrefixWhitespace"||kt[1].type==="blockQuoteMarker"||kt[1].type==="listItemIndent"))break}At&&(!Pe||At<Pe)&&(ft._spread=!0),ft.end=Object.assign({},Pe?B[Pe][1].start:qe[1].end),B.splice(Pe||we,0,["exit",ft,qe[2]]),we++,le++}if(qe[1].type==="listItemPrefix"){const Vt={type:"listItem",_spread:!1,start:Object.assign({},qe[1].start),end:void 0};ft=Vt,B.splice(we,0,["enter",Vt,qe[2]]),we++,le++,At=void 0,Ut=!0}}}return B[Y][1]._spread=Je,le}function s(B,Y){return le;function le(we){a.call(this,B(we),we),Y&&Y.call(this,we)}}function i(){this.stack.push({type:"fragment",children:[]})}function a(B,Y,le){this.stack[this.stack.length-1].children.push(B),this.stack.push(B),this.tokenStack.push([Y,le||void 0]),B.position={start:en(Y.start),end:void 0}}function c(B){return Y;function Y(le){B&&B.call(this,le),u.call(this,le)}}function u(B,Y){const le=this.stack.pop(),we=this.tokenStack.pop();if(we)we[0].type!==B.type&&(Y?Y.call(this,B,we[0]):(we[1]||Zc).call(this,B,we[0]));else throw new Error("Cannot close `"+B.type+"` ("+wr({start:B.start,end:B.end})+"): it’s not open");le.position.end=en(B.end)}function d(){return XE(this.stack.pop())}function f(){this.data.expectingFirstListItemValue=!0}function h(B){if(this.data.expectingFirstListItemValue){const Y=this.stack[this.stack.length-2];Y.start=Number.parseInt(this.sliceSerialize(B),10),this.data.expectingFirstListItemValue=void 0}}function p(){const B=this.resume(),Y=this.stack[this.stack.length-1];Y.lang=B}function x(){const B=this.resume(),Y=this.stack[this.stack.length-1];Y.meta=B}function m(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function g(){const B=this.resume(),Y=this.stack[this.stack.length-1];Y.value=B.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function y(){const B=this.resume(),Y=this.stack[this.stack.length-1];Y.value=B.replace(/(\r?\n|\r)$/g,"")}function v(B){const Y=this.resume(),le=this.stack[this.stack.length-1];le.label=Y,le.identifier=Hn(this.sliceSerialize(B)).toLowerCase()}function k(){const B=this.resume(),Y=this.stack[this.stack.length-1];Y.title=B}function S(){const B=this.resume(),Y=this.stack[this.stack.length-1];Y.url=B}function C(B){const Y=this.stack[this.stack.length-1];if(!Y.depth){const le=this.sliceSerialize(B).length;Y.depth=le}}function j(){this.data.setextHeadingSlurpLineEnding=!0}function N(B){const Y=this.stack[this.stack.length-1];Y.depth=this.sliceSerialize(B).codePointAt(0)===61?1:2}function I(){this.data.setextHeadingSlurpLineEnding=void 0}function R(B){const le=this.stack[this.stack.length-1].children;let we=le[le.length-1];(!we||we.type!=="text")&&(we=oe(),we.position={start:en(B.start),end:void 0},le.push(we)),this.stack.push(we)}function O(B){const Y=this.stack.pop();Y.value+=this.sliceSerialize(B),Y.position.end=en(B.end)}function $(B){const Y=this.stack[this.stack.length-1];if(this.data.atHardBreak){const le=Y.children[Y.children.length-1];le.position.end=en(B.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(Y.type)&&(R.call(this,B),O.call(this,B))}function E(){this.data.atHardBreak=!0}function L(){const B=this.resume(),Y=this.stack[this.stack.length-1];Y.value=B}function w(){const B=this.resume(),Y=this.stack[this.stack.length-1];Y.value=B}function M(){const B=this.resume(),Y=this.stack[this.stack.length-1];Y.value=B}function U(){const B=this.stack[this.stack.length-1];if(this.data.inReference){const Y=this.data.referenceType||"shortcut";B.type+="Reference",B.referenceType=Y,delete B.url,delete B.title}else delete B.identifier,delete B.label;this.data.referenceType=void 0}function F(){const B=this.stack[this.stack.length-1];if(this.data.inReference){const Y=this.data.referenceType||"shortcut";B.type+="Reference",B.referenceType=Y,delete B.url,delete B.title}else delete B.identifier,delete B.label;this.data.referenceType=void 0}function V(B){const Y=this.sliceSerialize(B),le=this.stack[this.stack.length-2];le.label=Y3(Y),le.identifier=Hn(Y).toLowerCase()}function J(){const B=this.stack[this.stack.length-1],Y=this.resume(),le=this.stack[this.stack.length-1];if(this.data.inReference=!0,le.type==="link"){const we=B.children;le.children=we}else le.alt=Y}function z(){const B=this.resume(),Y=this.stack[this.stack.length-1];Y.url=B}function H(){const B=this.resume(),Y=this.stack[this.stack.length-1];Y.title=B}function Z(){this.data.inReference=void 0}function P(){this.data.referenceType="collapsed"}function ee(B){const Y=this.resume(),le=this.stack[this.stack.length-1];le.label=Y,le.identifier=Hn(this.sliceSerialize(B)).toLowerCase(),this.data.referenceType="full"}function Q(B){this.data.characterReferenceType=B.type}function de(B){const Y=this.sliceSerialize(B),le=this.data.characterReferenceType;let we;le?(we=am(Y,le==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):we=Ka(Y);const Ie=this.stack[this.stack.length-1];Ie.value+=we}function ae(B){const Y=this.stack.pop();Y.position.end=en(B.end)}function ue(B){O.call(this,B);const Y=this.stack[this.stack.length-1];Y.url=this.sliceSerialize(B)}function he(B){O.call(this,B);const Y=this.stack[this.stack.length-1];Y.url="mailto:"+this.sliceSerialize(B)}function fe(){return{type:"blockquote",children:[]}}function ge(){return{type:"code",lang:null,meta:null,value:""}}function Ce(){return{type:"inlineCode",value:""}}function ze(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function _(){return{type:"emphasis",children:[]}}function ne(){return{type:"heading",depth:0,children:[]}}function G(){return{type:"break"}}function A(){return{type:"html",value:""}}function T(){return{type:"image",title:null,url:"",alt:null}}function D(){return{type:"link",title:null,url:"",children:[]}}function X(B){return{type:"list",ordered:B.type==="listOrdered",start:null,spread:B._spread,children:[]}}function se(B){return{type:"listItem",spread:B._spread,checked:null,children:[]}}function q(){return{type:"paragraph",children:[]}}function K(){return{type:"strong",children:[]}}function oe(){return{type:"text",value:""}}function re(){return{type:"thematicBreak"}}}function en(e){return{line:e.line,column:e.column,offset:e.offset}}function ym(e,t){let n=-1;for(;++n<t.length;){const r=t[n];Array.isArray(r)?ym(e,r):tT(e,r)}}function tT(e,t){let n;for(n in t)if(xm.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 Zc(e,t){throw e?new Error("Cannot close `"+e.type+"` ("+wr({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+wr({start:t.start,end:t.end})+") is open"):new Error("Cannot close document, a token (`"+t.type+"`, "+wr({start:t.start,end:t.end})+") is still open")}function nT(e){const t=this;t.parser=n;function n(r){return Q3(r,{...t.data("settings"),...e,extensions:t.data("micromarkExtensions")||[],mdastExtensions:t.data("fromMarkdownExtensions")||[]})}}function rT(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 oT(e,t){const n={type:"element",tagName:"br",properties:{},children:[]};return e.patch(t,n),[e.applyData(t,n),{type:"text",value:`
|
|
97
|
-
`}]}function sT(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 iT(e,t){const n={type:"element",tagName:"del",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function aT(e,t){const n={type:"element",tagName:"em",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function lT(e,t){const n=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",r=String(t.identifier).toUpperCase(),o=ir(r.toLowerCase()),s=e.footnoteOrder.indexOf(r);let i,a=e.footnoteCounts.get(r);a===void 0?(a=0,e.footnoteOrder.push(r),i=e.footnoteOrder.length):i=s+1,a+=1,e.footnoteCounts.set(r,a);const c={type:"element",tagName:"a",properties:{href:"#"+n+"fn-"+o,id:n+"fnref-"+o+(a>1?"-"+a:""),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 cT(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 uT(e,t){if(e.options.allowDangerousHtml){const n={type:"raw",value:t.value};return e.patch(t,n),e.applyData(t,n)}}function bm(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 dT(e,t){const n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return bm(e,t);const o={src:ir(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 fT(e,t){const n={src:ir(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 pT(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 hT(e,t){const n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return bm(e,t);const o={href:ir(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 mT(e,t){const n={href:ir(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 gT(e,t,n){const r=e.all(t),o=n?xT(n):vm(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 a=-1;for(;++a<r.length;){const d=r[a];(o||a!==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 xT(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=vm(n[r])}return t}function vm(e){const t=e.spread;return t??e.children.length>1}function yT(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 bT(e,t){const n={type:"element",tagName:"p",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function vT(e,t){const n={type:"root",children:e.wrap(e.all(t))};return e.patch(t,n),e.applyData(t,n)}function wT(e,t){const n={type:"element",tagName:"strong",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function kT(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)},a=Ha(t.children[1]),c=em(t.children[t.children.length-1]);a&&c&&(i.position={start:a,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 _T(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,a=i?i.length:t.children.length;let c=-1;const u=[];for(;++c<a;){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 ST(e,t){const n={type:"element",tagName:"td",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}const qc=9,Kc=32;function CT(e){const t=String(e),n=/\r?\n|\r/g;let r=n.exec(t),o=0;const s=[];for(;r;)s.push(Jc(t.slice(o,r.index),o>0,!0),r[0]),o=r.index+r[0].length,r=n.exec(t);return s.push(Jc(t.slice(o),o>0,!1)),s.join("")}function Jc(e,t,n){let r=0,o=e.length;if(t){let s=e.codePointAt(r);for(;s===qc||s===Kc;)r++,s=e.codePointAt(r)}if(n){let s=e.codePointAt(o-1);for(;s===qc||s===Kc;)o--,s=e.codePointAt(o-1)}return o>r?e.slice(r,o):""}function jT(e,t){const n={type:"text",value:CT(String(t.value))};return e.patch(t,n),e.applyData(t,n)}function ET(e,t){const n={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(t,n),e.applyData(t,n)}const NT={blockquote:rT,break:oT,code:sT,delete:iT,emphasis:aT,footnoteReference:lT,heading:cT,html:uT,imageReference:dT,image:fT,inlineCode:pT,linkReference:hT,link:mT,listItem:gT,list:yT,paragraph:bT,root:vT,strong:wT,table:kT,tableCell:ST,tableRow:_T,text:jT,thematicBreak:ET,toml:so,yaml:so,definition:so,footnoteDefinition:so};function so(){}const wm=-1,gs=0,_r=1,$o=2,Ya=3,Xa=4,Qa=5,el=6,km=7,_m=8,Gc=typeof self=="object"?self:globalThis,TT=(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 gs:case wm:return n(i,o);case _r:{const a=n([],o);for(const c of i)a.push(r(c));return a}case $o:{const a=n({},o);for(const[c,u]of i)a[r(c)]=r(u);return a}case Ya:return n(new Date(i),o);case Xa:{const{source:a,flags:c}=i;return n(new RegExp(a,c),o)}case Qa:{const a=n(new Map,o);for(const[c,u]of i)a.set(r(c),r(u));return a}case el:{const a=n(new Set,o);for(const c of i)a.add(r(c));return a}case km:{const{name:a,message:c}=i;return n(new Gc[a](c),o)}case _m: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:a}=new Uint8Array(i);return n(new DataView(a),i)}}return n(new Gc[s](i),o)};return r},Yc=e=>TT(new Map,e)(0),On="",{toString:AT}={},{keys:IT}=Object,hr=e=>{const t=typeof e;if(t!=="object"||!e)return[gs,t];const n=AT.call(e).slice(8,-1);switch(n){case"Array":return[_r,On];case"Object":return[$o,On];case"Date":return[Ya,On];case"RegExp":return[Xa,On];case"Map":return[Qa,On];case"Set":return[el,On];case"DataView":return[_r,n]}return n.includes("Array")?[_r,n]:n.includes("Error")?[km,n]:[$o,n]},io=([e,t])=>e===gs&&(t==="function"||t==="symbol"),zT=(e,t,n,r)=>{const o=(i,a)=>{const c=r.push(i)-1;return n.set(a,c),c},s=i=>{if(n.has(i))return n.get(i);let[a,c]=hr(i);switch(a){case gs:{let d=i;switch(c){case"bigint":a=_m,d=i.toString();break;case"function":case"symbol":if(e)throw new TypeError("unable to serialize "+c);d=null;break;case"undefined":return o([wm],i)}return o([a,d],i)}case _r:{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([a,d],i);for(const h of i)d.push(s(h));return f}case $o:{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([a,d],i);for(const h of IT(i))(e||!io(hr(i[h])))&&d.push([s(h),s(i[h])]);return f}case Ya:return o([a,i.toISOString()],i);case Xa:{const{source:d,flags:f}=i;return o([a,{source:d,flags:f}],i)}case Qa:{const d=[],f=o([a,d],i);for(const[h,p]of i)(e||!(io(hr(h))||io(hr(p))))&&d.push([s(h),s(p)]);return f}case el:{const d=[],f=o([a,d],i);for(const h of i)(e||!io(hr(h)))&&d.push(s(h));return f}}const{message:u}=i;return o([a,{name:c,message:u}],i)};return s},Xc=(e,{json:t,lossy:n}={})=>{const r=[];return zT(!(t||n),!!t,new Map,r)(e),r},Bo=typeof structuredClone=="function"?(e,t)=>t&&("json"in t||"lossy"in t)?Yc(Xc(e,t)):structuredClone(e):(e,t)=>Yc(Xc(e,t));function RT(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 PT(e,t){return"Back to reference "+(e+1)+(t>1?"-"+t:"")}function OT(e){const t=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",n=e.options.footnoteBackContent||RT,r=e.options.footnoteBackLabel||PT,o=e.options.footnoteLabel||"Footnotes",s=e.options.footnoteLabelTagName||"h2",i=e.options.footnoteLabelProperties||{className:["sr-only"]},a=[];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=ir(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 y={type:"element",tagName:"li",properties:{id:t+"fn-"+h},children:e.wrap(d,!0)};e.patch(u,y),a.push(y)}if(a.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:s,properties:{...Bo(i),id:"footnote-label"},children:[{type:"text",value:o}]},{type:"text",value:`
|
|
101
|
-
`},{type:"element",tagName:"ol",properties:{},children:e.wrap(a,!0)},{type:"text",value:`
|
|
102
|
-
`}]}}const Sm=(function(e){if(e==null)return FT;if(typeof e=="function")return xs(e);if(typeof e=="object")return Array.isArray(e)?MT(e):LT(e);if(typeof e=="string")return DT(e);throw new Error("Expected function, string, or object as test")});function MT(e){const t=[];let n=-1;for(;++n<e.length;)t[n]=Sm(e[n]);return xs(r);function r(...o){let s=-1;for(;++s<t.length;)if(t[s].apply(this,o))return!0;return!1}}function LT(e){const t=e;return xs(n);function n(r){const o=r;let s;for(s in e)if(o[s]!==t[s])return!1;return!0}}function DT(e){return xs(t);function t(n){return n&&n.type===e}}function xs(e){return t;function t(n,r,o){return!!($T(n)&&e.call(this,n,typeof r=="number"?r:void 0,o||void 0))}}function FT(){return!0}function $T(e){return e!==null&&typeof e=="object"&&"type"in e}const Cm=[],BT=!0,Qc=!1,UT="skip";function VT(e,t,n,r){let o;typeof t=="function"&&typeof n!="function"?(r=n,n=t):o=t;const s=Sm(o),i=r?-1:1;a(e,void 0,[])();function a(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=Cm,x,m,g;if((!t||s(c,u,d[d.length-1]||void 0))&&(p=HT(n(c,d)),p[0]===Qc))return p;if("children"in c&&c.children){const y=c;if(y.children&&p[0]!==UT)for(m=(r?y.children.length:-1)+i,g=d.concat(y);m>-1&&m<y.children.length;){const v=y.children[m];if(x=a(v,m,g)(),x[0]===Qc)return x;m=typeof x[1]=="number"?x[1]:m+i}}return p}}}function HT(e){return Array.isArray(e)?e:typeof e=="number"?[BT,e]:e==null?Cm:[e]}function jm(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),VT(e,s,a,o);function a(c,u){const d=u[u.length-1],f=d?d.children.indexOf(c):void 0;return i(c,f,d)}}const Fi={}.hasOwnProperty,WT={};function ZT(e,t){const n=t||WT,r=new Map,o=new Map,s=new Map,i={...NT,...n.handlers},a={all:u,applyData:KT,definitionById:r,footnoteById:o,footnoteCounts:s,footnoteOrder:[],handlers:i,one:c,options:n,patch:qT,wrap:GT};return jm(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)}}),a;function c(d,f){const h=d.type,p=a.handlers[h];if(Fi.call(a.handlers,h)&&p)return p(a,d,f);if(a.options.passThrough&&a.options.passThrough.includes(h)){if("children"in d){const{children:m,...g}=d,y=Bo(g);return y.children=a.all(d),y}return Bo(d)}return(a.options.unknownHandler||JT)(a,d,f)}function u(d){const f=[];if("children"in d){const h=d.children;let p=-1;for(;++p<h.length;){const x=a.one(h[p],d);if(x){if(p&&h[p-1].type==="break"&&(!Array.isArray(x)&&x.type==="text"&&(x.value=eu(x.value)),!Array.isArray(x)&&x.type==="element")){const m=x.children[0];m&&m.type==="text"&&(m.value=eu(m.value))}Array.isArray(x)?f.push(...x):f.push(x)}}}return f}}function qT(e,t){e.position&&(t.position=AE(e))}function KT(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,Bo(s)),"children"in n&&n.children&&o!==null&&o!==void 0&&(n.children=o)}return n}function JT(e,t){const n=t.data||{},r="value"in t&&!(Fi.call(n,"hProperties")||Fi.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 GT(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 eu(e){let t=0,n=e.charCodeAt(t);for(;n===9||n===32;)t++,n=e.charCodeAt(t);return e.slice(t)}function tu(e,t){const n=ZT(e,t),r=n.one(e,void 0),o=OT(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 YT(e,t){return e&&"run"in e?async function(n,r){const o=tu(n,{file:r,...t});await e.run(o,r)}:function(n,r){return tu(n,{file:r,...e||t})}}function nu(e){if(e)throw e}var Zs,ru;function XT(){if(ru)return Zs;ru=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},a=function(u,d){if(d==="__proto__")if(e.call(u,d)){if(r)return r(u,d).value}else return;return u[d]};return Zs=function c(){var u,d,f,h,p,x,m=arguments[0],g=1,y=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<y;++g)if(u=arguments[g],u!=null)for(d in u)f=a(m,d),h=a(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},Zs}var QT=XT();const qs=Gi(QT);function $i(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 e4(){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);a(null,...o);function a(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,a)(...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 a=e.length>i.length;let c;a&&i.push(o);try{c=e.apply(this,i)}catch(u){const d=u;if(a&&n)throw d;return o(d)}a||(c&&c.then&&typeof c.then=="function"?c.then(s,o):c instanceof Error?o(c):s(c))}function o(i,...a){n||(n=!0,t(i,...a))}function s(i){o(null,i)}}const It={basename:n4,dirname:r4,extname:o4,join:s4,sep:"/"};function n4(e,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');Vr(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,a=t.length-1;for(;o--;)if(e.codePointAt(o)===47){if(s){n=o+1;break}}else i<0&&(s=!0,i=o+1),a>-1&&(e.codePointAt(o)===t.codePointAt(a--)?a<0&&(r=o):(a=-1,r=i));return n===r?r=i:r<0&&(r=e.length),e.slice(n,r)}function r4(e){if(Vr(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 o4(e){Vr(e);let t=e.length,n=-1,r=0,o=-1,s=0,i;for(;t--;){const a=e.codePointAt(t);if(a===47){if(i){r=t+1;break}continue}n<0&&(i=!0,n=t+1),a===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 s4(...e){let t=-1,n;for(;++t<e.length;)Vr(e[t]),e[t]&&(n=n===void 0?e[t]:n+"/"+e[t]);return n===void 0?".":i4(n)}function i4(e){Vr(e);const t=e.codePointAt(0)===47;let n=a4(e,!t);return n.length===0&&!t&&(n="."),n.length>0&&e.codePointAt(e.length-1)===47&&(n+="/"),t?"/"+n:n}function a4(e,t){let n="",r=0,o=-1,s=0,i=-1,a,c;for(;++i<=e.length;){if(i<e.length)a=e.codePointAt(i);else{if(a===47)break;a=47}if(a===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 a===46&&s>-1?s++:s=-1}return n}function Vr(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const l4={cwd:c4};function c4(){return"/"}function Bi(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function u4(e){if(typeof e=="string")e=new URL(e);else if(!Bi(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 d4(e)}function d4(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 Ks=["history","path","basename","stem","extname","dirname"];class Em{constructor(t){let n;t?Bi(t)?n={path:t}:typeof t=="string"||f4(t)?n={value:t}:n=t:n={},this.cwd="cwd"in n?"":l4.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let r=-1;for(;++r<Ks.length;){const s=Ks[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)Ks.includes(o)||(this[o]=n[o])}get basename(){return typeof this.path=="string"?It.basename(this.path):void 0}set basename(t){Gs(t,"basename"),Js(t,"basename"),this.path=It.join(this.dirname||"",t)}get dirname(){return typeof this.path=="string"?It.dirname(this.path):void 0}set dirname(t){ou(this.basename,"dirname"),this.path=It.join(t||"",this.basename)}get extname(){return typeof this.path=="string"?It.extname(this.path):void 0}set extname(t){if(Js(t,"extname"),ou(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=It.join(this.dirname,this.stem+(t||""))}get path(){return this.history[this.history.length-1]}set path(t){Bi(t)&&(t=u4(t)),Gs(t,"path"),this.path!==t&&this.history.push(t)}get stem(){return typeof this.path=="string"?It.basename(this.path,this.extname):void 0}set stem(t){Gs(t,"stem"),Js(t,"stem"),this.path=It.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 Js(e,t){if(e&&e.includes(It.sep))throw new Error("`"+t+"` cannot be a path: did not expect `"+It.sep+"`")}function Gs(e,t){if(!e)throw new Error("`"+t+"` cannot be empty")}function ou(e,t){if(!e)throw new Error("Setting `"+t+"` requires `path` to be set too")}function f4(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const p4=(function(e){const r=this.constructor.prototype,o=r[e],s=function(){return o.apply(s,arguments)};return Object.setPrototypeOf(s,r),s}),h4={}.hasOwnProperty;class tl extends p4{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=e4()}copy(){const t=new tl;let n=-1;for(;++n<this.attachers.length;){const r=this.attachers[n];t.use(...r)}return t.data(qs(!0,{},this.namespace)),t}data(t,n){return typeof t=="string"?arguments.length===2?(Qs("data",this.frozen),this.namespace[t]=n,this):h4.call(this.namespace,t)&&this.namespace[t]||void 0:t?(Qs("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=ao(t),r=this.parser||this.Parser;return Ys("parse",r),r(String(n),n)}process(t,n){const r=this;return this.freeze(),Ys("process",this.parser||this.Parser),Xs("process",this.compiler||this.Compiler),n?o(void 0,n):new Promise(o);function o(s,i){const a=ao(t),c=r.parse(a);r.run(c,a,function(d,f,h){if(d||!f||!h)return u(d);const p=f,x=r.stringify(p,h);x4(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(),Ys("processSync",this.parser||this.Parser),Xs("processSync",this.compiler||this.Compiler),this.process(t,o),iu("processSync","process",n),r;function o(s,i){n=!0,nu(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,a){const c=ao(n);o.run(t,c,u);function u(d,f,h){const p=f||t;d?a(d):i?i(p):r(void 0,p,h)}}}runSync(t,n){let r=!1,o;return this.run(t,n,s),iu("runSync","run",r),o;function s(i,a){nu(i),o=a,r=!0}}stringify(t,n){this.freeze();const r=ao(n),o=this.compiler||this.Compiler;return Xs("stringify",o),su(t),o(t,r)}use(t,...n){const r=this.attachers,o=this.namespace;if(Qs("use",this.frozen),t!=null)if(typeof t=="function")c(t,n);else if(typeof t=="object")Array.isArray(t)?a(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");a(u.plugins),u.settings&&(o.settings=qs(!0,o.settings,u.settings))}function a(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];$i(m)&&$i(p)&&(p=qs(!0,m,p)),r[h]=[u,p,...x]}}}}const m4=new tl().freeze();function Ys(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function Xs(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function Qs(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(!$i(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function iu(e,t,n){if(!n)throw new Error("`"+e+"` finished async. Use `"+t+"` instead")}function ao(e){return g4(e)?e:new Em(e)}function g4(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function x4(e){return typeof e=="string"||y4(e)}function y4(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const b4="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",au=[],lu={allowDangerousHtml:!0},v4=/^(https?|ircs?|mailto|xmpp)$/i,w4=[{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 cu(e){const t=k4(e),n=_4(e);return S4(t.runSync(t.parse(n),n),e)}function k4(e){const t=e.rehypePlugins||au,n=e.remarkPlugins||au,r=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...lu}:lu;return m4().use(nT).use(n).use(YT,r).use(t)}function _4(e){const t=e.children||"",n=new Em;return typeof t=="string"&&(n.value=t),n}function S4(e,t){const n=t.allowedElements,r=t.allowElement,o=t.components,s=t.disallowedElements,i=t.skipHtml,a=t.unwrapDisallowed,c=t.urlTransform||C4;for(const d of w4)Object.hasOwn(t,d.from)&&(""+d.from+(d.to?"use `"+d.to+"` instead":"remove it")+b4+d.id,void 0);return jm(e,u),OE(e,{Fragment:l.Fragment,components:o,ignoreInvalidStyle:!0,jsx:l.jsx,jsxs:l.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 Vs)if(Object.hasOwn(Vs,p)&&Object.hasOwn(d.properties,p)){const x=d.properties[p],m=Vs[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 a&&d.children?h.children.splice(f,1,...d.children):h.children.splice(f,1),f}}}function C4(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||v4.test(e.slice(0,t))?e:""}function Nm(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 vr(e){return e!==null&&(Array.isArray(e)||typeof e=="object")}function Tm(e){return Array.isArray(e)?e.map((t,n)=>[String(n),t]):typeof e=="object"&&e!==null?Object.entries(e):[]}const uu=120;function j4({text:e}){const[t,n]=b.useState(!1);return e.length>uu?l.jsxs("span",{className:"text-emerald-400 break-all",children:['"',t?l.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:l.jsx(cu,{children:e})}):l.jsxs(De,{delayDuration:300,children:[l.jsxs(Fe,{onClick:o=>{o.stopPropagation(),n(!0)},className:"text-left cursor-pointer",children:[l.jsx("span",{children:e.slice(0,uu)}),l.jsx("span",{className:"text-emerald-400/50",children:"…"})]}),l.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?"…":""]})]}),'"']}):l.jsxs("span",{className:"text-emerald-400 break-all",children:['"',l.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:l.jsx(cu,{children:e})}),'"']})}function Am({value:e}){if(e===null)return l.jsx("span",{className:"text-rose-400 italic",children:"null"});switch(typeof e){case"string":return l.jsx(j4,{text:e});case"number":return l.jsx("span",{className:"text-amber-400",children:e});case"boolean":return l.jsx("span",{className:"text-blue-400",children:e?"true":"false"});case"object":case"bigint":case"symbol":case"undefined":case"function":return l.jsx("span",{className:"text-muted-foreground",children:JSON.stringify(e)})}}function du({value:e}){const[t,n]=b.useState(!1);function r(o){o.stopPropagation(),window.navigator.clipboard.writeText(JSON.stringify(e,null,2)).then(()=>{n(!0),setTimeout(()=>{n(!1)},2e3)})}return l.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?l.jsx(ct,{className:"size-3 text-green-500"}):l.jsx(Ft,{className:"size-3"})})}function E4({value:e}){const[t,n]=b.useState(!1);function r(o){o.stopPropagation(),window.navigator.clipboard.writeText(JSON.stringify(e,null,2)).then(()=>{n(!0),setTimeout(()=>{n(!1)},2e3)})}return l.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?l.jsx(ct,{className:"size-3 text-green-500"}):l.jsx(Ft,{className:"size-3 text-muted-foreground"})})}function N4({onClick:e}){return l.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:l.jsx(Bd,{className:"size-3.5 text-muted-foreground"})})}const T4=b.memo(function e({name:t,value:n,level:r,defaultExpandDepth:o,isArrayItem:s,path:i,expandTargetPath:a,anatomyPaths:c}){const u=b.useMemo(()=>a===null?!1:i===""?a.length>0:a===i||a.startsWith(`${i}/`),[a,i]),d=r<o||u&&vr(n),[f,h]=b.useState(d);b.useEffect(()=>{u&&vr(n)&&!f&&h(!0)},[a]);const[p,x]=b.useState(0),[m,g]=b.useState(null),y=vr(n),v=m===Number.POSITIVE_INFINITY,k=b.useMemo(()=>Tm(n),[n]),S=b.useMemo(()=>k.some(([,w])=>vr(w)),[k]),C=Nm(n),j=C==="array"?"[":"{",N=C==="array"?"]":"}",I=c!==null&&c.has(i);function R(){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(),R()}const L=m??o;return l.jsxs("div",{className:be(r>0&&"border-l border-border/50 ml-2"),children:[l.jsxs("div",{className:be("flex items-start gap-1 py-0.5 px-1 -ml-1 rounded-sm group/row",y&&"cursor-pointer hover:bg-muted/50"),"data-anatomy-path":I?i:void 0,onClick:y?$:void 0,onKeyDown:y?w=>{(w.key==="Enter"||w.key===" ")&&(w.preventDefault(),$())}:void 0,onDoubleClick:y&&S?()=>R():void 0,role:y?"button":void 0,tabIndex:y?0:void 0,children:[y?l.jsx("span",{className:"w-4 h-5 flex items-center justify-center shrink-0",children:f?l.jsx(Yt,{className:"size-3 text-muted-foreground"}):l.jsx(un,{className:"size-3 text-muted-foreground"})}):l.jsx("span",{className:"w-4 shrink-0"}),l.jsx("span",{className:be("shrink-0",s?"text-muted-foreground":"text-cyan-400"),children:s?t:`"${t}"`}),l.jsx("span",{className:"text-muted-foreground shrink-0",children:y?"":":"}),y?l.jsxs("span",{className:"text-muted-foreground",children:[j,l.jsxs("span",{className:"text-muted-foreground/60 text-xs",children:[" ",k.length," ",k.length===1?"item":"items"," ",N]})]}):l.jsx("span",{className:"min-w-0",children:l.jsx(Am,{value:n})}),y&&S&&!v&&l.jsx(N4,{onClick:E}),l.jsx(E4,{value:n})]}),y&&f&&l.jsxs("div",{className:"pl-4",children:[k.map(([w,M])=>l.jsx(e,{name:w,value:M,level:r+1,defaultExpandDepth:L,isArrayItem:C==="array",path:i===""?`/${w}`:`${i}/${w}`,expandTargetPath:a,anatomyPaths:c},w)),l.jsx("div",{className:"text-muted-foreground py-0.5 px-1",children:N})]},p)]})});function nl({data:e,defaultExpandDepth:t=0,className:n,showCopy:r=!1,bulkDepth:o,bulkRevision:s,anatomyPaths:i=null,expandToPath:a=null}){const c=vr(e),u=b.useMemo(()=>Tm(e),[e]),d=o??t,f=s??0;if(!c)return l.jsx(Xe,{children:l.jsx("div",{className:be("font-mono text-xs leading-relaxed",n),children:l.jsxs("div",{className:"flex items-center gap-1",children:[l.jsx(Am,{value:e}),r&&l.jsx(du,{value:e})]})})});const p=Nm(e)==="array";return l.jsx(Xe,{children:l.jsxs("div",{className:be("font-mono text-xs leading-relaxed",n),children:[r&&l.jsx("div",{className:"mb-2 flex items-center justify-end gap-2",children:l.jsx(du,{value:e})}),l.jsx("div",{children:u.map(([x,m])=>l.jsx(T4,{name:x,value:m,level:0,defaultExpandDepth:d,isArrayItem:p,path:`/${x}`,expandTargetPath:a,anatomyPaths:i},x))},f)]})})}const A4=b.memo(function({text:t,defaultExpandDepth:n=0,className:r,bulkDepth:o,bulkRevision:s}){const i=b.useMemo(()=>Mh(t),[t]);return i.kind==="json"?l.jsx(nl,{data:i.data,defaultExpandDepth:n,className:r,bulkDepth:o,bulkRevision:s}):l.jsx("pre",{className:be("font-mono text-xs whitespace-pre-wrap break-words",r),children:t})}),Im=Object.freeze(Object.defineProperty({__proto__:null,JsonViewer:nl,JsonViewerFromString:A4},Symbol.toStringTag,{value:"Module"}));function I4({className:e,children:t,...n}){return l.jsxs(pC,{"data-slot":"scroll-area",className:be("relative overflow-hidden",e),...n,children:[l.jsx(hC,{"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}),l.jsx(z4,{}),l.jsx(mC,{})]})}function z4({className:e,orientation:t="vertical",...n}){return l.jsx(Ap,{"data-slot":"scroll-area-scrollbar",orientation:t,className:be("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:l.jsx(Pp,{"data-slot":"scroll-area-thumb",className:"bg-border relative flex-1 rounded-full"})})}const zm={file:"file",shell:"shell",browser:"browser",web:"web",mcp:"MCP",code:"code",other:"other"},R4={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 P4({category:e}){switch(e){case"file":return l.jsx(Tv,{className:"size-3.5"});case"shell":return l.jsx(Zd,{className:"size-3.5"});case"browser":return l.jsx(Hv,{className:"size-3.5"});case"web":return l.jsx(Hd,{className:"size-3.5"});case"mcp":return l.jsx(Wb,{className:"size-3.5"});case"code":return l.jsx(fv,{className:"size-3.5"});case"other":return l.jsx(yv,{className:"size-3.5"})}}function O4({names:e}){return e.length===0?null:l.jsxs("div",{className:"flex min-w-0 flex-wrap items-center gap-1",children:[l.jsx("span",{className:"text-[10px] uppercase tracking-wide text-muted-foreground",children:"required"}),e.slice(0,4).map(t=>l.jsx(jt,{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&&l.jsxs("span",{className:"font-mono text-[10px] text-muted-foreground",children:["+",e.length-4]})]})}function M4({tool:e,called:t}){const[n,r]=b.useState(!1),o=gn(e.name),s=e.description!==null||e.requiredParameters.length>0||e.schema!==null;return l.jsx(sE,{open:n,onOpenChange:r,children:l.jsxs("div",{className:"rounded-md border border-border/60 bg-background/40",children:[l.jsxs("div",{className:"flex min-w-0 items-center gap-2 px-2.5 py-2",children:[l.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:[l.jsx(P4,{category:e.category}),l.jsx("span",{className:"min-w-0 truncate font-mono text-xs font-semibold text-foreground/90",children:e.name}),t&&l.jsx(jt,{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"}),l.jsxs("span",{className:"font-mono text-[10px] text-muted-foreground",children:[e.parameterCount," params"]}),e.descriptionPreview!==null&&l.jsx("span",{className:"hidden min-w-0 truncate text-xs text-muted-foreground md:inline",children:e.descriptionPreview}),l.jsx("span",{className:"flex-1"}),s&&(n?l.jsx(Yt,{className:"size-3.5 shrink-0 text-muted-foreground"}):l.jsx(un,{className:"size-3.5 shrink-0 text-muted-foreground"}))]}),l.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?l.jsx(ct,{className:"size-3.5 text-emerald-400"}):l.jsx(Ft,{className:"size-3.5"})})]}),l.jsx(iE,{children:l.jsxs("div",{className:"space-y-2 border-t border-border/60 px-2.5 py-2",children:[e.description!==null&&l.jsx("p",{className:"text-xs leading-relaxed text-muted-foreground",children:e.description}),l.jsx(O4,{names:e.requiredParameters}),e.schema!==null&&l.jsx(I4,{className:"max-h-64 rounded-md border border-border/60 bg-muted/20 p-2",children:l.jsx(nl,{data:Fo(e.schema),defaultExpandDepth:0})})]})})]})})}function L4(e,t){return t.length===0?!0:`${e.name} ${e.description??""} ${zm[e.category]}`.toLowerCase().trim().includes(t)}const D4=b.memo(function({summary:t,calledToolNames:n}){const[r,o]=b.useState(!1),[s,i]=b.useState(""),a=b.useMemo(()=>new Set(n),[n]),c=s.trim().toLowerCase(),u=b.useMemo(()=>t===null?[]:t.tools.filter(h=>L4(h,c)),[c,t]);if(t===null)return null;const d=t.tools.slice(0,6),f=t.tools.length-d.length;return l.jsxs("section",{className:"mb-3 rounded-lg border border-border/70 bg-muted/20",children:[l.jsxs("div",{className:"flex min-w-0 flex-wrap items-center gap-2 px-3 py-2",children:[l.jsxs("div",{className:"flex min-w-0 flex-1 items-center gap-2",children:[l.jsx(Dr,{className:"size-4 shrink-0 text-sky-300/80"}),l.jsxs("div",{className:"min-w-0",children:[l.jsxs("div",{className:"flex min-w-0 flex-wrap items-center gap-1.5",children:[l.jsx("span",{className:"text-sm font-semibold text-foreground",children:"Request Tools"}),l.jsx(jt,{variant:"outline",className:"h-5 rounded-md px-1.5 py-0 font-mono text-[10px]",children:t.tools.length}),t.toolChoiceLabel!==null&&l.jsxs(jt,{variant:"outline",className:"h-5 rounded-md px-1.5 py-0 font-mono text-[10px] text-muted-foreground",children:["tool_choice: ",t.toolChoiceLabel]})]}),l.jsx("div",{className:"mt-1 flex min-w-0 flex-wrap gap-1",children:t.categories.map(h=>l.jsxs(jt,{variant:"outline",className:be("h-5 rounded-md px-1.5 py-0 font-mono text-[10px]",R4[h.category]),children:[h.count," ",zm[h.category]]},h.category))})]})]}),l.jsxs(Re,{type:"button",variant:"ghost",size:"sm",className:"h-7 px-2",onClick:()=>o(h=>!h),"aria-expanded":r,children:[r?l.jsx(Yt,{className:"size-3.5"}):l.jsx(un,{className:"size-3.5"}),r?"Hide":"Show"]})]}),l.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=>l.jsx(jt,{variant:"outline",className:be("h-5 max-w-44 truncate rounded-md px-1.5 py-0 font-mono text-[10px]",a.has(h.name)&&"border-emerald-400/20 text-emerald-300"),children:h.name},h.name)),f>0&&l.jsxs("span",{className:"font-mono text-[10px] leading-5 text-muted-foreground",children:["+",f]})]}),r&&l.jsxs("div",{className:"space-y-2 border-t border-border/60 px-3 py-3",children:[l.jsxs("label",{className:"flex h-8 items-center gap-2 rounded-md border border-border/70 bg-background/50 px-2 text-xs",children:[l.jsx(l2,{className:"size-3.5 shrink-0 text-muted-foreground"}),l.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"})]}),l.jsx("div",{className:"grid gap-1.5",children:u.length>0?u.map(h=>l.jsx(M4,{tool:h,called:a.has(h.name)},h.name)):l.jsx("p",{className:"py-2 text-xs text-muted-foreground",children:"No matching tools"})})]})]})}),F4="/v1/chat/completions",$4="/chat/completions",B4="/v1/messages";class U4{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 ar=new U4;function V4(e){return ar.getByPath(e)??null}function H4(e){return V4(e)?.format??"unknown"}ar.registerPath(B4,"anthropic");ar.registerPath(F4,"openai");ar.registerPath($4,"openai");function W4(e){if(e==="")return{};try{const t=JSON.parse(e);return t!==null&&typeof t=="object"&&!Array.isArray(t)?{...t}:{}}catch{return{}}}function Z4(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:W4(e.inputJson)}}}function Rm(e,t,n,r){const o=new Map;let s="",i="",a=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 y=g.trim();if(y.startsWith("data: "))try{const v=JSON.parse(y.slice(6)),k=yb.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":a=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],[y])=>g-y).map(([,g])=>Z4(g));return JSON.stringify({id:s,type:"message",model:i!==""?i:n??"",role:"assistant",content:m,stop_reason:a,stop_sequence:c,usage:{input_tokens:u,output_tokens:d}})}const q4={format:"anthropic",parseRequest(e,t){try{const n=JSON.parse(e),r=Td.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=Ad.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 Rm(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}}};ar.register(q4);class K4{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 ys=new K4,J4="https://api.anthropic.com",G4={MiniMax:"https://api.minimaxi.com/anthropic"},Y4={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(G4))if(t.startsWith(n.toLowerCase()))return!0;return!0},getUpstreamBase(e,t){return t?.baseUrl!==void 0?t.baseUrl:J4},extractStream(e,t,n,r){return Rm(e,t,n,r)}};ys.register(Y4);function bs(e,t,n,r=!0){let o="",s="",i="",a="",c=null,u=0,d=0,f=!1,h=!1;const p=new Map,x=1e3;let m=0,g=0;const y=[];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 R=Object.getOwnPropertyDescriptor(j,"error");if(R!==void 0&&typeof R.value=="object"&&R.value!==null){const O=Object.getOwnPropertyDescriptor(R.value,"message");O!==void 0&&typeof O.value=="string"&&(t.error=O.value);continue}}const N=Sb.safeParse(j);if(!N.success)continue;const I=N.data;if(m===0&&(g=Date.now()),r===!0&&y.length<x&&y.push({index:m,timestamp:Date.now()-g,type:"chat.completion.chunk",data:I}),m++,h||(o=I.id,s=I.model,h=!0),!f&&I.usage!==void 0&&I.usage!==null){if(u=I.usage.prompt_tokens??0,d=I.usage.completion_tokens??0,t.inputTokens=u,typeof j=="object"&&j!==null&&!Array.isArray(j)){const R=Object.getOwnPropertyDescriptor(j,"usage");if(R!==void 0&&typeof R.value=="object"&&R.value!==null){const O=Object.getOwnPropertyDescriptor(R.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 R of I.choices){const O=R.delta;O.content!==void 0&&O.content!==null&&(i+=O.content),O.reasoning_content!==void 0&&O.reasoning_content!==null&&(a+=O.reasoning_content),O.thinking!==void 0&&O.thinking!==null&&(a+=O.thinking);const $=O.think;if($!=null&&(a+=$),R.finish_reason!==void 0&&R.finish_reason!==null&&(c=R.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:y,truncated:m>x}),f||(d=Math.ceil(i.length/4)),t.outputTokens=d;const v={role:"assistant",content:i};return a&&(v.reasoning_content=a),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 X4={format:"openai",parseRequest(e,t){try{const n=JSON.parse(e),r=Rd.safeParse(n);return r.success?{model:r.data.model,sessionId:t?.get("x-session-affinity")??null}:null}catch{return null}},extractTokens(e){const t=Od(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 bs(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}}};ar.register(X4);const Q4="https://api.openai.com/v1",eA={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:Q4},extractStream(e,t,n,r){return bs(e,t,n,r)}};ys.register(eA);const tA="https://open.bigmodel.cn/api/paas/v4",nA=["glm-","charglm-","cogview-","embedding-","rerank-"],rA={name:"zhipu",matches(e){const t=e.toLowerCase().replace(/\s+/g,"-");return nA.some(n=>t.startsWith(n))},getUpstreamBase(e,t){return t?.baseUrl??tA},extractStream(e,t,n,r){return bs(e,t,n,r)}};ys.register(rA);const oA="https://dashscope.aliyuncs.com/compatible-mode/v1",sA={name:"alibaba",matches(e){const t=e.toLowerCase().replace(/\s+/g,"-");return!!(t.startsWith("glm-5")||t.startsWith("qwen"))},getUpstreamBase(e,t){return oA},extractStream(e,t,n){return bs(e,t,n)}};ys.register(sA);function Pm(e,t){for(const n of Array.from(e))t(n)}const iA=/[\u3000-\u9FFF\uAC00-\uD7FF\uF900-\uFAFF\uFF00-\uFFEF\u{1F300}-\u{1FAFF}]/u;function rl(e){if(e.length===0)return 0;let t=0,n=0;return Pm(e,r=>{iA.test(r)?t+=1:n+=1}),Math.ceil(t*1)+Math.ceil(n/4)}function ol(e){if(e.length===0)return 0;let t=0;return Pm(e,()=>{t+=1}),t}function yn(e){return{parsed:null,comparisonValue:e,messageCount:null,toolCount:null}}const Wn={parsed:null,toolNames:null};function aA(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 a=i.text;typeof a=="string"&&t.push(a)}}break}case"image":t.push("[image]");break}}return t.join(`
|
|
109
|
-
`)}function lA(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 cA(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 ei(e,t,n,r){return{role:e,label:t,text:n,size:rl(n),characters:ol(n),path:r}}const uA={format:"anthropic",analyzeRequest(e){if(e===null)return yn(e);try{const t=Td.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}:yn(e)}catch{return yn(e)}},analyzeResponse(e){if(e===null)return Wn;try{let t=JSON.parse(e);typeof t=="string"&&(t=JSON.parse(t));const n=Ad.safeParse(t);if(!n.success)return Wn;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 Wn}},anatomySegments(e){if(e===null||typeof e!="object")return null;const t=e,n=[];if(t.system!==void 0){const r=lA(t.system);r.length>0&&n.push(ei("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",a=aA(s.content);n.push(ei(i,`[${o}] ${i}`,a,`/messages/${o}`))}),Array.isArray(t.tools)&&t.tools.length>0){const r=cA(t.tools);n.push(ei("tools","tools",r,"/tools"))}return n.length>0?n:null}};function dA(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 fA(e){const t=[],n=dA(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 a=typeof i.name=="string"?i.name:"",c=typeof i.arguments=="string"?i.arguments:"";t.push(`${a} ${c}`.trim())}return t.join(`
|
|
113
|
-
`)}function pA(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 fu(e,t,n,r){return{role:e,label:t,text:n,size:rl(n),characters:ol(n),path:r}}const hA={format:"openai",analyzeRequest(e){if(e===null)return yn(e);try{const t=Rd.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}:yn(e)}catch{return yn(e)}},analyzeResponse(e){if(e===null)return Wn;const t=Od(e);if(t===null)return Wn;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",a=fA(s);n.push(fu(i,`[${o}] ${i}`,a,`/messages/${o}`))}),Array.isArray(t.tools)&&t.tools.length>0){const r=pA(t.tools);n.push(fu("tools","tools",r,"/tools"))}return n.length>0?n:null}},mA={format:"unknown",analyzeRequest(e){return yn(e)},analyzeResponse(){return Wn},anatomySegments(){return null}},gA={anthropic:uA,openai:hA,unknown:mA};function Om(e){return gA[e]}function Or(e){const t=H4(e.path);return t==="unknown"?e.apiFormat:t}const Jt="agent-inspector:focus-log";function Ui(e){window.dispatchEvent(new CustomEvent(Jt,{detail:e}))}function vs(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 pu(e,t,n){return e==="anthropic"&&t==="full"&&n}function xA(e,t){return e==="full"&&t}function yA(e,t,n,r){return e==="anthropic"&&t==="full"&&n&&r}const bA=["file","shell","browser","web","mcp","code","other"];function Vi(e){const t=e.replace(/\s+/g," ").trim();return t.length<=120?t:`${t.slice(0,119)}...`}function Mm(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?Vi(t.slice(0,n+1)):Vi(t)}function vA(e,t){return`${e} ${t??""}`.toLowerCase()}function Mn(e,t){return t.some(n=>e.includes(n))}function Lm(e,t){const n=vA(e,t);return e.startsWith("mcp__")||e.startsWith("inspector_")||Mn(n,[" mcp","model context protocol"])?"mcp":Mn(n,["bash","shell","terminal","command","powershell","exec","process"])?"shell":Mn(n,["browser","playwright","screenshot","click","navigate","page","tab"])?"browser":Mn(n,["read","write","edit","file","glob","grep","patch","filesystem","directory"])?"file":Mn(n,["web","search","http","url","fetch"])?"web":Mn(n,["code","typescript","javascript","python","repl"])?"code":"other"}function Dm(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 Fm(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 wA(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:Mm(o),category:Lm(t,o),parameterCount:Dm(r).length,requiredParameters:Fm(r),schema:r}}function kA(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:Mm(s),category:Lm(n,s),parameterCount:Dm(o).length,requiredParameters:Fm(o),schema:o}}function _A(e){const t=kA(e);return t!==null?t:wA(e)}function SA(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:Vi(o)}function CA(e){const t=new Map;for(const n of e)t.set(n.category,(t.get(n.category)??0)+1);return bA.flatMap(n=>{const r=t.get(n)??0;return r>0?[{category:n,count:r}]:[]})}function jA(e){const t=Oe(e,"tools");if(!Array.isArray(t)||t.length===0)return null;const n=[];for(const r of t){const o=_A(r);o!==null&&n.push(o)}return n.length===0?null:{tools:n,toolChoiceLabel:SA(Oe(e,"tool_choice")),categories:CA(n)}}function Ln(){return l.jsx("div",{className:"h-1","aria-hidden":"true"})}function EA(e,t){switch(e){case"anatomy":return t===null?"request":"anatomy";case"request":return"request"}}function NA({active:e,onClick:t}){return l.jsxs(De,{children:[l.jsx(Fe,{asChild:!0,children:l.jsxs(Re,{variant:e?"default":"outline",size:"sm",className:"h-8 text-xs",onClick:t,"aria-pressed":e,children:[l.jsx(Rv,{className:"size-3.5 mr-1"}),e?"Showing diff":"Diff with Raw"]})}),l.jsx($e,{children:e?"Hide diff view":"Compare proxy output against the original raw version"})]})}const TA=b.memo(function({rawBody:e,displayedBody:t,emptyLabel:n}){const r=b.useMemo(()=>zj(e,t),[e,t]);return l.jsx(Zh,{result:r,emptyLabel:n})}),AA=b.memo(function({rawHeaders:e,headers:t,emptyLabel:n}){const r=b.useMemo(()=>Ij(e,t),[e,t]);return l.jsx(Zh,{result:r,emptyLabel:n})}),IA=b.memo(function({log:e,viewMode:t="simple",strip:n,slowResponseThresholdSeconds:r,timeDisplayFormat:o,cacheTrend:s=null,onCompareWithPrevious:i}){const[a,c]=b.useState(!1),[u,d]=b.useState(!1),[f,h]=b.useState(!1),[p,x]=b.useState(!1),[m,g]=b.useState("request"),[y,v]=b.useState(null),k=b.useRef(null),S=Or(e),C=Om(S),j=b.useMemo(()=>C.analyzeRequest(e.rawRequestBody),[C,e.rawRequestBody]),N=b.useMemo(()=>C.analyzeResponse(e.responseText),[C,e.responseText]),R=b.useMemo(()=>!n||S!=="anthropic"||e.rawRequestBody===null?null:hj(e.rawRequestBody).body,[e.rawRequestBody,S,n])??e.rawRequestBody,O=Ds(R),$=Ds(e.rawRequestBody),E=Ds(e.responseText),L=b.useMemo(()=>e.headers&&Object.keys(e.headers).length>0?JSON.stringify(e.headers,null,2):null,[e.headers]),w=b.useMemo(()=>e.rawHeaders&&Object.keys(e.rawHeaders).length>0?JSON.stringify(e.rawHeaders,null,2):null,[e.rawHeaders]),M=gn(R),U=gn(e.rawRequestBody),F=gn(L),V=gn(w),J=gn(e.responseText),z=b.useMemo(()=>({request:{copyLabel:"Copy request body",copyText:R,copyCopied:M.copied,onCopy:M.copy,expansion:{isExpanded:O.isExpanded,isPending:O.isPending,onToggle:O.toggle},diffWithRaw:yA(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:V.copied,onCopy:V.copy,expansion:null},raw:{copyLabel:"Copy response",copyText:e.responseText,copyCopied:J.copied,onCopy:J.copy,expansion:{isExpanded:E.isExpanded,isPending:E.isPending,onToggle:E.toggle}}}),[R,M,O,p,e.rawRequestBody,U,$,L,F,w,V,e.responseText,J,E,S,t,n,i]),H=b.useMemo(()=>O.parsedData!==null?C.anatomySegments(O.parsedData):null,[C,O.parsedData]),Z=b.useMemo(()=>jA(O.parsedData),[O.parsedData]),P=b.useMemo(()=>{if(H!==null)return new Set(H.map(Q=>Q.path))},[H]),ee=Cj({containerRef:k,setExpandToPath:v,ensureTabActive:()=>{m!=="request"&&g("request")}});return b.useEffect(()=>{a&&g(H!==null?"anatomy":"request")},[H,a]),b.useEffect(()=>{const Q=de=>{const ae=vs(de);ae!==null&&ae.logId===e.id&&(c(!0),g(EA(ae.tab,H)))};return window.addEventListener(Jt,Q),()=>{window.removeEventListener(Jt,Q)}},[H,e.id]),l.jsxs(Xe,{children:[l.jsxs("div",{className:"border border-border rounded-lg mb-1 overflow-hidden",children:[l.jsx(oE,{log:e,messageCount:j.messageCount,toolCount:j.toolCount,expanded:a,onToggle:()=>c(!a),cacheTrend:s,slowResponseThresholdSeconds:r,timeDisplayFormat:o,activeTab:m,tabActions:z,onReplay:i===void 0?void 0:()=>{d(!0)}}),a&&l.jsx("div",{onClick:Q=>Q.stopPropagation(),onKeyDown:Q=>Q.stopPropagation(),children:l.jsxs(Lh,{value:m,onValueChange:g,children:[l.jsxs(Dh,{className:"mx-4 mt-2",children:[t==="full"&&l.jsx(St,{value:"raw-headers",children:"Raw Headers"}),t==="full"&&l.jsx(St,{value:"headers",children:"Headers"}),H!==null&&l.jsx(St,{value:"anatomy",children:"Context"}),pu(S,t,n)&&l.jsx(St,{value:"raw-request",children:"Raw Request"}),l.jsx(St,{value:"request",children:"Request"}),t==="full"&&l.jsx(St,{value:"raw",children:"Raw Response"}),l.jsx(St,{value:"parsed",children:"Response"})]}),pu(S,t,n)&&l.jsx(Ct,{value:"raw-request",children:m==="raw-request"&&l.jsx("div",{className:"px-4 pt-1 pb-3",children:e.rawRequestBody===null?l.jsx("p",{className:"text-xs text-muted-foreground italic",children:"No request body"}):$.parsedData!==null?l.jsx(b.Suspense,{fallback:l.jsx(Ln,{}),children:l.jsx(mc,{data:$.parsedData,bulkDepth:$.bulkDepth,bulkRevision:$.bulkRevision})}):l.jsx("pre",{className:"font-mono text-xs whitespace-pre-wrap break-words",children:e.rawRequestBody})})}),l.jsx(Ct,{value:"request",children:m==="request"&&l.jsxs("div",{className:"px-4 pt-1 pb-3",children:[l.jsx(D4,{summary:Z,calledToolNames:N.toolNames??[]}),p?l.jsx(TA,{rawBody:e.rawRequestBody,displayedBody:R,emptyLabel:"No transformation applied; raw and sent request bodies are identical."}):l.jsx("div",{ref:k,children:R===null?l.jsx("p",{className:"text-xs text-muted-foreground italic",children:"No request body"}):O.parsedData!==null?l.jsx(b.Suspense,{fallback:l.jsx(Ln,{}),children:l.jsx(mc,{data:O.parsedData,bulkDepth:O.bulkDepth,bulkRevision:O.bulkRevision,anatomyPaths:P,expandToPath:y})}):l.jsx("pre",{className:"font-mono text-xs whitespace-pre-wrap break-words",children:R})})]})}),H!==null&&l.jsx(Ct,{value:"anatomy",children:m==="anatomy"&&l.jsx(b.Suspense,{fallback:l.jsx(Ln,{}),children:l.jsx(bj,{parsed:O.parsedData,inputTokens:e.inputTokens??null,model:e.model,segments:H,onSegmentActivate:ee})})}),t==="full"&&l.jsx(Ct,{value:"headers",children:m==="headers"&&l.jsxs("div",{className:"px-4 pt-1 pb-3",children:[l.jsx("div",{className:"flex justify-end gap-2 mb-2",children:xA(t,e.rawHeaders!==void 0&&Object.keys(e.rawHeaders).length>0)&&l.jsx(NA,{active:f,onClick:Q=>{Q.stopPropagation(),h(!f)}})}),f?l.jsx(AA,{rawHeaders:e.rawHeaders,headers:e.headers,emptyLabel:"No transformation applied; raw and processed headers are identical."}):e.headers&&Object.keys(e.headers).length>0?l.jsx("div",{className:"space-y-1 font-mono text-xs",children:Object.entries(e.headers).sort(([Q],[de])=>Q.localeCompare(de)).map(([Q,de])=>l.jsxs("div",{className:"flex gap-2",children:[l.jsxs("span",{className:"text-blue-600 dark:text-blue-400 font-semibold shrink-0",children:[Q,":"]}),l.jsx("span",{className:"text-muted-foreground truncate",title:de,children:de})]},Q))}):l.jsx("p",{className:"text-xs text-muted-foreground italic",children:"No headers captured"})]})}),t==="full"&&l.jsx(Ct,{value:"raw-headers",children:m==="raw-headers"&&l.jsx("div",{className:"px-4 pt-1 pb-3",children:e.rawHeaders&&Object.keys(e.rawHeaders).length>0?l.jsx("div",{className:"space-y-1 font-mono text-xs",children:Object.entries(e.rawHeaders).sort(([Q],[de])=>Q.localeCompare(de)).map(([Q,de])=>l.jsxs("div",{className:"flex gap-2",children:[l.jsxs("span",{className:"text-blue-600 dark:text-blue-400 font-semibold shrink-0",children:[Q,":"]}),l.jsx("span",{className:"text-muted-foreground truncate",title:de,children:de})]},Q))}):l.jsx("p",{className:"text-xs text-muted-foreground italic",children:"No raw headers captured"})})}),l.jsx(Ct,{value:"raw",children:m==="raw"&&l.jsxs("div",{className:"px-4 pt-1 pb-3 space-y-3",children:[e.error!==void 0&&e.error!==null&&l.jsxs("div",{className:"rounded border border-destructive/50 bg-destructive/10 p-3 text-xs",children:[l.jsx("div",{className:"font-semibold text-destructive mb-1",children:"SSE Error"}),l.jsx("div",{className:"text-muted-foreground font-mono",children:e.error})]}),e.responseText!==null?l.jsx(b.Suspense,{fallback:l.jsx(Ln,{}),children:l.jsx(kj,{text:e.responseText,defaultExpandDepth:0,bulkDepth:E.bulkDepth,bulkRevision:E.bulkRevision})}):l.jsx("p",{className:"text-xs text-muted-foreground italic",children:"No response"}),e.streaming===!0&&l.jsx(b.Suspense,{fallback:l.jsx(Ln,{}),children:l.jsx(wj,{logId:e.id,truncated:e.streamingChunksPath!==null})})]})}),l.jsx(Ct,{value:"parsed",children:m==="parsed"&&l.jsx("div",{className:"px-4 pt-1 pb-3",children:l.jsx(b.Suspense,{fallback:l.jsx(Ln,{}),children:l.jsx(vj,{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})})})})]})})]}),l.jsx(b.Suspense,{fallback:null,children:l.jsx(yj,{log:e,open:u,onOpenChange:d})})]})});function zA({stopReason:e,isPending:t,isFirst:n,isTurnStart:r,isOnlyEntry:o=!1,crabIndex:s=0,collapsible:i=!1,onToggle:a}){const c=e==="end_turn"||e==="stop",u=o&&r&&c,d=t&&!c,f=b.useMemo(()=>Do(s),[s]),h=b.useMemo(()=>K5(s),[s]),p=i&&a?{role:"button",tabIndex:0,className:"cursor-pointer",onClick:x=>{x.stopPropagation(),a()},onKeyDown:x=>{(x.key==="Enter"||x.key===" ")&&(x.preventDefault(),a())}}:{};return l.jsxs("div",{className:"flex flex-col items-center w-6 shrink-0 pt-0.5 pb-0.5",children:[l.jsx("div",{className:"flex justify-center h-[calc(0.75rem-8px)]",children:!n&&l.jsx("div",{className:"w-0.5 bg-muted-foreground/30 h-full"})}),u?l.jsx("span",{title:"Start and end of turn",children:l.jsx(h,{className:be("size-3.5 text-[#80FF00]","animate-crab-settle","drop-shadow-[0_0_4px_rgba(128,255,0,0.5)]")})}):c?l.jsx("span",{title:e==="end_turn"?"End of Turn (Anthropic)":"End of Turn (OpenAI)",...p,children:l.jsx(f,{className:be("size-3.5 text-amber-400","animate-crab-settle","drop-shadow-[0_0_4px_rgba(251,191,36,0.5)]")})}):r?l.jsx("span",{title:"Start of turn",...p,children:l.jsx(f,{className:be("size-3.5 text-emerald-400","animate-crab-appear","drop-shadow-[0_0_4px_rgba(52,211,153,0.5)]")})}):d?l.jsx("span",{title:"Processing…",children:l.jsx(f,{className:be("size-3.5 text-amber-300/80","animate-crab-crawl")})}):l.jsx("span",{children:l.jsx(f,{className:"size-3.5 text-muted-foreground/40"})}),l.jsx("div",{className:"flex-1 flex justify-center min-h-0",children:!c&&l.jsx("div",{className:be("w-0.5 h-full",t?"border-dashed bg-transparent border-l-2 border-muted-foreground/20":"bg-muted-foreground/30")})})]})}function RA({event:e}){const t=gn(e.argumentsText),n=e.argumentsText!==null;return l.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:[l.jsx(Dr,{className:"size-3.5 shrink-0 text-sky-400/70"}),l.jsx("span",{className:"font-mono font-semibold text-foreground/80",children:e.name}),e.argumentsPreview!==null&&l.jsxs(l.Fragment,{children:[l.jsx(un,{className:"size-3 shrink-0 text-muted-foreground/60"}),l.jsx("span",{className:"min-w-0 truncate font-mono text-muted-foreground",children:e.argumentsPreview})]}),n&&l.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?l.jsx(ct,{className:"size-3.5"}):l.jsx(Ft,{className:"size-3.5"})})]},e.id)}function PA({events:e}){return e.length===0?null:l.jsx("div",{className:"mx-3 mb-2 grid gap-1.5",children:e.map(t=>l.jsx(RA,{event:t},t.id))})}const hu=180;function OA(e,t){return e||t}function MA(e,t,n){return e>1&&t&&!n}function LA(e){const t=[];let n=[],r=0;for(const o of e){n.push({log:o,stopReason:O5(o)});const s=n[n.length-1];s!==void 0&&Ih(s.stopReason)&&(t.push({entries:n,turnIndex:r}),n=[],r+=1)}return n.length>0&&t.push({entries:n,turnIndex:r}),t}function DA(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=Or(o),a=Or(s);i==="unknown"||i!==a||t.set(o.id,s)}return t}function $m(e){if(e===null)return null;try{const t=JSON.parse(e);return typeof t=="string"?JSON.parse(t):t}catch{return null}}function Bm(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>hu?`${n.slice(0,hu-1)}...`:n}function Um(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 FA(e){const t=$m(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 a=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:Um(a),argumentsPreview:Bm(a)})}return r}function $A(e){const t=$m(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 a of i){const c=Oe(a,"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:Um(d),argumentsPreview:Bm(d)})}}return r}function sl(e){switch(Or(e)){case"anthropic":return FA(e);case"openai":return $A(e);case"unknown":return[]}}function BA(e,t,n=0){let r=0,o=0,s=0,i=0,a=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&&(a+=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+=sl(p).length;return{llmCallCount:e.length,toolCallCount:h,failedCallCount:r,pendingCallCount:o,slowCallCount:s,totalInputTokens:i,totalOutputTokens:a,totalCacheCreationInputTokens:c,totalCacheReadInputTokens:u,totalElapsedMs:d,maxElapsedMs:f,startedAt:e[0]?.timestamp??null,endedAt:e[e.length-1]?.timestamp??null,knowledgeCandidateCount:n}}function ti(e){return e<1e3?`${e}ms`:`${(e/1e3).toFixed(1)}s`}const UA=b.memo(function({entries:t,viewMode:n,strip:r,slowResponseThresholdSeconds:o,cacheTrends:s,onCompareWithPrevious:i,comparisonPredecessors:a,turnIndex:c=0,timeDisplayFormat:u}){const d=t.length-1,f=t[d]?.stopReason??null,h=f!==null?Ih(f):!1,p=t[d]?.log.responseStatus===null,x=t.length===1,m=MA(t.length,h,p),[g,y]=b.useState(!1),v=b.useRef(!1);b.useEffect(()=>{m?h&&!v.current&&y(!0):y(!1),v.current=h},[m,h]),b.useEffect(()=>{const U=F=>{const V=vs(F);V!==null&&t.some(J=>J.log.id===V.logId)&&m&&y(!1)};return window.addEventListener(Jt,U),()=>{window.removeEventListener(Jt,U)}},[m,t]);const k=b.useCallback(()=>{m&&y(U=>!U)},[m]),S=b.useMemo(()=>{let U=0,F=0,V=null,J=!1;for(const z of t)z.log.inputTokens!==null&&(U+=z.log.inputTokens,J=!0),z.log.outputTokens!==null&&(F+=z.log.outputTokens,J=!0),z.log.elapsedMs!==null&&(V=V===null?z.log.elapsedMs:Math.max(V,z.log.elapsedMs));return{totalInput:U,totalOutput:F,hasTokens:J,maxElapsed:V}},[t,d]),C=b.useMemo(()=>{const U=new Set;for(const F of t){const V=Ph(F.log.model);V!=="unknown"&&U.add(V)}return[...U]},[t]),j=b.useMemo(()=>Do(t[0]?.log.id??0),[t]),N=b.useMemo(()=>Do(t[d]?.log.id??0),[t,d]),I=c%2===0?"bg-muted/10":"bg-muted/25",R=S.maxElapsed!==null&&o>0&&S.maxElapsed>o*1e3,O=b.useMemo(()=>{const U=new Map;for(const F of t){const V=sl(F.log);V.length>0&&U.set(F.log.id,V)}return U},[t]),[$,E]=b.useState(0),L=b.useRef(null);b.useEffect(()=>{const U=L.current;if(!U)return;let F=0;const V=new ResizeObserver(()=>{window.cancelAnimationFrame(F),F=window.requestAnimationFrame(()=>E(J=>J+1))});return V.observe(U),()=>{V.disconnect(),window.cancelAnimationFrame(F)}},[]);const w=t[0]?.log.id??c,M=`Turn ${String(c+1)}`;return l.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:be("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?l.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:[l.jsx("div",{className:"w-5 shrink-0 flex items-start pt-1.5",children:l.jsx("span",{className:"text-[10px] text-muted-foreground/50 font-mono tabular-nums leading-none select-none",children:c+1})}),l.jsxs("div",{className:"w-6 shrink-0 flex flex-col items-center pt-0.5 pb-0.5",children:[l.jsx("div",{className:"flex justify-center h-[calc(0.75rem-8px)]"}),l.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:l.jsx(j,{className:be("size-3.5 text-emerald-400","animate-crab-appear drop-shadow-[0_0_4px_rgba(52,211,153,0.5)]")})}),l.jsx("div",{className:"flex-1 flex justify-center min-h-0",children:l.jsx("div",{className:"w-0.5 bg-muted-foreground/30 h-full"})}),l.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:l.jsx(N,{className:be("size-3.5 text-amber-400","animate-crab-settle drop-shadow-[0_0_4px_rgba(251,191,36,0.5)]")})})]}),t.length>1&&l.jsxs("div",{className:be("flex-1 min-w-0 mb-0.5 rounded-lg border border-border py-1 px-3 flex items-center gap-3 text-xs",I),children:[l.jsxs("span",{className:"text-blue-400/80 font-mono font-semibold tabular-nums shrink-0",children:["#",t[0]?.log.id??"?"," ~ #",t[d]?.log.id??"?"]}),l.jsxs("span",{className:"text-muted-foreground shrink-0",children:[t.length," request",t.length>1?"s":""]}),C.length>0&&l.jsx("span",{className:"flex items-center gap-0.5 shrink-0",children:C.map(U=>l.jsx(Oh,{provider:U,className:"size-4"},U))}),S.maxElapsed!==null&&l.jsx(Xe,{children:l.jsxs(De,{children:[l.jsx(Fe,{asChild:!0,children:l.jsxs("span",{className:be("flex items-center gap-1 shrink-0",R?"text-amber-400":"text-muted-foreground"),children:[l.jsx(on,{className:"size-3"}),l.jsx("span",{className:"font-mono tabular-nums",children:ti(S.maxElapsed)}),R&&l.jsx(Eo,{className:"size-3","aria-label":"Slow response"})]})}),l.jsx($e,{children:R?`Slow response: ${ti(S.maxElapsed)} exceeds ${ti(o*1e3)}`:"Slowest request in this turn"})]})}),S.hasTokens&&l.jsxs("span",{className:"flex items-center gap-1 shrink-0",children:[l.jsx(Tr,{className:"size-3 text-muted-foreground"}),l.jsxs("span",{className:"font-mono tabular-nums",children:[l.jsxs("span",{className:"text-blue-400",children:["IN ",Ve(S.totalInput)]})," / ",l.jsxs("span",{className:"text-amber-400",children:["OUT ",Ve(S.totalOutput)]})]})]}),l.jsx("span",{className:"flex-1 min-w-0"}),l.jsx(un,{className:"size-4 text-muted-foreground shrink-0"})]})]}):t.map((U,F)=>{const{log:V,stopReason:J}=U,z=F===0;return l.jsxs("div",{className:"flex items-stretch",children:[z?l.jsx("div",{className:"w-5 shrink-0 flex items-start pt-1.5",children:l.jsx("span",{className:"text-[10px] text-muted-foreground/50 font-mono tabular-nums leading-none select-none",children:c+1})}):l.jsx("div",{className:"w-5 shrink-0"}),l.jsx(zA,{stopReason:J,isPending:V.responseStatus===null,isFirst:F===0,isTurnStart:z,isOnlyEntry:x,crabIndex:V.id%12,collapsible:m&&z,onToggle:k}),l.jsxs("div",{className:be("flex-1 min-w-0 mb-0.5 rounded-lg",I),children:[l.jsx(IA,{log:V,viewMode:n,strip:r,slowResponseThresholdSeconds:o,timeDisplayFormat:u,cacheTrend:s?.get(V.id)??null,onCompareWithPrevious:a.has(V.id)?i:void 0}),l.jsx(PA,{events:O.get(V.id)??[]})]})]},V.id)})})}),il=et(["episode","procedure","preference","project-fact"]),VA=et(["draft","promoted","failed"]),Vm=ie({source:je("agent-inspector"),sessionId:W(),logIds:Se(pe().int().positive()),project:W().nullable(),models:Se(W())}),HA=ie({redacted:nt(),patterns:Se(W())}),Hr=ie({id:W(),type:il,title:W(),content:W(),tags:Se(W()),source:je("agent-inspector"),sessionId:W(),logIds:Se(pe().int().positive()),evidence:Vm,status:VA,createdAt:W(),updatedAt:W(),openClawMemoryId:W().nullable(),error:W().nullable(),redaction:HA});ie({idempotencyKey:W(),type:il,title:W(),content:W(),tags:Se(W()),source:je("agent-inspector"),project:W().nullable(),evidence:Vm});const WA=ie({id:W(),type:il.or(W()),title:W(),content:W(),score:pe().nullable(),source:W().nullable(),project:W().nullable(),evidence:ai().optional()});ie({results:Se(WA),warning:W().nullable()});const ZA=ie({candidates:Se(Hr)}),qA=ie({candidate:Hr}),KA=ie({error:W().optional(),candidate:Hr.optional()}),JA=ie({candidate:Hr}),GA={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 Hi(e){return e===null?"-":e<1e3?`${String(e)}ms`:`${(e/1e3).toFixed(1)}s`}function YA(e,t,n){return e===null||t===null?null:da(e,t,n)}function XA(e){return`${String(e)} candidate${e===1?"":"s"}`}function Hm(e){return`log-${String(e)}`}function Wm(e){const t=Hm(e),n=document.getElementById(t);window.history.replaceState(null,"",`#${t}`),n instanceof HTMLElement&&(n.scrollIntoView({block:"center",behavior:"smooth"}),n.focus({preventScroll:!0}))}function QA(e){for(const t of e)if(t.responseStatus!==null&&t.responseStatus>=400)return t;return null}function eI(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(sl(t).length>0)return t;return null}function nI(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=QA(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=eI(e.logs);if(o!==null&&e.summary.maxElapsedMs!==null&&t.push({kind:"slow",title:`Slowest ${Hi(e.summary.maxElapsedMs)}`,detail:`Max latency observed at #${String(o.id)}`,logId:o.id}),e.candidates.length>0){const s=e.candidates.filter(a=>a.status==="draft").length,i=e.candidates.filter(a=>a.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 rI(e){switch(e){case"session":return l.jsx(Jo,{className:"size-3.5 text-blue-400"});case"tool":return l.jsx(Dr,{className:"size-3.5 text-sky-400/70"});case"slow":return l.jsx(on,{className:"size-3.5 text-amber-400"});case"failure":return l.jsx(Ud,{className:"size-3.5 text-destructive"});case"candidate":return l.jsx($d,{className:"size-3.5 text-emerald-400"})}}function oI({insights:e}){return e.length===0?null:l.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=>l.jsxs("button",{type:"button",className:be("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&&Wm(t.logId)},disabled:t.logId===null,children:[rI(t.kind),l.jsxs("span",{className:"min-w-0",children:[l.jsx("span",{className:"block truncate font-medium text-foreground/90",children:t.title}),l.jsx("span",{className:"block truncate font-mono text-[10px]",children:t.detail})]})]},`${t.kind}-${t.title}`))})}function sI(e){switch(e){case"draft":return"Draft";case"promoted":return"Promoted";case"failed":return"Failed"}}function iI(e,t){if(t)return"Promoting";switch(e.status){case"draft":return"Promote";case"failed":return"Retry";case"promoted":return"Promoted"}}function aI(e){return e.redaction.redacted?`Redacted ${e.redaction.patterns.join(", ")}`:"No sensitive pattern matched"}function lI(e,t){const n=e.replace(/\s+/g," ").trim();return n.length<=t?n:`${n.slice(0,t-3)}...`}function cI(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 mu(e){return e.join(", ")}function uI(e){return e.split(",").map(t=>t.trim()).filter(t=>t.length>0)}function dI({candidate:e,isPromoting:t,isUpdating:n,onPromoteCandidate:r,onUpdateCandidate:o}){const[s,i]=b.useState(!1),[a,c]=b.useState(e.type),[u,d]=b.useState(e.title),[f,h]=b.useState(e.content),[p,x]=b.useState(mu(e.tags)),[m,g]=b.useState(null),y=e.status!=="promoted",v=e.status!=="promoted",k=b.useCallback(()=>{c(e.type),d(e.title),h(e.content),x(mu(e.tags)),g(null)},[e.content,e.tags,e.title,e.type]),S=b.useCallback(async()=>{const C=u.trim(),j=f.trim(),N=uI(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:a,title:C,content:j,tags:N})&&i(!1)},[e.id,f,p,u,a,o]);return s?l.jsx("div",{className:"rounded-md border border-border/80 bg-background/60 px-2.5 py-2",children:l.jsxs("div",{className:"grid gap-2",children:[l.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[l.jsxs("select",{value:a,disabled:n,onChange:C=>{const j=Hr.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:[l.jsx("option",{value:"episode",children:"episode"}),l.jsx("option",{value:"procedure",children:"procedure"}),l.jsx("option",{value:"preference",children:"preference"}),l.jsx("option",{value:"project-fact",children:"project-fact"})]}),l.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"})]}),l.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"}),l.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"}),l.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[l.jsxs("span",{className:"inline-flex items-center gap-1 text-[10px] text-muted-foreground",children:[l.jsx(Pl,{className:"size-3"}),"Saving reruns Inspector redaction before promotion."]}),l.jsx("span",{className:"flex-1"}),m!==null&&l.jsx("span",{className:"text-[10px] text-destructive",children:m}),l.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:[l.jsx(ua,{className:"size-3.5"}),"Cancel"]}),l.jsxs(Re,{type:"button",variant:"outline",size:"sm",className:"h-7 gap-1.5 px-2 text-xs",disabled:n,onClick:()=>{S()},children:[n?l.jsx(Rl,{className:"size-3.5 animate-spin"}):l.jsx(o2,{className:"size-3.5"}),"Save"]})]})]})}):l.jsxs("div",{className:"rounded-md border border-border/80 bg-background/60 px-2.5 py-2",children:[l.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[l.jsx(jt,{variant:"outline",className:"h-5 px-1.5 text-[10px] font-mono",children:e.type}),l.jsx("span",{className:"min-w-0 flex-1 truncate text-xs font-medium",title:e.title,children:e.title}),l.jsx(jt,{variant:"outline",className:be("h-5 shrink-0 px-1.5 text-[10px] font-mono",GA[e.status]),children:sI(e.status)})]}),l.jsx("p",{className:"mt-1 text-[11px] leading-relaxed text-muted-foreground",title:e.content,children:lI(e.content,360)}),l.jsxs("div",{className:"mt-2 flex flex-wrap items-center gap-x-3 gap-y-1 text-[10px] text-muted-foreground",children:[l.jsxs("span",{className:"inline-flex items-center gap-1",children:[l.jsx(Cv,{className:"size-3"}),cI(e.logIds)]}),l.jsxs("span",{className:"inline-flex items-center gap-1",children:[l.jsx(Pl,{className:"size-3"}),aI(e)]}),e.status==="promoted"&&l.jsxs("span",{className:"inline-flex items-center gap-1 text-emerald-500",children:[l.jsx(zl,{className:"size-3"}),e.openClawMemoryId??"OpenClaw"]}),e.status==="failed"&&e.error!==null&&l.jsxs("span",{className:"inline-flex items-center gap-1 text-destructive",children:[l.jsx(Ud,{className:"size-3"}),e.error]})]}),l.jsxs("div",{className:"mt-1 flex flex-wrap items-center gap-1.5",children:[e.logIds.map(C=>l.jsxs("a",{href:`#${Hm(C)}`,onClick:j=>{j.preventDefault(),Wm(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)),l.jsx("span",{className:"flex-1"}),v&&l.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:[l.jsx(Wd,{className:"size-3"}),"Review"]}),l.jsxs(Re,{type:"button",variant:y?"outline":"ghost",size:"sm",className:"h-6 gap-1.5 px-2 text-[10px]",onClick:()=>r(e.id),disabled:!y||t||n,children:[t?l.jsx(Rl,{className:"size-3 animate-spin"}):y?l.jsx(uv,{className:"size-3"}):l.jsx(zl,{className:"size-3"}),iI(e,t)]})]})]})}function fI({candidates:e,promotingCandidateIds:t,updatingCandidateIds:n,onPromoteCandidate:r,onUpdateCandidate:o}){return e.length===0?null:l.jsx("div",{className:"mt-2 grid gap-1.5",children:e.map(s=>l.jsx(dI,{candidate:s,isPromoting:t.has(s.id),isUpdating:n.has(s.id),onPromoteCandidate:r,onUpdateCandidate:o},s.id))})}function pI({logs:e,scopeId:t,slowResponseThresholdSeconds:n,showRollupMetrics:r,timeDisplayFormat:o}){const[s,i]=b.useState([]),[a,c]=b.useState(!0),[u,d]=b.useState({status:"idle",error:null}),[f,h]=b.useState(()=>new Set),[p,x]=b.useState(()=>new Set),m=s.length>0,g=b.useMemo(()=>BA(e,n,s.length),[s.length,e,n]),y=b.useMemo(()=>nI({logs:e,scopeId:t,summary:g,candidates:s}),[s,e,t,g]),v=r||g.maxElapsedMs!==null,k=b.useMemo(()=>YA(g.startedAt,g.endedAt,o),[g.endedAt,g.startedAt,o]),S=b.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 R=await xn(N,`Candidate generation failed with ${String(N.status)}`);d({status:"failed",error:R});return}const I=await Wt(N,ZA);i(I.candidates),c(I.candidates.length>0),d(I.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=b.useCallback(N=>{h(I=>{if(I.has(N))return I;const R=new Set(I);return R.add(N),R}),(async()=>{try{const I=await fetch(`/api/knowledge/candidates/${encodeURIComponent(N)}/promote`,{method:"POST"}),R=await I.json().catch(()=>null),O=qA.safeParse(R);if(I.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 $=KA.safeParse(R);$.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(I.status)}`})}catch(I){d({status:"failed",error:I instanceof Error?I.message:"Candidate promotion failed"})}finally{h(I=>{const R=new Set(I);return R.delete(N),R})}})()},[]),j=b.useCallback(async(N,I)=>{x(R=>{if(R.has(N))return R;const O=new Set(R);return O.add(N),O});try{const R=await fetch(`/api/knowledge/candidates/${encodeURIComponent(N)}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify(I)});if(!R.ok){const $=await xn(R,`Candidate update failed with ${String(R.status)}`);return d({status:"failed",error:$}),!1}const O=await Wt(R,JA);return i($=>$.map(E=>E.id===O.candidate.id?O.candidate:E)),d({status:"ready",error:null}),!0}catch(R){return d({status:"failed",error:R instanceof Error?R.message:"Candidate update failed"}),!1}finally{x(R=>{const O=new Set(R);return O.delete(N),O})}},[]);return e.length===0?null:l.jsxs("section",{className:"mb-2 rounded-lg border border-border bg-muted/10 px-3 py-2",children:[l.jsxs("div",{className:"flex flex-wrap items-center gap-x-3 gap-y-2 text-xs",children:[r&&l.jsxs("span",{className:"inline-flex items-center gap-1.5 font-semibold text-foreground",children:[l.jsx(Jo,{className:"size-3.5 text-blue-400"}),g.llmCallCount," LLM"]}),l.jsxs("span",{className:"inline-flex items-center gap-1.5 text-muted-foreground",children:[l.jsx(Dr,{className:"size-3.5 text-sky-400/70"}),g.toolCallCount," tools"]}),r&&l.jsxs("span",{className:"inline-flex items-center gap-1.5 text-muted-foreground",children:[l.jsx(Tr,{className:"size-3.5 text-emerald-400"}),l.jsxs("span",{className:"font-mono",children:[Ve(g.totalInputTokens)," / ",Ve(g.totalOutputTokens)]})]}),(g.totalCacheCreationInputTokens>0||g.totalCacheReadInputTokens>0)&&l.jsxs("span",{className:"inline-flex items-center gap-1.5 text-muted-foreground",children:[l.jsx(Tr,{className:"size-3.5 text-purple-400"}),l.jsxs("span",{className:"font-mono",children:["KV Cache +",Ve(g.totalCacheCreationInputTokens)," / ~",Ve(g.totalCacheReadInputTokens)]})]}),v&&l.jsxs("span",{className:"inline-flex items-center gap-1.5 text-muted-foreground",children:[l.jsx(on,{className:"size-3.5"}),r&&l.jsx("span",{className:"font-mono",children:Hi(g.totalElapsedMs)}),g.maxElapsedMs!==null&&l.jsxs("span",{className:"font-mono text-muted-foreground/70",children:["max ",Hi(g.maxElapsedMs)]})]}),r&&k!==null&&l.jsx("span",{className:"font-mono text-muted-foreground/70",children:k}),(g.failedCallCount>0||g.pendingCallCount>0||g.slowCallCount>0)&&l.jsxs("span",{className:"inline-flex items-center gap-1.5 text-amber-400",children:[l.jsx(Eo,{className:"size-3.5"}),l.jsxs("span",{className:"font-mono",children:[g.failedCallCount," fail / ",g.pendingCallCount," pending /"," ",g.slowCallCount," slow"]})]}),l.jsx("span",{className:"flex-1"}),m&&l.jsx(jt,{variant:"outline",className:"h-6 px-2 text-[10px] font-mono",children:XA(g.knowledgeCandidateCount)}),l.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"?l.jsx(Nr,{className:"size-3.5 animate-spin"}):l.jsx($d,{className:"size-3.5"}),"Candidate"]}),m&&l.jsx(Re,{type:"button",variant:"ghost",size:"icon",className:"size-7 text-muted-foreground",onClick:()=>c(N=>!N),"aria-expanded":a,"aria-label":a?"Collapse memory candidates":"Expand memory candidates",children:a?l.jsx(Yt,{className:"size-3.5"}):l.jsx(un,{className:"size-3.5"})})]}),u.status==="failed"&&l.jsx("p",{className:"mt-2 text-xs text-destructive",children:u.error}),l.jsx(oI,{insights:y}),a&&l.jsx(fI,{candidates:s,promotingCandidateIds:f,updatingCandidateIds:p,onPromoteCandidate:C,onUpdateCandidate:j})]})}function hI(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 Zm=b.memo(function({group:e,viewMode:t="simple",strip:n,slowResponseThresholdSeconds:r,cacheTrends:o,onCompareWithPrevious:s,comparisonPredecessors:i,onClearGroup:a,standalone:c=!1,hasPinnedSessionContext:u=!1,timeDisplayFormat:d,expanded:f,onExpandedChange:h}){const[p,x]=b.useState(!1),m=f??p,g=b.useCallback(I=>{if(h!==void 0){h(I);return}x(I)},[h]),y=b.useMemo(()=>hI(e.logs),[e.logs]),v=e.logs[0]?.timestamp??new Date().toISOString(),k=e.logs[e.logs.length-1]?.timestamp??new Date().toISOString(),S=z5(e.logs),C=e.logs.some(I=>I.responseStatus===null),j=c&&!u,N=b.useMemo(()=>LA(e.logs),[e.logs]);return b.useEffect(()=>{const I=R=>{if(c)return;const O=vs(R);O!==null&&e.logs.some($=>$.id===O.logId)&&g(!0)};return window.addEventListener(Jt,I),()=>{window.removeEventListener(Jt,I)}},[e.logs,g,c]),l.jsxs("div",{className:"mb-2",children:[!c&&l.jsx(A5,{conversationId:e.conversationId,startTime:v,endTime:k,totalCalls:e.logs.length,totalInputTokens:y.totalInputTokens,totalOutputTokens:y.totalOutputTokens,apiFormat:I5(e.logs),expanded:m,onToggle:()=>g(!m),hideApiFormat:S,isLoading:C,userAgent:e.logs[0]?.userAgent??null,timeDisplayFormat:d,onClear:()=>a(e.logs.map(I=>I.id))}),OA(c,m)&&l.jsxs("div",{children:[l.jsx(pI,{logs:e.logs,scopeId:e.conversationId,slowResponseThresholdSeconds:r,showRollupMetrics:j,timeDisplayFormat:d}),N.map(I=>l.jsx(UA,{entries:I.entries,viewMode:t,strip:n,slowResponseThresholdSeconds:r,timeDisplayFormat:d,cacheTrends:o,onCompareWithPrevious:s,comparisonPredecessors:i,turnIndex:I.turnIndex},I.turnIndex))]})]})});function mI({className:e}){return l.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",className:be("inline-block size-5",e),children:[l.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"}),l.jsx("path",{d:"M5 11 C3.5 9.5 1.5 10 2 12.5 C2.5 14 4 13.5 5 12.5"}),l.jsx("path",{d:"M19 11 C20.5 9.5 22.5 10 22 12.5 C21.5 14 20 13.5 19 12.5"}),l.jsx("line",{x1:"10",y1:"7",x2:"9.5",y2:"5"}),l.jsx("line",{x1:"14",y1:"7",x2:"14.5",y2:"5"}),l.jsx("circle",{cx:"9.5",cy:"4.5",r:"0.9",fill:"currentColor",stroke:"none"}),l.jsx("circle",{cx:"14.5",cy:"4.5",r:"0.9",fill:"currentColor",stroke:"none"}),l.jsx("line",{x1:"6.5",y1:"16",x2:"4.5",y2:"19.5"}),l.jsx("line",{x1:"9",y1:"17.5",x2:"8",y2:"20.5"}),l.jsx("line",{x1:"15",y1:"17.5",x2:"16",y2:"20.5"}),l.jsx("line",{x1:"17.5",y1:"16",x2:"19.5",y2:"19.5"}),l.jsxs("g",{children:[l.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"}),l.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"}),l.jsx("path",{d:"M8.4 16 L8.4 18.4",stroke:"#d6b45f",strokeWidth:"0.34"}),l.jsx("circle",{cx:"10.6",cy:"17.75",r:"0.36",fill:"#c2412d",stroke:"none"})]}),l.jsxs("g",{children:[l.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"}),l.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"}),l.jsx("path",{d:"M11.9 14.3 L11.9 17.8",stroke:"#d6b45f",strokeWidth:"0.42"}),l.jsx("path",{d:"M9.8 16.3 C11.2 15.8 12.9 15.9 14.3 16.5",stroke:"#9fca78",strokeWidth:"0.36"}),l.jsx("circle",{cx:"15.6",cy:"16.75",r:"0.43",fill:"#c2412d",stroke:"none"})]}),l.jsxs("g",{children:[l.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"}),l.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"}),l.jsx("path",{d:"M16.2 16.3 L16.2 18.6",stroke:"#d6b45f",strokeWidth:"0.34"}),l.jsx("circle",{cx:"18.35",cy:"18.15",r:"0.36",fill:"#c2412d",stroke:"none"})]})]})}const gI="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 xI({className:e}){return l.jsx("img",{src:gI,alt:"Model Context Protocol","aria-hidden":"true",className:be("inline-block size-8 object-contain invert",e)})}function gu({...e}){return l.jsx(FC,{"data-slot":"select",...e})}function xu({...e}){return l.jsx(BC,{"data-slot":"select-value",...e})}function yu({className:e,size:t="default",children:n,...r}){return l.jsxs($C,{"data-slot":"select-trigger","data-size":t,className:be("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,l.jsx(UC,{asChild:!0,children:l.jsx(Yt,{className:"size-4 opacity-50"})})]})}function bu({className:e,children:t,position:n="popper",align:r="center",...o}){return l.jsx(VC,{children:l.jsxs(HC,{"data-slot":"select-content",className:be("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:[l.jsx(yI,{}),l.jsx(WC,{className:be("p-1",n==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)] scroll-my-1"),children:t}),l.jsx(bI,{})]})})}function lo({className:e,children:t,...n}){return l.jsxs(ZC,{"data-slot":"select-item",className:be("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:[l.jsx("span",{className:"absolute right-2 flex size-3.5 items-center justify-center",children:l.jsx(KC,{children:l.jsx(ct,{className:"size-4"})})}),l.jsx(qC,{children:t})]})}function yI({className:e,...t}){return l.jsx(JC,{"data-slot":"select-scroll-up-button",className:be("flex cursor-default items-center justify-center py-1",e),...t,children:l.jsx(Yb,{className:"size-4"})})}function bI({className:e,...t}){return l.jsx(GC,{"data-slot":"select-scroll-down-button",className:be("flex cursor-default items-center justify-center py-1",e),...t,children:l.jsx(Yt,{className:"size-4"})})}function vI(){return l.jsxs("svg",{fill:"currentColor",fillRule:"evenodd",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",className:"size-6 shrink-0",children:[l.jsx("title",{children:"Claude Code"}),l.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 wI(){return l.jsxs("svg",{fill:"currentColor",fillRule:"evenodd",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",className:"size-6 shrink-0",children:[l.jsx("title",{children:"OpenCode"}),l.jsx("path",{d:"M16 6H8v12h8V6zm4 16H4V2h16v20z"})]})}function kI(){return l.jsxs("svg",{fill:"currentColor",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",className:"size-6 shrink-0",children:[l.jsx("title",{children:"MiMo Code"}),l.jsx("text",{x:"12",y:"18",textAnchor:"middle",fontSize:"16",fontWeight:"800",fontFamily:"system-ui, sans-serif",children:"M"})]})}const _I=ie({name:W(),apiKey:W(),format:et(["anthropic","openai"]),anthropicBaseUrl:W(),openaiBaseUrl:W(),models:Se(W()),sourceTool:et(["claude-code","opencode","mimo-code"]),alreadyExists:nt()}),SI=ie({providers:Se(_I),warnings:Se(W()).optional()}),CI=ie({success:nt().optional(),imported:pe().optional(),message:W().optional(),errors:Se(W()).optional()}),jI={"claude-code":vI,opencode:wI,"mimo-code":kI};function EI({open:e,onOpenChange:t,onImportComplete:n}){const[r,o]=b.useState(!1),[s,i]=b.useState(null),[a,c]=b.useState([]),[u,d]=b.useState([]),[f,h]=b.useState(new Set),[p,x]=b.useState(!1),[m,g]=b.useState(null),[y,v]=b.useState(null),k=b.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(I=>{const R=SI.safeParse(I);if(!R.success){i(`Invalid response: ${R.error.message}`);return}c(R.data.providers),d(R.data.warnings??[]);const O=new Set;R.data.providers.forEach(($,E)=>{$.alreadyExists||O.add(E)}),h(O)}):N.text().then(I=>{i(`Scan failed (${N.status}): ${I}`)})).catch(N=>{i(N instanceof Error?N.message:String(N))}).finally(()=>{o(!1)})},[]);b.useEffect(()=>{e&&k()},[e,k]);const S=b.useCallback(N=>{h(I=>{const R=new Set(I);return R.has(N)?R.delete(N):R.add(N),R})},[]),C=b.useCallback(()=>{const N=a.filter((O,$)=>f.has($));if(N.length===0)return;x(!0),v(null),g(null);const I=new Date().toISOString(),R=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:I,updatedAt:I}));fetch("/api/providers/import",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({providers:R})}).then(O=>O.json()).then(O=>{const $=CI.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)})},[a,f,n]),j=a.some(N=>!N.alreadyExists);return l.jsx(La,{open:e,onOpenChange:t,children:l.jsxs(Da,{className:"max-w-xl max-h-[80vh] overflow-hidden flex flex-col",children:[l.jsxs(Fa,{children:[l.jsx($a,{children:"Import from External Tools"}),l.jsx("p",{className:"text-xs text-muted-foreground",children:"Detect provider configurations from Claude Code, OpenCode, and MiMo Code."})]}),l.jsxs("div",{className:"flex-1 overflow-y-auto space-y-3",children:[r&&l.jsxs("div",{className:"flex items-center justify-center py-8 gap-2 text-muted-foreground",children:[l.jsx(Nr,{className:"size-4 animate-spin"}),l.jsx("span",{className:"text-sm",children:"Scanning for external providers..."})]}),s!==null&&l.jsxs("div",{className:"flex items-center gap-2 text-destructive text-sm py-4",children:[l.jsx(Er,{className:"size-4"}),s]}),!r&&s===null&&a.length===0&&l.jsxs("p",{className:"text-sm text-muted-foreground py-8 text-center",children:["No external provider configurations found.",l.jsx("br",{}),l.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&&a.map((N,I)=>l.jsxs("label",{className:`flex items-start gap-3 p-3 border rounded-md ${N.alreadyExists?"":"cursor-pointer hover:bg-muted/50"}`,children:[!N.alreadyExists&&l.jsx("input",{type:"checkbox",checked:f.has(I),disabled:p,onChange:()=>S(I),className:"mt-0.5 size-4"}),l.jsxs("div",{className:"flex-1 min-w-0",children:[l.jsxs("div",{className:"flex items-center justify-between",children:[(()=>{const R=jI[N.sourceTool];return R===void 0?null:l.jsx(R,{})})(),N.alreadyExists&&l.jsx("span",{className:"text-[10px] text-muted-foreground",children:"Already added"})]}),l.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`:""]}),l.jsx("div",{className:"text-xs text-muted-foreground mt-0.5 truncate",children:N.format==="anthropic"?N.anthropicBaseUrl:N.openaiBaseUrl}),l.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&&l.jsx("div",{className:"text-xs text-muted-foreground space-y-1 border-t pt-2",children:u.map((N,I)=>l.jsxs("div",{className:"flex items-center gap-1",children:[l.jsx(Er,{className:"size-3"}),N]},I))}),m!==null&&l.jsx("div",{className:"text-sm text-green-500 border-t pt-2",children:m}),y!==null&&l.jsx("div",{className:"text-sm text-destructive border-t pt-2",children:y})]}),l.jsxs("div",{className:"flex items-center justify-between pt-3 border-t",children:[l.jsxs(Re,{variant:"outline",size:"sm",onClick:k,disabled:r,children:[l.jsx(Nr,{className:`size-3 mr-1 ${r?"animate-spin":""}`}),"Rescan"]}),l.jsxs(Re,{size:"sm",onClick:C,disabled:!j||f.size===0||p,children:[l.jsx(aa,{className:"size-3 mr-1"}),p?"Importing...":`Import Selected (${f.size})`]})]})]})})}function qm(e){return e.length<=8?"••••••••":e.slice(0,4)+"••••••••"+e.slice(-4)}const Km=ie({id:W().min(1),aliases:Se(W()).optional().default([]),contextWindow:pe().int().positive().optional(),outputLimit:pe().int().positive().optional(),sourceUrl:W().optional()}),NI=ie({name:W().min(1).optional(),aliases:Se(W()).optional().default([]),baseUrls:Se(W()).optional().default([]),models:Se(Km).min(1)});ie({version:pe().int().positive().optional(),updatedAt:W().optional(),providers:Se(NI).optional().default([]),models:Se(Km).optional().default([])});function vu(e){return e.trim().toLowerCase().replace(/\s+/g,"-")}function TI(e){const t=e.models.filter(n=>n.trim()!=="");return t.length>0?t:e.model!==void 0&&e.model.trim()!==""?[e.model]:[]}function al(e,t){const n=vu(t);return(e.modelMetadata??[]).find(o=>vu(o.model)===n)??null}function AI(e){const t=TI(e);return t.length===0?!1:t.every(n=>{const r=al(e,n);return r!==null&&r.contextWindow!==void 0})}function II(e,t){if(e===null)return null;for(const n of t){const r=al(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 zI={deepseek:"https://api-docs.deepseek.com/zh-cn/"};function RI(e){return Object.prototype.hasOwnProperty.call(e,"success")}function PI(e){return Object.prototype.hasOwnProperty.call(e,"notConfigured")}function OI(e){const t={className:"size-3",strokeWidth:2};switch(e){case"timeout":return l.jsx(on,{...t});case"network_unreachable":return l.jsx(k2,{...t});case"connection_refused":return l.jsx(S2,{...t});case"auth_failed":return l.jsx(Fv,{...t});case"rate_limited":return l.jsx(Iv,{...t});case"server_error":return l.jsx(u2,{...t});case"invalid_response":return l.jsx(iv,{...t});case"unknown":return l.jsx(Er,{...t});default:return l.jsx(Er,{...t})}}function co({result:e}){const[t,n]=b.useState(!1);if(!RI(e))return PI(e)?l.jsxs("div",{className:"flex items-center gap-1 text-xs text-muted-foreground shrink-0",children:[l.jsx(Uv,{className:"size-3"}),l.jsx("span",{children:"Not configured"})]}):l.jsxs("div",{className:"flex items-center gap-1 text-xs text-muted-foreground shrink-0",children:[l.jsx(di,{className:"size-3 animate-spin"}),l.jsx("span",{children:"Testing..."})]});if(e.success){const c=[];e.inputTokens!==void 0&&c.push(l.jsxs("span",{children:[e.inputTokens," in"]},"in")),e.outputTokens!==void 0&&c.push(l.jsxs("span",{children:[e.outputTokens," out"]},"out")),e.cacheCreationInputTokens!==void 0&&e.cacheCreationInputTokens>0&&c.push(l.jsxs("span",{className:"font-mono tabular-nums text-emerald-400",children:["KV Cache +",e.cacheCreationInputTokens]},"cache-create")),e.cacheReadInputTokens!==void 0&&e.cacheReadInputTokens>0&&c.push(l.jsxs("span",{className:"font-mono tabular-nums text-purple-400",children:["KV Cache ~",e.cacheReadInputTokens]},"cache-read"));const u=[];for(let d=0;d<c.length;d++)d>0&&u.push(", "),u.push(c[d]);return l.jsx(Xe,{children:l.jsxs(De,{children:[l.jsx(Fe,{asChild:!0,children:l.jsxs("div",{className:"flex items-center gap-1 text-xs text-green-600 shrink-0",children:[l.jsx(rv,{className:"size-3"}),l.jsx("span",{children:"Connected"}),c.length>0&&l.jsxs("span",{className:"text-muted-foreground",children:["(",u,")"]})]})}),l.jsx($e,{children:"Connection test passed"})]})})}const r=e.error,o=r?.message??"Connection failed",s=r?.hint,i=r?.details,a=r?.type??"unknown";return l.jsxs("div",{className:"flex flex-col gap-1 shrink-0",children:[l.jsxs("div",{className:"flex items-center gap-1 text-xs text-red-600 max-w-[200px]",children:[OI(a),l.jsx(Xe,{children:l.jsxs(De,{children:[l.jsx(Fe,{asChild:!0,children:l.jsx("span",{className:"truncate",children:o})}),l.jsx($e,{children:"Connection test failed"})]})}),i!==void 0&&l.jsx(Xe,{children:l.jsxs(De,{children:[l.jsx(Fe,{asChild:!0,children:l.jsx("button",{type:"button",onClick:()=>n(!t),className:"shrink-0 text-muted-foreground hover:text-foreground transition-colors",children:t?l.jsx(la,{className:"size-3"}):l.jsx(ca,{className:"size-3"})})}),l.jsx($e,{children:t?"Hide error details":"Show detailed error information"})]})})]}),t&&i!==void 0&&l.jsxs("div",{className:"text-xs text-muted-foreground bg-muted/50 rounded p-2 max-w-[300px]",children:[s!==void 0&&l.jsx("div",{className:"mb-1",children:s}),l.jsx("div",{className:"font-mono whitespace-pre-wrap break-all text-red-400/80",children:i})]})]})}function MI(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 LI(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 DI({provider:e,testResults:t,isTesting:n,testingTimeLeft:r,isHighlighted:o,onEdit:s,onDelete:i,onTest:a,onRefreshMetadata:c,isRefreshingMetadata:u=!1}){const[d,f]=b.useState(!1),[h,p]=b.useState(!1),[x,m]=b.useState(!1);function g(){navigator.clipboard.writeText(e.apiKey).catch(()=>{}),p(!0),setTimeout(()=>p(!1),2e3)}const y=e.apiDocsUrl??Object.entries(zI).find(([C])=>e.name.toLowerCase().includes(C))?.[1],v=AI(e),k=e.modelMetadataUrl!==void 0&&e.modelMetadataUrl.trim()!=="",S=k?"Refresh":"Import defaults";return l.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:[l.jsxs("div",{className:"flex items-start justify-between gap-2",children:[l.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[l.jsx("span",{className:"font-medium truncate",children:e.name}),e.source==="company"&&l.jsx(Xe,{children:l.jsxs(De,{children:[l.jsx(Fe,{asChild:!0,children:l.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:"公司"})}),l.jsx($e,{children:"Company-provided API key"})]})}),e.source==="personal"&&l.jsx(Xe,{children:l.jsxs(De,{children:[l.jsx(Fe,{asChild:!0,children:l.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:"个人"})}),l.jsx($e,{children:"Your personal API key"})]})})]}),y!==void 0&&l.jsxs("a",{href:y,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:[l.jsx(Vd,{className:"size-3"}),l.jsx("span",{className:"sr-only",children:"Docs"})]})]}),e.models!==void 0&&e.models.length>0&&l.jsx("div",{className:"flex flex-wrap gap-1",children:e.models.map(C=>{const j=al(e,C),N=LI(j?.sourceUrl);return l.jsxs("span",{className:"inline-flex items-center gap-1 text-xs px-1.5 py-0.5 rounded bg-muted text-muted-foreground",children:[l.jsx("span",{children:C}),j!==null&&j.contextWindow!==void 0&&l.jsx("span",{className:"font-mono text-foreground/80",children:uf(j.contextWindow)}),N!==null&&l.jsx(Xe,{children:l.jsxs(De,{children:[l.jsx(Fe,{asChild:!0,children:l.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})}),l.jsx($e,{children:N.title})]})})]},C)})}),!v&&l.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:[l.jsx("span",{children:"Context window metadata missing"}),l.jsxs("div",{className:"flex shrink-0 items-center gap-1",children:[l.jsxs(Re,{type:"button",variant:"outline",size:"sm",onClick:()=>c?.(e.id),className:"h-6 gap-1 px-2 text-xs",disabled:u,children:[l.jsx(di,{className:`size-3 ${u?"animate-spin":""}`}),S]}),!k&&l.jsx(Re,{type:"button",variant:"ghost",size:"sm",onClick:()=>s(e),className:"h-6 px-2 text-xs",children:"Set URL"})]})]}),l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx("code",{className:"text-xs text-muted-foreground bg-muted px-2 py-1 rounded flex-1 truncate",children:d?e.apiKey:qm(e.apiKey)}),l.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?l.jsx(la,{className:"size-4"}):l.jsx(ca,{className:"size-4"})}),l.jsx("button",{type:"button",onClick:g,className:"text-muted-foreground hover:text-foreground transition-colors p-1","aria-label":"Copy API key",children:h?l.jsx(ct,{className:"size-4 text-green-500"}):l.jsx(Ft,{className:"size-4"})})]}),e.anthropicBaseUrl!==void 0&&e.anthropicBaseUrl!==""&&l.jsxs("div",{className:"flex items-center justify-between gap-2",children:[l.jsxs("div",{className:"text-xs text-muted-foreground min-w-0 flex-1",children:[l.jsx("span",{className:"font-medium",children:"Anthropic:"})," ",l.jsx("span",{className:"truncate",children:e.anthropicBaseUrl})]}),t&&l.jsx(co,{result:t.anthropic.nonStreaming})]}),e.openaiBaseUrl!==void 0&&e.openaiBaseUrl!==""&&l.jsxs("div",{className:"flex items-center justify-between gap-2",children:[l.jsxs("div",{className:"text-xs text-muted-foreground min-w-0 flex-1",children:[l.jsx("span",{className:"font-medium",children:"OpenAI:"})," ",l.jsx("span",{className:"truncate",children:e.openaiBaseUrl})]}),t&&l.jsx(co,{result:t.openai.nonStreaming})]}),t?.testedAt!==void 0&&l.jsxs("div",{className:"text-xs text-muted-foreground flex items-center gap-1",children:[l.jsx(on,{className:"size-3"}),l.jsxs("span",{children:["Tested ",MI(t.testedAt)]})]}),t?.models!==void 0&&Object.keys(t.models).length>0&&l.jsxs("div",{className:"border-t pt-2",children:[l.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:[l.jsx("span",{className:"font-mono",children:x?"▾":"▸"}),"Model Test Results (",Object.keys(t.models).length,")"]}),x&&l.jsx("div",{className:"mt-2 overflow-x-auto",children:l.jsxs("table",{className:"w-full text-xs border-collapse",children:[l.jsx("thead",{children:l.jsxs("tr",{className:"border-b border-border",children:[l.jsx("th",{className:"text-left py-1 px-2 font-medium text-muted-foreground",children:"Model"}),e.anthropicBaseUrl!==void 0&&e.anthropicBaseUrl!==""&&l.jsx("th",{className:"text-left py-1 px-2 font-medium text-muted-foreground",children:"Anthropic"}),e.openaiBaseUrl!==void 0&&e.openaiBaseUrl!==""&&l.jsx("th",{className:"text-left py-1 px-2 font-medium text-muted-foreground",children:"OpenAI"})]})}),l.jsx("tbody",{children:Object.entries(t.models).map(([C,j])=>l.jsxs("tr",{className:"border-b border-border/50 last:border-0",children:[l.jsx("td",{className:"py-1 px-2 font-medium",children:C}),e.anthropicBaseUrl!==void 0&&e.anthropicBaseUrl!==""&&l.jsx("td",{className:"py-1 px-2",children:l.jsx(co,{result:j.anthropic.nonStreaming})}),e.openaiBaseUrl!==void 0&&e.openaiBaseUrl!==""&&l.jsx("td",{className:"py-1 px-2",children:l.jsx(co,{result:j.openai.nonStreaming})})]},C))})]})})]}),l.jsxs("div",{className:"flex gap-2 pt-1 border-t",children:[a!==void 0&&l.jsxs(Re,{variant:"outline",size:"sm",onClick:()=>a(e.id),className:"text-xs h-7 gap-1",disabled:n??!1,children:[l.jsx(di,{className:`size-3 ${n??!1?"animate-spin":""}`}),n??!1?r!==void 0?`Testing (${r}s)`:"Testing...":"Test"]}),l.jsxs(Re,{variant:"outline",size:"sm",onClick:()=>s(e),className:"text-xs h-7 gap-1",disabled:n??!1,children:[l.jsx(Wd,{className:"size-3"}),"Edit"]}),l.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:[l.jsx(qd,{className:"size-3"}),"Delete"]})]})]})}const wu=["zhipu","zhipuai","bigmodel","z.ai","zai","glm"],ku=["zhipu coding","glm coding","bigmodel coding","z.ai coding","zai coding"],FI={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"],Su=["glm-5","glm-5.1","glm-5.2","qwen3.6-plus","qwen3.7-max"],Cu=["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"];function uo(){return{contextWindow:"",outputLimit:""}}function ju(e){return e.trim().toLowerCase().replace(/\s+/g,"-")}function Jm(e,t){const n=ju(t);return e?.modelMetadata?.find(r=>ju(r.model)===n)??null}function Eu(e,t){return t.map(n=>{const r=Jm(e,n);return{contextWindow:r?.contextWindow?.toString()??"",outputLimit:r?.outputLimit?.toString()??""}})}function fo(e){const t=e.trim();if(t==="")return null;const n=Number(t);return!Number.isInteger(n)||n<=0?null:n}function $I({provider:e,onSubmit:t,onCancel:n}){const[r,o]=b.useState(e?.name??""),[s,i]=b.useState(e?.apiKey??""),[a,c]=b.useState(!1),[u,d]=b.useState(!1),f=e?.models,[h,p]=b.useState(f!==void 0&&f.length>0?f:[""]),[x,m]=b.useState(()=>Eu(e,f!==void 0&&f.length>0?f:[""])),[g,y]=b.useState("anthropic"),[v,k]=b.useState(e?.anthropicBaseUrl??""),[S,C]=b.useState(e?.openaiBaseUrl??""),[j,N]=b.useState(e?.apiDocsUrl??""),[I,R]=b.useState(e?.modelMetadataUrl??""),[O,$]=b.useState(e?.source),[E,L]=b.useState({}),[w,M]=b.useState(!1),[U,F]=b.useState(null),V=b.useRef([]);b.useEffect(()=>{if(U===null)return;const A=U;function T(D){if(!(D.target instanceof Node))return;const X=V.current[A];X!=null&&!X.contains(D.target)&&F(null)}return document.addEventListener("mousedown",T),()=>document.removeEventListener("mousedown",T)},[U]);const[J,z]=b.useState(!1),[H,Z]=b.useState(!1),P=r.toLowerCase().includes("minimax"),ee=r.toLowerCase().includes("alibaba"),Q=[...wu,...ku].some(A=>r.toLowerCase().includes(A)),de=P?_u:Q?Cu:ee?Su:[],ae=e?.modelMetadata?.some(A=>A.contextWindow!==void 0)??!1;function ue(){navigator.clipboard.writeText(s).catch(()=>{}),d(!0),setTimeout(()=>d(!1),2e3)}b.useEffect(()=>{if(e){o(e.name),i(e.apiKey);const A=(e.models?.length??0)>0?e.models:[""];p(A),m(Eu(e,A)),k(e.anthropicBaseUrl??""),C(e.openaiBaseUrl??""),N(e.apiDocsUrl??""),R(e.modelMetadataUrl??""),$(e.source),z(!1),Z(!1)}},[e]),b.useEffect(()=>{const A=r.toLowerCase();for(const[T,D]of Object.entries(FI))if(A.includes(T)){D.anthropicBaseUrl!==void 0&&!J&&k(D.anthropicBaseUrl),D.openaiBaseUrl!==void 0&&!H&&C(D.openaiBaseUrl),D.apiDocsUrl!==void 0&&!j&&N(D.apiDocsUrl),T==="minimax"&&h.length===1&&h[0]===""&&p([_u[0]??""]),T==="alibaba"&&h.length===1&&h[0]===""&&p([Su[0]??""]),(wu.includes(T)||ku.includes(T))&&h.length===1&&h[0]===""&&p([Cu[0]??""]);break}},[r]);function he(){const A={};return r.trim()||(A.name="Name is required"),s.trim()||(A.apiKey="API key is required"),(h.length===0||h.every(T=>!T.trim()))&&(A.models="At least one model is required"),v.trim()&&!fe(v.trim())&&(A.anthropicBaseUrl="Invalid URL format"),S.trim()&&!fe(S.trim())&&(A.openaiBaseUrl="Invalid URL format"),I.trim()&&!fe(I.trim())&&(A.modelMetadataUrl="Invalid URL format"),x.forEach((T,D)=>{const X=fo(T.contextWindow),se=fo(T.outputLimit);T.contextWindow.trim()!==""&&X===null&&(A[`modelMetadata.${D}.contextWindow`]="Context window must be a positive integer"),T.outputLimit.trim()!==""&&se===null&&(A[`modelMetadata.${D}.outputLimit`]="Output limit must be a positive integer"),X!==null&&se!==null&&se>X&&(A[`modelMetadata.${D}.outputLimit`]="Output limit should not exceed context window")}),!v.trim()&&!S.trim()&&(A.format="At least one format URL (Anthropic or OpenAI) is required"),L(A),Object.keys(A).length===0}function fe(A){try{return new URL(A),!0}catch{return!1}}function ge(A,T){p(D=>{const X=[...D];return X[A]=T,X})}function Ce(A,T){m(D=>{const X=[...D];return X[A]={...X[A]??uo(),...T},X})}function ze(A){p(T=>T.filter((D,X)=>X!==A)),m(T=>T.filter((D,X)=>X!==A))}function _(){p(A=>[...A,""]),m(A=>[...A,uo()])}function ne(){const A=new Date().toISOString(),T=[];return h.forEach((D,X)=>{const se=D.trim();if(se==="")return;const q=x[X]??uo(),K=fo(q.contextWindow),oe=fo(q.outputLimit);if(K===null&&oe===null)return;const re=Jm(e,se);if(re!==null&&re.contextWindow===(K??void 0)&&re.outputLimit===(oe??void 0)){T.push({...re,model:se});return}const B={model:se,source:"manual",updatedAt:A};K!==null&&(B.contextWindow=K),oe!==null&&(B.outputLimit=oe),T.push(B)}),T.length>0?T:e?.modelMetadata!==void 0?[]:void 0}function G(A){if(A.preventDefault(),!!he()){M(!0);try{t({name:r.trim(),apiKey:s.trim(),models:h.map(T=>T.trim()).filter(T=>T!==""),anthropicBaseUrl:v.trim()||void 0,openaiBaseUrl:S.trim()||void 0,apiDocsUrl:j.trim()||void 0,modelMetadataUrl:I.trim()||void 0,modelMetadata:ne(),source:O})}finally{M(!1)}}}return l.jsxs("form",{onSubmit:G,className:"space-y-4",children:[l.jsxs("div",{className:"space-y-2",children:[l.jsxs("label",{htmlFor:"provider-name",className:"text-sm font-medium",children:["Name ",l.jsx("span",{className:"text-destructive",children:"*"})]}),l.jsx("input",{id:"provider-name",type:"text",value:r,onChange:A=>o(A.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&&l.jsx("p",{className:"text-xs text-destructive",children:E.name})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx("label",{htmlFor:"provider-source",className:"text-sm font-medium",children:"Token Source"}),l.jsxs("select",{id:"provider-source",value:O??"",onChange:A=>$(A.target.value==="company"||A.target.value==="personal"?A.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:[l.jsx("option",{value:"",children:"—"}),l.jsx("option",{value:"personal",children:"个人 (Personal)"}),l.jsx("option",{value:"company",children:"公司 (Company)"})]}),l.jsx("p",{className:"text-xs text-muted-foreground",children:"Label whether this API key is company-provided or personal."})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx("label",{htmlFor:"provider-model-metadata-url",className:"text-sm font-medium",children:"Model Metadata URL"}),l.jsx("input",{id:"provider-model-metadata-url",type:"text",value:I,onChange:A=>R(A.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&&l.jsx("p",{className:"text-xs text-destructive",children:E.modelMetadataUrl}),I.trim()===""&&l.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&&!ae&&I.trim()===""&&l.jsx("p",{className:"text-xs text-amber-400",children:"This provider has no matching context metadata yet."}),I.trim()!==""&&l.jsx("p",{className:"text-xs text-muted-foreground",children:"Agent Inspector will refresh model limits from this JSON registry after save."})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsxs("label",{htmlFor:"provider-apikey",className:"text-sm font-medium",children:["API Key ",l.jsx("span",{className:"text-destructive",children:"*"})]}),l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx("input",{id:"provider-apikey",type:"text",value:a||s.length===0?s:qm(s),onChange:A=>i(A.target.value),onFocus:()=>{!a&&s.length>0&&c(!0)},placeholder:"sk-ant-...",readOnly:!a&&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"}),l.jsx("button",{type:"button",onClick:()=>c(A=>!A),className:"text-muted-foreground hover:text-foreground transition-colors p-1 shrink-0","aria-label":a?"Hide API key":"Show API key",children:a?l.jsx(la,{className:"size-4"}):l.jsx(ca,{className:"size-4"})}),l.jsx("button",{type:"button",onClick:ue,className:"text-muted-foreground hover:text-foreground transition-colors p-1 shrink-0","aria-label":"Copy API key",children:u?l.jsx(ct,{className:"size-4 text-green-500"}):l.jsx(Ft,{className:"size-4"})})]}),E.apiKey!==void 0&&l.jsx("p",{className:"text-xs text-destructive",children:E.apiKey})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsxs("label",{className:"text-sm font-medium",children:["Models ",l.jsx("span",{className:"text-destructive",children:"*"})]}),h.map((A,T)=>{const D=x[T]??uo(),X=E[`modelMetadata.${T}.contextWindow`],se=E[`modelMetadata.${T}.outputLimit`];return l.jsxs("div",{ref:q=>{V.current[T]=q},className:"space-y-2 rounded-md border border-border bg-muted/10 p-2",children:[l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsxs("div",{className:"relative flex-1",children:[l.jsx("input",{type:"text",value:A,onChange:q=>ge(T,q.target.value),placeholder:de.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"}),de.length>0&&l.jsxs(l.Fragment,{children:[l.jsx("button",{type:"button",onClick:()=>F(U===T?null:T),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:l.jsx(Yt,{className:"size-4"})}),U===T&&l.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:de.map(q=>l.jsx("button",{type:"button",onClick:()=>{ge(T,q),F(null)},className:"w-full text-left px-3 py-2 text-sm hover:bg-muted transition-colors",children:q},q))})]})]}),h.length>1&&l.jsx("button",{type:"button",onClick:()=>ze(T),className:"text-muted-foreground hover:text-destructive transition-colors p-1 shrink-0","aria-label":"Remove model",children:l.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:[l.jsx("path",{d:"M3 6h18"}),l.jsx("path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6"}),l.jsx("path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2"})]})})]}),l.jsxs("div",{className:"grid gap-2 sm:grid-cols-2",children:[l.jsxs("label",{className:"space-y-1 text-xs text-muted-foreground",children:[l.jsx("span",{children:"Context Window"}),l.jsx("input",{type:"number",min:1,step:1e3,value:D.contextWindow,onChange:q=>Ce(T,{contextWindow:q.target.value}),placeholder:"e.g. 1048576",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]"}),X!==void 0&&l.jsx("span",{className:"block text-destructive",children:X})]}),l.jsxs("label",{className:"space-y-1 text-xs text-muted-foreground",children:[l.jsx("span",{children:"Output Limit"}),l.jsx("input",{type:"number",min:1,step:1e3,value:D.outputLimit,onChange:q=>Ce(T,{outputLimit:q.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]"}),se!==void 0&&l.jsx("span",{className:"block text-destructive",children:se})]})]})]},T)}),l.jsx("button",{type:"button",onClick:_,className:"text-xs text-primary hover:underline flex items-center gap-1",children:"+ Add Model"}),E.models!==void 0&&l.jsx("p",{className:"text-xs text-destructive",children:E.models})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsxs("div",{className:"flex gap-1 border-b border-border",children:[l.jsx(Xe,{children:l.jsxs(De,{children:[l.jsx(Fe,{asChild:!0,children:l.jsx("button",{type:"button",onClick:()=>y("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"})}),l.jsx($e,{children:"Anthropic Messages API protocol"})]})}),l.jsx(Xe,{children:l.jsxs(De,{children:[l.jsx(Fe,{asChild:!0,children:l.jsx("button",{type:"button",onClick:()=>y("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"})}),l.jsx($e,{children:"OpenAI Chat Completions API protocol"})]})})]}),E.format!==void 0&&l.jsx("p",{className:"text-xs text-destructive",children:E.format})]}),g==="anthropic"&&l.jsxs("div",{className:"space-y-2",children:[l.jsx("label",{htmlFor:"provider-anthropic-base-url",className:"text-sm font-medium",children:"Anthropic Base URL"}),l.jsx("input",{id:"provider-anthropic-base-url",type:"text",value:v,onChange:A=>{z(!0),k(A.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&&l.jsx("p",{className:"text-xs text-destructive",children:E.anthropicBaseUrl}),l.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"&&l.jsxs("div",{className:"space-y-2",children:[l.jsx("label",{htmlFor:"provider-openai-base-url",className:"text-sm font-medium",children:"OpenAI Base URL"}),l.jsx("input",{id:"provider-openai-base-url",type:"text",value:S,onChange:A=>{Z(!0),C(A.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&&l.jsx("p",{className:"text-xs text-destructive",children:E.openaiBaseUrl}),l.jsx("p",{className:"text-xs text-muted-foreground",children:"OpenAI-compatible endpoint URL. Leave empty if this provider does not support OpenAI format."})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx("label",{htmlFor:"provider-api-docs-url",className:"text-sm font-medium",children:"API Docs URL"}),l.jsx("input",{id:"provider-api-docs-url",type:"text",value:j,onChange:A=>N(A.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"}),l.jsx("p",{className:"text-xs text-muted-foreground",children:"Optional API documentation URL. If not set, uses known provider docs."})]}),l.jsxs("div",{className:"sticky bottom-0 bg-card border-t flex gap-2 justify-end pt-2 pb-2",children:[l.jsx(Re,{type:"button",variant:"outline",onClick:n,disabled:w,children:"Cancel"}),l.jsx(Re,{type:"submit",disabled:w,children:w?"Saving...":e?"Update Provider":"Add Provider"})]})]})}const BI=et(["timeout","network_unreachable","connection_refused","auth_failed","rate_limited","server_error","invalid_response","unknown"]),UI=ie({message:W(),type:BI,details:W().optional(),hint:W().optional()}),VI=ie({type:et(["text","thinking"]),text:W().optional(),thinking:W().optional()}),HI=ie({success:nt(),error:UI.optional(),model:W().optional(),inputTokens:pe().optional(),outputTokens:pe().optional(),cacheCreationInputTokens:pe().optional(),cacheReadInputTokens:pe().optional(),latencyMs:pe().optional(),content:Se(VI).optional(),rawResponse:W().optional(),streaming:nt().optional(),streamingChunks:ie({chunks:Se(Md),truncated:nt().default(!1)}).optional(),requestHeaders:Zt(W(),W()).optional()}),Nu=Gt([HI,ie({notConfigured:je(!0)}),ie({testing:je(!0)})]),Uo=ie({nonStreaming:Nu,streaming:Nu}),WI=ie({anthropic:Uo,openai:Uo}),ZI=ie({anthropic:Uo,openai:Uo,models:Zt(W(),WI).optional(),testedAt:W().optional()});function qI(){return{anthropic:{nonStreaming:{testing:!0},streaming:{testing:!0}},openai:{nonStreaming:{testing:!0},streaming:{testing:!0}}}}function Tu(e,t){const n=()=>({nonStreaming:{success:!1,error:{message:e,type:t}},streaming:{notConfigured:!0}});return{anthropic:n(),openai:n()}}const KI=ie({providerConfig:W()}),JI=ie({success:nt().optional(),imported:pe().optional(),message:W().optional(),errors:Se(W()).optional()}),GI=ie({provider:To,imported:pe(),matchedModels:Se(W()),missingModels:Se(W()),sourceUrl:W()}),YI=30,po="Network error: could not reach the server. Is the proxy running?";function Au(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}}async function XI(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 QI({externalProviders:e,isLoading:t=!1,externalTestResults:n,externalTestingProviders:r,externalTestingTimeLeft:o,onProvidersMutate:s,onTestResultsChange:i,onTestingProvidersChange:a,onTestingTimeLeftChange:c}){const[u,d]=b.useState(!1),[f,h]=b.useState(),[p,x]=b.useState(null),[m,g]=b.useState({}),[y,v]=b.useState(new Set),[k,S]=b.useState({}),[C,j]=b.useState(null),[N,I]=b.useState(!1),[R,O]=b.useState(null),[$,E]=b.useState(!1),[L,w]=b.useState(!1),[M,U]=b.useState(null),[F,V]=b.useState("all"),[J,z]=b.useState(new Set),H=b.useRef(null),Z=b.useRef(null),P=e??[],ee=b.useMemo(()=>{const K=F==="all"?P:P.filter(oe=>oe.source===F);return F==="all"?[...K].sort((oe,re)=>{const B={personal:0,company:1};return(B[oe.source??""]??2)-(B[re.source??""]??2)}):K},[P,F]),Q=n??m,de=r??y,ae=o??k,ue=c?(K,oe)=>c(K,oe):(K,oe)=>{S(oe===void 0?re=>{const B={...re};return delete B[K],B}:re=>({...re,[K]:oe}))};b.useEffect(()=>{(async()=>{try{const K=await fetch("/api/config/paths");if(K.ok){const oe=await Wt(K,KI);j(oe.providerConfig)}}catch{}})()},[]);const he=b.useCallback(K=>{Z.current!==null&&clearTimeout(Z.current),O(K),H.current?.scrollTo({top:H.current.scrollHeight,behavior:"smooth"}),Z.current=setTimeout(()=>{O(null),Z.current=null},2e3)},[]);b.useEffect(()=>()=>{Z.current!==null&&clearTimeout(Z.current)},[]);const fe=b.useCallback(()=>{s?.().catch(()=>{})},[s]),ge=b.useCallback((K,oe)=>{i?i(K,oe):g(re=>({...re,[K]:oe}))},[i]),Ce=b.useCallback((K,oe)=>{if(a){a(K,oe);return}v(re=>{const B=new Set(re);return oe?B.add(K):B.delete(K),B})},[a]),ze=b.useCallback(async K=>{ge(K,qI()),Ce(K,!0);const oe=new AbortController;let re=YI;ue(K,re);const B=setInterval(()=>{re--,ue(K,re),re<=0&&(clearInterval(B),oe.abort())},1e3);try{const Y=await fetch(`/api/providers/${K}/test`,{method:"POST",signal:oe.signal});if(Y.ok){const le=await Wt(Y,ZI);ge(K,le),await XI(K,le)}else ge(K,Tu(`HTTP ${Y.status}: ${Y.statusText}`,"server_error"))}catch(Y){Y instanceof Error&&Y.name==="AbortError"&&ge(K,Tu("Request timed out","timeout"))}finally{clearInterval(B),ue(K,void 0),Ce(K,!1)}},[ue,ge,Ce]),_=b.useCallback(async(K,oe,re=!0)=>{z(B=>{const Y=new Set(B);return Y.add(K),Y});try{const B=oe!==void 0&&oe.trim()!==""?{url:oe}:{},Y=await fetch(`/api/providers/${K}/model-metadata`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(B)});if(!Y.ok)return re&&x(await xn(Y,"Failed to refresh model metadata")),!1;const le=await Wt(Y,GI);return le.imported===0&&re?x("No matching model metadata found for this provider."):x(null),he(le.provider.id),fe(),le.imported>0}catch{return re&&x(po),!1}finally{z(B=>{const Y=new Set(B);return Y.delete(K),Y})}},[fe,he]);function ne(K){(async()=>{try{const oe=await fetch("/api/providers",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(Au(K))});if(!oe.ok){x(await xn(oe,"Failed to add provider"));return}const re=await Wt(oe,To);d(!1),he(re.id),K.modelMetadataUrl!==void 0&&K.modelMetadataUrl.trim()!==""&&await _(re.id,K.modelMetadataUrl,!1),fe(),await ze(re.id)}catch{x(po)}})()}function G(K){f&&(async()=>{try{const oe=await fetch(`/api/providers/${f.id}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(Au(K))});if(!oe.ok){x(await xn(oe,"Failed to update provider"));return}const re=await Wt(oe,To);h(void 0),he(re.id),K.modelMetadataUrl!==void 0&&K.modelMetadataUrl.trim()!==""&&await _(re.id,K.modelMetadataUrl,!1),fe(),((K.apiKey??"")!==(f.apiKey??"")||JSON.stringify(K.models)!==JSON.stringify(f.models)||(K.anthropicBaseUrl??"")!==(f.anthropicBaseUrl??"")||(K.openaiBaseUrl??"")!==(f.openaiBaseUrl??""))&&await ze(re.id)}catch{x(po)}})()}function A(K){U(K),w(!0)}function T(){const K=M;K!==null&&(async()=>{let oe;try{oe=await fetch(`/api/providers/${K}`,{method:"DELETE"})}catch{x(po);return}if(!oe.ok){x(await xn(oe,"Failed to delete provider"));return}fe()})()}const D=b.useRef(null);function X(K){const oe="/api/providers/export";(async()=>{try{const re=await fetch(oe);if(!re.ok){x("Failed to export providers");return}const B=await re.blob(),Y=URL.createObjectURL(B),le=document.createElement("a");le.href=Y,le.download=re.headers.get("Content-Disposition")?.match(/filename="(.+)"/)?.[1]??"providers.json",document.body.appendChild(le),le.click(),document.body.removeChild(le),URL.revokeObjectURL(Y)}catch{x("Failed to export providers")}})()}function se(){D.current?.click()}function q(K){const oe=K.target.files?.[0];oe&&(async()=>{try{const re=await oe.text(),B=await fetch("/api/providers/import",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(re)}),Y=await Wt(B,JI);B.ok&&Y.imported!==void 0&&Y.imported>0?(fe(),x(null)):Y.errors&&Y.errors.length>0?x(Y.errors.join("; ")):x(Y.message??"Import failed")}catch{x("Failed to import providers")}K.target.value=""})()}return t?l.jsx("div",{className:"flex items-center justify-center py-8",children:l.jsx("p",{className:"text-sm text-muted-foreground",children:"Loading providers..."})}):u||f?l.jsxs("div",{className:"space-y-4",children:[l.jsx("div",{className:"flex items-center justify-between sticky top-0 bg-background z-10 pb-2",children:l.jsx("h3",{className:"text-lg font-medium",children:f?"Edit Provider":"Add New Provider"})}),l.jsx($I,{provider:f,onSubmit:f?G:ne,onCancel:()=>{d(!1),h(void 0)}})]}):l.jsxs("div",{className:"space-y-4",children:[l.jsxs("div",{className:"flex items-center justify-between sticky top-0 z-10 bg-background pb-2",children:[l.jsx("h3",{className:"text-lg font-medium",children:"Providers"}),l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx(Xe,{children:l.jsxs(De,{children:[l.jsx(Fe,{asChild:!0,children:l.jsxs(Re,{variant:"outline",size:"sm",onClick:()=>X(),className:"gap-1 hover:bg-muted",children:[l.jsx(aa,{className:"size-3"}),"Export"]})}),l.jsx($e,{children:"Download providers as JSON for backup or sharing"})]})}),l.jsx(Xe,{children:l.jsxs(De,{children:[l.jsx(Fe,{asChild:!0,children:l.jsxs(Re,{variant:"outline",size:"sm",onClick:se,className:"gap-1 hover:bg-muted",children:[l.jsx(y2,{className:"size-3"}),"Import"]})}),l.jsx($e,{children:"Import providers from an exported JSON file"})]})}),l.jsx("input",{type:"file",ref:D,accept:".json",onChange:q,style:{display:"none"}}),l.jsx(Xe,{children:l.jsxs(De,{children:[l.jsx(Fe,{asChild:!0,children:l.jsxs(Re,{variant:"outline",size:"sm",onClick:()=>E(!0),className:"gap-1",children:[l.jsx(i2,{className:"size-3"}),"Scan"]})}),l.jsx($e,{children:"Detect and import provider configs from Claude Code and OpenCode"})]})}),l.jsxs(Re,{onClick:()=>d(!0),size:"sm",className:"gap-1",children:[l.jsx(ui,{className:"size-4"}),"Add Provider"]})]})]}),C!==null&&l.jsxs("div",{className:"flex items-center gap-2 text-xs text-muted-foreground bg-muted/30 rounded-md px-3 py-2",children:[l.jsx("span",{className:"shrink-0",children:"Config:"}),l.jsx("span",{className:"font-mono truncate",title:C,children:C}),l.jsx(Xe,{children:l.jsxs(De,{children:[l.jsx(Fe,{asChild:!0,children:l.jsx("button",{type:"button",onClick:()=>{window.navigator.clipboard.writeText(C).then(()=>{I(!0),setTimeout(()=>I(!1),2e3)})},className:"shrink-0 ml-auto text-muted-foreground hover:text-foreground transition-colors",children:N?l.jsx(ct,{className:"size-3 text-green-500"}):l.jsx(Ft,{className:"size-3"})})}),l.jsx($e,{children:"Copy config file path to clipboard"})]})})]}),p!==null&&l.jsxs("div",{className:"flex items-center gap-2 text-sm text-destructive bg-destructive/10 rounded-md px-3 py-2",children:[l.jsx(Er,{className:"size-4 shrink-0"}),p]}),P.length===0?l.jsxs("div",{className:"text-center py-12 space-y-3",children:[l.jsx("p",{className:"text-sm text-muted-foreground",children:"No providers configured yet."}),l.jsxs(Re,{onClick:()=>d(!0),variant:"outline",size:"sm",children:[l.jsx(ui,{className:"size-4"}),"Add Your First Provider"]})]}):l.jsxs("div",{className:"space-y-3",children:[l.jsx("div",{className:"flex gap-1 border-b border-border",children:["all","personal","company"].map(K=>l.jsx(Xe,{children:l.jsxs(De,{children:[l.jsx(Fe,{asChild:!0,children:l.jsx("button",{type:"button",onClick:()=>V(K),className:`px-3 py-2 text-sm font-medium border-b-2 transition-colors ${F===K?"border-primary text-primary":"border-transparent text-muted-foreground hover:text-foreground"}`,children:K==="all"?"All":K==="personal"?"Personal":"Company"})}),l.jsx($e,{children:K==="all"?"Show all providers":K==="personal"?"Providers you configured yourself":"Providers set by your organization"})]})},K))}),l.jsx("div",{ref:H,className:"space-y-3",children:ee.map(K=>l.jsx(DI,{provider:K,testResults:Q[K.id],isTesting:de.has(K.id),testingTimeLeft:ae[K.id],isHighlighted:K.id===R,onEdit:oe=>h(oe),onDelete:A,onRefreshMetadata:oe=>{_(oe)},isRefreshingMetadata:J.has(K.id),onTest:oe=>{ze(oe)}},K.id))})]}),l.jsx(EI,{open:$,onOpenChange:E,onImportComplete:()=>{s!==void 0&&s()}}),l.jsx(Ah,{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:T})]})}function ez(){const[e,t]=b.useState(!1),[n,r]=b.useState("providers"),{providers:o,isLoading:s,mutate:i}=df(),[a,c]=b.useState({}),[u,d]=b.useState(new Set),[f,h]=b.useState({}),p=b.useCallback((g,y)=>{c(v=>({...v,[g]:y}))},[]),x=b.useCallback((g,y)=>{d(v=>{const k=new Set(v);return y?k.add(g):k.delete(g),k})},[]),m=b.useCallback((g,y)=>{h(v=>{if(y===void 0){const k={...v};return delete k[g],k}return{...v,[g]:y}})},[]);return l.jsxs(La,{open:e,onOpenChange:t,children:[l.jsx(C5,{asChild:!0,children:l.jsxs(Re,{variant:"ghost",size:"icon",className:"size-8",children:[l.jsx(f2,{className:"size-4"}),l.jsx("span",{className:"sr-only",children:"Settings"})]})}),l.jsxs(Da,{className:"max-w-2xl max-h-[80vh] overflow-hidden flex flex-col",children:[l.jsx(Fa,{children:l.jsx($a,{children:"Settings"})}),l.jsxs(Lh,{value:n,onValueChange:r,className:"flex-1 overflow-hidden",children:[l.jsxs(Dh,{children:[l.jsx(St,{value:"providers",children:"Providers"}),l.jsx(St,{value:"proxy",children:"Proxy"}),l.jsx(St,{value:"storage",children:"Storage"}),l.jsx(St,{value:"onboarding",children:"Onboarding"})]}),l.jsxs("div",{className:"mt-4 flex-1 overflow-x-hidden overflow-y-auto pr-3",children:[l.jsx(Ct,{value:"providers",children:l.jsx(QI,{externalProviders:o,isLoading:s,externalTestResults:a,externalTestingProviders:u,externalTestingTimeLeft:f,onProvidersMutate:()=>i(),onTestResultsChange:p,onTestingProvidersChange:x,onTestingTimeLeftChange:m})}),l.jsx(Ct,{value:"proxy",children:l.jsx(sz,{})}),l.jsx(Ct,{value:"storage",children:l.jsx(nz,{})}),l.jsx(Ct,{value:"onboarding",children:l.jsx(oz,{})})]})]})]})]})}const tz=ie({memoryCount:pe(),logDir:W(),logFileCount:pe(),logBytes:pe(),chunkDir:W(),chunkFileCount:pe(),chunkBytes:pe()});function Iu(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 nz(){const[e,t]=b.useState(null),[n,r]=b.useState(null),[o,s]=b.useState(!1),i=b.useCallback(async()=>{s(!0),r(null);try{const a=await fetch("/api/logs?stats=1");if(!a.ok){r(`Failed to load storage stats: HTTP ${String(a.status)}`);return}const c=await a.json(),u=tz.safeParse(c);if(!u.success){r("Storage stats response was not valid.");return}t(u.data)}catch(a){r(a instanceof Error?a.message:String(a))}finally{s(!1)}},[]);return b.useEffect(()=>{i()},[i]),l.jsxs("div",{className:"space-y-4",children:[l.jsxs("div",{className:"flex items-center justify-between gap-3",children:[l.jsxs("div",{children:[l.jsx("h3",{className:"text-sm font-semibold",children:"Log storage"}),l.jsx("p",{className:"text-xs text-muted-foreground",children:"Inspect local log and streaming chunk footprint before exporting or clearing sessions."})]}),l.jsx(Re,{type:"button",variant:"outline",size:"sm",onClick:()=>{i()},children:o?"Refreshing...":"Refresh"})]}),e!==null&&l.jsxs("div",{className:"grid gap-2 text-xs",children:[l.jsxs("div",{className:"rounded-md border border-border bg-muted/20 px-3 py-2",children:[l.jsx("div",{className:"font-medium",children:"In-memory logs"}),l.jsxs("div",{className:"mt-1 font-mono text-muted-foreground",children:[e.memoryCount.toLocaleString()," loaded"]})]}),l.jsxs("div",{className:"rounded-md border border-border bg-muted/20 px-3 py-2",children:[l.jsx("div",{className:"font-medium",children:"Log files"}),l.jsx("div",{className:"mt-1 break-all font-mono text-muted-foreground",children:e.logDir}),l.jsxs("div",{className:"mt-1 font-mono text-muted-foreground",children:[e.logFileCount.toLocaleString()," files / ",Iu(e.logBytes)]})]}),l.jsxs("div",{className:"rounded-md border border-border bg-muted/20 px-3 py-2",children:[l.jsx("div",{className:"font-medium",children:"Streaming chunks"}),l.jsx("div",{className:"mt-1 break-all font-mono text-muted-foreground",children:e.chunkDir}),l.jsxs("div",{className:"mt-1 font-mono text-muted-foreground",children:[e.chunkFileCount.toLocaleString()," files / ",Iu(e.chunkBytes)]})]})]}),n!==null&&l.jsx("p",{className:"text-xs text-destructive",children:n})]})}function rz({id:e,label:t,value:n,copiedId:r,onCopy:o}){const s=r===e;return l.jsxs("div",{className:"min-w-0 rounded-md border border-border bg-muted/20 px-3 py-2",children:[l.jsx("div",{className:"mb-1 text-xs font-medium text-muted-foreground",children:t}),l.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[l.jsx("code",{className:"min-w-0 flex-1 truncate font-mono text-xs text-foreground",children:n}),l.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?l.jsx(ct,{className:"size-3.5 text-emerald-500"}):l.jsx(Ft,{className:"size-3.5"})})]})]})}function oz(){const[e,t]=b.useState(null),n=b.useMemo(()=>typeof window>"u"?"http://localhost:25947":window.location.origin,[]),r=b.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=b.useCallback((s,i)=>{window.navigator.clipboard.writeText(i).then(()=>{t(s),setTimeout(()=>t(null),1600)})},[]);return l.jsxs("div",{className:"min-w-0 space-y-4",children:[l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx(Zd,{className:"size-4 text-muted-foreground"}),l.jsx("h3",{className:"text-sm font-semibold",children:"Agent onboarding"})]}),l.jsx("div",{className:"grid gap-2",children:r.map(s=>l.jsx(rz,{id:s.id,label:s.label,value:s.value,copiedId:e,onCopy:o},s.id))}),l.jsxs("div",{className:"grid gap-2 rounded-md border border-border bg-background px-3 py-2 text-xs text-muted-foreground",children:[l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx(ct,{className:"size-3.5 text-emerald-500"}),l.jsx("span",{children:"Provider test creates a traceable memory probe session."})]}),l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx(ct,{className:"size-3.5 text-emerald-500"}),l.jsx("span",{children:"Captured sessions can produce reviewable memory candidates."})]})]})]})}function sz(){const{strip:e,captureMode:t,slowResponseThresholdSeconds:n,timeDisplayFormat:r,isLoading:o,setStrip:s,setSlowResponseThresholdSeconds:i,setTimeDisplayFormat:a}=Dd(),[c,u]=b.useState(null),[d,f]=b.useState(!1),h=t==="full"?"simple":"full",p=b.useCallback(async g=>{u(null),f(!0);try{await s(g)}catch(y){u(y instanceof Error?y.message:String(y))}finally{f(!1)}},[s]),x=b.useCallback(async g=>{u(null),f(!0);try{await i(g)}catch(y){u(y instanceof Error?y.message:String(y))}finally{f(!1)}},[i]),m=b.useCallback(async g=>{u(null),f(!0);try{await a(g)}catch(y){u(y instanceof Error?y.message:String(y))}finally{f(!1)}},[a]);return l.jsxs("div",{className:"space-y-4",children:[l.jsxs("div",{className:"space-y-1",children:[l.jsx("h3",{className:"text-sm font-semibold",children:"Capture mode"}),l.jsxs("p",{className:"text-xs text-muted-foreground",children:["This process is running in ",l.jsx("code",{children:t})," mode. Restart with"," ",l.jsxs("code",{children:["agent-inspector --mode ",h]})," 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."]})]}),l.jsxs("div",{className:"space-y-1",children:[l.jsx("h3",{className:"text-sm font-semibold",children:"Claude Code billing header"}),l.jsxs("p",{className:"text-xs text-muted-foreground",children:["When enabled, the proxy strips the synthetic ",l.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 ",l.jsx("code",{children:"AGENT_INSPECTOR_STRIP_CLAUDE_CODE_BILLING_HEADER"})," ","environment variable; your choice is persisted to ",l.jsx("code",{children:"config.json"})," and overrides the env var for subsequent requests."]})]}),l.jsxs("label",{className:"flex items-center gap-3",children:[l.jsx("input",{type:"checkbox",role:"switch",checked:e,disabled:o||d,onChange:g=>{p(g.currentTarget.checked)},className:"size-4 cursor-pointer disabled:cursor-not-allowed disabled:opacity-50"}),l.jsx("span",{className:"text-sm",children:o?"Loading...":e?"Stripping enabled":"Stripping disabled"})]}),l.jsxs("div",{className:"space-y-1",children:[l.jsx("label",{htmlFor:"slow-response-threshold",className:"text-sm font-semibold",children:"Slow response threshold"}),l.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 ",l.jsx("code",{children:"0"})," to disable the indicator."]}),l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx("input",{id:"slow-response-threshold",type:"number",min:0,max:ci,step:1,value:n,disabled:o||d,onChange:g=>{const y=Number(g.currentTarget.value);Number.isInteger(y)&&(y<0||y>ci||x(y))},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"}),l.jsx("span",{className:"text-xs text-muted-foreground",children:"seconds"})]})]}),l.jsxs("div",{className:"space-y-1",children:[l.jsx("label",{htmlFor:"time-display-format",className:"text-sm font-semibold",children:"Time display"}),l.jsx("p",{className:"text-xs text-muted-foreground",children:"Controls timestamps in session summaries, conversation headers, and log rows."}),l.jsxs("select",{id:"time-display-format",value:r,disabled:o||d,onChange:g=>{const y=Ld.safeParse(g.currentTarget.value);y.success&&m(y.data)},className:"h-8 rounded-md border border-input bg-background px-2 text-sm disabled:cursor-not-allowed disabled:opacity-50",children:[l.jsx("option",{value:"time",children:"Time only"}),l.jsx("option",{value:"full",children:"Full ISO"})]})]}),c!==null&&l.jsxs("p",{className:"text-xs text-destructive",children:["Failed to save: ",c]})]})}function iz(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:zu(s.cacheCreationInputTokens,i.cacheCreationInputTokens),read:zu(s.cacheReadInputTokens,i.cacheReadInputTokens)})}}return t}function zu(e,t){return t===null||e===null?null:t>e?{direction:"up",delta:t-e}:t<e?{direction:"down",delta:e-t}:null}const az=30,lz=112,cz=6;function uz(e){return e>az}function dz({groups:e,standalone:t,...n}){return uz(e.length)?l.jsx(fz,{groups:e,standalone:t,...n}):l.jsx(l.Fragment,{children:e.map(r=>l.jsx(Zm,{group:r,standalone:t,...n},r.id))})}function fz({groups:e,standalone:t,...n}){const[r,o]=b.useState(()=>new Map),s=Kj({count:e.length,estimateSize:()=>lz,overscan:cz,getItemKey:c=>e[c]?.id??c}),i=b.useCallback((c,u)=>{o(d=>{const f=new Map(d);return u?f.set(c,!0):f.delete(c),f})},[]),a=b.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 b.useEffect(()=>{const c=u=>{const d=vs(u);if(d===null)return;const f=a.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(Jt,c),()=>{window.removeEventListener(Jt,c)}},[e,a,i,s]),l.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:l.jsx("div",{"data-index":c.index,ref:s.measureElement,className:"absolute left-0 top-0 w-full",style:{transform:`translateY(${c.start}px)`},children:l.jsx(Zm,{group:u,standalone:t,expanded:r.get(u.id)??!1,onExpandedChange:d=>i(u.id,d),...n})},c.key)})})}const Vo="data-nav-id",pz="data-nav-action";function Ru(e){return Array.from(e.querySelectorAll(`[${Vo}]`))}function Pu(e){return e instanceof HTMLElement}function hz(e,t){let n=e;for(;n!==null&&n!==t;){if(n.hasAttribute(Vo))return n;n=n.parentElement}return e.hasAttribute(Vo)?e:null}function ni(e){const t=e.getAttribute(pz);return t==="toggle"||t==="expand"||t==="collapse"?t:null}function mr(e){e.focus({preventScroll:!0}),e.scrollIntoView({block:"nearest",behavior:"smooth"})}function gr(e,t){return e[t]??null}function Gm(e){const t=e.tagName;return!!(t==="INPUT"||t==="TEXTAREA"||t==="SELECT"||e.isContentEditable)}function Ou(e){const t=e.tagName;return t==="BUTTON"||t==="A"||Gm(e)?!0:e.closest("[role='button'],[role='menuitem'],[role='option']")!==null}function mz(e){return e.closest("[role='dialog'],[role='menu'],[role='listbox']")!==null?!0:document.querySelector("[role='dialog'],[role='menu'],[role='listbox']")!==null}function gz(){const e=window.getSelection();return e===null?!1:e.type==="Range"&&e.toString().length>0}function ho(e,t){return e.key===t&&e.shiftKey}function xz(e,t,n={}){const r=t??e,o=n.pageWide===!0,s=b.useCallback(i=>{const a=e.current,c=r.current;if(!a||!c)return;const u=i.target;if(!Pu(u)||u!==c)return;const d=Ru(a),f=gr(d,0);f!==null&&mr(f)},[e,r]);b.useEffect(()=>{const i=a=>{if(a.altKey||a.ctrlKey||a.metaKey)return;const c=e.current;if(!c)return;const u=a.target;if(!Pu(u)||Gm(u)||gz())return;const d=c.contains(u);if(d&&Ou(u)&&!u.hasAttribute(Vo)||!d&&(!o||Ou(u)||mz(u)))return;const f=Ru(c);if(f.length===0)return;const h=hz(u,c),p=h!==null?f.indexOf(h):-1;let x=!1;switch(a.key){case"ArrowUp":case"W":{if(a.shiftKey&&a.key==="ArrowUp"||a.key==="W"&&!ho(a,"W"))break;a.preventDefault();const m=p>0?p-1:p===-1?f.length-1:-1;if(m!==-1){const g=gr(f,m);g!==null&&mr(g)}x=!0;break}case"ArrowDown":case"S":{if(a.shiftKey&&a.key==="ArrowDown"||a.key==="S"&&!ho(a,"S"))break;a.preventDefault();const m=p<f.length-1?p+1:p===-1?0:-1;if(m!==-1){const g=gr(f,m);g!==null&&mr(g)}x=!0;break}case"ArrowLeft":case"A":{if(a.shiftKey&&a.key==="ArrowLeft"||a.key==="A"&&!ho(a,"A")||h===null)break;if(a.preventDefault(),ni(h)==="collapse")h.click();else if(p>0){const g=gr(f,p-1);g!==null&&mr(g)}x=!0;break}case"ArrowRight":case"D":{if(a.shiftKey&&a.key==="ArrowRight"||a.key==="D"&&!ho(a,"D")||h===null)break;if(a.preventDefault(),ni(h)==="expand")h.click();else if(p<f.length-1){const g=gr(f,p+1);g!==null&&mr(g)}x=!0;break}case" ":{if(h===null)break;a.preventDefault(),ni(h)!==null&&h.click(),x=!0;break}}x&&a.stopPropagation()};return document.addEventListener("keydown",i,{capture:!0}),()=>document.removeEventListener("keydown",i,{capture:!0})},[e,o,r]),b.useEffect(()=>(document.addEventListener("focusin",s),()=>document.removeEventListener("focusin",s)),[s])}const yz={system:"System",user:"User",assistant:"Assistant",tool:"Tool Results",tools:"Tool Definitions"},bz={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"},vz={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"},ri=12,mo=1,Mu=80,Lu=24;function wz(e){return e.length<=Lu?e:`${e.slice(0,Lu-3)}...`}function kz(e){const t=e.replace(/\s+/g," ").trim();return t.length<=Mu?t:`${t.slice(0,Mu)}...`}function go(e){return e>=10?`${e.toFixed(0)}%`:e>=1?`${e.toFixed(1)}%`:e>0?"<1%":"0%"}const _z=b.memo(function({segments:t,totalTokens:n,showLabels:r=!0,onActivate:o}){const s=b.useMemo(()=>n>0?n:t.reduce((g,y)=>g+y.size,0),[t,n]),i=t.slice(0,ri),a=t.slice(ri),c=a.reduce((g,y)=>g+y.size,0),u=a.length,d=ri,f=d+u-1,h=u>0,p=o!==void 0,x=b.useMemo(()=>i.reduce((g,y)=>g+y.size,0),[i]),m=b.useMemo(()=>`Request context: ~${Ve(s)} tokens across ${t.length} segment${t.length===1?"":"s"}`,[t.length,s]);return t.length===0||s<=0?l.jsx("div",{role:"img","aria-label":m,className:"h-6"}):l.jsx(Xe,{delayDuration:150,children:l.jsxs("div",{role:"img","aria-label":m,className:"flex flex-col gap-1.5",children:[l.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,y)=>{const v=s>0?g.size/s*100:0,k=Math.max(mo,v),S=be("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",bz[g.role],p?vz[g.role]:""),C={width:`${k}%`},j=`${g.label}, ${go(v)}, ~${Ve(g.size)} tokens`;return l.jsxs(De,{children:[l.jsx(Fe,{asChild:!0,children:p?l.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}):l.jsx("span",{"aria-label":j,className:S,style:C})}),l.jsxs($e,{side:"bottom",className:"max-w-sm text-xs p-2 space-y-0.5",children:[l.jsxs("div",{className:"font-semibold",children:[g.label," - ",go(v)," - ~",Ve(g.size)," ","tokens"]}),l.jsx("div",{className:"text-muted-foreground",children:yz[g.role]}),l.jsxs("div",{className:"text-muted-foreground",children:[g.characters.toLocaleString()," chars"]}),g.text.length>0&&l.jsx("div",{className:"text-muted-foreground/90 break-words whitespace-pre-wrap",children:kz(g.text)})]})]},`${g.path}-${y}`)}),h&&l.jsxs(De,{children:[l.jsx(Fe,{asChild:!0,children:l.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(mo,c/s*100)}%`},children:["... +",u]})}),l.jsxs($e,{side:"bottom",className:"text-xs",children:[u," more segment",u===1?"":"s"," (indices"," ",d,"-",f,")"]})]})]}),r&&l.jsxs("div",{className:"flex w-full gap-1 text-[10px] text-muted-foreground",children:[i.map((g,y)=>{const v=s>0?g.size/s*100:0,k=Math.max(mo,v);return l.jsxs("div",{className:"flex flex-col gap-0.5 truncate",style:{width:`${k}%`},title:`${g.label} - ${go(v)} - ~${Ve(g.size)} tokens`,children:[l.jsx("span",{className:"truncate font-mono text-foreground/80",children:wz(g.label)}),l.jsxs("span",{className:"truncate font-mono text-muted-foreground/70",children:[go(v)," - ~",Ve(g.size)]})]},`label-${g.path}-${y}`)}),h&&l.jsxs("div",{className:"flex flex-col gap-0.5 truncate text-muted-foreground",style:{width:`${Math.max(mo,c/s*100)}%`},children:[l.jsxs("span",{className:"truncate font-mono text-foreground/60",children:["... +",u]}),l.jsxs("span",{className:"truncate font-mono text-muted-foreground/60",children:["~",Ve(c)]})]})]}),x<s*.1&&l.jsx("div",{className:"h-0"})]})})}),Ym=.75,Xm=.9,Wi=8e3,Sz=.35,Qm=40,eg=160,Cz=5,jz=8,Ez=18,Nz=6e4,Tz=.7,Du=3e3,Az=.3,Fu=160,Iz=new Set(["answer","body","content","data","error","message","markdown","output","response","result","stderr","stdout","text","transcript"]),zz=["context_window","contextWindow","context_length","contextLength","max_context_length","maxContextLength","max_input_tokens","maxInputTokens"],Rz=["max_tokens","maxTokens","max_completion_tokens","maxCompletionTokens","max_output_tokens","maxOutputTokens"],Pz=[{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"]}],Oz={system:"System",user:"User messages",assistant:"Assistant messages",tool:"Tool results",tools:"Tool definitions"};function Mz(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 tg(e,t){for(const n of t){const r=Mz(Oe(e,n));if(r!==null)return r}return null}function Lz(e){const t=Oe(e,"model");if(typeof t!="string")return null;const n=t.trim();return n===""?null:n}function Dz(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 Fz(e,t,n=[]){const r=tg(t,zz);if(r!==null)return{tokens:r,label:"Request metadata",source:"request"};const o=II(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 Pz)if(Dz(s,i))return{tokens:i.tokens,label:`${i.family} local rule`,source:"model-rule"};return{tokens:null,label:"No local rule",source:"unknown"}}function $z(e){return e<0?0:e>1?1:e}function Bz(e){return e===null?"unknown":e>=Xm?"danger":e>=Ym?"watch":"ok"}function Uz(e,t){return e.filter(n=>n.role===t).reduce((n,r)=>n+r.size,0)}function Vz(e,t){return["system","user","assistant","tool","tools"].map(r=>{const o=Uz(e,r);return{role:r,label:Oz[r],tokens:o,percent:t>0?o/t:0}}).filter(r=>r.tokens>0).sort((r,o)=>o.tokens-r.tokens)}function Zi(e){return e.replace(/\s+/g," ").trim().toLowerCase()}function Hz(e){const t=e.replace(/\s+/g," ").trim();return t.length<=Fu?t:`${t.slice(0,Fu-3)}...`}function Wz(e){return{role:e.role,label:e.label,path:e.path,tokens:e.tokens,characters:e.characters}}function Zz(e){return{role:e.role,label:e.label,path:e.path,tokens:e.size,characters:e.characters,text:e.text}}function qz(e){const t=e.trim();return t.startsWith("{")||t.startsWith("[")}function Kz(e){if(!qz(e))return null;try{return JSON.parse(e)}catch{return null}}function Jz(e){return e.toLowerCase().replace(/[^a-z0-9]/g,"")}function Gz(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 Yz(e){const t=Gz(e);return t===null?!1:Iz.has(Jz(t))}function Xz(e){return e.map(t=>t.startsWith("[")?t:`.${t}`).join("").replace(/^\./,"")}function Qz(e,t,n){const r=ol(t);if(r<eg)return null;const o=rl(t);return o<Qm?null:{role:e.role,label:`${e.label} ${Xz(n)}`,path:e.path,tokens:o,characters:r,text:t}}function qi({value:e,segment:t,path:n,depth:r,candidates:o}){if(!(o.length>=jz)&&!(r>Cz)){if(typeof e=="string"){if(!Yz(n))return;const s=Qz(t,e,n);s!==null&&o.push(s);return}if(Array.isArray(e)){e.forEach((s,i)=>qi({value:s,segment:t,path:[...n,`[${String(i)}]`],depth:r+1,candidates:o}));return}Ba(e)&&Object.entries(e).forEach(([s,i])=>qi({value:i,segment:t,path:[...n,s],depth:r+1,candidates:o}))}}function eR(e){const t=Zz(e),n=Kz(e.text);if(n===null)return[t];const r=[];qi({value:n,segment:e,path:[],depth:0,candidates:r});const o=Zi(e.text),s=new Set([o]),i=r.filter(a=>{const c=Zi(a.text);return c===""||s.has(c)?!1:(s.add(c),!0)});return[t,...i]}function tR(e){const t=new Map;for(const r of e){const o=eR(r);for(const s of o){if(s.tokens<Qm||s.characters<eg)continue;const i=Zi(s.text);if(i==="")continue;const a=t.get(i);if(a===void 0){t.set(i,{tokens:s.tokens,candidates:[s]});continue}t.set(i,{tokens:a.tokens+s.tokens,candidates:[...a.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:Hz(o.text),firstLabel:o.label,segments:r.candidates.map(Wz)})}return n.sort((r,o)=>o.repeatedTokens-r.repeatedTokens||o.totalTokens-r.totalTokens)}function nR(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>=Wi?"danger":"watch",title:"Duplicate context",detail:`${String(n)} repeated blocks across ${String(t)} group${t===1?"":"s"}, ~${String(r)} repeated tokens.`}}function rR(e){return e.reduce((t,n)=>t+n.repeatedTokens,0)}function oR(e,t,n){const r=[],o=e.find(c=>c.role==="tools")??null;o!==null&&(o.tokens>=Wi||o.percent>=Sz&&o.tokens>=Du)&&r.push({kind:"tool-schema",severity:o.tokens>=Wi?"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>=Du&&s.percent>=Az&&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),a=t>0?i/t:0;return n>=Ez&&(i>=Nz||a>=Tz)&&r.push({kind:"history-bloat",severity:a>=.85?"danger":"watch",title:"Conversation history growth",detail:`${String(n)} message blocks take ${Math.round(a*100)}% of request context.`}),r}function sR({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:rR(r)}}function iR({segments:e,inputTokens:t,parsed:n,model:r,providers:o=[]}){const s=e.reduce((j,N)=>j+N.size,0),i=r??Lz(n),a=t??s,c=tg(n,Rz),u=Fz(i,n,o),d=c??0,f=u.tokens===null?null:a+d,h=u.tokens===null?null:u.tokens-a,p=u.tokens===null?null:u.tokens-a-d,x=u.tokens===null||f===null?null:$z(f/u.tokens),m=Vz(e,s),g=m[0]??null,y=e.filter(j=>j.role!=="tools").length,v=tR(e),k=nR(v),S=oR(m,s,y);k!==null&&S.unshift(k);const C=Bz(x);return{model:i,contextWindow:u,estimatedInputTokens:a,outputReserveTokens:c,windowUsedTokens:f,remainingInputTokens:h,remainingAfterReserveTokens:p,usagePercent:x,riskLevel:C,roleUsages:m,largestRole:g,diagnostics:S,duplicateGroups:v,health:sR({risk:C,contextWindow:u,diagnostics:S,duplicateGroups:v})}}const WR={watch:Ym,danger:Xm};function aR(e){if(e===null)return null;try{return JSON.parse(e)}catch{return null}}function lR(e){return{role:e.role,label:e.label,size:e.tokens,characters:e.tokens*4,text:"",path:`role:${e.role}`}}function cR(e,t){const n=aR(e.rawRequestBody);if(n===null)return null;const o=Om(Or(e)).anatomySegments(n);if(o===null)return null;const s=iR({segments:o,inputTokens:e.inputTokens??null,parsed:n,model:e.model,providers:t}),i=s.model??e.model??"Unknown model",a=s.roleUsages.map(lR);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:a,roleTotalTokens:a.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 $u(e){switch(e){case"danger":return 4;case"watch":return 3;case"unknown":return 2;case"ok":return 1}}function dR(e,t){const n=$u(t.latest.riskLevel)-$u(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 fR(e,t){return e.usagePercent===null||t.usagePercent===null?null:(t.usagePercent-e.usagePercent)*100}function pR(e,t=[]){const n=[...e].sort((s,i)=>s.id-i.id),r=new Map;for(const s of n){const i=cR(s,t);if(i===null)continue;const a=r.get(i.model);if(a===void 0){r.set(i.model,{model:i.model,requestCount:1,first:i,latest:i,peak:i});continue}r.set(i.model,{model:a.model,requestCount:a.requestCount+1,first:a.first,latest:i,peak:uR(i,a.peak)?i:a.peak})}return{models:[...r.values()].map(s=>({model:s.model,requestCount:s.requestCount,first:s.first,latest:s.latest,peak:s.peak,trendPercent:fR(s.first,s.latest)})).sort(dR)}}function wo(e){return e.length<=30?e:`${e.slice(0,12)}...${e.slice(-12)}`}function Bu(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 hR(e,t){const n=e[0],r=e[e.length-1];return n===void 0||r===void 0?null:da(n.timestamp,r.timestamp,t)}function mR(e){for(const t of e)if(t.userAgent!==null&&t.userAgent!==void 0&&t.userAgent!=="")return t.userAgent;return null}function gR({pinnedSessionId:e,selectedSession:t,sessions:n,logs:r}){if(e!==void 0){const i=r.filter(a=>a.sessionId===e);return i.length===0?null:{label:e,logs:i,showBackLink:!0}}if(t!=="__all__"){const i=r.filter(a=>a.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(a=>a.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 Sr(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 xR(e){return e===null?"n/a":Math.abs(e)<.1?"0%":`${e>0?"+":""}${e.toFixed(1)}%`}function Ki(e){return e===null||!Number.isFinite(e)?0:Math.min(Math.max(e*100,0),100)}function yR(e,t){if(t===null)return null;const n=Ki(e),r=Ki(t);return r<=0||Math.abs(r-n)<.5?null:r}function bR(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 vR(e){const t=e.latest.contextWindow.tokens;return t===null?"Context window unknown":`Context window ${uf(t)}`}function wR(e){return`${e} ${e===1?"request":"requests"}`}function Uu(e){return`#${String(e)}`}function Vu(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 kR(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 _R(e){switch(e){case"risk":return"Risk";case"optimizable":return"Optimizable";case"ok":return"OK"}}const SR=10,CR=80;function jR(e){e.setAttribute("data-deep-link-highlight","true"),window.setTimeout(()=>{e.removeAttribute("data-deep-link-highlight")},1800)}function ER(e){const t=document.getElementById(`log-${String(e)}`);return t instanceof HTMLElement?(t.scrollIntoView({block:"center",behavior:"smooth"}),t.focus({preventScroll:!0}),jR(t),!0):!1}function ng(e){Ui({logId:e,tab:"anatomy"});let t=0;const n=()=>{Ui({logId:e,tab:"anatomy"}),!ER(e)&&(t+=1,t<SR&&window.setTimeout(n,CR))};window.setTimeout(n,0)}function Hu({command:e}){const[t,n]=b.useState(!1),r=b.useCallback(()=>{window.navigator.clipboard.writeText(e).then(()=>{n(!0),setTimeout(()=>n(!1),2e3)})},[e]);return l.jsxs("div",{className:"inline-flex items-center gap-2 bg-muted rounded-md px-3 py-2",children:[l.jsx("pre",{className:"text-blue-500 font-mono text-sm m-0",children:e}),l.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?l.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:l.jsx("path",{d:"M20 6 9 17l-5-5"})}):l.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[l.jsx("rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2"}),l.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 NR(){return l.jsx(Xe,{children:l.jsxs(De,{children:[l.jsx(Fe,{asChild:!0,children:l.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:[l.jsx("span",{className:"size-1.5 rounded-full bg-emerald-300 shadow-[0_0_8px_rgba(110,231,183,0.8)]"}),"MCP Ready",l.jsx("span",{className:"hidden text-cyan-200/70 sm:inline",children:"/api/mcp"})]})}),l.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 Wu({label:e,logId:t}){return l.jsxs("button",{type:"button",onClick:()=>ng(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 ${Uu(t)}`,children:[e," ",Uu(t)]})}function TR({latestPercent:e,peakPercent:t,risk:n,onOpenContext:r}){const o=Ki(e),s=yR(e,t),i=t===null?`Latest context window usage ${Sr(e)}`:`Latest context window usage ${Sr(e)}, peak ${Sr(t)}`;return l.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:l.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:[l.jsx("span",{className:be("block h-full rounded-full transition-[width]",bR(n)),style:{width:`${o}%`}}),s!==null&&l.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 AR({summary:e}){const t=e.trendPercent,n=t===null||Math.abs(t)<.1?null:t>0?Bb:Ob,r=e.latest.diagnostics[0]??null,o=Sr(e.latest.usagePercent),s=Sr(e.peak.usagePercent),i=()=>{ng(e.latest.logId)};return l.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:[l.jsxs("div",{className:"min-w-0",children:[l.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[l.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}),l.jsx("span",{className:be("inline-flex h-5 shrink-0 items-center rounded border px-1.5 font-mono text-[10px]",kR(e.latest.health.level)),children:_R(e.latest.health.level)})]}),l.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:[l.jsx("span",{children:wR(e.requestCount)}),l.jsx("span",{children:vR(e)})]})]}),l.jsxs("div",{className:"min-w-0 space-y-2 text-xs",children:[l.jsx(TR,{latestPercent:e.latest.usagePercent,peakPercent:e.peak.usagePercent,risk:e.latest.riskLevel,onOpenContext:i}),l.jsxs("div",{className:"grid grid-cols-3 gap-2",children:[l.jsxs("div",{className:"min-w-0",children:[l.jsx("div",{className:"text-[10px] uppercase text-muted-foreground",children:"Latest"}),l.jsx("div",{className:be("mt-0.5 font-mono",Vu(e.latest.riskLevel)),children:o}),l.jsx(Wu,{label:"Log",logId:e.latest.logId})]}),l.jsxs("div",{className:"min-w-0",children:[l.jsx("div",{className:"text-[10px] uppercase text-muted-foreground",children:"Peak"}),l.jsx("div",{className:be("mt-0.5 font-mono",Vu(e.peak.riskLevel)),children:s}),l.jsx(Wu,{label:"Log",logId:e.peak.logId})]}),l.jsxs("div",{className:"min-w-0",children:[l.jsx("div",{className:"text-[10px] uppercase text-muted-foreground",children:"Trend"}),l.jsxs("div",{className:"mt-0.5 flex items-center gap-1 font-mono text-foreground",children:[n!==null&&l.jsx(n,{className:be("size-3",t!==null&&t>0?"text-amber-300":"text-emerald-300")}),xR(t)]}),l.jsx("div",{className:"h-5","aria-hidden":"true"})]})]})]}),l.jsxs("div",{className:"min-w-0 space-y-1.5",children:[l.jsx(_z,{segments:e.latest.roleSegments,totalTokens:e.latest.roleTotalTokens,showLabels:!1}),l.jsxs("div",{className:"flex min-w-0 flex-wrap items-center gap-x-2 gap-y-1 text-[11px] text-muted-foreground",children:[l.jsxs("span",{className:"font-mono",children:["~",Ve(e.latest.estimatedInputTokens)," input"]}),e.latest.windowUsedTokens!==null&&l.jsxs("span",{className:"font-mono",children:["~",Ve(e.latest.windowUsedTokens)," used"]}),r!==null&&l.jsx("span",{className:"truncate",children:r})]})]})]})}function IR({summary:e}){return e.models.length===0?null:l.jsxs("div",{className:"mt-3 border-t border-border/70 pt-2",children:[l.jsxs("div",{className:"mb-1 flex items-center justify-between gap-2",children:[l.jsx("div",{className:"text-[11px] font-semibold uppercase tracking-normal text-muted-foreground",children:"Session Context"}),l.jsxs("div",{className:"font-mono text-[10px] text-muted-foreground",children:[e.models.length," model",e.models.length===1?"":"s"]})]}),l.jsx("div",{className:"max-h-52 overflow-y-auto pr-1",children:e.models.map(t=>l.jsx(AR,{summary:t},t.model))})]})}function zR({label:e,logs:t,totalIn:n,totalOut:r,timeDisplayFormat:o,contextSummary:s,showBackLink:i}){const[a,c]=b.useState(!1),u=b.useMemo(()=>hR(t,o),[t,o]),d=b.useMemo(()=>mR(t),[t]),f=b.useCallback(()=>{window.navigator.clipboard.writeText(window.location.href).then(()=>{c(!0),setTimeout(()=>c(!1),2e3)})},[]);return l.jsxs("div",{className:"mb-4 border border-border rounded-md bg-muted/20 px-3 py-2 text-xs",children:[l.jsxs("div",{className:"flex items-center gap-3",children:[i&&l.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:l.jsx(Fb,{className:"size-3.5"})}),l.jsxs("div",{className:"min-w-0 flex-1",children:[l.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[l.jsx("span",{className:"font-mono font-semibold text-purple-400/90 truncate",title:e,children:wo(e)}),d!==null&&l.jsx("span",{className:"font-mono text-muted-foreground truncate max-w-[220px]",title:d,children:d})]}),l.jsxs("div",{className:"mt-1 flex flex-wrap items-center gap-x-3 gap-y-1 text-muted-foreground",children:[l.jsxs("span",{children:[t.length," request",t.length!==1?"s":""]}),u!==null&&l.jsx("span",{children:u}),(n>0||r>0)&&l.jsxs("span",{className:"font-mono",children:[Ve(n)," in / ",Ve(r)," out"]})]})]}),l.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":a?"Copied session link":"Copy session link",title:a?"Copied session link":"Copy session link",children:a?l.jsx(ct,{className:"size-3.5"}):l.jsx(Ft,{className:"size-3.5"})})]}),l.jsx(IR,{summary:s})]})}function RR({logs:e,sessions:t,models:n,selectedSession:r,selectedModel:o,onSessionChange:s,onModelChange:i,onClearAll:a,onClearGroup:c,viewMode:u,onViewModeChange:d,captureMode:f,strip:h,slowResponseThresholdSeconds:p,timeDisplayFormat:x,hideSessionFilter:m=!1,pinnedSessionId:g}){const{totalIn:y,totalOut:v}=b.useMemo(()=>Bu(e),[e]),{providers:k}=df(),[S,C]=b.useState(null),[j,N]=b.useState(null),[I,R]=b.useState("hidden"),O=b.useRef(null),$=b.useRef(null);xz(O,$,{pageWide:!0}),b.useEffect(()=>{const de=50+zr.length*400,ae=setTimeout(()=>R("playing"),50),ue=setTimeout(()=>R("done"),de);return()=>{clearTimeout(ae),clearTimeout(ue)}},[]),b.useEffect(()=>{if(g===void 0){document.title="Agent Inspector";return}const ee=e.length===1?"1 req":`${e.length} req`;document.title=`${wo(g)} - ${ee} - Agent Inspector`},[e.length,g]);const E=b.useCallback(async ee=>{C(ee);try{await $2(e,ee)}finally{C(null)}},[e]);b.useEffect(()=>{N(null)},[r,o]);const L=b.useCallback(()=>{N(null)},[]),w=b.useMemo(()=>P5(e),[e]),M=b.useMemo(()=>gR({pinnedSessionId:g,selectedSession:r,sessions:t,logs:e}),[e,g,r,t]),U=M?.logs??[],F=M!==null&&U.length>0,{totalIn:V,totalOut:J}=b.useMemo(()=>Bu(U),[U]),z=b.useMemo(()=>pR(U,k),[U,k]),H=b.useMemo(()=>iz(w),[w]),Z=b.useMemo(()=>DA(w),[w]),P=b.useCallback(ee=>{const Q=Z.get(ee.id);Q!==void 0&&N([Q,ee])},[Z]);return l.jsxs("div",{className:"max-w-[1400px] xl:max-w-[1600px] 2xl:max-w-[1800px] mx-auto px-6 pb-6",children:[l.jsxs("div",{className:"sticky top-0 z-30 bg-background pt-6",children:[l.jsxs("div",{className:"grid grid-cols-[1fr_auto_1fr] items-start gap-3 pb-8",children:[l.jsx("div",{}),l.jsxs("h1",{className:"flex min-w-0 flex-col items-center gap-2 text-center",children:[l.jsxs("span",{className:"flex max-w-[calc(100vw-7rem)] items-end gap-2 whitespace-nowrap",children:[l.jsxs("span",{className:"flex shrink-0 items-end gap-1 group cursor-default","aria-hidden":"true",children:[l.jsx(mI,{className:"size-10 text-amber-500 transition-all duration-300 group-hover:scale-125 group-hover:-translate-y-1.5"}),l.jsx("span",{className:"hidden items-end gap-0.5 sm:flex",children:zr.map((ee,Q)=>{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"][Q],ae=I==="hidden"?"opacity-0 scale-0":I==="playing"?"animate-crab-piano-pop":"";return l.jsx(ee,{className:`size-5 ${de} transition-all duration-300 ease-out group-hover:scale-125 group-hover:-translate-y-1 ${ae}`,style:{transitionDelay:`${Q*50}ms`,...I==="playing"?{animationDelay:`${Q*400}ms`}:{}}},Q)})})]}),l.jsxs("span",{className:"flex min-w-0 items-baseline gap-2 pl-1",children:[l.jsx("span",{className:"truncate text-lg font-bold",children:"Agent Inspector"}),l.jsxs("span",{className:"shrink-0 font-mono text-xs font-semibold text-muted-foreground",children:["v",Rw.version]})]}),l.jsx(ui,{className:"size-4 shrink-0 text-muted-foreground/70","aria-hidden":"true"}),l.jsx(xI,{className:"size-10 shrink-0"})]}),l.jsx(NR,{})]}),l.jsx("div",{className:"justify-self-end",children:l.jsx(ez,{})})]}),F&&M!==null&&l.jsx(zR,{label:M.label,logs:U,totalIn:V,totalOut:J,timeDisplayFormat:x,contextSummary:z,showBackLink:M.showBackLink}),l.jsxs("div",{className:"flex items-center gap-3 mb-4",children:[!m&&l.jsxs(gu,{value:r,onValueChange:s,children:[l.jsx(yu,{className:"flex-1 max-w-[350px] text-xs",children:l.jsx(xu,{placeholder:"All sessions"})}),l.jsxs(bu,{children:[l.jsx(lo,{value:"__all__",children:"All sessions"}),t.map(ee=>l.jsx(lo,{value:ee,children:wo(ee)},ee))]})]}),l.jsxs(gu,{value:o,onValueChange:i,children:[l.jsx(yu,{className:"flex-1 max-w-[250px] text-xs",children:l.jsx(xu,{placeholder:"All models"})}),l.jsxs(bu,{children:[l.jsx(lo,{value:"__all__",children:"All models"}),n.map(ee=>l.jsx(lo,{value:ee,children:ee},ee))]})]}),f==="full"?l.jsxs("div",{className:"flex items-center border border-border rounded-md overflow-hidden",children:[l.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"}),l.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"})]}):l.jsx("div",{className:"flex h-8 items-center rounded-md border border-border bg-muted px-3 text-xs text-foreground",children:"Simple"}),l.jsx("div",{className:"flex-1"}),!F&&l.jsxs("span",{className:"text-muted-foreground text-xs font-mono",children:[e.length," request",e.length!==1?"s":"",y>0||v>0?` - ${Ve(y)} in / ${Ve(v)} out`:""]}),e.length>0&&l.jsx("button",{type:"button",onClick:()=>{E("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"?l.jsx("span",{children:"Exporting..."}):l.jsxs(l.Fragment,{children:[l.jsx(aa,{className:"size-3.5"}),l.jsx("span",{children:"Export"})]})}),e.length>0&&l.jsx("button",{type:"button",onClick:()=>{E("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"}),l.jsx("button",{type:"button",onClick:a,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"})]})]}),l.jsx("div",{children:e.length===0?r!=="__all__"?l.jsxs("div",{className:"text-center text-muted-foreground py-16 space-y-4",children:[l.jsx("p",{className:"text-sm font-medium",children:"Session not found"}),l.jsx("p",{className:"text-xs font-mono bg-muted px-3 py-1 rounded inline-block max-w-[500px] break-all",children:wo(r)}),l.jsxs("p",{className:"text-xs",children:["This session may have been cleared or never existed."," ",m?l.jsx("a",{href:"/",className:"underline hover:text-foreground transition-colors",children:"Back to all sessions"}):l.jsx("button",{type:"button",onClick:()=>s("__all__"),className:"underline hover:text-foreground transition-colors",children:"Show all sessions"})]})]}):l.jsxs("div",{className:"text-center text-muted-foreground py-16 space-y-4",children:[l.jsx("p",{className:"text-sm",children:"No requests captured yet."}),l.jsx("p",{className:"text-xs",children:"Route AI coding tools through the proxy:"}),l.jsxs("div",{className:"flex flex-col items-center gap-2",children:[l.jsx(Hu,{command:"ANTHROPIC_BASE_URL=http://localhost:25947/proxy <your-tool>"}),l.jsx(Hu,{command:"OPENAI_BASE_URL=http://localhost:25947/proxy <your-tool>"})]})]}):l.jsx("div",{ref:$,tabIndex:0,className:"flex flex-col gap-2 focus:outline-none",children:l.jsx("div",{ref:O,children:l.jsx(dz,{groups:w,viewMode:u,strip:h,slowResponseThresholdSeconds:p,cacheTrends:H,onCompareWithPrevious:P,comparisonPredecessors:Z,onClearGroup:c,standalone:w.length===1,hasPinnedSessionContext:F,timeDisplayFormat:x})})})}),j!==null&&l.jsx(b.Suspense,{fallback:null,children:l.jsx(xj,{left:j[0],right:j[1],onClose:L})})]})}const PR=Gt([ie({type:je("init"),logs:Se(Al)}),ie({type:je("update"),log:Al})]);function OR(e){const t=new Set;for(const n of e)n.sessionId!==null&&n.sessionId!==""&&t.add(n.sessionId);return[...t]}function MR(e){const t=new Set;for(const n of e)n.model!==null&&n.model!==""&&t.add(n.model);return[...t]}function LR(e,t,n){return t==="__all__"&&n==="__all__"?e:e.filter(r=>!(t!=="__all__"&&r.sessionId!==t||n!=="__all__"&&r.model!==n))}const DR=50,FR=12,$R=1800;function BR(e){return e===void 0?"/api/logs/stream":`/api/logs/stream?${new URLSearchParams({sessionId:e}).toString()}`}function ZR({initialSessionId:e}={}){const[t,n]=b.useState([]),[r,o]=b.useState(e??"__all__"),[s,i]=b.useState("__all__"),[a,c]=b.useState("simple"),[u,d]=b.useState(null),f=b.useRef(null),h=b.useRef(null),p=b.useRef(null),x=b.useRef(new Map),m=b.useRef([]),g=b.useRef(null),y=b.useMemo(()=>LR(t,r,s),[t,r,s]),v=b.useMemo(()=>OR(t),[t]),k=b.useMemo(()=>MR(t),[t]),S=b.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})},[]),C=b.useCallback(L=>{m.current.push(L),g.current===null&&(g.current=setTimeout(S,DR))},[S]),j=b.useCallback(()=>{f.current&&f.current.close();const L=new EventSource(BR(e));f.current=L,L.onmessage=w=>{try{const M=String(w.data),U=JSON.parse(M),F=PR.safeParse(U);if(!F.success){d("Failed to parse SSE data");return}const V=F.data;if(V.type==="init"){g.current!==null&&(clearTimeout(g.current),g.current=null),m.current=[];const J=new Map;for(let z=0;z<V.logs.length;z++){const H=V.logs[z];H!==void 0&&J.set(H.id,z)}x.current=J,n(V.logs),d(null)}else V.type==="update"&&C(V.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]);b.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]),b.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&&Ui({logId:M,tab:"request"});let U=!1,F=0,V=null,J=null;const z=()=>{if(U)return;const H=document.getElementById(w);if(H!==null){p.current=L,H.scrollIntoView({block:"center",behavior:"smooth"}),H instanceof HTMLElement&&(V=H,H.setAttribute("data-deep-link-highlight","true"),J=window.setTimeout(()=>{H.removeAttribute("data-deep-link-highlight")},$R),H.focus({preventScroll:!0}),H.getAttribute("data-nav-action")==="expand"&&H.click());return}F+=1,F<FR&&window.setTimeout(z,100)};return z(),()=>{U=!0,J!==null&&window.clearTimeout(J),V!==null&&V.removeAttribute("data-deep-link-highlight")}},[y.length]);const N=b.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]),I=b.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(J=>!M.has(J.id)),V=new Map;for(let J=0;J<F.length;J++){const z=F[J];z!==void 0&&V.set(z.id,J)}return x.current=V,F}),d(null)}catch(w){d(w instanceof Error?w.message:"Unknown error clearing group")}})()},[]),{strip:R,captureMode:O,slowResponseThresholdSeconds:$,timeDisplayFormat:E}=Dd();return l.jsxs(l.Fragment,{children:[u!==null&&l.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}),l.jsx(I2,{}),l.jsx(RR,{logs:y,sessions:v,models:k,selectedSession:r,selectedModel:s,onSessionChange:o,onModelChange:i,onClearAll:N,onClearGroup:I,viewMode:a,onViewModeChange:c,captureMode:O,strip:R,slowResponseThresholdSeconds:$,timeDisplayFormat:E,hideSessionFilter:e!==void 0,pinnedSessionId:e})]})}export{I4 as $,Se as A,jt as B,hv as C,La as D,Ui as E,nt as F,W as G,Al as H,iR as I,A4 as J,bz as K,yz as L,Uv as M,uf as N,WR as O,ZR as P,Yt as Q,n2 as R,_z as S,Lh as T,Ne as U,cu as V,sE as W,ua as X,HR as Y,$d as Z,iE as _,R5 as a,Zd as a0,nl as a1,Fo as a2,Tr as a3,Eo as a4,Tw as a5,Nr as a6,be as b,me as c,ui as d,Wd as e,Ve as f,Om as g,un as h,ct as i,Ft as j,Da as k,Fa as l,$a as m,Qv as n,Dh as o,St as p,Ct as q,Or as r,Re as s,Xe as t,df as u,De as v,Fe as w,$e as x,ie as y,pe as z};
|