@tonyclaw/agent-inspector 2.0.11 → 2.0.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.output/nitro.json +1 -1
- package/.output/public/assets/{CompareDrawer-C9OWdxHM.js → CompareDrawer-ClM_uVRy.js} +1 -1
- package/.output/public/assets/ProxyViewerContainer-CTNNzXSa.js +114 -0
- package/.output/public/assets/{ReplayDialog-CwE6I1Pe.js → ReplayDialog-7rp7N_KJ.js} +1 -1
- package/.output/public/assets/RequestAnatomy-sL2FFo_N.js +1 -0
- package/.output/public/assets/ResponseView-Cjlf3b6-.js +1 -0
- package/.output/public/assets/{StreamingChunkSequence-CLcLZ7-W.js → StreamingChunkSequence-Ctx3sT3r.js} +1 -1
- package/.output/public/assets/_sessionId-DEWzDQ8-.js +1 -0
- package/.output/public/assets/index-DGIIhZTn.js +1 -0
- package/.output/public/assets/index-D_nZj9Vt.css +1 -0
- package/.output/public/assets/{main-D1Xanzu7.js → main-FvIQopAy.js} +2 -2
- package/.output/server/_libs/lucide-react.mjs +51 -39
- package/.output/server/{_sessionId-D3IyPpws.mjs → _sessionId-BDSgtrsI.mjs} +2 -2
- package/.output/server/_ssr/{CompareDrawer-BIMThqxy.mjs → CompareDrawer-Cqvv0I3x.mjs} +3 -3
- package/.output/server/_ssr/{ProxyViewerContainer-BiBdKWtj.mjs → ProxyViewerContainer-C0YEoG8N.mjs} +1611 -183
- package/.output/server/_ssr/{ReplayDialog-D_wiDyM2.mjs → ReplayDialog-CrsynUKI.mjs} +4 -4
- package/.output/server/_ssr/RequestAnatomy-CR_JUkcL.mjs +688 -0
- package/.output/server/_ssr/{ResponseView-Drk5ghmL.mjs → ResponseView-Dba2Et69.mjs} +3 -3
- package/.output/server/_ssr/{StreamingChunkSequence-F889rmG0.mjs → StreamingChunkSequence-BIMHLstI.mjs} +2 -2
- package/.output/server/_ssr/{index-CaPniq9z.mjs → index-DveIUTm5.mjs} +2 -2
- package/.output/server/_ssr/index.mjs +2 -2
- package/.output/server/_ssr/{router-C7S8FRth.mjs → router-D0yXVG0Q.mjs} +85 -22
- package/.output/server/{_tanstack-start-manifest_v-CVTkFOdT.mjs → _tanstack-start-manifest_v-pe0xJFuQ.mjs} +1 -1
- package/.output/server/index.mjs +62 -62
- package/package.json +1 -1
- package/src/components/ProxyViewer.tsx +453 -52
- package/src/components/providers/ProviderCard.tsx +45 -2
- package/src/components/providers/ProviderForm.tsx +245 -80
- package/src/components/providers/ProvidersPanel.tsx +7 -1
- package/src/components/proxy-viewer/ConversationGroup.tsx +18 -1
- package/src/components/proxy-viewer/LogEntry.tsx +25 -0
- package/src/components/proxy-viewer/TurnGroup.tsx +15 -0
- package/src/components/proxy-viewer/anatomy/RequestAnatomy.tsx +99 -79
- package/src/components/proxy-viewer/anatomy/contextIntelligence.ts +22 -4
- package/src/components/proxy-viewer/anatomy/sessionContextSummary.ts +196 -0
- package/src/components/proxy-viewer/logFocus.ts +33 -0
- package/src/lib/providerModelMetadata.ts +64 -12
- package/src/lib/utils.ts +7 -0
- package/src/proxy/providers.ts +25 -0
- package/src/routes/api/providers.ts +3 -0
- package/.output/public/assets/ProxyViewerContainer-CNzay4u8.js +0 -114
- package/.output/public/assets/RequestAnatomy-DEehC3yz.js +0 -1
- package/.output/public/assets/ResponseView-CE5UsuUq.js +0 -1
- package/.output/public/assets/_sessionId-DE__tPTo.js +0 -1
- package/.output/public/assets/index-BFO4Jmw5.js +0 -1
- package/.output/public/assets/index-CDzZ7l_S.css +0 -1
- package/.output/server/_ssr/RequestAnatomy-5UiMTESr.mjs +0 -1383
|
@@ -1,114 +0,0 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/CompareDrawer-C9OWdxHM.js","assets/main-D1Xanzu7.js","assets/ReplayDialog-CwE6I1Pe.js","assets/ResponseView-CE5UsuUq.js","assets/RequestAnatomy-DEehC3yz.js","assets/StreamingChunkSequence-CLcLZ7-W.js"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{u as Ii,a as du,r as y,j as l,c as Ur,g as Pi,b as Ir,d as at,e as fu,f as fm,h as hm,_ as _n}from"./main-D1Xanzu7.js";function X(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 p=d[f];p in a||(a[p]=u[p].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 Fn extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class hu extends Error{constructor(t){super(`Encountered unidirectional transform during encode: ${t}`),this.name="ZodEncodeError"}}const pu={};function tn(e){return pu}function mu(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 qs(e,t){return typeof t=="bigint"?t.toString():t}function Lo(e){return{get value(){{const t=e();return Object.defineProperty(this,"value",{value:t}),t}}}}function Ri(e){return e==null}function Oi(e){const t=e.startsWith("^")?1:0,n=e.endsWith("$")?e.length-1:e.length;return e.slice(t,n)}function pm(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 Ha=Symbol("evaluating");function Ae(e,t,n){let r;Object.defineProperty(e,t,{get(){if(r!==Ha)return r===void 0&&(r=Ha,r=n()),r},set(o){Object.defineProperty(e,t,{value:o})},configurable:!0})}function Sn(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function an(...e){const t={};for(const n of e){const r=Object.getOwnPropertyDescriptors(n);Object.assign(t,r)}return Object.defineProperties({},t)}function Za(e){return JSON.stringify(e)}function mm(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}const gu="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function _r(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}const gm=Lo(()=>{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(_r(e)===!1)return!1;const t=e.constructor;if(t===void 0||typeof t!="function")return!0;const n=t.prototype;return!(_r(n)===!1||Object.prototype.hasOwnProperty.call(n,"isPrototypeOf")===!1)}function xu(e){return Zn(e)?{...e}:Array.isArray(e)?[...e]:e}const xm=new Set(["string","number","symbol"]);function Wn(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function ln(e,t,n){const r=new e._zod.constr(t??e._zod.def);return(!t||n?.parent)&&(r._zod.parent=e),r}function be(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 ym(e){return Object.keys(e).filter(t=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}const bm={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 vm(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=an(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 Sn(this,"shape",i),i},checks:[]});return ln(e,s)}function wm(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=an(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 Sn(this,"shape",i),i},checks:[]});return ln(e,s)}function km(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=an(e._zod.def,{get shape(){const s={...e._zod.def.shape,...t};return Sn(this,"shape",s),s}});return ln(e,o)}function _m(e,t){if(!Zn(t))throw new Error("Invalid input to safeExtend: expected a plain object");const n=an(e._zod.def,{get shape(){const r={...e._zod.def.shape,...t};return Sn(this,"shape",r),r}});return ln(e,n)}function Sm(e,t){const n=an(e._zod.def,{get shape(){const r={...e._zod.def.shape,...t._zod.def.shape};return Sn(this,"shape",r),r},get catchall(){return t._zod.def.catchall},checks:[]});return ln(e,n)}function Cm(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=an(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 Sn(this,"shape",c),c},checks:[]});return ln(t,i)}function jm(e,t,n){const r=an(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 Sn(this,"shape",s),s}});return ln(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 Ln(e,t){return t.map(n=>{var r;return(r=n).path??(r.path=[]),n.path.unshift(e),n})}function Vr(e){return typeof e=="string"?e:e?.message}function nn(e,t,n){const r={...e,path:e.path??[]};if(!e.message){const o=Vr(e.inst?._zod.def?.error?.(e))??Vr(t?.error?.(e))??Vr(n.customError?.(e))??Vr(n.localeError?.(e))??"Invalid input";r.message=o}return delete r.inst,delete r.continue,t?.reportInput||delete r.input,r}function Mi(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}function Sr(...e){const[t,n,r]=e;return typeof t=="string"?{message:t,code:"custom",input:n,inst:r}:{...t}}const yu=(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,qs,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},bu=X("$ZodError",yu),vu=X("$ZodError",yu,{Parent:Error});function Em(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 Nm(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 Di=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 Fn;if(i.issues.length){const a=new(o?.Err??e)(i.issues.map(c=>nn(c,s,tn())));throw gu(a,o?.callee),a}return i.value},Li=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=>nn(c,s,tn())));throw gu(a,o?.callee),a}return i.value},Fo=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 Fn;return s.issues.length?{success:!1,error:new(e??bu)(s.issues.map(i=>nn(i,o,tn())))}:{success:!0,data:s.value}},Tm=Fo(vu),$o=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=>nn(i,o,tn())))}:{success:!0,data:s.value}},Am=$o(vu),zm=e=>(t,n,r)=>{const o=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return Di(e)(t,n,o)},Im=e=>(t,n,r)=>Di(e)(t,n,r),Pm=e=>async(t,n,r)=>{const o=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return Li(e)(t,n,o)},Rm=e=>async(t,n,r)=>Li(e)(t,n,r),Om=e=>(t,n,r)=>{const o=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return Fo(e)(t,n,o)},Mm=e=>(t,n,r)=>Fo(e)(t,n,r),Dm=e=>async(t,n,r)=>{const o=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return $o(e)(t,n,o)},Lm=e=>async(t,n,r)=>$o(e)(t,n,r),Fm=/^[cC][^\s-]{8,}$/,$m=/^[0-9a-z]+$/,Bm=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,Um=/^[0-9a-vA-V]{20}$/,Vm=/^[A-Za-z0-9]{27}$/,Hm=/^[a-zA-Z0-9_-]{21}$/,Zm=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,Wm=/^([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})$/,Wa=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)$/,qm=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,Jm="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function Km(){return new RegExp(Jm,"u")}const Gm=/^(?:(?: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])$/,Ym=/^(([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}|:))$/,Xm=/^((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])$/,Qm=/^(([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])$/,eg=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,wu=/^[A-Za-z0-9_-]*$/,tg=/^\+[1-9]\d{6,14}$/,ku="(?:(?:\\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])))",ng=new RegExp(`^${ku}$`);function _u(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 rg(e){return new RegExp(`^${_u(e)}$`)}function og(e){const t=_u({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(`^${ku}T(?:${r})$`)}const sg=e=>{const t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${t}$`)},ig=/^-?\d+$/,Su=/^-?\d+(?:\.\d+)?$/,ag=/^(?:true|false)$/i,lg=/^null$/i,cg=/^[^A-Z]*$/,ug=/^[^a-z]*$/,ut=X("$ZodCheck",(e,t)=>{var n;e._zod??(e._zod={}),e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),Cu={number:"number",bigint:"bigint",object:"date"},ju=X("$ZodCheckLessThan",(e,t)=>{ut.init(e,t);const n=Cu[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})}}),Eu=X("$ZodCheckGreaterThan",(e,t)=>{ut.init(e,t);const n=Cu[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})}}),dg=X("$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):pm(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})}}),fg=X("$ZodCheckNumberFormat",(e,t)=>{ut.init(e,t),t.format=t.format||"float64";const n=t.format?.includes("int"),r=n?"int":"number",[o,s]=bm[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=ig)}),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})}}),hg=X("$ZodCheckMaxLength",(e,t)=>{var n;ut.init(e,t),(n=e._zod.def).when??(n.when=r=>{const o=r.value;return!Ri(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=Mi(o);r.issues.push({origin:i,code:"too_big",maximum:t.maximum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),pg=X("$ZodCheckMinLength",(e,t)=>{var n;ut.init(e,t),(n=e._zod.def).when??(n.when=r=>{const o=r.value;return!Ri(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=Mi(o);r.issues.push({origin:i,code:"too_small",minimum:t.minimum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),mg=X("$ZodCheckLengthEquals",(e,t)=>{var n;ut.init(e,t),(n=e._zod.def).when??(n.when=r=>{const o=r.value;return!Ri(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=Mi(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})}}),Bo=X("$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=()=>{})}),gg=X("$ZodCheckRegex",(e,t)=>{Bo.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})}}),xg=X("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=cg),Bo.init(e,t)}),yg=X("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=ug),Bo.init(e,t)}),bg=X("$ZodCheckIncludes",(e,t)=>{ut.init(e,t);const n=Wn(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})}}),vg=X("$ZodCheckStartsWith",(e,t)=>{ut.init(e,t);const n=new RegExp(`^${Wn(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})}}),wg=X("$ZodCheckEndsWith",(e,t)=>{ut.init(e,t);const n=new RegExp(`.*${Wn(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})}}),kg=X("$ZodCheckOverwrite",(e,t)=>{ut.init(e,t),e._zod.check=n=>{n.value=t.tx(n.value)}});class _g{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 Sg={major:4,minor:3,patch:6},Ve=X("$ZodType",(e,t)=>{var n;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=Sg;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 p=i.issues.length,h=f._zod.check(i);if(h instanceof Promise&&c?.async===!1)throw new Fn;if(d||h instanceof Promise)d=(d??Promise.resolve()).then(async()=>{await h,i.issues.length!==p&&(u||(u=Dn(i,p)))});else{if(i.issues.length===p)continue;u||(u=Dn(i,p))}}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 Fn;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 Fn;return c.then(u=>o(u,r,a))}return o(c,r,a)}}Ae(e,"~standard",()=>({validate:o=>{try{const s=Tm(e,o);return s.success?{value:s.data}:{issues:s.error?.issues}}catch{return Am(e,o).then(i=>i.success?{value:i.data}:{issues:i.error?.issues})}},vendor:"zod",version:1}))}),Fi=X("$ZodString",(e,t)=>{Ve.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??sg(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=X("$ZodStringFormat",(e,t)=>{Bo.init(e,t),Fi.init(e,t)}),Cg=X("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=Wm),Ze.init(e,t)}),jg=X("$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=Wa(r))}else t.pattern??(t.pattern=Wa());Ze.init(e,t)}),Eg=X("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=qm),Ze.init(e,t)}),Ng=X("$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})}}}),Tg=X("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=Km()),Ze.init(e,t)}),Ag=X("$ZodNanoID",(e,t)=>{t.pattern??(t.pattern=Hm),Ze.init(e,t)}),zg=X("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=Fm),Ze.init(e,t)}),Ig=X("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=$m),Ze.init(e,t)}),Pg=X("$ZodULID",(e,t)=>{t.pattern??(t.pattern=Bm),Ze.init(e,t)}),Rg=X("$ZodXID",(e,t)=>{t.pattern??(t.pattern=Um),Ze.init(e,t)}),Og=X("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=Vm),Ze.init(e,t)}),Mg=X("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=og(t)),Ze.init(e,t)}),Dg=X("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=ng),Ze.init(e,t)}),Lg=X("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=rg(t)),Ze.init(e,t)}),Fg=X("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=Zm),Ze.init(e,t)}),$g=X("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=Gm),Ze.init(e,t),e._zod.bag.format="ipv4"}),Bg=X("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=Ym),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})}}}),Ug=X("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=Xm),Ze.init(e,t)}),Vg=X("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=Qm),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 Nu(e){if(e==="")return!0;if(e.length%4!==0)return!1;try{return atob(e),!0}catch{return!1}}const Hg=X("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=eg),Ze.init(e,t),e._zod.bag.contentEncoding="base64",e._zod.check=n=>{Nu(n.value)||n.issues.push({code:"invalid_format",format:"base64",input:n.value,inst:e,continue:!t.abort})}});function Zg(e){if(!wu.test(e))return!1;const t=e.replace(/[-_]/g,r=>r==="-"?"+":"/"),n=t.padEnd(Math.ceil(t.length/4)*4,"=");return Nu(n)}const Wg=X("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=wu),Ze.init(e,t),e._zod.bag.contentEncoding="base64url",e._zod.check=n=>{Zg(n.value)||n.issues.push({code:"invalid_format",format:"base64url",input:n.value,inst:e,continue:!t.abort})}}),qg=X("$ZodE164",(e,t)=>{t.pattern??(t.pattern=tg),Ze.init(e,t)});function Jg(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 Kg=X("$ZodJWT",(e,t)=>{Ze.init(e,t),e._zod.check=n=>{Jg(n.value,t.alg)||n.issues.push({code:"invalid_format",format:"jwt",input:n.value,inst:e,continue:!t.abort})}}),Tu=X("$ZodNumber",(e,t)=>{Ve.init(e,t),e._zod.pattern=e._zod.bag.pattern??Su,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}}),Gg=X("$ZodNumberFormat",(e,t)=>{fg.init(e,t),Tu.init(e,t)}),Yg=X("$ZodBoolean",(e,t)=>{Ve.init(e,t),e._zod.pattern=ag,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}}),Xg=X("$ZodNull",(e,t)=>{Ve.init(e,t),e._zod.pattern=lg,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}}),Qg=X("$ZodUnknown",(e,t)=>{Ve.init(e,t),e._zod.parse=n=>n}),ex=X("$ZodNever",(e,t)=>{Ve.init(e,t),e._zod.parse=(n,r)=>(n.issues.push({expected:"never",code:"invalid_type",input:n.value,inst:e}),n)});function qa(e,t,n){e.issues.length&&t.issues.push(...Ln(n,e.issues)),t.value[n]=e.value}const tx=X("$ZodArray",(e,t)=>{Ve.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=>qa(u,n,i))):qa(c,n,i)}return s.length?Promise.all(s).then(()=>n):n}});function po(e,t,n,r,o){if(e.issues.length){if(o&&!(n in r))return;t.issues.push(...Ln(n,e.issues))}e.value===void 0?n in r&&(t.value[n]=void 0):t.value[n]=e.value}function Au(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=ym(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(n)}}function zu(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 p=c.run({value:t[f],issues:[]},r);p instanceof Promise?e.push(p.then(h=>po(h,n,f,t,d))):po(p,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 nx=X("$ZodObject",(e,t)=>{if(Ve.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=Lo(()=>Au(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=_r,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 p of i.keys){const h=f[p],g=h._zod.optout==="optional",m=h._zod.run({value:u[p],issues:[]},c);m instanceof Promise?d.push(m.then(x=>po(x,a,p,u,g))):po(m,a,p,u,g)}return s?zu(d,u,a,c,r.value,e):d.length?Promise.all(d).then(()=>a):a}}),rx=X("$ZodObjectJIT",(e,t)=>{nx.init(e,t);const n=e._zod.parse,r=Lo(()=>Au(t)),o=p=>{const h=new _g(["shape","payload","ctx"]),g=r.value,m=k=>{const S=Za(k);return`shape[${S}]._zod.run({ value: input[${S}], issues: [] }, ctx)`};h.write("const input = payload.value;");const x=Object.create(null);let b=0;for(const k of g.keys)x[k]=`key_${b++}`;h.write("const newResult = {};");for(const k of g.keys){const S=x[k],C=Za(k),N=p[k]?._zod?.optout==="optional";h.write(`const ${S} = ${m(k)};`),N?h.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
|
-
`):h.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
|
-
`)}h.write("payload.value = newResult;"),h.write("return payload;");const v=h.compile();return(k,S)=>v(p,k,S)};let s;const i=_r,a=!pu.jitless,u=a&&gm.value,d=t.catchall;let f;e._zod.parse=(p,h)=>{f??(f=r.value);const g=p.value;return i(g)?a&&u&&h?.async===!1&&h.jitless!==!0?(s||(s=o(t.shape)),p=s(p,h),d?zu([],g,p,h,f,e):p):n(p,h):(p.issues.push({expected:"object",code:"invalid_type",input:g,inst:e}),p)}});function Ja(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=>nn(i,r,tn())))}),t)}const Iu=X("$ZodUnion",(e,t)=>{Ve.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=>Oi(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=>Ja(c,o,e,s)):Ja(a,o,e,s)}}),ox=X("$ZodDiscriminatedUnion",(e,t)=>{t.inclusive=!1,Iu.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=Lo(()=>{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(!_r(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)}}),sx=X("$ZodIntersection",(e,t)=>{Ve.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])=>Ka(n,c,u)):Ka(n,s,i)}});function Js(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=Js(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=Js(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 Ka(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=Js(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 ix=X("$ZodRecord",(e,t)=>{Ve.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(...Ln(u,f.issues)),n.value[u]=f.value})):(d.issues.length&&n.issues.push(...Ln(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"&&Su.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=>nn(f,r,tn())),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(...Ln(a,f.issues)),n.value[c.value]=f.value})):(d.issues.length&&n.issues.push(...Ln(a,d.issues)),n.value[c.value]=d.value)}}return s.length?Promise.all(s).then(()=>n):n}}),ax=X("$ZodEnum",(e,t)=>{Ve.init(e,t);const n=mu(t.entries),r=new Set(n);e._zod.values=r,e._zod.pattern=new RegExp(`^(${n.filter(o=>xm.has(typeof o)).map(o=>typeof o=="string"?Wn(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}}),lx=X("$ZodLiteral",(e,t)=>{if(Ve.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"?Wn(r):r?Wn(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}}),cx=X("$ZodTransform",(e,t)=>{Ve.init(e,t),e._zod.parse=(n,r)=>{if(r.direction==="backward")throw new hu(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 Fn;return n.value=o,n}});function Ga(e,t){return e.issues.length&&t===void 0?{issues:[],value:void 0}:e}const Pu=X("$ZodOptional",(e,t)=>{Ve.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(`^(${Oi(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=>Ga(s,n.value)):Ga(o,n.value)}return n.value===void 0?n:t.innerType._zod.run(n,r)}}),ux=X("$ZodExactOptional",(e,t)=>{Pu.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)}),dx=X("$ZodNullable",(e,t)=>{Ve.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(`^(${Oi(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)}),fx=X("$ZodDefault",(e,t)=>{Ve.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=>Ya(s,t)):Ya(o,t)}});function Ya(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}const hx=X("$ZodPrefault",(e,t)=>{Ve.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))}),px=X("$ZodNonOptional",(e,t)=>{Ve.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=>Xa(s,e)):Xa(o,e)}});function Xa(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 mx=X("$ZodCatch",(e,t)=>{Ve.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=>nn(i,r,tn()))},input:n.value}),n.issues=[]),n)):(n.value=o.value,o.issues.length&&(n.value=t.catchValue({...n,error:{issues:o.issues.map(s=>nn(s,r,tn()))},input:n.value}),n.issues=[]),n)}}),gx=X("$ZodPipe",(e,t)=>{Ve.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=>Hr(i,t.in,r)):Hr(s,t.in,r)}const o=t.in._zod.run(n,r);return o instanceof Promise?o.then(s=>Hr(s,t.out,r)):Hr(o,t.out,r)}});function Hr(e,t,n){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},n)}const xx=X("$ZodReadonly",(e,t)=>{Ve.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(Qa):Qa(o)}});function Qa(e){return e.value=Object.freeze(e.value),e}const yx=X("$ZodLazy",(e,t)=>{Ve.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)}),bx=X("$ZodCustom",(e,t)=>{ut.init(e,t),Ve.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=>el(s,n,r,e));el(o,n,r,e)}});function el(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(Sr(o))}}var tl;class vx{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 wx(){return new vx}(tl=globalThis).__zod_globalRegistry??(tl.__zod_globalRegistry=wx());const gr=globalThis.__zod_globalRegistry;function kx(e,t){return new e({type:"string",...be(t)})}function _x(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...be(t)})}function nl(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...be(t)})}function Sx(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...be(t)})}function Cx(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...be(t)})}function jx(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...be(t)})}function Ex(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...be(t)})}function Nx(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...be(t)})}function Tx(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...be(t)})}function Ax(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...be(t)})}function zx(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...be(t)})}function Ix(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...be(t)})}function Px(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...be(t)})}function Rx(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...be(t)})}function Ox(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...be(t)})}function Mx(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...be(t)})}function Dx(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...be(t)})}function Lx(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...be(t)})}function Fx(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...be(t)})}function $x(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...be(t)})}function Bx(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...be(t)})}function Ux(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...be(t)})}function Vx(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...be(t)})}function Hx(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...be(t)})}function Zx(e,t){return new e({type:"string",format:"date",check:"string_format",...be(t)})}function Wx(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...be(t)})}function qx(e,t){return new e({type:"string",format:"duration",check:"string_format",...be(t)})}function Jx(e,t){return new e({type:"number",checks:[],...be(t)})}function Kx(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...be(t)})}function Gx(e,t){return new e({type:"boolean",...be(t)})}function Yx(e,t){return new e({type:"null",...be(t)})}function Xx(e){return new e({type:"unknown"})}function Qx(e,t){return new e({type:"never",...be(t)})}function rl(e,t){return new ju({check:"less_than",...be(t),value:e,inclusive:!1})}function fs(e,t){return new ju({check:"less_than",...be(t),value:e,inclusive:!0})}function ol(e,t){return new Eu({check:"greater_than",...be(t),value:e,inclusive:!1})}function hs(e,t){return new Eu({check:"greater_than",...be(t),value:e,inclusive:!0})}function sl(e,t){return new dg({check:"multiple_of",...be(t),value:e})}function Ru(e,t){return new hg({check:"max_length",...be(t),maximum:e})}function mo(e,t){return new pg({check:"min_length",...be(t),minimum:e})}function Ou(e,t){return new mg({check:"length_equals",...be(t),length:e})}function e0(e,t){return new gg({check:"string_format",format:"regex",...be(t),pattern:e})}function t0(e){return new xg({check:"string_format",format:"lowercase",...be(e)})}function n0(e){return new yg({check:"string_format",format:"uppercase",...be(e)})}function r0(e,t){return new bg({check:"string_format",format:"includes",...be(t),includes:e})}function o0(e,t){return new vg({check:"string_format",format:"starts_with",...be(t),prefix:e})}function s0(e,t){return new wg({check:"string_format",format:"ends_with",...be(t),suffix:e})}function Xn(e){return new kg({check:"overwrite",tx:e})}function i0(e){return Xn(t=>t.normalize(e))}function a0(){return Xn(e=>e.trim())}function l0(){return Xn(e=>e.toLowerCase())}function c0(){return Xn(e=>e.toUpperCase())}function u0(){return Xn(e=>mm(e))}function d0(e,t,n){return new e({type:"array",element:t,...be(n)})}function f0(e,t,n){return new e({type:"custom",check:"custom",fn:t,...be(n)})}function h0(e){const t=p0(n=>(n.addIssue=r=>{if(typeof r=="string")n.issues.push(Sr(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(Sr(o))}},e(n.value,n)));return t}function p0(e,t){const n=new ut({check:"custom",...be(t)});return n._zod.check=e,n}function Mu(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??gr,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 Ke(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 p=i.schema,h=t.processors[o.type];if(!h)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${o.type}`);h(e,t,p,d)}const f=e._zod.parent;f&&(i.ref||(i.ref=f),Ke(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 Du(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,p=e.external.uri??(g=>g);if(f)return{ref:p(f)};const h=i[1].defId??i[1].schema.id??`schema${e.counter++}`;return i[1].defId=h,{defId:h,ref:`${p("__shared")}#/${a}/${h}`}}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 Lu(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 p=e.seen.get(d),h=p.schema;if(h.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0")?(c.allOf=c.allOf??[],c.allOf.push(h)):Object.assign(c,h),Object.assign(c,u),i._zod.parent===d)for(const m in c)m==="$ref"||m==="allOf"||m in u||delete c[m];if(h.$ref&&p.def)for(const m in c)m==="$ref"||m==="allOf"||m in p.def&&JSON.stringify(c[m])===JSON.stringify(p.def[m])&&delete c[m]}const f=i._zod.parent;if(f&&f!==d){r(f);const p=e.seen.get(f);if(p?.schema.$ref&&(c.$ref=p.schema.$ref,p.def))for(const h in c)h==="$ref"||h==="allOf"||h in p.def&&JSON.stringify(c[h])===JSON.stringify(p.def[h])&&delete c[h]}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:go(t,"input",e.processors),output:go(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 m0=(e,t={})=>n=>{const r=Mu({...n,processors:t});return Ke(e,r),Du(r,e),Lu(r,e)},go=(e,t,n={})=>r=>{const{libraryOptions:o,target:s}=r??{},i=Mu({...o??{},target:s,io:t,processors:n});return Ke(e,i),Du(i,e),Lu(i,e)},g0={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},x0=(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=g0[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}))])}},y0=(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)},b0=(e,t,n,r)=>{n.type="boolean"},v0=(e,t,n,r)=>{t.target==="openapi-3.0"?(n.type="string",n.nullable=!0,n.enum=[null]):n.type="null"},w0=(e,t,n,r)=>{n.not={}},k0=(e,t,n,r)=>{},_0=(e,t,n,r)=>{const o=e._zod.def,s=mu(o.entries);s.every(i=>typeof i=="number")&&(n.type="number"),s.every(i=>typeof i=="string")&&(n.type="string"),n.enum=s},S0=(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},C0=(e,t,n,r)=>{if(t.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema")},j0=(e,t,n,r)=>{if(t.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema")},E0=(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=Ke(s.element,t,{...r,path:[...r.path,"items"]})},N0=(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]=Ke(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=Ke(s.catchall,t,{...r,path:[...r.path,"additionalProperties"]})):t.io==="output"&&(o.additionalProperties=!1)},T0=(e,t,n,r)=>{const o=e._zod.def,s=o.inclusive===!1,i=o.options.map((a,c)=>Ke(a,t,{...r,path:[...r.path,s?"oneOf":"anyOf",c]}));s?n.oneOf=i:n.anyOf=i},A0=(e,t,n,r)=>{const o=e._zod.def,s=Ke(o.left,t,{...r,path:[...r.path,"allOf",0]}),i=Ke(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},z0=(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=Ke(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=Ke(s.keyType,t,{...r,path:[...r.path,"propertyNames"]})),o.additionalProperties=Ke(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)}},I0=(e,t,n,r)=>{const o=e._zod.def,s=Ke(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"}]},P0=(e,t,n,r)=>{const o=e._zod.def;Ke(o.innerType,t,r);const s=t.seen.get(e);s.ref=o.innerType},R0=(e,t,n,r)=>{const o=e._zod.def;Ke(o.innerType,t,r);const s=t.seen.get(e);s.ref=o.innerType,n.default=JSON.parse(JSON.stringify(o.defaultValue))},O0=(e,t,n,r)=>{const o=e._zod.def;Ke(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)))},M0=(e,t,n,r)=>{const o=e._zod.def;Ke(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},D0=(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;Ke(s,t,r);const i=t.seen.get(e);i.ref=s},L0=(e,t,n,r)=>{const o=e._zod.def;Ke(o.innerType,t,r);const s=t.seen.get(e);s.ref=o.innerType,n.readOnly=!0},Fu=(e,t,n,r)=>{const o=e._zod.def;Ke(o.innerType,t,r);const s=t.seen.get(e);s.ref=o.innerType},F0=(e,t,n,r)=>{const o=e._zod.innerType;Ke(o,t,r);const s=t.seen.get(e);s.ref=o},$0=X("ZodISODateTime",(e,t)=>{Mg.init(e,t),qe.init(e,t)});function B0(e){return Hx($0,e)}const U0=X("ZodISODate",(e,t)=>{Dg.init(e,t),qe.init(e,t)});function V0(e){return Zx(U0,e)}const H0=X("ZodISOTime",(e,t)=>{Lg.init(e,t),qe.init(e,t)});function Z0(e){return Wx(H0,e)}const W0=X("ZodISODuration",(e,t)=>{Fg.init(e,t),qe.init(e,t)});function q0(e){return qx(W0,e)}const J0=(e,t)=>{bu.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:n=>Nm(e,n)},flatten:{value:n=>Em(e,n)},addIssue:{value:n=>{e.issues.push(n),e.message=JSON.stringify(e.issues,qs,2)}},addIssues:{value:n=>{e.issues.push(...n),e.message=JSON.stringify(e.issues,qs,2)}},isEmpty:{get(){return e.issues.length===0}}})},yt=X("ZodError",J0,{Parent:Error}),K0=Di(yt),G0=Li(yt),Y0=Fo(yt),X0=$o(yt),Q0=zm(yt),e1=Im(yt),t1=Pm(yt),n1=Rm(yt),r1=Om(yt),o1=Mm(yt),s1=Dm(yt),i1=Lm(yt),He=X("ZodType",(e,t)=>(Ve.init(e,t),Object.assign(e["~standard"],{jsonSchema:{input:go(e,"input"),output:go(e,"output")}}),e.toJSONSchema=m0(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.check=(...n)=>e.clone(an(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)=>ln(e,n,r),e.brand=()=>e,e.register=((n,r)=>(n.add(e,r),e)),e.parse=(n,r)=>K0(e,n,r,{callee:e.parse}),e.safeParse=(n,r)=>Y0(e,n,r),e.parseAsync=async(n,r)=>G0(e,n,r,{callee:e.parseAsync}),e.safeParseAsync=async(n,r)=>X0(e,n,r),e.spa=e.safeParseAsync,e.encode=(n,r)=>Q0(e,n,r),e.decode=(n,r)=>e1(e,n,r),e.encodeAsync=async(n,r)=>t1(e,n,r),e.decodeAsync=async(n,r)=>n1(e,n,r),e.safeEncode=(n,r)=>r1(e,n,r),e.safeDecode=(n,r)=>o1(e,n,r),e.safeEncodeAsync=async(n,r)=>s1(e,n,r),e.safeDecodeAsync=async(n,r)=>i1(e,n,r),e.refine=(n,r)=>e.check(ny(n,r)),e.superRefine=n=>e.check(ry(n)),e.overwrite=n=>e.check(Xn(n)),e.optional=()=>ll(e),e.exactOptional=()=>B1(e),e.nullable=()=>cl(e),e.nullish=()=>ll(cl(e)),e.nonoptional=n=>q1(e,n),e.array=()=>Ce(e),e.or=n=>Kt([e,n]),e.and=n=>O1(e,n),e.transform=n=>ul(e,F1(n)),e.default=n=>H1(e,n),e.prefault=n=>W1(e,n),e.catch=n=>K1(e,n),e.pipe=n=>ul(e,n),e.readonly=()=>X1(e),e.describe=n=>{const r=e.clone();return gr.add(r,{description:n}),r},Object.defineProperty(e,"description",{get(){return gr.get(e)?.description},configurable:!0}),e.meta=(...n)=>{if(n.length===0)return gr.get(e);const r=e.clone();return gr.add(r,n[0]),r},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e.apply=n=>n(e),e)),$u=X("_ZodString",(e,t)=>{Fi.init(e,t),He.init(e,t),e._zod.processJSONSchema=(r,o,s)=>x0(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(e0(...r)),e.includes=(...r)=>e.check(r0(...r)),e.startsWith=(...r)=>e.check(o0(...r)),e.endsWith=(...r)=>e.check(s0(...r)),e.min=(...r)=>e.check(mo(...r)),e.max=(...r)=>e.check(Ru(...r)),e.length=(...r)=>e.check(Ou(...r)),e.nonempty=(...r)=>e.check(mo(1,...r)),e.lowercase=r=>e.check(t0(r)),e.uppercase=r=>e.check(n0(r)),e.trim=()=>e.check(a0()),e.normalize=(...r)=>e.check(i0(...r)),e.toLowerCase=()=>e.check(l0()),e.toUpperCase=()=>e.check(c0()),e.slugify=()=>e.check(u0())}),a1=X("ZodString",(e,t)=>{Fi.init(e,t),$u.init(e,t),e.email=n=>e.check(_x(l1,n)),e.url=n=>e.check(Nx(c1,n)),e.jwt=n=>e.check(Vx(S1,n)),e.emoji=n=>e.check(Tx(u1,n)),e.guid=n=>e.check(nl(il,n)),e.uuid=n=>e.check(Sx(Zr,n)),e.uuidv4=n=>e.check(Cx(Zr,n)),e.uuidv6=n=>e.check(jx(Zr,n)),e.uuidv7=n=>e.check(Ex(Zr,n)),e.nanoid=n=>e.check(Ax(d1,n)),e.guid=n=>e.check(nl(il,n)),e.cuid=n=>e.check(zx(f1,n)),e.cuid2=n=>e.check(Ix(h1,n)),e.ulid=n=>e.check(Px(p1,n)),e.base64=n=>e.check($x(w1,n)),e.base64url=n=>e.check(Bx(k1,n)),e.xid=n=>e.check(Rx(m1,n)),e.ksuid=n=>e.check(Ox(g1,n)),e.ipv4=n=>e.check(Mx(x1,n)),e.ipv6=n=>e.check(Dx(y1,n)),e.cidrv4=n=>e.check(Lx(b1,n)),e.cidrv6=n=>e.check(Fx(v1,n)),e.e164=n=>e.check(Ux(_1,n)),e.datetime=n=>e.check(B0(n)),e.date=n=>e.check(V0(n)),e.time=n=>e.check(Z0(n)),e.duration=n=>e.check(q0(n))});function V(e){return kx(a1,e)}const qe=X("ZodStringFormat",(e,t)=>{Ze.init(e,t),$u.init(e,t)}),l1=X("ZodEmail",(e,t)=>{Eg.init(e,t),qe.init(e,t)}),il=X("ZodGUID",(e,t)=>{Cg.init(e,t),qe.init(e,t)}),Zr=X("ZodUUID",(e,t)=>{jg.init(e,t),qe.init(e,t)}),c1=X("ZodURL",(e,t)=>{Ng.init(e,t),qe.init(e,t)}),u1=X("ZodEmoji",(e,t)=>{Tg.init(e,t),qe.init(e,t)}),d1=X("ZodNanoID",(e,t)=>{Ag.init(e,t),qe.init(e,t)}),f1=X("ZodCUID",(e,t)=>{zg.init(e,t),qe.init(e,t)}),h1=X("ZodCUID2",(e,t)=>{Ig.init(e,t),qe.init(e,t)}),p1=X("ZodULID",(e,t)=>{Pg.init(e,t),qe.init(e,t)}),m1=X("ZodXID",(e,t)=>{Rg.init(e,t),qe.init(e,t)}),g1=X("ZodKSUID",(e,t)=>{Og.init(e,t),qe.init(e,t)}),x1=X("ZodIPv4",(e,t)=>{$g.init(e,t),qe.init(e,t)}),y1=X("ZodIPv6",(e,t)=>{Bg.init(e,t),qe.init(e,t)}),b1=X("ZodCIDRv4",(e,t)=>{Ug.init(e,t),qe.init(e,t)}),v1=X("ZodCIDRv6",(e,t)=>{Vg.init(e,t),qe.init(e,t)}),w1=X("ZodBase64",(e,t)=>{Hg.init(e,t),qe.init(e,t)}),k1=X("ZodBase64URL",(e,t)=>{Wg.init(e,t),qe.init(e,t)}),_1=X("ZodE164",(e,t)=>{qg.init(e,t),qe.init(e,t)}),S1=X("ZodJWT",(e,t)=>{Kg.init(e,t),qe.init(e,t)}),Bu=X("ZodNumber",(e,t)=>{Tu.init(e,t),He.init(e,t),e._zod.processJSONSchema=(r,o,s)=>y0(e,r,o),e.gt=(r,o)=>e.check(ol(r,o)),e.gte=(r,o)=>e.check(hs(r,o)),e.min=(r,o)=>e.check(hs(r,o)),e.lt=(r,o)=>e.check(rl(r,o)),e.lte=(r,o)=>e.check(fs(r,o)),e.max=(r,o)=>e.check(fs(r,o)),e.int=r=>e.check(al(r)),e.safe=r=>e.check(al(r)),e.positive=r=>e.check(ol(0,r)),e.nonnegative=r=>e.check(hs(0,r)),e.negative=r=>e.check(rl(0,r)),e.nonpositive=r=>e.check(fs(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 ye(e){return Jx(Bu,e)}const C1=X("ZodNumberFormat",(e,t)=>{Gg.init(e,t),Bu.init(e,t)});function al(e){return Kx(C1,e)}const j1=X("ZodBoolean",(e,t)=>{Yg.init(e,t),He.init(e,t),e._zod.processJSONSchema=(n,r,o)=>b0(e,n,r)});function nt(e){return Gx(j1,e)}const E1=X("ZodNull",(e,t)=>{Xg.init(e,t),He.init(e,t),e._zod.processJSONSchema=(n,r,o)=>v0(e,n,r)});function Ks(e){return Yx(E1,e)}const N1=X("ZodUnknown",(e,t)=>{Qg.init(e,t),He.init(e,t),e._zod.processJSONSchema=(n,r,o)=>k0()});function Gs(){return Xx(N1)}const T1=X("ZodNever",(e,t)=>{ex.init(e,t),He.init(e,t),e._zod.processJSONSchema=(n,r,o)=>w0(e,n,r)});function A1(e){return Qx(T1,e)}const z1=X("ZodArray",(e,t)=>{tx.init(e,t),He.init(e,t),e._zod.processJSONSchema=(n,r,o)=>E0(e,n,r,o),e.element=t.element,e.min=(n,r)=>e.check(mo(n,r)),e.nonempty=n=>e.check(mo(1,n)),e.max=(n,r)=>e.check(Ru(n,r)),e.length=(n,r)=>e.check(Ou(n,r)),e.unwrap=()=>e.element});function Ce(e,t){return d0(z1,e,t)}const I1=X("ZodObject",(e,t)=>{rx.init(e,t),He.init(e,t),e._zod.processJSONSchema=(n,r,o)=>N0(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:Gs()}),e.loose=()=>e.clone({...e._zod.def,catchall:Gs()}),e.strict=()=>e.clone({...e._zod.def,catchall:A1()}),e.strip=()=>e.clone({...e._zod.def,catchall:void 0}),e.extend=n=>km(e,n),e.safeExtend=n=>_m(e,n),e.merge=n=>Sm(e,n),e.pick=n=>vm(e,n),e.omit=n=>wm(e,n),e.partial=(...n)=>Cm(Vu,e,n[0]),e.required=(...n)=>jm(Hu,e,n[0])});function ae(e,t){const n={type:"object",shape:e??{},...be(t)};return new I1(n)}const Uu=X("ZodUnion",(e,t)=>{Iu.init(e,t),He.init(e,t),e._zod.processJSONSchema=(n,r,o)=>T0(e,n,r,o),e.options=t.options});function Kt(e,t){return new Uu({type:"union",options:e,...be(t)})}const P1=X("ZodDiscriminatedUnion",(e,t)=>{Uu.init(e,t),ox.init(e,t)});function Cn(e,t,n){return new P1({type:"union",options:t,discriminator:e,...be(n)})}const R1=X("ZodIntersection",(e,t)=>{sx.init(e,t),He.init(e,t),e._zod.processJSONSchema=(n,r,o)=>A0(e,n,r,o)});function O1(e,t){return new R1({type:"intersection",left:e,right:t})}const M1=X("ZodRecord",(e,t)=>{ix.init(e,t),He.init(e,t),e._zod.processJSONSchema=(n,r,o)=>z0(e,n,r,o),e.keyType=t.keyType,e.valueType=t.valueType});function Wt(e,t,n){return new M1({type:"record",keyType:e,valueType:t,...be(n)})}const Ys=X("ZodEnum",(e,t)=>{ax.init(e,t),He.init(e,t),e._zod.processJSONSchema=(r,o,s)=>_0(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 Ys({...t,checks:[],...be(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 Ys({...t,checks:[],...be(o),entries:s})}});function et(e,t){const n=Array.isArray(e)?Object.fromEntries(e.map(r=>[r,r])):e;return new Ys({type:"enum",entries:n,...be(t)})}const D1=X("ZodLiteral",(e,t)=>{lx.init(e,t),He.init(e,t),e._zod.processJSONSchema=(n,r,o)=>S0(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 D1({type:"literal",values:Array.isArray(e)?e:[e],...be(t)})}const L1=X("ZodTransform",(e,t)=>{cx.init(e,t),He.init(e,t),e._zod.processJSONSchema=(n,r,o)=>j0(e,n),e._zod.parse=(n,r)=>{if(r.direction==="backward")throw new hu(e.constructor.name);n.addIssue=s=>{if(typeof s=="string")n.issues.push(Sr(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(Sr(i))}};const o=t.transform(n.value,n);return o instanceof Promise?o.then(s=>(n.value=s,n)):(n.value=o,n)}});function F1(e){return new L1({type:"transform",transform:e})}const Vu=X("ZodOptional",(e,t)=>{Pu.init(e,t),He.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Fu(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function ll(e){return new Vu({type:"optional",innerType:e})}const $1=X("ZodExactOptional",(e,t)=>{ux.init(e,t),He.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Fu(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function B1(e){return new $1({type:"optional",innerType:e})}const U1=X("ZodNullable",(e,t)=>{dx.init(e,t),He.init(e,t),e._zod.processJSONSchema=(n,r,o)=>I0(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function cl(e){return new U1({type:"nullable",innerType:e})}const V1=X("ZodDefault",(e,t)=>{fx.init(e,t),He.init(e,t),e._zod.processJSONSchema=(n,r,o)=>R0(e,n,r,o),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function H1(e,t){return new V1({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():xu(t)}})}const Z1=X("ZodPrefault",(e,t)=>{hx.init(e,t),He.init(e,t),e._zod.processJSONSchema=(n,r,o)=>O0(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function W1(e,t){return new Z1({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():xu(t)}})}const Hu=X("ZodNonOptional",(e,t)=>{px.init(e,t),He.init(e,t),e._zod.processJSONSchema=(n,r,o)=>P0(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function q1(e,t){return new Hu({type:"nonoptional",innerType:e,...be(t)})}const J1=X("ZodCatch",(e,t)=>{mx.init(e,t),He.init(e,t),e._zod.processJSONSchema=(n,r,o)=>M0(e,n,r,o),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function K1(e,t){return new J1({type:"catch",innerType:e,catchValue:typeof t=="function"?t:()=>t})}const G1=X("ZodPipe",(e,t)=>{gx.init(e,t),He.init(e,t),e._zod.processJSONSchema=(n,r,o)=>D0(e,n,r,o),e.in=t.in,e.out=t.out});function ul(e,t){return new G1({type:"pipe",in:e,out:t})}const Y1=X("ZodReadonly",(e,t)=>{xx.init(e,t),He.init(e,t),e._zod.processJSONSchema=(n,r,o)=>L0(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function X1(e){return new Y1({type:"readonly",innerType:e})}const Q1=X("ZodLazy",(e,t)=>{yx.init(e,t),He.init(e,t),e._zod.processJSONSchema=(n,r,o)=>F0(e,n,r,o),e.unwrap=()=>e._zod.def.getter()});function ey(e){return new Q1({type:"lazy",getter:e})}const ty=X("ZodCustom",(e,t)=>{bx.init(e,t),He.init(e,t),e._zod.processJSONSchema=(n,r,o)=>C0(e,n)});function ny(e,t={}){return f0(ty,e,t)}function ry(e){return h0(e)}const qn=ey(()=>Kt([V(),ye(),nt(),Ks(),Ce(qn),Wt(V(),qn)]));function Zu(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function De(e,t){return e===null||typeof e!="object"||Array.isArray(e)?void 0:Object.getOwnPropertyDescriptor(e,t)?.value}const $i=ae({type:V(),ttl:V().optional(),scope:V().optional()}),Bi=ae({type:je("text"),text:V(),cache_control:$i.optional()}),Wu=ae({type:je("thinking"),thinking:V(),signature:V().optional()}),oy=ae({type:je("think"),thinking:V(),signature:V().optional()}),sy=ae({type:je("base64"),media_type:V(),data:V()}),qu=ae({type:je("image"),source:sy}),Ju=ae({type:je("tool_use"),id:V(),name:V(),input:Wt(V(),qn)}),iy=Cn("type",[Bi,qu]),ay=ae({type:je("tool_result"),tool_use_id:V().optional(),content:Kt([V(),Ce(iy)]),is_error:nt().optional()}),ly=Cn("type",[Bi,Wu,qu,Ju,ay]),cy=Kt([V(),Ce(ly)]),uy=ae({role:et(["user","assistant"]),content:cy}),dy=ae({type:je("text"),text:V(),cache_control:$i.optional()}),fy=ae({type:V(),properties:Wt(V(),Wt(V(),qn)).optional(),required:Ce(V()).optional(),additionalProperties:nt().optional(),$schema:V().optional()}),hy=ae({name:V(),description:V().optional(),input_schema:fy.optional(),cache_control:$i.optional()}),py=Cn("type",[ae({type:je("enabled"),budget_tokens:ye()}),ae({type:je("disabled")}),ae({type:je("adaptive")})]),Ku=ae({model:V(),messages:Ce(uy),system:Ce(dy).optional(),tools:Ce(hy).optional(),max_tokens:ye().optional(),temperature:ye().optional(),stream:nt().optional(),thinking:py.optional(),metadata:ae({user_id:V().optional()}).optional()}),Ui=Cn("type",[Bi,Wu,oy,Ju]),my=ae({input_tokens:ye().nullable().optional(),output_tokens:ye().nullable().optional(),cache_creation_input_tokens:ye().nullable().optional(),cache_read_input_tokens:ye().nullable().optional()}).passthrough(),Gu=ae({id:V(),type:je("message"),model:V(),role:je("assistant"),content:Ce(Ui),stop_reason:V().nullable(),stop_sequence:V().nullable().optional(),usage:my}).passthrough(),gy=ae({type:je("message_start"),message:ae({id:V(),type:je("message"),model:V(),role:je("assistant"),content:Ce(Ui),stop_reason:Ks(),stop_sequence:Ks(),usage:ae({input_tokens:ye(),cache_creation_input_tokens:ye().optional(),cache_read_input_tokens:ye().optional()}).passthrough()})}),xy=ae({type:je("content_block_start"),index:ye(),content_block:Ui}),yy=Cn("type",[ae({type:je("text_delta"),text:V()}),ae({type:je("input_json_delta"),partial_json:V()}),ae({type:je("thinking_delta"),thinking:V()}),ae({type:je("signature_delta"),signature:V()})]),by=ae({type:je("content_block_delta"),index:ye(),delta:yy}),vy=ae({type:je("content_block_stop"),index:ye()}),wy=ae({type:je("message_delta"),delta:ae({stop_reason:V().nullable(),stop_sequence:V().nullable().optional()}),usage:ae({output_tokens:ye(),input_tokens:ye().optional(),cache_creation_input_tokens:ye().optional(),cache_read_input_tokens:ye().optional()}).passthrough()}),ky=ae({type:je("message_stop")}),_y=ae({type:je("ping")}),Sy=ae({type:je("error"),error:ae({type:V(),message:V()})}),Cy=Cn("type",[gy,xy,by,vy,wy,ky,_y,Sy]),jy=Kt([V(),Ce(Cn("type",[ae({type:je("text"),text:V()}),ae({type:je("image_url"),image_url:ae({url:V(),detail:V().optional()})})]))]),Yu=ae({role:et(["system","user","assistant","tool"]),content:jy,name:V().optional(),reasoning_content:V().optional(),thinking:V().optional(),think:V().optional()}),Ey=ae({name:V(),arguments:V()}),Xu=ae({index:ye().optional(),id:V().optional(),type:je("function").optional(),function:ae({name:V().optional(),arguments:V().optional()})});Yu.extend({content:Kt([V(),Ce(ae({type:je("text"),text:V()}))]).optional(),function_call:Ey.optional(),tool_calls:Ce(Xu).optional()});const Ny=ae({type:je("function"),function:ae({name:V(),description:V().optional(),parameters:Wt(V(),qn)})}),Qu=ae({model:V(),messages:Ce(Yu),temperature:ye().optional(),max_tokens:ye().optional(),stream:nt().optional(),tools:Ce(Ny).optional(),tool_choice:Kt([et(["auto","none","required"]),ae({type:je("auto")}),ae({type:je("none")}),ae({type:je("function"),function:ae({name:V()})})]).optional(),user:V().optional()}),ed=ae({role:et(["assistant"]).optional(),content:V().nullable().optional(),reasoning_content:V().nullable().optional(),thinking:V().nullable().optional(),think:V().nullable().optional(),function_call:ae({name:V().optional(),arguments:V().optional()}).nullable().optional(),tool_calls:Ce(ae({index:ye(),id:V().optional(),type:je("function").optional(),function:ae({name:V().optional(),arguments:V().optional()})})).nullable().optional()}),Ty=ae({index:ye(),message:ae({role:et(["assistant"]),content:V().nullable(),reasoning_content:V().optional(),thinking:V().optional(),think:V().optional(),function_call:ae({name:V(),arguments:V()}).nullable().optional(),tool_calls:Ce(Xu).optional()}).optional(),delta:ed.optional(),finish_reason:V().nullable()}),Ay=ae({id:V(),object:je("chat.completion"),created:ye(),model:V(),choices:Ce(Ty),usage:ae({prompt_tokens:ye().nullable().optional(),completion_tokens:ye().nullable().optional(),total_tokens:ye().nullable().optional()}).passthrough(),service_tier:V().nullable().optional(),system_fingerprint:V().nullable().optional()}).passthrough(),zy=ae({id:V(),object:je("chat.completion.chunk"),created:ye(),model:V(),choices:Ce(ae({index:ye(),delta:ed,finish_reason:V().nullable().optional()})),usage:ae({prompt_tokens:ye().nullable().optional(),completion_tokens:ye().nullable().optional(),total_tokens:ye().nullable().optional()}).passthrough().nullable().optional()}).passthrough();function td(e){try{const t=JSON.parse(e),n=Ay.safeParse(t);return n.success?n.data:null}catch{return null}}const nd=ae({index:ye(),timestamp:ye(),type:V(),data:qn}),Iy=ae({chunks:Ce(nd),truncated:nt().optional().default(!1)}),dl=ae({id:ye(),timestamp:V(),method:V(),path:V(),model:V().nullable(),sessionId:V().nullable(),rawRequestBody:V().nullable(),responseStatus:ye().nullable(),responseText:V().nullable(),inputTokens:ye().nullable(),outputTokens:ye().nullable(),cacheCreationInputTokens:ye().nullable(),cacheReadInputTokens:ye().nullable(),elapsedMs:ye().nullable(),streaming:nt(),userAgent:V().nullable(),origin:V().nullable(),rawHeaders:Wt(V(),V()).optional(),headers:Wt(V(),V()).optional(),apiFormat:et(["anthropic","openai","unknown"]).default("unknown"),isTest:nt().optional().default(!1),providerName:V().nullable().optional(),clientPort:ye().nullable().optional(),clientPid:ye().nullable().optional(),clientCwd:V().nullable().optional(),clientProjectFolder:V().nullable().optional(),streamingChunks:Iy.optional(),streamingChunksPath:V().nullable().optional(),error:V().nullable().optional()});ae({model:V()});ae({model:V().optional(),metadata:ae({user_id:V().optional()}).passthrough().optional()});const Py=ae({error:V()});async function Zt(e,t){const n=await e.json();return t.parse(n)}async function gn(e,t){try{const n=await e.json(),r=Py.safeParse(n);return r.success?r.data.error:t}catch{return t}}async function Pr(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 gn(o,s))}return Zt(o,t)}const xo=10,Xs=600,yo="time",rd=et(["time","full"]),Uo=ae({stripClaudeCodeBillingHeader:nt(),hasSeenOnboarding:nt().default(!1),slowResponseThresholdSeconds:ye().int().min(0).max(Xs).default(xo),timeDisplayFormat:rd.default(yo)}),xr="/api/config";async function Ry(e){return Pr(e,Uo,void 0,t=>`Failed to fetch ${e}: ${t.status}`)}async function ps(e){return Pr(xr,Uo,{method:"PATCH",headers:{"content-type":"application/json"},body:JSON.stringify(e)},t=>`PATCH failed with status ${t.status}`)}function od(){const e=Ii(xr,Ry,{revalidateOnFocus:!1,revalidateIfStale:!1}),{mutate:t}=du(),n=e.data?.stripClaudeCodeBillingHeader??!1,r=e.data?.slowResponseThresholdSeconds??xo,o=e.data?.timeDisplayFormat??yo,s=u=>({stripClaudeCodeBillingHeader:e.data?.stripClaudeCodeBillingHeader??!1,hasSeenOnboarding:e.data?.hasSeenOnboarding??!1,slowResponseThresholdSeconds:e.data?.slowResponseThresholdSeconds??xo,timeDisplayFormat:e.data?.timeDisplayFormat??yo,...u}),i=async u=>{await t(xr,ps({stripClaudeCodeBillingHeader:u}),{optimisticData:s({stripClaudeCodeBillingHeader:u}),rollbackOnError:!0,revalidate:!1})},a=async u=>{await t(xr,ps({slowResponseThresholdSeconds:u}),{optimisticData:s({slowResponseThresholdSeconds:u}),rollbackOnError:!0,revalidate:!1})},c=async u=>{await t(xr,ps({timeDisplayFormat:u}),{optimisticData:s({timeDisplayFormat:u}),rollbackOnError:!0,revalidate:!1})};return{strip:n,slowResponseThresholdSeconds:r,timeDisplayFormat:o,isLoading:e.isLoading,isError:e.error!==void 0,setStrip:i,setSlowResponseThresholdSeconds:a,setTimeDisplayFormat:c}}const sd=(...e)=>e.filter((t,n,r)=>!!t&&t.trim()!==""&&r.indexOf(t)===n).join(" ").trim();const Oy=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();const My=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(t,n,r)=>r?r.toUpperCase():n.toLowerCase());const fl=e=>{const t=My(e);return t.charAt(0).toUpperCase()+t.slice(1)};var Dy={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 Ly=e=>{for(const t in e)if(t.startsWith("aria-")||t==="role"||t==="title")return!0;return!1};const Fy=y.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:n=2,absoluteStrokeWidth:r,className:o="",children:s,iconNode:i,...a},c)=>y.createElement("svg",{ref:c,...Dy,width:t,height:t,stroke:e,strokeWidth:r?Number(n)*24/Number(t):n,className:sd("lucide",o),...!s&&!Ly(a)&&{"aria-hidden":"true"},...a},[...i.map(([u,d])=>y.createElement(u,d)),...Array.isArray(s)?s:[s]]));const xe=(e,t)=>{const n=y.forwardRef(({className:r,...o},s)=>y.createElement(Fy,{ref:s,iconNode:t,className:sd(`lucide-${Oy(fl(e))}`,`lucide-${e}`,r),...o}));return n.displayName=fl(e),n};const $y=[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]],By=xe("arrow-down",$y);const Uy=[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]],Vy=xe("arrow-left",Uy);const Hy=[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]],Zy=xe("arrow-up",Hy);const Wy=[["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"}]],qy=xe("blocks",Wy);const Jy=[["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"}]],id=xe("brain",Jy);const Ky=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],ct=xe("check",Ky);const Gy=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],Gt=xe("chevron-down",Gy);const Yy=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],cn=xe("chevron-right",Yy);const Xy=[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]],Qy=xe("chevron-up",Xy);const eb=[["path",{d:"m7 6 5 5 5-5",key:"1lc07p"}],["path",{d:"m7 13 5 5 5-5",key:"1d48rs"}]],ad=xe("chevrons-down",eb);const tb=[["path",{d:"m17 11-5-5-5 5",key:"e8nh98"}],["path",{d:"m17 18-5-5-5 5",key:"2avn1x"}]],nb=xe("chevrons-up",tb);const rb=[["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"}]],Cr=xe("circle-alert",rb);const ob=[["path",{d:"M21.801 10A10 10 0 1 1 17 3.335",key:"yps3ct"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]],sb=xe("circle-check-big",ob);const ib=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],hl=xe("circle-check",ib);const ab=[["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"}]],lb=xe("circle-question-mark",ab);const cb=[["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"}]],ld=xe("circle-x",cb);const ub=[["path",{d:"M12 6v6l4 2",key:"mmk7yg"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],rn=xe("clock",ub);const db=[["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"}]],fb=xe("cloud-upload",db);const hb=[["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"}]],pb=xe("code-xml",hb);const mb=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M12 3v18",key:"108xh3"}]],gb=xe("columns-2",mb);const xb=[["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=xe("copy",xb);const yb=[["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"}]],Vi=xe("download",yb);const bb=[["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"}]],vb=xe("ellipsis",bb);const wb=[["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"}]],cd=xe("external-link",wb);const kb=[["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"}]],Hi=xe("eye-off",kb);const _b=[["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"}]],Zi=xe("eye",_b);const Sb=[["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"}]],Cb=xe("file-diff",Sb);const jb=[["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"}]],Eb=xe("file-search",jb);const Nb=[["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"}]],Tb=xe("file-terminal",Nb);const Ab=[["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"}]],zb=xe("file-text",Ab);const Ib=[["path",{d:"m12 14 4-4",key:"9kzdfg"}],["path",{d:"M3.34 19a10 10 0 1 1 17.32 0",key:"19p75a"}]],Pb=xe("gauge",Ib);const Rb=[["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"}]],Ob=xe("git-compare-arrows",Rb);const Mb=[["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"}]],ud=xe("globe",Mb);const Db=[["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"}]],Lb=xe("history",Db);const Fb=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],jr=xe("loader-circle",Fb);const $b=[["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"}]],Bb=xe("lock",$b);const Ub=[["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"}]],Vo=xe("message-square",Ub);const Vb=[["path",{d:"M5 12h14",key:"1ays0h"}]],Hb=xe("minus",Vb);const Zb=[["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"}]],Wb=xe("mouse-pointer-click",Zb);const qb=[["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"}]],Jb=xe("octagon-alert",qb);const Kb=[["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"}]],dd=xe("pencil",Kb);const Gb=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],Qs=xe("plus",Gb);const Yb=[["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"}]],Xb=xe("radio",Yb);const Qb=[["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"}]],pl=xe("refresh-cw",Qb);const ev=[["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"}]],tv=xe("rotate-ccw",ev);const nv=[["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"}]],ei=xe("rotate-cw",nv);const rv=[["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"}]],ov=xe("rows-3",rv);const sv=[["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"}]],iv=xe("save",sv);const av=[["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"}]],lv=xe("scan",av);const cv=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],uv=xe("search",cv);const dv=[["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"}]],fv=xe("server",dv);const hv=[["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"}]],pv=xe("settings",hv);const mv=[["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"}]],ml=xe("shield-check",mv);const gv=[["path",{d:"M12 19h8",key:"baeox8"}],["path",{d:"m4 17 6-6-6-6",key:"1yngyt"}]],fd=xe("terminal",gv);const xv=[["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"}]],hd=xe("trash-2",xv);const yv=[["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"}]],bo=xe("triangle-alert",yv);const bv=[["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"}]],vv=xe("upload",bv);const wv=[["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"}]],kv=xe("user",wv);const _v=[["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"}]],Sv=xe("wifi-off",_v);const Cv=[["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"}]],jv=xe("wifi",Cv);const Ev=[["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"}]],Rr=xe("wrench",Ev);const Nv=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],Wi=xe("x",Nv);const Tv=[["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"}]],Er=xe("zap",Tv),ti="/api/config";async function Av(e){return Pr(e,Uo,void 0,t=>`Failed to fetch ${e}: ${t.status}`)}async function zv(e){return Pr(ti,Uo,{method:"PATCH",headers:{"content-type":"application/json"},body:JSON.stringify(e)},t=>`PATCH failed with status ${t.status}`)}function Iv(){const e=Ii(ti,Av,{revalidateOnFocus:!1,revalidateIfStale:!1}),{mutate:t}=du(),n=e.data?.hasSeenOnboarding??!1,r=async()=>{await t(ti,zv({hasSeenOnboarding:!0}),{optimisticData:{stripClaudeCodeBillingHeader:e.data?.stripClaudeCodeBillingHeader??!1,hasSeenOnboarding:!0,slowResponseThresholdSeconds:e.data?.slowResponseThresholdSeconds??xo,timeDisplayFormat:e.data?.timeDisplayFormat??yo},rollbackOnError:!0,revalidate:!1})};return{hasSeenOnboarding:n,isLoading:e.isLoading,markSeen:r}}function Pv(){const{hasSeenOnboarding:e,isLoading:t,markSeen:n}=Iv();return t||e?null: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:"Agent Inspector is ready"}),l.jsxs("ul",{className:"space-y-0.5 text-xs leading-relaxed text-muted-foreground",children:[l.jsxs("li",{children:[l.jsx("strong",{children:"Trace"}),": requests, responses, streaming chunks, tools, and timing."]}),l.jsxs("li",{children:[l.jsx("strong",{children:"Replay"}),": resend captured requests and compare provider behavior."]}),l.jsxs("li",{children:[l.jsx("strong",{children:"Memory"}),": create reviewable candidates before promotion to OpenClaw."]})]})]}),l.jsxs("button",{type:"button",onClick:()=>{n()},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:()=>{n()},className:"-m-1 shrink-0 p-1 text-muted-foreground transition-colors hover:text-foreground","aria-label":"Dismiss",children:l.jsx(Wi,{className:"size-3.5"})})]})}function Wr(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 ms={exports:{}};var gl;function Rv(){return gl||(gl=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 Wr=="function"&&Wr;if(!d&&f)return f(u,!0);if(a)return a(u,!0);var p=new Error("Cannot find module '"+u+"'");throw p.code="MODULE_NOT_FOUND",p}var h=o[u]={exports:{}};r[u][0].call(h.exports,function(g){var m=r[u][1][g];return i(m||g)},h,h.exports,n,r,o,s)}return o[u].exports}for(var a=typeof Wr=="function"&&Wr,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,p,h,g,m,x=[],b=0,v=c.length,k=v,S=s.getTypeOf(c)!=="string";b<c.length;)k=v-b,f=S?(u=c[b++],d=b<v?c[b++]:0,b<v?c[b++]:0):(u=c.charCodeAt(b++),d=b<v?c.charCodeAt(b++):0,b<v?c.charCodeAt(b++):0),p=u>>2,h=(3&u)<<4|d>>4,g=1<k?(15&d)<<2|f>>6:64,m=2<k?63&f:64,x.push(a.charAt(p)+a.charAt(h)+a.charAt(g)+a.charAt(m));return x.join("")},o.decode=function(c){var u,d,f,p,h,g,m=0,x=0,b="data:";if(c.substr(0,b.length)===b)throw new Error("Invalid base64 input, it looks like a data url.");var v,k=3*(c=c.replace(/[^A-Za-z0-9+/=]/g,"")).length/4;if(c.charAt(c.length-1)===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|(p=a.indexOf(c.charAt(m++)))>>4,d=(15&p)<<4|(h=a.indexOf(c.charAt(m++)))>>2,f=(3&h)<<6|(g=a.indexOf(c.charAt(m++))),v[x++]=u,h!==64&&(v[x++]=d),g!==64&&(v[x++]=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,p,h,g){this.compressedSize=d,this.uncompressedSize=f,this.crc32=p,this.compression=h,this.compressedContent=g}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,p){return d.pipe(new a).pipe(new c("uncompressedSize")).pipe(f.compressWorker(p)).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,p){var h=i,g=p+f;u^=-1;for(var m=p;m<g;m++)u=u>>>8^h[255&(u^d[m])];return-1^u})(0|c,a,a.length,0):(function(u,d,f,p){var h=i,g=p+f;u^=-1;for(var m=p;m<g;m++)u=u>>>8^h[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,p){c.call(this,"FlateWorker/"+f),this._pako=null,this._pakoAction=f,this._pakoOptions=p,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(p){f.push({data:p,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(h,g){var m,x="";for(m=0;m<g;m++)x+=String.fromCharCode(255&h),h>>>=8;return x}function i(h,g,m,x,b,v){var k,S,C=h.file,E=h.compression,N=v!==u.utf8encode,z=a.transformTo("string",v(C.name)),T=a.transformTo("string",u.utf8encode(C.name)),R=C.comment,$=a.transformTo("string",v(R)),j=a.transformTo("string",u.utf8encode(R)),D=T.length!==C.name.length,w=j.length!==R.length,M="",U="",L="",F=C.dir,q=C.date,A={crc32:0,compressedSize:0,uncompressedSize:0};g&&!m||(A.crc32=h.crc32,A.compressedSize=h.compressedSize,A.uncompressedSize=h.uncompressedSize);var Z=0;g&&(Z|=8),N||!D&&!w||(Z|=2048);var W=0,I=0;F&&(W|=16),b==="UNIX"?(I=798,W|=(function(ee,pe){var le=ee;return ee||(le=pe?16893:33204),(65535&le)<<16})(C.unixPermissions,F)):(I=20,W|=(function(ee){return 63&(ee||0)})(C.dosPermissions)),k=q.getUTCHours(),k<<=6,k|=q.getUTCMinutes(),k<<=5,k|=q.getUTCSeconds()/2,S=q.getUTCFullYear()-1980,S<<=4,S|=q.getUTCMonth()+1,S<<=5,S|=q.getUTCDate(),D&&(U=s(1,1)+s(d(z),4)+T,M+="up"+s(U.length,2)+U),w&&(L=s(1,1)+s(d($),4)+j,M+="uc"+s(L.length,2)+L);var se="";return se+=`
|
|
41
|
-
\0`,se+=s(Z,2),se+=E.magic,se+=s(k,2),se+=s(S,2),se+=s(A.crc32,4),se+=s(A.compressedSize,4),se+=s(A.uncompressedSize,4),se+=s(z.length,2),se+=s(M.length,2),{fileRecord:f.LOCAL_FILE_HEADER+se+z+M,dirRecord:f.CENTRAL_FILE_HEADER+s(I,2)+se+s($.length,2)+"\0\0\0\0"+s(W,4)+s(x,4)+z+M+$}}var a=n("../utils"),c=n("../stream/GenericWorker"),u=n("../utf8"),d=n("../crc32"),f=n("../signature");function p(h,g,m,x){c.call(this,"ZipFileWorker"),this.bytesWritten=0,this.zipComment=g,this.zipPlatform=m,this.encodeFileName=x,this.streamFiles=h,this.accumulate=!1,this.contentBuffer=[],this.dirRecords=[],this.currentSourceOffset=0,this.entriesCount=0,this.currentFile=null,this._sources=[]}a.inherits(p,c),p.prototype.push=function(h){var g=h.meta.percent||0,m=this.entriesCount,x=this._sources.length;this.accumulate?this.contentBuffer.push(h):(this.bytesWritten+=h.data.length,c.prototype.push.call(this,{data:h.data,meta:{currentFile:this.currentFile,percent:m?(g+100*(m-x-1))/m:100}}))},p.prototype.openedSource=function(h){this.currentSourceOffset=this.bytesWritten,this.currentFile=h.file.name;var g=this.streamFiles&&!h.file.dir;if(g){var m=i(h,g,!1,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);this.push({data:m.fileRecord,meta:{percent:0}})}else this.accumulate=!0},p.prototype.closedSource=function(h){this.accumulate=!1;var g=this.streamFiles&&!h.file.dir,m=i(h,g,!0,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);if(this.dirRecords.push(m.dirRecord),g)this.push({data:(function(x){return f.DATA_DESCRIPTOR+s(x.crc32,4)+s(x.compressedSize,4)+s(x.uncompressedSize,4)})(h),meta:{percent:100}});else for(this.push({data:m.fileRecord,meta:{percent:0}});this.contentBuffer.length;)this.push(this.contentBuffer.shift());this.currentFile=null},p.prototype.flush=function(){for(var h=this.bytesWritten,g=0;g<this.dirRecords.length;g++)this.push({data:this.dirRecords[g],meta:{percent:100}});var m=this.bytesWritten-h,x=(function(b,v,k,S,C){var E=a.transformTo("string",C(S));return f.CENTRAL_DIRECTORY_END+"\0\0\0\0"+s(b,2)+s(b,2)+s(v,4)+s(k,4)+s(E.length,2)+E})(this.dirRecords.length,m,h,this.zipComment,this.encodeFileName);this.push({data:x,meta:{percent:100}})},p.prototype.prepareNextSource=function(){this.previous=this._sources.shift(),this.openedSource(this.previous.streamInfo),this.isPaused?this.previous.pause():this.previous.resume()},p.prototype.registerPrevious=function(h){this._sources.push(h);var g=this;return h.on("data",function(m){g.processChunk(m)}),h.on("end",function(){g.closedSource(g.previous.streamInfo),g._sources.length?g.prepareNextSource():g.end()}),h.on("error",function(m){g.error(m)}),this},p.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))},p.prototype.error=function(h){var g=this._sources;if(!c.prototype.error.call(this,h))return!1;for(var m=0;m<g.length;m++)try{g[m].error(h)}catch{}return!0},p.prototype.lock=function(){c.prototype.lock.call(this);for(var h=this._sources,g=0;g<h.length;g++)h[g].lock()},r.exports=p},{"../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(p,h){f++;var g=(function(v,k){var S=v||k,C=s[S];if(!C)throw new Error(S+" is not a valid compression method !");return C})(h.options.compression,c.compression),m=h.options.compressionOptions||c.compressionOptions||{},x=h.dir,b=h.date;h._compressWorker(g,m).withStreamInfo("file",{name:p,dir:x,date:b,comment:h.comment||"",unixPermissions:h.unixPermissions,dosPermissions:h.dosPermissions}).pipe(d)}),d.entriesCount=f}catch(p){d.error(p)}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(p){return new i.Promise(function(h,g){var m=p.decompressed.getContentWorker().pipe(new u);m.on("error",function(x){g(x)}).on("end",function(){m.streamInfo.crc32!==p.decompressed.crc32?g(new Error("Corrupted zip : CRC32 mismatch")):h()}).resume()})}r.exports=function(p,h){var g=this;return h=s.extend(h||{},{base64:!1,checkCRC32:!1,optimizedBinaryString:!1,createFolders:!1,decodeFileName:a.utf8decode}),d.isNode&&d.isStream(p)?i.Promise.reject(new Error("JSZip can't accept a stream when loading a zip file.")):s.prepareContent("the loaded zip file",p,!0,h.optimizedBinaryString,h.base64).then(function(m){var x=new c(h);return x.load(m),x}).then(function(m){var x=[i.Promise.resolve(m)],b=m.files;if(h.checkCRC32)for(var v=0;v<b.length;v++)x.push(f(b[v]));return i.Promise.all(x)}).then(function(m){for(var x=m.shift(),b=x.files,v=0;v<b.length;v++){var k=b[v],S=k.fileNameStr,C=s.resolve(k.fileNameStr);g.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:h.createFolders}),k.dir||(g.file(C).unsafeOriginalName=S)}return x.zipComment.length&&(g.comment=x.zipComment),g})}},{"./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,p){d.push(f)||d._helper.pause(),u&&u(p)}).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,E,N){var z,T=a.getTypeOf(E),R=a.extend(N||{},d);R.date=R.date||new Date,R.compression!==null&&(R.compression=R.compression.toUpperCase()),typeof R.unixPermissions=="string"&&(R.unixPermissions=parseInt(R.unixPermissions,8)),R.unixPermissions&&16384&R.unixPermissions&&(R.dir=!0),R.dosPermissions&&16&R.dosPermissions&&(R.dir=!0),R.dir&&(C=b(C)),R.createFolders&&(z=x(C))&&v.call(this,z,!0);var $=T==="string"&&R.binary===!1&&R.base64===!1;N&&N.binary!==void 0||(R.binary=!$),(E instanceof f&&E.uncompressedSize===0||R.dir||!E||E.length===0)&&(R.base64=!1,R.binary=!0,E="",R.compression="STORE",T="string");var j=null;j=E instanceof f||E instanceof c?E:g.isNode&&g.isStream(E)?new m(C,E):a.prepareContent(C,E,R.binary,R.optimizedBinaryString,R.base64);var D=new p(C,j,R);this.files[C]=D}var i=n("./utf8"),a=n("./utils"),c=n("./stream/GenericWorker"),u=n("./stream/StreamHelper"),d=n("./defaults"),f=n("./compressedObject"),p=n("./zipObject"),h=n("./generate"),g=n("./nodejsUtils"),m=n("./nodejs/NodejsStreamInputAdapter"),x=function(C){C.slice(-1)==="/"&&(C=C.substring(0,C.length-1));var E=C.lastIndexOf("/");return 0<E?C.substring(0,E):""},b=function(C){return C.slice(-1)!=="/"&&(C+="/"),C},v=function(C,E){return E=E!==void 0?E:d.createFolders,C=b(C),this.files[C]||s.call(this,C,null,{dir:!0,createFolders:E}),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 E,N,z;for(E in this.files)z=this.files[E],(N=E.slice(this.root.length,E.length))&&E.slice(0,this.root.length)===this.root&&C(N,z)},filter:function(C){var E=[];return this.forEach(function(N,z){C(N,z)&&E.push(z)}),E},file:function(C,E,N){if(arguments.length!==1)return C=this.root+C,s.call(this,C,E,N),this;if(k(C)){var z=C;return this.filter(function(R,$){return!$.dir&&z.test(R)})}var T=this.files[this.root+C];return T&&!T.dir?T:null},folder:function(C){if(!C)return this;if(k(C))return this.filter(function(T,R){return R.dir&&C.test(T)});var E=this.root+C,N=v.call(this,E),z=this.clone();return z.root=N.name,z},remove:function(C){C=this.root+C;var E=this.files[C];if(E||(C.slice(-1)!=="/"&&(C+="/"),E=this.files[C]),E&&!E.dir)delete this.files[C];else for(var N=this.filter(function(T,R){return R.name.slice(0,C.length)===C}),z=0;z<N.length;z++)delete this.files[N[z].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 E,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 z=N.comment||this.comment||"";E=h.generateWorker(this,N,z)}catch(T){(E=new c("error")).error(T)}return new u(E,N.type||"string",N.mimeType)},generateAsync:function(C,E){return this.generateInternalStream(C).accumulate(E)},generateNodeStream:function(C,E){return(C=C||{}).type||(C.type="nodebuffer"),this.generateInternalStream(C).toNodejsStream(E)}};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),p=this.length-4;0<=p;--p)if(this.data[p]===c&&this.data[p+1]===u&&this.data[p+2]===d&&this.data[p+3]===f)return p-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),p=this.readData(4);return c===p[0]&&u===p[1]&&d===p[2]&&f===p[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 p=s.getTypeOf(f);return s.checkSupport(p),p!=="string"||i.uint8array?p==="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 p(g,m){return new d.Promise(function(x,b){var v=[],k=g._internalType,S=g._outputType,C=g._mimeType;g.on("data",function(E,N){v.push(E),m&&m(N)}).on("error",function(E){v=[],b(E)}).on("end",function(){try{var E=(function(N,z,T){switch(N){case"blob":return s.newBlob(s.transformTo("arraybuffer",z),T);case"base64":return c.encode(z);default:return s.transformTo(N,z)}})(S,(function(N,z){var T,R=0,$=null,j=0;for(T=0;T<z.length;T++)j+=z[T].length;switch(N){case"string":return z.join("");case"array":return Array.prototype.concat.apply([],z);case"uint8array":for($=new Uint8Array(j),T=0;T<z.length;T++)$.set(z[T],R),R+=z[T].length;return $;case"nodebuffer":return Buffer.concat(z);default:throw new Error("concat : unsupported type '"+N+"'")}})(k,v),C);x(E)}catch(N){b(N)}v=[]}).resume()})}function h(g,m,x){var b=m;switch(m){case"blob":case"arraybuffer":b="uint8array";break;case"base64":b="string"}try{this._internalType=b,this._outputType=m,this._mimeType=x,s.checkSupport(b),this._worker=g.pipe(new i(b)),g.lock()}catch(v){this._worker=new a("error"),this._worker.error(v)}}h.prototype={accumulate:function(g){return p(this,g)},on:function(g,m){var x=this;return g==="data"?this._worker.on(g,function(b){m.call(x,b.data,b.meta)}):this._worker.on(g,function(){s.delay(m,arguments,x)}),this},resume:function(){return s.delay(this._worker.resume,[],this._worker),this},pause:function(){return this._worker.pause(),this},toNodejsStream:function(g){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"},g)}},r.exports=h},{"../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 p(){c.call(this,"utf-8 encode")}o.utf8encode=function(h){return i.nodebuffer?a.newBufferFrom(h,"utf-8"):(function(g){var m,x,b,v,k,S=g.length,C=0;for(v=0;v<S;v++)(64512&(x=g.charCodeAt(v)))==55296&&v+1<S&&(64512&(b=g.charCodeAt(v+1)))==56320&&(x=65536+(x-55296<<10)+(b-56320),v++),C+=x<128?1:x<2048?2:x<65536?3:4;for(m=i.uint8array?new Uint8Array(C):new Array(C),v=k=0;k<C;v++)(64512&(x=g.charCodeAt(v)))==55296&&v+1<S&&(64512&(b=g.charCodeAt(v+1)))==56320&&(x=65536+(x-55296<<10)+(b-56320),v++),x<128?m[k++]=x:(x<2048?m[k++]=192|x>>>6:(x<65536?m[k++]=224|x>>>12:(m[k++]=240|x>>>18,m[k++]=128|x>>>12&63),m[k++]=128|x>>>6&63),m[k++]=128|63&x);return m})(h)},o.utf8decode=function(h){return i.nodebuffer?s.transformTo("nodebuffer",h).toString("utf-8"):(function(g){var m,x,b,v,k=g.length,S=new Array(2*k);for(m=x=0;m<k;)if((b=g[m++])<128)S[x++]=b;else if(4<(v=u[b]))S[x++]=65533,m+=v-1;else{for(b&=v===2?31:v===3?15:7;1<v&&m<k;)b=b<<6|63&g[m++],v--;1<v?S[x++]=65533:b<65536?S[x++]=b:(b-=65536,S[x++]=55296|b>>10&1023,S[x++]=56320|1023&b)}return S.length!==x&&(S.subarray?S=S.subarray(0,x):S.length=x),s.applyFromCharCode(S)})(h=s.transformTo(i.uint8array?"uint8array":"array",h))},s.inherits(f,c),f.prototype.processChunk=function(h){var g=s.transformTo(i.uint8array?"uint8array":"array",h.data);if(this.leftOver&&this.leftOver.length){if(i.uint8array){var m=g;(g=new Uint8Array(m.length+this.leftOver.length)).set(this.leftOver,0),g.set(m,this.leftOver.length)}else g=this.leftOver.concat(g);this.leftOver=null}var x=(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})(g),b=g;x!==g.length&&(i.uint8array?(b=g.subarray(0,x),this.leftOver=g.subarray(x,g.length)):(b=g.slice(0,x),this.leftOver=g.slice(x,g.length))),this.push({data:o.utf8decode(b),meta:h.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(p,c),p.prototype.processChunk=function(h){this.push({data:o.utf8encode(h.data),meta:h.meta})},o.Utf8EncodeWorker=p},{"./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,x){for(var b=0;b<m.length;++b)x[b]=255&m.charCodeAt(b);return x}n("setimmediate"),o.newBlob=function(m,x){o.checkSupport("blob");try{return new Blob([m],{type:x})}catch{try{var b=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);return b.append(m),b.getBlob(x)}catch{throw new Error("Bug : can't construct the Blob.")}}};var f={stringifyByChunk:function(m,x,b){var v=[],k=0,S=m.length;if(S<=b)return String.fromCharCode.apply(null,m);for(;k<S;)x==="array"||x==="nodebuffer"?v.push(String.fromCharCode.apply(null,m.slice(k,Math.min(k+b,S)))):v.push(String.fromCharCode.apply(null,m.subarray(k,Math.min(k+b,S)))),k+=b;return v.join("")},stringifyByChar:function(m){for(var x="",b=0;b<m.length;b++)x+=String.fromCharCode(m[b]);return x},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 p(m){var x=65536,b=o.getTypeOf(m),v=!0;if(b==="uint8array"?v=f.applyCanBeUsed.uint8array:b==="nodebuffer"&&(v=f.applyCanBeUsed.nodebuffer),v)for(;1<x;)try{return f.stringifyByChunk(m,b,x)}catch{x=Math.floor(x/2)}return f.stringifyByChar(m)}function h(m,x){for(var b=0;b<m.length;b++)x[b]=m[b];return x}o.applyFromCharCode=p;var g={};g.string={string:u,array:function(m){return d(m,new Array(m.length))},arraybuffer:function(m){return g.string.uint8array(m).buffer},uint8array:function(m){return d(m,new Uint8Array(m.length))},nodebuffer:function(m){return d(m,a.allocBuffer(m.length))}},g.array={string:p,array:u,arraybuffer:function(m){return new Uint8Array(m).buffer},uint8array:function(m){return new Uint8Array(m)},nodebuffer:function(m){return a.newBufferFrom(m)}},g.arraybuffer={string:function(m){return p(new Uint8Array(m))},array:function(m){return h(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))}},g.uint8array={string:p,array:function(m){return h(m,new Array(m.length))},arraybuffer:function(m){return m.buffer},uint8array:u,nodebuffer:function(m){return a.newBufferFrom(m)}},g.nodebuffer={string:p,array:function(m){return h(m,new Array(m.length))},arraybuffer:function(m){return g.nodebuffer.uint8array(m).buffer},uint8array:function(m){return h(m,new Uint8Array(m.length))},nodebuffer:u},o.transformTo=function(m,x){if(x=x||"",!m)return x;o.checkSupport(m);var b=o.getTypeOf(x);return g[b][m](x)},o.resolve=function(m){for(var x=m.split("/"),b=[],v=0;v<x.length;v++){var k=x[v];k==="."||k===""&&v!==0&&v!==x.length-1||(k===".."?b.pop():b.push(k))}return b.join("/")},o.getTypeOf=function(m){return typeof m=="string"?"string":Object.prototype.toString.call(m)==="[object Array]"?"array":s.nodebuffer&&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 x,b,v="";for(b=0;b<(m||"").length;b++)v+="\\x"+((x=m.charCodeAt(b))<16?"0":"")+x.toString(16).toUpperCase();return v},o.delay=function(m,x,b){setImmediate(function(){m.apply(b||null,x||[])})},o.inherits=function(m,x){function b(){}b.prototype=x.prototype,m.prototype=new b},o.extend=function(){var m,x,b={};for(m=0;m<arguments.length;m++)for(x in arguments[m])Object.prototype.hasOwnProperty.call(arguments[m],x)&&b[x]===void 0&&(b[x]=arguments[m][x]);return b},o.prepareContent=function(m,x,b,v,k){return c.Promise.resolve(x).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,E){var N=new FileReader;N.onload=function(z){C(z.target.result)},N.onerror=function(z){E(z.target.error)},N.readAsArrayBuffer(S)}):S}).then(function(S){var C=o.getTypeOf(S);return C?(C==="arraybuffer"?S=o.transformTo("uint8array",S):C==="string"&&(k?S=i.decode(S):b&&v!==!0&&(S=(function(E){return d(E,s.uint8array?new Uint8Array(E.length):new Array(E.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 p=this.reader.readString(4);throw new Error("Corrupted zip or bug: unexpected signature ("+i.pretty(p)+", expected "+i.pretty(f)+")")}},isSignature:function(f,p){var h=this.reader.index;this.reader.setIndex(f);var g=this.reader.readString(4)===p;return this.reader.setIndex(h),g},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),p=u.uint8array?"uint8array":"array",h=i.transformTo(p,f);this.zipComment=this.loadOptions.decodeFileName(h)},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,p,h,g=this.zip64EndOfCentralSize-44;0<g;)f=this.reader.readInt(2),p=this.reader.readInt(4),h=this.reader.readData(p),this.zip64ExtensibleData[f]={id:f,length:p,value:h}},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,p;for(f=0;f<this.files.length;f++)p=this.files[f],this.reader.setIndex(p.localHeaderOffset),this.checkSignature(a.LOCAL_FILE_HEADER),p.readLocalPart(this.reader),p.handleUTF8(),p.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 p=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 h=this.centralDirOffset+this.centralDirSize;this.zip64&&(h+=20,h+=12+this.zip64EndOfCentralSize);var g=p-h;if(0<g)this.isSignature(p,a.CENTRAL_FILE_HEADER)||(this.reader.zero=g);else if(g<0)throw new Error("Corrupted zip: missing "+Math.abs(g)+" 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 p(h,g){this.options=h,this.loadOptions=g}p.prototype={isEncrypted:function(){return(1&this.bitFlag)==1},useUTF8:function(){return(2048&this.bitFlag)==2048},readLocalPart:function(h){var g,m;if(h.skip(22),this.fileNameLength=h.readInt(2),m=h.readInt(2),this.fileName=h.readData(this.fileNameLength),h.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((g=(function(x){for(var b in d)if(Object.prototype.hasOwnProperty.call(d,b)&&d[b].magic===x)return d[b];return null})(this.compressionMethod))===null)throw new Error("Corrupted zip : compression "+i.pretty(this.compressionMethod)+" unknown (inner file : "+i.transformTo("string",this.fileName)+")");this.decompressed=new a(this.compressedSize,this.uncompressedSize,this.crc32,g,h.readData(this.compressedSize))},readCentralPart:function(h){this.versionMadeBy=h.readInt(2),h.skip(2),this.bitFlag=h.readInt(2),this.compressionMethod=h.readString(2),this.date=h.readDate(),this.crc32=h.readInt(4),this.compressedSize=h.readInt(4),this.uncompressedSize=h.readInt(4);var g=h.readInt(2);if(this.extraFieldsLength=h.readInt(2),this.fileCommentLength=h.readInt(2),this.diskNumberStart=h.readInt(2),this.internalFileAttributes=h.readInt(2),this.externalFileAttributes=h.readInt(4),this.localHeaderOffset=h.readInt(4),this.isEncrypted())throw new Error("Encrypted zip are not supported");h.skip(g),this.readExtraFields(h),this.parseZIP64ExtraField(h),this.fileComment=h.readData(this.fileCommentLength)},processAttributes:function(){this.unixPermissions=null,this.dosPermissions=null;var h=this.versionMadeBy>>8;this.dir=!!(16&this.externalFileAttributes),h==0&&(this.dosPermissions=63&this.externalFileAttributes),h==3&&(this.unixPermissions=this.externalFileAttributes>>16&65535),this.dir||this.fileNameStr.slice(-1)!=="/"||(this.dir=!0)},parseZIP64ExtraField:function(){if(this.extraFields[1]){var h=s(this.extraFields[1].value);this.uncompressedSize===i.MAX_VALUE_32BITS&&(this.uncompressedSize=h.readInt(8)),this.compressedSize===i.MAX_VALUE_32BITS&&(this.compressedSize=h.readInt(8)),this.localHeaderOffset===i.MAX_VALUE_32BITS&&(this.localHeaderOffset=h.readInt(8)),this.diskNumberStart===i.MAX_VALUE_32BITS&&(this.diskNumberStart=h.readInt(4))}},readExtraFields:function(h){var g,m,x,b=h.index+this.extraFieldsLength;for(this.extraFields||(this.extraFields={});h.index+4<b;)g=h.readInt(2),m=h.readInt(2),x=h.readData(m),this.extraFields[g]={id:g,length:m,value:x};h.setIndex(b)},handleUTF8:function(){var h=f.uint8array?"uint8array":"array";if(this.useUTF8())this.fileNameStr=u.utf8decode(this.fileName),this.fileCommentStr=u.utf8decode(this.fileComment);else{var g=this.findExtraFieldUnicodePath();if(g!==null)this.fileNameStr=g;else{var m=i.transformTo(h,this.fileName);this.fileNameStr=this.loadOptions.decodeFileName(m)}var x=this.findExtraFieldUnicodeComment();if(x!==null)this.fileCommentStr=x;else{var b=i.transformTo(h,this.fileComment);this.fileCommentStr=this.loadOptions.decodeFileName(b)}}},findExtraFieldUnicodePath:function(){var h=this.extraFields[28789];if(h){var g=s(h.value);return g.readInt(1)!==1||c(this.fileName)!==g.readInt(4)?null:u.utf8decode(g.readData(h.length-5))}return null},findExtraFieldUnicodeComment:function(){var h=this.extraFields[25461];if(h){var g=s(h.value);return g.readInt(1)!==1||c(this.fileComment)!==g.readInt(4)?null:u.utf8decode(g.readData(h.length-5))}return null}},r.exports=p},{"./compressedObject":2,"./compressions":3,"./crc32":4,"./reader/readerFor":22,"./support":30,"./utf8":31,"./utils":32}],35:[function(n,r,o){function s(g,m,x){this.name=g,this.dir=x.dir,this.date=x.date,this.comment=x.comment,this.unixPermissions=x.unixPermissions,this.dosPermissions=x.dosPermissions,this._data=m,this._dataBinary=x.binary,this.options={compression:x.compression,compressionOptions:x.compressionOptions}}var i=n("./stream/StreamHelper"),a=n("./stream/DataWorker"),c=n("./utf8"),u=n("./compressedObject"),d=n("./stream/GenericWorker");s.prototype={internalStream:function(g){var m=null,x="string";try{if(!g)throw new Error("No output type specified.");var b=(x=g.toLowerCase())==="string"||x==="text";x!=="binarystring"&&x!=="text"||(x="string"),m=this._decompressWorker();var v=!this._dataBinary;v&&!b&&(m=m.pipe(new c.Utf8EncodeWorker)),!v&&b&&(m=m.pipe(new c.Utf8DecodeWorker))}catch(k){(m=new d("error")).error(k)}return new i(m,x,"")},async:function(g,m){return this.internalStream(g).accumulate(m)},nodeStream:function(g,m){return this.internalStream(g||"nodebuffer").toNodejsStream(m)},_compressWorker:function(g,m){if(this._data instanceof u&&this._data.compression.magic===g.magic)return this._data.getCompressedWorker();var x=this._decompressWorker();return this._dataBinary||(x=x.pipe(new c.Utf8EncodeWorker)),u.createWorkerFrom(x,g,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"],p=function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},h=0;h<f.length;h++)s.prototype[f[h]]=p;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(g),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(){g(),m.onreadystatechange=null,m.parentNode.removeChild(m),m=null},s.document.documentElement.appendChild(m)}:function(){setTimeout(g,0)};else{var p=new s.MessageChannel;p.port1.onmessage=g,i=function(){p.port2.postMessage(0)}}var h=[];function g(){var m,x;a=!0;for(var b=h.length;b;){for(x=h,h=[],m=-1;++m<b;)x[m]();b=h.length}a=!1}r.exports=function(m){h.push(m)!==1||a||i()}}).call(this,typeof Ur<"u"?Ur: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(b){if(typeof b!="function")throw new TypeError("resolver must be a function");this.state=d,this.queue=[],this.outcome=void 0,b!==i&&m(this,b)}function p(b,v,k){this.promise=b,typeof v=="function"&&(this.onFulfilled=v,this.callFulfilled=this.otherCallFulfilled),typeof k=="function"&&(this.onRejected=k,this.callRejected=this.otherCallRejected)}function h(b,v,k){s(function(){var S;try{S=v(k)}catch(C){return a.reject(b,C)}S===b?a.reject(b,new TypeError("Cannot resolve promise with itself")):a.resolve(b,S)})}function g(b){var v=b&&b.then;if(b&&(typeof b=="object"||typeof b=="function")&&typeof v=="function")return function(){v.apply(b,arguments)}}function m(b,v){var k=!1;function S(N){k||(k=!0,a.reject(b,N))}function C(N){k||(k=!0,a.resolve(b,N))}var E=x(function(){v(C,S)});E.status==="error"&&S(E.value)}function x(b,v){var k={};try{k.value=b(v),k.status="success"}catch(S){k.status="error",k.value=S}return k}(r.exports=f).prototype.finally=function(b){if(typeof b!="function")return this;var v=this.constructor;return this.then(function(k){return v.resolve(b()).then(function(){return k})},function(k){return v.resolve(b()).then(function(){throw k})})},f.prototype.catch=function(b){return this.then(null,b)},f.prototype.then=function(b,v){if(typeof b!="function"&&this.state===u||typeof v!="function"&&this.state===c)return this;var k=new this.constructor(i);return this.state!==d?h(k,this.state===u?b:v,this.outcome):this.queue.push(new p(k,b,v)),k},p.prototype.callFulfilled=function(b){a.resolve(this.promise,b)},p.prototype.otherCallFulfilled=function(b){h(this.promise,this.onFulfilled,b)},p.prototype.callRejected=function(b){a.reject(this.promise,b)},p.prototype.otherCallRejected=function(b){h(this.promise,this.onRejected,b)},a.resolve=function(b,v){var k=x(g,v);if(k.status==="error")return a.reject(b,k.value);var S=k.value;if(S)m(b,S);else{b.state=u,b.outcome=v;for(var C=-1,E=b.queue.length;++C<E;)b.queue[C].callFulfilled(v)}return b},a.reject=function(b,v){b.state=c,b.outcome=v;for(var k=-1,S=b.queue.length;++k<S;)b.queue[k].callRejected(v);return b},f.resolve=function(b){return b instanceof this?b:a.resolve(new this(i),b)},f.reject=function(b){var v=new this(i);return a.reject(v,b)},f.all=function(b){var v=this;if(Object.prototype.toString.call(b)!=="[object Array]")return this.reject(new TypeError("must be an array"));var k=b.length,S=!1;if(!k)return this.resolve([]);for(var C=new Array(k),E=0,N=-1,z=new this(i);++N<k;)T(b[N],N);return z;function T(R,$){v.resolve(R).then(function(j){C[$]=j,++E!==k||S||(S=!0,a.resolve(z,C))},function(j){S||(S=!0,a.reject(z,j))})}},f.race=function(b){var v=this;if(Object.prototype.toString.call(b)!=="[object Array]")return this.reject(new TypeError("must be an array"));var k=b.length,S=!1;if(!k)return this.resolve([]);for(var C=-1,E=new this(i);++C<k;)N=b[C],v.resolve(N).then(function(z){S||(S=!0,a.resolve(E,z))},function(z){S||(S=!0,a.reject(E,z))});var N;return E}},{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,p=-1,h=0,g=8;function m(b){if(!(this instanceof m))return new m(b);this.options=i.assign({level:p,method:g,chunkSize:16384,windowBits:15,memLevel:8,strategy:h,to:""},b||{});var v=this.options;v.raw&&0<v.windowBits?v.windowBits=-v.windowBits:v.gzip&&0<v.windowBits&&v.windowBits<16&&(v.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new u,this.strm.avail_out=0;var k=s.deflateInit2(this.strm,v.level,v.method,v.windowBits,v.memLevel,v.strategy);if(k!==f)throw new Error(c[k]);if(v.header&&s.deflateSetHeader(this.strm,v.header),v.dictionary){var S;if(S=typeof v.dictionary=="string"?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 x(b,v){var k=new m(v);if(k.push(b,!0),k.err)throw k.msg||c[k.err];return k.result}m.prototype.push=function(b,v){var k,S,C=this.strm,E=this.options.chunkSize;if(this.ended)return!1;S=v===~~v?v:v===!0?4:0,typeof b=="string"?C.input=a.string2buf(b):d.call(b)==="[object ArrayBuffer]"?C.input=new Uint8Array(b):C.input=b,C.next_in=0,C.avail_in=C.input.length;do{if(C.avail_out===0&&(C.output=new i.Buf8(E),C.next_out=0,C.avail_out=E),(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(b){this.chunks.push(b)},m.prototype.onEnd=function(b){b===f&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=i.flattenChunks(this.chunks)),this.chunks=[],this.err=b,this.msg=this.strm.msg},o.Deflate=m,o.deflate=x,o.deflateRaw=function(b,v){return(v=v||{}).raw=!0,x(b,v)},o.gzip=function(b,v){return(v=v||{}).gzip=!0,x(b,v)}},{"./utils/common":41,"./utils/strings":42,"./zlib/deflate":46,"./zlib/messages":51,"./zlib/zstream":53}],40:[function(n,r,o){var s=n("./zlib/inflate"),i=n("./utils/common"),a=n("./utils/strings"),c=n("./zlib/constants"),u=n("./zlib/messages"),d=n("./zlib/zstream"),f=n("./zlib/gzheader"),p=Object.prototype.toString;function h(m){if(!(this instanceof h))return new h(m);this.options=i.assign({chunkSize:16384,windowBits:0,to:""},m||{});var x=this.options;x.raw&&0<=x.windowBits&&x.windowBits<16&&(x.windowBits=-x.windowBits,x.windowBits===0&&(x.windowBits=-15)),!(0<=x.windowBits&&x.windowBits<16)||m&&m.windowBits||(x.windowBits+=32),15<x.windowBits&&x.windowBits<48&&(15&x.windowBits)==0&&(x.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new d,this.strm.avail_out=0;var b=s.inflateInit2(this.strm,x.windowBits);if(b!==c.Z_OK)throw new Error(u[b]);this.header=new f,s.inflateGetHeader(this.strm,this.header)}function g(m,x){var b=new h(x);if(b.push(m,!0),b.err)throw b.msg||u[b.err];return b.result}h.prototype.push=function(m,x){var b,v,k,S,C,E,N=this.strm,z=this.options.chunkSize,T=this.options.dictionary,R=!1;if(this.ended)return!1;v=x===~~x?x:x===!0?c.Z_FINISH:c.Z_NO_FLUSH,typeof m=="string"?N.input=a.binstring2buf(m):p.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(z),N.next_out=0,N.avail_out=z),(b=s.inflate(N,c.Z_NO_FLUSH))===c.Z_NEED_DICT&&T&&(E=typeof T=="string"?a.string2buf(T):p.call(T)==="[object ArrayBuffer]"?new Uint8Array(T):T,b=s.inflateSetDictionary(this.strm,E)),b===c.Z_BUF_ERROR&&R===!0&&(b=c.Z_OK,R=!1),b!==c.Z_STREAM_END&&b!==c.Z_OK)return this.onEnd(b),!(this.ended=!0);N.next_out&&(N.avail_out!==0&&b!==c.Z_STREAM_END&&(N.avail_in!==0||v!==c.Z_FINISH&&v!==c.Z_SYNC_FLUSH)||(this.options.to==="string"?(k=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=z-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&&(R=!0)}while((0<N.avail_in||N.avail_out===0)&&b!==c.Z_STREAM_END);return b===c.Z_STREAM_END&&(v=c.Z_FINISH),v===c.Z_FINISH?(b=s.inflateEnd(this.strm),this.onEnd(b),this.ended=!0,b===c.Z_OK):v!==c.Z_SYNC_FLUSH||(this.onEnd(c.Z_OK),!(N.avail_out=0))},h.prototype.onData=function(m){this.chunks.push(m)},h.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=h,o.inflate=g,o.inflateRaw=function(m,x){return(x=x||{}).raw=!0,g(m,x)},o.ungzip=g},{"./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,p){if(u.subarray&&c.subarray)c.set(u.subarray(d,d+f),p);else for(var h=0;h<f;h++)c[p+h]=u[d+h]},flattenChunks:function(c){var u,d,f,p,h,g;for(u=f=0,d=c.length;u<d;u++)f+=c[u].length;for(g=new Uint8Array(f),u=p=0,d=c.length;u<d;u++)h=c[u],g.set(h,p),p+=h.length;return g}},a={arraySet:function(c,u,d,f,p){for(var h=0;h<f;h++)c[p+h]=u[d+h]},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,p){if(p<65537&&(f.subarray&&a||!f.subarray&&i))return String.fromCharCode.apply(null,s.shrinkBuf(f,p));for(var h="",g=0;g<p;g++)h+=String.fromCharCode(f[g]);return h}c[254]=c[254]=1,o.string2buf=function(f){var p,h,g,m,x,b=f.length,v=0;for(m=0;m<b;m++)(64512&(h=f.charCodeAt(m)))==55296&&m+1<b&&(64512&(g=f.charCodeAt(m+1)))==56320&&(h=65536+(h-55296<<10)+(g-56320),m++),v+=h<128?1:h<2048?2:h<65536?3:4;for(p=new s.Buf8(v),m=x=0;x<v;m++)(64512&(h=f.charCodeAt(m)))==55296&&m+1<b&&(64512&(g=f.charCodeAt(m+1)))==56320&&(h=65536+(h-55296<<10)+(g-56320),m++),h<128?p[x++]=h:(h<2048?p[x++]=192|h>>>6:(h<65536?p[x++]=224|h>>>12:(p[x++]=240|h>>>18,p[x++]=128|h>>>12&63),p[x++]=128|h>>>6&63),p[x++]=128|63&h);return p},o.buf2binstring=function(f){return d(f,f.length)},o.binstring2buf=function(f){for(var p=new s.Buf8(f.length),h=0,g=p.length;h<g;h++)p[h]=f.charCodeAt(h);return p},o.buf2string=function(f,p){var h,g,m,x,b=p||f.length,v=new Array(2*b);for(h=g=0;h<b;)if((m=f[h++])<128)v[g++]=m;else if(4<(x=c[m]))v[g++]=65533,h+=x-1;else{for(m&=x===2?31:x===3?15:7;1<x&&h<b;)m=m<<6|63&f[h++],x--;1<x?v[g++]=65533:m<65536?v[g++]=m:(m-=65536,v[g++]=55296|m>>10&1023,v[g++]=56320|1023&m)}return d(v,g)},o.utf8border=function(f,p){var h;for((p=p||f.length)>f.length&&(p=f.length),h=p-1;0<=h&&(192&f[h])==128;)h--;return h<0||h===0?p:h+c[f[h]]>p?h:p}},{"./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 p=u;p<f;p++)i=i>>>8^d[255&(i^a[p])];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,p=4,h=0,g=-2,m=-1,x=4,b=2,v=8,k=9,S=286,C=30,E=19,N=2*S+1,z=15,T=3,R=258,$=R+T+1,j=42,D=113,w=1,M=2,U=3,L=4;function F(_,Q){return _.msg=d[Q],Q}function q(_){return(_<<1)-(4<_?9:0)}function A(_){for(var Q=_.length;0<=--Q;)_[Q]=0}function Z(_){var Q=_.state,G=Q.pending;G>_.avail_out&&(G=_.avail_out),G!==0&&(i.arraySet(_.output,Q.pending_buf,Q.pending_out,G,_.next_out),_.next_out+=G,Q.pending_out+=G,_.total_out+=G,_.avail_out-=G,Q.pending-=G,Q.pending===0&&(Q.pending_out=0))}function W(_,Q){a._tr_flush_block(_,0<=_.block_start?_.block_start:-1,_.strstart-_.block_start,Q),_.block_start=_.strstart,Z(_.strm)}function I(_,Q){_.pending_buf[_.pending++]=Q}function se(_,Q){_.pending_buf[_.pending++]=Q>>>8&255,_.pending_buf[_.pending++]=255&Q}function ee(_,Q){var G,O,P=_.max_chain_length,H=_.strstart,oe=_.prev_length,ie=_.nice_match,K=_.strstart>_.w_size-$?_.strstart-(_.w_size-$):0,J=_.window,re=_.w_mask,te=_.prev,B=_.strstart+R,Y=J[H+oe-1],ce=J[H+oe];_.prev_length>=_.good_match&&(P>>=2),ie>_.lookahead&&(ie=_.lookahead);do if(J[(G=Q)+oe]===ce&&J[G+oe-1]===Y&&J[G]===J[H]&&J[++G]===J[H+1]){H+=2,G++;do;while(J[++H]===J[++G]&&J[++H]===J[++G]&&J[++H]===J[++G]&&J[++H]===J[++G]&&J[++H]===J[++G]&&J[++H]===J[++G]&&J[++H]===J[++G]&&J[++H]===J[++G]&&H<B);if(O=R-(B-H),H=B-R,oe<O){if(_.match_start=Q,ie<=(oe=O))break;Y=J[H+oe-1],ce=J[H+oe]}}while((Q=te[Q&re])>K&&--P!=0);return oe<=_.lookahead?oe:_.lookahead}function pe(_){var Q,G,O,P,H,oe,ie,K,J,re,te=_.w_size;do{if(P=_.window_size-_.lookahead-_.strstart,_.strstart>=te+(te-$)){for(i.arraySet(_.window,_.window,te,te,0),_.match_start-=te,_.strstart-=te,_.block_start-=te,Q=G=_.hash_size;O=_.head[--Q],_.head[Q]=te<=O?O-te:0,--G;);for(Q=G=te;O=_.prev[--Q],_.prev[Q]=te<=O?O-te:0,--G;);P+=te}if(_.strm.avail_in===0)break;if(oe=_.strm,ie=_.window,K=_.strstart+_.lookahead,J=P,re=void 0,re=oe.avail_in,J<re&&(re=J),G=re===0?0:(oe.avail_in-=re,i.arraySet(ie,oe.input,oe.next_in,re,K),oe.state.wrap===1?oe.adler=c(oe.adler,ie,re,K):oe.state.wrap===2&&(oe.adler=u(oe.adler,ie,re,K)),oe.next_in+=re,oe.total_in+=re,re),_.lookahead+=G,_.lookahead+_.insert>=T)for(H=_.strstart-_.insert,_.ins_h=_.window[H],_.ins_h=(_.ins_h<<_.hash_shift^_.window[H+1])&_.hash_mask;_.insert&&(_.ins_h=(_.ins_h<<_.hash_shift^_.window[H+T-1])&_.hash_mask,_.prev[H&_.w_mask]=_.head[_.ins_h],_.head[_.ins_h]=H,H++,_.insert--,!(_.lookahead+_.insert<T)););}while(_.lookahead<$&&_.strm.avail_in!==0)}function le(_,Q){for(var G,O;;){if(_.lookahead<$){if(pe(_),_.lookahead<$&&Q===f)return w;if(_.lookahead===0)break}if(G=0,_.lookahead>=T&&(_.ins_h=(_.ins_h<<_.hash_shift^_.window[_.strstart+T-1])&_.hash_mask,G=_.prev[_.strstart&_.w_mask]=_.head[_.ins_h],_.head[_.ins_h]=_.strstart),G!==0&&_.strstart-G<=_.w_size-$&&(_.match_length=ee(_,G)),_.match_length>=T)if(O=a._tr_tally(_,_.strstart-_.match_start,_.match_length-T),_.lookahead-=_.match_length,_.match_length<=_.max_lazy_match&&_.lookahead>=T){for(_.match_length--;_.strstart++,_.ins_h=(_.ins_h<<_.hash_shift^_.window[_.strstart+T-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 O=a._tr_tally(_,0,_.window[_.strstart]),_.lookahead--,_.strstart++;if(O&&(W(_,!1),_.strm.avail_out===0))return w}return _.insert=_.strstart<T-1?_.strstart:T-1,Q===p?(W(_,!0),_.strm.avail_out===0?U:L):_.last_lit&&(W(_,!1),_.strm.avail_out===0)?w:M}function ne(_,Q){for(var G,O,P;;){if(_.lookahead<$){if(pe(_),_.lookahead<$&&Q===f)return w;if(_.lookahead===0)break}if(G=0,_.lookahead>=T&&(_.ins_h=(_.ins_h<<_.hash_shift^_.window[_.strstart+T-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=T-1,G!==0&&_.prev_length<_.max_lazy_match&&_.strstart-G<=_.w_size-$&&(_.match_length=ee(_,G),_.match_length<=5&&(_.strategy===1||_.match_length===T&&4096<_.strstart-_.match_start)&&(_.match_length=T-1)),_.prev_length>=T&&_.match_length<=_.prev_length){for(P=_.strstart+_.lookahead-T,O=a._tr_tally(_,_.strstart-1-_.prev_match,_.prev_length-T),_.lookahead-=_.prev_length-1,_.prev_length-=2;++_.strstart<=P&&(_.ins_h=(_.ins_h<<_.hash_shift^_.window[_.strstart+T-1])&_.hash_mask,G=_.prev[_.strstart&_.w_mask]=_.head[_.ins_h],_.head[_.ins_h]=_.strstart),--_.prev_length!=0;);if(_.match_available=0,_.match_length=T-1,_.strstart++,O&&(W(_,!1),_.strm.avail_out===0))return w}else if(_.match_available){if((O=a._tr_tally(_,0,_.window[_.strstart-1]))&&W(_,!1),_.strstart++,_.lookahead--,_.strm.avail_out===0)return w}else _.match_available=1,_.strstart++,_.lookahead--}return _.match_available&&(O=a._tr_tally(_,0,_.window[_.strstart-1]),_.match_available=0),_.insert=_.strstart<T-1?_.strstart:T-1,Q===p?(W(_,!0),_.strm.avail_out===0?U:L):_.last_lit&&(W(_,!1),_.strm.avail_out===0)?w:M}function de(_,Q,G,O,P){this.good_length=_,this.max_lazy=Q,this.nice_length=G,this.max_chain=O,this.func=P}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*E+1)),A(this.dyn_ltree),A(this.dyn_dtree),A(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new i.Buf16(z+1),this.heap=new i.Buf16(2*S+1),A(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new i.Buf16(2*S+1),A(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 he(_){var Q;return _&&_.state?(_.total_in=_.total_out=0,_.data_type=b,(Q=_.state).pending=0,Q.pending_out=0,Q.wrap<0&&(Q.wrap=-Q.wrap),Q.status=Q.wrap?j:D,_.adler=Q.wrap===2?0:1,Q.last_flush=f,a._tr_init(Q),h):F(_,g)}function we(_){var Q=he(_);return Q===h&&(function(G){G.window_size=2*G.w_size,A(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=T-1,G.match_available=0,G.ins_h=0})(_.state),Q}function Me(_,Q,G,O,P,H){if(!_)return g;var oe=1;if(Q===m&&(Q=6),O<0?(oe=0,O=-O):15<O&&(oe=2,O-=16),P<1||k<P||G!==v||O<8||15<O||Q<0||9<Q||H<0||x<H)return F(_,g);O===8&&(O=9);var ie=new fe;return(_.state=ie).strm=_,ie.wrap=oe,ie.gzhead=null,ie.w_bits=O,ie.w_size=1<<ie.w_bits,ie.w_mask=ie.w_size-1,ie.hash_bits=P+7,ie.hash_size=1<<ie.hash_bits,ie.hash_mask=ie.hash_size-1,ie.hash_shift=~~((ie.hash_bits+T-1)/T),ie.window=new i.Buf8(2*ie.w_size),ie.head=new i.Buf16(ie.hash_size),ie.prev=new i.Buf16(ie.w_size),ie.lit_bufsize=1<<P+6,ie.pending_buf_size=4*ie.lit_bufsize,ie.pending_buf=new i.Buf8(ie.pending_buf_size),ie.d_buf=1*ie.lit_bufsize,ie.l_buf=3*ie.lit_bufsize,ie.level=Q,ie.strategy=H,ie.method=G,we(_)}s=[new de(0,0,0,0,function(_,Q){var G=65535;for(G>_.pending_buf_size-5&&(G=_.pending_buf_size-5);;){if(_.lookahead<=1){if(pe(_),_.lookahead===0&&Q===f)return w;if(_.lookahead===0)break}_.strstart+=_.lookahead,_.lookahead=0;var O=_.block_start+G;if((_.strstart===0||_.strstart>=O)&&(_.lookahead=_.strstart-O,_.strstart=O,W(_,!1),_.strm.avail_out===0)||_.strstart-_.block_start>=_.w_size-$&&(W(_,!1),_.strm.avail_out===0))return w}return _.insert=0,Q===p?(W(_,!0),_.strm.avail_out===0?U:L):(_.strstart>_.block_start&&(W(_,!1),_.strm.avail_out),w)}),new de(4,4,8,4,le),new de(4,5,16,8,le),new de(4,6,32,32,le),new de(4,4,16,16,ne),new de(8,16,32,32,ne),new de(8,16,128,128,ne),new de(8,32,128,256,ne),new de(32,128,258,1024,ne),new de(32,258,258,4096,ne)],o.deflateInit=function(_,Q){return Me(_,Q,v,15,8,0)},o.deflateInit2=Me,o.deflateReset=we,o.deflateResetKeep=he,o.deflateSetHeader=function(_,Q){return _&&_.state?_.state.wrap!==2?g:(_.state.gzhead=Q,h):g},o.deflate=function(_,Q){var G,O,P,H;if(!_||!_.state||5<Q||Q<0)return _?F(_,g):g;if(O=_.state,!_.output||!_.input&&_.avail_in!==0||O.status===666&&Q!==p)return F(_,_.avail_out===0?-5:g);if(O.strm=_,G=O.last_flush,O.last_flush=Q,O.status===j)if(O.wrap===2)_.adler=0,I(O,31),I(O,139),I(O,8),O.gzhead?(I(O,(O.gzhead.text?1:0)+(O.gzhead.hcrc?2:0)+(O.gzhead.extra?4:0)+(O.gzhead.name?8:0)+(O.gzhead.comment?16:0)),I(O,255&O.gzhead.time),I(O,O.gzhead.time>>8&255),I(O,O.gzhead.time>>16&255),I(O,O.gzhead.time>>24&255),I(O,O.level===9?2:2<=O.strategy||O.level<2?4:0),I(O,255&O.gzhead.os),O.gzhead.extra&&O.gzhead.extra.length&&(I(O,255&O.gzhead.extra.length),I(O,O.gzhead.extra.length>>8&255)),O.gzhead.hcrc&&(_.adler=u(_.adler,O.pending_buf,O.pending,0)),O.gzindex=0,O.status=69):(I(O,0),I(O,0),I(O,0),I(O,0),I(O,0),I(O,O.level===9?2:2<=O.strategy||O.level<2?4:0),I(O,3),O.status=D);else{var oe=v+(O.w_bits-8<<4)<<8;oe|=(2<=O.strategy||O.level<2?0:O.level<6?1:O.level===6?2:3)<<6,O.strstart!==0&&(oe|=32),oe+=31-oe%31,O.status=D,se(O,oe),O.strstart!==0&&(se(O,_.adler>>>16),se(O,65535&_.adler)),_.adler=1}if(O.status===69)if(O.gzhead.extra){for(P=O.pending;O.gzindex<(65535&O.gzhead.extra.length)&&(O.pending!==O.pending_buf_size||(O.gzhead.hcrc&&O.pending>P&&(_.adler=u(_.adler,O.pending_buf,O.pending-P,P)),Z(_),P=O.pending,O.pending!==O.pending_buf_size));)I(O,255&O.gzhead.extra[O.gzindex]),O.gzindex++;O.gzhead.hcrc&&O.pending>P&&(_.adler=u(_.adler,O.pending_buf,O.pending-P,P)),O.gzindex===O.gzhead.extra.length&&(O.gzindex=0,O.status=73)}else O.status=73;if(O.status===73)if(O.gzhead.name){P=O.pending;do{if(O.pending===O.pending_buf_size&&(O.gzhead.hcrc&&O.pending>P&&(_.adler=u(_.adler,O.pending_buf,O.pending-P,P)),Z(_),P=O.pending,O.pending===O.pending_buf_size)){H=1;break}H=O.gzindex<O.gzhead.name.length?255&O.gzhead.name.charCodeAt(O.gzindex++):0,I(O,H)}while(H!==0);O.gzhead.hcrc&&O.pending>P&&(_.adler=u(_.adler,O.pending_buf,O.pending-P,P)),H===0&&(O.gzindex=0,O.status=91)}else O.status=91;if(O.status===91)if(O.gzhead.comment){P=O.pending;do{if(O.pending===O.pending_buf_size&&(O.gzhead.hcrc&&O.pending>P&&(_.adler=u(_.adler,O.pending_buf,O.pending-P,P)),Z(_),P=O.pending,O.pending===O.pending_buf_size)){H=1;break}H=O.gzindex<O.gzhead.comment.length?255&O.gzhead.comment.charCodeAt(O.gzindex++):0,I(O,H)}while(H!==0);O.gzhead.hcrc&&O.pending>P&&(_.adler=u(_.adler,O.pending_buf,O.pending-P,P)),H===0&&(O.status=103)}else O.status=103;if(O.status===103&&(O.gzhead.hcrc?(O.pending+2>O.pending_buf_size&&Z(_),O.pending+2<=O.pending_buf_size&&(I(O,255&_.adler),I(O,_.adler>>8&255),_.adler=0,O.status=D)):O.status=D),O.pending!==0){if(Z(_),_.avail_out===0)return O.last_flush=-1,h}else if(_.avail_in===0&&q(Q)<=q(G)&&Q!==p)return F(_,-5);if(O.status===666&&_.avail_in!==0)return F(_,-5);if(_.avail_in!==0||O.lookahead!==0||Q!==f&&O.status!==666){var ie=O.strategy===2?(function(K,J){for(var re;;){if(K.lookahead===0&&(pe(K),K.lookahead===0)){if(J===f)return w;break}if(K.match_length=0,re=a._tr_tally(K,0,K.window[K.strstart]),K.lookahead--,K.strstart++,re&&(W(K,!1),K.strm.avail_out===0))return w}return K.insert=0,J===p?(W(K,!0),K.strm.avail_out===0?U:L):K.last_lit&&(W(K,!1),K.strm.avail_out===0)?w:M})(O,Q):O.strategy===3?(function(K,J){for(var re,te,B,Y,ce=K.window;;){if(K.lookahead<=R){if(pe(K),K.lookahead<=R&&J===f)return w;if(K.lookahead===0)break}if(K.match_length=0,K.lookahead>=T&&0<K.strstart&&(te=ce[B=K.strstart-1])===ce[++B]&&te===ce[++B]&&te===ce[++B]){Y=K.strstart+R;do;while(te===ce[++B]&&te===ce[++B]&&te===ce[++B]&&te===ce[++B]&&te===ce[++B]&&te===ce[++B]&&te===ce[++B]&&te===ce[++B]&&B<Y);K.match_length=R-(Y-B),K.match_length>K.lookahead&&(K.match_length=K.lookahead)}if(K.match_length>=T?(re=a._tr_tally(K,1,K.match_length-T),K.lookahead-=K.match_length,K.strstart+=K.match_length,K.match_length=0):(re=a._tr_tally(K,0,K.window[K.strstart]),K.lookahead--,K.strstart++),re&&(W(K,!1),K.strm.avail_out===0))return w}return K.insert=0,J===p?(W(K,!0),K.strm.avail_out===0?U:L):K.last_lit&&(W(K,!1),K.strm.avail_out===0)?w:M})(O,Q):s[O.level].func(O,Q);if(ie!==U&&ie!==L||(O.status=666),ie===w||ie===U)return _.avail_out===0&&(O.last_flush=-1),h;if(ie===M&&(Q===1?a._tr_align(O):Q!==5&&(a._tr_stored_block(O,0,0,!1),Q===3&&(A(O.head),O.lookahead===0&&(O.strstart=0,O.block_start=0,O.insert=0))),Z(_),_.avail_out===0))return O.last_flush=-1,h}return Q!==p?h:O.wrap<=0?1:(O.wrap===2?(I(O,255&_.adler),I(O,_.adler>>8&255),I(O,_.adler>>16&255),I(O,_.adler>>24&255),I(O,255&_.total_in),I(O,_.total_in>>8&255),I(O,_.total_in>>16&255),I(O,_.total_in>>24&255)):(se(O,_.adler>>>16),se(O,65535&_.adler)),Z(_),0<O.wrap&&(O.wrap=-O.wrap),O.pending!==0?h:1)},o.deflateEnd=function(_){var Q;return _&&_.state?(Q=_.state.status)!==j&&Q!==69&&Q!==73&&Q!==91&&Q!==103&&Q!==D&&Q!==666?F(_,g):(_.state=null,Q===D?F(_,-3):h):g},o.deflateSetDictionary=function(_,Q){var G,O,P,H,oe,ie,K,J,re=Q.length;if(!_||!_.state||(H=(G=_.state).wrap)===2||H===1&&G.status!==j||G.lookahead)return g;for(H===1&&(_.adler=c(_.adler,Q,re,0)),G.wrap=0,re>=G.w_size&&(H===0&&(A(G.head),G.strstart=0,G.block_start=0,G.insert=0),J=new i.Buf8(G.w_size),i.arraySet(J,Q,re-G.w_size,G.w_size,0),Q=J,re=G.w_size),oe=_.avail_in,ie=_.next_in,K=_.input,_.avail_in=re,_.next_in=0,_.input=Q,pe(G);G.lookahead>=T;){for(O=G.strstart,P=G.lookahead-(T-1);G.ins_h=(G.ins_h<<G.hash_shift^G.window[O+T-1])&G.hash_mask,G.prev[O&G.w_mask]=G.head[G.ins_h],G.head[G.ins_h]=O,O++,--P;);G.strstart=O,G.lookahead=T-1,pe(G)}return G.strstart+=G.lookahead,G.block_start=G.strstart,G.insert=G.lookahead,G.lookahead=0,G.match_length=G.prev_length=T-1,G.match_available=0,_.next_in=ie,_.input=K,_.avail_in=oe,G.wrap=H,h},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,p,h,g,m,x,b,v,k,S,C,E,N,z,T,R,$,j,D,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),p=d+(s.avail_out-257),h=a.dmax,g=a.wsize,m=a.whave,x=a.wnext,b=a.window,v=a.hold,k=a.bits,S=a.lencode,C=a.distcode,E=(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),z=S[v&E];t:for(;;){if(v>>>=T=z>>>24,k-=T,(T=z>>>16&255)===0)M[d++]=65535&z;else{if(!(16&T)){if((64&T)==0){z=S[(65535&z)+(v&(1<<T)-1)];continue t}if(32&T){a.mode=12;break e}s.msg="invalid literal/length code",a.mode=30;break e}R=65535&z,(T&=15)&&(k<T&&(v+=w[c++]<<k,k+=8),R+=v&(1<<T)-1,v>>>=T,k-=T),k<15&&(v+=w[c++]<<k,k+=8,v+=w[c++]<<k,k+=8),z=C[v&N];n:for(;;){if(v>>>=T=z>>>24,k-=T,!(16&(T=z>>>16&255))){if((64&T)==0){z=C[(65535&z)+(v&(1<<T)-1)];continue n}s.msg="invalid distance code",a.mode=30;break e}if($=65535&z,k<(T&=15)&&(v+=w[c++]<<k,(k+=8)<T&&(v+=w[c++]<<k,k+=8)),h<($+=v&(1<<T)-1)){s.msg="invalid distance too far back",a.mode=30;break e}if(v>>>=T,k-=T,(T=d-f)<$){if(m<(T=$-T)&&a.sane){s.msg="invalid distance too far back",a.mode=30;break e}if(D=b,(j=0)===x){if(j+=g-T,T<R){for(R-=T;M[d++]=b[j++],--T;);j=d-$,D=M}}else if(x<T){if(j+=g+x-T,(T-=x)<R){for(R-=T;M[d++]=b[j++],--T;);if(j=0,x<R){for(R-=T=x;M[d++]=b[j++],--T;);j=d-$,D=M}}}else if(j+=x-T,T<R){for(R-=T;M[d++]=b[j++],--T;);j=d-$,D=M}for(;2<R;)M[d++]=D[j++],M[d++]=D[j++],M[d++]=D[j++],R-=3;R&&(M[d++]=D[j++],1<R&&(M[d++]=D[j++]))}else{for(j=d-$;M[d++]=M[j++],M[d++]=M[j++],M[d++]=M[j++],2<(R-=3););R&&(M[d++]=M[j++],1<R&&(M[d++]=M[j++]))}break}}break}}while(c<u&&d<p);c-=R=k>>3,v&=(1<<(k-=R<<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<p?p-d+257:257-(d-p),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,p=0,h=-2,g=1,m=852,x=592;function b(j){return(j>>>24&255)+(j>>>8&65280)+((65280&j)<<8)+((255&j)<<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(j){var D;return j&&j.state?(D=j.state,j.total_in=j.total_out=D.total=0,j.msg="",D.wrap&&(j.adler=1&D.wrap),D.mode=g,D.last=0,D.havedict=0,D.dmax=32768,D.head=null,D.hold=0,D.bits=0,D.lencode=D.lendyn=new s.Buf32(m),D.distcode=D.distdyn=new s.Buf32(x),D.sane=1,D.back=-1,p):h}function S(j){var D;return j&&j.state?((D=j.state).wsize=0,D.whave=0,D.wnext=0,k(j)):h}function C(j,D){var w,M;return j&&j.state?(M=j.state,D<0?(w=0,D=-D):(w=1+(D>>4),D<48&&(D&=15)),D&&(D<8||15<D)?h:(M.window!==null&&M.wbits!==D&&(M.window=null),M.wrap=w,M.wbits=D,S(j))):h}function E(j,D){var w,M;return j?(M=new v,(j.state=M).window=null,(w=C(j,D))!==p&&(j.state=null),w):h}var N,z,T=!0;function R(j){if(T){var D;for(N=new s.Buf32(512),z=new s.Buf32(32),D=0;D<144;)j.lens[D++]=8;for(;D<256;)j.lens[D++]=9;for(;D<280;)j.lens[D++]=7;for(;D<288;)j.lens[D++]=8;for(u(d,j.lens,0,288,N,0,j.work,{bits:9}),D=0;D<32;)j.lens[D++]=5;u(f,j.lens,0,32,z,0,j.work,{bits:5}),T=!1}j.lencode=N,j.lenbits=9,j.distcode=z,j.distbits=5}function $(j,D,w,M){var U,L=j.state;return L.window===null&&(L.wsize=1<<L.wbits,L.wnext=0,L.whave=0,L.window=new s.Buf8(L.wsize)),M>=L.wsize?(s.arraySet(L.window,D,w-L.wsize,L.wsize,0),L.wnext=0,L.whave=L.wsize):(M<(U=L.wsize-L.wnext)&&(U=M),s.arraySet(L.window,D,w-M,U,L.wnext),(M-=U)?(s.arraySet(L.window,D,w-M,M,0),L.wnext=M,L.whave=L.wsize):(L.wnext+=U,L.wnext===L.wsize&&(L.wnext=0),L.whave<L.wsize&&(L.whave+=U))),0}o.inflateReset=S,o.inflateReset2=C,o.inflateResetKeep=k,o.inflateInit=function(j){return E(j,15)},o.inflateInit2=E,o.inflate=function(j,D){var w,M,U,L,F,q,A,Z,W,I,se,ee,pe,le,ne,de,fe,he,we,Me,_,Q,G,O,P=0,H=new s.Buf8(4),oe=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];if(!j||!j.state||!j.output||!j.input&&j.avail_in!==0)return h;(w=j.state).mode===12&&(w.mode=13),F=j.next_out,U=j.output,A=j.avail_out,L=j.next_in,M=j.input,q=j.avail_in,Z=w.hold,W=w.bits,I=q,se=A,Q=p;e:for(;;)switch(w.mode){case g:if(w.wrap===0){w.mode=13;break}for(;W<16;){if(q===0)break e;q--,Z+=M[L++]<<W,W+=8}if(2&w.wrap&&Z===35615){H[w.check=0]=255&Z,H[1]=Z>>>8&255,w.check=a(w.check,H,2,0),W=Z=0,w.mode=2;break}if(w.flags=0,w.head&&(w.head.done=!1),!(1&w.wrap)||(((255&Z)<<8)+(Z>>8))%31){j.msg="incorrect header check",w.mode=30;break}if((15&Z)!=8){j.msg="unknown compression method",w.mode=30;break}if(W-=4,_=8+(15&(Z>>>=4)),w.wbits===0)w.wbits=_;else if(_>w.wbits){j.msg="invalid window size",w.mode=30;break}w.dmax=1<<_,j.adler=w.check=1,w.mode=512&Z?10:12,W=Z=0;break;case 2:for(;W<16;){if(q===0)break e;q--,Z+=M[L++]<<W,W+=8}if(w.flags=Z,(255&w.flags)!=8){j.msg="unknown compression method",w.mode=30;break}if(57344&w.flags){j.msg="unknown header flags set",w.mode=30;break}w.head&&(w.head.text=Z>>8&1),512&w.flags&&(H[0]=255&Z,H[1]=Z>>>8&255,w.check=a(w.check,H,2,0)),W=Z=0,w.mode=3;case 3:for(;W<32;){if(q===0)break e;q--,Z+=M[L++]<<W,W+=8}w.head&&(w.head.time=Z),512&w.flags&&(H[0]=255&Z,H[1]=Z>>>8&255,H[2]=Z>>>16&255,H[3]=Z>>>24&255,w.check=a(w.check,H,4,0)),W=Z=0,w.mode=4;case 4:for(;W<16;){if(q===0)break e;q--,Z+=M[L++]<<W,W+=8}w.head&&(w.head.xflags=255&Z,w.head.os=Z>>8),512&w.flags&&(H[0]=255&Z,H[1]=Z>>>8&255,w.check=a(w.check,H,2,0)),W=Z=0,w.mode=5;case 5:if(1024&w.flags){for(;W<16;){if(q===0)break e;q--,Z+=M[L++]<<W,W+=8}w.length=Z,w.head&&(w.head.extra_len=Z),512&w.flags&&(H[0]=255&Z,H[1]=Z>>>8&255,w.check=a(w.check,H,2,0)),W=Z=0}else w.head&&(w.head.extra=null);w.mode=6;case 6:if(1024&w.flags&&(q<(ee=w.length)&&(ee=q),ee&&(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,L,ee,_)),512&w.flags&&(w.check=a(w.check,M,ee,L)),q-=ee,L+=ee,w.length-=ee),w.length))break e;w.length=0,w.mode=7;case 7:if(2048&w.flags){if(q===0)break e;for(ee=0;_=M[L+ee++],w.head&&_&&w.length<65536&&(w.head.name+=String.fromCharCode(_)),_&&ee<q;);if(512&w.flags&&(w.check=a(w.check,M,ee,L)),q-=ee,L+=ee,_)break e}else w.head&&(w.head.name=null);w.length=0,w.mode=8;case 8:if(4096&w.flags){if(q===0)break e;for(ee=0;_=M[L+ee++],w.head&&_&&w.length<65536&&(w.head.comment+=String.fromCharCode(_)),_&&ee<q;);if(512&w.flags&&(w.check=a(w.check,M,ee,L)),q-=ee,L+=ee,_)break e}else w.head&&(w.head.comment=null);w.mode=9;case 9:if(512&w.flags){for(;W<16;){if(q===0)break e;q--,Z+=M[L++]<<W,W+=8}if(Z!==(65535&w.check)){j.msg="header crc mismatch",w.mode=30;break}W=Z=0}w.head&&(w.head.hcrc=w.flags>>9&1,w.head.done=!0),j.adler=w.check=0,w.mode=12;break;case 10:for(;W<32;){if(q===0)break e;q--,Z+=M[L++]<<W,W+=8}j.adler=w.check=b(Z),W=Z=0,w.mode=11;case 11:if(w.havedict===0)return j.next_out=F,j.avail_out=A,j.next_in=L,j.avail_in=q,w.hold=Z,w.bits=W,2;j.adler=w.check=1,w.mode=12;case 12:if(D===5||D===6)break e;case 13:if(w.last){Z>>>=7&W,W-=7&W,w.mode=27;break}for(;W<3;){if(q===0)break e;q--,Z+=M[L++]<<W,W+=8}switch(w.last=1&Z,W-=1,3&(Z>>>=1)){case 0:w.mode=14;break;case 1:if(R(w),w.mode=20,D!==6)break;Z>>>=2,W-=2;break e;case 2:w.mode=17;break;case 3:j.msg="invalid block type",w.mode=30}Z>>>=2,W-=2;break;case 14:for(Z>>>=7&W,W-=7&W;W<32;){if(q===0)break e;q--,Z+=M[L++]<<W,W+=8}if((65535&Z)!=(Z>>>16^65535)){j.msg="invalid stored block lengths",w.mode=30;break}if(w.length=65535&Z,W=Z=0,w.mode=15,D===6)break e;case 15:w.mode=16;case 16:if(ee=w.length){if(q<ee&&(ee=q),A<ee&&(ee=A),ee===0)break e;s.arraySet(U,M,L,ee,F),q-=ee,L+=ee,A-=ee,F+=ee,w.length-=ee;break}w.mode=12;break;case 17:for(;W<14;){if(q===0)break e;q--,Z+=M[L++]<<W,W+=8}if(w.nlen=257+(31&Z),Z>>>=5,W-=5,w.ndist=1+(31&Z),Z>>>=5,W-=5,w.ncode=4+(15&Z),Z>>>=4,W-=4,286<w.nlen||30<w.ndist){j.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(;W<3;){if(q===0)break e;q--,Z+=M[L++]<<W,W+=8}w.lens[oe[w.have++]]=7&Z,Z>>>=3,W-=3}for(;w.have<19;)w.lens[oe[w.have++]]=0;if(w.lencode=w.lendyn,w.lenbits=7,G={bits:w.lenbits},Q=u(0,w.lens,0,19,w.lencode,0,w.work,G),w.lenbits=G.bits,Q){j.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(;de=(P=w.lencode[Z&(1<<w.lenbits)-1])>>>16&255,fe=65535&P,!((ne=P>>>24)<=W);){if(q===0)break e;q--,Z+=M[L++]<<W,W+=8}if(fe<16)Z>>>=ne,W-=ne,w.lens[w.have++]=fe;else{if(fe===16){for(O=ne+2;W<O;){if(q===0)break e;q--,Z+=M[L++]<<W,W+=8}if(Z>>>=ne,W-=ne,w.have===0){j.msg="invalid bit length repeat",w.mode=30;break}_=w.lens[w.have-1],ee=3+(3&Z),Z>>>=2,W-=2}else if(fe===17){for(O=ne+3;W<O;){if(q===0)break e;q--,Z+=M[L++]<<W,W+=8}W-=ne,_=0,ee=3+(7&(Z>>>=ne)),Z>>>=3,W-=3}else{for(O=ne+7;W<O;){if(q===0)break e;q--,Z+=M[L++]<<W,W+=8}W-=ne,_=0,ee=11+(127&(Z>>>=ne)),Z>>>=7,W-=7}if(w.have+ee>w.nlen+w.ndist){j.msg="invalid bit length repeat",w.mode=30;break}for(;ee--;)w.lens[w.have++]=_}}if(w.mode===30)break;if(w.lens[256]===0){j.msg="invalid code -- missing end-of-block",w.mode=30;break}if(w.lenbits=9,G={bits:w.lenbits},Q=u(d,w.lens,0,w.nlen,w.lencode,0,w.work,G),w.lenbits=G.bits,Q){j.msg="invalid literal/lengths set",w.mode=30;break}if(w.distbits=6,w.distcode=w.distdyn,G={bits:w.distbits},Q=u(f,w.lens,w.nlen,w.ndist,w.distcode,0,w.work,G),w.distbits=G.bits,Q){j.msg="invalid distances set",w.mode=30;break}if(w.mode=20,D===6)break e;case 20:w.mode=21;case 21:if(6<=q&&258<=A){j.next_out=F,j.avail_out=A,j.next_in=L,j.avail_in=q,w.hold=Z,w.bits=W,c(j,se),F=j.next_out,U=j.output,A=j.avail_out,L=j.next_in,M=j.input,q=j.avail_in,Z=w.hold,W=w.bits,w.mode===12&&(w.back=-1);break}for(w.back=0;de=(P=w.lencode[Z&(1<<w.lenbits)-1])>>>16&255,fe=65535&P,!((ne=P>>>24)<=W);){if(q===0)break e;q--,Z+=M[L++]<<W,W+=8}if(de&&(240&de)==0){for(he=ne,we=de,Me=fe;de=(P=w.lencode[Me+((Z&(1<<he+we)-1)>>he)])>>>16&255,fe=65535&P,!(he+(ne=P>>>24)<=W);){if(q===0)break e;q--,Z+=M[L++]<<W,W+=8}Z>>>=he,W-=he,w.back+=he}if(Z>>>=ne,W-=ne,w.back+=ne,w.length=fe,de===0){w.mode=26;break}if(32&de){w.back=-1,w.mode=12;break}if(64&de){j.msg="invalid literal/length code",w.mode=30;break}w.extra=15&de,w.mode=22;case 22:if(w.extra){for(O=w.extra;W<O;){if(q===0)break e;q--,Z+=M[L++]<<W,W+=8}w.length+=Z&(1<<w.extra)-1,Z>>>=w.extra,W-=w.extra,w.back+=w.extra}w.was=w.length,w.mode=23;case 23:for(;de=(P=w.distcode[Z&(1<<w.distbits)-1])>>>16&255,fe=65535&P,!((ne=P>>>24)<=W);){if(q===0)break e;q--,Z+=M[L++]<<W,W+=8}if((240&de)==0){for(he=ne,we=de,Me=fe;de=(P=w.distcode[Me+((Z&(1<<he+we)-1)>>he)])>>>16&255,fe=65535&P,!(he+(ne=P>>>24)<=W);){if(q===0)break e;q--,Z+=M[L++]<<W,W+=8}Z>>>=he,W-=he,w.back+=he}if(Z>>>=ne,W-=ne,w.back+=ne,64&de){j.msg="invalid distance code",w.mode=30;break}w.offset=fe,w.extra=15&de,w.mode=24;case 24:if(w.extra){for(O=w.extra;W<O;){if(q===0)break e;q--,Z+=M[L++]<<W,W+=8}w.offset+=Z&(1<<w.extra)-1,Z>>>=w.extra,W-=w.extra,w.back+=w.extra}if(w.offset>w.dmax){j.msg="invalid distance too far back",w.mode=30;break}w.mode=25;case 25:if(A===0)break e;if(ee=se-A,w.offset>ee){if((ee=w.offset-ee)>w.whave&&w.sane){j.msg="invalid distance too far back",w.mode=30;break}pe=ee>w.wnext?(ee-=w.wnext,w.wsize-ee):w.wnext-ee,ee>w.length&&(ee=w.length),le=w.window}else le=U,pe=F-w.offset,ee=w.length;for(A<ee&&(ee=A),A-=ee,w.length-=ee;U[F++]=le[pe++],--ee;);w.length===0&&(w.mode=21);break;case 26:if(A===0)break e;U[F++]=w.length,A--,w.mode=21;break;case 27:if(w.wrap){for(;W<32;){if(q===0)break e;q--,Z|=M[L++]<<W,W+=8}if(se-=A,j.total_out+=se,w.total+=se,se&&(j.adler=w.check=w.flags?a(w.check,U,se,F-se):i(w.check,U,se,F-se)),se=A,(w.flags?Z:b(Z))!==w.check){j.msg="incorrect data check",w.mode=30;break}W=Z=0}w.mode=28;case 28:if(w.wrap&&w.flags){for(;W<32;){if(q===0)break e;q--,Z+=M[L++]<<W,W+=8}if(Z!==(4294967295&w.total)){j.msg="incorrect length check",w.mode=30;break}W=Z=0}w.mode=29;case 29:Q=1;break e;case 30:Q=-3;break e;case 31:return-4;default:return h}return j.next_out=F,j.avail_out=A,j.next_in=L,j.avail_in=q,w.hold=Z,w.bits=W,(w.wsize||se!==j.avail_out&&w.mode<30&&(w.mode<27||D!==4))&&$(j,j.output,j.next_out,se-j.avail_out)?(w.mode=31,-4):(I-=j.avail_in,se-=j.avail_out,j.total_in+=I,j.total_out+=se,w.total+=se,w.wrap&&se&&(j.adler=w.check=w.flags?a(w.check,U,se,j.next_out-se):i(w.check,U,se,j.next_out-se)),j.data_type=w.bits+(w.last?64:0)+(w.mode===12?128:0)+(w.mode===20||w.mode===15?256:0),(I==0&&se===0||D===4)&&Q===p&&(Q=-5),Q)},o.inflateEnd=function(j){if(!j||!j.state)return h;var D=j.state;return D.window&&(D.window=null),j.state=null,p},o.inflateGetHeader=function(j,D){var w;return j&&j.state?(2&(w=j.state).wrap)==0?h:((w.head=D).done=!1,p):h},o.inflateSetDictionary=function(j,D){var w,M=D.length;return j&&j.state?(w=j.state).wrap!==0&&w.mode!==11?h:w.mode===11&&i(1,D,M,0)!==w.check?-3:$(j,D,M,M)?(w.mode=31,-4):(w.havedict=1,p):h},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,p,h,g,m,x,b){var v,k,S,C,E,N,z,T,R,$=b.bits,j=0,D=0,w=0,M=0,U=0,L=0,F=0,q=0,A=0,Z=0,W=null,I=0,se=new s.Buf16(16),ee=new s.Buf16(16),pe=null,le=0;for(j=0;j<=15;j++)se[j]=0;for(D=0;D<h;D++)se[f[p+D]]++;for(U=$,M=15;1<=M&&se[M]===0;M--);if(M<U&&(U=M),M===0)return g[m++]=20971520,g[m++]=20971520,b.bits=1,0;for(w=1;w<M&&se[w]===0;w++);for(U<w&&(U=w),j=q=1;j<=15;j++)if(q<<=1,(q-=se[j])<0)return-1;if(0<q&&(d===0||M!==1))return-1;for(ee[1]=0,j=1;j<15;j++)ee[j+1]=ee[j]+se[j];for(D=0;D<h;D++)f[p+D]!==0&&(x[ee[f[p+D]]++]=D);if(N=d===0?(W=pe=x,19):d===1?(W=i,I-=257,pe=a,le-=257,256):(W=c,pe=u,-1),j=w,E=m,F=D=Z=0,S=-1,C=(A=1<<(L=U))-1,d===1&&852<A||d===2&&592<A)return 1;for(;;){for(z=j-F,R=x[D]<N?(T=0,x[D]):x[D]>N?(T=pe[le+x[D]],W[I+x[D]]):(T=96,0),v=1<<j-F,w=k=1<<L;g[E+(Z>>F)+(k-=v)]=z<<24|T<<16|R|0,k!==0;);for(v=1<<j-1;Z&v;)v>>=1;if(v!==0?(Z&=v-1,Z+=v):Z=0,D++,--se[j]==0){if(j===M)break;j=f[p+x[D]]}if(U<j&&(Z&C)!==S){for(F===0&&(F=U),E+=w,q=1<<(L=j-F);L+F<M&&!((q-=se[L+F])<=0);)L++,q<<=1;if(A+=1<<L,d===1&&852<A||d===2&&592<A)return 1;g[S=Z&C]=U<<24|L<<16|E-m|0}}return Z!==0&&(g[E+Z]=j-F<<24|64<<16|0),b.bits=U,0}},{"../utils/common":41}],51:[function(n,r,o){r.exports={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"}},{}],52:[function(n,r,o){var s=n("../utils/common"),i=0,a=1;function c(P){for(var H=P.length;0<=--H;)P[H]=0}var u=0,d=29,f=256,p=f+1+d,h=30,g=19,m=2*p+1,x=15,b=16,v=7,k=256,S=16,C=17,E=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],z=[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],T=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],R=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],$=new Array(2*(p+2));c($);var j=new Array(2*h);c(j);var D=new Array(512);c(D);var w=new Array(256);c(w);var M=new Array(d);c(M);var U,L,F,q=new Array(h);function A(P,H,oe,ie,K){this.static_tree=P,this.extra_bits=H,this.extra_base=oe,this.elems=ie,this.max_length=K,this.has_stree=P&&P.length}function Z(P,H){this.dyn_tree=P,this.max_code=0,this.stat_desc=H}function W(P){return P<256?D[P]:D[256+(P>>>7)]}function I(P,H){P.pending_buf[P.pending++]=255&H,P.pending_buf[P.pending++]=H>>>8&255}function se(P,H,oe){P.bi_valid>b-oe?(P.bi_buf|=H<<P.bi_valid&65535,I(P,P.bi_buf),P.bi_buf=H>>b-P.bi_valid,P.bi_valid+=oe-b):(P.bi_buf|=H<<P.bi_valid&65535,P.bi_valid+=oe)}function ee(P,H,oe){se(P,oe[2*H],oe[2*H+1])}function pe(P,H){for(var oe=0;oe|=1&P,P>>>=1,oe<<=1,0<--H;);return oe>>>1}function le(P,H,oe){var ie,K,J=new Array(x+1),re=0;for(ie=1;ie<=x;ie++)J[ie]=re=re+oe[ie-1]<<1;for(K=0;K<=H;K++){var te=P[2*K+1];te!==0&&(P[2*K]=pe(J[te]++,te))}}function ne(P){var H;for(H=0;H<p;H++)P.dyn_ltree[2*H]=0;for(H=0;H<h;H++)P.dyn_dtree[2*H]=0;for(H=0;H<g;H++)P.bl_tree[2*H]=0;P.dyn_ltree[2*k]=1,P.opt_len=P.static_len=0,P.last_lit=P.matches=0}function de(P){8<P.bi_valid?I(P,P.bi_buf):0<P.bi_valid&&(P.pending_buf[P.pending++]=P.bi_buf),P.bi_buf=0,P.bi_valid=0}function fe(P,H,oe,ie){var K=2*H,J=2*oe;return P[K]<P[J]||P[K]===P[J]&&ie[H]<=ie[oe]}function he(P,H,oe){for(var ie=P.heap[oe],K=oe<<1;K<=P.heap_len&&(K<P.heap_len&&fe(H,P.heap[K+1],P.heap[K],P.depth)&&K++,!fe(H,ie,P.heap[K],P.depth));)P.heap[oe]=P.heap[K],oe=K,K<<=1;P.heap[oe]=ie}function we(P,H,oe){var ie,K,J,re,te=0;if(P.last_lit!==0)for(;ie=P.pending_buf[P.d_buf+2*te]<<8|P.pending_buf[P.d_buf+2*te+1],K=P.pending_buf[P.l_buf+te],te++,ie===0?ee(P,K,H):(ee(P,(J=w[K])+f+1,H),(re=N[J])!==0&&se(P,K-=M[J],re),ee(P,J=W(--ie),oe),(re=z[J])!==0&&se(P,ie-=q[J],re)),te<P.last_lit;);ee(P,k,H)}function Me(P,H){var oe,ie,K,J=H.dyn_tree,re=H.stat_desc.static_tree,te=H.stat_desc.has_stree,B=H.stat_desc.elems,Y=-1;for(P.heap_len=0,P.heap_max=m,oe=0;oe<B;oe++)J[2*oe]!==0?(P.heap[++P.heap_len]=Y=oe,P.depth[oe]=0):J[2*oe+1]=0;for(;P.heap_len<2;)J[2*(K=P.heap[++P.heap_len]=Y<2?++Y:0)]=1,P.depth[K]=0,P.opt_len--,te&&(P.static_len-=re[2*K+1]);for(H.max_code=Y,oe=P.heap_len>>1;1<=oe;oe--)he(P,J,oe);for(K=B;oe=P.heap[1],P.heap[1]=P.heap[P.heap_len--],he(P,J,1),ie=P.heap[1],P.heap[--P.heap_max]=oe,P.heap[--P.heap_max]=ie,J[2*K]=J[2*oe]+J[2*ie],P.depth[K]=(P.depth[oe]>=P.depth[ie]?P.depth[oe]:P.depth[ie])+1,J[2*oe+1]=J[2*ie+1]=K,P.heap[1]=K++,he(P,J,1),2<=P.heap_len;);P.heap[--P.heap_max]=P.heap[1],(function(ce,ke){var ze,Je,ft,Ie,Nt,Ut,We=ke.dyn_tree,Vt=ke.max_code,kt=ke.stat_desc.static_tree,um=ke.stat_desc.has_stree,dm=ke.stat_desc.extra_bits,Va=ke.stat_desc.extra_base,ar=ke.stat_desc.max_length,Br=0;for(Ie=0;Ie<=x;Ie++)ce.bl_count[Ie]=0;for(We[2*ce.heap[ce.heap_max]+1]=0,ze=ce.heap_max+1;ze<m;ze++)ar<(Ie=We[2*We[2*(Je=ce.heap[ze])+1]+1]+1)&&(Ie=ar,Br++),We[2*Je+1]=Ie,Vt<Je||(ce.bl_count[Ie]++,Nt=0,Va<=Je&&(Nt=dm[Je-Va]),Ut=We[2*Je],ce.opt_len+=Ut*(Ie+Nt),um&&(ce.static_len+=Ut*(kt[2*Je+1]+Nt)));if(Br!==0){do{for(Ie=ar-1;ce.bl_count[Ie]===0;)Ie--;ce.bl_count[Ie]--,ce.bl_count[Ie+1]+=2,ce.bl_count[ar]--,Br-=2}while(0<Br);for(Ie=ar;Ie!==0;Ie--)for(Je=ce.bl_count[Ie];Je!==0;)Vt<(ft=ce.heap[--ze])||(We[2*ft+1]!==Ie&&(ce.opt_len+=(Ie-We[2*ft+1])*We[2*ft],We[2*ft+1]=Ie),Je--)}})(P,H),le(J,Y,P.bl_count)}function _(P,H,oe){var ie,K,J=-1,re=H[1],te=0,B=7,Y=4;for(re===0&&(B=138,Y=3),H[2*(oe+1)+1]=65535,ie=0;ie<=oe;ie++)K=re,re=H[2*(ie+1)+1],++te<B&&K===re||(te<Y?P.bl_tree[2*K]+=te:K!==0?(K!==J&&P.bl_tree[2*K]++,P.bl_tree[2*S]++):te<=10?P.bl_tree[2*C]++:P.bl_tree[2*E]++,J=K,Y=(te=0)===re?(B=138,3):K===re?(B=6,3):(B=7,4))}function Q(P,H,oe){var ie,K,J=-1,re=H[1],te=0,B=7,Y=4;for(re===0&&(B=138,Y=3),ie=0;ie<=oe;ie++)if(K=re,re=H[2*(ie+1)+1],!(++te<B&&K===re)){if(te<Y)for(;ee(P,K,P.bl_tree),--te!=0;);else K!==0?(K!==J&&(ee(P,K,P.bl_tree),te--),ee(P,S,P.bl_tree),se(P,te-3,2)):te<=10?(ee(P,C,P.bl_tree),se(P,te-3,3)):(ee(P,E,P.bl_tree),se(P,te-11,7));J=K,Y=(te=0)===re?(B=138,3):K===re?(B=6,3):(B=7,4)}}c(q);var G=!1;function O(P,H,oe,ie){se(P,(u<<1)+(ie?1:0),3),(function(K,J,re,te){de(K),I(K,re),I(K,~re),s.arraySet(K.pending_buf,K.window,J,re,K.pending),K.pending+=re})(P,H,oe)}o._tr_init=function(P){G||((function(){var H,oe,ie,K,J,re=new Array(x+1);for(K=ie=0;K<d-1;K++)for(M[K]=ie,H=0;H<1<<N[K];H++)w[ie++]=K;for(w[ie-1]=K,K=J=0;K<16;K++)for(q[K]=J,H=0;H<1<<z[K];H++)D[J++]=K;for(J>>=7;K<h;K++)for(q[K]=J<<7,H=0;H<1<<z[K]-7;H++)D[256+J++]=K;for(oe=0;oe<=x;oe++)re[oe]=0;for(H=0;H<=143;)$[2*H+1]=8,H++,re[8]++;for(;H<=255;)$[2*H+1]=9,H++,re[9]++;for(;H<=279;)$[2*H+1]=7,H++,re[7]++;for(;H<=287;)$[2*H+1]=8,H++,re[8]++;for(le($,p+1,re),H=0;H<h;H++)j[2*H+1]=5,j[2*H]=pe(H,5);U=new A($,N,f+1,p,x),L=new A(j,z,0,h,x),F=new A(new Array(0),T,0,g,v)})(),G=!0),P.l_desc=new Z(P.dyn_ltree,U),P.d_desc=new Z(P.dyn_dtree,L),P.bl_desc=new Z(P.bl_tree,F),P.bi_buf=0,P.bi_valid=0,ne(P)},o._tr_stored_block=O,o._tr_flush_block=function(P,H,oe,ie){var K,J,re=0;0<P.level?(P.strm.data_type===2&&(P.strm.data_type=(function(te){var B,Y=4093624447;for(B=0;B<=31;B++,Y>>>=1)if(1&Y&&te.dyn_ltree[2*B]!==0)return i;if(te.dyn_ltree[18]!==0||te.dyn_ltree[20]!==0||te.dyn_ltree[26]!==0)return a;for(B=32;B<f;B++)if(te.dyn_ltree[2*B]!==0)return a;return i})(P)),Me(P,P.l_desc),Me(P,P.d_desc),re=(function(te){var B;for(_(te,te.dyn_ltree,te.l_desc.max_code),_(te,te.dyn_dtree,te.d_desc.max_code),Me(te,te.bl_desc),B=g-1;3<=B&&te.bl_tree[2*R[B]+1]===0;B--);return te.opt_len+=3*(B+1)+5+5+4,B})(P),K=P.opt_len+3+7>>>3,(J=P.static_len+3+7>>>3)<=K&&(K=J)):K=J=oe+5,oe+4<=K&&H!==-1?O(P,H,oe,ie):P.strategy===4||J===K?(se(P,2+(ie?1:0),3),we(P,$,j)):(se(P,4+(ie?1:0),3),(function(te,B,Y,ce){var ke;for(se(te,B-257,5),se(te,Y-1,5),se(te,ce-4,4),ke=0;ke<ce;ke++)se(te,te.bl_tree[2*R[ke]+1],3);Q(te,te.dyn_ltree,B-1),Q(te,te.dyn_dtree,Y-1)})(P,P.l_desc.max_code+1,P.d_desc.max_code+1,re+1),we(P,P.dyn_ltree,P.dyn_dtree)),ne(P),ie&&de(P)},o._tr_tally=function(P,H,oe){return P.pending_buf[P.d_buf+2*P.last_lit]=H>>>8&255,P.pending_buf[P.d_buf+2*P.last_lit+1]=255&H,P.pending_buf[P.l_buf+P.last_lit]=255&oe,P.last_lit++,H===0?P.dyn_ltree[2*oe]++:(P.matches++,H--,P.dyn_ltree[2*(w[oe]+f+1)]++,P.dyn_dtree[2*W(H)]++),P.last_lit===P.lit_bufsize-1},o._tr_align=function(P){se(P,2,3),ee(P,k,$),(function(H){H.bi_valid===16?(I(H,H.bi_buf),H.bi_buf=0,H.bi_valid=0):8<=H.bi_valid&&(H.pending_buf[H.pending++]=255&H.bi_buf,H.bi_buf>>=8,H.bi_valid-=8)})(P)}},{"../utils/common":41}],53:[function(n,r,o){r.exports=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}},{}],54:[function(n,r,o){(function(s){(function(i,a){if(!i.setImmediate){var c,u,d,f,p=1,h={},g=!1,m=i.document,x=Object.getPrototypeOf&&Object.getPrototypeOf(i);x=x&&x.setTimeout?x: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)},x.setImmediate=function(S){typeof S!="function"&&(S=new Function(""+S));for(var C=new Array(arguments.length-1),E=0;E<C.length;E++)C[E]=arguments[E+1];var N={callback:S,args:C};return h[p]=N,c(p),p++},x.clearImmediate=b}function b(S){delete h[S]}function v(S){if(g)setTimeout(v,0,S);else{var C=h[S];if(C){g=!0;try{(function(E){var N=E.callback,z=E.args;switch(z.length){case 0:N();break;case 1:N(z[0]);break;case 2:N(z[0],z[1]);break;case 3:N(z[0],z[1],z[2]);break;default:N.apply(a,z)}})(C)}finally{b(S),g=!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 Ur<"u"?Ur:typeof self<"u"?self:typeof window<"u"?window:{})},{}]},{},[10])(10)})})(ms)),ms.exports}var Ov=Rv();const Mv=Pi(Ov);async function Dv(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}}async function Lv(e){const t=new Mv;for(const i of e)i.rawRequestBody!==null&&t.file(`#${i.id}.Request.json`,i.rawRequestBody),i.responseText!==null&&t.file(`#${i.id}.Response.json`,i.responseText);const n=e.filter(i=>i.streaming);await Promise.allSettled(n.map(async i=>{const a=await Dv(i.id);a!==null&&t.file(`#${i.id}.SSE.Response.json`,a)}));const r=await t.generateAsync({type:"blob"}),o=URL.createObjectURL(r),s=document.createElement("a");s.href=o,s.download=`agent-inspector-export-${new Date().toISOString().slice(0,10)}.zip`,document.body.appendChild(s),s.click(),document.body.removeChild(s),URL.revokeObjectURL(o)}function ni(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 qi(e,t,n){return`${ni(e,n)} - ${ni(t,n)}`}function pd(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=pd(e[t]))&&(r&&(r+=" "),r+=n)}else for(n in e)e[n]&&(r&&(r+=" "),r+=n);return r}function md(){for(var e,t,n=0,r="",o=arguments.length;n<o;n++)(e=arguments[n])&&(t=pd(e))&&(r&&(r+=" "),r+=t);return r}const Fv=(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},$v=(e,t)=>({classGroupId:e,validator:t}),gd=(e=new Map,t=null,n)=>({nextPart:e,validators:t,classGroupId:n}),vo="-",xl=[],Bv="arbitrary..",Uv=e=>{const t=Hv(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=e;return{getClassGroupId:i=>{if(i.startsWith("[")&&i.endsWith("]"))return Vv(i);const a=i.split(vo),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?Fv(u,c):c:u||xl}return n[i]||xl}}},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(vo):e.slice(t).join(vo),c=i.length;for(let u=0;u<c;u++){const d=i[u];if(d.validator(a))return d.classGroupId}},Vv=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?Bv+r:void 0})(),Hv=e=>{const{theme:t,classGroups:n}=e;return Zv(n,t)},Zv=(e,t)=>{const n=gd();for(const r in e){const o=e[r];Ji(o,n,r,t)}return n},Ji=(e,t,n,r)=>{const o=e.length;for(let s=0;s<o;s++){const i=e[s];Wv(i,t,n,r)}},Wv=(e,t,n,r)=>{if(typeof e=="string"){qv(e,t,n);return}if(typeof e=="function"){Jv(e,t,n,r);return}Kv(e,t,n,r)},qv=(e,t,n)=>{const r=e===""?t:yd(t,e);r.classGroupId=n},Jv=(e,t,n,r)=>{if(Gv(e)){Ji(e(r),t,n,r);return}t.validators===null&&(t.validators=[]),t.validators.push($v(n,e))},Kv=(e,t,n,r)=>{const o=Object.entries(e),s=o.length;for(let i=0;i<s;i++){const[a,c]=o[i];Ji(c,yd(t,a),n,r)}},yd=(e,t)=>{let n=e;const r=t.split(vo),o=r.length;for(let s=0;s<o;s++){const i=r[s];let a=n.nextPart.get(i);a||(a=gd(),n.nextPart.set(i,a)),n=a}return n},Gv=e=>"isThemeGetter"in e&&e.isThemeGetter===!0,Yv=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)}}},ri="!",yl=":",Xv=[],bl=(e,t,n,r,o)=>({modifiers:e,hasImportantModifier:t,baseClassName:n,maybePostfixModifierPosition:r,isExternal:o}),Qv=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 x=o[m];if(i===0&&a===0){if(x===yl){s.push(o.slice(c,m)),c=m+1;continue}if(x==="/"){u=m;continue}}x==="["?i++:x==="]"?i--:x==="("?a++:x===")"&&a--}const f=s.length===0?o:o.slice(c);let p=f,h=!1;f.endsWith(ri)?(p=f.slice(0,-1),h=!0):f.startsWith(ri)&&(p=f.slice(1),h=!0);const g=u&&u>c?u-c:void 0;return bl(s,h,p,g)};if(t){const o=t+yl,s=r;r=i=>i.startsWith(o)?s(i.slice(o.length)):bl(Xv,!1,i,void 0,!0)}if(n){const o=r;r=s=>n({className:s,parseClassName:o})}return r},e2=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}},t2=e=>({cache:Yv(e.cacheSize),parseClassName:Qv(e),sortModifiers:e2(e),...Uv(e)}),n2=/\s+/,r2=(e,t)=>{const{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:o,sortModifiers:s}=t,i=[],a=e.trim().split(n2);let c="";for(let u=a.length-1;u>=0;u-=1){const d=a[u],{isExternal:f,modifiers:p,hasImportantModifier:h,baseClassName:g,maybePostfixModifierPosition:m}=n(d);if(f){c=d+(c.length>0?" "+c:c);continue}let x=!!m,b=r(x?g.substring(0,m):g);if(!b){if(!x){c=d+(c.length>0?" "+c:c);continue}if(b=r(g),!b){c=d+(c.length>0?" "+c:c);continue}x=!1}const v=p.length===0?"":p.length===1?p[0]:s(p).join(":"),k=h?v+ri:v,S=k+b;if(i.indexOf(S)>-1)continue;i.push(S);const C=o(b,x);for(let E=0;E<C.length;++E){const N=C[E];i.push(k+N)}c=d+(c.length>0?" "+c:c)}return c},o2=(...e)=>{let t=0,n,r,o="";for(;t<e.length;)(n=e[t++])&&(r=bd(n))&&(o&&(o+=" "),o+=r);return o},bd=e=>{if(typeof e=="string")return e;let t,n="";for(let r=0;r<e.length;r++)e[r]&&(t=bd(e[r]))&&(n&&(n+=" "),n+=t);return n},s2=(e,...t)=>{let n,r,o,s;const i=c=>{const u=t.reduce((d,f)=>f(d),e());return n=t2(u),r=n.cache.get,o=n.cache.set,s=a,a(c)},a=c=>{const u=r(c);if(u)return u;const d=r2(c,n);return o(c,d),d};return s=i,(...c)=>s(o2(...c))},i2=[],Ye=e=>{const t=n=>n[e]||i2;return t.isThemeGetter=!0,t},vd=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,wd=/^\((?:(\w[\w-]*):)?(.+)\)$/i,a2=/^\d+\/\d+$/,l2=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,c2=/\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$/,u2=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,d2=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,f2=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Nn=e=>a2.test(e),Te=e=>!!e&&!Number.isNaN(Number(e)),Xt=e=>!!e&&Number.isInteger(Number(e)),gs=e=>e.endsWith("%")&&Te(e.slice(0,-1)),Ht=e=>l2.test(e),h2=()=>!0,p2=e=>c2.test(e)&&!u2.test(e),kd=()=>!1,m2=e=>d2.test(e),g2=e=>f2.test(e),x2=e=>!me(e)&&!ge(e),y2=e=>Qn(e,Cd,kd),me=e=>vd.test(e),pn=e=>Qn(e,jd,p2),xs=e=>Qn(e,_2,Te),vl=e=>Qn(e,_d,kd),b2=e=>Qn(e,Sd,g2),qr=e=>Qn(e,Ed,m2),ge=e=>wd.test(e),lr=e=>er(e,jd),v2=e=>er(e,S2),wl=e=>er(e,_d),w2=e=>er(e,Cd),k2=e=>er(e,Sd),Jr=e=>er(e,Ed,!0),Qn=(e,t,n)=>{const r=vd.exec(e);return r?r[1]?t(r[1]):n(r[2]):!1},er=(e,t,n=!1)=>{const r=wd.exec(e);return r?r[1]?t(r[1]):n:!1},_d=e=>e==="position"||e==="percentage",Sd=e=>e==="image"||e==="url",Cd=e=>e==="length"||e==="size"||e==="bg-size",jd=e=>e==="length",_2=e=>e==="number",S2=e=>e==="family-name",Ed=e=>e==="shadow",C2=()=>{const e=Ye("color"),t=Ye("font"),n=Ye("text"),r=Ye("font-weight"),o=Ye("tracking"),s=Ye("leading"),i=Ye("breakpoint"),a=Ye("container"),c=Ye("spacing"),u=Ye("radius"),d=Ye("shadow"),f=Ye("inset-shadow"),p=Ye("text-shadow"),h=Ye("drop-shadow"),g=Ye("blur"),m=Ye("perspective"),x=Ye("aspect"),b=Ye("ease"),v=Ye("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(),ge,me],E=()=>["auto","hidden","clip","visible","scroll"],N=()=>["auto","contain","none"],z=()=>[ge,me,c],T=()=>[Nn,"full","auto",...z()],R=()=>[Xt,"none","subgrid",ge,me],$=()=>["auto",{span:["full",Xt,ge,me]},Xt,ge,me],j=()=>[Xt,"auto",ge,me],D=()=>["auto","min","max","fr",ge,me],w=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],M=()=>["start","end","center","stretch","center-safe","end-safe"],U=()=>["auto",...z()],L=()=>[Nn,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...z()],F=()=>[e,ge,me],q=()=>[...S(),wl,vl,{position:[ge,me]}],A=()=>["no-repeat",{repeat:["","x","y","space","round"]}],Z=()=>["auto","cover","contain",w2,y2,{size:[ge,me]}],W=()=>[gs,lr,pn],I=()=>["","none","full",u,ge,me],se=()=>["",Te,lr,pn],ee=()=>["solid","dashed","dotted","double"],pe=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],le=()=>[Te,gs,wl,vl],ne=()=>["","none",g,ge,me],de=()=>["none",Te,ge,me],fe=()=>["none",Te,ge,me],he=()=>[Te,ge,me],we=()=>[Nn,"full",...z()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[Ht],breakpoint:[Ht],color:[h2],container:[Ht],"drop-shadow":[Ht],ease:["in","out","in-out"],font:[x2],"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",Nn,me,ge,x]}],container:["container"],columns:[{columns:[Te,me,ge,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:E()}],"overflow-x":[{"overflow-x":E()}],"overflow-y":[{"overflow-y":E()}],overscroll:[{overscroll:N()}],"overscroll-x":[{"overscroll-x":N()}],"overscroll-y":[{"overscroll-y":N()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:T()}],"inset-x":[{"inset-x":T()}],"inset-y":[{"inset-y":T()}],start:[{start:T()}],end:[{end:T()}],top:[{top:T()}],right:[{right:T()}],bottom:[{bottom:T()}],left:[{left:T()}],visibility:["visible","invisible","collapse"],z:[{z:[Xt,"auto",ge,me]}],basis:[{basis:[Nn,"full","auto",a,...z()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[Te,Nn,"auto","initial","none",me]}],grow:[{grow:["",Te,ge,me]}],shrink:[{shrink:["",Te,ge,me]}],order:[{order:[Xt,"first","last","none",ge,me]}],"grid-cols":[{"grid-cols":R()}],"col-start-end":[{col:$()}],"col-start":[{"col-start":j()}],"col-end":[{"col-end":j()}],"grid-rows":[{"grid-rows":R()}],"row-start-end":[{row:$()}],"row-start":[{"row-start":j()}],"row-end":[{"row-end":j()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":D()}],"auto-rows":[{"auto-rows":D()}],gap:[{gap:z()}],"gap-x":[{"gap-x":z()}],"gap-y":[{"gap-y":z()}],"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:z()}],px:[{px:z()}],py:[{py:z()}],ps:[{ps:z()}],pe:[{pe:z()}],pt:[{pt:z()}],pr:[{pr:z()}],pb:[{pb:z()}],pl:[{pl:z()}],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":z()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":z()}],"space-y-reverse":["space-y-reverse"],size:[{size:L()}],w:[{w:[a,"screen",...L()]}],"min-w":[{"min-w":[a,"screen","none",...L()]}],"max-w":[{"max-w":[a,"screen","none","prose",{screen:[i]},...L()]}],h:[{h:["screen","lh",...L()]}],"min-h":[{"min-h":["screen","lh","none",...L()]}],"max-h":[{"max-h":["screen","lh",...L()]}],"font-size":[{text:["base",n,lr,pn]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[r,ge,xs]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",gs,me]}],"font-family":[{font:[v2,me,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,ge,me]}],"line-clamp":[{"line-clamp":[Te,"none",ge,xs]}],leading:[{leading:[s,...z()]}],"list-image":[{"list-image":["none",ge,me]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",ge,me]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:F()}],"text-color":[{text:F()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...ee(),"wavy"]}],"text-decoration-thickness":[{decoration:[Te,"from-font","auto",ge,pn]}],"text-decoration-color":[{decoration:F()}],"underline-offset":[{"underline-offset":[Te,"auto",ge,me]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:z()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",ge,me]}],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",ge,me]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:q()}],"bg-repeat":[{bg:A()}],"bg-size":[{bg:Z()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},Xt,ge,me],radial:["",ge,me],conic:[Xt,ge,me]},k2,b2]}],"bg-color":[{bg:F()}],"gradient-from-pos":[{from:W()}],"gradient-via-pos":[{via:W()}],"gradient-to-pos":[{to:W()}],"gradient-from":[{from:F()}],"gradient-via":[{via:F()}],"gradient-to":[{to:F()}],rounded:[{rounded:I()}],"rounded-s":[{"rounded-s":I()}],"rounded-e":[{"rounded-e":I()}],"rounded-t":[{"rounded-t":I()}],"rounded-r":[{"rounded-r":I()}],"rounded-b":[{"rounded-b":I()}],"rounded-l":[{"rounded-l":I()}],"rounded-ss":[{"rounded-ss":I()}],"rounded-se":[{"rounded-se":I()}],"rounded-ee":[{"rounded-ee":I()}],"rounded-es":[{"rounded-es":I()}],"rounded-tl":[{"rounded-tl":I()}],"rounded-tr":[{"rounded-tr":I()}],"rounded-br":[{"rounded-br":I()}],"rounded-bl":[{"rounded-bl":I()}],"border-w":[{border:se()}],"border-w-x":[{"border-x":se()}],"border-w-y":[{"border-y":se()}],"border-w-s":[{"border-s":se()}],"border-w-e":[{"border-e":se()}],"border-w-t":[{"border-t":se()}],"border-w-r":[{"border-r":se()}],"border-w-b":[{"border-b":se()}],"border-w-l":[{"border-l":se()}],"divide-x":[{"divide-x":se()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":se()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...ee(),"hidden","none"]}],"divide-style":[{divide:[...ee(),"hidden","none"]}],"border-color":[{border:F()}],"border-color-x":[{"border-x":F()}],"border-color-y":[{"border-y":F()}],"border-color-s":[{"border-s":F()}],"border-color-e":[{"border-e":F()}],"border-color-t":[{"border-t":F()}],"border-color-r":[{"border-r":F()}],"border-color-b":[{"border-b":F()}],"border-color-l":[{"border-l":F()}],"divide-color":[{divide:F()}],"outline-style":[{outline:[...ee(),"none","hidden"]}],"outline-offset":[{"outline-offset":[Te,ge,me]}],"outline-w":[{outline:["",Te,lr,pn]}],"outline-color":[{outline:F()}],shadow:[{shadow:["","none",d,Jr,qr]}],"shadow-color":[{shadow:F()}],"inset-shadow":[{"inset-shadow":["none",f,Jr,qr]}],"inset-shadow-color":[{"inset-shadow":F()}],"ring-w":[{ring:se()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:F()}],"ring-offset-w":[{"ring-offset":[Te,pn]}],"ring-offset-color":[{"ring-offset":F()}],"inset-ring-w":[{"inset-ring":se()}],"inset-ring-color":[{"inset-ring":F()}],"text-shadow":[{"text-shadow":["none",p,Jr,qr]}],"text-shadow-color":[{"text-shadow":F()}],opacity:[{opacity:[Te,ge,me]}],"mix-blend":[{"mix-blend":[...pe(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":pe()}],"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":le()}],"mask-image-linear-to-pos":[{"mask-linear-to":le()}],"mask-image-linear-from-color":[{"mask-linear-from":F()}],"mask-image-linear-to-color":[{"mask-linear-to":F()}],"mask-image-t-from-pos":[{"mask-t-from":le()}],"mask-image-t-to-pos":[{"mask-t-to":le()}],"mask-image-t-from-color":[{"mask-t-from":F()}],"mask-image-t-to-color":[{"mask-t-to":F()}],"mask-image-r-from-pos":[{"mask-r-from":le()}],"mask-image-r-to-pos":[{"mask-r-to":le()}],"mask-image-r-from-color":[{"mask-r-from":F()}],"mask-image-r-to-color":[{"mask-r-to":F()}],"mask-image-b-from-pos":[{"mask-b-from":le()}],"mask-image-b-to-pos":[{"mask-b-to":le()}],"mask-image-b-from-color":[{"mask-b-from":F()}],"mask-image-b-to-color":[{"mask-b-to":F()}],"mask-image-l-from-pos":[{"mask-l-from":le()}],"mask-image-l-to-pos":[{"mask-l-to":le()}],"mask-image-l-from-color":[{"mask-l-from":F()}],"mask-image-l-to-color":[{"mask-l-to":F()}],"mask-image-x-from-pos":[{"mask-x-from":le()}],"mask-image-x-to-pos":[{"mask-x-to":le()}],"mask-image-x-from-color":[{"mask-x-from":F()}],"mask-image-x-to-color":[{"mask-x-to":F()}],"mask-image-y-from-pos":[{"mask-y-from":le()}],"mask-image-y-to-pos":[{"mask-y-to":le()}],"mask-image-y-from-color":[{"mask-y-from":F()}],"mask-image-y-to-color":[{"mask-y-to":F()}],"mask-image-radial":[{"mask-radial":[ge,me]}],"mask-image-radial-from-pos":[{"mask-radial-from":le()}],"mask-image-radial-to-pos":[{"mask-radial-to":le()}],"mask-image-radial-from-color":[{"mask-radial-from":F()}],"mask-image-radial-to-color":[{"mask-radial-to":F()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":S()}],"mask-image-conic-pos":[{"mask-conic":[Te]}],"mask-image-conic-from-pos":[{"mask-conic-from":le()}],"mask-image-conic-to-pos":[{"mask-conic-to":le()}],"mask-image-conic-from-color":[{"mask-conic-from":F()}],"mask-image-conic-to-color":[{"mask-conic-to":F()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:q()}],"mask-repeat":[{mask:A()}],"mask-size":[{mask:Z()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",ge,me]}],filter:[{filter:["","none",ge,me]}],blur:[{blur:ne()}],brightness:[{brightness:[Te,ge,me]}],contrast:[{contrast:[Te,ge,me]}],"drop-shadow":[{"drop-shadow":["","none",h,Jr,qr]}],"drop-shadow-color":[{"drop-shadow":F()}],grayscale:[{grayscale:["",Te,ge,me]}],"hue-rotate":[{"hue-rotate":[Te,ge,me]}],invert:[{invert:["",Te,ge,me]}],saturate:[{saturate:[Te,ge,me]}],sepia:[{sepia:["",Te,ge,me]}],"backdrop-filter":[{"backdrop-filter":["","none",ge,me]}],"backdrop-blur":[{"backdrop-blur":ne()}],"backdrop-brightness":[{"backdrop-brightness":[Te,ge,me]}],"backdrop-contrast":[{"backdrop-contrast":[Te,ge,me]}],"backdrop-grayscale":[{"backdrop-grayscale":["",Te,ge,me]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[Te,ge,me]}],"backdrop-invert":[{"backdrop-invert":["",Te,ge,me]}],"backdrop-opacity":[{"backdrop-opacity":[Te,ge,me]}],"backdrop-saturate":[{"backdrop-saturate":[Te,ge,me]}],"backdrop-sepia":[{"backdrop-sepia":["",Te,ge,me]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":z()}],"border-spacing-x":[{"border-spacing-x":z()}],"border-spacing-y":[{"border-spacing-y":z()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",ge,me]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[Te,"initial",ge,me]}],ease:[{ease:["linear","initial",b,ge,me]}],delay:[{delay:[Te,ge,me]}],animate:[{animate:["none",v,ge,me]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[m,ge,me]}],"perspective-origin":[{"perspective-origin":C()}],rotate:[{rotate:de()}],"rotate-x":[{"rotate-x":de()}],"rotate-y":[{"rotate-y":de()}],"rotate-z":[{"rotate-z":de()}],scale:[{scale:fe()}],"scale-x":[{"scale-x":fe()}],"scale-y":[{"scale-y":fe()}],"scale-z":[{"scale-z":fe()}],"scale-3d":["scale-3d"],skew:[{skew:he()}],"skew-x":[{"skew-x":he()}],"skew-y":[{"skew-y":he()}],transform:[{transform:[ge,me,"","none","gpu","cpu"]}],"transform-origin":[{origin:C()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:we()}],"translate-x":[{"translate-x":we()}],"translate-y":[{"translate-y":we()}],"translate-z":[{"translate-z":we()}],"translate-none":["translate-none"],accent:[{accent:F()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:F()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",ge,me]}],"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":z()}],"scroll-mx":[{"scroll-mx":z()}],"scroll-my":[{"scroll-my":z()}],"scroll-ms":[{"scroll-ms":z()}],"scroll-me":[{"scroll-me":z()}],"scroll-mt":[{"scroll-mt":z()}],"scroll-mr":[{"scroll-mr":z()}],"scroll-mb":[{"scroll-mb":z()}],"scroll-ml":[{"scroll-ml":z()}],"scroll-p":[{"scroll-p":z()}],"scroll-px":[{"scroll-px":z()}],"scroll-py":[{"scroll-py":z()}],"scroll-ps":[{"scroll-ps":z()}],"scroll-pe":[{"scroll-pe":z()}],"scroll-pt":[{"scroll-pt":z()}],"scroll-pr":[{"scroll-pr":z()}],"scroll-pb":[{"scroll-pb":z()}],"scroll-pl":[{"scroll-pl":z()}],"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",ge,me]}],fill:[{fill:["none",...F()]}],"stroke-w":[{stroke:[Te,lr,pn,xs]}],stroke:[{stroke:["none",...F()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}},j2=s2(C2);function ve(...e){return j2(md(e))}function Qe(e){return e>=1e6?(e/1e6).toFixed(1).replace(/\.0$/,"")+"M":(e/1e3).toFixed(1).replace(/\.0$/,"")+"K"}function E2(e){return e===null?"pending":e>=200&&e<300?"success":e>=400&&e<500?"client_error":e>=500?"server_error":"pending"}const N2="2.0.11",T2={version:N2},kl=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,_l=md,Ki=(e,t)=>n=>{var r;if(t?.variants==null)return _l(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 p=kl(d)||kl(f);return o[u][p]}),a=n&&Object.entries(n).reduce((u,d)=>{let[f,p]=d;return p===void 0||(u[f]=p),u},{}),c=t==null||(r=t.compoundVariants)===null||r===void 0?void 0:r.reduce((u,d)=>{let{class:f,className:p,...h}=d;return Object.entries(h).every(g=>{let[m,x]=g;return Array.isArray(x)?x.includes({...s,...a}[m]):{...s,...a}[m]===x})?[...u,f,p]:u},[]);return _l(e,i,c,n?.class,n?.className)};function Sl(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function Nd(...e){return t=>{let n=!1;const r=e.map(o=>{const s=Sl(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():Sl(e[o],null)}}}}function Oe(...e){return y.useCallback(Nd(...e),e)}function Jn(e){const t=z2(e),n=y.forwardRef((r,o)=>{const{children:s,...i}=r,a=y.Children.toArray(s),c=a.find(P2);if(c){const u=c.props.children,d=a.map(f=>f===c?y.Children.count(u)>1?y.Children.only(null):y.isValidElement(u)?u.props.children:null:f);return l.jsx(t,{...i,ref:o,children:y.isValidElement(u)?y.cloneElement(u,void 0,d):null})}return l.jsx(t,{...i,ref:o,children:s})});return n.displayName=`${e}.Slot`,n}var A2=Jn("Slot");function z2(e){const t=y.forwardRef((n,r)=>{const{children:o,...s}=n;if(y.isValidElement(o)){const i=O2(o),a=R2(s,o.props);return o.type!==y.Fragment&&(a.ref=r?Nd(r,i):i),y.cloneElement(o,a)}return y.Children.count(o)>1?y.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var Td=Symbol("radix.slottable");function I2(e){const t=({children:n})=>l.jsx(l.Fragment,{children:n});return t.displayName=`${e}.Slottable`,t.__radixId=Td,t}function P2(e){return y.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===Td}function R2(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 O2(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 M2=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Ne=M2.reduce((e,t)=>{const n=Jn(`Primitive.${t}`),r=y.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 D2(e,t){e&&Ir.flushSync(()=>e.dispatchEvent(t))}var Ad=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"}),L2="VisuallyHidden",zd=y.forwardRef((e,t)=>l.jsx(Ne.span,{...e,ref:t,style:{...Ad,...e.style}}));zd.displayName=L2;var F2=zd;function $2(e,t){const n=y.createContext(t),r=s=>{const{children:i,...a}=s,c=y.useMemo(()=>a,Object.values(a));return l.jsx(n.Provider,{value:c,children:i})};r.displayName=e+"Provider";function o(s){const i=y.useContext(n);if(i)return i;if(t!==void 0)return t;throw new Error(`\`${s}\` must be used within \`${e}\``)}return[r,o]}function Yt(e,t=[]){let n=[];function r(s,i){const a=y.createContext(i),c=n.length;n=[...n,i];const u=f=>{const{scope:p,children:h,...g}=f,m=p?.[e]?.[c]||a,x=y.useMemo(()=>g,Object.values(g));return l.jsx(m.Provider,{value:x,children:h})};u.displayName=s+"Provider";function d(f,p){const h=p?.[e]?.[c]||a,g=y.useContext(h);if(g)return g;if(i!==void 0)return i;throw new Error(`\`${f}\` must be used within \`${s}\``)}return[u,d]}const o=()=>{const s=n.map(i=>y.createContext(i));return function(a){const c=a?.[e]||s;return y.useMemo(()=>({[`__scope${e}`]:{...a,[e]:c}}),[a,c])}};return o.scopeName=e,[r,B2(o,...t)]}function B2(...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 y.useMemo(()=>({[`__scope${t.scopeName}`]:i}),[i])}};return n.scopeName=t.scopeName,n}function Id(e){const t=e+"CollectionProvider",[n,r]=Yt(t),[o,s]=n(t,{collectionRef:{current:null},itemMap:new Map}),i=m=>{const{scope:x,children:b}=m,v=at.useRef(null),k=at.useRef(new Map).current;return l.jsx(o,{scope:x,itemMap:k,collectionRef:v,children:b})};i.displayName=t;const a=e+"CollectionSlot",c=Jn(a),u=at.forwardRef((m,x)=>{const{scope:b,children:v}=m,k=s(a,b),S=Oe(x,k.collectionRef);return l.jsx(c,{ref:S,children:v})});u.displayName=a;const d=e+"CollectionItemSlot",f="data-radix-collection-item",p=Jn(d),h=at.forwardRef((m,x)=>{const{scope:b,children:v,...k}=m,S=at.useRef(null),C=Oe(x,S),E=s(d,b);return at.useEffect(()=>(E.itemMap.set(S,{ref:S,...k}),()=>{E.itemMap.delete(S)})),l.jsx(p,{[f]:"",ref:C,children:v})});h.displayName=d;function g(m){const x=s(e+"CollectionConsumer",m);return at.useCallback(()=>{const v=x.collectionRef.current;if(!v)return[];const k=Array.from(v.querySelectorAll(`[${f}]`));return Array.from(x.itemMap.values()).sort((E,N)=>k.indexOf(E.ref.current)-k.indexOf(N.ref.current))},[x.collectionRef,x.itemMap])}return[{Provider:i,Slot:u,ItemSlot:h},g,r]}function _e(e,t,{checkForDefaultPrevented:n=!0}={}){return function(o){if(e?.(o),n===!1||!o.defaultPrevented)return t?.(o)}}var tt=globalThis?.document?y.useLayoutEffect:()=>{},U2=fu[" useInsertionEffect ".trim().toString()]||tt;function yn({prop:e,defaultProp:t,onChange:n=()=>{},caller:r}){const[o,s,i]=V2({defaultProp:t,onChange:n}),a=e!==void 0,c=a?e:o;{const d=y.useRef(e!==void 0);y.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=y.useCallback(d=>{if(a){const f=H2(d)?d(e):d;f!==e&&i.current?.(f)}else s(d)},[a,e,s,i]);return[c,u]}function V2({defaultProp:e,onChange:t}){const[n,r]=y.useState(e),o=y.useRef(n),s=y.useRef(t);return U2(()=>{s.current=t},[t]),y.useEffect(()=>{o.current!==n&&(s.current?.(n),o.current=n)},[n,o]),[n,r,s]}function H2(e){return typeof e=="function"}function Z2(e,t){return y.useReducer((n,r)=>t[n][r]??n,e)}var bt=e=>{const{present:t,children:n}=e,r=W2(t),o=typeof n=="function"?n({present:r.isPresent}):y.Children.only(n),s=Oe(r.ref,q2(o));return typeof n=="function"||r.isPresent?y.cloneElement(o,{ref:s}):null};bt.displayName="Presence";function W2(e){const[t,n]=y.useState(),r=y.useRef(null),o=y.useRef(e),s=y.useRef("none"),i=e?"mounted":"unmounted",[a,c]=Z2(i,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return y.useEffect(()=>{const u=Kr(r.current);s.current=a==="mounted"?u:"none"},[a]),tt(()=>{const u=r.current,d=o.current;if(d!==e){const p=s.current,h=Kr(u);e?c("MOUNT"):h==="none"||u?.display==="none"?c("UNMOUNT"):c(d&&p!==h?"ANIMATION_OUT":"UNMOUNT"),o.current=e}},[e,c]),tt(()=>{if(t){let u;const d=t.ownerDocument.defaultView??window,f=h=>{const m=Kr(r.current).includes(CSS.escape(h.animationName));if(h.target===t&&m&&(c("ANIMATION_END"),!o.current)){const x=t.style.animationFillMode;t.style.animationFillMode="forwards",u=d.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=x)})}},p=h=>{h.target===t&&(s.current=Kr(r.current))};return t.addEventListener("animationstart",p),t.addEventListener("animationcancel",f),t.addEventListener("animationend",f),()=>{d.clearTimeout(u),t.removeEventListener("animationstart",p),t.removeEventListener("animationcancel",f),t.removeEventListener("animationend",f)}}else c("ANIMATION_END")},[t,c]),{isPresent:["mounted","unmountSuspended"].includes(a),ref:y.useCallback(u=>{r.current=u?getComputedStyle(u):null,n(u)},[])}}function Kr(e){return e?.animationName||"none"}function q2(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 J2=fu[" useId ".trim().toString()]||(()=>{}),K2=0;function Ot(e){const[t,n]=y.useState(J2());return tt(()=>{n(r=>r??String(K2++))},[e]),e||(t?`radix-${t}`:"")}var Ho="Collapsible",[G2]=Yt(Ho),[Y2,Gi]=G2(Ho),Pd=y.forwardRef((e,t)=>{const{__scopeCollapsible:n,open:r,defaultOpen:o,disabled:s,onOpenChange:i,...a}=e,[c,u]=yn({prop:r,defaultProp:o??!1,onChange:i,caller:Ho});return l.jsx(Y2,{scope:n,disabled:s,contentId:Ot(),open:c,onOpenToggle:y.useCallback(()=>u(d=>!d),[u]),children:l.jsx(Ne.div,{"data-state":Xi(c),"data-disabled":s?"":void 0,...a,ref:t})})});Pd.displayName=Ho;var Rd="CollapsibleTrigger",Od=y.forwardRef((e,t)=>{const{__scopeCollapsible:n,...r}=e,o=Gi(Rd,n);return l.jsx(Ne.button,{type:"button","aria-controls":o.contentId,"aria-expanded":o.open||!1,"data-state":Xi(o.open),"data-disabled":o.disabled?"":void 0,disabled:o.disabled,...r,ref:t,onClick:_e(e.onClick,o.onOpenToggle)})});Od.displayName=Rd;var Yi="CollapsibleContent",Md=y.forwardRef((e,t)=>{const{forceMount:n,...r}=e,o=Gi(Yi,e.__scopeCollapsible);return l.jsx(bt,{present:n||o.open,children:({present:s})=>l.jsx(X2,{...r,ref:t,present:s})})});Md.displayName=Yi;var X2=y.forwardRef((e,t)=>{const{__scopeCollapsible:n,present:r,children:o,...s}=e,i=Gi(Yi,n),[a,c]=y.useState(r),u=y.useRef(null),d=Oe(t,u),f=y.useRef(0),p=f.current,h=y.useRef(0),g=h.current,m=i.open||a,x=y.useRef(m),b=y.useRef(void 0);return y.useEffect(()=>{const v=requestAnimationFrame(()=>x.current=!1);return()=>cancelAnimationFrame(v)},[]),tt(()=>{const v=u.current;if(v){b.current=b.current||{transitionDuration:v.style.transitionDuration,animationName:v.style.animationName},v.style.transitionDuration="0s",v.style.animationName="none";const k=v.getBoundingClientRect();f.current=k.height,h.current=k.width,x.current||(v.style.transitionDuration=b.current.transitionDuration,v.style.animationName=b.current.animationName),c(r)}},[i.open,r]),l.jsx(Ne.div,{"data-state":Xi(i.open),"data-disabled":i.disabled?"":void 0,id:i.contentId,hidden:!m,...s,ref:d,style:{"--radix-collapsible-content-height":p?`${p}px`:void 0,"--radix-collapsible-content-width":g?`${g}px`:void 0,...e.style},children:m&&o})});function Xi(e){return e?"open":"closed"}var Q2=Pd,ew=y.createContext(void 0);function Zo(e){const t=y.useContext(ew);return e||t||"ltr"}function st(e){const t=y.useRef(e);return y.useEffect(()=>{t.current=e}),y.useMemo(()=>(...n)=>t.current?.(...n),[])}function tw(e,t=globalThis?.document){const n=st(e);y.useEffect(()=>{const r=o=>{o.key==="Escape"&&n(o)};return t.addEventListener("keydown",r,{capture:!0}),()=>t.removeEventListener("keydown",r,{capture:!0})},[n,t])}var nw="DismissableLayer",oi="dismissableLayer.update",rw="dismissableLayer.pointerDownOutside",ow="dismissableLayer.focusOutside",Cl,Dd=y.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),Wo=y.forwardRef((e,t)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:r,onPointerDownOutside:o,onFocusOutside:s,onInteractOutside:i,onDismiss:a,...c}=e,u=y.useContext(Dd),[d,f]=y.useState(null),p=d?.ownerDocument??globalThis?.document,[,h]=y.useState({}),g=Oe(t,N=>f(N)),m=Array.from(u.layers),[x]=[...u.layersWithOutsidePointerEventsDisabled].slice(-1),b=m.indexOf(x),v=d?m.indexOf(d):-1,k=u.layersWithOutsidePointerEventsDisabled.size>0,S=v>=b,C=aw(N=>{const z=N.target,T=[...u.branches].some(R=>R.contains(z));!S||T||(o?.(N),i?.(N),N.defaultPrevented||a?.())},p),E=lw(N=>{const z=N.target;[...u.branches].some(R=>R.contains(z))||(s?.(N),i?.(N),N.defaultPrevented||a?.())},p);return tw(N=>{v===u.layers.size-1&&(r?.(N),!N.defaultPrevented&&a&&(N.preventDefault(),a()))},p),y.useEffect(()=>{if(d)return n&&(u.layersWithOutsidePointerEventsDisabled.size===0&&(Cl=p.body.style.pointerEvents,p.body.style.pointerEvents="none"),u.layersWithOutsidePointerEventsDisabled.add(d)),u.layers.add(d),jl(),()=>{n&&u.layersWithOutsidePointerEventsDisabled.size===1&&(p.body.style.pointerEvents=Cl)}},[d,p,n,u]),y.useEffect(()=>()=>{d&&(u.layers.delete(d),u.layersWithOutsidePointerEventsDisabled.delete(d),jl())},[d,u]),y.useEffect(()=>{const N=()=>h({});return document.addEventListener(oi,N),()=>document.removeEventListener(oi,N)},[]),l.jsx(Ne.div,{...c,ref:g,style:{pointerEvents:k?S?"auto":"none":void 0,...e.style},onFocusCapture:_e(e.onFocusCapture,E.onFocusCapture),onBlurCapture:_e(e.onBlurCapture,E.onBlurCapture),onPointerDownCapture:_e(e.onPointerDownCapture,C.onPointerDownCapture)})});Wo.displayName=nw;var sw="DismissableLayerBranch",iw=y.forwardRef((e,t)=>{const n=y.useContext(Dd),r=y.useRef(null),o=Oe(t,r);return y.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})});iw.displayName=sw;function aw(e,t=globalThis?.document){const n=st(e),r=y.useRef(!1),o=y.useRef(()=>{});return y.useEffect(()=>{const s=a=>{if(a.target&&!r.current){let c=function(){Ld(rw,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 lw(e,t=globalThis?.document){const n=st(e),r=y.useRef(!1);return y.useEffect(()=>{const o=s=>{s.target&&!r.current&&Ld(ow,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 jl(){const e=new CustomEvent(oi);document.dispatchEvent(e)}function Ld(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?D2(o,s):o.dispatchEvent(s)}var ys="focusScope.autoFocusOnMount",bs="focusScope.autoFocusOnUnmount",El={bubbles:!1,cancelable:!0},cw="FocusScope",Qi=y.forwardRef((e,t)=>{const{loop:n=!1,trapped:r=!1,onMountAutoFocus:o,onUnmountAutoFocus:s,...i}=e,[a,c]=y.useState(null),u=st(o),d=st(s),f=y.useRef(null),p=Oe(t,m=>c(m)),h=y.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;y.useEffect(()=>{if(r){let m=function(k){if(h.paused||!a)return;const S=k.target;a.contains(S)?f.current=S:en(f.current,{select:!0})},x=function(k){if(h.paused||!a)return;const S=k.relatedTarget;S!==null&&(a.contains(S)||en(f.current,{select:!0}))},b=function(k){if(document.activeElement===document.body)for(const C of k)C.removedNodes.length>0&&en(a)};document.addEventListener("focusin",m),document.addEventListener("focusout",x);const v=new MutationObserver(b);return a&&v.observe(a,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",m),document.removeEventListener("focusout",x),v.disconnect()}}},[r,a,h.paused]),y.useEffect(()=>{if(a){Tl.add(h);const m=document.activeElement;if(!a.contains(m)){const b=new CustomEvent(ys,El);a.addEventListener(ys,u),a.dispatchEvent(b),b.defaultPrevented||(uw(mw(Fd(a)),{select:!0}),document.activeElement===m&&en(a))}return()=>{a.removeEventListener(ys,u),setTimeout(()=>{const b=new CustomEvent(bs,El);a.addEventListener(bs,d),a.dispatchEvent(b),b.defaultPrevented||en(m??document.body,{select:!0}),a.removeEventListener(bs,d),Tl.remove(h)},0)}}},[a,u,d,h]);const g=y.useCallback(m=>{if(!n&&!r||h.paused)return;const x=m.key==="Tab"&&!m.altKey&&!m.ctrlKey&&!m.metaKey,b=document.activeElement;if(x&&b){const v=m.currentTarget,[k,S]=dw(v);k&&S?!m.shiftKey&&b===S?(m.preventDefault(),n&&en(k,{select:!0})):m.shiftKey&&b===k&&(m.preventDefault(),n&&en(S,{select:!0})):b===v&&m.preventDefault()}},[n,r,h.paused]);return l.jsx(Ne.div,{tabIndex:-1,...i,ref:p,onKeyDown:g})});Qi.displayName=cw;function uw(e,{select:t=!1}={}){const n=document.activeElement;for(const r of e)if(en(r,{select:t}),document.activeElement!==n)return}function dw(e){const t=Fd(e),n=Nl(t,e),r=Nl(t.reverse(),e);return[n,r]}function Fd(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 Nl(e,t){for(const n of e)if(!fw(n,{upTo:t}))return n}function fw(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 hw(e){return e instanceof HTMLInputElement&&"select"in e}function en(e,{select:t=!1}={}){if(e&&e.focus){const n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&hw(e)&&t&&e.select()}}var Tl=pw();function pw(){let e=[];return{add(t){const n=e[0];t!==n&&n?.pause(),e=Al(e,t),e.unshift(t)},remove(t){e=Al(e,t),e[0]?.resume()}}}function Al(e,t){const n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}function mw(e){return e.filter(t=>t.tagName!=="A")}var gw="Portal",qo=y.forwardRef((e,t)=>{const{container:n,...r}=e,[o,s]=y.useState(!1);tt(()=>s(!0),[]);const i=n||o&&globalThis?.document?.body;return i?fm.createPortal(l.jsx(Ne.div,{...r,ref:t}),i):null});qo.displayName=gw;var vs=0;function $d(){y.useEffect(()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??zl()),document.body.insertAdjacentElement("beforeend",e[1]??zl()),vs++,()=>{vs===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(t=>t.remove()),vs--}},[])}function zl(){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 It=function(){return It=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},It.apply(this,arguments)};function Bd(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 xw(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 lo="right-scroll-bar-position",co="width-before-scroll-bar",yw="with-scroll-bars-hidden",bw="--removed-body-scroll-bar-size";function ws(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}function vw(e,t){var n=y.useState(function(){return{value:e,callback:t,facade:{get current(){return n.value},set current(r){var o=n.value;o!==r&&(n.value=r,n.callback(r,o))}}}})[0];return n.callback=t,n.facade}var ww=typeof window<"u"?y.useLayoutEffect:y.useEffect,Il=new WeakMap;function kw(e,t){var n=vw(null,function(r){return e.forEach(function(o){return ws(o,r)})});return ww(function(){var r=Il.get(n);if(r){var o=new Set(r),s=new Set(e),i=n.current;o.forEach(function(a){s.has(a)||ws(a,null)}),s.forEach(function(a){o.has(a)||ws(a,i)})}Il.set(n,e)},[e]),n}function _w(e){return e}function Sw(e,t){t===void 0&&(t=_w);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 Cw(e){e===void 0&&(e={});var t=Sw(null);return t.options=It({async:!0,ssr:!1},e),t}var Ud=function(e){var t=e.sideCar,n=Bd(e,["sideCar"]);if(!t)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var r=t.read();if(!r)throw new Error("Sidecar medium not found");return y.createElement(r,It({},n))};Ud.isSideCarExport=!0;function jw(e,t){return e.useMedium(t),Ud}var Vd=Cw(),ks=function(){},Jo=y.forwardRef(function(e,t){var n=y.useRef(null),r=y.useState({onScrollCapture:ks,onWheelCapture:ks,onTouchMoveCapture:ks}),o=r[0],s=r[1],i=e.forwardProps,a=e.children,c=e.className,u=e.removeScrollBar,d=e.enabled,f=e.shards,p=e.sideCar,h=e.noRelative,g=e.noIsolation,m=e.inert,x=e.allowPinchZoom,b=e.as,v=b===void 0?"div":b,k=e.gapMode,S=Bd(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),C=p,E=kw([n,t]),N=It(It({},S),o);return y.createElement(y.Fragment,null,d&&y.createElement(C,{sideCar:Vd,removeScrollBar:u,shards:f,noRelative:h,noIsolation:g,inert:m,setCallbacks:s,allowPinchZoom:!!x,lockRef:n,gapMode:k}),i?y.cloneElement(y.Children.only(a),It(It({},N),{ref:E})):y.createElement(v,It({},N,{className:c,ref:E}),a))});Jo.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};Jo.classNames={fullWidth:co,zeroRight:lo};var Ew=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function Nw(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=Ew();return t&&e.setAttribute("nonce",t),e}function Tw(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function Aw(e){var t=document.head||document.getElementsByTagName("head")[0];t.appendChild(e)}var zw=function(){var e=0,t=null;return{add:function(n){e==0&&(t=Nw())&&(Tw(t,n),Aw(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},Iw=function(){var e=zw();return function(t,n){y.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},Hd=function(){var e=Iw(),t=function(n){var r=n.styles,o=n.dynamic;return e(r,o),null};return t},Pw={left:0,top:0,right:0,gap:0},_s=function(e){return parseInt(e||"",10)||0},Rw=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[_s(n),_s(r),_s(o)]},Ow=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return Pw;var t=Rw(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])}},Mw=Hd(),$n="data-scroll-locked",Dw=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(yw,` {
|
|
43
|
-
overflow: hidden `).concat(r,`;
|
|
44
|
-
padding-right: `).concat(a,"px ").concat(r,`;
|
|
45
|
-
}
|
|
46
|
-
body[`).concat($n,`] {
|
|
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(lo,` {
|
|
60
|
-
right: `).concat(a,"px ").concat(r,`;
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
.`).concat(co,` {
|
|
64
|
-
margin-right: `).concat(a,"px ").concat(r,`;
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
.`).concat(lo," .").concat(lo,` {
|
|
68
|
-
right: 0 `).concat(r,`;
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
.`).concat(co," .").concat(co,` {
|
|
72
|
-
margin-right: 0 `).concat(r,`;
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
body[`).concat($n,`] {
|
|
76
|
-
`).concat(bw,": ").concat(a,`px;
|
|
77
|
-
}
|
|
78
|
-
`)},Pl=function(){var e=parseInt(document.body.getAttribute($n)||"0",10);return isFinite(e)?e:0},Lw=function(){y.useEffect(function(){return document.body.setAttribute($n,(Pl()+1).toString()),function(){var e=Pl()-1;e<=0?document.body.removeAttribute($n):document.body.setAttribute($n,e.toString())}},[])},Fw=function(e){var t=e.noRelative,n=e.noImportant,r=e.gapMode,o=r===void 0?"margin":r;Lw();var s=y.useMemo(function(){return Ow(o)},[o]);return y.createElement(Mw,{styles:Dw(s,!t,o,n?"":"!important")})},si=!1;if(typeof window<"u")try{var Gr=Object.defineProperty({},"passive",{get:function(){return si=!0,!0}});window.addEventListener("test",Gr,Gr),window.removeEventListener("test",Gr,Gr)}catch{si=!1}var Tn=si?{passive:!1}:!1,$w=function(e){return e.tagName==="TEXTAREA"},Zd=function(e,t){if(!(e instanceof Element))return!1;var n=window.getComputedStyle(e);return n[t]!=="hidden"&&!(n.overflowY===n.overflowX&&!$w(e)&&n[t]==="visible")},Bw=function(e){return Zd(e,"overflowY")},Uw=function(e){return Zd(e,"overflowX")},Rl=function(e,t){var n=t.ownerDocument,r=t;do{typeof ShadowRoot<"u"&&r instanceof ShadowRoot&&(r=r.host);var o=Wd(e,r);if(o){var s=qd(e,r),i=s[1],a=s[2];if(i>a)return!0}r=r.parentNode}while(r&&r!==n.body);return!1},Vw=function(e){var t=e.scrollTop,n=e.scrollHeight,r=e.clientHeight;return[t,n,r]},Hw=function(e){var t=e.scrollLeft,n=e.scrollWidth,r=e.clientWidth;return[t,n,r]},Wd=function(e,t){return e==="v"?Bw(t):Uw(t)},qd=function(e,t){return e==="v"?Vw(t):Hw(t)},Zw=function(e,t){return e==="h"&&t==="rtl"?-1:1},Ww=function(e,t,n,r,o){var s=Zw(e,window.getComputedStyle(t).direction),i=s*r,a=n.target,c=t.contains(a),u=!1,d=i>0,f=0,p=0;do{if(!a)break;var h=qd(e,a),g=h[0],m=h[1],x=h[2],b=m-x-s*g;(g||b)&&Wd(e,a)&&(f+=b,p+=g);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(p)<1)&&(u=!0),u},Yr=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},Ol=function(e){return[e.deltaX,e.deltaY]},Ml=function(e){return e&&"current"in e?e.current:e},qw=function(e,t){return e[0]===t[0]&&e[1]===t[1]},Jw=function(e){return`
|
|
79
|
-
.block-interactivity-`.concat(e,` {pointer-events: none;}
|
|
80
|
-
.allow-interactivity-`).concat(e,` {pointer-events: all;}
|
|
81
|
-
`)},Kw=0,An=[];function Gw(e){var t=y.useRef([]),n=y.useRef([0,0]),r=y.useRef(),o=y.useState(Kw++)[0],s=y.useState(Hd)[0],i=y.useRef(e);y.useEffect(function(){i.current=e},[e]),y.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(o));var m=xw([e.lockRef.current],(e.shards||[]).map(Ml),!0).filter(Boolean);return m.forEach(function(x){return x.classList.add("allow-interactivity-".concat(o))}),function(){document.body.classList.remove("block-interactivity-".concat(o)),m.forEach(function(x){return x.classList.remove("allow-interactivity-".concat(o))})}}},[e.inert,e.lockRef.current,e.shards]);var a=y.useCallback(function(m,x){if("touches"in m&&m.touches.length===2||m.type==="wheel"&&m.ctrlKey)return!i.current.allowPinchZoom;var b=Yr(m),v=n.current,k="deltaX"in m?m.deltaX:v[0]-b[0],S="deltaY"in m?m.deltaY:v[1]-b[1],C,E=m.target,N=Math.abs(k)>Math.abs(S)?"h":"v";if("touches"in m&&N==="h"&&E.type==="range")return!1;var z=window.getSelection(),T=z&&z.anchorNode,R=T?T===E||T.contains(E):!1;if(R)return!1;var $=Rl(N,E);if(!$)return!0;if($?C=N:(C=N==="v"?"h":"v",$=Rl(N,E)),!$)return!1;if(!r.current&&"changedTouches"in m&&(k||S)&&(r.current=C),!C)return!0;var j=r.current||C;return Ww(j,x,m,j==="h"?k:S)},[]),c=y.useCallback(function(m){var x=m;if(!(!An.length||An[An.length-1]!==s)){var b="deltaY"in x?Ol(x):Yr(x),v=t.current.filter(function(C){return C.name===x.type&&(C.target===x.target||x.target===C.shadowParent)&&qw(C.delta,b)})[0];if(v&&v.should){x.cancelable&&x.preventDefault();return}if(!v){var k=(i.current.shards||[]).map(Ml).filter(Boolean).filter(function(C){return C.contains(x.target)}),S=k.length>0?a(x,k[0]):!i.current.noIsolation;S&&x.cancelable&&x.preventDefault()}}},[]),u=y.useCallback(function(m,x,b,v){var k={name:m,delta:x,target:b,should:v,shadowParent:Yw(b)};t.current.push(k),setTimeout(function(){t.current=t.current.filter(function(S){return S!==k})},1)},[]),d=y.useCallback(function(m){n.current=Yr(m),r.current=void 0},[]),f=y.useCallback(function(m){u(m.type,Ol(m),m.target,a(m,e.lockRef.current))},[]),p=y.useCallback(function(m){u(m.type,Yr(m),m.target,a(m,e.lockRef.current))},[]);y.useEffect(function(){return An.push(s),e.setCallbacks({onScrollCapture:f,onWheelCapture:f,onTouchMoveCapture:p}),document.addEventListener("wheel",c,Tn),document.addEventListener("touchmove",c,Tn),document.addEventListener("touchstart",d,Tn),function(){An=An.filter(function(m){return m!==s}),document.removeEventListener("wheel",c,Tn),document.removeEventListener("touchmove",c,Tn),document.removeEventListener("touchstart",d,Tn)}},[]);var h=e.removeScrollBar,g=e.inert;return y.createElement(y.Fragment,null,g?y.createElement(s,{styles:Jw(o)}):null,h?y.createElement(Fw,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function Yw(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const Xw=jw(Vd,Gw);var ea=y.forwardRef(function(e,t){return y.createElement(Jo,It({},e,{ref:t,sideCar:Xw}))});ea.classNames=Jo.classNames;var Qw=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},zn=new WeakMap,Xr=new WeakMap,Qr={},Ss=0,Jd=function(e){return e&&(e.host||Jd(e.parentNode))},ek=function(e,t){return t.map(function(n){if(e.contains(n))return n;var r=Jd(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})},tk=function(e,t,n,r){var o=ek(t,Array.isArray(e)?e:[e]);Qr[n]||(Qr[n]=new WeakMap);var s=Qr[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(p){if(a.has(p))d(p);else try{var h=p.getAttribute(r),g=h!==null&&h!=="false",m=(zn.get(p)||0)+1,x=(s.get(p)||0)+1;zn.set(p,m),s.set(p,x),i.push(p),m===1&&g&&Xr.set(p,!0),x===1&&p.setAttribute(n,"true"),g||p.setAttribute(r,"true")}catch(b){console.error("aria-hidden: cannot operate on ",p,b)}})};return d(t),a.clear(),Ss++,function(){i.forEach(function(f){var p=zn.get(f)-1,h=s.get(f)-1;zn.set(f,p),s.set(f,h),p||(Xr.has(f)||f.removeAttribute(r),Xr.delete(f)),h||f.removeAttribute(n)}),Ss--,Ss||(zn=new WeakMap,zn=new WeakMap,Xr=new WeakMap,Qr={})}},Kd=function(e,t,n){n===void 0&&(n="data-aria-hidden");var r=Array.from(Array.isArray(e)?e:[e]),o=Qw(e);return o?(r.push.apply(r,Array.from(o.querySelectorAll("[aria-live], script"))),tk(r,o,n,"aria-hidden")):function(){return null}},Ko="Dialog",[Gd]=Yt(Ko),[nk,Et]=Gd(Ko),Yd=e=>{const{__scopeDialog:t,children:n,open:r,defaultOpen:o,onOpenChange:s,modal:i=!0}=e,a=y.useRef(null),c=y.useRef(null),[u,d]=yn({prop:r,defaultProp:o??!1,onChange:s,caller:Ko});return l.jsx(nk,{scope:t,triggerRef:a,contentRef:c,contentId:Ot(),titleId:Ot(),descriptionId:Ot(),open:u,onOpenChange:d,onOpenToggle:y.useCallback(()=>d(f=>!f),[d]),modal:i,children:n})};Yd.displayName=Ko;var Xd="DialogTrigger",Qd=y.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=Et(Xd,n),s=Oe(t,o.triggerRef);return l.jsx(Ne.button,{type:"button","aria-haspopup":"dialog","aria-expanded":o.open,"aria-controls":o.contentId,"data-state":ra(o.open),...r,ref:s,onClick:_e(e.onClick,o.onOpenToggle)})});Qd.displayName=Xd;var ta="DialogPortal",[rk,ef]=Gd(ta,{forceMount:void 0}),tf=e=>{const{__scopeDialog:t,forceMount:n,children:r,container:o}=e,s=Et(ta,t);return l.jsx(rk,{scope:t,forceMount:n,children:y.Children.map(r,i=>l.jsx(bt,{present:n||s.open,children:l.jsx(qo,{asChild:!0,container:o,children:i})}))})};tf.displayName=ta;var wo="DialogOverlay",nf=y.forwardRef((e,t)=>{const n=ef(wo,e.__scopeDialog),{forceMount:r=n.forceMount,...o}=e,s=Et(wo,e.__scopeDialog);return s.modal?l.jsx(bt,{present:r||s.open,children:l.jsx(sk,{...o,ref:t})}):null});nf.displayName=wo;var ok=Jn("DialogOverlay.RemoveScroll"),sk=y.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=Et(wo,n);return l.jsx(ea,{as:ok,allowPinchZoom:!0,shards:[o.contentRef],children:l.jsx(Ne.div,{"data-state":ra(o.open),...r,ref:t,style:{pointerEvents:"auto",...r.style}})})}),bn="DialogContent",rf=y.forwardRef((e,t)=>{const n=ef(bn,e.__scopeDialog),{forceMount:r=n.forceMount,...o}=e,s=Et(bn,e.__scopeDialog);return l.jsx(bt,{present:r||s.open,children:s.modal?l.jsx(ik,{...o,ref:t}):l.jsx(ak,{...o,ref:t})})});rf.displayName=bn;var ik=y.forwardRef((e,t)=>{const n=Et(bn,e.__scopeDialog),r=y.useRef(null),o=Oe(t,n.contentRef,r);return y.useEffect(()=>{const s=r.current;if(s)return Kd(s)},[]),l.jsx(of,{...e,ref:o,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:_e(e.onCloseAutoFocus,s=>{s.preventDefault(),n.triggerRef.current?.focus()}),onPointerDownOutside:_e(e.onPointerDownOutside,s=>{const i=s.detail.originalEvent,a=i.button===0&&i.ctrlKey===!0;(i.button===2||a)&&s.preventDefault()}),onFocusOutside:_e(e.onFocusOutside,s=>s.preventDefault())})}),ak=y.forwardRef((e,t)=>{const n=Et(bn,e.__scopeDialog),r=y.useRef(!1),o=y.useRef(!1);return l.jsx(of,{...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()}})}),of=y.forwardRef((e,t)=>{const{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:o,onCloseAutoFocus:s,...i}=e,a=Et(bn,n),c=y.useRef(null),u=Oe(t,c);return $d(),l.jsxs(l.Fragment,{children:[l.jsx(Qi,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:o,onUnmountAutoFocus:s,children:l.jsx(Wo,{role:"dialog",id:a.contentId,"aria-describedby":a.descriptionId,"aria-labelledby":a.titleId,"data-state":ra(a.open),...i,ref:u,onDismiss:()=>a.onOpenChange(!1)})}),l.jsxs(l.Fragment,{children:[l.jsx(ck,{titleId:a.titleId}),l.jsx(dk,{contentRef:c,descriptionId:a.descriptionId})]})]})}),na="DialogTitle",sf=y.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=Et(na,n);return l.jsx(Ne.h2,{id:o.titleId,...r,ref:t})});sf.displayName=na;var af="DialogDescription",lk=y.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=Et(af,n);return l.jsx(Ne.p,{id:o.descriptionId,...r,ref:t})});lk.displayName=af;var lf="DialogClose",cf=y.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=Et(lf,n);return l.jsx(Ne.button,{type:"button",...r,ref:t,onClick:_e(e.onClick,()=>o.onOpenChange(!1))})});cf.displayName=lf;function ra(e){return e?"open":"closed"}var uf="DialogTitleWarning",[vz,df]=$2(uf,{contentName:bn,titleName:na,docsSlug:"dialog"}),ck=({titleId:e})=>{const t=df(uf),n=`\`${t.contentName}\` requires a \`${t.titleName}\` for the component to be accessible for screen reader users.
|
|
82
|
-
|
|
83
|
-
If you want to hide the \`${t.titleName}\`, you can wrap it with our VisuallyHidden component.
|
|
84
|
-
|
|
85
|
-
For more information, see https://radix-ui.com/primitives/docs/components/${t.docsSlug}`;return y.useEffect(()=>{e&&(document.getElementById(e)||console.error(n))},[n,e]),null},uk="DialogDescriptionWarning",dk=({contentRef:e,descriptionId:t})=>{const r=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${df(uk).contentName}}.`;return y.useEffect(()=>{const o=e.current?.getAttribute("aria-describedby");t&&o&&(document.getElementById(t)||console.warn(r))},[r,e,t]),null},fk=Yd,hk=Qd,pk=tf,mk=nf,gk=rf,xk=sf,yk=cf;function bk(e){const t=y.useRef({value:e,previous:e});return y.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}function vk(e){const[t,n]=y.useState(void 0);return tt(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});const r=new ResizeObserver(o=>{if(!Array.isArray(o)||!o.length)return;const s=o[0];let i,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 wk=["top","right","bottom","left"],on=Math.min,pt=Math.max,ko=Math.round,eo=Math.floor,Mt=e=>({x:e,y:e}),kk={left:"right",right:"left",bottom:"top",top:"bottom"},_k={start:"end",end:"start"};function ii(e,t,n){return pt(e,on(t,n))}function qt(e,t){return typeof e=="function"?e(t):e}function Jt(e){return e.split("-")[0]}function tr(e){return e.split("-")[1]}function oa(e){return e==="x"?"y":"x"}function sa(e){return e==="y"?"height":"width"}const Sk=new Set(["top","bottom"]);function Rt(e){return Sk.has(Jt(e))?"y":"x"}function ia(e){return oa(Rt(e))}function Ck(e,t,n){n===void 0&&(n=!1);const r=tr(e),o=ia(e),s=sa(o);let i=o==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[s]>t.floating[s]&&(i=_o(i)),[i,_o(i)]}function jk(e){const t=_o(e);return[ai(e),t,ai(t)]}function ai(e){return e.replace(/start|end/g,t=>_k[t])}const Dl=["left","right"],Ll=["right","left"],Ek=["top","bottom"],Nk=["bottom","top"];function Tk(e,t,n){switch(e){case"top":case"bottom":return n?t?Ll:Dl:t?Dl:Ll;case"left":case"right":return t?Ek:Nk;default:return[]}}function Ak(e,t,n,r){const o=tr(e);let s=Tk(Jt(e),n==="start",r);return o&&(s=s.map(i=>i+"-"+o),t&&(s=s.concat(s.map(ai)))),s}function _o(e){return e.replace(/left|right|bottom|top/g,t=>kk[t])}function zk(e){return{top:0,right:0,bottom:0,left:0,...e}}function ff(e){return typeof e!="number"?zk(e):{top:e,right:e,bottom:e,left:e}}function So(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 Fl(e,t,n){let{reference:r,floating:o}=e;const s=Rt(t),i=ia(t),a=sa(i),c=Jt(t),u=s==="y",d=r.x+r.width/2-o.width/2,f=r.y+r.height/2-o.height/2,p=r[a]/2-o[a]/2;let h;switch(c){case"top":h={x:d,y:r.y-o.height};break;case"bottom":h={x:d,y:r.y+r.height};break;case"right":h={x:r.x+r.width,y:f};break;case"left":h={x:r.x-o.width,y:f};break;default:h={x:r.x,y:r.y}}switch(tr(t)){case"start":h[i]-=p*(n&&u?-1:1);break;case"end":h[i]+=p*(n&&u?-1:1);break}return h}async function Ik(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:p=!1,padding:h=0}=qt(t,e),g=ff(h),x=a[p?f==="floating"?"reference":"floating":f],b=So(await s.getClippingRect({element:(n=await(s.isElement==null?void 0:s.isElement(x)))==null||n?x:x.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=So(s.convertOffsetParentRelativeRectToViewportRelativeRect?await s.convertOffsetParentRelativeRectToViewportRelativeRect({elements:a,rect:v,offsetParent:k,strategy:c}):v);return{top:(b.top-C.top+g.top)/S.y,bottom:(C.bottom-b.bottom+g.bottom)/S.y,left:(b.left-C.left+g.left)/S.x,right:(C.right-b.right+g.right)/S.x}}const Pk=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}=Fl(u,r,c),p=r,h={},g=0;for(let x=0;x<a.length;x++){var m;const{name:b,fn:v}=a[x],{x:k,y:S,data:C,reset:E}=await v({x:d,y:f,initialPlacement:r,placement:p,strategy:o,middlewareData:h,rects:u,platform:{...i,detectOverflow:(m=i.detectOverflow)!=null?m:Ik},elements:{reference:e,floating:t}});d=k??d,f=S??f,h={...h,[b]:{...h[b],...C}},E&&g<=50&&(g++,typeof E=="object"&&(E.placement&&(p=E.placement),E.rects&&(u=E.rects===!0?await i.getElementRects({reference:e,floating:t,strategy:o}):E.rects),{x:d,y:f}=Fl(u,p,c)),x=-1)}return{x:d,y:f,placement:p,strategy:o,middlewareData:h}},Rk=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=ff(d),p={x:n,y:r},h=ia(o),g=sa(h),m=await i.getDimensions(u),x=h==="y",b=x?"top":"left",v=x?"bottom":"right",k=x?"clientHeight":"clientWidth",S=s.reference[g]+s.reference[h]-p[h]-s.floating[g],C=p[h]-s.reference[h],E=await(i.getOffsetParent==null?void 0:i.getOffsetParent(u));let N=E?E[k]:0;(!N||!await(i.isElement==null?void 0:i.isElement(E)))&&(N=a.floating[k]||s.floating[g]);const z=S/2-C/2,T=N/2-m[g]/2-1,R=on(f[b],T),$=on(f[v],T),j=R,D=N-m[g]-$,w=N/2-m[g]/2+z,M=ii(j,w,D),U=!c.arrow&&tr(o)!=null&&w!==M&&s.reference[g]/2-(w<j?R:$)-m[g]/2<0,L=U?w<j?w-j:w-D:0;return{[h]:p[h]+L,data:{[h]:M,centerOffset:w-M-L,...U&&{alignmentOffset:L}},reset:U}}}),Ok=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:p,fallbackStrategy:h="bestFit",fallbackAxisSideDirection:g="none",flipAlignment:m=!0,...x}=qt(e,t);if((n=s.arrow)!=null&&n.alignmentOffset)return{};const b=Jt(o),v=Rt(a),k=Jt(a)===a,S=await(c.isRTL==null?void 0:c.isRTL(u.floating)),C=p||(k||!m?[_o(a)]:jk(a)),E=g!=="none";!p&&E&&C.push(...Ak(a,m,g,S));const N=[a,...C],z=await c.detectOverflow(t,x),T=[];let R=((r=s.flip)==null?void 0:r.overflows)||[];if(d&&T.push(z[b]),f){const w=Ck(o,i,S);T.push(z[w[0]],z[w[1]])}if(R=[...R,{placement:o,overflows:T}],!T.every(w=>w<=0)){var $,j;const w=((($=s.flip)==null?void 0:$.index)||0)+1,M=N[w];if(M&&(!(f==="alignment"?v!==Rt(M):!1)||R.every(F=>Rt(F.placement)===v?F.overflows[0]>0:!0)))return{data:{index:w,overflows:R},reset:{placement:M}};let U=(j=R.filter(L=>L.overflows[0]<=0).sort((L,F)=>L.overflows[1]-F.overflows[1])[0])==null?void 0:j.placement;if(!U)switch(h){case"bestFit":{var D;const L=(D=R.filter(F=>{if(E){const q=Rt(F.placement);return q===v||q==="y"}return!0}).map(F=>[F.placement,F.overflows.filter(q=>q>0).reduce((q,A)=>q+A,0)]).sort((F,q)=>F[1]-q[1])[0])==null?void 0:D[0];L&&(U=L);break}case"initialPlacement":U=a;break}if(o!==U)return{reset:{placement:U}}}return{}}}};function $l(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function Bl(e){return wk.some(t=>e[t]>=0)}const Mk=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=$l(i,n.reference);return{data:{referenceHiddenOffsets:a,referenceHidden:Bl(a)}}}case"escaped":{const i=await r.detectOverflow(t,{...s,altBoundary:!0}),a=$l(i,n.floating);return{data:{escapedOffsets:a,escaped:Bl(a)}}}default:return{}}}}},hf=new Set(["left","top"]);async function Dk(e,t){const{placement:n,platform:r,elements:o}=e,s=await(r.isRTL==null?void 0:r.isRTL(o.floating)),i=Jt(n),a=tr(n),c=Rt(n)==="y",u=hf.has(i)?-1:1,d=s&&c?-1:1,f=qt(t,e);let{mainAxis:p,crossAxis:h,alignmentAxis:g}=typeof f=="number"?{mainAxis:f,crossAxis:0,alignmentAxis:null}:{mainAxis:f.mainAxis||0,crossAxis:f.crossAxis||0,alignmentAxis:f.alignmentAxis};return a&&typeof g=="number"&&(h=a==="end"?g*-1:g),c?{x:h*d,y:p*u}:{x:p*u,y:h*d}}const Lk=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 Dk(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}}}}},Fk=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:b=>{let{x:v,y:k}=b;return{x:v,y:k}}},...u}=qt(e,t),d={x:n,y:r},f=await s.detectOverflow(t,u),p=Rt(Jt(o)),h=oa(p);let g=d[h],m=d[p];if(i){const b=h==="y"?"top":"left",v=h==="y"?"bottom":"right",k=g+f[b],S=g-f[v];g=ii(k,g,S)}if(a){const b=p==="y"?"top":"left",v=p==="y"?"bottom":"right",k=m+f[b],S=m-f[v];m=ii(k,m,S)}const x=c.fn({...t,[h]:g,[p]:m});return{...x,data:{x:x.x-n,y:x.y-r,enabled:{[h]:i,[p]:a}}}}}},$k=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=Rt(o),p=oa(f);let h=d[p],g=d[f];const m=qt(a,t),x=typeof m=="number"?{mainAxis:m,crossAxis:0}:{mainAxis:0,crossAxis:0,...m};if(c){const k=p==="y"?"height":"width",S=s.reference[p]-s.floating[k]+x.mainAxis,C=s.reference[p]+s.reference[k]-x.mainAxis;h<S?h=S:h>C&&(h=C)}if(u){var b,v;const k=p==="y"?"width":"height",S=hf.has(Jt(o)),C=s.reference[f]-s.floating[k]+(S&&((b=i.offset)==null?void 0:b[f])||0)+(S?0:x.crossAxis),E=s.reference[f]+s.reference[k]+(S?0:((v=i.offset)==null?void 0:v[f])||0)-(S?x.crossAxis:0);g<C?g=C:g>E&&(g=E)}return{[p]:h,[f]:g}}}},Bk=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=Jt(o),p=tr(o),h=Rt(o)==="y",{width:g,height:m}=s.floating;let x,b;f==="top"||f==="bottom"?(x=f,b=p===(await(i.isRTL==null?void 0:i.isRTL(a.floating))?"start":"end")?"left":"right"):(b=f,x=p==="end"?"top":"bottom");const v=m-d.top-d.bottom,k=g-d.left-d.right,S=on(m-d[x],v),C=on(g-d[b],k),E=!t.middlewareData.shift;let N=S,z=C;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(z=k),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(N=v),E&&!p){const R=pt(d.left,0),$=pt(d.right,0),j=pt(d.top,0),D=pt(d.bottom,0);h?z=g-2*(R!==0||$!==0?R+$:pt(d.left,d.right)):N=m-2*(j!==0||D!==0?j+D:pt(d.top,d.bottom))}await c({...t,availableWidth:z,availableHeight:N});const T=await i.getDimensions(a.floating);return g!==T.width||m!==T.height?{reset:{rects:!0}}:{}}}};function Go(){return typeof window<"u"}function nr(e){return pf(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=(pf(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function pf(e){return Go()?e instanceof Node||e instanceof gt(e).Node:!1}function Ct(e){return Go()?e instanceof Element||e instanceof gt(e).Element:!1}function Dt(e){return Go()?e instanceof HTMLElement||e instanceof gt(e).HTMLElement:!1}function Ul(e){return!Go()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof gt(e).ShadowRoot}const Uk=new Set(["inline","contents"]);function Or(e){const{overflow:t,overflowX:n,overflowY:r,display:o}=jt(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&!Uk.has(o)}const Vk=new Set(["table","td","th"]);function Hk(e){return Vk.has(nr(e))}const Zk=[":popover-open",":modal"];function Yo(e){return Zk.some(t=>{try{return e.matches(t)}catch{return!1}})}const Wk=["transform","translate","scale","rotate","perspective"],qk=["transform","translate","scale","rotate","perspective","filter"],Jk=["paint","layout","strict","content"];function aa(e){const t=la(),n=Ct(e)?jt(e):e;return Wk.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)||qk.some(r=>(n.willChange||"").includes(r))||Jk.some(r=>(n.contain||"").includes(r))}function Kk(e){let t=sn(e);for(;Dt(t)&&!Kn(t);){if(aa(t))return t;if(Yo(t))return null;t=sn(t)}return null}function la(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const Gk=new Set(["html","body","#document"]);function Kn(e){return Gk.has(nr(e))}function jt(e){return gt(e).getComputedStyle(e)}function Xo(e){return Ct(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function sn(e){if(nr(e)==="html")return e;const t=e.assignedSlot||e.parentNode||Ul(e)&&e.host||$t(e);return Ul(t)?t.host:t}function mf(e){const t=sn(e);return Kn(t)?e.ownerDocument?e.ownerDocument.body:e.body:Dt(t)&&Or(t)?t:mf(t)}function Nr(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);const o=mf(e),s=o===((r=e.ownerDocument)==null?void 0:r.body),i=gt(o);if(s){const a=li(i);return t.concat(i,i.visualViewport||[],Or(o)?o:[],a&&n?Nr(a):[])}return t.concat(o,Nr(o,[],n))}function li(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function gf(e){const t=jt(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const o=Dt(e),s=o?e.offsetWidth:n,i=o?e.offsetHeight:r,a=ko(n)!==s||ko(r)!==i;return a&&(n=s,r=i),{width:n,height:r,$:a}}function ca(e){return Ct(e)?e:e.contextElement}function Bn(e){const t=ca(e);if(!Dt(t))return Mt(1);const n=t.getBoundingClientRect(),{width:r,height:o,$:s}=gf(t);let i=(s?ko(n.width):n.width)/r,a=(s?ko(n.height):n.height)/o;return(!i||!Number.isFinite(i))&&(i=1),(!a||!Number.isFinite(a))&&(a=1),{x:i,y:a}}const Yk=Mt(0);function xf(e){const t=gt(e);return!la()||!t.visualViewport?Yk:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function Xk(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==gt(e)?!1:t}function vn(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const o=e.getBoundingClientRect(),s=ca(e);let i=Mt(1);t&&(r?Ct(r)&&(i=Bn(r)):i=Bn(e));const a=Xk(s,n,r)?xf(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 p=gt(s),h=r&&Ct(r)?gt(r):r;let g=p,m=li(g);for(;m&&r&&h!==g;){const x=Bn(m),b=m.getBoundingClientRect(),v=jt(m),k=b.left+(m.clientLeft+parseFloat(v.paddingLeft))*x.x,S=b.top+(m.clientTop+parseFloat(v.paddingTop))*x.y;c*=x.x,u*=x.y,d*=x.x,f*=x.y,c+=k,u+=S,g=gt(m),m=li(g)}}return So({width:d,height:f,x:c,y:u})}function Qo(e,t){const n=Xo(e).scrollLeft;return t?t.left+n:vn($t(e)).left+n}function yf(e,t){const n=e.getBoundingClientRect(),r=n.left+t.scrollLeft-Qo(e,n),o=n.top+t.scrollTop;return{x:r,y:o}}function Qk(e){let{elements:t,rect:n,offsetParent:r,strategy:o}=e;const s=o==="fixed",i=$t(r),a=t?Yo(t.floating):!1;if(r===i||a&&s)return n;let c={scrollLeft:0,scrollTop:0},u=Mt(1);const d=Mt(0),f=Dt(r);if((f||!f&&!s)&&((nr(r)!=="body"||Or(i))&&(c=Xo(r)),Dt(r))){const h=vn(r);u=Bn(r),d.x=h.x+r.clientLeft,d.y=h.y+r.clientTop}const p=i&&!f&&!s?yf(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+p.x,y:n.y*u.y-c.scrollTop*u.y+d.y+p.y}}function e_(e){return Array.from(e.getClientRects())}function t_(e){const t=$t(e),n=Xo(e),r=e.ownerDocument.body,o=pt(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),s=pt(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let i=-n.scrollLeft+Qo(e);const a=-n.scrollTop;return jt(r).direction==="rtl"&&(i+=pt(t.clientWidth,r.clientWidth)-o),{width:o,height:s,x:i,y:a}}const Vl=25;function n_(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=la();(!d||d&&t==="fixed")&&(a=o.offsetLeft,c=o.offsetTop)}const u=Qo(r);if(u<=0){const d=r.ownerDocument,f=d.body,p=getComputedStyle(f),h=d.compatMode==="CSS1Compat"&&parseFloat(p.marginLeft)+parseFloat(p.marginRight)||0,g=Math.abs(r.clientWidth-f.clientWidth-h);g<=Vl&&(s-=g)}else u<=Vl&&(s+=u);return{width:s,height:i,x:a,y:c}}const r_=new Set(["absolute","fixed"]);function o_(e,t){const n=vn(e,!0,t==="fixed"),r=n.top+e.clientTop,o=n.left+e.clientLeft,s=Dt(e)?Bn(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 Hl(e,t,n){let r;if(t==="viewport")r=n_(e,n);else if(t==="document")r=t_($t(e));else if(Ct(t))r=o_(t,n);else{const o=xf(e);r={x:t.x-o.x,y:t.y-o.y,width:t.width,height:t.height}}return So(r)}function bf(e,t){const n=sn(e);return n===t||!Ct(n)||Kn(n)?!1:jt(n).position==="fixed"||bf(n,t)}function s_(e,t){const n=t.get(e);if(n)return n;let r=Nr(e,[],!1).filter(a=>Ct(a)&&nr(a)!=="body"),o=null;const s=jt(e).position==="fixed";let i=s?sn(e):e;for(;Ct(i)&&!Kn(i);){const a=jt(i),c=aa(i);!c&&a.position==="fixed"&&(o=null),(s?!c&&!o:!c&&a.position==="static"&&!!o&&r_.has(o.position)||Or(i)&&!c&&bf(e,i))?r=r.filter(d=>d!==i):o=a,i=sn(i)}return t.set(e,r),r}function i_(e){let{element:t,boundary:n,rootBoundary:r,strategy:o}=e;const i=[...n==="clippingAncestors"?Yo(t)?[]:s_(t,this._c):[].concat(n),r],a=i[0],c=i.reduce((u,d)=>{const f=Hl(t,d,o);return u.top=pt(f.top,u.top),u.right=on(f.right,u.right),u.bottom=on(f.bottom,u.bottom),u.left=pt(f.left,u.left),u},Hl(t,a,o));return{width:c.right-c.left,height:c.bottom-c.top,x:c.left,y:c.top}}function a_(e){const{width:t,height:n}=gf(e);return{width:t,height:n}}function l_(e,t,n){const r=Dt(t),o=$t(t),s=n==="fixed",i=vn(e,!0,s,t);let a={scrollLeft:0,scrollTop:0};const c=Mt(0);function u(){c.x=Qo(o)}if(r||!r&&!s)if((nr(t)!=="body"||Or(o))&&(a=Xo(t)),r){const h=vn(t,!0,s,t);c.x=h.x+t.clientLeft,c.y=h.y+t.clientTop}else o&&u();s&&!r&&o&&u();const d=o&&!r&&!s?yf(o,a):Mt(0),f=i.left+a.scrollLeft-c.x-d.x,p=i.top+a.scrollTop-c.y-d.y;return{x:f,y:p,width:i.width,height:i.height}}function Cs(e){return jt(e).position==="static"}function Zl(e,t){if(!Dt(e)||jt(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return $t(e)===n&&(n=n.ownerDocument.body),n}function vf(e,t){const n=gt(e);if(Yo(e))return n;if(!Dt(e)){let o=sn(e);for(;o&&!Kn(o);){if(Ct(o)&&!Cs(o))return o;o=sn(o)}return n}let r=Zl(e,t);for(;r&&Hk(r)&&Cs(r);)r=Zl(r,t);return r&&Kn(r)&&Cs(r)&&!aa(r)?n:r||Kk(e)||n}const c_=async function(e){const t=this.getOffsetParent||vf,n=this.getDimensions,r=await n(e.floating);return{reference:l_(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function u_(e){return jt(e).direction==="rtl"}const d_={convertOffsetParentRelativeRectToViewportRelativeRect:Qk,getDocumentElement:$t,getClippingRect:i_,getOffsetParent:vf,getElementRects:c_,getClientRects:e_,getDimensions:a_,getScale:Bn,isElement:Ct,isRTL:u_};function wf(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function f_(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:p,height:h}=u;if(a||t(),!p||!h)return;const g=eo(f),m=eo(o.clientWidth-(d+p)),x=eo(o.clientHeight-(f+h)),b=eo(d),k={rootMargin:-g+"px "+-m+"px "+-x+"px "+-b+"px",threshold:pt(0,on(1,c))||1};let S=!0;function C(E){const N=E[0].intersectionRatio;if(N!==c){if(!S)return i();N?i(!1,N):r=setTimeout(()=>{i(!1,1e-7)},1e3)}N===1&&!wf(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 h_(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=ca(e),d=o||s?[...u?Nr(u):[],...Nr(t)]:[];d.forEach(b=>{o&&b.addEventListener("scroll",n,{passive:!0}),s&&b.addEventListener("resize",n)});const f=u&&a?f_(u,n):null;let p=-1,h=null;i&&(h=new ResizeObserver(b=>{let[v]=b;v&&v.target===u&&h&&(h.unobserve(t),cancelAnimationFrame(p),p=requestAnimationFrame(()=>{var k;(k=h)==null||k.observe(t)})),n()}),u&&!c&&h.observe(u),h.observe(t));let g,m=c?vn(e):null;c&&x();function x(){const b=vn(e);m&&!wf(m,b)&&n(),m=b,g=requestAnimationFrame(x)}return n(),()=>{var b;d.forEach(v=>{o&&v.removeEventListener("scroll",n),s&&v.removeEventListener("resize",n)}),f?.(),(b=h)==null||b.disconnect(),h=null,c&&cancelAnimationFrame(g)}}const p_=Lk,m_=Fk,g_=Ok,x_=Bk,y_=Mk,Wl=Rk,b_=$k,v_=(e,t,n)=>{const r=new Map,o={platform:d_,...n},s={...o.platform,_c:r};return Pk(e,t,{...o,platform:s})};var w_=typeof document<"u",k_=function(){},uo=w_?y.useLayoutEffect:k_;function Co(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(!Co(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)&&!Co(e[s],t[s]))return!1}return!0}return e!==e&&t!==t}function kf(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function ql(e,t){const n=kf(e);return Math.round(t*n)/n}function js(e){const t=y.useRef(e);return uo(()=>{t.current=e}),t}function __(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]=y.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[p,h]=y.useState(r);Co(p,r)||h(r);const[g,m]=y.useState(null),[x,b]=y.useState(null),v=y.useCallback(F=>{F!==E.current&&(E.current=F,m(F))},[]),k=y.useCallback(F=>{F!==N.current&&(N.current=F,b(F))},[]),S=s||g,C=i||x,E=y.useRef(null),N=y.useRef(null),z=y.useRef(d),T=c!=null,R=js(c),$=js(o),j=js(u),D=y.useCallback(()=>{if(!E.current||!N.current)return;const F={placement:t,strategy:n,middleware:p};$.current&&(F.platform=$.current),v_(E.current,N.current,F).then(q=>{const A={...q,isPositioned:j.current!==!1};w.current&&!Co(z.current,A)&&(z.current=A,Ir.flushSync(()=>{f(A)}))})},[p,t,n,$,j]);uo(()=>{u===!1&&z.current.isPositioned&&(z.current.isPositioned=!1,f(F=>({...F,isPositioned:!1})))},[u]);const w=y.useRef(!1);uo(()=>(w.current=!0,()=>{w.current=!1}),[]),uo(()=>{if(S&&(E.current=S),C&&(N.current=C),S&&C){if(R.current)return R.current(S,C,D);D()}},[S,C,D,R,T]);const M=y.useMemo(()=>({reference:E,floating:N,setReference:v,setFloating:k}),[v,k]),U=y.useMemo(()=>({reference:S,floating:C}),[S,C]),L=y.useMemo(()=>{const F={position:n,left:0,top:0};if(!U.floating)return F;const q=ql(U.floating,d.x),A=ql(U.floating,d.y);return a?{...F,transform:"translate("+q+"px, "+A+"px)",...kf(U.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:q,top:A}},[n,a,U.floating,d.x,d.y]);return y.useMemo(()=>({...d,update:D,refs:M,elements:U,floatingStyles:L}),[d,D,M,U,L])}const S_=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?Wl({element:r.current,padding:o}).fn(n):{}:r?Wl({element:r,padding:o}).fn(n):{}}}},C_=(e,t)=>({...p_(e),options:[e,t]}),j_=(e,t)=>({...m_(e),options:[e,t]}),E_=(e,t)=>({...b_(e),options:[e,t]}),N_=(e,t)=>({...g_(e),options:[e,t]}),T_=(e,t)=>({...x_(e),options:[e,t]}),A_=(e,t)=>({...y_(e),options:[e,t]}),z_=(e,t)=>({...S_(e),options:[e,t]});var I_="Arrow",_f=y.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"})})});_f.displayName=I_;var P_=_f,ua="Popper",[Sf,es]=Yt(ua),[R_,Cf]=Sf(ua),jf=e=>{const{__scopePopper:t,children:n}=e,[r,o]=y.useState(null);return l.jsx(R_,{scope:t,anchor:r,onAnchorChange:o,children:n})};jf.displayName=ua;var Ef="PopperAnchor",Nf=y.forwardRef((e,t)=>{const{__scopePopper:n,virtualRef:r,...o}=e,s=Cf(Ef,n),i=y.useRef(null),a=Oe(t,i),c=y.useRef(null);return y.useEffect(()=>{const u=c.current;c.current=r?.current||i.current,u!==c.current&&s.onAnchorChange(c.current)}),r?null:l.jsx(Ne.div,{...o,ref:a})});Nf.displayName=Ef;var da="PopperContent",[O_,M_]=Sf(da),Tf=y.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:p=!1,updatePositionStrategy:h="optimized",onPlaced:g,...m}=e,x=Cf(da,n),[b,v]=y.useState(null),k=Oe(t,le=>v(le)),[S,C]=y.useState(null),E=vk(S),N=E?.width??0,z=E?.height??0,T=r+(s!=="center"?"-"+s:""),R=typeof d=="number"?d:{top:0,right:0,bottom:0,left:0,...d},$=Array.isArray(u)?u:[u],j=$.length>0,D={padding:R,boundary:$.filter(L_),altBoundary:j},{refs:w,floatingStyles:M,placement:U,isPositioned:L,middlewareData:F}=__({strategy:"fixed",placement:T,whileElementsMounted:(...le)=>h_(...le,{animationFrame:h==="always"}),elements:{reference:x.anchor},middleware:[C_({mainAxis:o+z,alignmentAxis:i}),c&&j_({mainAxis:!0,crossAxis:!1,limiter:f==="partial"?E_():void 0,...D}),c&&N_({...D}),T_({...D,apply:({elements:le,rects:ne,availableWidth:de,availableHeight:fe})=>{const{width:he,height:we}=ne.reference,Me=le.floating.style;Me.setProperty("--radix-popper-available-width",`${de}px`),Me.setProperty("--radix-popper-available-height",`${fe}px`),Me.setProperty("--radix-popper-anchor-width",`${he}px`),Me.setProperty("--radix-popper-anchor-height",`${we}px`)}}),S&&z_({element:S,padding:a}),F_({arrowWidth:N,arrowHeight:z}),p&&A_({strategy:"referenceHidden",...D})]}),[q,A]=If(U),Z=st(g);tt(()=>{L&&Z?.()},[L,Z]);const W=F.arrow?.x,I=F.arrow?.y,se=F.arrow?.centerOffset!==0,[ee,pe]=y.useState();return tt(()=>{b&&pe(window.getComputedStyle(b).zIndex)},[b]),l.jsx("div",{ref:w.setFloating,"data-radix-popper-content-wrapper":"",style:{...M,transform:L?M.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:ee,"--radix-popper-transform-origin":[F.transformOrigin?.x,F.transformOrigin?.y].join(" "),...F.hide?.referenceHidden&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:l.jsx(O_,{scope:n,placedSide:q,onArrowChange:C,arrowX:W,arrowY:I,shouldHideArrow:se,children:l.jsx(Ne.div,{"data-side":q,"data-align":A,...m,ref:k,style:{...m.style,animation:L?void 0:"none"}})})})});Tf.displayName=da;var Af="PopperArrow",D_={top:"bottom",right:"left",bottom:"top",left:"right"},zf=y.forwardRef(function(t,n){const{__scopePopper:r,...o}=t,s=M_(Af,r),i=D_[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(P_,{...o,ref:n,style:{...o.style,display:"block"}})})});zf.displayName=Af;function L_(e){return e!==null}var F_=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]=If(n),f={start:"0%",center:"50%",end:"100%"}[d],p=(o.arrow?.x??0)+a/2,h=(o.arrow?.y??0)+c/2;let g="",m="";return u==="bottom"?(g=i?f:`${p}px`,m=`${-c}px`):u==="top"?(g=i?f:`${p}px`,m=`${r.floating.height+c}px`):u==="right"?(g=`${-c}px`,m=i?f:`${h}px`):u==="left"&&(g=`${r.floating.width+c}px`,m=i?f:`${h}px`),{data:{x:g,y:m}}}});function If(e){const[t,n="center"]=e.split("-");return[t,n]}var Pf=jf,Rf=Nf,Of=Tf,Mf=zf,Es="rovingFocusGroup.onEntryFocus",$_={bubbles:!1,cancelable:!0},Mr="RovingFocusGroup",[ci,Df,B_]=Id(Mr),[U_,Lf]=Yt(Mr,[B_]),[V_,H_]=U_(Mr),Ff=y.forwardRef((e,t)=>l.jsx(ci.Provider,{scope:e.__scopeRovingFocusGroup,children:l.jsx(ci.Slot,{scope:e.__scopeRovingFocusGroup,children:l.jsx(Z_,{...e,ref:t})})}));Ff.displayName=Mr;var Z_=y.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,p=y.useRef(null),h=Oe(t,p),g=Zo(s),[m,x]=yn({prop:i,defaultProp:a??null,onChange:c,caller:Mr}),[b,v]=y.useState(!1),k=st(u),S=Df(n),C=y.useRef(!1),[E,N]=y.useState(0);return y.useEffect(()=>{const z=p.current;if(z)return z.addEventListener(Es,k),()=>z.removeEventListener(Es,k)},[k]),l.jsx(V_,{scope:n,orientation:r,dir:g,loop:o,currentTabStopId:m,onItemFocus:y.useCallback(z=>x(z),[x]),onItemShiftTab:y.useCallback(()=>v(!0),[]),onFocusableItemAdd:y.useCallback(()=>N(z=>z+1),[]),onFocusableItemRemove:y.useCallback(()=>N(z=>z-1),[]),children:l.jsx(Ne.div,{tabIndex:b||E===0?-1:0,"data-orientation":r,...f,ref:h,style:{outline:"none",...e.style},onMouseDown:_e(e.onMouseDown,()=>{C.current=!0}),onFocus:_e(e.onFocus,z=>{const T=!C.current;if(z.target===z.currentTarget&&T&&!b){const R=new CustomEvent(Es,$_);if(z.currentTarget.dispatchEvent(R),!R.defaultPrevented){const $=S().filter(U=>U.focusable),j=$.find(U=>U.active),D=$.find(U=>U.id===m),M=[j,D,...$].filter(Boolean).map(U=>U.ref.current);Uf(M,d)}}C.current=!1}),onBlur:_e(e.onBlur,()=>v(!1))})})}),$f="RovingFocusGroupItem",Bf=y.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,focusable:r=!0,active:o=!1,tabStopId:s,children:i,...a}=e,c=Ot(),u=s||c,d=H_($f,n),f=d.currentTabStopId===u,p=Df(n),{onFocusableItemAdd:h,onFocusableItemRemove:g,currentTabStopId:m}=d;return y.useEffect(()=>{if(r)return h(),()=>g()},[r,h,g]),l.jsx(ci.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:_e(e.onMouseDown,x=>{r?d.onItemFocus(u):x.preventDefault()}),onFocus:_e(e.onFocus,()=>d.onItemFocus(u)),onKeyDown:_e(e.onKeyDown,x=>{if(x.key==="Tab"&&x.shiftKey){d.onItemShiftTab();return}if(x.target!==x.currentTarget)return;const b=J_(x,d.orientation,d.dir);if(b!==void 0){if(x.metaKey||x.ctrlKey||x.altKey||x.shiftKey)return;x.preventDefault();let k=p().filter(S=>S.focusable).map(S=>S.ref.current);if(b==="last")k.reverse();else if(b==="prev"||b==="next"){b==="prev"&&k.reverse();const S=k.indexOf(x.currentTarget);k=d.loop?K_(k,S+1):k.slice(S+1)}setTimeout(()=>Uf(k))}}),children:typeof i=="function"?i({isCurrentTabStop:f,hasTabStop:m!=null}):i})})});Bf.displayName=$f;var W_={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function q_(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function J_(e,t,n){const r=q_(e.key,n);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(r))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(r)))return W_[r]}function Uf(e,t=!1){const n=document.activeElement;for(const r of e)if(r===n||(r.focus({preventScroll:t}),document.activeElement!==n))return}function K_(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var G_=Ff,Y_=Bf;function ui(e,[t,n]){return Math.min(n,Math.max(t,e))}function X_(e,t){return y.useReducer((n,r)=>t[n][r]??n,e)}var fa="ScrollArea",[Vf]=Yt(fa),[Q_,vt]=Vf(fa),Hf=y.forwardRef((e,t)=>{const{__scopeScrollArea:n,type:r="hover",dir:o,scrollHideDelay:s=600,...i}=e,[a,c]=y.useState(null),[u,d]=y.useState(null),[f,p]=y.useState(null),[h,g]=y.useState(null),[m,x]=y.useState(null),[b,v]=y.useState(0),[k,S]=y.useState(0),[C,E]=y.useState(!1),[N,z]=y.useState(!1),T=Oe(t,$=>c($)),R=Zo(o);return l.jsx(Q_,{scope:n,type:r,dir:R,scrollHideDelay:s,scrollArea:a,viewport:u,onViewportChange:d,content:f,onContentChange:p,scrollbarX:h,onScrollbarXChange:g,scrollbarXEnabled:C,onScrollbarXEnabledChange:E,scrollbarY:m,onScrollbarYChange:x,scrollbarYEnabled:N,onScrollbarYEnabledChange:z,onCornerWidthChange:v,onCornerHeightChange:S,children:l.jsx(Ne.div,{dir:R,...i,ref:T,style:{position:"relative","--radix-scroll-area-corner-width":b+"px","--radix-scroll-area-corner-height":k+"px",...e.style}})})});Hf.displayName=fa;var Zf="ScrollAreaViewport",Wf=y.forwardRef((e,t)=>{const{__scopeScrollArea:n,children:r,nonce:o,...s}=e,i=vt(Zf,n),a=y.useRef(null),c=Oe(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})})]})});Wf.displayName=Zf;var Bt="ScrollAreaScrollbar",qf=y.forwardRef((e,t)=>{const{forceMount:n,...r}=e,o=vt(Bt,e.__scopeScrollArea),{onScrollbarXEnabledChange:s,onScrollbarYEnabledChange:i}=o,a=e.orientation==="horizontal";return y.useEffect(()=>(a?s(!0):i(!0),()=>{a?s(!1):i(!1)}),[a,s,i]),o.type==="hover"?l.jsx(eS,{...r,ref:t,forceMount:n}):o.type==="scroll"?l.jsx(tS,{...r,ref:t,forceMount:n}):o.type==="auto"?l.jsx(Jf,{...r,ref:t,forceMount:n}):o.type==="always"?l.jsx(ha,{...r,ref:t}):null});qf.displayName=Bt;var eS=y.forwardRef((e,t)=>{const{forceMount:n,...r}=e,o=vt(Bt,e.__scopeScrollArea),[s,i]=y.useState(!1);return y.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(Jf,{"data-state":s?"visible":"hidden",...r,ref:t})})}),tS=y.forwardRef((e,t)=>{const{forceMount:n,...r}=e,o=vt(Bt,e.__scopeScrollArea),s=e.orientation==="horizontal",i=ns(()=>c("SCROLL_END"),100),[a,c]=X_("hidden",{hidden:{SCROLL:"scrolling"},scrolling:{SCROLL_END:"idle",POINTER_ENTER:"interacting"},interacting:{SCROLL:"interacting",POINTER_LEAVE:"idle"},idle:{HIDE:"hidden",SCROLL:"scrolling",POINTER_ENTER:"interacting"}});return y.useEffect(()=>{if(a==="idle"){const u=window.setTimeout(()=>c("HIDE"),o.scrollHideDelay);return()=>window.clearTimeout(u)}},[a,o.scrollHideDelay,c]),y.useEffect(()=>{const u=o.viewport,d=s?"scrollLeft":"scrollTop";if(u){let f=u[d];const p=()=>{const h=u[d];f!==h&&(c("SCROLL"),i()),f=h};return u.addEventListener("scroll",p),()=>u.removeEventListener("scroll",p)}},[o.viewport,s,c,i]),l.jsx(bt,{present:n||a!=="hidden",children:l.jsx(ha,{"data-state":a==="hidden"?"hidden":"visible",...r,ref:t,onPointerEnter:_e(e.onPointerEnter,()=>c("POINTER_ENTER")),onPointerLeave:_e(e.onPointerLeave,()=>c("POINTER_LEAVE"))})})}),Jf=y.forwardRef((e,t)=>{const n=vt(Bt,e.__scopeScrollArea),{forceMount:r,...o}=e,[s,i]=y.useState(!1),a=e.orientation==="horizontal",c=ns(()=>{if(n.viewport){const u=n.viewport.offsetWidth<n.viewport.scrollWidth,d=n.viewport.offsetHeight<n.viewport.scrollHeight;i(a?u:d)}},10);return Gn(n.viewport,c),Gn(n.content,c),l.jsx(bt,{present:r||s,children:l.jsx(ha,{"data-state":s?"visible":"hidden",...o,ref:t})})}),ha=y.forwardRef((e,t)=>{const{orientation:n="vertical",...r}=e,o=vt(Bt,e.__scopeScrollArea),s=y.useRef(null),i=y.useRef(0),[a,c]=y.useState({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),u=Qf(a.viewport,a.content),d={...r,sizes:a,onSizesChange:c,hasThumb:u>0&&u<1,onThumbChange:p=>s.current=p,onThumbPointerUp:()=>i.current=0,onThumbPointerDown:p=>i.current=p};function f(p,h){return aS(p,i.current,a,h)}return n==="horizontal"?l.jsx(nS,{...d,ref:t,onThumbPositionChange:()=>{if(o.viewport&&s.current){const p=o.viewport.scrollLeft,h=Jl(p,a,o.dir);s.current.style.transform=`translate3d(${h}px, 0, 0)`}},onWheelScroll:p=>{o.viewport&&(o.viewport.scrollLeft=p)},onDragScroll:p=>{o.viewport&&(o.viewport.scrollLeft=f(p,o.dir))}}):n==="vertical"?l.jsx(rS,{...d,ref:t,onThumbPositionChange:()=>{if(o.viewport&&s.current){const p=o.viewport.scrollTop,h=Jl(p,a);s.current.style.transform=`translate3d(0, ${h}px, 0)`}},onWheelScroll:p=>{o.viewport&&(o.viewport.scrollTop=p)},onDragScroll:p=>{o.viewport&&(o.viewport.scrollTop=f(p))}}):null}),nS=y.forwardRef((e,t)=>{const{sizes:n,onSizesChange:r,...o}=e,s=vt(Bt,e.__scopeScrollArea),[i,a]=y.useState(),c=y.useRef(null),u=Oe(t,c,s.onScrollbarXChange);return y.useEffect(()=>{c.current&&a(getComputedStyle(c.current))},[c]),l.jsx(Gf,{"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":ts(n)+"px",...e.style},onThumbPointerDown:d=>e.onThumbPointerDown(d.x),onDragScroll:d=>e.onDragScroll(d.x),onWheelScroll:(d,f)=>{if(s.viewport){const p=s.viewport.scrollLeft+d.deltaX;e.onWheelScroll(p),th(p,f)&&d.preventDefault()}},onResize:()=>{c.current&&s.viewport&&i&&r({content:s.viewport.scrollWidth,viewport:s.viewport.offsetWidth,scrollbar:{size:c.current.clientWidth,paddingStart:Eo(i.paddingLeft),paddingEnd:Eo(i.paddingRight)}})}})}),rS=y.forwardRef((e,t)=>{const{sizes:n,onSizesChange:r,...o}=e,s=vt(Bt,e.__scopeScrollArea),[i,a]=y.useState(),c=y.useRef(null),u=Oe(t,c,s.onScrollbarYChange);return y.useEffect(()=>{c.current&&a(getComputedStyle(c.current))},[c]),l.jsx(Gf,{"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":ts(n)+"px",...e.style},onThumbPointerDown:d=>e.onThumbPointerDown(d.y),onDragScroll:d=>e.onDragScroll(d.y),onWheelScroll:(d,f)=>{if(s.viewport){const p=s.viewport.scrollTop+d.deltaY;e.onWheelScroll(p),th(p,f)&&d.preventDefault()}},onResize:()=>{c.current&&s.viewport&&i&&r({content:s.viewport.scrollHeight,viewport:s.viewport.offsetHeight,scrollbar:{size:c.current.clientHeight,paddingStart:Eo(i.paddingTop),paddingEnd:Eo(i.paddingBottom)}})}})}),[oS,Kf]=Vf(Bt),Gf=y.forwardRef((e,t)=>{const{__scopeScrollArea:n,sizes:r,hasThumb:o,onThumbChange:s,onThumbPointerUp:i,onThumbPointerDown:a,onThumbPositionChange:c,onDragScroll:u,onWheelScroll:d,onResize:f,...p}=e,h=vt(Bt,n),[g,m]=y.useState(null),x=Oe(t,T=>m(T)),b=y.useRef(null),v=y.useRef(""),k=h.viewport,S=r.content-r.viewport,C=st(d),E=st(c),N=ns(f,10);function z(T){if(b.current){const R=T.clientX-b.current.left,$=T.clientY-b.current.top;u({x:R,y:$})}}return y.useEffect(()=>{const T=R=>{const $=R.target;g?.contains($)&&C(R,S)};return document.addEventListener("wheel",T,{passive:!1}),()=>document.removeEventListener("wheel",T,{passive:!1})},[k,g,S,C]),y.useEffect(E,[r,E]),Gn(g,N),Gn(h.content,N),l.jsx(oS,{scope:n,scrollbar:g,hasThumb:o,onThumbChange:st(s),onThumbPointerUp:st(i),onThumbPositionChange:E,onThumbPointerDown:st(a),children:l.jsx(Ne.div,{...p,ref:x,style:{position:"absolute",...p.style},onPointerDown:_e(e.onPointerDown,T=>{T.button===0&&(T.target.setPointerCapture(T.pointerId),b.current=g.getBoundingClientRect(),v.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect="none",h.viewport&&(h.viewport.style.scrollBehavior="auto"),z(T))}),onPointerMove:_e(e.onPointerMove,z),onPointerUp:_e(e.onPointerUp,T=>{const R=T.target;R.hasPointerCapture(T.pointerId)&&R.releasePointerCapture(T.pointerId),document.body.style.webkitUserSelect=v.current,h.viewport&&(h.viewport.style.scrollBehavior=""),b.current=null})})})}),jo="ScrollAreaThumb",Yf=y.forwardRef((e,t)=>{const{forceMount:n,...r}=e,o=Kf(jo,e.__scopeScrollArea);return l.jsx(bt,{present:n||o.hasThumb,children:l.jsx(sS,{ref:t,...r})})}),sS=y.forwardRef((e,t)=>{const{__scopeScrollArea:n,style:r,...o}=e,s=vt(jo,n),i=Kf(jo,n),{onThumbPositionChange:a}=i,c=Oe(t,f=>i.onThumbChange(f)),u=y.useRef(void 0),d=ns(()=>{u.current&&(u.current(),u.current=void 0)},100);return y.useEffect(()=>{const f=s.viewport;if(f){const p=()=>{if(d(),!u.current){const h=lS(f,a);u.current=h,a()}};return a(),f.addEventListener("scroll",p),()=>f.removeEventListener("scroll",p)}},[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:_e(e.onPointerDownCapture,f=>{const h=f.target.getBoundingClientRect(),g=f.clientX-h.left,m=f.clientY-h.top;i.onThumbPointerDown({x:g,y:m})}),onPointerUp:_e(e.onPointerUp,i.onThumbPointerUp)})});Yf.displayName=jo;var pa="ScrollAreaCorner",Xf=y.forwardRef((e,t)=>{const n=vt(pa,e.__scopeScrollArea),r=!!(n.scrollbarX&&n.scrollbarY);return n.type!=="scroll"&&r?l.jsx(iS,{...e,ref:t}):null});Xf.displayName=pa;var iS=y.forwardRef((e,t)=>{const{__scopeScrollArea:n,...r}=e,o=vt(pa,n),[s,i]=y.useState(0),[a,c]=y.useState(0),u=!!(s&&a);return Gn(o.scrollbarX,()=>{const d=o.scrollbarX?.offsetHeight||0;o.onCornerHeightChange(d),c(d)}),Gn(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 Eo(e){return e?parseInt(e,10):0}function Qf(e,t){const n=e/t;return isNaN(n)?0:n}function ts(e){const t=Qf(e.viewport,e.content),n=e.scrollbar.paddingStart+e.scrollbar.paddingEnd,r=(e.scrollbar.size-n)*t;return Math.max(r,18)}function aS(e,t,n,r="ltr"){const o=ts(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 eh([c,u],f)(e)}function Jl(e,t,n="ltr"){const r=ts(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=ui(e,c);return eh([0,i],[0,a])(u)}function eh(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 th(e,t){return e>0&&e<t}var lS=(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 ns(e,t){const n=st(e),r=y.useRef(0);return y.useEffect(()=>()=>window.clearTimeout(r.current),[]),y.useCallback(()=>{window.clearTimeout(r.current),r.current=window.setTimeout(n,t)},[n,t])}function Gn(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 cS=Hf,uS=Wf,dS=Xf,fS=[" ","Enter","ArrowUp","ArrowDown"],hS=[" ","Enter"],wn="Select",[rs,os,pS]=Id(wn),[rr]=Yt(wn,[pS,es]),ss=es(),[mS,un]=rr(wn),[gS,xS]=rr(wn),nh=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:p,required:h,form:g}=e,m=ss(t),[x,b]=y.useState(null),[v,k]=y.useState(null),[S,C]=y.useState(!1),E=Zo(u),[N,z]=yn({prop:r,defaultProp:o??!1,onChange:s,caller:wn}),[T,R]=yn({prop:i,defaultProp:a,onChange:c,caller:wn}),$=y.useRef(null),j=x?g||!!x.closest("form"):!0,[D,w]=y.useState(new Set),M=Array.from(D).map(U=>U.props.value).join(";");return l.jsx(Pf,{...m,children:l.jsxs(mS,{required:h,scope:t,trigger:x,onTriggerChange:b,valueNode:v,onValueNodeChange:k,valueNodeHasChildren:S,onValueNodeHasChildrenChange:C,contentId:Ot(),value:T,onValueChange:R,open:N,onOpenChange:z,dir:E,triggerPointerDownPosRef:$,disabled:p,children:[l.jsx(rs.Provider,{scope:t,children:l.jsx(gS,{scope:e.__scopeSelect,onNativeOptionAdd:y.useCallback(U=>{w(L=>new Set(L).add(U))},[]),onNativeOptionRemove:y.useCallback(U=>{w(L=>{const F=new Set(L);return F.delete(U),F})},[]),children:n})}),j?l.jsxs(Sh,{"aria-hidden":!0,required:h,tabIndex:-1,name:d,autoComplete:f,value:T,onChange:U=>R(U.target.value),disabled:p,form:g,children:[T===void 0?l.jsx("option",{value:""}):null,Array.from(D)]},M):null]})})};nh.displayName=wn;var rh="SelectTrigger",oh=y.forwardRef((e,t)=>{const{__scopeSelect:n,disabled:r=!1,...o}=e,s=ss(n),i=un(rh,n),a=i.disabled||r,c=Oe(t,i.onTriggerChange),u=os(n),d=y.useRef("touch"),[f,p,h]=jh(m=>{const x=u().filter(k=>!k.disabled),b=x.find(k=>k.value===i.value),v=Eh(x,m,b);v!==void 0&&i.onValueChange(v.value)}),g=m=>{a||(i.onOpenChange(!0),h()),m&&(i.triggerPointerDownPosRef.current={x:Math.round(m.pageX),y:Math.round(m.pageY)})};return l.jsx(Rf,{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":Ch(i.value)?"":void 0,...o,ref:c,onClick:_e(o.onClick,m=>{m.currentTarget.focus(),d.current!=="mouse"&&g(m)}),onPointerDown:_e(o.onPointerDown,m=>{d.current=m.pointerType;const x=m.target;x.hasPointerCapture(m.pointerId)&&x.releasePointerCapture(m.pointerId),m.button===0&&m.ctrlKey===!1&&m.pointerType==="mouse"&&(g(m),m.preventDefault())}),onKeyDown:_e(o.onKeyDown,m=>{const x=f.current!=="";!(m.ctrlKey||m.altKey||m.metaKey)&&m.key.length===1&&p(m.key),!(x&&m.key===" ")&&fS.includes(m.key)&&(g(),m.preventDefault())})})})});oh.displayName=rh;var sh="SelectValue",ih=y.forwardRef((e,t)=>{const{__scopeSelect:n,className:r,style:o,children:s,placeholder:i="",...a}=e,c=un(sh,n),{onValueNodeHasChildrenChange:u}=c,d=s!==void 0,f=Oe(t,c.onValueNodeChange);return tt(()=>{u(d)},[u,d]),l.jsx(Ne.span,{...a,ref:f,style:{pointerEvents:"none"},children:Ch(c.value)?l.jsx(l.Fragment,{children:i}):s})});ih.displayName=sh;var yS="SelectIcon",ah=y.forwardRef((e,t)=>{const{__scopeSelect:n,children:r,...o}=e;return l.jsx(Ne.span,{"aria-hidden":!0,...o,ref:t,children:r||"▼"})});ah.displayName=yS;var bS="SelectPortal",lh=e=>l.jsx(qo,{asChild:!0,...e});lh.displayName=bS;var kn="SelectContent",ch=y.forwardRef((e,t)=>{const n=un(kn,e.__scopeSelect),[r,o]=y.useState();if(tt(()=>{o(new DocumentFragment)},[]),!n.open){const s=r;return s?Ir.createPortal(l.jsx(uh,{scope:e.__scopeSelect,children:l.jsx(rs.Slot,{scope:e.__scopeSelect,children:l.jsx("div",{children:e.children})})}),s):null}return l.jsx(dh,{...e,ref:t})});ch.displayName=kn;var _t=10,[uh,dn]=rr(kn),vS="SelectContentImpl",wS=Jn("SelectContent.RemoveScroll"),dh=y.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:p,collisionPadding:h,sticky:g,hideWhenDetached:m,avoidCollisions:x,...b}=e,v=un(kn,n),[k,S]=y.useState(null),[C,E]=y.useState(null),N=Oe(t,le=>S(le)),[z,T]=y.useState(null),[R,$]=y.useState(null),j=os(n),[D,w]=y.useState(!1),M=y.useRef(!1);y.useEffect(()=>{if(k)return Kd(k)},[k]),$d();const U=y.useCallback(le=>{const[ne,...de]=j().map(we=>we.ref.current),[fe]=de.slice(-1),he=document.activeElement;for(const we of le)if(we===he||(we?.scrollIntoView({block:"nearest"}),we===ne&&C&&(C.scrollTop=0),we===fe&&C&&(C.scrollTop=C.scrollHeight),we?.focus(),document.activeElement!==he))return},[j,C]),L=y.useCallback(()=>U([z,k]),[U,z,k]);y.useEffect(()=>{D&&L()},[D,L]);const{onOpenChange:F,triggerPointerDownPosRef:q}=v;y.useEffect(()=>{if(k){let le={x:0,y:0};const ne=fe=>{le={x:Math.abs(Math.round(fe.pageX)-(q.current?.x??0)),y:Math.abs(Math.round(fe.pageY)-(q.current?.y??0))}},de=fe=>{le.x<=10&&le.y<=10?fe.preventDefault():k.contains(fe.target)||F(!1),document.removeEventListener("pointermove",ne),q.current=null};return q.current!==null&&(document.addEventListener("pointermove",ne),document.addEventListener("pointerup",de,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",ne),document.removeEventListener("pointerup",de,{capture:!0})}}},[k,F,q]),y.useEffect(()=>{const le=()=>F(!1);return window.addEventListener("blur",le),window.addEventListener("resize",le),()=>{window.removeEventListener("blur",le),window.removeEventListener("resize",le)}},[F]);const[A,Z]=jh(le=>{const ne=j().filter(he=>!he.disabled),de=ne.find(he=>he.ref.current===document.activeElement),fe=Eh(ne,le,de);fe&&setTimeout(()=>fe.ref.current.focus())}),W=y.useCallback((le,ne,de)=>{const fe=!M.current&&!de;(v.value!==void 0&&v.value===ne||fe)&&(T(le),fe&&(M.current=!0))},[v.value]),I=y.useCallback(()=>k?.focus(),[k]),se=y.useCallback((le,ne,de)=>{const fe=!M.current&&!de;(v.value!==void 0&&v.value===ne||fe)&&$(le)},[v.value]),ee=r==="popper"?di:fh,pe=ee===di?{side:a,sideOffset:c,align:u,alignOffset:d,arrowPadding:f,collisionBoundary:p,collisionPadding:h,sticky:g,hideWhenDetached:m,avoidCollisions:x}:{};return l.jsx(uh,{scope:n,content:k,viewport:C,onViewportChange:E,itemRefCallback:W,selectedItem:z,onItemLeave:I,itemTextRefCallback:se,focusSelectedItem:L,selectedItemText:R,position:r,isPositioned:D,searchRef:A,children:l.jsx(ea,{as:wS,allowPinchZoom:!0,children:l.jsx(Qi,{asChild:!0,trapped:v.open,onMountAutoFocus:le=>{le.preventDefault()},onUnmountAutoFocus:_e(o,le=>{v.trigger?.focus({preventScroll:!0}),le.preventDefault()}),children:l.jsx(Wo,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:s,onPointerDownOutside:i,onFocusOutside:le=>le.preventDefault(),onDismiss:()=>v.onOpenChange(!1),children:l.jsx(ee,{role:"listbox",id:v.contentId,"data-state":v.open?"open":"closed",dir:v.dir,onContextMenu:le=>le.preventDefault(),...b,...pe,onPlaced:()=>w(!0),ref:N,style:{display:"flex",flexDirection:"column",outline:"none",...b.style},onKeyDown:_e(b.onKeyDown,le=>{const ne=le.ctrlKey||le.altKey||le.metaKey;if(le.key==="Tab"&&le.preventDefault(),!ne&&le.key.length===1&&Z(le.key),["ArrowUp","ArrowDown","Home","End"].includes(le.key)){let fe=j().filter(he=>!he.disabled).map(he=>he.ref.current);if(["ArrowUp","End"].includes(le.key)&&(fe=fe.slice().reverse()),["ArrowUp","ArrowDown"].includes(le.key)){const he=le.target,we=fe.indexOf(he);fe=fe.slice(we+1)}setTimeout(()=>U(fe)),le.preventDefault()}})})})})})})});dh.displayName=vS;var kS="SelectItemAlignedPosition",fh=y.forwardRef((e,t)=>{const{__scopeSelect:n,onPlaced:r,...o}=e,s=un(kn,n),i=dn(kn,n),[a,c]=y.useState(null),[u,d]=y.useState(null),f=Oe(t,N=>d(N)),p=os(n),h=y.useRef(!1),g=y.useRef(!0),{viewport:m,selectedItem:x,selectedItemText:b,focusSelectedItem:v}=i,k=y.useCallback(()=>{if(s.trigger&&s.valueNode&&a&&u&&m&&x&&b){const N=s.trigger.getBoundingClientRect(),z=u.getBoundingClientRect(),T=s.valueNode.getBoundingClientRect(),R=b.getBoundingClientRect();if(s.dir!=="rtl"){const he=R.left-z.left,we=T.left-he,Me=N.left-we,_=N.width+Me,Q=Math.max(_,z.width),G=window.innerWidth-_t,O=ui(we,[_t,Math.max(_t,G-Q)]);a.style.minWidth=_+"px",a.style.left=O+"px"}else{const he=z.right-R.right,we=window.innerWidth-T.right-he,Me=window.innerWidth-N.right-we,_=N.width+Me,Q=Math.max(_,z.width),G=window.innerWidth-_t,O=ui(we,[_t,Math.max(_t,G-Q)]);a.style.minWidth=_+"px",a.style.right=O+"px"}const $=p(),j=window.innerHeight-_t*2,D=m.scrollHeight,w=window.getComputedStyle(u),M=parseInt(w.borderTopWidth,10),U=parseInt(w.paddingTop,10),L=parseInt(w.borderBottomWidth,10),F=parseInt(w.paddingBottom,10),q=M+U+D+F+L,A=Math.min(x.offsetHeight*5,q),Z=window.getComputedStyle(m),W=parseInt(Z.paddingTop,10),I=parseInt(Z.paddingBottom,10),se=N.top+N.height/2-_t,ee=j-se,pe=x.offsetHeight/2,le=x.offsetTop+pe,ne=M+U+le,de=q-ne;if(ne<=se){const he=$.length>0&&x===$[$.length-1].ref.current;a.style.bottom="0px";const we=u.clientHeight-m.offsetTop-m.offsetHeight,Me=Math.max(ee,pe+(he?I:0)+we+L),_=ne+Me;a.style.height=_+"px"}else{const he=$.length>0&&x===$[0].ref.current;a.style.top="0px";const Me=Math.max(se,M+m.offsetTop+(he?W:0)+pe)+de;a.style.height=Me+"px",m.scrollTop=ne-se+m.offsetTop}a.style.margin=`${_t}px 0`,a.style.minHeight=A+"px",a.style.maxHeight=j+"px",r?.(),requestAnimationFrame(()=>h.current=!0)}},[p,s.trigger,s.valueNode,a,u,m,x,b,s.dir,r]);tt(()=>k(),[k]);const[S,C]=y.useState();tt(()=>{u&&C(window.getComputedStyle(u).zIndex)},[u]);const E=y.useCallback(N=>{N&&g.current===!0&&(k(),v?.(),g.current=!1)},[k,v]);return l.jsx(SS,{scope:n,contentWrapper:a,shouldExpandOnScrollRef:h,onScrollButtonChange:E,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}})})})});fh.displayName=kS;var _S="SelectPopperPosition",di=y.forwardRef((e,t)=>{const{__scopeSelect:n,align:r="start",collisionPadding:o=_t,...s}=e,i=ss(n);return l.jsx(Of,{...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)"}})});di.displayName=_S;var[SS,ma]=rr(kn,{}),fi="SelectViewport",hh=y.forwardRef((e,t)=>{const{__scopeSelect:n,nonce:r,...o}=e,s=dn(fi,n),i=ma(fi,n),a=Oe(t,s.onViewportChange),c=y.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(rs.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:_e(o.onScroll,u=>{const d=u.currentTarget,{contentWrapper:f,shouldExpandOnScrollRef:p}=i;if(p?.current&&f){const h=Math.abs(c.current-d.scrollTop);if(h>0){const g=window.innerHeight-_t*2,m=parseFloat(f.style.minHeight),x=parseFloat(f.style.height),b=Math.max(m,x);if(b<g){const v=b+h,k=Math.min(g,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})})})]})});hh.displayName=fi;var ph="SelectGroup",[CS,jS]=rr(ph),ES=y.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,o=Ot();return l.jsx(CS,{scope:n,id:o,children:l.jsx(Ne.div,{role:"group","aria-labelledby":o,...r,ref:t})})});ES.displayName=ph;var mh="SelectLabel",NS=y.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,o=jS(mh,n);return l.jsx(Ne.div,{id:o.id,...r,ref:t})});NS.displayName=mh;var No="SelectItem",[TS,gh]=rr(No),xh=y.forwardRef((e,t)=>{const{__scopeSelect:n,value:r,disabled:o=!1,textValue:s,...i}=e,a=un(No,n),c=dn(No,n),u=a.value===r,[d,f]=y.useState(s??""),[p,h]=y.useState(!1),g=Oe(t,v=>c.itemRefCallback?.(v,r,o)),m=Ot(),x=y.useRef("touch"),b=()=>{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(TS,{scope:n,value:r,disabled:o,textId:m,isSelected:u,onItemTextChange:y.useCallback(v=>{f(k=>k||(v?.textContent??"").trim())},[]),children:l.jsx(rs.ItemSlot,{scope:n,value:r,disabled:o,textValue:d,children:l.jsx(Ne.div,{role:"option","aria-labelledby":m,"data-highlighted":p?"":void 0,"aria-selected":u&&p,"data-state":u?"checked":"unchecked","aria-disabled":o||void 0,"data-disabled":o?"":void 0,tabIndex:o?void 0:-1,...i,ref:g,onFocus:_e(i.onFocus,()=>h(!0)),onBlur:_e(i.onBlur,()=>h(!1)),onClick:_e(i.onClick,()=>{x.current!=="mouse"&&b()}),onPointerUp:_e(i.onPointerUp,()=>{x.current==="mouse"&&b()}),onPointerDown:_e(i.onPointerDown,v=>{x.current=v.pointerType}),onPointerMove:_e(i.onPointerMove,v=>{x.current=v.pointerType,o?c.onItemLeave?.():x.current==="mouse"&&v.currentTarget.focus({preventScroll:!0})}),onPointerLeave:_e(i.onPointerLeave,v=>{v.currentTarget===document.activeElement&&c.onItemLeave?.()}),onKeyDown:_e(i.onKeyDown,v=>{c.searchRef?.current!==""&&v.key===" "||(hS.includes(v.key)&&b(),v.key===" "&&v.preventDefault())})})})})});xh.displayName=No;var yr="SelectItemText",yh=y.forwardRef((e,t)=>{const{__scopeSelect:n,className:r,style:o,...s}=e,i=un(yr,n),a=dn(yr,n),c=gh(yr,n),u=xS(yr,n),[d,f]=y.useState(null),p=Oe(t,b=>f(b),c.onItemTextChange,b=>a.itemTextRefCallback?.(b,c.value,c.disabled)),h=d?.textContent,g=y.useMemo(()=>l.jsx("option",{value:c.value,disabled:c.disabled,children:h},c.value),[c.disabled,c.value,h]),{onNativeOptionAdd:m,onNativeOptionRemove:x}=u;return tt(()=>(m(g),()=>x(g)),[m,x,g]),l.jsxs(l.Fragment,{children:[l.jsx(Ne.span,{id:c.textId,...s,ref:p}),c.isSelected&&i.valueNode&&!i.valueNodeHasChildren?Ir.createPortal(s.children,i.valueNode):null]})});yh.displayName=yr;var bh="SelectItemIndicator",vh=y.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e;return gh(bh,n).isSelected?l.jsx(Ne.span,{"aria-hidden":!0,...r,ref:t}):null});vh.displayName=bh;var hi="SelectScrollUpButton",wh=y.forwardRef((e,t)=>{const n=dn(hi,e.__scopeSelect),r=ma(hi,e.__scopeSelect),[o,s]=y.useState(!1),i=Oe(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(_h,{...e,ref:i,onAutoScroll:()=>{const{viewport:a,selectedItem:c}=n;a&&c&&(a.scrollTop=a.scrollTop-c.offsetHeight)}}):null});wh.displayName=hi;var pi="SelectScrollDownButton",kh=y.forwardRef((e,t)=>{const n=dn(pi,e.__scopeSelect),r=ma(pi,e.__scopeSelect),[o,s]=y.useState(!1),i=Oe(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(_h,{...e,ref:i,onAutoScroll:()=>{const{viewport:a,selectedItem:c}=n;a&&c&&(a.scrollTop=a.scrollTop+c.offsetHeight)}}):null});kh.displayName=pi;var _h=y.forwardRef((e,t)=>{const{__scopeSelect:n,onAutoScroll:r,...o}=e,s=dn("SelectScrollButton",n),i=y.useRef(null),a=os(n),c=y.useCallback(()=>{i.current!==null&&(window.clearInterval(i.current),i.current=null)},[]);return y.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:_e(o.onPointerDown,()=>{i.current===null&&(i.current=window.setInterval(r,50))}),onPointerMove:_e(o.onPointerMove,()=>{s.onItemLeave?.(),i.current===null&&(i.current=window.setInterval(r,50))}),onPointerLeave:_e(o.onPointerLeave,()=>{c()})})}),AS="SelectSeparator",zS=y.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e;return l.jsx(Ne.div,{"aria-hidden":!0,...r,ref:t})});zS.displayName=AS;var mi="SelectArrow",IS=y.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,o=ss(n),s=un(mi,n),i=dn(mi,n);return s.open&&i.position==="popper"?l.jsx(Mf,{...o,...r,ref:t}):null});IS.displayName=mi;var PS="SelectBubbleInput",Sh=y.forwardRef(({__scopeSelect:e,value:t,...n},r)=>{const o=y.useRef(null),s=Oe(r,o),i=bk(t);return y.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:{...Ad,...n.style},ref:s,defaultValue:t})});Sh.displayName=PS;function Ch(e){return e===""||e===void 0}function jh(e){const t=st(e),n=y.useRef(""),r=y.useRef(0),o=y.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=y.useCallback(()=>{n.current="",window.clearTimeout(r.current)},[]);return y.useEffect(()=>()=>window.clearTimeout(r.current),[]),[n,o,s]}function Eh(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=RS(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 RS(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var OS=nh,MS=oh,DS=ih,LS=ah,FS=lh,$S=ch,BS=hh,US=xh,VS=yh,HS=vh,ZS=wh,WS=kh,is="Tabs",[qS]=Yt(is,[Lf]),Nh=Lf(),[JS,ga]=qS(is),Th=y.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,onValueChange:o,defaultValue:s,orientation:i="horizontal",dir:a,activationMode:c="automatic",...u}=e,d=Zo(a),[f,p]=yn({prop:r,onChange:o,defaultProp:s??"",caller:is});return l.jsx(JS,{scope:n,baseId:Ot(),value:f,onValueChange:p,orientation:i,dir:d,activationMode:c,children:l.jsx(Ne.div,{dir:d,"data-orientation":i,...u,ref:t})})});Th.displayName=is;var Ah="TabsList",zh=y.forwardRef((e,t)=>{const{__scopeTabs:n,loop:r=!0,...o}=e,s=ga(Ah,n),i=Nh(n);return l.jsx(G_,{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})})});zh.displayName=Ah;var Ih="TabsTrigger",Ph=y.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,disabled:o=!1,...s}=e,i=ga(Ih,n),a=Nh(n),c=Mh(i.baseId,r),u=Dh(i.baseId,r),d=r===i.value;return l.jsx(Y_,{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:_e(e.onMouseDown,f=>{!o&&f.button===0&&f.ctrlKey===!1?i.onValueChange(r):f.preventDefault()}),onKeyDown:_e(e.onKeyDown,f=>{[" ","Enter"].includes(f.key)&&i.onValueChange(r)}),onFocus:_e(e.onFocus,()=>{const f=i.activationMode!=="manual";!d&&!o&&f&&i.onValueChange(r)})})})});Ph.displayName=Ih;var Rh="TabsContent",Oh=y.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,forceMount:o,children:s,...i}=e,a=ga(Rh,n),c=Mh(a.baseId,r),u=Dh(a.baseId,r),d=r===a.value,f=y.useRef(d);return y.useEffect(()=>{const p=requestAnimationFrame(()=>f.current=!1);return()=>cancelAnimationFrame(p)},[]),l.jsx(bt,{present:o||d,children:({present:p})=>l.jsx(Ne.div,{"data-state":d?"active":"inactive","data-orientation":a.orientation,role:"tabpanel","aria-labelledby":c,hidden:!p,id:u,tabIndex:0,...i,ref:t,style:{...e.style,animationDuration:f.current?"0s":void 0},children:p&&s})})});Oh.displayName=Rh;function Mh(e,t){return`${e}-trigger-${t}`}function Dh(e,t){return`${e}-content-${t}`}var KS=Th,GS=zh,YS=Ph,XS=Oh,[as]=Yt("Tooltip",[es]),ls=es(),Lh="TooltipProvider",QS=700,gi="tooltip.open",[eC,xa]=as(Lh),Fh=e=>{const{__scopeTooltip:t,delayDuration:n=QS,skipDelayDuration:r=300,disableHoverableContent:o=!1,children:s}=e,i=y.useRef(!0),a=y.useRef(!1),c=y.useRef(0);return y.useEffect(()=>{const u=c.current;return()=>window.clearTimeout(u)},[]),l.jsx(eC,{scope:t,isOpenDelayedRef:i,delayDuration:n,onOpen:y.useCallback(()=>{window.clearTimeout(c.current),i.current=!1},[]),onClose:y.useCallback(()=>{window.clearTimeout(c.current),c.current=window.setTimeout(()=>i.current=!0,r)},[r]),isPointerInTransitRef:a,onPointerInTransitChange:y.useCallback(u=>{a.current=u},[]),disableHoverableContent:o,children:s})};Fh.displayName=Lh;var Tr="Tooltip",[tC,Dr]=as(Tr),$h=e=>{const{__scopeTooltip:t,children:n,open:r,defaultOpen:o,onOpenChange:s,disableHoverableContent:i,delayDuration:a}=e,c=xa(Tr,e.__scopeTooltip),u=ls(t),[d,f]=y.useState(null),p=Ot(),h=y.useRef(0),g=i??c.disableHoverableContent,m=a??c.delayDuration,x=y.useRef(!1),[b,v]=yn({prop:r,defaultProp:o??!1,onChange:N=>{N?(c.onOpen(),document.dispatchEvent(new CustomEvent(gi))):c.onClose(),s?.(N)},caller:Tr}),k=y.useMemo(()=>b?x.current?"delayed-open":"instant-open":"closed",[b]),S=y.useCallback(()=>{window.clearTimeout(h.current),h.current=0,x.current=!1,v(!0)},[v]),C=y.useCallback(()=>{window.clearTimeout(h.current),h.current=0,v(!1)},[v]),E=y.useCallback(()=>{window.clearTimeout(h.current),h.current=window.setTimeout(()=>{x.current=!0,v(!0),h.current=0},m)},[m,v]);return y.useEffect(()=>()=>{h.current&&(window.clearTimeout(h.current),h.current=0)},[]),l.jsx(Pf,{...u,children:l.jsx(tC,{scope:t,contentId:p,open:b,stateAttribute:k,trigger:d,onTriggerChange:f,onTriggerEnter:y.useCallback(()=>{c.isOpenDelayedRef.current?E():S()},[c.isOpenDelayedRef,E,S]),onTriggerLeave:y.useCallback(()=>{g?C():(window.clearTimeout(h.current),h.current=0)},[C,g]),onOpen:S,onClose:C,disableHoverableContent:g,children:n})})};$h.displayName=Tr;var xi="TooltipTrigger",Bh=y.forwardRef((e,t)=>{const{__scopeTooltip:n,...r}=e,o=Dr(xi,n),s=xa(xi,n),i=ls(n),a=y.useRef(null),c=Oe(t,a,o.onTriggerChange),u=y.useRef(!1),d=y.useRef(!1),f=y.useCallback(()=>u.current=!1,[]);return y.useEffect(()=>()=>document.removeEventListener("pointerup",f),[f]),l.jsx(Rf,{asChild:!0,...i,children:l.jsx(Ne.button,{"aria-describedby":o.open?o.contentId:void 0,"data-state":o.stateAttribute,...r,ref:c,onPointerMove:_e(e.onPointerMove,p=>{p.pointerType!=="touch"&&!d.current&&!s.isPointerInTransitRef.current&&(o.onTriggerEnter(),d.current=!0)}),onPointerLeave:_e(e.onPointerLeave,()=>{o.onTriggerLeave(),d.current=!1}),onPointerDown:_e(e.onPointerDown,()=>{o.open&&o.onClose(),u.current=!0,document.addEventListener("pointerup",f,{once:!0})}),onFocus:_e(e.onFocus,()=>{u.current||o.onOpen()}),onBlur:_e(e.onBlur,o.onClose),onClick:_e(e.onClick,o.onClose)})})});Bh.displayName=xi;var ya="TooltipPortal",[nC,rC]=as(ya,{forceMount:void 0}),Uh=e=>{const{__scopeTooltip:t,forceMount:n,children:r,container:o}=e,s=Dr(ya,t);return l.jsx(nC,{scope:t,forceMount:n,children:l.jsx(bt,{present:n||s.open,children:l.jsx(qo,{asChild:!0,container:o,children:r})})})};Uh.displayName=ya;var Yn="TooltipContent",Vh=y.forwardRef((e,t)=>{const n=rC(Yn,e.__scopeTooltip),{forceMount:r=n.forceMount,side:o="top",...s}=e,i=Dr(Yn,e.__scopeTooltip);return l.jsx(bt,{present:r||i.open,children:i.disableHoverableContent?l.jsx(Hh,{side:o,...s,ref:t}):l.jsx(oC,{side:o,...s,ref:t})})}),oC=y.forwardRef((e,t)=>{const n=Dr(Yn,e.__scopeTooltip),r=xa(Yn,e.__scopeTooltip),o=y.useRef(null),s=Oe(t,o),[i,a]=y.useState(null),{trigger:c,onClose:u}=n,d=o.current,{onPointerInTransitChange:f}=r,p=y.useCallback(()=>{a(null),f(!1)},[f]),h=y.useCallback((g,m)=>{const x=g.currentTarget,b={x:g.clientX,y:g.clientY},v=lC(b,x.getBoundingClientRect()),k=cC(b,v),S=uC(m.getBoundingClientRect()),C=fC([...k,...S]);a(C),f(!0)},[f]);return y.useEffect(()=>()=>p(),[p]),y.useEffect(()=>{if(c&&d){const g=x=>h(x,d),m=x=>h(x,c);return c.addEventListener("pointerleave",g),d.addEventListener("pointerleave",m),()=>{c.removeEventListener("pointerleave",g),d.removeEventListener("pointerleave",m)}}},[c,d,h,p]),y.useEffect(()=>{if(i){const g=m=>{const x=m.target,b={x:m.clientX,y:m.clientY},v=c?.contains(x)||d?.contains(x),k=!dC(b,i);v?p():k&&(p(),u())};return document.addEventListener("pointermove",g),()=>document.removeEventListener("pointermove",g)}},[c,d,i,u,p]),l.jsx(Hh,{...e,ref:s})}),[sC,iC]=as(Tr,{isInside:!1}),aC=I2("TooltipContent"),Hh=y.forwardRef((e,t)=>{const{__scopeTooltip:n,children:r,"aria-label":o,onEscapeKeyDown:s,onPointerDownOutside:i,...a}=e,c=Dr(Yn,n),u=ls(n),{onClose:d}=c;return y.useEffect(()=>(document.addEventListener(gi,d),()=>document.removeEventListener(gi,d)),[d]),y.useEffect(()=>{if(c.trigger){const f=p=>{p.target?.contains(c.trigger)&&d()};return window.addEventListener("scroll",f,{capture:!0}),()=>window.removeEventListener("scroll",f,{capture:!0})}},[c.trigger,d]),l.jsx(Wo,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:s,onPointerDownOutside:i,onFocusOutside:f=>f.preventDefault(),onDismiss:d,children:l.jsxs(Of,{"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(aC,{children:r}),l.jsx(sC,{scope:n,isInside:!0,children:l.jsx(F2,{id:c.contentId,role:"tooltip",children:o||r})})]})})});Vh.displayName=Yn;var Zh="TooltipArrow",Wh=y.forwardRef((e,t)=>{const{__scopeTooltip:n,...r}=e,o=ls(n);return iC(Zh,n).isInside?null:l.jsx(Mf,{...o,...r,ref:t})});Wh.displayName=Zh;function lC(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 cC(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 uC(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 dC(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,p=c.y;d>r!=p>r&&n<(f-u)*(r-d)/(p-d)+u&&(o=!o)}return o}function fC(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),hC(t)}function hC(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 pC=Fh,mC=$h,gC=Bh,xC=Uh,yC=Vh,bC=Wh;const vC=Ki("inline-flex items-center justify-center rounded-full border border-transparent px-2 py-0.5 text-xs font-medium w-fit whitespace-nowrap shrink-0 [&>svg]:size-3 gap-1 [&>svg]:pointer-events-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive transition-[color,box-shadow] overflow-hidden",{variants:{variant:{default:"bg-primary text-primary-foreground [a&]:hover:bg-primary/90",secondary:"bg-secondary text-secondary-foreground [a&]:hover:bg-secondary/90",destructive:"bg-destructive text-white [a&]:hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60",outline:"border-border text-foreground [a&]:hover:bg-accent [a&]:hover:text-accent-foreground",ghost:"[a&]:hover:bg-accent [a&]:hover:text-accent-foreground",link:"text-primary underline-offset-4 [a&]:hover:underline"}},defaultVariants:{variant:"default"}});function St({className:e,variant:t="default",asChild:n=!1,...r}){const o=n?A2:"span";return l.jsx(o,{"data-slot":"badge","data-variant":t,className:ve(vC({variant:t}),e),...r})}function ba({...e}){return l.jsx(fk,{"data-slot":"dialog",...e})}function wC({...e}){return l.jsx(hk,{"data-slot":"dialog-trigger",...e})}function kC({...e}){return l.jsx(pk,{"data-slot":"dialog-portal",...e})}function _C({className:e,...t}){return l.jsx(mk,{"data-slot":"dialog-overlay",className:ve("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",e),...t})}function va({className:e,children:t,...n}){return l.jsxs(kC,{children:[l.jsx(_C,{}),l.jsxs(gk,{"data-slot":"dialog-content",className:ve("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] rounded-lg",e),...n,children:[t,l.jsxs(yk,{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(Wi,{className:"size-4"}),l.jsx("span",{className:"sr-only",children:"Close"})]})]})]})}function wa({className:e,...t}){return l.jsx("div",{"data-slot":"dialog-header",className:ve("flex flex-col space-y-1.5 text-center sm:text-left",e),...t})}function ka({className:e,...t}){return l.jsx(xk,{"data-slot":"dialog-title",className:ve("text-lg font-semibold leading-none tracking-tight",e),...t})}const SC=Ki("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:ve(SC({variant:t,size:n,className:e})),...r})}function qh({open:e,onOpenChange:t,title:n,description:r,confirmLabel:o="Confirm",variant:s="default",onConfirm:i}){return l.jsx(ba,{open:e,onOpenChange:t,children:l.jsxs(va,{children:[l.jsx(wa,{children:l.jsx(ka,{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 CC={anthropic:"Anthropic",openai:"OpenAI",unknown:"Unknown"};function jC({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:p,onClear:h}){const[g,m]=y.useState(!1),x=v=>{v.stopPropagation(),h!==void 0&&m(!0)},b=y.useCallback(v=>{v.stopPropagation(),window.open(hm(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:ve("flex items-center gap-3 px-3 py-2 cursor-pointer transition-colors","hover:bg-muted/50","select-none","border border-border rounded-lg mb-2 bg-background sticky top-0 z-10","focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1 focus-visible:outline-none"),onClick:c,onKeyDown:v=>{v.target===v.currentTarget&&(v.key==="Enter"||v.key===" ")&&(v.preventDefault(),c())},children:[a?l.jsx(Gt,{className:"size-4 text-muted-foreground shrink-0"}):d?l.jsx(jr,{className:"size-4 animate-spin text-muted-foreground shrink-0"}):l.jsx(cn,{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(kv,{className:"size-3"}),l.jsx("span",{className:"font-mono tabular-nums truncate max-w-[120px]",children:f})]}),!u&&l.jsx(St,{variant:"outline",className:ve("text-[10px] px-1.5 py-0 h-5 font-mono shrink-0",i==="openai"&&"border-blue-500/40 text-blue-400",i==="anthropic"&&"border-orange-500/40 text-orange-400",i==="unknown"&&"border-muted text-muted-foreground"),children:CC[i]}),l.jsxs("span",{className:"flex items-center gap-1 text-muted-foreground text-xs shrink-0",children:[l.jsx(rn,{className:"size-3"}),l.jsx("span",{className:"font-mono tabular-nums",children:qi(t,n,p)})]}),l.jsxs("span",{className:"flex items-center gap-1 text-muted-foreground text-xs shrink-0",children:[l.jsx(Vo,{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(Er,{className:"size-3 text-muted-foreground"}),l.jsxs("span",{className:"font-mono tabular-nums",children:[l.jsx("span",{className:"text-blue-400",children:Qe(o)})," / ",l.jsx("span",{className:"text-amber-400",children:Qe(s)})]})]}),l.jsx("span",{className:"flex-1 min-w-0"}),l.jsx("button",{type:"button",onClick:b,onKeyDown:v=>{(v.key==="Enter"||v.key===" ")&&b(v)},"aria-label":`Open session ${e} in a new tab`,title:"Open this session in a new tab",className:"text-muted-foreground hover:text-foreground transition-colors shrink-0 inline-flex items-center justify-center size-8 rounded hover:bg-muted cursor-pointer",children:l.jsx(cd,{className:"size-3.5"})}),h!==void 0&&l.jsx("button",{type:"button",onClick:x,"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(hd,{className:"size-3.5"})}),l.jsx(qh,{open:g,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:()=>{h?.()}})]})}function EC(e){const t=e.find(n=>n.apiFormat!=="unknown");return t!==void 0?t.apiFormat:e[0]?.apiFormat??"unknown"}function NC(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 TC(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 AC(e){const t=new Map;for(const r of e){const o=TC(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 Kl(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function zC(e){if(e.responseText===null)return null;try{let t=JSON.parse(e.responseText);return typeof t=="string"&&(t=JSON.parse(t)),Kl(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&&Kl(t.choices[0])&&typeof t.choices[0].finish_reason=="string"&&t.choices[0].finish_reason==="stop"?"stop":null:null}catch{return null}}function Jh(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:ve("inline-block size-5",e),children:[l.jsx("path",{d:n}),r,o,s,i]})}const fn=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"})]}),Kh=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 Gh({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:fn,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 IC({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:Kh,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 PC({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:fn,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 RC({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 OC({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:fn,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 MC({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:fn,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 DC({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:Kh,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 LC({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:fn,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 FC({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:fn,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 $C({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:fn,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 BC({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:fn,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 UC({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 Ar=[Gh,IC,PC,RC,OC,MC,DC,LC,FC,$C,BC,UC];function To(e){return Ar[Math.abs(e)%Ar.length]??Gh}function VC(e){const t=Ar.length-2;return t<=0?0:1+((Number.isFinite(e)?Math.trunc(e):0)%t+t)%t}function HC(e){return To(VC(e))}const ZC="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",WC="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",qC="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",JC="/assets/minimax-BPMzvuL-.jpeg",KC="/assets/alibaba-TTwafVwX.svg",GC="/assets/qwen-CONDcHqt.png",YC="/assets/zhipuai-BPNAnxo-.svg",XC={"claude-":"anthropic","gpt-":"openai","o1-":"openai","o3-":"openai","deepseek-":"deepseek",MiniMax:"minimax",qwen:"qwen","glm-":"zhipuai"};function Yh(e){if(e===null)return"unknown";const t=e.toLowerCase();for(const[n,r]of Object.entries(XC))if(t.startsWith(n.toLowerCase()))return r;return"unknown"}const jn={width:24,height:24,objectFit:"contain"},QC=at.memo(({className:e})=>l.jsx("img",{src:ZC,alt:"Anthropic",className:e,style:jn})),e5=at.memo(({className:e})=>l.jsx("img",{src:WC,alt:"OpenAI",className:e,style:{...jn,background:"white",borderRadius:"4px"}})),t5=at.memo(({className:e})=>l.jsx("img",{src:qC,alt:"DeepSeek",className:e,style:jn})),n5=at.memo(({className:e})=>l.jsx("img",{src:JC,alt:"MiniMax",className:e,style:jn})),r5=at.memo(({className:e})=>l.jsx("img",{src:KC,alt:"Alibaba",className:e,style:jn})),o5=at.memo(({className:e})=>l.jsx("img",{src:GC,alt:"Qwen",className:e,style:jn})),s5=at.memo(({className:e})=>l.jsx("img",{src:YC,alt:"ZhipuAI",className:e,style:jn}));function Xh({provider:e,className:t}){switch(e){case"anthropic":return l.jsx(QC,{className:t});case"openai":return l.jsx(e5,{className:t});case"deepseek":return l.jsx(t5,{className:t});case"minimax":return l.jsx(n5,{className:t});case"alibaba":return l.jsx(r5,{className:t});case"qwen":return l.jsx(o5,{className:t});case"zhipuai":return l.jsx(s5,{className:t});case"unknown":return null}}function Xe({delayDuration:e=0,...t}){return l.jsx(pC,{"data-slot":"tooltip-provider",delayDuration:e,...t})}function $e({...e}){return l.jsx(mC,{"data-slot":"tooltip",...e})}function Be({...e}){return l.jsx(gC,{"data-slot":"tooltip-trigger",...e})}function Ue({className:e,sideOffset:t=0,children:n,...r}){return l.jsx(xC,{children:l.jsxs(yC,{"data-slot":"tooltip-content",sideOffset:t,className:ve("bg-foreground text-background animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 w-fit origin-(--radix-tooltip-content-transform-origin) rounded-md px-3 py-1.5 text-xs text-balance",e),...r,children:[n,l.jsx(bC,{className:"bg-foreground fill-foreground z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px]"})]})})}const i5="x-anthropic-billing-header:";function a5(e){return e.trimStart().toLowerCase().startsWith(i5)}function l5(e){return Zu(e)?Object.prototype.hasOwnProperty.call(e,"system"):!1}function c5(e){if(!Zu(e))return!1;const t=De(e,"type"),n=De(e,"text");return typeof t!="string"||t!=="text"||typeof n!="string"?!1:a5(n)}function u5(e){let t;try{t=JSON.parse(e)}catch{return{body:e,removed:0}}if(!l5(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(c5(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 d5(e){return{depth:Number.POSITIVE_INFINITY}}function Qh(e){try{const t=JSON.parse(e);return{kind:"json",data:Ao(t)}}catch{return{kind:"text"}}}function Ns(e){const t=y.useMemo(()=>e===null?null:Qh(e),[e]),n=t?.kind==="json"?t.data:null,r=y.useMemo(()=>n===null?null:d5(),[n]),[o,s]=y.useState(!1),[i,a]=y.useState(0),[c,u]=y.useState(0),[d,f]=y.useTransition(),p=y.useCallback(()=>{const h=!o,g=h&&r!==null?r.depth:0;f(()=>{s(h),a(g),u(m=>m+1)})},[o,r]);return{parsedData:n,policy:r,isExpanded:o,toggle:p,isPending:d,bulkDepth:i,bulkRevision:c}}function Ao(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=>Ao(n));const t={};for(const n of Object.keys(e)){const r=Object.getOwnPropertyDescriptor(e,n);t[n]=Ao(r?.value)}return t}case"bigint":case"symbol":case"function":case"undefined":return String(e)}return null}function ep({className:e,orientation:t="horizontal",...n}){return l.jsx(KS,{"data-slot":"tabs","data-orientation":t,orientation:t,className:ve("group/tabs flex gap-2 data-[orientation=horizontal]:flex-col",e),...n})}const f5=Ki("rounded-lg p-[3px] group-data-[orientation=horizontal]/tabs:h-9 data-[variant=line]:rounded-none group/tabs-list text-muted-foreground inline-flex w-fit items-center justify-center group-data-[orientation=vertical]/tabs:h-fit group-data-[orientation=vertical]/tabs:flex-col",{variants:{variant:{default:"bg-muted",line:"gap-1 bg-transparent"}},defaultVariants:{variant:"default"}});function tp({className:e,variant:t="default",...n}){return l.jsx(GS,{"data-slot":"tabs-list","data-variant":t,className:ve(f5({variant:t}),e),...n})}function At({className:e,...t}){return l.jsx(YS,{"data-slot":"tabs-trigger",className:ve("focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:outline-ring text-foreground/60 hover:text-foreground dark:text-muted-foreground dark:hover:text-foreground relative inline-flex h-[calc(100%-1px)] flex-1 items-center justify-center gap-1.5 rounded-md border border-transparent px-2 py-1 text-sm font-medium whitespace-nowrap transition-all group-data-[orientation=vertical]/tabs:w-full group-data-[orientation=vertical]/tabs:justify-start focus-visible:ring-[3px] focus-visible:outline-1 disabled:pointer-events-none disabled:opacity-50 group-data-[variant=default]/tabs-list:data-[state=active]:shadow-sm group-data-[variant=line]/tabs-list:data-[state=active]:shadow-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4","group-data-[variant=line]/tabs-list:bg-transparent group-data-[variant=line]/tabs-list:data-[state=active]:bg-transparent dark:group-data-[variant=line]/tabs-list:data-[state=active]:border-transparent dark:group-data-[variant=line]/tabs-list:data-[state=active]:bg-transparent","data-[state=active]:bg-background dark:data-[state=active]:text-foreground dark:data-[state=active]:border-input dark:data-[state=active]:bg-input/30 data-[state=active]:text-foreground","after:bg-foreground after:absolute after:opacity-0 after:transition-opacity group-data-[orientation=horizontal]/tabs:after:inset-x-0 group-data-[orientation=horizontal]/tabs:after:bottom-[-5px] group-data-[orientation=horizontal]/tabs:after:h-0.5 group-data-[orientation=vertical]/tabs:after:inset-y-0 group-data-[orientation=vertical]/tabs:after:-right-1 group-data-[orientation=vertical]/tabs:after:w-0.5 group-data-[variant=line]/tabs-list:data-[state=active]:after:opacity-100",e),...t})}function zt({className:e,...t}){return l.jsx(XS,{"data-slot":"tabs-content",className:ve("flex-1 outline-none",e),...t})}function mn(e){const[t,n]=y.useState(!1),r=y.useRef(null);y.useEffect(()=>()=>{r.current!==null&&clearTimeout(r.current)},[]);const o=y.useCallback(s=>{s.stopPropagation(),e!==null&&window.navigator.clipboard.writeText(e).then(()=>{n(!0),r.current!==null&&clearTimeout(r.current),r.current=setTimeout(()=>n(!1),2e3)})},[e]);return{copied:t,copy:o}}const h5=y.lazy(()=>_n(()=>import("./CompareDrawer-C9OWdxHM.js"),__vite__mapDeps([0,1])).then(e=>({default:e.CompareDrawer}))),p5=y.lazy(()=>_n(()=>import("./ReplayDialog-CwE6I1Pe.js"),__vite__mapDeps([2,1,3])).then(e=>({default:e.ReplayDialog}))),m5=y.lazy(()=>_n(()=>import("./RequestAnatomy-DEehC3yz.js"),__vite__mapDeps([4,1])).then(e=>({default:e.RequestAnatomy}))),g5=y.lazy(()=>_n(()=>import("./ResponseView-CE5UsuUq.js"),__vite__mapDeps([3,1])).then(e=>({default:e.ResponseView}))),x5=y.lazy(()=>_n(()=>import("./StreamingChunkSequence-CLcLZ7-W.js"),__vite__mapDeps([5,1])).then(e=>({default:e.StreamingChunkSequence}))),Gl=y.lazy(()=>_n(()=>Promise.resolve().then(()=>Zp),void 0).then(e=>({default:e.JsonViewer}))),y5=y.lazy(()=>_n(()=>Promise.resolve().then(()=>Zp),void 0).then(e=>({default:e.JsonViewerFromString}))),b5=1200,v5=12;function w5(e){const{containerRef:t,setExpandToPath:n,ensureTabActive:r,highlightMs:o}=e,s=y.useRef(null);return y.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??b5)},u=`[data-anatomy-path="${(f=>typeof CSS<"u"&&typeof CSS.escape=="function"?CSS.escape(f):f.replace(/(["'\\[\](){}])/g,"\\$1"))(i.path)}"]`,d=f=>{const p=t.current;if(p!==null){const h=p.querySelector(u);if(h!==null){a(h);return}}f>0?window.requestAnimationFrame(()=>d(f-1)):n(null)};window.requestAnimationFrame(()=>d(v5))},[t,r,o,n])}class np{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,p=Date.now()+f,h=[{oldPos:-1,lastComponent:void 0}];let g=this.extractCommon(h[0],n,t,0,r);if(h[0].oldPos+1>=c&&g+1>=a)return i(this.buildValues(h[0].lastComponent,n,t));let m=-1/0,x=1/0;const b=()=>{for(let v=Math.max(m,-u);v<=Math.min(x,u);v+=2){let k;const S=h[v-1],C=h[v+1];S&&(h[v-1]=void 0);let E=!1;if(C){const z=C.oldPos-v;E=C&&0<=z&&z<a}const N=S&&S.oldPos+1<c;if(!E&&!N){h[v]=void 0;continue}if(!N||E&&S.oldPos<C.oldPos?k=this.addToPath(C,!0,!1,0,r):k=this.addToPath(S,!1,!0,1,r),g=this.extractCommon(k,n,t,v,r),k.oldPos+1>=c&&g+1>=a)return i(this.buildValues(k.lastComponent,n,t))||!0;h[v]=k,k.oldPos+1>=c&&(x=Math.min(x,v-1)),g+1>=a&&(m=Math.max(m,v+1))}u++};if(o)(function v(){setTimeout(function(){if(u>d||Date.now()>p)return o(void 0);b()||v()},0)})();else for(;u<=d&&Date.now()<=p;){const v=b();if(v)return v}}addToPath(t,n,r,o,s){const i=t.lastComponent;return i&&!s.oneChangePerToken&&i.added===n&&i.removed===r?{oldPos:t.oldPos+o,lastComponent:{count:i.count+1,added:n,removed:r,previousComponent:i.previousComponent}}:{oldPos:t.oldPos+o,lastComponent:{count:1,added:n,removed:r,previousComponent:i}}}extractCommon(t,n,r,o,s){const i=n.length,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(p,h){const g=r[u+h];return g.length>p.length?g:p}),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 k5 extends np{constructor(){super(...arguments),this.tokenize=op}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 _5=new k5;function rp(e,t,n){return _5.diff(e,t,n)}function op(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 S5 extends np{constructor(){super(...arguments),this.tokenize=op}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(yi(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 C5=new S5;function j5(e,t,n){return C5.diff(e,t,n)}function yi(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]=yi(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]=yi(e[c],t,n,r,c);t.pop(),n.pop()}else i=e;return i}function Yl(e){return e===void 0?[]:Object.entries(e).map(t=>[t[0].toLowerCase(),t[1]]).sort(([t],[n])=>t.localeCompare(n))}function Xl([e,t]){return`${e}: ${t}`}function bi(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 E5(e,t){const n=Yl(e).map(Xl).join(`
|
|
92
|
-
`),r=Yl(t).map(Xl).join(`
|
|
93
|
-
`);if(n===r)return{lines:[],isEmpty:!0};const o=rp(n,r);return{lines:bi(o),isEmpty:!1}}function Ql(e){try{const t=JSON.parse(e);return t===null||typeof t=="string"||typeof t=="object"?t:null}catch{return null}}function N5(e,t){const n=e??"",r=t??"";if(n===r)return{lines:[],isEmpty:!0};const o=Ql(n),s=Ql(r);if(o!==null&&s!==null){const a=j5(o,s)??[];if(a.length===1){const c=a[0];if(c!==void 0&&!c.added&&!c.removed)return{lines:[],isEmpty:!0}}return{lines:bi(a),isEmpty:!1}}const i=rp(n,r);return{lines:bi(i),isEmpty:!1}}function T5(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 In(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 ec(e,t){if(e===void 0)throw new Error("Unexpected undefined");return e}const tc=(e,t)=>Math.abs(e-t)<1.01,A5=(e,t,n)=>{let r;return function(...o){e.clearTimeout(r),r=e.setTimeout(()=>t.apply(this,o),n)}};let cr;const nc=()=>{if(cr!==void 0)return cr;if(typeof navigator>"u")return cr=!1;if(/iP(hone|od|ad)/.test(navigator.userAgent))return cr=!0;const e=navigator.maxTouchPoints;return cr=navigator.platform==="MacIntel"&&e!==void 0&&e>0},rc=e=>{const{offsetWidth:t,offsetHeight:n}=e;return{width:t,height:n}},z5=e=>e,I5=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},P5=(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(rc(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(rc(n))};e.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(a):a()});return s.observe(n,{box:"border-box"}),()=>{s.unobserve(n)}},zo={passive:!0},R5=typeof window>"u"?!0:"onscrollend"in window,O5=(e,t,n)=>{const r=e.scrollElement;if(!r)return;const o=e.targetWindow;if(!o)return;const s=e.options.useScrollendEvent&&R5;let i=0;const a=s?null:A5(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,zo),s&&r.addEventListener("scrollend",d,zo),()=>{r.removeEventListener("scroll",u),s&&r.removeEventListener("scrollend",d)}},M5=(e,t)=>O5(e,t,n=>{const{horizontal:r,isRtl:o}=e.options;return r?n.scrollLeft*(o&&-1||1):n.scrollTop}),D5=(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"]},L5=(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})},F5=L5;class $5{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:z5,rangeExtractor:I5,onChange:()=>{},measureElement:D5,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(),p=u>0?((r=f[0])==null?void 0:r.key)??i.getItemKey(0):null,h=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)!==p||s.getItemKey(d-1)!==h)){const x=u>0?this.getVirtualItemForOffset(this.getScrollOffset())??f[0]:null;x&&(a=[x.key,this.getScrollOffset()-x.start]);const b=s.followOnAppend===!0?"auto":s.followOnAppend||null;b&&d>u&&this.isAtEnd(i.scrollEndThreshold)&&(u===0||s.getItemKey(d-1)!==h)&&(c=b)}}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=In(()=>(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,!(!nc()||this.targetWindow==null)&&(this._iosJustTouchEnded=!0,this._iosTouchEndTimerId=this.targetWindow.setTimeout(()=>{this._iosJustTouchEnded=!1,this._iosTouchEndTimerId=null,this._flushIosDeferredIfReady()},150))};s.addEventListener("touchstart",i,zo),s.addEventListener("touchend",a,zo),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 p=f.start+i-this.getScrollOffset();tc(p,0)||this.applyScrollAdjustment(p)}}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=In(()=>[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=In(()=>[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 g of this.laneAssignments.keys())g>=n&&this.laneAssignments.delete(g);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(g=>{this.itemSizeCache.set(g.key,g.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 g=this.options.gap,m=n*2;let x=this._flatMeasurements;if(!x||x.length<m){const k=new Float64Array(m);x&&f>0&&k.set(x.subarray(0,f*2)),x=k,this._flatMeasurements=x}let b;if(f===0)b=r+o;else{const k=f-1;b=x[k*2]+x[k*2+1]+g}for(let k=f;k<n;k++){const S=s(k),C=d.get(S),E=typeof C=="number"?C:this.options.estimateSize(k);x[k*2]=b,x[k*2+1]=E,b+=E+g}const v=T5(n,x,s);return this.measurementsCache=v,v}const p=this.measurementsCache.slice(0,f),h=new Array(a).fill(void 0);for(let g=0;g<f;g++){const m=p[g];m&&(h[m.lane]=g)}for(let g=f;g<n;g++){const m=s(g),x=this.laneAssignments.get(g);let b,v;const k=c==="estimate"||d.has(m);if(x!==void 0&&this.options.lanes>1){b=x;const N=h[b],z=N!==void 0?p[N]:void 0;v=z?z.end+this.options.gap:r+o}else{const N=this.options.lanes===1?p[g-1]:this.getFurthestMeasurement(p,g);v=N?N.end+this.options.gap:r+o,b=N?N.lane:g%this.options.lanes,this.options.lanes>1&&k&&this.laneAssignments.set(g,b)}const S=d.get(m),C=typeof S=="number"?S:this.options.estimateSize(g),E=v+C;p[g]={index:g,start:v,size:C,end:E,key:m,lane:b},h[b]=g}return this.measurementsCache=p,p},{key:!1,debug:()=>this.options.debug}),this.calculateRange=In(()=>[this.getMeasurements(),this.getSize(),this.getScrollOffset(),this.options.lanes],(n,r,o,s)=>this.range=n.length>0&&r>0?B5({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=In(()=>{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 p=this.measurementsCache[n];if(!p)return;c=p.key,a=p.start,i=p.size}const d=this.itemSizeCache.get(c)??i,f=r-d;if(f!==0){const p=this.options.anchorTo==="end"&&((o=this.scrollState)==null?void 0:o.behavior)!=="smooth"&&this.getVirtualDistanceFromEnd()<=this.options.scrollEndThreshold,h=p?this.getTotalSize():0,g=((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++,p?this.applyScrollAdjustment(this.getTotalSize()-h):g&&this.applyScrollAdjustment(f),this.notify(!1)}},this.getVirtualItems=In(()=>[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=sp(0,r.length-1,s?a=>o[a*2]:a=>ec(r[a]).start,n);return ec(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&&(nc()&&(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&&tc(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 sp=(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 B5({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=sp(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(p=>p<n+t);){const p=e[u];d[p.lane]=p.end,u++}const f=Array(r).fill(n+t);for(;c>=0&&f.some(p=>p>=n);){const p=e[c];f[p.lane]=p.start,c--}c=Math.max(0,c-c%r),u=Math.min(s,u+(r-1-u%r))}return{startIndex:c,endIndex:u}}const oc=typeof document<"u"?y.useLayoutEffect:y.useEffect;function U5({useFlushSync:e=!0,...t}){const n=y.useReducer(s=>s+1,0)[1],r={...t,onChange:(s,i)=>{var a;e&&i?Ir.flushSync(n):n(),(a=t.onChange)==null||a.call(t,s,i)}},[o]=y.useState(()=>new $5(r));return o.setOptions(r),oc(()=>o._didMount(),[]),oc(()=>o._willUpdate()),o}function V5(e){return U5({observeElementRect:P5,observeElementOffset:M5,scrollToFn:F5,...e})}const H5=22,Ts=1e4;function Z5(e){return e==="added"?"+":e==="removed"?"-":" "}function W5(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 q5=function({result:t,emptyLabel:n}){const[r,o]=y.useState("unified"),s=y.useRef(null),i=V5({count:t.lines.length,getScrollElement:()=>s.current,estimateSize:()=>H5,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>Ts,u=c?t.lines.slice(0,Ts):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 ${Ts.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:ve("flex items-center gap-1 px-2 py-1 transition-colors",r==="unified"?"bg-muted text-foreground":"hover:bg-muted/50"),title:"Unified diff (single column)",children:[l.jsx(ov,{className:"size-3"}),"Unified"]}),l.jsxs("button",{type:"button",onClick:()=>o("split"),"aria-pressed":r==="split",className:ve("flex items-center gap-1 px-2 py-1 transition-colors border-l border-border",r==="split"?"bg-muted text-foreground":"hover:bg-muted/50"),title:"Split diff (side by side)",children:[l.jsx(gb,{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(J5,{virtualizer:i,lines:u}):l.jsx(Y5,{lines:u})})]})};function J5({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:ve("flex items-start gap-3 px-2",W5(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:ve("select-none w-3 text-right font-bold",r.kind==="added"&&"text-green-600 dark:text-green-400",r.kind==="removed"&&"text-red-600 dark:text-red-400"),children:Z5(r.kind)}),l.jsx("span",{className:"whitespace-pre-wrap break-all flex-1",children:r.text})]},n.key)})})}function K5(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 G5(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 Y5({lines:e}){const t=K5(e);return l.jsx("div",{"data-testid":"diff-split",children:t.map((n,r)=>l.jsxs("div",{className:ve("grid grid-cols-2 font-mono text-xs",G5(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:ve("select-none w-3 text-right font-bold",(n.kind==="removed"||n.kind==="changed")&&"text-red-600 dark:text-red-400"),children:n.left!==null?"-":" "}),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:ve("select-none w-3 text-right font-bold",(n.kind==="added"||n.kind==="changed")&&"text-green-600 dark:text-green-400"),children:n.right!==null?"+":" "}),l.jsx("span",{className:"whitespace-pre-wrap break-all flex-1",children:n.right?.text??""})]})]},r))})}const ip=y.memo(q5),X5={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 As(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?Zy:By,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,Qe(e.delta)]})]})}const Q5=y.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=E2(e.responseStatus),p=e.elapsedMs!==null&&u>0&&e.elapsedMs>u*1e3,h=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:ve("flex items-center gap-2 px-3 py-1 cursor-pointer transition-colors","hover:bg-muted/50","select-none","focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1 focus-visible:outline-none"),onClick:o,onKeyDown:g=>{(g.key==="Enter"||g.key===" ")&&(g.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(rn,{className:"size-3"}),l.jsx("span",{className:"font-mono tabular-nums",title:e.timestamp,children:ni(e.timestamp,d)})]}),e.model!==null&&l.jsxs($e,{children:[l.jsx(Be,{asChild:!0,children:l.jsx("span",{className:"shrink-0",children:l.jsx(Xh,{provider:Yh(e.model),className:"size-4"})})}),l.jsx(Ue,{children:e.model})]}),f!=="success"&&l.jsxs(St,{variant:"outline",className:ve("text-[10px] px-1.5 py-0 h-5 font-mono tabular-nums gap-1",X5[f]),children:[f==="server_error"?l.jsx(Jb,{className:"size-3","aria-label":"Server error"}):f==="client_error"?l.jsx(bo,{className:"size-3","aria-label":"Client error"}):f==="pending"?l.jsx(jr,{className:"size-3 animate-spin","aria-label":"Pending"}):null,e.responseStatus]}),e.elapsedMs!==null&&l.jsxs($e,{children:[l.jsx(Be,{asChild:!0,children:l.jsxs("span",{className:ve("flex items-center gap-1 text-xs shrink-0",p?"text-amber-400":"text-muted-foreground"),children:[l.jsx(rn,{className:"size-3"}),l.jsx("span",{className:"font-mono tabular-nums",children:As(e.elapsedMs)}),p&&l.jsx(bo,{className:"size-3","aria-label":"Slow response"})]})}),l.jsx(Ue,{children:p?`Slow response: ${As(e.elapsedMs)} exceeds ${As(u*1e3)}`:"Elapsed response time"})]}),h&&l.jsxs("span",{className:"flex items-center gap-1 text-xs shrink-0",children:[l.jsx(Er,{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?Qe(e.inputTokens):"—"]})," / ",l.jsxs("span",{className:e.outputTokens!==null?"text-amber-400":"text-muted-foreground",children:["OUT ",e.outputTokens!==null?Qe(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 +",Qe(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 ~",Qe(e.cacheReadInputTokens)]})]}),t!==null&&l.jsxs("span",{className:"flex items-center gap-1 text-muted-foreground text-xs shrink-0",children:[l.jsx(Vo,{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(Rr,{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(ud,{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($e,{children:[l.jsx(Be,{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(Tb,{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(Ue,{children:e.clientCwd!==null?`PID: ${e.clientPid??"?"} CWD: ${e.clientCwd}`:`Process ID: ${e.clientPid??"?"}`})]}),e.streaming&&l.jsxs($e,{children:[l.jsx(Be,{asChild:!0,children:l.jsx(Xb,{className:"size-3 text-muted-foreground/60 shrink-0"})}),l.jsx(Ue,{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:g=>g.stopPropagation(),onKeyDown:g=>g.stopPropagation(),children:[a!==void 0&&i!==void 0&&(()=>{const g=a[i];return g===void 0?null:l.jsxs(l.Fragment,{children:[g.expansion!==null&&l.jsxs($e,{children:[l.jsx(Be,{asChild:!0,children:l.jsx(Re,{variant:"outline",size:"icon",className:"size-8",onClick:g.expansion.onToggle,disabled:g.expansion.isPending,"aria-pressed":g.expansion.isExpanded,"aria-label":g.expansion.isExpanded?"Collapse all JSON":"Expand all JSON",children:g.expansion.isExpanded?l.jsx(nb,{className:"size-3.5"}):l.jsx(ad,{className:"size-3.5"})})}),l.jsx(Ue,{children:g.expansion.isExpanded?"Collapse all JSON nodes":"Expand all JSON nodes"})]}),g.diffWithRaw!==void 0&&l.jsxs($e,{children:[l.jsx(Be,{asChild:!0,children:l.jsx(Re,{variant:"outline",size:"icon",className:ve("size-8",g.diffWithRaw.active&&"bg-accent text-accent-foreground"),onClick:g.diffWithRaw.onToggle,"aria-pressed":g.diffWithRaw.active,"aria-label":g.diffWithRaw.active?"Hide raw diff":"Diff with raw",children:l.jsx(Cb,{className:"size-3.5"})})}),l.jsx(Ue,{children:g.diffWithRaw.active?"Hide diff with raw request":"Show diff between displayed and raw request body"})]}),g.diffWithPrevious!==void 0&&l.jsxs($e,{children:[l.jsx(Be,{asChild:!0,children:l.jsx(Re,{variant:"outline",size:"icon",className:"size-8",onClick:g.diffWithPrevious,"aria-label":"Diff with previous",children:l.jsx(Lb,{className:"size-3.5"})})}),l.jsx(Ue,{children:"Compare this request with the immediately preceding one"})]}),g.copyText!==null&&l.jsxs($e,{children:[l.jsx(Be,{asChild:!0,children:l.jsx(Re,{variant:"outline",size:"icon",className:"size-8",onClick:g.onCopy,"aria-label":g.copyCopied?"Copied":g.copyLabel,children:g.copyCopied?l.jsx(ct,{className:"size-3.5 text-emerald-500"}):l.jsx(Ft,{className:"size-3.5"})})}),l.jsx(Ue,{children:g.copyCopied?"Copied to clipboard":g.copyLabel})]})]})})(),c!==void 0&&l.jsxs($e,{children:[l.jsx(Be,{asChild:!0,children:l.jsx(Re,{variant:"outline",size:"icon",className:"size-8",onClick:c,"aria-label":"Replay request",children:l.jsx(tv,{className:"size-3.5"})})}),l.jsx(Ue,{children:"Re-send this request to the provider"})]})]}),r?l.jsx(Gt,{className:"size-4 text-muted-foreground shrink-0"}):l.jsx(cn,{className:"size-4 text-muted-foreground shrink-0"})]})})});function ej({...e}){return l.jsx(Q2,{"data-slot":"collapsible",...e})}function wz({...e}){return l.jsx(Od,{"data-slot":"collapsible-trigger",...e})}function tj({...e}){return l.jsx(Md,{"data-slot":"collapsible-content",...e})}function nj(e,t){const n={};return(e[e.length-1]===""?[...e,""]:e).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const rj=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,oj=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,sj={};function ic(e,t){return(sj.jsx?oj:rj).test(e)}const ij=/[ \t\n\f\r]/g;function aj(e){return typeof e=="object"?e.type==="text"?ac(e.value):!1:ac(e)}function ac(e){return e.replace(ij,"")===""}class Lr{constructor(t,n,r){this.normal=n,this.property=t,r&&(this.space=r)}}Lr.prototype.normal={};Lr.prototype.property={};Lr.prototype.space=void 0;function ap(e,t){const n={},r={};for(const o of e)Object.assign(n,o.property),Object.assign(r,o.normal);return new Lr(n,r,t)}function vi(e){return e.toLowerCase()}class dt{constructor(t,n){this.attribute=n,this.property=t}}dt.prototype.attribute="";dt.prototype.booleanish=!1;dt.prototype.boolean=!1;dt.prototype.commaOrSpaceSeparated=!1;dt.prototype.commaSeparated=!1;dt.prototype.defined=!1;dt.prototype.mustUseProperty=!1;dt.prototype.number=!1;dt.prototype.overloadedBoolean=!1;dt.prototype.property="";dt.prototype.spaceSeparated=!1;dt.prototype.space=void 0;let lj=0;const Ee=En(),Ge=En(),wi=En(),ue=En(),Le=En(),Un=En(),ht=En();function En(){return 2**++lj}const ki=Object.freeze(Object.defineProperty({__proto__:null,boolean:Ee,booleanish:Ge,commaOrSpaceSeparated:ht,commaSeparated:Un,number:ue,overloadedBoolean:wi,spaceSeparated:Le},Symbol.toStringTag,{value:"Module"})),zs=Object.keys(ki);class _a extends dt{constructor(t,n,r,o){let s=-1;if(super(t,n),lc(this,"space",o),typeof r=="number")for(;++s<zs.length;){const i=zs[s];lc(this,zs[s],(r&ki[i])===ki[i])}}}_a.prototype.defined=!0;function lc(e,t,n){n&&(e[t]=n)}function or(e){const t={},n={};for(const[r,o]of Object.entries(e.properties)){const s=new _a(r,e.transform(e.attributes||{},r),o,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(s.mustUseProperty=!0),t[r]=s,n[vi(r)]=r,n[vi(s.attribute)]=r}return new Lr(t,n,e.space)}const lp=or({properties:{ariaActiveDescendant:null,ariaAtomic:Ge,ariaAutoComplete:null,ariaBusy:Ge,ariaChecked:Ge,ariaColCount:ue,ariaColIndex:ue,ariaColSpan:ue,ariaControls:Le,ariaCurrent:null,ariaDescribedBy:Le,ariaDetails:null,ariaDisabled:Ge,ariaDropEffect:Le,ariaErrorMessage:null,ariaExpanded:Ge,ariaFlowTo:Le,ariaGrabbed:Ge,ariaHasPopup:null,ariaHidden:Ge,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:Le,ariaLevel:ue,ariaLive:null,ariaModal:Ge,ariaMultiLine:Ge,ariaMultiSelectable:Ge,ariaOrientation:null,ariaOwns:Le,ariaPlaceholder:null,ariaPosInSet:ue,ariaPressed:Ge,ariaReadOnly:Ge,ariaRelevant:null,ariaRequired:Ge,ariaRoleDescription:Le,ariaRowCount:ue,ariaRowIndex:ue,ariaRowSpan:ue,ariaSelected:Ge,ariaSetSize:ue,ariaSort:null,ariaValueMax:ue,ariaValueMin:ue,ariaValueNow:ue,ariaValueText:null,role:null},transform(e,t){return t==="role"?t:"aria-"+t.slice(4).toLowerCase()}});function cp(e,t){return t in e?e[t]:t}function up(e,t){return cp(e,t.toLowerCase())}const cj=or({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:Un,acceptCharset:Le,accessKey:Le,action:null,allow:null,allowFullScreen:Ee,allowPaymentRequest:Ee,allowUserMedia:Ee,alt:null,as:null,async:Ee,autoCapitalize:null,autoComplete:Le,autoFocus:Ee,autoPlay:Ee,blocking:Le,capture:null,charSet:null,checked:Ee,cite:null,className:Le,cols:ue,colSpan:null,content:null,contentEditable:Ge,controls:Ee,controlsList:Le,coords:ue|Un,crossOrigin:null,data:null,dateTime:null,decoding:null,default:Ee,defer:Ee,dir:null,dirName:null,disabled:Ee,download:wi,draggable:Ge,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:Ee,formTarget:null,headers:Le,height:ue,hidden:wi,high:ue,href:null,hrefLang:null,htmlFor:Le,httpEquiv:Le,id:null,imageSizes:null,imageSrcSet:null,inert:Ee,inputMode:null,integrity:null,is:null,isMap:Ee,itemId:null,itemProp:Le,itemRef:Le,itemScope:Ee,itemType:Le,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:Ee,low:ue,manifest:null,max:null,maxLength:ue,media:null,method:null,min:null,minLength:ue,multiple:Ee,muted:Ee,name:null,nonce:null,noModule:Ee,noValidate:Ee,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:Ee,optimum:ue,pattern:null,ping:Le,placeholder:null,playsInline:Ee,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:Ee,referrerPolicy:null,rel:Le,required:Ee,reversed:Ee,rows:ue,rowSpan:ue,sandbox:Le,scope:null,scoped:Ee,seamless:Ee,selected:Ee,shadowRootClonable:Ee,shadowRootDelegatesFocus:Ee,shadowRootMode:null,shape:null,size:ue,sizes:null,slot:null,span:ue,spellCheck:Ge,src:null,srcDoc:null,srcLang:null,srcSet:null,start:ue,step:null,style:null,tabIndex:ue,target:null,title:null,translate:null,type:null,typeMustMatch:Ee,useMap:null,value:Ge,width:ue,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:Le,axis:null,background:null,bgColor:null,border:ue,borderColor:null,bottomMargin:ue,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:Ee,declare:Ee,event:null,face:null,frame:null,frameBorder:null,hSpace:ue,leftMargin:ue,link:null,longDesc:null,lowSrc:null,marginHeight:ue,marginWidth:ue,noResize:Ee,noHref:Ee,noShade:Ee,noWrap:Ee,object:null,profile:null,prompt:null,rev:null,rightMargin:ue,rules:null,scheme:null,scrolling:Ge,standby:null,summary:null,text:null,topMargin:ue,valueType:null,version:null,vAlign:null,vLink:null,vSpace:ue,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:Ee,disableRemotePlayback:Ee,prefix:null,property:null,results:ue,security:null,unselectable:null},space:"html",transform:up}),uj=or({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:ht,accentHeight:ue,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:ue,amplitude:ue,arabicForm:null,ascent:ue,attributeName:null,attributeType:null,azimuth:ue,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:ue,by:null,calcMode:null,capHeight:ue,className:Le,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:ue,diffuseConstant:ue,direction:null,display:null,dur:null,divisor:ue,dominantBaseline:null,download:Ee,dx:null,dy:null,edgeMode:null,editable:null,elevation:ue,enableBackground:null,end:null,event:null,exponent:ue,externalResourcesRequired:null,fill:null,fillOpacity:ue,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:Un,g2:Un,glyphName:Un,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:ue,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:ue,horizOriginX:ue,horizOriginY:ue,id:null,ideographic:ue,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:ue,k:ue,k1:ue,k2:ue,k3:ue,k4:ue,kernelMatrix:ht,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:ue,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:ue,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:ue,overlineThickness:ue,paintOrder:null,panose1:null,path:null,pathLength:ue,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:Le,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:ue,pointsAtY:ue,pointsAtZ:ue,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:ht,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:ht,rev:ht,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:ht,requiredFeatures:ht,requiredFonts:ht,requiredFormats:ht,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:ue,specularExponent:ue,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:ue,strikethroughThickness:ue,string:null,stroke:null,strokeDashArray:ht,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:ue,strokeOpacity:ue,strokeWidth:null,style:null,surfaceScale:ue,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:ht,tabIndex:ue,tableValues:null,target:null,targetX:ue,targetY:ue,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:ht,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:ue,underlineThickness:ue,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:ue,values:null,vAlphabetic:ue,vMathematical:ue,vectorEffect:null,vHanging:ue,vIdeographic:ue,version:null,vertAdvY:ue,vertOriginX:ue,vertOriginY:ue,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:ue,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:cp}),dp=or({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()}}),fp=or({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:up}),hp=or({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,t){return"xml:"+t.slice(3).toLowerCase()}}),dj={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"},fj=/[A-Z]/g,cc=/-[a-z]/g,hj=/^data[-\w.:]+$/i;function pj(e,t){const n=vi(t);let r=t,o=dt;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)==="data"&&hj.test(t)){if(t.charAt(4)==="-"){const s=t.slice(5).replace(cc,gj);r="data"+s.charAt(0).toUpperCase()+s.slice(1)}else{const s=t.slice(4);if(!cc.test(s)){let i=s.replace(fj,mj);i.charAt(0)!=="-"&&(i="-"+i),t="data"+i}}o=_a}return new o(r,t)}function mj(e){return"-"+e.toLowerCase()}function gj(e){return e.charAt(1).toUpperCase()}const xj=ap([lp,cj,dp,fp,hp],"html"),Sa=ap([lp,uj,dp,fp,hp],"svg");function yj(e){return e.join(" ").trim()}var Pn={},Is,uc;function bj(){if(uc)return Is;uc=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="",p="comment",h="declaration";function g(x,b){if(typeof x!="string")throw new TypeError("First argument must be a string");if(!x)return[];b=b||{};var v=1,k=1;function S(w){var M=w.match(t);M&&(v+=M.length);var U=w.lastIndexOf(c);k=~U?w.length-U:k+w.length}function C(){var w={line:v,column:k};return function(M){return M.position=new E(w),T(),M}}function E(w){this.start=w,this.end={line:v,column:k},this.source=b.source}E.prototype.content=x;function N(w){var M=new Error(b.source+":"+v+":"+k+": "+w);if(M.reason=w,M.filename=b.source,M.line=v,M.column=k,M.source=x,!b.silent)throw M}function z(w){var M=w.exec(x);if(M){var U=M[0];return S(U),x=x.slice(U.length),M}}function T(){z(n)}function R(w){var M;for(w=w||[];M=$();)M!==!1&&w.push(M);return w}function $(){var w=C();if(!(u!=x.charAt(0)||d!=x.charAt(1))){for(var M=2;f!=x.charAt(M)&&(d!=x.charAt(M)||u!=x.charAt(M+1));)++M;if(M+=2,f===x.charAt(M-1))return N("End of comment missing");var U=x.slice(2,M-2);return k+=2,S(U),x=x.slice(M),k+=2,w({type:p,comment:U})}}function j(){var w=C(),M=z(r);if(M){if($(),!z(o))return N("property missing ':'");var U=z(s),L=w({type:h,property:m(M[0].replace(e,f)),value:U?m(U[0].replace(e,f)):f});return z(i),L}}function D(){var w=[];R(w);for(var M;M=j();)M!==!1&&(w.push(M),R(w));return w}return T(),D()}function m(x){return x?x.replace(a,f):f}return Is=g,Is}var dc;function vj(){if(dc)return Pn;dc=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(bj());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 ur={},fc;function wj(){if(fc)return ur;fc=1,Object.defineProperty(ur,"__esModule",{value:!0}),ur.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 ur.camelCase=c,ur}var dr,hc;function kj(){if(hc)return dr;hc=1;var e=dr&&dr.__importDefault||function(o){return o&&o.__esModule?o:{default:o}},t=e(vj()),n=wj();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,dr=r,dr}var _j=kj();const Sj=Pi(_j),pp=mp("end"),Ca=mp("start");function mp(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 Cj(e){const t=Ca(e),n=pp(e);if(t&&n)return{start:t,end:n}}function vr(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?pc(e.position):"start"in e||"end"in e?pc(e):"line"in e||"column"in e?_i(e):""}function _i(e){return mc(e&&e.line)+":"+mc(e&&e.column)}function pc(e){return _i(e&&e.start)+"-"+_i(e&&e.end)}function mc(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=vr(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 ja={}.hasOwnProperty,jj=new Map,Ej=/[A-Z]/g,Nj=new Set(["table","tbody","thead","tfoot","tr"]),Tj=new Set(["td","th"]),gp="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function Aj(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=Lj(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=Dj(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"?Sa:xj,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},s=xp(o,e,void 0);return s&&typeof s!="string"?s:o.create(e,o.Fragment,{children:s||void 0},void 0)}function xp(e,t,n){if(t.type==="element")return zj(e,t,n);if(t.type==="mdxFlowExpression"||t.type==="mdxTextExpression")return Ij(e,t);if(t.type==="mdxJsxFlowElement"||t.type==="mdxJsxTextElement")return Rj(e,t,n);if(t.type==="mdxjsEsm")return Pj(e,t);if(t.type==="root")return Oj(e,t,n);if(t.type==="text")return Mj(e,t)}function zj(e,t,n){const r=e.schema;let o=r;t.tagName.toLowerCase()==="svg"&&r.space==="html"&&(o=Sa,e.schema=o),e.ancestors.push(t);const s=bp(e,t.tagName,!1),i=Fj(e,t);let a=Na(e,t);return Nj.has(t.tagName)&&(a=a.filter(function(c){return typeof c=="string"?!aj(c):!0})),yp(e,i,s,t),Ea(i,a),e.ancestors.pop(),e.schema=r,e.create(t,s,i,n)}function Ij(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)}zr(e,t.position)}function Pj(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);zr(e,t.position)}function Rj(e,t,n){const r=e.schema;let o=r;t.name==="svg"&&r.space==="html"&&(o=Sa,e.schema=o),e.ancestors.push(t);const s=t.name===null?e.Fragment:bp(e,t.name,!0),i=$j(e,t),a=Na(e,t);return yp(e,i,s,t),Ea(i,a),e.ancestors.pop(),e.schema=r,e.create(t,s,i,n)}function Oj(e,t,n){const r={};return Ea(r,Na(e,t)),e.create(t,e.Fragment,r,n)}function Mj(e,t){return t.value}function yp(e,t,n,r){typeof n!="string"&&n!==e.Fragment&&e.passNode&&(t.node=r)}function Ea(e,t){if(t.length>0){const n=t.length>1?t:t[0];n&&(e.children=n)}}function Dj(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 Lj(e,t){return n;function n(r,o,s,i){const a=Array.isArray(s.children),c=Ca(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 Fj(e,t){const n={};let r,o;for(o in t.properties)if(o!=="children"&&ja.call(t.properties,o)){const s=Bj(e,o,t.properties[o]);if(s){const[i,a]=s;e.tableCellAlignToStyle&&i==="align"&&typeof a=="string"&&Tj.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 $j(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 zr(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 zr(e,t.position);else s=r.value===null?!0:r.value;n[o]=s}return n}function Na(e,t){const n=[];let r=-1;const o=e.passKeys?new Map:jj;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=xp(e,s,i);a!==void 0&&n.push(a)}return n}function Bj(e,t,n){const r=pj(e.schema,t);if(!(n==null||typeof n=="number"&&Number.isNaN(n))){if(Array.isArray(n)&&(n=r.commaSeparated?nj(n):yj(n)),r.property==="style"){let o=typeof n=="object"?n:Uj(e,String(n));return e.stylePropertyNameCase==="css"&&(o=Vj(o)),["style",o]}return[e.elementAttributeNameCase==="react"&&r.space?dj[r.property]||r.property:r.attribute,n]}}function Uj(e,t){try{return Sj(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=gp+"#cannot-parse-style-attribute",o}}function bp(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=ic(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=ic(t)&&!/^[a-z]/.test(t)?{type:"Identifier",name:t}:{type:"Literal",value:t};if(r.type==="Literal"){const o=r.value;return ja.call(e.components,o)?e.components[o]:o}if(e.evaluater)return e.evaluater.evaluateExpression(r);zr(e)}function zr(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=gp+"#cannot-handle-mdx-estrees-without-createevaluater",n}function Vj(e){const t={};let n;for(n in e)ja.call(e,n)&&(t[Hj(n)]=e[n]);return t}function Hj(e){let t=e.replace(Ej,Zj);return t.slice(0,3)==="ms-"&&(t="-"+t),t}function Zj(e){return"-"+e.toLowerCase()}const Ps={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"]},Wj={};function qj(e,t){const n=Wj,r=typeof n.includeImageAlt=="boolean"?n.includeImageAlt:!0,o=typeof n.includeHtml=="boolean"?n.includeHtml:!0;return vp(e,r,o)}function vp(e,t,n){if(Jj(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 gc(e.children,t,n)}return Array.isArray(e)?gc(e,t,n):""}function gc(e,t,n){const r=[];let o=-1;for(;++o<e.length;)r[o]=vp(e[o],t,n);return r.join("")}function Jj(e){return!!(e&&typeof e=="object")}const xc=document.createElement("i");function Ta(e){const t="&"+e+";";xc.innerHTML=t;const n=xc.textContent;return n.charCodeAt(n.length-1)===59&&e!=="semi"||n===t?!1:n}function Lt(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?(Lt(e,e.length,0,t),e):t}const yc={}.hasOwnProperty;function Kj(e){const t={};let n=-1;for(;++n<e.length;)Gj(t,e[n]);return t}function Gj(e,t){let n;for(n in t){const o=(yc.call(e,n)?e[n]:void 0)||(e[n]={}),s=t[n];let i;if(s)for(i in s){yc.call(o,i)||(o[i]=[]);const a=s[i];Yj(o[i],Array.isArray(a)?a:a?[a]:[])}}}function Yj(e,t){let n=-1;const r=[];for(;++n<t.length;)(t[n].add==="after"?e:r).push(t[n]);Lt(e,0,0,r)}function wp(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 Vn(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const Pt=hn(/[A-Za-z]/),mt=hn(/[\dA-Za-z]/),Xj=hn(/[#-'*+\--9=?A-Z^-~]/);function Si(e){return e!==null&&(e<32||e===127)}const Ci=hn(/\d/),Qj=hn(/[\dA-Fa-f]/),e3=hn(/[!-/:-@[-`{-~]/);function Se(e){return e!==null&&e<-2}function lt(e){return e!==null&&(e<0||e===32)}function Pe(e){return e===-2||e===-1||e===32}const t3=hn(new RegExp("\\p{P}|\\p{S}","u")),n3=hn(/\s/);function hn(e){return t;function t(n){return n!==null&&n>-1&&e.test(String.fromCharCode(n))}}function sr(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 Fe(e,t,n,r){const o=r?r-1:Number.POSITIVE_INFINITY;let s=0;return i;function i(c){return Pe(c)?(e.enter(n),a(c)):t(c)}function a(c){return Pe(c)&&s++<o?(e.consume(c),a):(e.exit(n),t(c))}}const r3={tokenize:o3};function o3(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"),Fe(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 Se(a)?(e.consume(a),e.exit("chunkText"),s):(e.consume(a),i)}}const s3={tokenize:i3},bc={tokenize:a3};function i3(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,E;for(;C--;)if(t.events[C][0]==="exit"&&t.events[C][1].type==="chunkFlow"){E=t.events[C][1].end;break}b(r);let N=S;for(;N<t.events.length;)t.events[N][1].end={...E},N++;return Lt(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 p(k);if(o.currentConstruct&&o.currentConstruct.concrete)return g(k);t.interrupt=!!(o.currentConstruct&&!o._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(bc,d,f)(k)}function d(k){return o&&v(),b(r),p(k)}function f(k){return t.parser.lazy[t.now().line]=r!==n.length,i=t.now().offset,g(k)}function p(k){return t.containerState={},e.attempt(bc,h,g)(k)}function h(k){return r++,n.push([t.currentConstruct,t.containerState]),p(k)}function g(k){if(k===null){o&&v(),b(0),e.consume(k);return}return o=o||t.parser.flow(t.now()),e.enter("chunkFlow",{_tokenizer:o,contentType:"flow",previous:s}),m(k)}function m(k){if(k===null){x(e.exit("chunkFlow"),!0),b(0),e.consume(k);return}return Se(k)?(e.consume(k),x(e.exit("chunkFlow")),r=0,t.interrupt=void 0,a):(e.consume(k),m)}function x(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 E=o.events.length;for(;E--;)if(o.events[E][1].start.offset<i&&(!o.events[E][1].end||o.events[E][1].end.offset>i))return;const N=t.events.length;let z=N,T,R;for(;z--;)if(t.events[z][0]==="exit"&&t.events[z][1].type==="chunkFlow"){if(T){R=t.events[z][1].end;break}T=!0}for(b(r),E=N;E<t.events.length;)t.events[E][1].end={...R},E++;Lt(t.events,z+1,0,t.events.slice(N)),t.events.length=E}}function b(k){let S=n.length;for(;S-- >k;){const C=n[S];t.containerState=C[1],C[0].exit.call(t,e)}n.length=k}function v(){o.write([null]),s=void 0,o=void 0,t.containerState._closeFlow=void 0}}function a3(e,t,n){return Fe(e,e.attempt(this.parser.constructs.document,t,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function vc(e){if(e===null||lt(e)||n3(e))return 1;if(t3(e))return 2}function Aa(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 ji={name:"attention",resolveAll:l3,tokenize:c3};function l3(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},p={...e[n][1].start};wc(f,-c),wc(p,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:p},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,Aa(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,Lt(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 c3(e,t){const n=this.parser.constructs.attentionMarkers.null,r=this.previous,o=vc(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=vc(c),f=!d||d===2&&o||n.includes(c),p=!o||o===2&&d||n.includes(r);return u._open=!!(s===42?f:f&&(o||!p)),u._close=!!(s===42?p:p&&(d||!f)),t(c)}}function wc(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}const u3={name:"autolink",tokenize:d3};function d3(e,t,n){let r=0;return o;function o(h){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(h),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),s}function s(h){return Pt(h)?(e.consume(h),i):h===64?n(h):u(h)}function i(h){return h===43||h===45||h===46||mt(h)?(r=1,a(h)):u(h)}function a(h){return h===58?(e.consume(h),r=0,c):(h===43||h===45||h===46||mt(h))&&r++<32?(e.consume(h),a):(r=0,u(h))}function c(h){return h===62?(e.exit("autolinkProtocol"),e.enter("autolinkMarker"),e.consume(h),e.exit("autolinkMarker"),e.exit("autolink"),t):h===null||h===32||h===60||Si(h)?n(h):(e.consume(h),c)}function u(h){return h===64?(e.consume(h),d):Xj(h)?(e.consume(h),u):n(h)}function d(h){return mt(h)?f(h):n(h)}function f(h){return h===46?(e.consume(h),r=0,d):h===62?(e.exit("autolinkProtocol").type="autolinkEmail",e.enter("autolinkMarker"),e.consume(h),e.exit("autolinkMarker"),e.exit("autolink"),t):p(h)}function p(h){if((h===45||mt(h))&&r++<63){const g=h===45?p:f;return e.consume(h),g}return n(h)}}const cs={partial:!0,tokenize:f3};function f3(e,t,n){return r;function r(s){return Pe(s)?Fe(e,o,"linePrefix")(s):o(s)}function o(s){return s===null||Se(s)?t(s):n(s)}}const kp={continuation:{tokenize:p3},exit:m3,name:"blockQuote",tokenize:h3};function h3(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 Pe(i)?(e.enter("blockQuotePrefixWhitespace"),e.consume(i),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),t):(e.exit("blockQuotePrefix"),t(i))}}function p3(e,t,n){const r=this;return o;function o(i){return Pe(i)?Fe(e,s,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(i):s(i)}function s(i){return e.attempt(kp,t,n)(i)}}function m3(e){e.exit("blockQuote")}const _p={name:"characterEscape",tokenize:g3};function g3(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 e3(s)?(e.enter("characterEscapeValue"),e.consume(s),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):n(s)}}const Sp={name:"characterReference",tokenize:x3};function x3(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=Qj,d):(e.enter("characterReferenceValue"),s=7,i=Ci,d(f))}function d(f){if(f===59&&o){const p=e.exit("characterReferenceValue");return i===mt&&!Ta(r.sliceSerialize(p))?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 kc={partial:!0,tokenize:b3},_c={concrete:!0,name:"codeFenced",tokenize:y3};function y3(e,t,n){const r=this,o={partial:!0,tokenize:C};let s=0,i=0,a;return c;function c(E){return u(E)}function u(E){const N=r.events[r.events.length-1];return s=N&&N[1].type==="linePrefix"?N[2].sliceSerialize(N[1],!0).length:0,a=E,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),d(E)}function d(E){return E===a?(i++,e.consume(E),d):i<3?n(E):(e.exit("codeFencedFenceSequence"),Pe(E)?Fe(e,f,"whitespace")(E):f(E))}function f(E){return E===null||Se(E)?(e.exit("codeFencedFence"),r.interrupt?t(E):e.check(kc,m,S)(E)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),p(E))}function p(E){return E===null||Se(E)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),f(E)):Pe(E)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),Fe(e,h,"whitespace")(E)):E===96&&E===a?n(E):(e.consume(E),p)}function h(E){return E===null||Se(E)?f(E):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),g(E))}function g(E){return E===null||Se(E)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),f(E)):E===96&&E===a?n(E):(e.consume(E),g)}function m(E){return e.attempt(o,S,x)(E)}function x(E){return e.enter("lineEnding"),e.consume(E),e.exit("lineEnding"),b}function b(E){return s>0&&Pe(E)?Fe(e,v,"linePrefix",s+1)(E):v(E)}function v(E){return E===null||Se(E)?e.check(kc,m,S)(E):(e.enter("codeFlowValue"),k(E))}function k(E){return E===null||Se(E)?(e.exit("codeFlowValue"),v(E)):(e.consume(E),k)}function S(E){return e.exit("codeFenced"),t(E)}function C(E,N,z){let T=0;return R;function R(M){return E.enter("lineEnding"),E.consume(M),E.exit("lineEnding"),$}function $(M){return E.enter("codeFencedFence"),Pe(M)?Fe(E,j,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(M):j(M)}function j(M){return M===a?(E.enter("codeFencedFenceSequence"),D(M)):z(M)}function D(M){return M===a?(T++,E.consume(M),D):T>=i?(E.exit("codeFencedFenceSequence"),Pe(M)?Fe(E,w,"whitespace")(M):w(M)):z(M)}function w(M){return M===null||Se(M)?(E.exit("codeFencedFence"),N(M)):z(M)}}}function b3(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 Rs={name:"codeIndented",tokenize:w3},v3={partial:!0,tokenize:k3};function w3(e,t,n){const r=this;return o;function o(u){return e.enter("codeIndented"),Fe(e,s,"linePrefix",5)(u)}function s(u){const d=r.events[r.events.length-1];return d&&d[1].type==="linePrefix"&&d[2].sliceSerialize(d[1],!0).length>=4?i(u):n(u)}function i(u){return u===null?c(u):Se(u)?e.attempt(v3,i,c)(u):(e.enter("codeFlowValue"),a(u))}function a(u){return u===null||Se(u)?(e.exit("codeFlowValue"),i(u)):(e.consume(u),a)}function c(u){return e.exit("codeIndented"),t(u)}}function k3(e,t,n){const r=this;return o;function o(i){return r.parser.lazy[r.now().line]?n(i):Se(i)?(e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),o):Fe(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):Se(i)?o(i):n(i)}}const _3={name:"codeText",previous:C3,resolve:S3,tokenize:j3};function S3(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 C3(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function j3(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)):Se(f)?(e.enter("lineEnding"),e.consume(f),e.exit("lineEnding"),c):(e.enter("codeTextData"),u(f))}function u(f){return f===null||f===32||f===96||Se(f)?(e.exit("codeTextData"),c(f)):(e.consume(f),u)}function d(f){return f===96?(e.consume(f),o++,d):o===r?(e.exit("codeTextSequence"),e.exit("codeText"),t(f)):(s.type="codeTextData",u(f))}}class E3{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&&fr(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),fr(this.left,t)}unshift(t){this.setCursor(0),this.right.push(t)}unshiftMany(t){this.setCursor(0),fr(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);fr(this.right,n.reverse())}else{const n=this.right.splice(this.left.length+this.right.length-t,Number.POSITIVE_INFINITY);fr(this.left,n.reverse())}}}function fr(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 Cp(e){const t={};let n=-1,r,o,s,i,a,c,u;const d=new E3(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,N3(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 Lt(e,0,Number.POSITIVE_INFINITY,d.slice(0)),!u}function N3(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,p=-1,h=n,g=0,m=0;const x=[m];for(;h;){for(;e.get(++o)[1]!==h;);s.push(o),h._tokenizer||(d=r.sliceStream(h),h.next||d.push(null),f&&i.defineSkip(h.start),h._isInFirstContentOfListItem&&(i._gfmTasklistFirstContentOfListItem=!0),i.write(d),h._isInFirstContentOfListItem&&(i._gfmTasklistFirstContentOfListItem=void 0)),f=h,h=h.next}for(h=n;++p<a.length;)a[p][0]==="exit"&&a[p-1][0]==="enter"&&a[p][1].type===a[p-1][1].type&&a[p][1].start.line!==a[p][1].end.line&&(m=p+1,x.push(m),h._tokenizer=void 0,h.previous=void 0,h=h.next);for(i.events=[],h?(h._tokenizer=void 0,h.previous=void 0):x.pop(),p=x.length;p--;){const b=a.slice(x[p],x[p+1]),v=s.pop();c.push([v,v+b.length-1]),e.splice(v,2,b)}for(c.reverse(),p=-1;++p<c.length;)u[g+c[p][0]]=g+c[p][1],g+=c[p][1]-c[p][0]-1;return u}const T3={resolve:z3,tokenize:I3},A3={partial:!0,tokenize:P3};function z3(e){return Cp(e),e}function I3(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):Se(a)?e.check(A3,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 P3(e,t,n){const r=this;return o;function o(i){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),Fe(e,s,"linePrefix")}function s(i){if(i===null||Se(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 jp(e,t,n,r,o,s,i,a,c){const u=c||Number.POSITIVE_INFINITY;let d=0;return f;function f(b){return b===60?(e.enter(r),e.enter(o),e.enter(s),e.consume(b),e.exit(s),p):b===null||b===32||b===41||Si(b)?n(b):(e.enter(r),e.enter(i),e.enter(a),e.enter("chunkString",{contentType:"string"}),m(b))}function p(b){return b===62?(e.enter(s),e.consume(b),e.exit(s),e.exit(o),e.exit(r),t):(e.enter(a),e.enter("chunkString",{contentType:"string"}),h(b))}function h(b){return b===62?(e.exit("chunkString"),e.exit(a),p(b)):b===null||b===60||Se(b)?n(b):(e.consume(b),b===92?g:h)}function g(b){return b===60||b===62||b===92?(e.consume(b),h):h(b)}function m(b){return!d&&(b===null||b===41||lt(b))?(e.exit("chunkString"),e.exit(a),e.exit(i),e.exit(r),t(b)):d<u&&b===40?(e.consume(b),d++,m):b===41?(e.consume(b),d--,m):b===null||b===32||b===40||Si(b)?n(b):(e.consume(b),b===92?x:m)}function x(b){return b===40||b===41||b===92?(e.consume(b),m):m(b)}}function Ep(e,t,n,r,o,s){const i=this;let a=0,c;return u;function u(h){return e.enter(r),e.enter(o),e.consume(h),e.exit(o),e.enter(s),d}function d(h){return a>999||h===null||h===91||h===93&&!c||h===94&&!a&&"_hiddenFootnoteSupport"in i.parser.constructs?n(h):h===93?(e.exit(s),e.enter(o),e.consume(h),e.exit(o),e.exit(r),t):Se(h)?(e.enter("lineEnding"),e.consume(h),e.exit("lineEnding"),d):(e.enter("chunkString",{contentType:"string"}),f(h))}function f(h){return h===null||h===91||h===93||Se(h)||a++>999?(e.exit("chunkString"),d(h)):(e.consume(h),c||(c=!Pe(h)),h===92?p:f)}function p(h){return h===91||h===92||h===93?(e.consume(h),a++,f):f(h)}}function Np(e,t,n,r,o,s){let i;return a;function a(p){return p===34||p===39||p===40?(e.enter(r),e.enter(o),e.consume(p),e.exit(o),i=p===40?41:p,c):n(p)}function c(p){return p===i?(e.enter(o),e.consume(p),e.exit(o),e.exit(r),t):(e.enter(s),u(p))}function u(p){return p===i?(e.exit(s),c(i)):p===null?n(p):Se(p)?(e.enter("lineEnding"),e.consume(p),e.exit("lineEnding"),Fe(e,u,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),d(p))}function d(p){return p===i||p===null||Se(p)?(e.exit("chunkString"),u(p)):(e.consume(p),p===92?f:d)}function f(p){return p===i||p===92?(e.consume(p),d):d(p)}}function wr(e,t){let n;return r;function r(o){return Se(o)?(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),n=!0,r):Pe(o)?Fe(e,r,n?"linePrefix":"lineSuffix")(o):t(o)}}const R3={name:"definition",tokenize:M3},O3={partial:!0,tokenize:D3};function M3(e,t,n){const r=this;let o;return s;function s(h){return e.enter("definition"),i(h)}function i(h){return Ep.call(r,e,a,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(h)}function a(h){return o=Vn(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),h===58?(e.enter("definitionMarker"),e.consume(h),e.exit("definitionMarker"),c):n(h)}function c(h){return lt(h)?wr(e,u)(h):u(h)}function u(h){return jp(e,d,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(h)}function d(h){return e.attempt(O3,f,f)(h)}function f(h){return Pe(h)?Fe(e,p,"whitespace")(h):p(h)}function p(h){return h===null||Se(h)?(e.exit("definition"),r.parser.defined.push(o),t(h)):n(h)}}function D3(e,t,n){return r;function r(a){return lt(a)?wr(e,o)(a):n(a)}function o(a){return Np(e,s,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(a)}function s(a){return Pe(a)?Fe(e,i,"whitespace")(a):i(a)}function i(a){return a===null||Se(a)?t(a):n(a)}}const L3={name:"hardBreakEscape",tokenize:F3};function F3(e,t,n){return r;function r(s){return e.enter("hardBreakEscape"),e.consume(s),o}function o(s){return Se(s)?(e.exit("hardBreakEscape"),t(s)):n(s)}}const $3={name:"headingAtx",resolve:B3,tokenize:U3};function B3(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"},Lt(e,r,n-r+1,[["enter",o,t],["enter",s,t],["exit",s,t],["exit",o,t]])),e}function U3(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||Se(d)?(e.exit("atxHeading"),t(d)):Pe(d)?Fe(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 V3=["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"],Sc=["pre","script","style","textarea"],H3={concrete:!0,name:"htmlFlow",resolveTo:q3,tokenize:J3},Z3={partial:!0,tokenize:G3},W3={partial:!0,tokenize:K3};function q3(e){let t=e.length;for(;t--&&!(e[t][0]==="enter"&&e[t][1].type==="htmlFlow"););return t>1&&e[t-2][1].type==="linePrefix"&&(e[t][1].start=e[t-2][1].start,e[t+1][1].start=e[t-2][1].start,e.splice(t-2,2)),e}function J3(e,t,n){const r=this;let o,s,i,a,c;return u;function u(I){return d(I)}function d(I){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(I),f}function f(I){return I===33?(e.consume(I),p):I===47?(e.consume(I),s=!0,m):I===63?(e.consume(I),o=3,r.interrupt?t:A):Pt(I)?(e.consume(I),i=String.fromCharCode(I),x):n(I)}function p(I){return I===45?(e.consume(I),o=2,h):I===91?(e.consume(I),o=5,a=0,g):Pt(I)?(e.consume(I),o=4,r.interrupt?t:A):n(I)}function h(I){return I===45?(e.consume(I),r.interrupt?t:A):n(I)}function g(I){const se="CDATA[";return I===se.charCodeAt(a++)?(e.consume(I),a===se.length?r.interrupt?t:j:g):n(I)}function m(I){return Pt(I)?(e.consume(I),i=String.fromCharCode(I),x):n(I)}function x(I){if(I===null||I===47||I===62||lt(I)){const se=I===47,ee=i.toLowerCase();return!se&&!s&&Sc.includes(ee)?(o=1,r.interrupt?t(I):j(I)):V3.includes(i.toLowerCase())?(o=6,se?(e.consume(I),b):r.interrupt?t(I):j(I)):(o=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(I):s?v(I):k(I))}return I===45||mt(I)?(e.consume(I),i+=String.fromCharCode(I),x):n(I)}function b(I){return I===62?(e.consume(I),r.interrupt?t:j):n(I)}function v(I){return Pe(I)?(e.consume(I),v):R(I)}function k(I){return I===47?(e.consume(I),R):I===58||I===95||Pt(I)?(e.consume(I),S):Pe(I)?(e.consume(I),k):R(I)}function S(I){return I===45||I===46||I===58||I===95||mt(I)?(e.consume(I),S):C(I)}function C(I){return I===61?(e.consume(I),E):Pe(I)?(e.consume(I),C):k(I)}function E(I){return I===null||I===60||I===61||I===62||I===96?n(I):I===34||I===39?(e.consume(I),c=I,N):Pe(I)?(e.consume(I),E):z(I)}function N(I){return I===c?(e.consume(I),c=null,T):I===null||Se(I)?n(I):(e.consume(I),N)}function z(I){return I===null||I===34||I===39||I===47||I===60||I===61||I===62||I===96||lt(I)?C(I):(e.consume(I),z)}function T(I){return I===47||I===62||Pe(I)?k(I):n(I)}function R(I){return I===62?(e.consume(I),$):n(I)}function $(I){return I===null||Se(I)?j(I):Pe(I)?(e.consume(I),$):n(I)}function j(I){return I===45&&o===2?(e.consume(I),U):I===60&&o===1?(e.consume(I),L):I===62&&o===4?(e.consume(I),Z):I===63&&o===3?(e.consume(I),A):I===93&&o===5?(e.consume(I),q):Se(I)&&(o===6||o===7)?(e.exit("htmlFlowData"),e.check(Z3,W,D)(I)):I===null||Se(I)?(e.exit("htmlFlowData"),D(I)):(e.consume(I),j)}function D(I){return e.check(W3,w,W)(I)}function w(I){return e.enter("lineEnding"),e.consume(I),e.exit("lineEnding"),M}function M(I){return I===null||Se(I)?D(I):(e.enter("htmlFlowData"),j(I))}function U(I){return I===45?(e.consume(I),A):j(I)}function L(I){return I===47?(e.consume(I),i="",F):j(I)}function F(I){if(I===62){const se=i.toLowerCase();return Sc.includes(se)?(e.consume(I),Z):j(I)}return Pt(I)&&i.length<8?(e.consume(I),i+=String.fromCharCode(I),F):j(I)}function q(I){return I===93?(e.consume(I),A):j(I)}function A(I){return I===62?(e.consume(I),Z):I===45&&o===2?(e.consume(I),A):j(I)}function Z(I){return I===null||Se(I)?(e.exit("htmlFlowData"),W(I)):(e.consume(I),Z)}function W(I){return e.exit("htmlFlow"),t(I)}}function K3(e,t,n){const r=this;return o;function o(i){return Se(i)?(e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),s):n(i)}function s(i){return r.parser.lazy[r.now().line]?n(i):t(i)}}function G3(e,t,n){return r;function r(o){return e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),e.attempt(cs,t,n)}}const Y3={name:"htmlText",tokenize:X3};function X3(e,t,n){const r=this;let o,s,i;return a;function a(A){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(A),c}function c(A){return A===33?(e.consume(A),u):A===47?(e.consume(A),C):A===63?(e.consume(A),k):Pt(A)?(e.consume(A),z):n(A)}function u(A){return A===45?(e.consume(A),d):A===91?(e.consume(A),s=0,g):Pt(A)?(e.consume(A),v):n(A)}function d(A){return A===45?(e.consume(A),h):n(A)}function f(A){return A===null?n(A):A===45?(e.consume(A),p):Se(A)?(i=f,L(A)):(e.consume(A),f)}function p(A){return A===45?(e.consume(A),h):f(A)}function h(A){return A===62?U(A):A===45?p(A):f(A)}function g(A){const Z="CDATA[";return A===Z.charCodeAt(s++)?(e.consume(A),s===Z.length?m:g):n(A)}function m(A){return A===null?n(A):A===93?(e.consume(A),x):Se(A)?(i=m,L(A)):(e.consume(A),m)}function x(A){return A===93?(e.consume(A),b):m(A)}function b(A){return A===62?U(A):A===93?(e.consume(A),b):m(A)}function v(A){return A===null||A===62?U(A):Se(A)?(i=v,L(A)):(e.consume(A),v)}function k(A){return A===null?n(A):A===63?(e.consume(A),S):Se(A)?(i=k,L(A)):(e.consume(A),k)}function S(A){return A===62?U(A):k(A)}function C(A){return Pt(A)?(e.consume(A),E):n(A)}function E(A){return A===45||mt(A)?(e.consume(A),E):N(A)}function N(A){return Se(A)?(i=N,L(A)):Pe(A)?(e.consume(A),N):U(A)}function z(A){return A===45||mt(A)?(e.consume(A),z):A===47||A===62||lt(A)?T(A):n(A)}function T(A){return A===47?(e.consume(A),U):A===58||A===95||Pt(A)?(e.consume(A),R):Se(A)?(i=T,L(A)):Pe(A)?(e.consume(A),T):U(A)}function R(A){return A===45||A===46||A===58||A===95||mt(A)?(e.consume(A),R):$(A)}function $(A){return A===61?(e.consume(A),j):Se(A)?(i=$,L(A)):Pe(A)?(e.consume(A),$):T(A)}function j(A){return A===null||A===60||A===61||A===62||A===96?n(A):A===34||A===39?(e.consume(A),o=A,D):Se(A)?(i=j,L(A)):Pe(A)?(e.consume(A),j):(e.consume(A),w)}function D(A){return A===o?(e.consume(A),o=void 0,M):A===null?n(A):Se(A)?(i=D,L(A)):(e.consume(A),D)}function w(A){return A===null||A===34||A===39||A===60||A===61||A===96?n(A):A===47||A===62||lt(A)?T(A):(e.consume(A),w)}function M(A){return A===47||A===62||lt(A)?T(A):n(A)}function U(A){return A===62?(e.consume(A),e.exit("htmlTextData"),e.exit("htmlText"),t):n(A)}function L(A){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(A),e.exit("lineEnding"),F}function F(A){return Pe(A)?Fe(e,q,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(A):q(A)}function q(A){return e.enter("htmlTextData"),i(A)}}const za={name:"labelEnd",resolveAll:nE,resolveTo:rE,tokenize:oE},Q3={tokenize:sE},eE={tokenize:iE},tE={tokenize:aE};function nE(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&&Lt(e,0,e.length,n),e}function rE(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,Aa(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]]),Lt(e,s,e.length,a),e}function oE(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(p){return s?s._inactive?f(p):(i=r.parser.defined.includes(Vn(r.sliceSerialize({start:s.end,end:r.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(p),e.exit("labelMarker"),e.exit("labelEnd"),c):n(p)}function c(p){return p===40?e.attempt(Q3,d,i?d:f)(p):p===91?e.attempt(eE,d,i?u:f)(p):i?d(p):f(p)}function u(p){return e.attempt(tE,d,f)(p)}function d(p){return t(p)}function f(p){return s._balanced=!0,n(p)}}function sE(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)?wr(e,s)(f):s(f)}function s(f){return f===41?d(f):jp(e,i,a,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(f)}function i(f){return lt(f)?wr(e,c)(f):d(f)}function a(f){return n(f)}function c(f){return f===34||f===39||f===40?Np(e,u,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(f):d(f)}function u(f){return lt(f)?wr(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 iE(e,t,n){const r=this;return o;function o(a){return Ep.call(r,e,s,i,"reference","referenceMarker","referenceString")(a)}function s(a){return r.parser.defined.includes(Vn(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?t(a):n(a)}function i(a){return n(a)}}function aE(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 lE={name:"labelStartImage",resolveAll:za.resolveAll,tokenize:cE};function cE(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 uE={name:"labelStartLink",resolveAll:za.resolveAll,tokenize:dE};function dE(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 Os={name:"lineEnding",tokenize:fE};function fE(e,t){return n;function n(r){return e.enter("lineEnding"),e.consume(r),e.exit("lineEnding"),Fe(e,t,"linePrefix")}}const fo={name:"thematicBreak",tokenize:hE};function hE(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||Se(u))?(e.exit("thematicBreak"),t(u)):n(u)}function c(u){return u===o?(e.consume(u),r++,c):(e.exit("thematicBreakSequence"),Pe(u)?Fe(e,a,"whitespace")(u):a(u))}}const it={continuation:{tokenize:xE},exit:bE,name:"list",tokenize:gE},pE={partial:!0,tokenize:vE},mE={partial:!0,tokenize:yE};function gE(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(h){const g=r.containerState.type||(h===42||h===43||h===45?"listUnordered":"listOrdered");if(g==="listUnordered"?!r.containerState.marker||h===r.containerState.marker:Ci(h)){if(r.containerState.type||(r.containerState.type=g,e.enter(g,{_container:!0})),g==="listUnordered")return e.enter("listItemPrefix"),h===42||h===45?e.check(fo,n,u)(h):u(h);if(!r.interrupt||h===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),c(h)}return n(h)}function c(h){return Ci(h)&&++i<10?(e.consume(h),c):(!r.interrupt||i<2)&&(r.containerState.marker?h===r.containerState.marker:h===41||h===46)?(e.exit("listItemValue"),u(h)):n(h)}function u(h){return e.enter("listItemMarker"),e.consume(h),e.exit("listItemMarker"),r.containerState.marker=r.containerState.marker||h,e.check(cs,r.interrupt?n:d,e.attempt(pE,p,f))}function d(h){return r.containerState.initialBlankLine=!0,s++,p(h)}function f(h){return Pe(h)?(e.enter("listItemPrefixWhitespace"),e.consume(h),e.exit("listItemPrefixWhitespace"),p):n(h)}function p(h){return r.containerState.size=s+r.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(h)}}function xE(e,t,n){const r=this;return r.containerState._closeFlow=void 0,e.check(cs,o,s);function o(a){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,Fe(e,t,"listItemIndent",r.containerState.size+1)(a)}function s(a){return r.containerState.furtherBlankLines||!Pe(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(mE,t,i)(a))}function i(a){return r.containerState._closeFlow=!0,r.interrupt=void 0,Fe(e,e.attempt(it,t,n),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(a)}}function yE(e,t,n){const r=this;return Fe(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 bE(e){e.exit(this.containerState.type)}function vE(e,t,n){const r=this;return Fe(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!Pe(s)&&i&&i[1].type==="listItemPrefixWhitespace"?t(s):n(s)}}const Cc={name:"setextUnderline",resolveTo:wE,tokenize:kE};function wE(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 kE(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"),Pe(u)?Fe(e,c,"lineSuffix")(u):c(u))}function c(u){return u===null||Se(u)?(e.exit("setextHeadingLine"),t(u)):n(u)}}const _E={tokenize:SE};function SE(e){const t=this,n=e.attempt(cs,r,e.attempt(this.parser.constructs.flowInitial,o,Fe(e,e.attempt(this.parser.constructs.flow,o,e.attempt(T3,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 CE={resolveAll:Ap()},jE=Tp("string"),EE=Tp("text");function Tp(e){return{resolveAll:Ap(e==="text"?NE: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 p=-1;if(f)for(;++p<f.length;){const h=f[p];if(!h.previous||h.previous.call(r,r.previous))return!0}return!1}}}function Ap(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 NE(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 TE={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:kp},AE={91:R3},zE={[-2]:Rs,[-1]:Rs,32:Rs},IE={35:$3,42:fo,45:[Cc,fo],60:H3,61:Cc,95:fo,96:_c,126:_c},PE={38:Sp,92:_p},RE={[-5]:Os,[-4]:Os,[-3]:Os,33:lE,38:Sp,42:ji,60:[u3,Y3],91:uE,92:[L3,_p],93:za,95:ji,96:_3},OE={null:[ji,CE]},ME={null:[42,95]},DE={null:[]},LE=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:ME,contentInitial:AE,disable:DE,document:TE,flow:IE,flowInitial:zE,insideSpan:OE,string:PE,text:RE},Symbol.toStringTag,{value:"Module"}));function FE(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(E),consume:v,enter:k,exit:S,interrupt:N(E,{interrupt:!0})},u={code:null,containerState:{},defineSkip:m,events:[],now:g,parser:e,previous:null,sliceSerialize:p,sliceStream:h,write:f};let d=t.tokenize.call(u,c);return t.resolveAll&&s.push(t),u;function f($){return i=xt(i,$),x(),i[i.length-1]!==null?[]:(z(t,0),u.events=Aa(s,u.events,u),u.events)}function p($,j){return BE(h($),j)}function h($){return $E(i,$)}function g(){const{_bufferIndex:$,_index:j,line:D,column:w,offset:M}=r;return{_bufferIndex:$,_index:j,line:D,column:w,offset:M}}function m($){o[$.line]=$.column,R()}function x(){let $;for(;r._index<i.length;){const j=i[r._index];if(typeof j=="string")for($=r._index,r._bufferIndex<0&&(r._bufferIndex=0);r._index===$&&r._bufferIndex<j.length;)b(j.charCodeAt(r._bufferIndex));else b(j)}}function b($){d=d($)}function v($){Se($)?(r.line++,r.column=1,r.offset+=$===-3?2:1,R()):$!==-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($,j){const D=j||{};return D.type=$,D.start=g(),u.events.push(["enter",D,u]),a.push(D),D}function S($){const j=a.pop();return j.end=g(),u.events.push(["exit",j,u]),j}function C($,j){z($,j.from)}function E($,j){j.restore()}function N($,j){return D;function D(w,M,U){let L,F,q,A;return Array.isArray(w)?W(w):"tokenize"in w?W([w]):Z(w);function Z(pe){return le;function le(ne){const de=ne!==null&&pe[ne],fe=ne!==null&&pe.null,he=[...Array.isArray(de)?de:de?[de]:[],...Array.isArray(fe)?fe:fe?[fe]:[]];return W(he)(ne)}}function W(pe){return L=pe,F=0,pe.length===0?U:I(pe[F])}function I(pe){return le;function le(ne){return A=T(),q=pe,pe.partial||(u.currentConstruct=pe),pe.name&&u.parser.constructs.disable.null.includes(pe.name)?ee():pe.tokenize.call(j?Object.assign(Object.create(u),j):u,c,se,ee)(ne)}}function se(pe){return $(q,A),M}function ee(pe){return A.restore(),++F<L.length?I(L[F]):U}}}function z($,j){$.resolveAll&&!s.includes($)&&s.push($),$.resolve&&Lt(u.events,j,u.events.length-j,$.resolve(u.events.slice(j),u)),$.resolveTo&&(u.events=$.resolveTo(u.events,u))}function T(){const $=g(),j=u.previous,D=u.currentConstruct,w=u.events.length,M=Array.from(a);return{from:w,restore:U};function U(){r=$,u.previous=j,u.currentConstruct=D,u.events.length=w,a=M,R()}}function R(){r.line in o&&r.column<2&&(r.column=o[r.line],r.offset+=o[r.line]-1)}}function $E(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 BE(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 UE(e){const r={constructs:Kj([LE,...(e||{}).extensions||[]]),content:o(r3),defined:[],document:o(s3),flow:o(_E),lazy:{},string:o(jE),text:o(EE)};return r;function o(s){return i;function i(a){return FE(r,s,a)}}}function VE(e){for(;!Cp(e););return e}const jc=/[\0\t\n\r]/g;function HE(){let e=1,t="",n=!0,r;return o;function o(s,i,a){const c=[];let u,d,f,p,h;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(jc.lastIndex=f,u=jc.exec(s),p=u&&u.index!==void 0?u.index:s.length,h=s.charCodeAt(p),!u){t=s.slice(f);break}if(h===10&&f===p&&r)c.push(-3),r=void 0;else switch(r&&(c.push(-5),r=void 0),f<p&&(c.push(s.slice(f,p)),e+=p-f),h){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=p+1}return a&&(r&&c.push(-5),t&&c.push(t),c.push(null)),c}}const ZE=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function WE(e){return e.replace(ZE,qE)}function qE(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){const o=n.charCodeAt(1),s=o===120||o===88;return wp(n.slice(s?2:1),s?16:10)}return Ta(n)||e}const zp={}.hasOwnProperty;function JE(e,t,n){return typeof t!="string"&&(n=t,t=void 0),KE(n)(VE(UE(n).document().write(HE()(e,t,!0))))}function KE(e){const t={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:s(H),autolinkProtocol:T,autolinkEmail:T,atxHeading:s(Q),blockQuote:s(fe),characterEscape:T,characterReference:T,codeFenced:s(he),codeFencedFenceInfo:i,codeFencedFenceMeta:i,codeIndented:s(he,i),codeText:s(we,i),codeTextData:T,data:T,codeFlowValue:T,definition:s(Me),definitionDestinationString:i,definitionLabelString:i,definitionTitleString:i,emphasis:s(_),hardBreakEscape:s(G),hardBreakTrailing:s(G),htmlFlow:s(O,i),htmlFlowData:T,htmlText:s(O,i),htmlTextData:T,image:s(P),label:i,link:s(H),listItem:s(ie),listItemValue:p,listOrdered:s(oe,f),listUnordered:s(oe),paragraph:s(K),reference:I,referenceString:i,resourceDestinationString:i,resourceTitleString:i,setextHeading:s(Q),strong:s(J),thematicBreak:s(te)},exit:{atxHeading:c(),atxHeadingSequence:C,autolink:c(),autolinkEmail:de,autolinkProtocol:ne,blockQuote:c(),characterEscapeValue:R,characterReferenceMarkerHexadecimal:ee,characterReferenceMarkerNumeric:ee,characterReferenceValue:pe,characterReference:le,codeFenced:c(x),codeFencedFence:m,codeFencedFenceInfo:h,codeFencedFenceMeta:g,codeFlowValue:R,codeIndented:c(b),codeText:c(M),codeTextData:R,data:R,definition:c(),definitionDestinationString:S,definitionLabelString:v,definitionTitleString:k,emphasis:c(),hardBreakEscape:c(j),hardBreakTrailing:c(j),htmlFlow:c(D),htmlFlowData:R,htmlText:c(w),htmlTextData:R,image:c(L),label:q,labelText:F,lineEnding:$,link:c(U),listItem:c(),listOrdered:c(),listUnordered:c(),paragraph:c(),referenceString:se,resourceDestinationString:A,resourceTitleString:Z,resource:W,setextHeading:c(z),setextHeadingLineSequence:N,setextHeadingText:E,strong:c(),thematicBreak:c()}};Ip(t,(e||{}).mdastExtensions||[]);const n={};return r;function r(B){let Y={type:"root",children:[]};const ce={stack:[Y],tokenStack:[],config:t,enter:a,exit:u,buffer:i,resume:d,data:n},ke=[];let ze=-1;for(;++ze<B.length;)if(B[ze][1].type==="listOrdered"||B[ze][1].type==="listUnordered")if(B[ze][0]==="enter")ke.push(ze);else{const Je=ke.pop();ze=o(B,Je,ze)}for(ze=-1;++ze<B.length;){const Je=t[B[ze][0]];zp.call(Je,B[ze][1].type)&&Je[B[ze][1].type].call(Object.assign({sliceSerialize:B[ze][2].sliceSerialize},ce),B[ze][1])}if(ce.tokenStack.length>0){const Je=ce.tokenStack[ce.tokenStack.length-1];(Je[1]||Ec).call(ce,void 0,Je[0])}for(Y.position={start:Qt(B.length>0?B[0][1].start:{line:1,column:1,offset:0}),end:Qt(B.length>0?B[B.length-2][1].end:{line:1,column:1,offset:0})},ze=-1;++ze<t.transforms.length;)Y=t.transforms[ze](Y)||Y;return Y}function o(B,Y,ce){let ke=Y-1,ze=-1,Je=!1,ft,Ie,Nt,Ut;for(;++ke<=ce;){const We=B[ke];switch(We[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{We[0]==="enter"?ze++:ze--,Ut=void 0;break}case"lineEndingBlank":{We[0]==="enter"&&(ft&&!Ut&&!ze&&!Nt&&(Nt=ke),Ut=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:Ut=void 0}if(!ze&&We[0]==="enter"&&We[1].type==="listItemPrefix"||ze===-1&&We[0]==="exit"&&(We[1].type==="listUnordered"||We[1].type==="listOrdered")){if(ft){let Vt=ke;for(Ie=void 0;Vt--;){const kt=B[Vt];if(kt[1].type==="lineEnding"||kt[1].type==="lineEndingBlank"){if(kt[0]==="exit")continue;Ie&&(B[Ie][1].type="lineEndingBlank",Je=!0),kt[1].type="lineEnding",Ie=Vt}else if(!(kt[1].type==="linePrefix"||kt[1].type==="blockQuotePrefix"||kt[1].type==="blockQuotePrefixWhitespace"||kt[1].type==="blockQuoteMarker"||kt[1].type==="listItemIndent"))break}Nt&&(!Ie||Nt<Ie)&&(ft._spread=!0),ft.end=Object.assign({},Ie?B[Ie][1].start:We[1].end),B.splice(Ie||ke,0,["exit",ft,We[2]]),ke++,ce++}if(We[1].type==="listItemPrefix"){const Vt={type:"listItem",_spread:!1,start:Object.assign({},We[1].start),end:void 0};ft=Vt,B.splice(ke,0,["enter",Vt,We[2]]),ke++,ce++,Nt=void 0,Ut=!0}}}return B[Y][1]._spread=Je,ce}function s(B,Y){return ce;function ce(ke){a.call(this,B(ke),ke),Y&&Y.call(this,ke)}}function i(){this.stack.push({type:"fragment",children:[]})}function a(B,Y,ce){this.stack[this.stack.length-1].children.push(B),this.stack.push(B),this.tokenStack.push([Y,ce||void 0]),B.position={start:Qt(Y.start),end:void 0}}function c(B){return Y;function Y(ce){B&&B.call(this,ce),u.call(this,ce)}}function u(B,Y){const ce=this.stack.pop(),ke=this.tokenStack.pop();if(ke)ke[0].type!==B.type&&(Y?Y.call(this,B,ke[0]):(ke[1]||Ec).call(this,B,ke[0]));else throw new Error("Cannot close `"+B.type+"` ("+vr({start:B.start,end:B.end})+"): it’s not open");ce.position.end=Qt(B.end)}function d(){return qj(this.stack.pop())}function f(){this.data.expectingFirstListItemValue=!0}function p(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 h(){const B=this.resume(),Y=this.stack[this.stack.length-1];Y.lang=B}function g(){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 x(){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 b(){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(),ce=this.stack[this.stack.length-1];ce.label=Y,ce.identifier=Vn(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 ce=this.sliceSerialize(B).length;Y.depth=ce}}function E(){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 z(){this.data.setextHeadingSlurpLineEnding=void 0}function T(B){const ce=this.stack[this.stack.length-1].children;let ke=ce[ce.length-1];(!ke||ke.type!=="text")&&(ke=re(),ke.position={start:Qt(B.start),end:void 0},ce.push(ke)),this.stack.push(ke)}function R(B){const Y=this.stack.pop();Y.value+=this.sliceSerialize(B),Y.position.end=Qt(B.end)}function $(B){const Y=this.stack[this.stack.length-1];if(this.data.atHardBreak){const ce=Y.children[Y.children.length-1];ce.position.end=Qt(B.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(Y.type)&&(T.call(this,B),R.call(this,B))}function j(){this.data.atHardBreak=!0}function D(){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 L(){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(B){const Y=this.sliceSerialize(B),ce=this.stack[this.stack.length-2];ce.label=WE(Y),ce.identifier=Vn(Y).toLowerCase()}function q(){const B=this.stack[this.stack.length-1],Y=this.resume(),ce=this.stack[this.stack.length-1];if(this.data.inReference=!0,ce.type==="link"){const ke=B.children;ce.children=ke}else ce.alt=Y}function A(){const B=this.resume(),Y=this.stack[this.stack.length-1];Y.url=B}function Z(){const B=this.resume(),Y=this.stack[this.stack.length-1];Y.title=B}function W(){this.data.inReference=void 0}function I(){this.data.referenceType="collapsed"}function se(B){const Y=this.resume(),ce=this.stack[this.stack.length-1];ce.label=Y,ce.identifier=Vn(this.sliceSerialize(B)).toLowerCase(),this.data.referenceType="full"}function ee(B){this.data.characterReferenceType=B.type}function pe(B){const Y=this.sliceSerialize(B),ce=this.data.characterReferenceType;let ke;ce?(ke=wp(Y,ce==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):ke=Ta(Y);const ze=this.stack[this.stack.length-1];ze.value+=ke}function le(B){const Y=this.stack.pop();Y.position.end=Qt(B.end)}function ne(B){R.call(this,B);const Y=this.stack[this.stack.length-1];Y.url=this.sliceSerialize(B)}function de(B){R.call(this,B);const Y=this.stack[this.stack.length-1];Y.url="mailto:"+this.sliceSerialize(B)}function fe(){return{type:"blockquote",children:[]}}function he(){return{type:"code",lang:null,meta:null,value:""}}function we(){return{type:"inlineCode",value:""}}function Me(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function _(){return{type:"emphasis",children:[]}}function Q(){return{type:"heading",depth:0,children:[]}}function G(){return{type:"break"}}function O(){return{type:"html",value:""}}function P(){return{type:"image",title:null,url:"",alt:null}}function H(){return{type:"link",title:null,url:"",children:[]}}function oe(B){return{type:"list",ordered:B.type==="listOrdered",start:null,spread:B._spread,children:[]}}function ie(B){return{type:"listItem",spread:B._spread,checked:null,children:[]}}function K(){return{type:"paragraph",children:[]}}function J(){return{type:"strong",children:[]}}function re(){return{type:"text",value:""}}function te(){return{type:"thematicBreak"}}}function Qt(e){return{line:e.line,column:e.column,offset:e.offset}}function Ip(e,t){let n=-1;for(;++n<t.length;){const r=t[n];Array.isArray(r)?Ip(e,r):GE(e,r)}}function GE(e,t){let n;for(n in t)if(zp.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 Ec(e,t){throw e?new Error("Cannot close `"+e.type+"` ("+vr({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+vr({start:t.start,end:t.end})+") is open"):new Error("Cannot close document, a token (`"+t.type+"`, "+vr({start:t.start,end:t.end})+") is still open")}function YE(e){const t=this;t.parser=n;function n(r){return JE(r,{...t.data("settings"),...e,extensions:t.data("micromarkExtensions")||[],mdastExtensions:t.data("fromMarkdownExtensions")||[]})}}function XE(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 QE(e,t){const n={type:"element",tagName:"br",properties:{},children:[]};return e.patch(t,n),[e.applyData(t,n),{type:"text",value:`
|
|
97
|
-
`}]}function eN(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 tN(e,t){const n={type:"element",tagName:"del",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function nN(e,t){const n={type:"element",tagName:"em",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function rN(e,t){const n=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",r=String(t.identifier).toUpperCase(),o=sr(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 oN(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 sN(e,t){if(e.options.allowDangerousHtml){const n={type:"raw",value:t.value};return e.patch(t,n),e.applyData(t,n)}}function Pp(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 iN(e,t){const n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return Pp(e,t);const o={src:sr(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 aN(e,t){const n={src:sr(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 lN(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 cN(e,t){const n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return Pp(e,t);const o={href:sr(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 uN(e,t){const n={href:sr(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 dN(e,t,n){const r=e.all(t),o=n?fN(n):Rp(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 fN(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=Rp(n[r])}return t}function Rp(e){const t=e.spread;return t??e.children.length>1}function hN(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 pN(e,t){const n={type:"element",tagName:"p",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function mN(e,t){const n={type:"root",children:e.wrap(e.all(t))};return e.patch(t,n),e.applyData(t,n)}function gN(e,t){const n={type:"element",tagName:"strong",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function xN(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=Ca(t.children[1]),c=pp(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 yN(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],p={},h=i?i[c]:void 0;h&&(p.align=h);let g={type:"element",tagName:s,properties:p,children:[]};f&&(g.children=e.all(f),e.patch(f,g),g=e.applyData(f,g)),u.push(g)}const d={type:"element",tagName:"tr",properties:{},children:e.wrap(u,!0)};return e.patch(t,d),e.applyData(t,d)}function bN(e,t){const n={type:"element",tagName:"td",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}const Nc=9,Tc=32;function vN(e){const t=String(e),n=/\r?\n|\r/g;let r=n.exec(t),o=0;const s=[];for(;r;)s.push(Ac(t.slice(o,r.index),o>0,!0),r[0]),o=r.index+r[0].length,r=n.exec(t);return s.push(Ac(t.slice(o),o>0,!1)),s.join("")}function Ac(e,t,n){let r=0,o=e.length;if(t){let s=e.codePointAt(r);for(;s===Nc||s===Tc;)r++,s=e.codePointAt(r)}if(n){let s=e.codePointAt(o-1);for(;s===Nc||s===Tc;)o--,s=e.codePointAt(o-1)}return o>r?e.slice(r,o):""}function wN(e,t){const n={type:"text",value:vN(String(t.value))};return e.patch(t,n),e.applyData(t,n)}function kN(e,t){const n={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(t,n),e.applyData(t,n)}const _N={blockquote:XE,break:QE,code:eN,delete:tN,emphasis:nN,footnoteReference:rN,heading:oN,html:sN,imageReference:iN,image:aN,inlineCode:lN,linkReference:cN,link:uN,listItem:dN,list:hN,paragraph:pN,root:mN,strong:gN,table:xN,tableCell:bN,tableRow:yN,text:wN,thematicBreak:kN,toml:to,yaml:to,definition:to,footnoteDefinition:to};function to(){}const Op=-1,us=0,kr=1,Io=2,Ia=3,Pa=4,Ra=5,Oa=6,Mp=7,Dp=8,zc=typeof self=="object"?self:globalThis,SN=(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 us:case Op:return n(i,o);case kr:{const a=n([],o);for(const c of i)a.push(r(c));return a}case Io:{const a=n({},o);for(const[c,u]of i)a[r(c)]=r(u);return a}case Ia:return n(new Date(i),o);case Pa:{const{source:a,flags:c}=i;return n(new RegExp(a,c),o)}case Ra:{const a=n(new Map,o);for(const[c,u]of i)a.set(r(c),r(u));return a}case Oa:{const a=n(new Set,o);for(const c of i)a.add(r(c));return a}case Mp:{const{name:a,message:c}=i;return n(new zc[a](c),o)}case Dp: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 zc[s](i),o)};return r},Ic=e=>SN(new Map,e)(0),Rn="",{toString:CN}={},{keys:jN}=Object,hr=e=>{const t=typeof e;if(t!=="object"||!e)return[us,t];const n=CN.call(e).slice(8,-1);switch(n){case"Array":return[kr,Rn];case"Object":return[Io,Rn];case"Date":return[Ia,Rn];case"RegExp":return[Pa,Rn];case"Map":return[Ra,Rn];case"Set":return[Oa,Rn];case"DataView":return[kr,n]}return n.includes("Array")?[kr,n]:n.includes("Error")?[Mp,n]:[Io,n]},no=([e,t])=>e===us&&(t==="function"||t==="symbol"),EN=(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 us:{let d=i;switch(c){case"bigint":a=Dp,d=i.toString();break;case"function":case"symbol":if(e)throw new TypeError("unable to serialize "+c);d=null;break;case"undefined":return o([Op],i)}return o([a,d],i)}case kr:{if(c){let p=i;return c==="DataView"?p=new Uint8Array(i.buffer):c==="ArrayBuffer"&&(p=new Uint8Array(i)),o([c,[...p]],i)}const d=[],f=o([a,d],i);for(const p of i)d.push(s(p));return f}case Io:{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 p of jN(i))(e||!no(hr(i[p])))&&d.push([s(p),s(i[p])]);return f}case Ia:return o([a,i.toISOString()],i);case Pa:{const{source:d,flags:f}=i;return o([a,{source:d,flags:f}],i)}case Ra:{const d=[],f=o([a,d],i);for(const[p,h]of i)(e||!(no(hr(p))||no(hr(h))))&&d.push([s(p),s(h)]);return f}case Oa:{const d=[],f=o([a,d],i);for(const p of i)(e||!no(hr(p)))&&d.push(s(p));return f}}const{message:u}=i;return o([a,{name:c,message:u}],i)};return s},Pc=(e,{json:t,lossy:n}={})=>{const r=[];return EN(!(t||n),!!t,new Map,r)(e),r},Po=typeof structuredClone=="function"?(e,t)=>t&&("json"in t||"lossy"in t)?Ic(Pc(e,t)):structuredClone(e):(e,t)=>Ic(Pc(e,t));function NN(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 TN(e,t){return"Back to reference "+(e+1)+(t>1?"-"+t:"")}function AN(e){const t=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",n=e.options.footnoteBackContent||NN,r=e.options.footnoteBackLabel||TN,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(),p=sr(f.toLowerCase());let h=0;const g=[],m=e.footnoteCounts.get(f);for(;m!==void 0&&++h<=m;){g.length>0&&g.push({type:"text",value:" "});let v=typeof n=="string"?n:n(c,h);typeof v=="string"&&(v={type:"text",value:v}),g.push({type:"element",tagName:"a",properties:{href:"#"+t+"fnref-"+p+(h>1?"-"+h:""),dataFootnoteBackref:"",ariaLabel:typeof r=="string"?r:r(c,h),className:["data-footnote-backref"]},children:Array.isArray(v)?v:[v]})}const x=d[d.length-1];if(x&&x.type==="element"&&x.tagName==="p"){const v=x.children[x.children.length-1];v&&v.type==="text"?v.value+=" ":x.children.push({type:"text",value:" "}),x.children.push(...g)}else d.push(...g);const b={type:"element",tagName:"li",properties:{id:t+"fn-"+p},children:e.wrap(d,!0)};e.patch(u,b),a.push(b)}if(a.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:s,properties:{...Po(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 Lp=(function(e){if(e==null)return RN;if(typeof e=="function")return ds(e);if(typeof e=="object")return Array.isArray(e)?zN(e):IN(e);if(typeof e=="string")return PN(e);throw new Error("Expected function, string, or object as test")});function zN(e){const t=[];let n=-1;for(;++n<e.length;)t[n]=Lp(e[n]);return ds(r);function r(...o){let s=-1;for(;++s<t.length;)if(t[s].apply(this,o))return!0;return!1}}function IN(e){const t=e;return ds(n);function n(r){const o=r;let s;for(s in e)if(o[s]!==t[s])return!1;return!0}}function PN(e){return ds(t);function t(n){return n&&n.type===e}}function ds(e){return t;function t(n,r,o){return!!(ON(n)&&e.call(this,n,typeof r=="number"?r:void 0,o||void 0))}}function RN(){return!0}function ON(e){return e!==null&&typeof e=="object"&&"type"in e}const Fp=[],MN=!0,Rc=!1,DN="skip";function LN(e,t,n,r){let o;typeof t=="function"&&typeof n!="function"?(r=n,n=t):o=t;const s=Lp(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 h=typeof f.tagName=="string"?f.tagName:typeof f.name=="string"?f.name:void 0;Object.defineProperty(p,"name",{value:"node ("+(c.type+(h?"<"+h+">":""))+")"})}return p;function p(){let h=Fp,g,m,x;if((!t||s(c,u,d[d.length-1]||void 0))&&(h=FN(n(c,d)),h[0]===Rc))return h;if("children"in c&&c.children){const b=c;if(b.children&&h[0]!==DN)for(m=(r?b.children.length:-1)+i,x=d.concat(b);m>-1&&m<b.children.length;){const v=b.children[m];if(g=a(v,m,x)(),g[0]===Rc)return g;m=typeof g[1]=="number"?g[1]:m+i}}return h}}}function FN(e){return Array.isArray(e)?e:typeof e=="number"?[MN,e]:e==null?Fp:[e]}function $p(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),LN(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 Ei={}.hasOwnProperty,$N={};function BN(e,t){const n=t||$N,r=new Map,o=new Map,s=new Map,i={..._N,...n.handlers},a={all:u,applyData:VN,definitionById:r,footnoteById:o,footnoteCounts:s,footnoteOrder:[],handlers:i,one:c,options:n,patch:UN,wrap:ZN};return $p(e,function(d){if(d.type==="definition"||d.type==="footnoteDefinition"){const f=d.type==="definition"?r:o,p=String(d.identifier).toUpperCase();f.has(p)||f.set(p,d)}}),a;function c(d,f){const p=d.type,h=a.handlers[p];if(Ei.call(a.handlers,p)&&h)return h(a,d,f);if(a.options.passThrough&&a.options.passThrough.includes(p)){if("children"in d){const{children:m,...x}=d,b=Po(x);return b.children=a.all(d),b}return Po(d)}return(a.options.unknownHandler||HN)(a,d,f)}function u(d){const f=[];if("children"in d){const p=d.children;let h=-1;for(;++h<p.length;){const g=a.one(p[h],d);if(g){if(h&&p[h-1].type==="break"&&(!Array.isArray(g)&&g.type==="text"&&(g.value=Oc(g.value)),!Array.isArray(g)&&g.type==="element")){const m=g.children[0];m&&m.type==="text"&&(m.value=Oc(m.value))}Array.isArray(g)?f.push(...g):f.push(g)}}}return f}}function UN(e,t){e.position&&(t.position=Cj(e))}function VN(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,Po(s)),"children"in n&&n.children&&o!==null&&o!==void 0&&(n.children=o)}return n}function HN(e,t){const n=t.data||{},r="value"in t&&!(Ei.call(n,"hProperties")||Ei.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 ZN(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 Oc(e){let t=0,n=e.charCodeAt(t);for(;n===9||n===32;)t++,n=e.charCodeAt(t);return e.slice(t)}function Mc(e,t){const n=BN(e,t),r=n.one(e,void 0),o=AN(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 WN(e,t){return e&&"run"in e?async function(n,r){const o=Mc(n,{file:r,...t});await e.run(o,r)}:function(n,r){return Mc(n,{file:r,...e||t})}}function Dc(e){if(e)throw e}var Ms,Lc;function qN(){if(Lc)return Ms;Lc=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 p;for(p in u);return typeof p>"u"||e.call(u,p)},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 Ms=function c(){var u,d,f,p,h,g,m=arguments[0],x=1,b=arguments.length,v=!1;for(typeof m=="boolean"&&(v=m,m=arguments[1]||{},x=2),(m==null||typeof m!="object"&&typeof m!="function")&&(m={});x<b;++x)if(u=arguments[x],u!=null)for(d in u)f=a(m,d),p=a(u,d),m!==p&&(v&&p&&(s(p)||(h=o(p)))?(h?(h=!1,g=f&&o(f)?f:[]):g=f&&s(f)?f:{},i(m,{name:d,newValue:c(v,g,p)})):typeof p<"u"&&i(m,{name:d,newValue:p}));return m},Ms}var JN=qN();const Ds=Pi(JN);function Ni(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 KN(){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?GN(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 GN(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 Tt={basename:YN,dirname:XN,extname:QN,join:eT,sep:"/"};function YN(e,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');Fr(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 XN(e){if(Fr(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 QN(e){Fr(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 eT(...e){let t=-1,n;for(;++t<e.length;)Fr(e[t]),e[t]&&(n=n===void 0?e[t]:n+"/"+e[t]);return n===void 0?".":tT(n)}function tT(e){Fr(e);const t=e.codePointAt(0)===47;let n=nT(e,!t);return n.length===0&&!t&&(n="."),n.length>0&&e.codePointAt(e.length-1)===47&&(n+="/"),t?"/"+n:n}function nT(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 Fr(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const rT={cwd:oT};function oT(){return"/"}function Ti(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function sT(e){if(typeof e=="string")e=new URL(e);else if(!Ti(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 iT(e)}function iT(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 Ls=["history","path","basename","stem","extname","dirname"];class Bp{constructor(t){let n;t?Ti(t)?n={path:t}:typeof t=="string"||aT(t)?n={value:t}:n=t:n={},this.cwd="cwd"in n?"":rT.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let r=-1;for(;++r<Ls.length;){const s=Ls[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)Ls.includes(o)||(this[o]=n[o])}get basename(){return typeof this.path=="string"?Tt.basename(this.path):void 0}set basename(t){$s(t,"basename"),Fs(t,"basename"),this.path=Tt.join(this.dirname||"",t)}get dirname(){return typeof this.path=="string"?Tt.dirname(this.path):void 0}set dirname(t){Fc(this.basename,"dirname"),this.path=Tt.join(t||"",this.basename)}get extname(){return typeof this.path=="string"?Tt.extname(this.path):void 0}set extname(t){if(Fs(t,"extname"),Fc(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=Tt.join(this.dirname,this.stem+(t||""))}get path(){return this.history[this.history.length-1]}set path(t){Ti(t)&&(t=sT(t)),$s(t,"path"),this.path!==t&&this.history.push(t)}get stem(){return typeof this.path=="string"?Tt.basename(this.path,this.extname):void 0}set stem(t){$s(t,"stem"),Fs(t,"stem"),this.path=Tt.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 Fs(e,t){if(e&&e.includes(Tt.sep))throw new Error("`"+t+"` cannot be a path: did not expect `"+Tt.sep+"`")}function $s(e,t){if(!e)throw new Error("`"+t+"` cannot be empty")}function Fc(e,t){if(!e)throw new Error("Setting `"+t+"` requires `path` to be set too")}function aT(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const lT=(function(e){const r=this.constructor.prototype,o=r[e],s=function(){return o.apply(s,arguments)};return Object.setPrototypeOf(s,r),s}),cT={}.hasOwnProperty;class Ma extends lT{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=KN()}copy(){const t=new Ma;let n=-1;for(;++n<this.attachers.length;){const r=this.attachers[n];t.use(...r)}return t.data(Ds(!0,{},this.namespace)),t}data(t,n){return typeof t=="string"?arguments.length===2?(Vs("data",this.frozen),this.namespace[t]=n,this):cT.call(this.namespace,t)&&this.namespace[t]||void 0:t?(Vs("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=ro(t),r=this.parser||this.Parser;return Bs("parse",r),r(String(n),n)}process(t,n){const r=this;return this.freeze(),Bs("process",this.parser||this.Parser),Us("process",this.compiler||this.Compiler),n?o(void 0,n):new Promise(o);function o(s,i){const a=ro(t),c=r.parse(a);r.run(c,a,function(d,f,p){if(d||!f||!p)return u(d);const h=f,g=r.stringify(h,p);fT(g)?p.value=g:p.result=g,u(d,p)});function u(d,f){d||!f?i(d):s?s(f):n(void 0,f)}}}processSync(t){let n=!1,r;return this.freeze(),Bs("processSync",this.parser||this.Parser),Us("processSync",this.compiler||this.Compiler),this.process(t,o),Bc("processSync","process",n),r;function o(s,i){n=!0,Dc(s),r=i}}run(t,n,r){$c(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=ro(n);o.run(t,c,u);function u(d,f,p){const h=f||t;d?a(d):i?i(h):r(void 0,h,p)}}}runSync(t,n){let r=!1,o;return this.run(t,n,s),Bc("runSync","run",r),o;function s(i,a){Dc(i),o=a,r=!0}}stringify(t,n){this.freeze();const r=ro(n),o=this.compiler||this.Compiler;return Us("stringify",o),$c(t),o(t,r)}use(t,...n){const r=this.attachers,o=this.namespace;if(Vs("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=Ds(!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,p=-1;for(;++f<r.length;)if(r[f][0]===u){p=f;break}if(p===-1)r.push([u,...d]);else if(d.length>0){let[h,...g]=d;const m=r[p][1];Ni(m)&&Ni(h)&&(h=Ds(!0,m,h)),r[p]=[u,h,...g]}}}}const uT=new Ma().freeze();function Bs(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function Us(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function Vs(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 $c(e){if(!Ni(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function Bc(e,t,n){if(!n)throw new Error("`"+e+"` finished async. Use `"+t+"` instead")}function ro(e){return dT(e)?e:new Bp(e)}function dT(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function fT(e){return typeof e=="string"||hT(e)}function hT(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const pT="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",Uc=[],Vc={allowDangerousHtml:!0},mT=/^(https?|ircs?|mailto|xmpp)$/i,gT=[{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 Hc(e){const t=xT(e),n=yT(e);return bT(t.runSync(t.parse(n),n),e)}function xT(e){const t=e.rehypePlugins||Uc,n=e.remarkPlugins||Uc,r=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...Vc}:Vc;return uT().use(YE).use(n).use(WN,r).use(t)}function yT(e){const t=e.children||"",n=new Bp;return typeof t=="string"&&(n.value=t),n}function bT(e,t){const n=t.allowedElements,r=t.allowElement,o=t.components,s=t.disallowedElements,i=t.skipHtml,a=t.unwrapDisallowed,c=t.urlTransform||vT;for(const d of gT)Object.hasOwn(t,d.from)&&(""+d.from+(d.to?"use `"+d.to+"` instead":"remove it")+pT+d.id,void 0);return $p(e,u),Aj(e,{Fragment:l.Fragment,components:o,ignoreInvalidStyle:!0,jsx:l.jsx,jsxs:l.jsxs,passKeys:!0,passNode:!0});function u(d,f,p){if(d.type==="raw"&&p&&typeof f=="number")return i?p.children.splice(f,1):p.children[f]={type:"text",value:d.value},f;if(d.type==="element"){let h;for(h in Ps)if(Object.hasOwn(Ps,h)&&Object.hasOwn(d.properties,h)){const g=d.properties[h],m=Ps[h];(m===null||m.includes(d.tagName))&&(d.properties[h]=c(String(g||""),h,d))}}if(d.type==="element"){let h=n?!n.includes(d.tagName):s?s.includes(d.tagName):!1;if(!h&&r&&typeof f=="number"&&(h=!r(d,f,p)),h&&p&&typeof f=="number")return a&&d.children?p.children.splice(f,1,...d.children):p.children.splice(f,1),f}}}function vT(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||mT.test(e.slice(0,t))?e:""}function Up(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 br(e){return e!==null&&(Array.isArray(e)||typeof e=="object")}function Vp(e){return Array.isArray(e)?e.map((t,n)=>[String(n),t]):typeof e=="object"&&e!==null?Object.entries(e):[]}const Zc=120;function wT({text:e}){const[t,n]=y.useState(!1);return e.length>Zc?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(Hc,{children:e})}):l.jsxs($e,{delayDuration:300,children:[l.jsxs(Be,{onClick:o=>{o.stopPropagation(),n(!0)},className:"text-left cursor-pointer",children:[l.jsx("span",{children:e.slice(0,Zc)}),l.jsx("span",{className:"text-emerald-400/50",children:"…"})]}),l.jsxs(Ue,{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(Hc,{children:e})}),'"']})}function Hp({value:e}){if(e===null)return l.jsx("span",{className:"text-rose-400 italic",children:"null"});switch(typeof e){case"string":return l.jsx(wT,{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 Wc({value:e}){const[t,n]=y.useState(!1);function r(o){o.stopPropagation(),window.navigator.clipboard.writeText(JSON.stringify(e,null,2)).then(()=>{n(!0),setTimeout(()=>{n(!1)},2e3)})}return 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 kT({value:e}){const[t,n]=y.useState(!1);function r(o){o.stopPropagation(),window.navigator.clipboard.writeText(JSON.stringify(e,null,2)).then(()=>{n(!0),setTimeout(()=>{n(!1)},2e3)})}return 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 _T({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(ad,{className:"size-3.5 text-muted-foreground"})})}const ST=y.memo(function e({name:t,value:n,level:r,defaultExpandDepth:o,isArrayItem:s,path:i,expandTargetPath:a,anatomyPaths:c}){const u=y.useMemo(()=>a===null?!1:i===""?a.length>0:a===i||a.startsWith(`${i}/`),[a,i]),d=r<o||u&&br(n),[f,p]=y.useState(d);y.useEffect(()=>{u&&br(n)&&!f&&p(!0)},[a]);const[h,g]=y.useState(0),[m,x]=y.useState(null),b=br(n),v=m===Number.POSITIVE_INFINITY,k=y.useMemo(()=>Vp(n),[n]),S=y.useMemo(()=>k.some(([,w])=>br(w)),[k]),C=Up(n),E=C==="array"?"[":"{",N=C==="array"?"]":"}",z=c!==null&&c.has(i);function T(){p(!0),x(Number.POSITIVE_INFINITY),g(w=>w+1)}function R(){p(!1),x(0),g(w=>w+1)}function $(){v?R():p(!f)}function j(w){w.stopPropagation(),T()}const D=m??o;return l.jsxs("div",{className:ve(r>0&&"border-l border-border/50 ml-2"),children:[l.jsxs("div",{className:ve("flex items-start gap-1 py-0.5 px-1 -ml-1 rounded-sm group/row",b&&"cursor-pointer hover:bg-muted/50"),"data-anatomy-path":z?i:void 0,onClick:b?$:void 0,onKeyDown:b?w=>{(w.key==="Enter"||w.key===" ")&&(w.preventDefault(),$())}:void 0,onDoubleClick:b&&S?()=>T():void 0,role:b?"button":void 0,tabIndex:b?0:void 0,children:[b?l.jsx("span",{className:"w-4 h-5 flex items-center justify-center shrink-0",children:f?l.jsx(Gt,{className:"size-3 text-muted-foreground"}):l.jsx(cn,{className:"size-3 text-muted-foreground"})}):l.jsx("span",{className:"w-4 shrink-0"}),l.jsx("span",{className:ve("shrink-0",s?"text-muted-foreground":"text-cyan-400"),children:s?t:`"${t}"`}),l.jsx("span",{className:"text-muted-foreground shrink-0",children:b?"":":"}),b?l.jsxs("span",{className:"text-muted-foreground",children:[E,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(Hp,{value:n})}),b&&S&&!v&&l.jsx(_T,{onClick:j}),l.jsx(kT,{value:n})]}),b&&f&&l.jsxs("div",{className:"pl-4",children:[k.map(([w,M])=>l.jsx(e,{name:w,value:M,level:r+1,defaultExpandDepth:D,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})]},h)]})});function Da({data:e,defaultExpandDepth:t=0,className:n,showCopy:r=!1,bulkDepth:o,bulkRevision:s,anatomyPaths:i=null,expandToPath:a=null}){const c=br(e),u=y.useMemo(()=>Vp(e),[e]),d=o??t,f=s??0;if(!c)return l.jsx(Xe,{children:l.jsx("div",{className:ve("font-mono text-xs leading-relaxed",n),children:l.jsxs("div",{className:"flex items-center gap-1",children:[l.jsx(Hp,{value:e}),r&&l.jsx(Wc,{value:e})]})})});const h=Up(e)==="array";return l.jsx(Xe,{children:l.jsxs("div",{className:ve("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(Wc,{value:e})}),l.jsx("div",{children:u.map(([g,m])=>l.jsx(ST,{name:g,value:m,level:0,defaultExpandDepth:d,isArrayItem:h,path:`/${g}`,expandTargetPath:a,anatomyPaths:i},g))},f)]})})}const CT=y.memo(function({text:t,defaultExpandDepth:n=0,className:r,bulkDepth:o,bulkRevision:s}){const i=y.useMemo(()=>Qh(t),[t]);return i.kind==="json"?l.jsx(Da,{data:i.data,defaultExpandDepth:n,className:r,bulkDepth:o,bulkRevision:s}):l.jsx("pre",{className:ve("font-mono text-xs whitespace-pre-wrap break-words",r),children:t})}),Zp=Object.freeze(Object.defineProperty({__proto__:null,JsonViewer:Da,JsonViewerFromString:CT},Symbol.toStringTag,{value:"Module"}));function jT({className:e,children:t,...n}){return l.jsxs(cS,{"data-slot":"scroll-area",className:ve("relative",e),...n,children:[l.jsx(uS,{"data-slot":"scroll-area-viewport",className:"focus-visible:ring-ring/50 size-full rounded-[inherit] transition-[color,box-shadow] outline-none focus-visible:ring-[3px] focus-visible:outline-1",children:t}),l.jsx(ET,{}),l.jsx(dS,{})]})}function ET({className:e,orientation:t="vertical",...n}){return l.jsx(qf,{"data-slot":"scroll-area-scrollbar",orientation:t,className:ve("flex touch-none p-px transition-colors select-none",t==="vertical"&&"h-full w-2.5 border-l border-l-transparent",t==="horizontal"&&"h-2.5 flex-col border-t border-t-transparent",e),...n,children:l.jsx(Yf,{"data-slot":"scroll-area-thumb",className:"bg-border relative flex-1 rounded-full"})})}const Wp={file:"file",shell:"shell",browser:"browser",web:"web",mcp:"MCP",code:"code",other:"other"},NT={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 TT({category:e}){switch(e){case"file":return l.jsx(zb,{className:"size-3.5"});case"shell":return l.jsx(fd,{className:"size-3.5"});case"browser":return l.jsx(Wb,{className:"size-3.5"});case"web":return l.jsx(ud,{className:"size-3.5"});case"mcp":return l.jsx(qy,{className:"size-3.5"});case"code":return l.jsx(pb,{className:"size-3.5"});case"other":return l.jsx(vb,{className:"size-3.5"})}}function AT({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(St,{variant:"outline",className:"h-5 max-w-36 truncate rounded-md px-1.5 py-0 font-mono text-[10px]",children:t},t)),e.length>4&&l.jsxs("span",{className:"font-mono text-[10px] text-muted-foreground",children:["+",e.length-4]})]})}function zT({tool:e,called:t}){const[n,r]=y.useState(!1),o=mn(e.name),s=e.description!==null||e.requiredParameters.length>0||e.schema!==null;return l.jsx(ej,{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(TT,{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(St,{variant:"outline",className:"h-5 rounded-md border-emerald-400/20 bg-emerald-400/5 px-1.5 py-0 text-[10px] text-emerald-300",children:"called"}),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(Gt,{className:"size-3.5 shrink-0 text-muted-foreground"}):l.jsx(cn,{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(tj,{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(AT,{names:e.requiredParameters}),e.schema!==null&&l.jsx(jT,{className:"max-h-64 rounded-md border border-border/60 bg-muted/20 p-2",children:l.jsx(Da,{data:Ao(e.schema),defaultExpandDepth:0})})]})})]})})}function IT(e,t){return t.length===0?!0:`${e.name} ${e.description??""} ${Wp[e.category]}`.toLowerCase().trim().includes(t)}const PT=y.memo(function({summary:t,calledToolNames:n}){const[r,o]=y.useState(!1),[s,i]=y.useState(""),a=y.useMemo(()=>new Set(n),[n]),c=s.trim().toLowerCase(),u=y.useMemo(()=>t===null?[]:t.tools.filter(p=>IT(p,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(Rr,{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(St,{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(St,{variant:"outline",className:"h-5 rounded-md px-1.5 py-0 font-mono text-[10px] text-muted-foreground",children:["tool_choice: ",t.toolChoiceLabel]})]}),l.jsx("div",{className:"mt-1 flex min-w-0 flex-wrap gap-1",children:t.categories.map(p=>l.jsxs(St,{variant:"outline",className:ve("h-5 rounded-md px-1.5 py-0 font-mono text-[10px]",NT[p.category]),children:[p.count," ",Wp[p.category]]},p.category))})]})]}),l.jsxs(Re,{type:"button",variant:"ghost",size:"sm",className:"h-7 px-2",onClick:()=>o(p=>!p),"aria-expanded":r,children:[r?l.jsx(Gt,{className:"size-3.5"}):l.jsx(cn,{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(p=>l.jsx(St,{variant:"outline",className:ve("h-5 max-w-44 truncate rounded-md px-1.5 py-0 font-mono text-[10px]",a.has(p.name)&&"border-emerald-400/20 text-emerald-300"),children:p.name},p.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(uv,{className:"size-3.5 shrink-0 text-muted-foreground"}),l.jsx("input",{value:s,onChange:p=>i(p.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(p=>l.jsx(zT,{tool:p,called:a.has(p.name)},p.name)):l.jsx("p",{className:"py-2 text-xs text-muted-foreground",children:"No matching tools"})})]})]})}),RT="/v1/chat/completions",OT="/chat/completions",MT="/v1/messages";class DT{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 ir=new DT;function LT(e){return ir.getByPath(e)??null}function FT(e){return LT(e)?.format??"unknown"}ir.registerPath(MT,"anthropic");ir.registerPath(RT,"openai");ir.registerPath(OT,"openai");function $T(e){if(e==="")return{};try{const t=JSON.parse(e);return t!==null&&typeof t=="object"&&!Array.isArray(t)?{...t}:{}}catch{return{}}}function BT(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:$T(e.inputJson)}}}function qp(e,t,n,r){const o=new Map;let s="",i="",a=null,c=null,u=0,d=0;const f=1e3;let p=0,h=0;const g=[];for(const x of e.split(`
|
|
107
|
-
`)){const b=x.trim();if(b.startsWith("data: "))try{const v=JSON.parse(b.slice(6)),k=Cy.safeParse(v);if(!k.success)continue;const S=k.data;switch(p===0&&(h=Date.now()),r===!0&&g.length<f&&g.push({index:p,timestamp:Date.now()-h,type:S.type,data:S}),p++,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 E=S.delta;E.type==="text_delta"&&C.type==="text"?C.text+=E.text:E.type==="thinking_delta"&&(C.type==="thinking"||C.type==="think")?C.thinking+=E.thinking:E.type==="signature_delta"&&(C.type==="thinking"||C.type==="think")?C.signature+=E.signature:E.type==="input_json_delta"&&C.type==="tool_use"&&(C.inputJson+=E.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:g,truncated:p>f});const m=[...o.entries()].sort(([x],[b])=>x-b).map(([,x])=>BT(x));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 UT={format:"anthropic",parseRequest(e,t){try{const n=JSON.parse(e),r=Ku.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=Gu.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 qp(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}}};ir.register(UT);class VT{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 La=new VT,HT="https://api.anthropic.com",ZT={MiniMax:"https://api.minimaxi.com/anthropic"},WT={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(ZT))if(t.startsWith(n.toLowerCase()))return!0;return!0},getUpstreamBase(e,t){return t?.baseUrl!==void 0?t.baseUrl:HT},extractStream(e,t,n,r){return qp(e,t,n,r)}};La.register(WT);function Fa(e,t,n,r=!0){let o="",s="",i="",a="",c=null,u=0,d=0,f=!1,p=!1;const h=new Map,g=1e3;let m=0,x=0;const b=[];for(const k of e.split(`
|
|
108
|
-
`)){const S=k.trim();if(!S.startsWith("data: "))continue;const C=S.slice(6);if(C==="[DONE]")break;try{const E=JSON.parse(C);if(typeof E=="object"&&E!==null&&!Array.isArray(E)){const T=Object.getOwnPropertyDescriptor(E,"error");if(T!==void 0&&typeof T.value=="object"&&T.value!==null){const R=Object.getOwnPropertyDescriptor(T.value,"message");R!==void 0&&typeof R.value=="string"&&(t.error=R.value);continue}}const N=zy.safeParse(E);if(!N.success)continue;const z=N.data;if(m===0&&(x=Date.now()),r===!0&&b.length<g&&b.push({index:m,timestamp:Date.now()-x,type:"chat.completion.chunk",data:z}),m++,p||(o=z.id,s=z.model,p=!0),!f&&z.usage!==void 0&&z.usage!==null){if(u=z.usage.prompt_tokens??0,d=z.usage.completion_tokens??0,t.inputTokens=u,typeof E=="object"&&E!==null&&!Array.isArray(E)){const T=Object.getOwnPropertyDescriptor(E,"usage");if(T!==void 0&&typeof T.value=="object"&&T.value!==null){const R=Object.getOwnPropertyDescriptor(T.value,"prompt_tokens_details");if(R!==void 0&&typeof R.value=="object"&&R.value!==null){const $=Object.getOwnPropertyDescriptor(R.value,"cached_tokens");$!==void 0&&typeof $.value=="number"&&(t.cacheReadInputTokens=$.value)}}}f=!0}for(const T of z.choices){const R=T.delta;R.content!==void 0&&R.content!==null&&(i+=R.content),R.reasoning_content!==void 0&&R.reasoning_content!==null&&(a+=R.reasoning_content),R.thinking!==void 0&&R.thinking!==null&&(a+=R.thinking);const $=R.think;if($!=null&&(a+=$),T.finish_reason!==void 0&&T.finish_reason!==null&&(c=T.finish_reason),R.tool_calls!==void 0&&R.tool_calls!==null)for(const j of R.tool_calls){let D=h.get(j.index);D===void 0&&(D={index:j.index,type:"function",function:{name:"",arguments:""}},h.set(j.index,D)),j.id!==void 0&&(D.id=j.id),j.function?.name!==void 0&&(D.function.name+=j.function.name),j.function?.arguments!==void 0&&(D.function.arguments+=j.function.arguments)}}}catch{}}r===!0&&(t.streamingChunks={chunks:b,truncated:m>g}),f||(d=Math.ceil(i.length/4)),t.outputTokens=d;const v={role:"assistant",content:i};return a&&(v.reasoning_content=a),h.size>0&&(v.tool_calls=[...h.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 qT={format:"openai",parseRequest(e,t){try{const n=JSON.parse(e),r=Qu.safeParse(n);return r.success?{model:r.data.model,sessionId:t?.get("x-session-affinity")??null}:null}catch{return null}},extractTokens(e){const t=td(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 Fa(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}}};ir.register(qT);const JT="https://api.openai.com/v1",KT={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:JT},extractStream(e,t,n,r){return Fa(e,t,n,r)}};La.register(KT);const GT="https://dashscope.aliyuncs.com/compatible-mode/v1",YT={name:"alibaba",matches(e){const t=e.toLowerCase().replace(/\s+/g,"-");return!!(t.startsWith("glm-5")||t.startsWith("qwen"))},getUpstreamBase(e,t){return GT},extractStream(e,t,n){return Fa(e,t,n)}};La.register(YT);function Jp(e,t){for(const n of Array.from(e))t(n)}const XT=/[\u3000-\u9FFF\uAC00-\uD7FF\uF900-\uFAFF\uFF00-\uFFEF\u{1F300}-\u{1FAFF}]/u;function Kp(e){if(e.length===0)return 0;let t=0,n=0;return Jp(e,r=>{XT.test(r)?t+=1:n+=1}),Math.ceil(t*1)+Math.ceil(n/4)}function Gp(e){if(e.length===0)return 0;let t=0;return Jp(e,()=>{t+=1}),t}function xn(e){return{parsed:null,comparisonValue:e,messageCount:null,toolCount:null}}const Hn={parsed:null,toolNames:null};function QT(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 e4(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 t4(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 Hs(e,t,n,r){return{role:e,label:t,text:n,size:Kp(n),characters:Gp(n),path:r}}const n4={format:"anthropic",analyzeRequest(e){if(e===null)return xn(e);try{const t=Ku.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}:xn(e)}catch{return xn(e)}},analyzeResponse(e){if(e===null)return Hn;try{let t=JSON.parse(e);typeof t=="string"&&(t=JSON.parse(t));const n=Gu.safeParse(t);if(!n.success)return Hn;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 Hn}},anatomySegments(e){if(e===null||typeof e!="object")return null;const t=e,n=[];if(t.system!==void 0){const r=e4(t.system);r.length>0&&n.push(Hs("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=QT(s.content);n.push(Hs(i,`[${o}] ${i}`,a,`/messages/${o}`))}),Array.isArray(t.tools)&&t.tools.length>0){const r=t4(t.tools);n.push(Hs("tools","tools",r,"/tools"))}return n.length>0?n:null}};function r4(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 o4(e){const t=[],n=r4(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 s4(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 qc(e,t,n,r){return{role:e,label:t,text:n,size:Kp(n),characters:Gp(n),path:r}}const i4={format:"openai",analyzeRequest(e){if(e===null)return xn(e);try{const t=Qu.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}:xn(e)}catch{return xn(e)}},analyzeResponse(e){if(e===null)return Hn;const t=td(e);if(t===null)return Hn;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=o4(s);n.push(qc(i,`[${o}] ${i}`,a,`/messages/${o}`))}),Array.isArray(t.tools)&&t.tools.length>0){const r=s4(t.tools);n.push(qc("tools","tools",r,"/tools"))}return n.length>0?n:null}},a4={format:"unknown",analyzeRequest(e){return xn(e)},analyzeResponse(){return Hn},anatomySegments(){return null}},l4={anthropic:n4,openai:i4,unknown:a4};function c4(e){return l4[e]}function Ro(e){const t=FT(e.path);return t==="unknown"?e.apiFormat:t}function Jc(e,t,n){return e==="anthropic"&&t==="full"&&n}function u4(e,t){return e==="full"&&t}function d4(e,t,n,r){return e==="anthropic"&&t==="full"&&n&&r}const f4=["file","shell","browser","web","mcp","code","other"];function Ai(e){const t=e.replace(/\s+/g," ").trim();return t.length<=120?t:`${t.slice(0,119)}...`}function Yp(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?Ai(t.slice(0,n+1)):Ai(t)}function h4(e,t){return`${e} ${t??""}`.toLowerCase()}function On(e,t){return t.some(n=>e.includes(n))}function Xp(e,t){const n=h4(e,t);return e.startsWith("mcp__")||e.startsWith("inspector_")||On(n,[" mcp","model context protocol"])?"mcp":On(n,["bash","shell","terminal","command","powershell","exec","process"])?"shell":On(n,["browser","playwright","screenshot","click","navigate","page","tab"])?"browser":On(n,["read","write","edit","file","glob","grep","patch","filesystem","directory"])?"file":On(n,["web","search","http","url","fetch"])?"web":On(n,["code","typescript","javascript","python","repl"])?"code":"other"}function Qp(e){const t=De(e,"properties");return t===null||typeof t!="object"||Array.isArray(t)?[]:Object.keys(t).sort((n,r)=>n.localeCompare(r))}function em(e){const t=De(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 p4(e){const t=De(e,"name");if(typeof t!="string"||t.length===0)return null;const n=De(e,"description"),r=De(e,"input_schema")??null,o=typeof n=="string"?n:null;return{name:t,description:o,descriptionPreview:Yp(o),category:Xp(t,o),parameterCount:Qp(r).length,requiredParameters:em(r),schema:r}}function m4(e){const t=De(e,"function"),n=De(t,"name");if(typeof n!="string"||n.length===0)return null;const r=De(t,"description"),o=De(t,"parameters")??null,s=typeof r=="string"?r:null;return{name:n,description:s,descriptionPreview:Yp(s),category:Xp(n,s),parameterCount:Qp(o).length,requiredParameters:em(o),schema:o}}function g4(e){const t=m4(e);return t!==null?t:p4(e)}function x4(e){if(e==null)return null;if(typeof e=="string")return e;const t=De(e,"type"),n=De(e,"name"),r=De(De(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:Ai(o)}function y4(e){const t=new Map;for(const n of e)t.set(n.category,(t.get(n.category)??0)+1);return f4.flatMap(n=>{const r=t.get(n)??0;return r>0?[{category:n,count:r}]:[]})}function b4(e){const t=De(e,"tools");if(!Array.isArray(t)||t.length===0)return null;const n=[];for(const r of t){const o=g4(r);o!==null&&n.push(o)}return n.length===0?null:{tools:n,toolChoiceLabel:x4(De(e,"tool_choice")),categories:y4(n)}}function Mn(){return l.jsx("div",{className:"h-1","aria-hidden":"true"})}function v4({active:e,onClick:t}){return l.jsxs($e,{children:[l.jsx(Be,{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(Ob,{className:"size-3.5 mr-1"}),e?"Showing diff":"Diff with Raw"]})}),l.jsx(Ue,{children:e?"Hide diff view":"Compare proxy output against the original raw version"})]})}const w4=y.memo(function({rawBody:e,displayedBody:t,emptyLabel:n}){const r=y.useMemo(()=>N5(e,t),[e,t]);return l.jsx(ip,{result:r,emptyLabel:n})}),k4=y.memo(function({rawHeaders:e,headers:t,emptyLabel:n}){const r=y.useMemo(()=>E5(e,t),[e,t]);return l.jsx(ip,{result:r,emptyLabel:n})}),_4=y.memo(function({log:e,viewMode:t="simple",strip:n,slowResponseThresholdSeconds:r,timeDisplayFormat:o,cacheTrend:s=null,onCompareWithPrevious:i}){const[a,c]=y.useState(!1),[u,d]=y.useState(!1),[f,p]=y.useState(!1),[h,g]=y.useState(!1),[m,x]=y.useState("request"),[b,v]=y.useState(null),k=y.useRef(null),S=Ro(e),C=c4(S),E=y.useMemo(()=>C.analyzeRequest(e.rawRequestBody),[C,e.rawRequestBody]),N=y.useMemo(()=>C.analyzeResponse(e.responseText),[C,e.responseText]),T=y.useMemo(()=>!n||S!=="anthropic"||e.rawRequestBody===null?null:u5(e.rawRequestBody).body,[e.rawRequestBody,S,n])??e.rawRequestBody,R=Ns(T),$=Ns(e.rawRequestBody),j=Ns(e.responseText),D=y.useMemo(()=>e.headers&&Object.keys(e.headers).length>0?JSON.stringify(e.headers,null,2):null,[e.headers]),w=y.useMemo(()=>e.rawHeaders&&Object.keys(e.rawHeaders).length>0?JSON.stringify(e.rawHeaders,null,2):null,[e.rawHeaders]),M=mn(T),U=mn(e.rawRequestBody),L=mn(D),F=mn(w),q=mn(e.responseText),A=y.useMemo(()=>({request:{copyLabel:"Copy request body",copyText:T,copyCopied:M.copied,onCopy:M.copy,expansion:{isExpanded:R.isExpanded,isPending:R.isPending,onToggle:R.toggle},diffWithRaw:d4(S,t,n,e.rawRequestBody!==null)?{active:h,onToggle:()=>g(!h)}: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:D,copyCopied:L.copied,onCopy:L.copy,expansion:null},"raw-headers":{copyLabel:"Copy raw headers",copyText:w,copyCopied:F.copied,onCopy:F.copy,expansion:null},raw:{copyLabel:"Copy response",copyText:e.responseText,copyCopied:q.copied,onCopy:q.copy,expansion:{isExpanded:j.isExpanded,isPending:j.isPending,onToggle:j.toggle}}}),[T,M,R,h,e.rawRequestBody,U,$,D,L,w,F,e.responseText,q,j,S,t,n,i]),Z=y.useMemo(()=>R.parsedData!==null?C.anatomySegments(R.parsedData):null,[C,R.parsedData]),W=y.useMemo(()=>b4(R.parsedData),[R.parsedData]),I=y.useMemo(()=>{if(Z!==null)return new Set(Z.map(ee=>ee.path))},[Z]),se=w5({containerRef:k,setExpandToPath:v,ensureTabActive:()=>{m!=="request"&&x("request")}});return y.useEffect(()=>{a&&x(Z!==null?"anatomy":"request")},[Z,a]),l.jsxs(Xe,{children:[l.jsxs("div",{className:"border border-border rounded-lg mb-1 overflow-hidden",children:[l.jsx(Q5,{log:e,messageCount:E.messageCount,toolCount:E.toolCount,expanded:a,onToggle:()=>c(!a),cacheTrend:s,slowResponseThresholdSeconds:r,timeDisplayFormat:o,activeTab:m,tabActions:A,onReplay:i===void 0?void 0:()=>{d(!0)}}),a&&l.jsx("div",{onClick:ee=>ee.stopPropagation(),onKeyDown:ee=>ee.stopPropagation(),children:l.jsxs(ep,{value:m,onValueChange:x,children:[l.jsxs(tp,{className:"mx-4 mt-2",children:[t==="full"&&l.jsx(At,{value:"raw-headers",children:"Raw Headers"}),t==="full"&&l.jsx(At,{value:"headers",children:"Headers"}),Z!==null&&l.jsx(At,{value:"anatomy",children:"Context"}),Jc(S,t,n)&&l.jsx(At,{value:"raw-request",children:"Raw Request"}),l.jsx(At,{value:"request",children:"Request"}),t==="full"&&l.jsx(At,{value:"raw",children:"Raw Response"}),l.jsx(At,{value:"parsed",children:"Response"})]}),Jc(S,t,n)&&l.jsx(zt,{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(y.Suspense,{fallback:l.jsx(Mn,{}),children:l.jsx(Gl,{data:$.parsedData,bulkDepth:$.bulkDepth,bulkRevision:$.bulkRevision})}):l.jsx("pre",{className:"font-mono text-xs whitespace-pre-wrap break-words",children:e.rawRequestBody})})}),l.jsx(zt,{value:"request",children:m==="request"&&l.jsxs("div",{className:"px-4 pt-1 pb-3",children:[l.jsx(PT,{summary:W,calledToolNames:N.toolNames??[]}),h?l.jsx(w4,{rawBody:e.rawRequestBody,displayedBody:T,emptyLabel:"No transformation applied; raw and sent request bodies are identical."}):l.jsx("div",{ref:k,children:T===null?l.jsx("p",{className:"text-xs text-muted-foreground italic",children:"No request body"}):R.parsedData!==null?l.jsx(y.Suspense,{fallback:l.jsx(Mn,{}),children:l.jsx(Gl,{data:R.parsedData,bulkDepth:R.bulkDepth,bulkRevision:R.bulkRevision,anatomyPaths:I,expandToPath:b})}):l.jsx("pre",{className:"font-mono text-xs whitespace-pre-wrap break-words",children:T})})]})}),Z!==null&&l.jsx(zt,{value:"anatomy",children:m==="anatomy"&&l.jsx(y.Suspense,{fallback:l.jsx(Mn,{}),children:l.jsx(m5,{parsed:R.parsedData,inputTokens:e.inputTokens??null,model:e.model,segments:Z,onSegmentActivate:se})})}),t==="full"&&l.jsx(zt,{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:u4(t,e.rawHeaders!==void 0&&Object.keys(e.rawHeaders).length>0)&&l.jsx(v4,{active:f,onClick:ee=>{ee.stopPropagation(),p(!f)}})}),f?l.jsx(k4,{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(([ee],[pe])=>ee.localeCompare(pe)).map(([ee,pe])=>l.jsxs("div",{className:"flex gap-2",children:[l.jsxs("span",{className:"text-blue-600 dark:text-blue-400 font-semibold shrink-0",children:[ee,":"]}),l.jsx("span",{className:"text-muted-foreground truncate",title:pe,children:pe})]},ee))}):l.jsx("p",{className:"text-xs text-muted-foreground italic",children:"No headers captured"})]})}),t==="full"&&l.jsx(zt,{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(([ee],[pe])=>ee.localeCompare(pe)).map(([ee,pe])=>l.jsxs("div",{className:"flex gap-2",children:[l.jsxs("span",{className:"text-blue-600 dark:text-blue-400 font-semibold shrink-0",children:[ee,":"]}),l.jsx("span",{className:"text-muted-foreground truncate",title:pe,children:pe})]},ee))}):l.jsx("p",{className:"text-xs text-muted-foreground italic",children:"No raw headers captured"})})}),l.jsx(zt,{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(y.Suspense,{fallback:l.jsx(Mn,{}),children:l.jsx(y5,{text:e.responseText,defaultExpandDepth:0,bulkDepth:j.bulkDepth,bulkRevision:j.bulkRevision})}):l.jsx("p",{className:"text-xs text-muted-foreground italic",children:"No response"}),e.streaming===!0&&l.jsx(y.Suspense,{fallback:l.jsx(Mn,{}),children:l.jsx(x5,{logId:e.id,truncated:e.streamingChunksPath!==null})})]})}),l.jsx(zt,{value:"parsed",children:m==="parsed"&&l.jsx("div",{className:"px-4 pt-1 pb-3",children:l.jsx(y.Suspense,{fallback:l.jsx(Mn,{}),children:l.jsx(g5,{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(y.Suspense,{fallback:null,children:l.jsx(p5,{log:e,open:u,onOpenChange:d})})]})});function S4({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=y.useMemo(()=>To(s),[s]),p=y.useMemo(()=>HC(s),[s]),h=i&&a?{role:"button",tabIndex:0,className:"cursor-pointer",onClick:g=>{g.stopPropagation(),a()},onKeyDown:g=>{(g.key==="Enter"||g.key===" ")&&(g.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(p,{className:ve("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)",...h,children:l.jsx(f,{className:ve("size-3.5 text-amber-400","animate-crab-settle","drop-shadow-[0_0_4px_rgba(251,191,36,0.5)]")})}):r?l.jsx("span",{title:"Start of turn",...h,children:l.jsx(f,{className:ve("size-3.5 text-emerald-400","animate-crab-appear","drop-shadow-[0_0_4px_rgba(52,211,153,0.5)]")})}):d?l.jsx("span",{title:"Processing…",children:l.jsx(f,{className:ve("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:ve("w-0.5 h-full",t?"border-dashed bg-transparent border-l-2 border-muted-foreground/20":"bg-muted-foreground/30")})})]})}function C4({event:e}){const t=mn(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(Rr,{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(cn,{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 j4({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(C4,{event:t},t.id))})}const Kc=180;function E4(e,t){return e||t}function N4(e,t,n){return e>1&&t&&!n}function T4(e){const t=[];let n=[],r=0;for(const o of e){n.push({log:o,stopReason:zC(o)});const s=n[n.length-1];s!==void 0&&Jh(s.stopReason)&&(t.push({entries:n,turnIndex:r}),n=[],r+=1)}return n.length>0&&t.push({entries:n,turnIndex:r}),t}function A4(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=Ro(o),a=Ro(s);i==="unknown"||i!==a||t.set(o.id,s)}return t}function tm(e){if(e===null)return null;try{const t=JSON.parse(e);return typeof t=="string"?JSON.parse(t):t}catch{return null}}function nm(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>Kc?`${n.slice(0,Kc-1)}...`:n}function rm(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 z4(e){const t=tm(e.responseText),n=De(t,"content");if(!Array.isArray(n))return[];const r=[];for(const o of n){if(De(o,"type")!=="tool_use")continue;const i=De(o,"name");if(typeof i!="string"||i.length===0)continue;const a=De(o,"input");r.push({id:`${String(e.id)}-anthropic-tool-${String(r.length)}`,logId:e.id,index:r.length,provider:"anthropic",name:i,argumentsText:rm(a),argumentsPreview:nm(a)})}return r}function I4(e){const t=tm(e.responseText),n=De(t,"choices");if(!Array.isArray(n))return[];const r=[];for(const o of n){const s=De(o,"message"),i=De(s,"tool_calls");if(Array.isArray(i))for(const a of i){const c=De(a,"function"),u=De(c,"name");if(typeof u!="string"||u.length===0)continue;const d=De(c,"arguments");r.push({id:`${String(e.id)}-openai-tool-${String(r.length)}`,logId:e.id,index:r.length,provider:"openai",name:u,argumentsText:rm(d),argumentsPreview:nm(d)})}}return r}function $a(e){switch(Ro(e)){case"anthropic":return z4(e);case"openai":return I4(e);case"unknown":return[]}}function P4(e,t,n=0){let r=0,o=0,s=0,i=0,a=0,c=0,u=0,d=0,f=null,p=0;for(const h of e)h.responseStatus===null?o+=1:h.responseStatus>=400&&(r+=1),h.elapsedMs!==null&&t>0&&h.elapsedMs>t*1e3&&(s+=1),h.inputTokens!==null&&(i+=h.inputTokens),h.outputTokens!==null&&(a+=h.outputTokens),h.cacheCreationInputTokens!==null&&(c+=h.cacheCreationInputTokens),h.cacheReadInputTokens!==null&&(u+=h.cacheReadInputTokens),h.elapsedMs!==null&&(d+=h.elapsedMs,f=f===null?h.elapsedMs:Math.max(f,h.elapsedMs)),p+=$a(h).length;return{llmCallCount:e.length,toolCallCount:p,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 Zs(e){return e<1e3?`${e}ms`:`${(e/1e3).toFixed(1)}s`}const R4=y.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,p=f!==null?Jh(f):!1,h=t[d]?.log.responseStatus===null,g=t.length===1,m=N4(t.length,p,h),[x,b]=y.useState(!1),v=y.useRef(!1);y.useEffect(()=>{m?p&&!v.current&&b(!0):b(!1),v.current=p},[m,p]);const k=y.useCallback(()=>{m&&b(U=>!U)},[m]),S=y.useMemo(()=>{let U=0,L=0,F=null,q=!1;for(const A of t)A.log.inputTokens!==null&&(U+=A.log.inputTokens,q=!0),A.log.outputTokens!==null&&(L+=A.log.outputTokens,q=!0),A.log.elapsedMs!==null&&(F=F===null?A.log.elapsedMs:Math.max(F,A.log.elapsedMs));return{totalInput:U,totalOutput:L,hasTokens:q,maxElapsed:F}},[t,d]),C=y.useMemo(()=>{const U=new Set;for(const L of t){const F=Yh(L.log.model);F!=="unknown"&&U.add(F)}return[...U]},[t]),E=y.useMemo(()=>To(t[0]?.log.id??0),[t]),N=y.useMemo(()=>To(t[d]?.log.id??0),[t,d]),z=c%2===0?"bg-muted/10":"bg-muted/25",T=S.maxElapsed!==null&&o>0&&S.maxElapsed>o*1e3,R=y.useMemo(()=>{const U=new Map;for(const L of t){const F=$a(L.log);F.length>0&&U.set(L.log.id,F)}return U},[t]),[$,j]=y.useState(0),D=y.useRef(null);y.useEffect(()=>{const U=D.current;if(!U)return;let L=0;const F=new ResizeObserver(()=>{window.cancelAnimationFrame(L),L=window.requestAnimationFrame(()=>j(q=>q+1))});return F.observe(U),()=>{F.disconnect(),window.cancelAnimationFrame(L)}},[]);const w=t[0]?.log.id??c,M=`Turn ${String(c+1)}`;return l.jsx("div",{ref:D,tabIndex:x?void 0:0,role:x?void 0:"group","aria-label":x?void 0:M,"data-nav-id":x?void 0:`turn-${String(w)}`,className:ve("border rounded-lg",h?"border-amber-500/10":"border-transparent",!x&&"focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1 focus-visible:outline-none"),children:x?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(E,{className:ve("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:ve("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:ve("flex-1 min-w-0 mb-0.5 rounded-lg border border-border py-1 px-3 flex items-center gap-3 text-xs",z),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(Xh,{provider:U,className:"size-4"},U))}),S.maxElapsed!==null&&l.jsx(Xe,{children:l.jsxs($e,{children:[l.jsx(Be,{asChild:!0,children:l.jsxs("span",{className:ve("flex items-center gap-1 shrink-0",T?"text-amber-400":"text-muted-foreground"),children:[l.jsx(rn,{className:"size-3"}),l.jsx("span",{className:"font-mono tabular-nums",children:Zs(S.maxElapsed)}),T&&l.jsx(bo,{className:"size-3","aria-label":"Slow response"})]})}),l.jsx(Ue,{children:T?`Slow response: ${Zs(S.maxElapsed)} exceeds ${Zs(o*1e3)}`:"Slowest request in this turn"})]})}),S.hasTokens&&l.jsxs("span",{className:"flex items-center gap-1 shrink-0",children:[l.jsx(Er,{className:"size-3 text-muted-foreground"}),l.jsxs("span",{className:"font-mono tabular-nums",children:[l.jsxs("span",{className:"text-blue-400",children:["IN ",Qe(S.totalInput)]})," / ",l.jsxs("span",{className:"text-amber-400",children:["OUT ",Qe(S.totalOutput)]})]})]}),l.jsx("span",{className:"flex-1 min-w-0"}),l.jsx(cn,{className:"size-4 text-muted-foreground shrink-0"})]})]}):t.map((U,L)=>{const{log:F,stopReason:q}=U,A=L===0;return l.jsxs("div",{className:"flex items-stretch",children:[A?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(S4,{stopReason:q,isPending:F.responseStatus===null,isFirst:L===0,isTurnStart:A,isOnlyEntry:g,crabIndex:F.id%12,collapsible:m&&A,onToggle:k}),l.jsxs("div",{className:ve("flex-1 min-w-0 mb-0.5 rounded-lg",z),children:[l.jsx(_4,{log:F,viewMode:n,strip:r,slowResponseThresholdSeconds:o,timeDisplayFormat:u,cacheTrend:s?.get(F.id)??null,onCompareWithPrevious:a.has(F.id)?i:void 0}),l.jsx(j4,{events:R.get(F.id)??[]})]})]},F.id)})})}),Ba=et(["episode","procedure","preference","project-fact"]),O4=et(["draft","promoted","failed"]),om=ae({source:je("agent-inspector"),sessionId:V(),logIds:Ce(ye().int().positive()),project:V().nullable(),models:Ce(V())}),M4=ae({redacted:nt(),patterns:Ce(V())}),$r=ae({id:V(),type:Ba,title:V(),content:V(),tags:Ce(V()),source:je("agent-inspector"),sessionId:V(),logIds:Ce(ye().int().positive()),evidence:om,status:O4,createdAt:V(),updatedAt:V(),openClawMemoryId:V().nullable(),error:V().nullable(),redaction:M4});ae({idempotencyKey:V(),type:Ba,title:V(),content:V(),tags:Ce(V()),source:je("agent-inspector"),project:V().nullable(),evidence:om});const D4=ae({id:V(),type:Ba.or(V()),title:V(),content:V(),score:ye().nullable(),source:V().nullable(),project:V().nullable(),evidence:Gs().optional()});ae({results:Ce(D4),warning:V().nullable()});const L4=ae({candidates:Ce($r)}),F4=ae({candidate:$r}),$4=ae({error:V().optional(),candidate:$r.optional()}),B4=ae({candidate:$r}),U4={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 zi(e){return e===null?"-":e<1e3?`${String(e)}ms`:`${(e/1e3).toFixed(1)}s`}function V4(e,t,n){return e===null||t===null?null:qi(e,t,n)}function H4(e){return`${String(e)} candidate${e===1?"":"s"}`}function sm(e){return`log-${String(e)}`}function im(e){const t=sm(e),n=document.getElementById(t);window.history.replaceState(null,"",`#${t}`),n instanceof HTMLElement&&(n.scrollIntoView({block:"center",behavior:"smooth"}),n.focus({preventScroll:!0}))}function Z4(e){for(const t of e)if(t.responseStatus!==null&&t.responseStatus>=400)return t;return null}function W4(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 q4(e){for(const t of e)if($a(t).length>0)return t;return null}function J4(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=q4(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=Z4(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=W4(e.logs);if(o!==null&&e.summary.maxElapsedMs!==null&&t.push({kind:"slow",title:`Slowest ${zi(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 K4(e){switch(e){case"session":return l.jsx(Vo,{className:"size-3.5 text-blue-400"});case"tool":return l.jsx(Rr,{className:"size-3.5 text-sky-400/70"});case"slow":return l.jsx(rn,{className:"size-3.5 text-amber-400"});case"failure":return l.jsx(ld,{className:"size-3.5 text-destructive"});case"candidate":return l.jsx(id,{className:"size-3.5 text-emerald-400"})}}function G4({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:ve("flex min-w-0 items-center gap-2 rounded-md px-2 py-1.5 text-left text-xs","text-muted-foreground transition-colors hover:bg-muted/40 hover:text-foreground","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring"),onClick:()=>{t.logId!==null&&im(t.logId)},disabled:t.logId===null,children:[K4(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 Y4(e){switch(e){case"draft":return"Draft";case"promoted":return"Promoted";case"failed":return"Failed"}}function X4(e,t){if(t)return"Promoting";switch(e.status){case"draft":return"Promote";case"failed":return"Retry";case"promoted":return"Promoted"}}function Q4(e){return e.redaction.redacted?`Redacted ${e.redaction.patterns.join(", ")}`:"No sensitive pattern matched"}function eA(e,t){const n=e.replace(/\s+/g," ").trim();return n.length<=t?n:`${n.slice(0,t-3)}...`}function tA(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 Gc(e){return e.join(", ")}function nA(e){return e.split(",").map(t=>t.trim()).filter(t=>t.length>0)}function rA({candidate:e,isPromoting:t,isUpdating:n,onPromoteCandidate:r,onUpdateCandidate:o}){const[s,i]=y.useState(!1),[a,c]=y.useState(e.type),[u,d]=y.useState(e.title),[f,p]=y.useState(e.content),[h,g]=y.useState(Gc(e.tags)),[m,x]=y.useState(null),b=e.status!=="promoted",v=e.status!=="promoted",k=y.useCallback(()=>{c(e.type),d(e.title),p(e.content),g(Gc(e.tags)),x(null)},[e.content,e.tags,e.title,e.type]),S=y.useCallback(async()=>{const C=u.trim(),E=f.trim(),N=nA(h);if(C.length===0){x("Title is required.");return}if(E.length===0){x("Content is required.");return}if(N.length===0){x("At least one tag is required.");return}x(null),await o(e.id,{type:a,title:C,content:E,tags:N})&&i(!1)},[e.id,f,h,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 E=$r.shape.type.safeParse(C.currentTarget.value);E.success&&c(E.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=>p(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:h,disabled:n,onChange:C=>g(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(ml,{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(Wi,{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(pl,{className:"size-3.5 animate-spin"}):l.jsx(iv,{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(St,{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(St,{variant:"outline",className:ve("h-5 shrink-0 px-1.5 text-[10px] font-mono",U4[e.status]),children:Y4(e.status)})]}),l.jsx("p",{className:"mt-1 text-[11px] leading-relaxed text-muted-foreground",title:e.content,children:eA(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(Eb,{className:"size-3"}),tA(e.logIds)]}),l.jsxs("span",{className:"inline-flex items-center gap-1",children:[l.jsx(ml,{className:"size-3"}),Q4(e)]}),e.status==="promoted"&&l.jsxs("span",{className:"inline-flex items-center gap-1 text-emerald-500",children:[l.jsx(hl,{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(ld,{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:`#${sm(C)}`,onClick:E=>{E.preventDefault(),im(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(dd,{className:"size-3"}),"Review"]}),l.jsxs(Re,{type:"button",variant:b?"outline":"ghost",size:"sm",className:"h-6 gap-1.5 px-2 text-[10px]",onClick:()=>r(e.id),disabled:!b||t||n,children:[t?l.jsx(pl,{className:"size-3 animate-spin"}):b?l.jsx(fb,{className:"size-3"}):l.jsx(hl,{className:"size-3"}),X4(e,t)]})]})]})}function oA({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(rA,{candidate:s,isPromoting:t.has(s.id),isUpdating:n.has(s.id),onPromoteCandidate:r,onUpdateCandidate:o},s.id))})}function sA({logs:e,scopeId:t,slowResponseThresholdSeconds:n,showRollupMetrics:r,timeDisplayFormat:o}){const[s,i]=y.useState([]),[a,c]=y.useState(!0),[u,d]=y.useState({status:"idle",error:null}),[f,p]=y.useState(()=>new Set),[h,g]=y.useState(()=>new Set),m=s.length>0,x=y.useMemo(()=>P4(e,n,s.length),[s.length,e,n]),b=y.useMemo(()=>J4({logs:e,scopeId:t,summary:x,candidates:s}),[s,e,t,x]),v=r||x.maxElapsedMs!==null,k=y.useMemo(()=>V4(x.startedAt,x.endedAt,o),[x.endedAt,x.startedAt,o]),S=y.useCallback(()=>{e.length===0||u.status==="loading"||(d({status:"loading",error:null}),(async()=>{try{const N=await fetch(`/api/knowledge/sessions/${encodeURIComponent(t)}/candidates`,{method:"POST"});if(!N.ok){const T=await gn(N,`Candidate generation failed with ${String(N.status)}`);d({status:"failed",error:T});return}const z=await Zt(N,L4);i(z.candidates),c(z.candidates.length>0),d(z.candidates.length>0?{status:"ready",error:null}:{status:"failed",error:"No candidate was generated for this trace scope."})}catch(N){d({status:"failed",error:N instanceof Error?N.message:"Candidate response was invalid"})}})())},[u.status,e.length,t]),C=y.useCallback(N=>{p(z=>{if(z.has(N))return z;const T=new Set(z);return T.add(N),T}),(async()=>{try{const z=await fetch(`/api/knowledge/candidates/${encodeURIComponent(N)}/promote`,{method:"POST"}),T=await z.json().catch(()=>null),R=F4.safeParse(T);if(z.ok&&R.success){i(j=>j.map(D=>D.id===R.data.candidate.id?R.data.candidate:D)),d({status:"ready",error:null});return}const $=$4.safeParse(T);$.success&&$.data.candidate!==void 0&&i(j=>j.map(D=>D.id===$.data.candidate?.id?$.data.candidate:D)),d({status:"failed",error:$.success?$.data.error??"Candidate promotion failed":`Candidate promotion failed with ${String(z.status)}`})}catch(z){d({status:"failed",error:z instanceof Error?z.message:"Candidate promotion failed"})}finally{p(z=>{const T=new Set(z);return T.delete(N),T})}})()},[]),E=y.useCallback(async(N,z)=>{g(T=>{if(T.has(N))return T;const R=new Set(T);return R.add(N),R});try{const T=await fetch(`/api/knowledge/candidates/${encodeURIComponent(N)}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify(z)});if(!T.ok){const $=await gn(T,`Candidate update failed with ${String(T.status)}`);return d({status:"failed",error:$}),!1}const R=await Zt(T,B4);return i($=>$.map(j=>j.id===R.candidate.id?R.candidate:j)),d({status:"ready",error:null}),!0}catch(T){return d({status:"failed",error:T instanceof Error?T.message:"Candidate update failed"}),!1}finally{g(T=>{const R=new Set(T);return R.delete(N),R})}},[]);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(Vo,{className:"size-3.5 text-blue-400"}),x.llmCallCount," LLM"]}),l.jsxs("span",{className:"inline-flex items-center gap-1.5 text-muted-foreground",children:[l.jsx(Rr,{className:"size-3.5 text-sky-400/70"}),x.toolCallCount," tools"]}),r&&l.jsxs("span",{className:"inline-flex items-center gap-1.5 text-muted-foreground",children:[l.jsx(Er,{className:"size-3.5 text-emerald-400"}),l.jsxs("span",{className:"font-mono",children:[Qe(x.totalInputTokens)," / ",Qe(x.totalOutputTokens)]})]}),(x.totalCacheCreationInputTokens>0||x.totalCacheReadInputTokens>0)&&l.jsxs("span",{className:"inline-flex items-center gap-1.5 text-muted-foreground",children:[l.jsx(Er,{className:"size-3.5 text-purple-400"}),l.jsxs("span",{className:"font-mono",children:["KV Cache +",Qe(x.totalCacheCreationInputTokens)," / ~",Qe(x.totalCacheReadInputTokens)]})]}),v&&l.jsxs("span",{className:"inline-flex items-center gap-1.5 text-muted-foreground",children:[l.jsx(rn,{className:"size-3.5"}),r&&l.jsx("span",{className:"font-mono",children:zi(x.totalElapsedMs)}),x.maxElapsedMs!==null&&l.jsxs("span",{className:"font-mono text-muted-foreground/70",children:["max ",zi(x.maxElapsedMs)]})]}),r&&k!==null&&l.jsx("span",{className:"font-mono text-muted-foreground/70",children:k}),(x.failedCallCount>0||x.pendingCallCount>0||x.slowCallCount>0)&&l.jsxs("span",{className:"inline-flex items-center gap-1.5 text-amber-400",children:[l.jsx(bo,{className:"size-3.5"}),l.jsxs("span",{className:"font-mono",children:[x.failedCallCount," fail / ",x.pendingCallCount," pending /"," ",x.slowCallCount," slow"]})]}),l.jsx("span",{className:"flex-1"}),m&&l.jsx(St,{variant:"outline",className:"h-6 px-2 text-[10px] font-mono",children:H4(x.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(jr,{className:"size-3.5 animate-spin"}):l.jsx(id,{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(Gt,{className:"size-3.5"}):l.jsx(cn,{className:"size-3.5"})})]}),u.status==="failed"&&l.jsx("p",{className:"mt-2 text-xs text-destructive",children:u.error}),l.jsx(G4,{insights:b}),a&&l.jsx(oA,{candidates:s,promotingCandidateIds:f,updatingCandidateIds:h,onPromoteCandidate:C,onUpdateCandidate:E})]})}function iA(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 aA=y.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}){const[f,p]=y.useState(!1),h=y.useMemo(()=>iA(e.logs),[e.logs]),g=e.logs[0]?.timestamp??new Date().toISOString(),m=e.logs[e.logs.length-1]?.timestamp??new Date().toISOString(),x=NC(e.logs),b=e.logs.some(S=>S.responseStatus===null),v=c&&!u,k=y.useMemo(()=>T4(e.logs),[e.logs]);return l.jsxs("div",{className:"mb-2",children:[!c&&l.jsx(jC,{conversationId:e.conversationId,startTime:g,endTime:m,totalCalls:e.logs.length,totalInputTokens:h.totalInputTokens,totalOutputTokens:h.totalOutputTokens,apiFormat:EC(e.logs),expanded:f,onToggle:()=>p(!f),hideApiFormat:x,isLoading:b,userAgent:e.logs[0]?.userAgent??null,timeDisplayFormat:d,onClear:()=>a(e.logs.map(S=>S.id))}),E4(c,f)&&l.jsxs("div",{children:[l.jsx(sA,{logs:e.logs,scopeId:e.conversationId,slowResponseThresholdSeconds:r,showRollupMetrics:v,timeDisplayFormat:d}),k.map(S=>l.jsx(R4,{entries:S.entries,viewMode:t,strip:n,slowResponseThresholdSeconds:r,timeDisplayFormat:d,cacheTrends:o,onCompareWithPrevious:s,comparisonPredecessors:i,turnIndex:S.turnIndex},S.turnIndex))]})]})});function lA({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:ve("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 cA="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 uA({className:e}){return l.jsx("img",{src:cA,alt:"Model Context Protocol","aria-hidden":"true",className:ve("inline-block size-8 object-contain invert",e)})}function Yc({...e}){return l.jsx(OS,{"data-slot":"select",...e})}function Xc({...e}){return l.jsx(DS,{"data-slot":"select-value",...e})}function Qc({className:e,size:t="default",children:n,...r}){return l.jsxs(MS,{"data-slot":"select-trigger","data-size":t,className:ve("border-input data-[placeholder]:text-muted-foreground [&_svg:not([class*='text-'])]:text-muted-foreground focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:bg-input/30 dark:hover:bg-input/50 flex w-fit items-center justify-between gap-2 rounded-md border bg-transparent px-3 py-2 text-sm whitespace-nowrap shadow-xs transition-[color,box-shadow] outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50 data-[size=default]:h-9 data-[size=sm]:h-8 *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-2 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",e),...r,children:[n,l.jsx(LS,{asChild:!0,children:l.jsx(Gt,{className:"size-4 opacity-50"})})]})}function eu({className:e,children:t,position:n="popper",align:r="center",...o}){return l.jsx(FS,{children:l.jsxs($S,{"data-slot":"select-content",className:ve("bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 relative z-50 max-h-(--radix-select-content-available-height) min-w-[8rem] origin-(--radix-select-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border shadow-md",n==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",e),position:n,align:r,...o,children:[l.jsx(dA,{}),l.jsx(BS,{className:ve("p-1",n==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)] scroll-my-1"),children:t}),l.jsx(fA,{})]})})}function oo({className:e,children:t,...n}){return l.jsxs(US,{"data-slot":"select-item",className:ve("focus:bg-accent focus:text-accent-foreground [&_svg:not([class*='text-'])]:text-muted-foreground relative flex w-full cursor-default items-center gap-2 rounded-sm py-1.5 pr-8 pl-2 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2",e),...n,children:[l.jsx("span",{className:"absolute right-2 flex size-3.5 items-center justify-center",children:l.jsx(HS,{children:l.jsx(ct,{className:"size-4"})})}),l.jsx(VS,{children:t})]})}function dA({className:e,...t}){return l.jsx(ZS,{"data-slot":"select-scroll-up-button",className:ve("flex cursor-default items-center justify-center py-1",e),...t,children:l.jsx(Qy,{className:"size-4"})})}function fA({className:e,...t}){return l.jsx(WS,{"data-slot":"select-scroll-down-button",className:ve("flex cursor-default items-center justify-center py-1",e),...t,children:l.jsx(Gt,{className:"size-4"})})}function hA(){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 pA(){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 mA(){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 gA=ae({name:V(),apiKey:V(),format:et(["anthropic","openai"]),anthropicBaseUrl:V(),openaiBaseUrl:V(),models:Ce(V()),sourceTool:et(["claude-code","opencode","mimo-code"]),alreadyExists:nt()}),xA=ae({providers:Ce(gA),warnings:Ce(V()).optional()}),yA=ae({success:nt().optional(),imported:ye().optional(),message:V().optional(),errors:Ce(V()).optional()}),bA={"claude-code":hA,opencode:pA,"mimo-code":mA};function vA({open:e,onOpenChange:t,onImportComplete:n}){const[r,o]=y.useState(!1),[s,i]=y.useState(null),[a,c]=y.useState([]),[u,d]=y.useState([]),[f,p]=y.useState(new Set),[h,g]=y.useState(!1),[m,x]=y.useState(null),[b,v]=y.useState(null),k=y.useCallback(()=>{o(!0),i(null),d([]),c([]),p(new Set),x(null),v(null),fetch("/api/providers/scan").then(N=>N.ok?N.json().then(z=>{const T=xA.safeParse(z);if(!T.success){i(`Invalid response: ${T.error.message}`);return}c(T.data.providers),d(T.data.warnings??[]);const R=new Set;T.data.providers.forEach(($,j)=>{$.alreadyExists||R.add(j)}),p(R)}):N.text().then(z=>{i(`Scan failed (${N.status}): ${z}`)})).catch(N=>{i(N instanceof Error?N.message:String(N))}).finally(()=>{o(!1)})},[]);y.useEffect(()=>{e&&k()},[e,k]);const S=y.useCallback(N=>{p(z=>{const T=new Set(z);return T.has(N)?T.delete(N):T.add(N),T})},[]),C=y.useCallback(()=>{const N=a.filter((R,$)=>f.has($));if(N.length===0)return;g(!0),v(null),x(null);const z=new Date().toISOString(),T=N.map(R=>({id:window.crypto.randomUUID(),name:R.name,apiKey:R.apiKey,format:R.format,anthropicBaseUrl:R.anthropicBaseUrl,openaiBaseUrl:R.openaiBaseUrl,models:R.models,createdAt:z,updatedAt:z}));fetch("/api/providers/import",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({providers:T})}).then(R=>R.json()).then(R=>{const $=yA.safeParse(R);if(!$.success){v(`Invalid response: ${$.error.message}`);return}const j=$.data;c(D=>D.map((w,M)=>f.has(M)?{...w,alreadyExists:!0}:w)),p(new Set),j.errors!==void 0&&j.errors.length>0&&j.message!==void 0?x(j.message):x(`Imported ${j.imported??N.length} provider(s)`),n()}).catch(R=>{v(R instanceof Error?R.message:String(R))}).finally(()=>{g(!1)})},[a,f,n]),E=a.some(N=>!N.alreadyExists);return l.jsx(ba,{open:e,onOpenChange:t,children:l.jsxs(va,{className:"max-w-xl max-h-[80vh] overflow-hidden flex flex-col",children:[l.jsxs(wa,{children:[l.jsx(ka,{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(jr,{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(Cr,{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,z)=>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(z),disabled:h,onChange:()=>S(z),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 T=bA[N.sourceTool];return T===void 0?null:l.jsx(T,{})})(),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,z)=>l.jsxs("div",{className:"flex items-center gap-1",children:[l.jsx(Cr,{className:"size-3"}),N]},z))}),m!==null&&l.jsx("div",{className:"text-sm text-green-500 border-t pt-2",children:m}),b!==null&&l.jsx("div",{className:"text-sm text-destructive border-t pt-2",children:b})]}),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(jr,{className:`size-3 mr-1 ${r?"animate-spin":""}`}),"Rescan"]}),l.jsxs(Re,{size:"sm",onClick:C,disabled:!E||f.size===0||h,children:[l.jsx(Vi,{className:"size-3 mr-1"}),h?"Importing...":`Import Selected (${f.size})`]})]})]})})}function am(e){return e.length<=8?"••••••••":e.slice(0,4)+"••••••••"+e.slice(-4)}const lm=ae({id:V().min(1),aliases:Ce(V()).optional().default([]),contextWindow:ye().int().positive().optional(),outputLimit:ye().int().positive().optional(),sourceUrl:V().optional()}),wA=ae({name:V().min(1).optional(),aliases:Ce(V()).optional().default([]),baseUrls:Ce(V()).optional().default([]),models:Ce(lm).min(1)});ae({version:ye().int().positive().optional(),updatedAt:V().optional(),providers:Ce(wA).optional().default([]),models:Ce(lm).optional().default([])});function tu(e){return e.trim().toLowerCase().replace(/\s+/g,"-")}function kA(e){const t=e.models.filter(n=>n.trim()!=="");return t.length>0?t:e.model!==void 0&&e.model.trim()!==""?[e.model]:[]}function Ua(e,t){const n=tu(t);return(e.modelMetadata??[]).find(o=>tu(o.model)===n)??null}function _A(e){const t=kA(e);return t.length===0?!1:t.every(n=>{const r=Ua(e,n);return r!==null&&r.contextWindow!==void 0})}function kz(e,t){if(e===null)return null;for(const n of t){const r=Ua(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 SA={deepseek:"https://api-docs.deepseek.com/zh-cn/"};function CA(e){return Object.prototype.hasOwnProperty.call(e,"success")}function jA(e){return Object.prototype.hasOwnProperty.call(e,"notConfigured")}function EA(e){const t={className:"size-3",strokeWidth:2};switch(e){case"timeout":return l.jsx(rn,{...t});case"network_unreachable":return l.jsx(Sv,{...t});case"connection_refused":return l.jsx(jv,{...t});case"auth_failed":return l.jsx(Bb,{...t});case"rate_limited":return l.jsx(Pb,{...t});case"server_error":return l.jsx(fv,{...t});case"invalid_response":return l.jsx(lb,{...t});case"unknown":return l.jsx(Cr,{...t});default:return l.jsx(Cr,{...t})}}function so({result:e}){const[t,n]=y.useState(!1);if(!CA(e))return jA(e)?l.jsxs("div",{className:"flex items-center gap-1 text-xs text-muted-foreground shrink-0",children:[l.jsx(Hb,{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(ei,{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($e,{children:[l.jsx(Be,{asChild:!0,children:l.jsxs("div",{className:"flex items-center gap-1 text-xs text-green-600 shrink-0",children:[l.jsx(sb,{className:"size-3"}),l.jsx("span",{children:"Connected"}),c.length>0&&l.jsxs("span",{className:"text-muted-foreground",children:["(",u,")"]})]})}),l.jsx(Ue,{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:[EA(a),l.jsx(Xe,{children:l.jsxs($e,{children:[l.jsx(Be,{asChild:!0,children:l.jsx("span",{className:"truncate",children:o})}),l.jsx(Ue,{children:"Connection test failed"})]})}),i!==void 0&&l.jsx(Xe,{children:l.jsxs($e,{children:[l.jsx(Be,{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(Hi,{className:"size-3"}):l.jsx(Zi,{className:"size-3"})})}),l.jsx(Ue,{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 NA(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 TA({provider:e,testResults:t,isTesting:n,testingTimeLeft:r,isHighlighted:o,onEdit:s,onDelete:i,onTest:a,onRefreshMetadata:c,isRefreshingMetadata:u=!1}){const[d,f]=y.useState(!1),[p,h]=y.useState(!1),[g,m]=y.useState(!1);function x(){navigator.clipboard.writeText(e.apiKey).catch(()=>{}),h(!0),setTimeout(()=>h(!1),2e3)}const b=e.apiDocsUrl??Object.entries(SA).find(([C])=>e.name.toLowerCase().includes(C))?.[1],v=_A(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($e,{children:[l.jsx(Be,{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(Ue,{children:"Company-provided API key"})]})}),e.source==="personal"&&l.jsx(Xe,{children:l.jsxs($e,{children:[l.jsx(Be,{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(Ue,{children:"Your personal API key"})]})})]}),b!==void 0&&l.jsxs("a",{href:b,target:"_blank",rel:"noopener noreferrer",className:"text-muted-foreground hover:text-foreground transition-colors flex items-center gap-1 text-xs",title:"View API documentation",children:[l.jsx(cd,{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 E=Ua(e,C);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}),E!==null&&E.contextWindow!==void 0&&l.jsx("span",{className:"font-mono text-foreground/80",children:Qe(E.contextWindow)})]},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(ei,{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:am(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(Hi,{className:"size-4"}):l.jsx(Zi,{className:"size-4"})}),l.jsx("button",{type:"button",onClick:x,className:"text-muted-foreground hover:text-foreground transition-colors p-1","aria-label":"Copy API key",children:p?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(so,{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(so,{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(rn,{className:"size-3"}),l.jsxs("span",{children:["Tested ",NA(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:g?"▾":"▸"}),"Model Test Results (",Object.keys(t.models).length,")"]}),g&&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,E])=>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(so,{result:E.anthropic.nonStreaming})}),e.openaiBaseUrl!==void 0&&e.openaiBaseUrl!==""&&l.jsx("td",{className:"py-1 px-2",children:l.jsx(so,{result:E.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(ei,{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(dd,{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(hd,{className:"size-3"}),"Delete"]})]})]})}const AA={deepseek:{format:"openai",baseUrl:"https://api.deepseek.com"},minimax:{format:"anthropic",baseUrl:"https://api.minimaxi.com/anthropic",apiDocsUrl:"https://platform.minimaxi.com/docs/api-reference/api-overview"},alibaba:{format:"openai",baseUrl:"https://dashscope.aliyuncs.com/compatible-mode"}},nu=["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"],ru=["glm-5","glm-5.1","qwen3.6-plus","qwen3.7-max"];function zA({provider:e,onSubmit:t,onCancel:n}){const[r,o]=y.useState(e?.name??""),[s,i]=y.useState(e?.apiKey??""),[a,c]=y.useState(!1),[u,d]=y.useState(!1),f=e?.models,[p,h]=y.useState(f!==void 0&&f.length>0?f:[""]),[g,m]=y.useState("anthropic"),[x,b]=y.useState(e?.anthropicBaseUrl??""),[v,k]=y.useState(e?.openaiBaseUrl??""),[S,C]=y.useState(e?.apiDocsUrl??""),[E,N]=y.useState(e?.modelMetadataUrl??""),[z,T]=y.useState(e?.source),[R,$]=y.useState({}),[j,D]=y.useState(!1),[w,M]=y.useState(null),U=y.useRef([]);y.useEffect(()=>{if(w===null)return;const ne=w;function de(fe){if(!(fe.target instanceof Node))return;const he=U.current[ne];he!=null&&!he.contains(fe.target)&&M(null)}return document.addEventListener("mousedown",de),()=>document.removeEventListener("mousedown",de)},[w]);const[L,F]=y.useState(!1),[q,A]=y.useState(!1),Z=r.toLowerCase().includes("minimax"),W=r.toLowerCase().includes("alibaba"),I=e?.modelMetadata?.some(ne=>ne.contextWindow!==void 0)??!1;function se(){navigator.clipboard.writeText(s).catch(()=>{}),d(!0),setTimeout(()=>d(!1),2e3)}y.useEffect(()=>{e&&(o(e.name),i(e.apiKey),h((e.models?.length??0)>0?e.models:[""]),b(e.anthropicBaseUrl??""),k(e.openaiBaseUrl??""),C(e.apiDocsUrl??""),N(e.modelMetadataUrl??""),T(e.source),F(!1),A(!1))},[e]),y.useEffect(()=>{const ne=r.toLowerCase();for(const[de,fe]of Object.entries(AA))if(ne.includes(de)){fe.format==="anthropic"&&!L?b(fe.baseUrl):fe.format==="openai"&&!q&&k(fe.baseUrl),fe.apiDocsUrl!==void 0&&!S&&C(fe.apiDocsUrl),de==="minimax"&&p.length===1&&p[0]===""&&h([nu[0]??""]),de==="alibaba"&&p.length===1&&p[0]===""&&h([ru[0]??""]);break}},[r]);function ee(){const ne={};return r.trim()||(ne.name="Name is required"),s.trim()||(ne.apiKey="API key is required"),(p.length===0||p.every(de=>!de.trim()))&&(ne.models="At least one model is required"),x.trim()&&!pe(x.trim())&&(ne.anthropicBaseUrl="Invalid URL format"),v.trim()&&!pe(v.trim())&&(ne.openaiBaseUrl="Invalid URL format"),E.trim()&&!pe(E.trim())&&(ne.modelMetadataUrl="Invalid URL format"),!x.trim()&&!v.trim()&&(ne.format="At least one format URL (Anthropic or OpenAI) is required"),$(ne),Object.keys(ne).length===0}function pe(ne){try{return new URL(ne),!0}catch{return!1}}function le(ne){if(ne.preventDefault(),!!ee()){D(!0);try{t({name:r.trim(),apiKey:s.trim(),models:p.map(de=>de.trim()).filter(de=>de!==""),anthropicBaseUrl:x.trim()||void 0,openaiBaseUrl:v.trim()||void 0,apiDocsUrl:S.trim()||void 0,modelMetadataUrl:E.trim()||void 0,source:z})}finally{D(!1)}}}return l.jsxs("form",{onSubmit:le,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:ne=>o(ne.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"}),R.name!==void 0&&l.jsx("p",{className:"text-xs text-destructive",children:R.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:z??"",onChange:ne=>T(ne.target.value==="company"||ne.target.value==="personal"?ne.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:E,onChange:ne=>N(ne.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"}),R.modelMetadataUrl!==void 0&&l.jsx("p",{className:"text-xs text-destructive",children:R.modelMetadataUrl}),E.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 and MiniMax M3/M2.7/M2.5/M2.1. Use a registry URL for private or custom model limits."}),e!==void 0&&!I&&E.trim()===""&&l.jsx("p",{className:"text-xs text-amber-400",children:"This provider has no matching context metadata yet."}),E.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:am(s),onChange:ne=>i(ne.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(ne=>!ne),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(Hi,{className:"size-4"}):l.jsx(Zi,{className:"size-4"})}),l.jsx("button",{type:"button",onClick:se,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"})})]}),R.apiKey!==void 0&&l.jsx("p",{className:"text-xs text-destructive",children:R.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:"*"})]}),p.map((ne,de)=>l.jsxs("div",{ref:fe=>{U.current[de]=fe},className:"flex items-center gap-2",children:[l.jsxs("div",{className:"relative flex-1",children:[l.jsx("input",{type:"text",value:ne,onChange:fe=>{h(he=>{const we=[...he];return we[de]=fe.target.value,we})},placeholder:Z||W?"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"}),(Z||W)&&l.jsxs(l.Fragment,{children:[l.jsx("button",{type:"button",onClick:()=>M(w===de?null:de),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(Gt,{className:"size-4"})}),w===de&&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:(Z?nu:ru).map(fe=>l.jsx("button",{type:"button",onClick:()=>{h(he=>{const we=[...he];return we[de]=fe,we}),M(null)},className:"w-full text-left px-3 py-2 text-sm hover:bg-muted transition-colors",children:fe},fe))})]})]}),p.length>1&&l.jsx("button",{type:"button",onClick:()=>h(fe=>fe.filter((he,we)=>we!==de)),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"})]})})]},de)),l.jsx("button",{type:"button",onClick:()=>h(ne=>[...ne,""]),className:"text-xs text-primary hover:underline flex items-center gap-1",children:"+ Add Model"}),R.models!==void 0&&l.jsx("p",{className:"text-xs text-destructive",children:R.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($e,{children:[l.jsx(Be,{asChild:!0,children:l.jsx("button",{type:"button",onClick:()=>m("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(Ue,{children:"Anthropic Messages API protocol"})]})}),l.jsx(Xe,{children:l.jsxs($e,{children:[l.jsx(Be,{asChild:!0,children:l.jsx("button",{type:"button",onClick:()=>m("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(Ue,{children:"OpenAI Chat Completions API protocol"})]})})]}),R.format!==void 0&&l.jsx("p",{className:"text-xs text-destructive",children:R.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:x,onChange:ne=>{F(!0),b(ne.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"}),R.anthropicBaseUrl!==void 0&&l.jsx("p",{className:"text-xs text-destructive",children:R.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:v,onChange:ne=>{A(!0),k(ne.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"}),R.openaiBaseUrl!==void 0&&l.jsx("p",{className:"text-xs text-destructive",children:R.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:S,onChange:ne=>C(ne.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:j,children:"Cancel"}),l.jsx(Re,{type:"submit",disabled:j,children:j?"Saving...":e?"Update Provider":"Add Provider"})]})]})}const IA=ae({model:V().min(1),contextWindow:ye().int().positive().optional(),outputLimit:ye().int().positive().optional(),source:et(["manual","registry"]).optional(),sourceUrl:V().optional(),updatedAt:V().optional()}),Oo=ae({id:V(),name:V(),apiKey:V(),model:V().optional(),models:Ce(V()).min(1),format:et(["anthropic","openai"]).optional(),baseUrl:V().optional(),anthropicBaseUrl:V().optional(),openaiBaseUrl:V().optional(),authHeader:et(["bearer","x-api-key"]).optional().default("bearer"),apiDocsUrl:V().optional(),modelMetadataUrl:V().optional(),modelMetadata:Ce(IA).optional(),source:et(["company","personal"]).optional(),createdAt:V(),updatedAt:V()}),PA=et(["timeout","network_unreachable","connection_refused","auth_failed","rate_limited","server_error","invalid_response","unknown"]),RA=ae({message:V(),type:PA,details:V().optional(),hint:V().optional()}),OA=ae({type:et(["text","thinking"]),text:V().optional(),thinking:V().optional()}),MA=ae({success:nt(),error:RA.optional(),model:V().optional(),inputTokens:ye().optional(),outputTokens:ye().optional(),cacheCreationInputTokens:ye().optional(),cacheReadInputTokens:ye().optional(),latencyMs:ye().optional(),content:Ce(OA).optional(),rawResponse:V().optional(),streaming:nt().optional(),streamingChunks:ae({chunks:Ce(nd),truncated:nt().default(!1)}).optional(),requestHeaders:Wt(V(),V()).optional()}),ou=Kt([MA,ae({notConfigured:je(!0)}),ae({testing:je(!0)})]),Mo=ae({nonStreaming:ou,streaming:ou}),DA=ae({anthropic:Mo,openai:Mo}),LA=ae({anthropic:Mo,openai:Mo,models:Wt(V(),DA).optional(),testedAt:V().optional()});function FA(){return{anthropic:{nonStreaming:{testing:!0},streaming:{testing:!0}},openai:{nonStreaming:{testing:!0},streaming:{testing:!0}}}}function su(e,t){const n=()=>({nonStreaming:{success:!1,error:{message:e,type:t}},streaming:{notConfigured:!0}});return{anthropic:n(),openai:n()}}const $A=ae({providerConfig:V()}),BA=ae({success:nt().optional(),imported:ye().optional(),message:V().optional(),errors:Ce(V()).optional()}),UA=ae({provider:Oo,imported:ye(),matchedModels:Ce(V()),missingModels:Ce(V()),sourceUrl:V()}),VA=30,io="Network error: could not reach the server. Is the proxy running?";function iu(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,source:e.source}}async function HA(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 ZA({externalProviders:e,isLoading:t=!1,externalTestResults:n,externalTestingProviders:r,externalTestingTimeLeft:o,onProvidersMutate:s,onTestResultsChange:i,onTestingProvidersChange:a,onTestingTimeLeftChange:c}){const[u,d]=y.useState(!1),[f,p]=y.useState(),[h,g]=y.useState(null),[m,x]=y.useState({}),[b,v]=y.useState(new Set),[k,S]=y.useState({}),[C,E]=y.useState(null),[N,z]=y.useState(!1),[T,R]=y.useState(null),[$,j]=y.useState(!1),[D,w]=y.useState(!1),[M,U]=y.useState(null),[L,F]=y.useState("all"),[q,A]=y.useState(new Set),Z=y.useRef(null),W=y.useRef(null),I=e??[],se=y.useMemo(()=>{const J=L==="all"?I:I.filter(re=>re.source===L);return L==="all"?[...J].sort((re,te)=>{const B={personal:0,company:1};return(B[re.source??""]??2)-(B[te.source??""]??2)}):J},[I,L]),ee=n??m,pe=r??b,le=o??k,ne=c?(J,re)=>c(J,re):(J,re)=>{S(re===void 0?te=>{const B={...te};return delete B[J],B}:te=>({...te,[J]:re}))};y.useEffect(()=>{(async()=>{try{const J=await fetch("/api/config/paths");if(J.ok){const re=await Zt(J,$A);E(re.providerConfig)}}catch{}})()},[]);const de=y.useCallback(J=>{W.current!==null&&clearTimeout(W.current),R(J),Z.current?.scrollTo({top:Z.current.scrollHeight,behavior:"smooth"}),W.current=setTimeout(()=>{R(null),W.current=null},2e3)},[]);y.useEffect(()=>()=>{W.current!==null&&clearTimeout(W.current)},[]);const fe=y.useCallback(()=>{s?.().catch(()=>{})},[s]),he=y.useCallback((J,re)=>{i?i(J,re):x(te=>({...te,[J]:re}))},[i]),we=y.useCallback((J,re)=>{if(a){a(J,re);return}v(te=>{const B=new Set(te);return re?B.add(J):B.delete(J),B})},[a]),Me=y.useCallback(async J=>{he(J,FA()),we(J,!0);const re=new AbortController;let te=VA;ne(J,te);const B=setInterval(()=>{te--,ne(J,te),te<=0&&(clearInterval(B),re.abort())},1e3);try{const Y=await fetch(`/api/providers/${J}/test`,{method:"POST",signal:re.signal});if(Y.ok){const ce=await Zt(Y,LA);he(J,ce),await HA(J,ce)}else he(J,su(`HTTP ${Y.status}: ${Y.statusText}`,"server_error"))}catch(Y){Y instanceof Error&&Y.name==="AbortError"&&he(J,su("Request timed out","timeout"))}finally{clearInterval(B),ne(J,void 0),we(J,!1)}},[ne,he,we]),_=y.useCallback(async(J,re,te=!0)=>{A(B=>{const Y=new Set(B);return Y.add(J),Y});try{const B=re!==void 0&&re.trim()!==""?{url:re}:{},Y=await fetch(`/api/providers/${J}/model-metadata`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(B)});if(!Y.ok)return te&&g(await gn(Y,"Failed to refresh model metadata")),!1;const ce=await Zt(Y,UA);return ce.imported===0&&te?g("No matching model metadata found for this provider."):g(null),de(ce.provider.id),fe(),ce.imported>0}catch{return te&&g(io),!1}finally{A(B=>{const Y=new Set(B);return Y.delete(J),Y})}},[fe,de]);function Q(J){(async()=>{try{const re=await fetch("/api/providers",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(iu(J))});if(!re.ok){g(await gn(re,"Failed to add provider"));return}const te=await Zt(re,Oo);d(!1),de(te.id),J.modelMetadataUrl!==void 0&&J.modelMetadataUrl.trim()!==""&&await _(te.id,J.modelMetadataUrl,!1),fe(),await Me(te.id)}catch{g(io)}})()}function G(J){f&&(async()=>{try{const re=await fetch(`/api/providers/${f.id}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(iu(J))});if(!re.ok){g(await gn(re,"Failed to update provider"));return}const te=await Zt(re,Oo);p(void 0),de(te.id),J.modelMetadataUrl!==void 0&&J.modelMetadataUrl.trim()!==""&&await _(te.id,J.modelMetadataUrl,!1),fe(),((J.apiKey??"")!==(f.apiKey??"")||JSON.stringify(J.models)!==JSON.stringify(f.models)||(J.anthropicBaseUrl??"")!==(f.anthropicBaseUrl??"")||(J.openaiBaseUrl??"")!==(f.openaiBaseUrl??""))&&await Me(te.id)}catch{g(io)}})()}function O(J){U(J),w(!0)}function P(){const J=M;J!==null&&(async()=>{let re;try{re=await fetch(`/api/providers/${J}`,{method:"DELETE"})}catch{g(io);return}if(!re.ok){g(await gn(re,"Failed to delete provider"));return}fe()})()}const H=y.useRef(null);function oe(J){const re="/api/providers/export";(async()=>{try{const te=await fetch(re);if(!te.ok){g("Failed to export providers");return}const B=await te.blob(),Y=URL.createObjectURL(B),ce=document.createElement("a");ce.href=Y,ce.download=te.headers.get("Content-Disposition")?.match(/filename="(.+)"/)?.[1]??"providers.json",document.body.appendChild(ce),ce.click(),document.body.removeChild(ce),URL.revokeObjectURL(Y)}catch{g("Failed to export providers")}})()}function ie(){H.current?.click()}function K(J){const re=J.target.files?.[0];re&&(async()=>{try{const te=await re.text(),B=await fetch("/api/providers/import",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(te)}),Y=await Zt(B,BA);B.ok&&Y.imported!==void 0&&Y.imported>0?(fe(),g(null)):Y.errors&&Y.errors.length>0?g(Y.errors.join("; ")):g(Y.message??"Import failed")}catch{g("Failed to import providers")}J.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(zA,{provider:f,onSubmit:f?G:Q,onCancel:()=>{d(!1),p(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($e,{children:[l.jsx(Be,{asChild:!0,children:l.jsxs(Re,{variant:"outline",size:"sm",onClick:()=>oe(),className:"gap-1 hover:bg-muted",children:[l.jsx(Vi,{className:"size-3"}),"Export"]})}),l.jsx(Ue,{children:"Download providers as JSON for backup or sharing"})]})}),l.jsx(Xe,{children:l.jsxs($e,{children:[l.jsx(Be,{asChild:!0,children:l.jsxs(Re,{variant:"outline",size:"sm",onClick:ie,className:"gap-1 hover:bg-muted",children:[l.jsx(vv,{className:"size-3"}),"Import"]})}),l.jsx(Ue,{children:"Import providers from an exported JSON file"})]})}),l.jsx("input",{type:"file",ref:H,accept:".json",onChange:K,style:{display:"none"}}),l.jsx(Xe,{children:l.jsxs($e,{children:[l.jsx(Be,{asChild:!0,children:l.jsxs(Re,{variant:"outline",size:"sm",onClick:()=>j(!0),className:"gap-1",children:[l.jsx(lv,{className:"size-3"}),"Scan"]})}),l.jsx(Ue,{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(Qs,{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($e,{children:[l.jsx(Be,{asChild:!0,children:l.jsx("button",{type:"button",onClick:()=>{window.navigator.clipboard.writeText(C).then(()=>{z(!0),setTimeout(()=>z(!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(Ue,{children:"Copy config file path to clipboard"})]})})]}),h!==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(Cr,{className:"size-4 shrink-0"}),h]}),I.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(Qs,{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(J=>l.jsx(Xe,{children:l.jsxs($e,{children:[l.jsx(Be,{asChild:!0,children:l.jsx("button",{type:"button",onClick:()=>F(J),className:`px-3 py-2 text-sm font-medium border-b-2 transition-colors ${L===J?"border-primary text-primary":"border-transparent text-muted-foreground hover:text-foreground"}`,children:J==="all"?"All":J==="personal"?"Personal":"Company"})}),l.jsx(Ue,{children:J==="all"?"Show all providers":J==="personal"?"Providers you configured yourself":"Providers set by your organization"})]})},J))}),l.jsx("div",{ref:Z,className:"space-y-3",children:se.map(J=>l.jsx(TA,{provider:J,testResults:ee[J.id],isTesting:pe.has(J.id),testingTimeLeft:le[J.id],isHighlighted:J.id===T,onEdit:re=>p(re),onDelete:O,onRefreshMetadata:re=>{_(re)},isRefreshingMetadata:q.has(J.id),onTest:re=>{Me(re)}},J.id))})]}),l.jsx(vA,{open:$,onOpenChange:j,onImportComplete:()=>{s!==void 0&&s()}}),l.jsx(qh,{open:D,onOpenChange:w,title:"Delete Provider",description:"Are you sure you want to delete this provider? This action cannot be undone.",confirmLabel:"Delete",variant:"destructive",onConfirm:P})]})}async function WA(e){return Pr(e,Oo.array(),void 0,t=>`Failed to fetch ${e}: ${t.status}`)}function qA(){const e=Ii("/api/providers",WA,{revalidateOnFocus:!1,revalidateIfStale:!1});return{providers:e.data??[],isLoading:e.isLoading,isError:e.error,mutate:e.mutate}}function JA(){const[e,t]=y.useState(!1),[n,r]=y.useState("providers"),{providers:o,isLoading:s,mutate:i}=qA(),[a,c]=y.useState({}),[u,d]=y.useState(new Set),[f,p]=y.useState({}),h=y.useCallback((x,b)=>{c(v=>({...v,[x]:b}))},[]),g=y.useCallback((x,b)=>{d(v=>{const k=new Set(v);return b?k.add(x):k.delete(x),k})},[]),m=y.useCallback((x,b)=>{p(v=>{if(b===void 0){const k={...v};return delete k[x],k}return{...v,[x]:b}})},[]);return l.jsxs(ba,{open:e,onOpenChange:t,children:[l.jsx(wC,{asChild:!0,children:l.jsxs(Re,{variant:"ghost",size:"icon",className:"size-8",children:[l.jsx(pv,{className:"size-4"}),l.jsx("span",{className:"sr-only",children:"Settings"})]})}),l.jsxs(va,{className:"max-w-2xl max-h-[80vh] overflow-hidden flex flex-col",children:[l.jsx(wa,{children:l.jsx(ka,{children:"Settings"})}),l.jsxs(ep,{value:n,onValueChange:r,className:"flex-1 overflow-hidden",children:[l.jsxs(tp,{children:[l.jsx(At,{value:"providers",children:"Providers"}),l.jsx(At,{value:"proxy",children:"Proxy"}),l.jsx(At,{value:"onboarding",children:"Onboarding"})]}),l.jsxs("div",{className:"mt-4 overflow-y-auto flex-1 pr-3",children:[l.jsx(zt,{value:"providers",children:l.jsx(ZA,{externalProviders:o,isLoading:s,externalTestResults:a,externalTestingProviders:u,externalTestingTimeLeft:f,onProvidersMutate:()=>i(),onTestResultsChange:h,onTestingProvidersChange:g,onTestingTimeLeftChange:m})}),l.jsx(zt,{value:"proxy",children:l.jsx(YA,{})}),l.jsx(zt,{value:"onboarding",children:l.jsx(GA,{})})]})]})]})]})}function KA({id:e,label:t,value:n,copiedId:r,onCopy:o}){const s=r===e;return l.jsxs("div",{className:"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 GA(){const[e,t]=y.useState(null),n=y.useMemo(()=>typeof window>"u"?"http://localhost:25947":window.location.origin,[]),r=y.useMemo(()=>[{id:"skill",label:"Codex skill",value:"agent-inspector onboard --force"},{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`}],[n]),o=y.useCallback((s,i)=>{window.navigator.clipboard.writeText(i).then(()=>{t(s),setTimeout(()=>t(null),1600)})},[]);return l.jsxs("div",{className:"space-y-4",children:[l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx(fd,{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(KA,{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 YA(){const{strip:e,slowResponseThresholdSeconds:t,timeDisplayFormat:n,isLoading:r,setStrip:o,setSlowResponseThresholdSeconds:s,setTimeDisplayFormat:i}=od(),[a,c]=y.useState(null),[u,d]=y.useState(!1),f=y.useCallback(async g=>{c(null),d(!0);try{await o(g)}catch(m){c(m instanceof Error?m.message:String(m))}finally{d(!1)}},[o]),p=y.useCallback(async g=>{c(null),d(!0);try{await s(g)}catch(m){c(m instanceof Error?m.message:String(m))}finally{d(!1)}},[s]),h=y.useCallback(async g=>{c(null),d(!0);try{await i(g)}catch(m){c(m instanceof Error?m.message:String(m))}finally{d(!1)}},[i]);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:"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:r||u,onChange:g=>{f(g.currentTarget.checked)},className:"size-4 cursor-pointer disabled:cursor-not-allowed disabled:opacity-50"}),l.jsx("span",{className:"text-sm",children:r?"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:Xs,step:1,value:t,disabled:r||u,onChange:g=>{const m=Number(g.currentTarget.value);Number.isInteger(m)&&(m<0||m>Xs||p(m))},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:n,disabled:r||u,onChange:g=>{const m=rd.safeParse(g.currentTarget.value);m.success&&h(m.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"})]})]}),a!==null&&l.jsxs("p",{className:"text-xs text-destructive",children:["Failed to save: ",a]})]})}function XA(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:au(s.cacheCreationInputTokens,i.cacheCreationInputTokens),read:au(s.cacheReadInputTokens,i.cacheReadInputTokens)})}}return t}function au(e,t){return t===null||e===null?null:t>e?{direction:"up",delta:t-e}:t<e?{direction:"down",delta:e-t}:null}const Do="data-nav-id",QA="data-nav-action";function lu(e){return Array.from(e.querySelectorAll(`[${Do}]`))}function cu(e){return e instanceof HTMLElement}function ez(e,t){let n=e;for(;n!==null&&n!==t;){if(n.hasAttribute(Do))return n;n=n.parentElement}return e.hasAttribute(Do)?e:null}function Ws(e){const t=e.getAttribute(QA);return t==="toggle"||t==="expand"||t==="collapse"?t:null}function pr(e){e.focus({preventScroll:!0}),e.scrollIntoView({block:"nearest",behavior:"smooth"})}function mr(e,t){return e[t]??null}function cm(e){const t=e.tagName;return!!(t==="INPUT"||t==="TEXTAREA"||t==="SELECT"||e.isContentEditable)}function uu(e){const t=e.tagName;return t==="BUTTON"||t==="A"||cm(e)?!0:e.closest("[role='button'],[role='menuitem'],[role='option']")!==null}function tz(e){return e.closest("[role='dialog'],[role='menu'],[role='listbox']")!==null?!0:document.querySelector("[role='dialog'],[role='menu'],[role='listbox']")!==null}function nz(){const e=window.getSelection();return e===null?!1:e.type==="Range"&&e.toString().length>0}function ao(e,t){return e.key===t&&e.shiftKey}function rz(e,t,n={}){const r=t??e,o=n.pageWide===!0,s=y.useCallback(i=>{const a=e.current,c=r.current;if(!a||!c)return;const u=i.target;if(!cu(u)||u!==c)return;const d=lu(a),f=mr(d,0);f!==null&&pr(f)},[e,r]);y.useEffect(()=>{const i=a=>{if(a.altKey||a.ctrlKey||a.metaKey)return;const c=e.current;if(!c)return;const u=a.target;if(!cu(u)||cm(u)||nz())return;const d=c.contains(u);if(d&&uu(u)&&!u.hasAttribute(Do)||!d&&(!o||uu(u)||tz(u)))return;const f=lu(c);if(f.length===0)return;const p=ez(u,c),h=p!==null?f.indexOf(p):-1;let g=!1;switch(a.key){case"ArrowUp":case"W":{if(a.shiftKey&&a.key==="ArrowUp"||a.key==="W"&&!ao(a,"W"))break;a.preventDefault();const m=h>0?h-1:h===-1?f.length-1:-1;if(m!==-1){const x=mr(f,m);x!==null&&pr(x)}g=!0;break}case"ArrowDown":case"S":{if(a.shiftKey&&a.key==="ArrowDown"||a.key==="S"&&!ao(a,"S"))break;a.preventDefault();const m=h<f.length-1?h+1:h===-1?0:-1;if(m!==-1){const x=mr(f,m);x!==null&&pr(x)}g=!0;break}case"ArrowLeft":case"A":{if(a.shiftKey&&a.key==="ArrowLeft"||a.key==="A"&&!ao(a,"A")||p===null)break;if(a.preventDefault(),Ws(p)==="collapse")p.click();else if(h>0){const x=mr(f,h-1);x!==null&&pr(x)}g=!0;break}case"ArrowRight":case"D":{if(a.shiftKey&&a.key==="ArrowRight"||a.key==="D"&&!ao(a,"D")||p===null)break;if(a.preventDefault(),Ws(p)==="expand")p.click();else if(h<f.length-1){const x=mr(f,h+1);x!==null&&pr(x)}g=!0;break}case" ":{if(p===null)break;a.preventDefault(),Ws(p)!==null&&p.click(),g=!0;break}}g&&a.stopPropagation()};return document.addEventListener("keydown",i,{capture:!0}),()=>document.removeEventListener("keydown",i,{capture:!0})},[e,o,r]),y.useEffect(()=>(document.addEventListener("focusin",s),()=>document.removeEventListener("focusin",s)),[s])}function ho(e){return e.length<=30?e:e.slice(0,12)+"…"+e.slice(-12)}function oz(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 sz(e,t){const n=e[0],r=e[e.length-1];return n===void 0||r===void 0?null:qi(n.timestamp,r.timestamp,t)}function iz(e){for(const t of e)if(t.userAgent!==null&&t.userAgent!==void 0&&t.userAgent!=="")return t.userAgent;return null}function az({command:e}){const[t,n]=y.useState(!1),r=y.useCallback(()=>{window.navigator.clipboard.writeText(e).then(()=>{n(!0),setTimeout(()=>n(!1),2e3)})},[e]);return 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 lz(){return l.jsx(Xe,{children:l.jsxs($e,{children:[l.jsx(Be,{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(Ue,{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 cz({sessionId:e,logs:t,totalIn:n,totalOut:r,timeDisplayFormat:o}){const[s,i]=y.useState(!1),a=y.useMemo(()=>sz(t,o),[t,o]),c=y.useMemo(()=>iz(t),[t]),u=y.useCallback(()=>{window.navigator.clipboard.writeText(window.location.href).then(()=>{i(!0),setTimeout(()=>i(!1),2e3)})},[]);return l.jsxs("div",{className:"mb-4 flex items-center gap-3 border border-border rounded-md bg-muted/20 px-3 py-2 text-xs",children:[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(Vy,{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:ho(e)}),c!==null&&l.jsx("span",{className:"font-mono text-muted-foreground truncate max-w-[220px]",title:c,children:c})]}),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":""]}),a!==null&&l.jsx("span",{children:a}),(n>0||r>0)&&l.jsxs("span",{className:"font-mono",children:[Qe(n)," in / ",Qe(r)," out"]})]})]}),l.jsx("button",{type:"button",onClick:u,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":s?"Copied session link":"Copy session link",title:s?"Copied session link":"Copy session link",children:s?l.jsx(ct,{className:"size-3.5"}):l.jsx(Ft,{className:"size-3.5"})})]})}function uz({logs:e,sessions:t,models:n,selectedSession:r,selectedModel:o,onSessionChange:s,onModelChange:i,onClearAll:a,onClearGroup:c,viewMode:u,onViewModeChange:d,strip:f,slowResponseThresholdSeconds:p,timeDisplayFormat:h,hideSessionFilter:g=!1,pinnedSessionId:m}){const{totalIn:x,totalOut:b}=y.useMemo(()=>oz(e),[e]),[v,k]=y.useState(!1),[S,C]=y.useState(null),[E,N]=y.useState("hidden"),z=y.useRef(null),T=y.useRef(null);rz(z,T,{pageWide:!0}),y.useEffect(()=>{const q=50+Ar.length*400,A=setTimeout(()=>N("playing"),50),Z=setTimeout(()=>N("done"),q);return()=>{clearTimeout(A),clearTimeout(Z)}},[]),y.useEffect(()=>{if(m===void 0){document.title="Agent Inspector";return}const L=e.length===1?"1 req":`${e.length} req`;document.title=`${ho(m)} - ${L} - Agent Inspector`},[e.length,m]);const R=y.useCallback(async()=>{k(!0);try{await Lv(e)}finally{k(!1)}},[e]);y.useEffect(()=>{C(null)},[r,o]);const $=y.useCallback(()=>{C(null)},[]),j=y.useMemo(()=>AC(e),[e]),D=m!==void 0,w=y.useMemo(()=>XA(j),[j]),M=y.useMemo(()=>A4(j),[j]),U=y.useCallback(L=>{const F=M.get(L.id);F!==void 0&&C([F,L])},[M]);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(lA,{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:Ar.map((L,F)=>{const q=["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"][F],A=E==="hidden"?"opacity-0 scale-0":E==="playing"?"animate-crab-piano-pop":"";return l.jsx(L,{className:`size-5 ${q} transition-all duration-300 ease-out group-hover:scale-125 group-hover:-translate-y-1 ${A}`,style:{transitionDelay:`${F*50}ms`,...E==="playing"?{animationDelay:`${F*400}ms`}:{}}},F)})})]}),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",T2.version]})]}),l.jsx(Qs,{className:"size-4 shrink-0 text-muted-foreground/70","aria-hidden":"true"}),l.jsx(uA,{className:"size-10 shrink-0"})]}),l.jsx(lz,{})]}),l.jsx("div",{className:"justify-self-end",children:l.jsx(JA,{})})]}),m!==void 0&&l.jsx(cz,{sessionId:m,logs:e,totalIn:x,totalOut:b,timeDisplayFormat:h}),l.jsxs("div",{className:"flex items-center gap-3 mb-4",children:[!g&&l.jsxs(Yc,{value:r,onValueChange:s,children:[l.jsx(Qc,{className:"flex-1 max-w-[350px] text-xs",children:l.jsx(Xc,{placeholder:"All sessions"})}),l.jsxs(eu,{children:[l.jsx(oo,{value:"__all__",children:"All sessions"}),t.map(L=>l.jsx(oo,{value:L,children:ho(L)},L))]})]}),l.jsxs(Yc,{value:o,onValueChange:i,children:[l.jsx(Qc,{className:"flex-1 max-w-[250px] text-xs",children:l.jsx(Xc,{placeholder:"All models"})}),l.jsxs(eu,{children:[l.jsx(oo,{value:"__all__",children:"All models"}),n.map(L=>l.jsx(oo,{value:L,children:L},L))]})]}),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-1"}),!D&&l.jsxs("span",{className:"text-muted-foreground text-xs font-mono",children:[e.length," request",e.length!==1?"s":"",x>0||b>0?` · ${Qe(x)} in / ${Qe(b)} out`:""]}),e.length>0&&l.jsx("button",{type:"button",onClick:()=>{R()},disabled:v,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 all logs as JSON ZIP",children:v?l.jsx("span",{children:"Exporting..."}):l.jsxs(l.Fragment,{children:[l.jsx(Vi,{className:"size-3.5"}),l.jsx("span",{children:"Export"})]})}),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:ho(r)}),l.jsxs("p",{className:"text-xs",children:["This session may have been cleared or never existed."," ",g?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.jsx(az,{command:"LLM_BASE_URL=http://localhost:25947/proxy <your-tool>"})]}):l.jsx("div",{ref:T,tabIndex:0,className:"flex flex-col gap-2 focus:outline-none",children:l.jsx("div",{ref:z,children:j.map(L=>l.jsx(aA,{group:L,viewMode:u,strip:f,slowResponseThresholdSeconds:p,cacheTrends:w,onCompareWithPrevious:U,comparisonPredecessors:M,onClearGroup:c,standalone:j.length===1,hasPinnedSessionContext:D,timeDisplayFormat:h},L.id))})})}),S!==null&&l.jsx(y.Suspense,{fallback:null,children:l.jsx(h5,{left:S[0],right:S[1],onClose:$})})]})}const dz=Kt([ae({type:je("init"),logs:Ce(dl)}),ae({type:je("update"),log:dl})]);function fz(e){const t=new Set;for(const n of e)n.sessionId!==null&&n.sessionId!==""&&t.add(n.sessionId);return[...t]}function hz(e){const t=new Set;for(const n of e)n.model!==null&&n.model!==""&&t.add(n.model);return[...t]}function pz(e,t,n){return t==="__all__"&&n==="__all__"?e:e.filter(r=>!(t!=="__all__"&&r.sessionId!==t||n!=="__all__"&&r.model!==n))}const mz=50,gz=12,xz=1800;function yz(e){return e===void 0?"/api/logs/stream":`/api/logs/stream?${new URLSearchParams({sessionId:e}).toString()}`}function _z({initialSessionId:e}={}){const[t,n]=y.useState([]),[r,o]=y.useState(e??"__all__"),[s,i]=y.useState("__all__"),[a,c]=y.useState("simple"),[u,d]=y.useState(null),f=y.useRef(null),p=y.useRef(null),h=y.useRef(null),g=y.useRef(new Map),m=y.useRef([]),x=y.useRef(null),b=y.useMemo(()=>pz(t,r,s),[t,r,s]),v=y.useMemo(()=>fz(t),[t]),k=y.useMemo(()=>hz(t),[t]),S=y.useCallback(()=>{x.current=null;const j=m.current;m.current=[],j.length!==0&&n(D=>{let w=D;for(const M of j){const U=g.current.get(M.id);U!==void 0?w=[...w.slice(0,U),M,...w.slice(U+1)]:(g.current.set(M.id,w.length),w=[...w,M])}return w})},[]),C=y.useCallback(j=>{m.current.push(j),x.current===null&&(x.current=setTimeout(S,mz))},[S]),E=y.useCallback(()=>{f.current&&f.current.close();const j=new EventSource(yz(e));f.current=j,j.onmessage=D=>{try{const w=String(D.data),M=JSON.parse(w),U=dz.safeParse(M);if(!U.success){d("Failed to parse SSE data");return}const L=U.data;if(L.type==="init"){x.current!==null&&(clearTimeout(x.current),x.current=null),m.current=[];const F=new Map;for(let q=0;q<L.logs.length;q++){const A=L.logs[q];A!==void 0&&F.set(A.id,q)}g.current=F,n(L.logs),d(null)}else L.type==="update"&&C(L.log)}catch{d("Failed to parse SSE data")}},j.onerror=()=>{d("SSE connection lost, reconnecting..."),j.close(),p.current!==null&&clearTimeout(p.current),p.current=setTimeout(E,3e3)}},[e,C]);y.useEffect(()=>(E(),()=>{f.current&&(f.current.close(),f.current=null),p.current!==null&&(clearTimeout(p.current),p.current=null),x.current!==null&&(clearTimeout(x.current),x.current=null)}),[E]),y.useEffect(()=>{const j=window.location.hash;if(!j.startsWith("#log-")||h.current===j)return;const D=j.slice(1);let w=!1,M=0,U=null,L=null;const F=()=>{if(w)return;const q=document.getElementById(D);if(q!==null){h.current=j,q.scrollIntoView({block:"center",behavior:"smooth"}),q instanceof HTMLElement&&(U=q,q.setAttribute("data-deep-link-highlight","true"),L=window.setTimeout(()=>{q.removeAttribute("data-deep-link-highlight")},xz),q.focus({preventScroll:!0}),q.getAttribute("data-nav-action")==="expand"&&q.click());return}M+=1,M<gz&&window.setTimeout(F,100)};return F(),()=>{w=!0,L!==null&&window.clearTimeout(L),U!==null&&U.removeAttribute("data-deep-link-highlight")}},[b.length]);const N=y.useCallback(()=>{e!==void 0&&t.length===0||(async()=>{try{const j=e===void 0?void 0:JSON.stringify({ids:t.map(w=>w.id)});if(!(await fetch("/api/logs",{method:"DELETE",...j===void 0?{}:{headers:{"Content-Type":"application/json"},body:j}})).ok){d("Failed to clear logs");return}g.current.clear(),n([]),d(null)}catch(j){d(j instanceof Error?j.message:"Unknown error clearing logs")}})()},[t,e]),z=y.useCallback(j=>{j.length!==0&&(async()=>{try{if(!(await fetch("/api/logs",{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({ids:j})})).ok){d("Failed to clear group");return}const w=new Set(j);n(M=>{const U=M.filter(F=>!w.has(F.id)),L=new Map;for(let F=0;F<U.length;F++){const q=U[F];q!==void 0&&L.set(q.id,F)}return g.current=L,U}),d(null)}catch(D){d(D instanceof Error?D.message:"Unknown error clearing group")}})()},[]),{strip:T,slowResponseThresholdSeconds:R,timeDisplayFormat:$}=od();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(Pv,{}),l.jsx(uz,{logs:b,sessions:v,models:k,selectedSession:r,selectedModel:s,onSessionChange:o,onModelChange:i,onClearAll:N,onClearGroup:z,viewMode:a,onViewModeChange:c,strip:T,slowResponseThresholdSeconds:R,timeDisplayFormat:$,hideSessionFilter:e!==void 0,pinnedSessionId:e})]})}export{Er as $,ye as A,St as B,gb as C,ba as D,V as E,De as F,kz as G,Zu as H,Gp as I,CT as J,Kp as K,Ne as L,Hb as M,Hc as N,ej as O,_z as P,wz as Q,ov as R,id as S,ep as T,Gt as U,tj as V,jT as W,Wi as X,fd as Y,Da as Z,Ao as _,TC as a,bo as a0,E2 as a1,jr as a2,ve as b,xe as c,Qs as d,dd as e,Qe as f,c4 as g,cn as h,ct as i,Ft as j,va as k,wa as l,ka as m,tv as n,tp as o,At as p,zt as q,Ro as r,Xe as s,$e as t,qA as u,Be as v,Ue as w,Re as x,ae as y,nt as z};
|