@tonyclaw/agent-inspector 2.0.4 → 2.0.5
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-BCH_fsLm.js → CompareDrawer-3nRwtk8J.js} +1 -1
- package/.output/public/assets/ProxyViewerContainer-CbW5VRER.js +101 -0
- package/.output/public/assets/ReplayDialog-Cl62N9PI.js +1 -0
- package/.output/public/assets/{RequestAnatomy-DZ8grAih.js → RequestAnatomy-DgQWGvjs.js} +1 -1
- package/.output/public/assets/ResponseView-Cvc-ct4E.js +1 -0
- package/.output/public/assets/StreamingChunkSequence-BCQaCAIe.js +1 -0
- package/.output/public/assets/_sessionId-CcD_aLGq.js +1 -0
- package/.output/public/assets/index-B_dffD3u.js +1 -0
- package/.output/public/assets/index-CX796gvi.css +1 -0
- package/.output/public/assets/{json-viewer-BrzjD7qI.js → json-viewer-IXejqXB0.js} +1 -1
- package/.output/public/assets/{main-mgxeUdZQ.js → main-2NlGzgOe.js} +2 -2
- package/.output/server/_libs/lucide-react.mjs +181 -114
- package/.output/server/{_sessionId-C4xsxIWm.mjs → _sessionId-DWCTasJU.mjs} +3 -3
- package/.output/server/_ssr/{CompareDrawer-DuWEpqQ7.mjs → CompareDrawer-DhrN1uC2.mjs} +6 -6
- package/.output/server/_ssr/{ProxyViewerContainer-Cckz5qKu.mjs → ProxyViewerContainer-DRl51s_n.mjs} +763 -119
- package/.output/server/_ssr/{ReplayDialog-BDRcr8E5.mjs → ReplayDialog-BQT_ygxC.mjs} +240 -14
- package/.output/server/_ssr/{RequestAnatomy-BoO2_Ij0.mjs → RequestAnatomy-DS2tZOgq.mjs} +3 -3
- package/.output/server/_ssr/{ResponseView-DZiPBxvO.mjs → ResponseView-e0kL2C3x.mjs} +8 -8
- package/.output/server/_ssr/{StreamingChunkSequence-D-be7KEL.mjs → StreamingChunkSequence-BJG-m7xs.mjs} +3 -3
- package/.output/server/_ssr/{index-5RImHKfu.mjs → index-Dea3OeRw.mjs} +2 -2
- package/.output/server/_ssr/index.mjs +2 -2
- package/.output/server/_ssr/{json-viewer-aJhb93ZK.mjs → json-viewer-DDU55MLK.mjs} +3 -3
- package/.output/server/_ssr/{router-Dgkv5nKP.mjs → router-Dl7oh0zx.mjs} +145 -71
- package/.output/server/_tanstack-start-manifest_v-m-FJNBVf.mjs +4 -0
- package/.output/server/index.mjs +69 -69
- package/package.json +1 -1
- package/src/components/OnboardingBanner.tsx +11 -19
- package/src/components/ProxyViewer.tsx +1 -1
- package/src/components/providers/ProviderCard.tsx +6 -20
- package/src/components/providers/SettingsDialog.tsx +95 -2
- package/src/components/proxy-viewer/AgentTraceSummary.tsx +639 -38
- package/src/components/proxy-viewer/CompareDrawer.tsx +4 -2
- package/src/components/proxy-viewer/LogEntryHeader.tsx +12 -22
- package/src/components/proxy-viewer/ReplayDialog.tsx +190 -8
- package/src/components/proxy-viewer/ResponseView.tsx +2 -2
- package/src/components/proxy-viewer/ToolTraceEvents.tsx +37 -16
- package/src/components/proxy-viewer/TurnGroup.tsx +14 -2
- package/src/components/proxy-viewer/formats/anthropic/ResponseView.tsx +2 -2
- package/src/components/proxy-viewer/replayComparison.ts +131 -0
- package/src/components/proxy-viewer/useKeyboardNavigation.ts +64 -22
- package/src/components/proxy-viewer/viewerState.ts +14 -2
- package/src/knowledge/candidateStore.ts +32 -1
- package/src/routes/api/knowledge.candidates.$candidateId.ts +50 -0
- package/src/routes/api/knowledge.sessions.$sessionId.candidates.ts +12 -2
- package/.output/public/assets/ProxyViewerContainer-D85_UANk.js +0 -101
- package/.output/public/assets/ReplayDialog-DTeaHHit.js +0 -1
- package/.output/public/assets/ResponseView-Cldm6RCi.js +0 -1
- package/.output/public/assets/StreamingChunkSequence-3x4p-yT7.js +0 -1
- package/.output/public/assets/_sessionId-YqWFBu6d.js +0 -1
- package/.output/public/assets/index-BIw2H6jO.js +0 -1
- package/.output/public/assets/index-CobXD0yH.css +0 -1
- package/.output/server/_tanstack-start-manifest_v-B8rrWXjr.mjs +0 -4
|
@@ -1,101 +0,0 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/CompareDrawer-BCH_fsLm.js","assets/main-mgxeUdZQ.js","assets/json-viewer-BrzjD7qI.js","assets/ReplayDialog-DTeaHHit.js","assets/ResponseView-Cldm6RCi.js","assets/RequestAnatomy-DZ8grAih.js","assets/StreamingChunkSequence-3x4p-yT7.js"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{u as Yo,a as xa,r as v,j as a,c as Kn,g as rd,b as $n,d as He,e as va,f as od,h as sd,_ as Ft}from"./main-mgxeUdZQ.js";function K(e,t,n){function r(l,c){if(l._zod||Object.defineProperty(l,"_zod",{value:{def:c,constr:i,traits:new Set},enumerable:!1}),l._zod.traits.has(e))return;l._zod.traits.add(e),t(l,c);const u=i.prototype,d=Object.keys(u);for(let p=0;p<d.length;p++){const m=d[p];m in l||(l[m]=u[m].bind(l))}}const o=n?.Parent??Object;class s extends o{}Object.defineProperty(s,"name",{value:e});function i(l){var c;const u=n?.Parent?new s:this;r(u,l),(c=u._zod).deferred??(c.deferred=[]);for(const d of u._zod.deferred)d();return u}return Object.defineProperty(i,"init",{value:r}),Object.defineProperty(i,Symbol.hasInstance,{value:l=>n?.Parent&&l instanceof n.Parent?!0:l?._zod?.traits?.has(e)}),Object.defineProperty(i,"name",{value:e}),i}class en extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class ya extends Error{constructor(t){super(`Encountered unidirectional transform during encode: ${t}`),this.name="ZodEncodeError"}}const ba={};function wt(e){return ba}function wa(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 ko(e,t){return typeof t=="bigint"?t.toString():t}function zr(e){return{get value(){{const t=e();return Object.defineProperty(this,"value",{value:t}),t}}}}function Xo(e){return e==null}function Qo(e){const t=e.startsWith("^")?1:0,n=e.endsWith("$")?e.length-1:e.length;return e.slice(t,n)}function id(e,t){const n=(e.toString().split(".")[1]||"").length,r=t.toString();let o=(r.split(".")[1]||"").length;if(o===0&&/\d?e-\d?/.test(r)){const c=r.match(/\d?e-(\d?)/);c?.[1]&&(o=Number.parseInt(c[1]))}const s=n>o?n:o,i=Number.parseInt(e.toFixed(s).replace(".","")),l=Number.parseInt(t.toFixed(s).replace(".",""));return i%l/10**s}const Us=Symbol("evaluating");function ke(e,t,n){let r;Object.defineProperty(e,t,{get(){if(r!==Us)return r===void 0&&(r=Us,r=n()),r},set(o){Object.defineProperty(e,t,{value:o})},configurable:!0})}function $t(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function jt(...e){const t={};for(const n of e){const r=Object.getOwnPropertyDescriptors(n);Object.assign(t,r)}return Object.defineProperties({},t)}function Zs(e){return JSON.stringify(e)}function ad(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}const _a="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function On(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}const ld=zr(()=>{if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{const e=Function;return new e(""),!0}catch{return!1}});function on(e){if(On(e)===!1)return!1;const t=e.constructor;if(t===void 0||typeof t!="function")return!0;const n=t.prototype;return!(On(n)===!1||Object.prototype.hasOwnProperty.call(n,"isPrototypeOf")===!1)}function ka(e){return on(e)?{...e}:Array.isArray(e)?[...e]:e}const cd=new Set(["string","number","symbol"]);function sn(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Et(e,t,n){const r=new e._zod.constr(t??e._zod.def);return(!t||n?.parent)&&(r._zod.parent=e),r}function de(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 ud(e){return Object.keys(e).filter(t=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}const dd={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 fd(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=jt(e._zod.def,{get shape(){const i={};for(const l in t){if(!(l in n.shape))throw new Error(`Unrecognized key: "${l}"`);t[l]&&(i[l]=n.shape[l])}return $t(this,"shape",i),i},checks:[]});return Et(e,s)}function hd(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=jt(e._zod.def,{get shape(){const i={...e._zod.def.shape};for(const l in t){if(!(l in n.shape))throw new Error(`Unrecognized key: "${l}"`);t[l]&&delete i[l]}return $t(this,"shape",i),i},checks:[]});return Et(e,s)}function pd(e,t){if(!on(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=jt(e._zod.def,{get shape(){const s={...e._zod.def.shape,...t};return $t(this,"shape",s),s}});return Et(e,o)}function md(e,t){if(!on(t))throw new Error("Invalid input to safeExtend: expected a plain object");const n=jt(e._zod.def,{get shape(){const r={...e._zod.def.shape,...t};return $t(this,"shape",r),r}});return Et(e,n)}function gd(e,t){const n=jt(e._zod.def,{get shape(){const r={...e._zod.def.shape,...t._zod.def.shape};return $t(this,"shape",r),r},get catchall(){return t._zod.def.catchall},checks:[]});return Et(e,n)}function xd(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=jt(t._zod.def,{get shape(){const l=t._zod.def.shape,c={...l};if(n)for(const u in n){if(!(u in l))throw new Error(`Unrecognized key: "${u}"`);n[u]&&(c[u]=e?new e({type:"optional",innerType:l[u]}):l[u])}else for(const u in l)c[u]=e?new e({type:"optional",innerType:l[u]}):l[u];return $t(this,"shape",c),c},checks:[]});return Et(t,i)}function vd(e,t,n){const r=jt(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 $t(this,"shape",s),s}});return Et(t,r)}function Xt(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 Qt(e,t){return t.map(n=>{var r;return(r=n).path??(r.path=[]),n.path.unshift(e),n})}function Gn(e){return typeof e=="string"?e:e?.message}function _t(e,t,n){const r={...e,path:e.path??[]};if(!e.message){const o=Gn(e.inst?._zod.def?.error?.(e))??Gn(t?.error?.(e))??Gn(n.customError?.(e))??Gn(n.localeError?.(e))??"Invalid input";r.message=o}return delete r.inst,delete r.continue,t?.reportInput||delete r.input,r}function es(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}function In(...e){const[t,n,r]=e;return typeof t=="string"?{message:t,code:"custom",input:n,inst:r}:{...t}}const Ca=(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,ko,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},Sa=K("$ZodError",Ca),ja=K("$ZodError",Ca,{Parent:Error});function yd(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 bd(e,t=n=>n.message){const n={_errors:[]},r=o=>{for(const s of o.issues)if(s.code==="invalid_union"&&s.errors.length)s.errors.map(i=>r({issues:i}));else if(s.code==="invalid_key")r({issues:s.issues});else if(s.code==="invalid_element")r({issues:s.issues});else if(s.path.length===0)n._errors.push(t(s));else{let i=n,l=0;for(;l<s.path.length;){const c=s.path[l];l===s.path.length-1?(i[c]=i[c]||{_errors:[]},i[c]._errors.push(t(s))):i[c]=i[c]||{_errors:[]},i=i[c],l++}}};return r(e),n}const ts=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 en;if(i.issues.length){const l=new(o?.Err??e)(i.issues.map(c=>_t(c,s,wt())));throw _a(l,o?.callee),l}return i.value},ns=e=>async(t,n,r,o)=>{const s=r?Object.assign(r,{async:!0}):{async:!0};let i=t._zod.run({value:n,issues:[]},s);if(i instanceof Promise&&(i=await i),i.issues.length){const l=new(o?.Err??e)(i.issues.map(c=>_t(c,s,wt())));throw _a(l,o?.callee),l}return i.value},Or=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 en;return s.issues.length?{success:!1,error:new(e??Sa)(s.issues.map(i=>_t(i,o,wt())))}:{success:!0,data:s.value}},wd=Or(ja),Ir=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=>_t(i,o,wt())))}:{success:!0,data:s.value}},_d=Ir(ja),kd=e=>(t,n,r)=>{const o=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return ts(e)(t,n,o)},Cd=e=>(t,n,r)=>ts(e)(t,n,r),Sd=e=>async(t,n,r)=>{const o=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return ns(e)(t,n,o)},jd=e=>async(t,n,r)=>ns(e)(t,n,r),Ed=e=>(t,n,r)=>{const o=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return Or(e)(t,n,o)},Nd=e=>(t,n,r)=>Or(e)(t,n,r),Td=e=>async(t,n,r)=>{const o=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return Ir(e)(t,n,o)},Ad=e=>async(t,n,r)=>Ir(e)(t,n,r),zd=/^[cC][^\s-]{8,}$/,Od=/^[0-9a-z]+$/,Id=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,Rd=/^[0-9a-vA-V]{20}$/,Pd=/^[A-Za-z0-9]{27}$/,Md=/^[a-zA-Z0-9_-]{21}$/,Dd=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,Ld=/^([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})$/,Ws=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)$/,Fd=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,$d="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function Bd(){return new RegExp($d,"u")}const Ud=/^(?:(?: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])$/,Zd=/^(([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}|:))$/,Wd=/^((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])$/,Vd=/^(([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])$/,Hd=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,Ea=/^[A-Za-z0-9_-]*$/,qd=/^\+[1-9]\d{6,14}$/,Na="(?:(?:\\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])))",Jd=new RegExp(`^${Na}$`);function Ta(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 Kd(e){return new RegExp(`^${Ta(e)}$`)}function Gd(e){const t=Ta({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(`^${Na}T(?:${r})$`)}const Yd=e=>{const t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${t}$`)},Xd=/^-?\d+$/,Aa=/^-?\d+(?:\.\d+)?$/,Qd=/^(?:true|false)$/i,ef=/^null$/i,tf=/^[^A-Z]*$/,nf=/^[^a-z]*$/,qe=K("$ZodCheck",(e,t)=>{var n;e._zod??(e._zod={}),e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),za={number:"number",bigint:"bigint",object:"date"},Oa=K("$ZodCheckLessThan",(e,t)=>{qe.init(e,t);const n=za[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})}}),Ia=K("$ZodCheckGreaterThan",(e,t)=>{qe.init(e,t);const n=za[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})}}),rf=K("$ZodCheckMultipleOf",(e,t)=>{qe.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):id(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})}}),of=K("$ZodCheckNumberFormat",(e,t)=>{qe.init(e,t),t.format=t.format||"float64";const n=t.format?.includes("int"),r=n?"int":"number",[o,s]=dd[t.format];e._zod.onattach.push(i=>{const l=i._zod.bag;l.format=t.format,l.minimum=o,l.maximum=s,n&&(l.pattern=Xd)}),e._zod.check=i=>{const l=i.value;if(n){if(!Number.isInteger(l)){i.issues.push({expected:r,format:t.format,code:"invalid_type",continue:!1,input:l,inst:e});return}if(!Number.isSafeInteger(l)){l>0?i.issues.push({input:l,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:r,inclusive:!0,continue:!t.abort}):i.issues.push({input:l,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:r,inclusive:!0,continue:!t.abort});return}}l<o&&i.issues.push({origin:"number",input:l,code:"too_small",minimum:o,inclusive:!0,inst:e,continue:!t.abort}),l>s&&i.issues.push({origin:"number",input:l,code:"too_big",maximum:s,inclusive:!0,inst:e,continue:!t.abort})}}),sf=K("$ZodCheckMaxLength",(e,t)=>{var n;qe.init(e,t),(n=e._zod.def).when??(n.when=r=>{const o=r.value;return!Xo(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=es(o);r.issues.push({origin:i,code:"too_big",maximum:t.maximum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),af=K("$ZodCheckMinLength",(e,t)=>{var n;qe.init(e,t),(n=e._zod.def).when??(n.when=r=>{const o=r.value;return!Xo(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=es(o);r.issues.push({origin:i,code:"too_small",minimum:t.minimum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),lf=K("$ZodCheckLengthEquals",(e,t)=>{var n;qe.init(e,t),(n=e._zod.def).when??(n.when=r=>{const o=r.value;return!Xo(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=es(o),l=s>t.length;r.issues.push({origin:i,...l?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:r.value,inst:e,continue:!t.abort})}}),Rr=K("$ZodCheckStringFormat",(e,t)=>{var n,r;qe.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=()=>{})}),cf=K("$ZodCheckRegex",(e,t)=>{Rr.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})}}),uf=K("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=tf),Rr.init(e,t)}),df=K("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=nf),Rr.init(e,t)}),ff=K("$ZodCheckIncludes",(e,t)=>{qe.init(e,t);const n=sn(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})}}),hf=K("$ZodCheckStartsWith",(e,t)=>{qe.init(e,t);const n=new RegExp(`^${sn(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})}}),pf=K("$ZodCheckEndsWith",(e,t)=>{qe.init(e,t);const n=new RegExp(`.*${sn(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})}}),mf=K("$ZodCheckOverwrite",(e,t)=>{qe.init(e,t),e._zod.check=n=>{n.value=t.tx(n.value)}});class gf{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 xf={major:4,minor:3,patch:6},ze=K("$ZodType",(e,t)=>{var n;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=xf;const r=[...e._zod.def.checks??[]];e._zod.traits.has("$ZodCheck")&&r.unshift(e);for(const o of r)for(const s of o._zod.onattach)s(e);if(r.length===0)(n=e._zod).deferred??(n.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{const o=(i,l,c)=>{let u=Xt(i),d;for(const p of l){if(p._zod.def.when){if(!p._zod.def.when(i))continue}else if(u)continue;const m=i.issues.length,h=p._zod.check(i);if(h instanceof Promise&&c?.async===!1)throw new en;if(d||h instanceof Promise)d=(d??Promise.resolve()).then(async()=>{await h,i.issues.length!==m&&(u||(u=Xt(i,m)))});else{if(i.issues.length===m)continue;u||(u=Xt(i,m))}}return d?d.then(()=>i):i},s=(i,l,c)=>{if(Xt(i))return i.aborted=!0,i;const u=o(l,r,c);if(u instanceof Promise){if(c.async===!1)throw new en;return u.then(d=>e._zod.parse(d,c))}return e._zod.parse(u,c)};e._zod.run=(i,l)=>{if(l.skipChecks)return e._zod.parse(i,l);if(l.direction==="backward"){const u=e._zod.parse({value:i.value,issues:[]},{...l,skipChecks:!0});return u instanceof Promise?u.then(d=>s(d,i,l)):s(u,i,l)}const c=e._zod.parse(i,l);if(c instanceof Promise){if(l.async===!1)throw new en;return c.then(u=>o(u,r,l))}return o(c,r,l)}}ke(e,"~standard",()=>({validate:o=>{try{const s=wd(e,o);return s.success?{value:s.data}:{issues:s.error?.issues}}catch{return _d(e,o).then(i=>i.success?{value:i.data}:{issues:i.error?.issues})}},vendor:"zod",version:1}))}),rs=K("$ZodString",(e,t)=>{ze.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??Yd(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}}),Re=K("$ZodStringFormat",(e,t)=>{Rr.init(e,t),rs.init(e,t)}),vf=K("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=Ld),Re.init(e,t)}),yf=K("$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=Ws(r))}else t.pattern??(t.pattern=Ws());Re.init(e,t)}),bf=K("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=Fd),Re.init(e,t)}),wf=K("$ZodURL",(e,t)=>{Re.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})}}}),_f=K("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=Bd()),Re.init(e,t)}),kf=K("$ZodNanoID",(e,t)=>{t.pattern??(t.pattern=Md),Re.init(e,t)}),Cf=K("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=zd),Re.init(e,t)}),Sf=K("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=Od),Re.init(e,t)}),jf=K("$ZodULID",(e,t)=>{t.pattern??(t.pattern=Id),Re.init(e,t)}),Ef=K("$ZodXID",(e,t)=>{t.pattern??(t.pattern=Rd),Re.init(e,t)}),Nf=K("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=Pd),Re.init(e,t)}),Tf=K("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=Gd(t)),Re.init(e,t)}),Af=K("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=Jd),Re.init(e,t)}),zf=K("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=Kd(t)),Re.init(e,t)}),Of=K("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=Dd),Re.init(e,t)}),If=K("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=Ud),Re.init(e,t),e._zod.bag.format="ipv4"}),Rf=K("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=Zd),Re.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})}}}),Pf=K("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=Wd),Re.init(e,t)}),Mf=K("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=Vd),Re.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 Ra(e){if(e==="")return!0;if(e.length%4!==0)return!1;try{return atob(e),!0}catch{return!1}}const Df=K("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=Hd),Re.init(e,t),e._zod.bag.contentEncoding="base64",e._zod.check=n=>{Ra(n.value)||n.issues.push({code:"invalid_format",format:"base64",input:n.value,inst:e,continue:!t.abort})}});function Lf(e){if(!Ea.test(e))return!1;const t=e.replace(/[-_]/g,r=>r==="-"?"+":"/"),n=t.padEnd(Math.ceil(t.length/4)*4,"=");return Ra(n)}const Ff=K("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=Ea),Re.init(e,t),e._zod.bag.contentEncoding="base64url",e._zod.check=n=>{Lf(n.value)||n.issues.push({code:"invalid_format",format:"base64url",input:n.value,inst:e,continue:!t.abort})}}),$f=K("$ZodE164",(e,t)=>{t.pattern??(t.pattern=qd),Re.init(e,t)});function Bf(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 Uf=K("$ZodJWT",(e,t)=>{Re.init(e,t),e._zod.check=n=>{Bf(n.value,t.alg)||n.issues.push({code:"invalid_format",format:"jwt",input:n.value,inst:e,continue:!t.abort})}}),Pa=K("$ZodNumber",(e,t)=>{ze.init(e,t),e._zod.pattern=e._zod.bag.pattern??Aa,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}}),Zf=K("$ZodNumberFormat",(e,t)=>{of.init(e,t),Pa.init(e,t)}),Wf=K("$ZodBoolean",(e,t)=>{ze.init(e,t),e._zod.pattern=Qd,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}}),Vf=K("$ZodNull",(e,t)=>{ze.init(e,t),e._zod.pattern=ef,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}}),Hf=K("$ZodUnknown",(e,t)=>{ze.init(e,t),e._zod.parse=n=>n}),qf=K("$ZodNever",(e,t)=>{ze.init(e,t),e._zod.parse=(n,r)=>(n.issues.push({expected:"never",code:"invalid_type",input:n.value,inst:e}),n)});function Vs(e,t,n){e.issues.length&&t.issues.push(...Qt(n,e.issues)),t.value[n]=e.value}const Jf=K("$ZodArray",(e,t)=>{ze.init(e,t),e._zod.parse=(n,r)=>{const o=n.value;if(!Array.isArray(o))return n.issues.push({expected:"array",code:"invalid_type",input:o,inst:e}),n;n.value=Array(o.length);const s=[];for(let i=0;i<o.length;i++){const l=o[i],c=t.element._zod.run({value:l,issues:[]},r);c instanceof Promise?s.push(c.then(u=>Vs(u,n,i))):Vs(c,n,i)}return s.length?Promise.all(s).then(()=>n):n}});function pr(e,t,n,r,o){if(e.issues.length){if(o&&!(n in r))return;t.issues.push(...Qt(n,e.issues))}e.value===void 0?n in r&&(t.value[n]=void 0):t.value[n]=e.value}function Ma(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=ud(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(n)}}function Da(e,t,n,r,o,s){const i=[],l=o.keySet,c=o.catchall._zod,u=c.def.type,d=c.optout==="optional";for(const p in t){if(l.has(p))continue;if(u==="never"){i.push(p);continue}const m=c.run({value:t[p],issues:[]},r);m instanceof Promise?e.push(m.then(h=>pr(h,n,p,t,d))):pr(m,n,p,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 Kf=K("$ZodObject",(e,t)=>{if(ze.init(e,t),!Object.getOwnPropertyDescriptor(t,"shape")?.get){const l=t.shape;Object.defineProperty(t,"shape",{get:()=>{const c={...l};return Object.defineProperty(t,"shape",{value:c}),c}})}const r=zr(()=>Ma(t));ke(e._zod,"propValues",()=>{const l=t.shape,c={};for(const u in l){const d=l[u]._zod;if(d.values){c[u]??(c[u]=new Set);for(const p of d.values)c[u].add(p)}}return c});const o=On,s=t.catchall;let i;e._zod.parse=(l,c)=>{i??(i=r.value);const u=l.value;if(!o(u))return l.issues.push({expected:"object",code:"invalid_type",input:u,inst:e}),l;l.value={};const d=[],p=i.shape;for(const m of i.keys){const h=p[m],g=h._zod.optout==="optional",f=h._zod.run({value:u[m],issues:[]},c);f instanceof Promise?d.push(f.then(x=>pr(x,l,m,u,g))):pr(f,l,m,u,g)}return s?Da(d,u,l,c,r.value,e):d.length?Promise.all(d).then(()=>l):l}}),Gf=K("$ZodObjectJIT",(e,t)=>{Kf.init(e,t);const n=e._zod.parse,r=zr(()=>Ma(t)),o=m=>{const h=new gf(["shape","payload","ctx"]),g=r.value,f=k=>{const C=Zs(k);return`shape[${C}]._zod.run({ value: input[${C}], issues: [] }, ctx)`};h.write("const input = payload.value;");const x=Object.create(null);let y=0;for(const k of g.keys)x[k]=`key_${y++}`;h.write("const newResult = {};");for(const k of g.keys){const C=x[k],S=Zs(k),N=m[k]?._zod?.optout==="optional";h.write(`const ${C} = ${f(k)};`),N?h.write(`
|
|
5
|
-
if (${C}.issues.length) {
|
|
6
|
-
if (${S} in input) {
|
|
7
|
-
payload.issues = payload.issues.concat(${C}.issues.map(iss => ({
|
|
8
|
-
...iss,
|
|
9
|
-
path: iss.path ? [${S}, ...iss.path] : [${S}]
|
|
10
|
-
})));
|
|
11
|
-
}
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
if (${C}.value === undefined) {
|
|
15
|
-
if (${S} in input) {
|
|
16
|
-
newResult[${S}] = undefined;
|
|
17
|
-
}
|
|
18
|
-
} else {
|
|
19
|
-
newResult[${S}] = ${C}.value;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
`):h.write(`
|
|
23
|
-
if (${C}.issues.length) {
|
|
24
|
-
payload.issues = payload.issues.concat(${C}.issues.map(iss => ({
|
|
25
|
-
...iss,
|
|
26
|
-
path: iss.path ? [${S}, ...iss.path] : [${S}]
|
|
27
|
-
})));
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
if (${C}.value === undefined) {
|
|
31
|
-
if (${S} in input) {
|
|
32
|
-
newResult[${S}] = undefined;
|
|
33
|
-
}
|
|
34
|
-
} else {
|
|
35
|
-
newResult[${S}] = ${C}.value;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
`)}h.write("payload.value = newResult;"),h.write("return payload;");const _=h.compile();return(k,C)=>_(m,k,C)};let s;const i=On,l=!ba.jitless,u=l&&ld.value,d=t.catchall;let p;e._zod.parse=(m,h)=>{p??(p=r.value);const g=m.value;return i(g)?l&&u&&h?.async===!1&&h.jitless!==!0?(s||(s=o(t.shape)),m=s(m,h),d?Da([],g,m,h,p,e):m):n(m,h):(m.issues.push({expected:"object",code:"invalid_type",input:g,inst:e}),m)}});function Hs(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=>!Xt(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=>_t(i,r,wt())))}),t)}const La=K("$ZodUnion",(e,t)=>{ze.init(e,t),ke(e._zod,"optin",()=>t.options.some(o=>o._zod.optin==="optional")?"optional":void 0),ke(e._zod,"optout",()=>t.options.some(o=>o._zod.optout==="optional")?"optional":void 0),ke(e._zod,"values",()=>{if(t.options.every(o=>o._zod.values))return new Set(t.options.flatMap(o=>Array.from(o._zod.values)))}),ke(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=>Qo(s.source)).join("|")})$`)}});const n=t.options.length===1,r=t.options[0]._zod.run;e._zod.parse=(o,s)=>{if(n)return r(o,s);let i=!1;const l=[];for(const c of t.options){const u=c._zod.run({value:o.value,issues:[]},s);if(u instanceof Promise)l.push(u),i=!0;else{if(u.issues.length===0)return u;l.push(u)}}return i?Promise.all(l).then(c=>Hs(c,o,e,s)):Hs(l,o,e,s)}}),Yf=K("$ZodDiscriminatedUnion",(e,t)=>{t.inclusive=!1,La.init(e,t);const n=e._zod.parse;ke(e._zod,"propValues",()=>{const o={};for(const s of t.options){const i=s._zod.propValues;if(!i||Object.keys(i).length===0)throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(s)}"`);for(const[l,c]of Object.entries(i)){o[l]||(o[l]=new Set);for(const u of c)o[l].add(u)}}return o});const r=zr(()=>{const o=t.options,s=new Map;for(const i of o){const l=i._zod.propValues?.[t.discriminator];if(!l||l.size===0)throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(i)}"`);for(const c of l){if(s.has(c))throw new Error(`Duplicate discriminator value "${String(c)}"`);s.set(c,i)}}return s});e._zod.parse=(o,s)=>{const i=o.value;if(!On(i))return o.issues.push({code:"invalid_type",expected:"object",input:i,inst:e}),o;const l=r.value.get(i?.[t.discriminator]);return l?l._zod.run(o,s):t.unionFallback?n(o,s):(o.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:t.discriminator,input:i,path:[t.discriminator],inst:e}),o)}}),Xf=K("$ZodIntersection",(e,t)=>{ze.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])=>qs(n,c,u)):qs(n,s,i)}});function Co(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(on(e)&&on(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=Co(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=Co(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 qs(e,t,n){const r=new Map;let o;for(const l of t.issues)if(l.code==="unrecognized_keys"){o??(o=l);for(const c of l.keys)r.has(c)||r.set(c,{}),r.get(c).l=!0}else e.issues.push(l);for(const l of n.issues)if(l.code==="unrecognized_keys")for(const c of l.keys)r.has(c)||r.set(c,{}),r.get(c).r=!0;else e.issues.push(l);const s=[...r].filter(([,l])=>l.l&&l.r).map(([l])=>l);if(s.length&&o&&e.issues.push({...o,keys:s}),Xt(e))return e;const i=Co(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 Qf=K("$ZodRecord",(e,t)=>{ze.init(e,t),e._zod.parse=(n,r)=>{const o=n.value;if(!on(o))return n.issues.push({expected:"record",code:"invalid_type",input:o,inst:e}),n;const s=[],i=t.keyType._zod.values;if(i){n.value={};const l=new Set;for(const u of i)if(typeof u=="string"||typeof u=="number"||typeof u=="symbol"){l.add(typeof u=="number"?u.toString():u);const d=t.valueType._zod.run({value:o[u],issues:[]},r);d instanceof Promise?s.push(d.then(p=>{p.issues.length&&n.issues.push(...Qt(u,p.issues)),n.value[u]=p.value})):(d.issues.length&&n.issues.push(...Qt(u,d.issues)),n.value[u]=d.value)}let c;for(const u in o)l.has(u)||(c=c??[],c.push(u));c&&c.length>0&&n.issues.push({code:"unrecognized_keys",input:o,inst:e,keys:c})}else{n.value={};for(const l of Reflect.ownKeys(o)){if(l==="__proto__")continue;let c=t.keyType._zod.run({value:l,issues:[]},r);if(c instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(typeof l=="string"&&Aa.test(l)&&c.issues.length){const p=t.keyType._zod.run({value:Number(l),issues:[]},r);if(p instanceof Promise)throw new Error("Async schemas not supported in object keys currently");p.issues.length===0&&(c=p)}if(c.issues.length){t.mode==="loose"?n.value[l]=o[l]:n.issues.push({code:"invalid_key",origin:"record",issues:c.issues.map(p=>_t(p,r,wt())),input:l,path:[l],inst:e});continue}const d=t.valueType._zod.run({value:o[l],issues:[]},r);d instanceof Promise?s.push(d.then(p=>{p.issues.length&&n.issues.push(...Qt(l,p.issues)),n.value[c.value]=p.value})):(d.issues.length&&n.issues.push(...Qt(l,d.issues)),n.value[c.value]=d.value)}}return s.length?Promise.all(s).then(()=>n):n}}),eh=K("$ZodEnum",(e,t)=>{ze.init(e,t);const n=wa(t.entries),r=new Set(n);e._zod.values=r,e._zod.pattern=new RegExp(`^(${n.filter(o=>cd.has(typeof o)).map(o=>typeof o=="string"?sn(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}}),th=K("$ZodLiteral",(e,t)=>{if(ze.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"?sn(r):r?sn(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}}),nh=K("$ZodTransform",(e,t)=>{ze.init(e,t),e._zod.parse=(n,r)=>{if(r.direction==="backward")throw new ya(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 en;return n.value=o,n}});function Js(e,t){return e.issues.length&&t===void 0?{issues:[],value:void 0}:e}const Fa=K("$ZodOptional",(e,t)=>{ze.init(e,t),e._zod.optin="optional",e._zod.optout="optional",ke(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),ke(e._zod,"pattern",()=>{const n=t.innerType._zod.pattern;return n?new RegExp(`^(${Qo(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=>Js(s,n.value)):Js(o,n.value)}return n.value===void 0?n:t.innerType._zod.run(n,r)}}),rh=K("$ZodExactOptional",(e,t)=>{Fa.init(e,t),ke(e._zod,"values",()=>t.innerType._zod.values),ke(e._zod,"pattern",()=>t.innerType._zod.pattern),e._zod.parse=(n,r)=>t.innerType._zod.run(n,r)}),oh=K("$ZodNullable",(e,t)=>{ze.init(e,t),ke(e._zod,"optin",()=>t.innerType._zod.optin),ke(e._zod,"optout",()=>t.innerType._zod.optout),ke(e._zod,"pattern",()=>{const n=t.innerType._zod.pattern;return n?new RegExp(`^(${Qo(n.source)}|null)$`):void 0}),ke(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)}),sh=K("$ZodDefault",(e,t)=>{ze.init(e,t),e._zod.optin="optional",ke(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=>Ks(s,t)):Ks(o,t)}});function Ks(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}const ih=K("$ZodPrefault",(e,t)=>{ze.init(e,t),e._zod.optin="optional",ke(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))}),ah=K("$ZodNonOptional",(e,t)=>{ze.init(e,t),ke(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=>Gs(s,e)):Gs(o,e)}});function Gs(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 lh=K("$ZodCatch",(e,t)=>{ze.init(e,t),ke(e._zod,"optin",()=>t.innerType._zod.optin),ke(e._zod,"optout",()=>t.innerType._zod.optout),ke(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=>_t(i,r,wt()))},input:n.value}),n.issues=[]),n)):(n.value=o.value,o.issues.length&&(n.value=t.catchValue({...n,error:{issues:o.issues.map(s=>_t(s,r,wt()))},input:n.value}),n.issues=[]),n)}}),ch=K("$ZodPipe",(e,t)=>{ze.init(e,t),ke(e._zod,"values",()=>t.in._zod.values),ke(e._zod,"optin",()=>t.in._zod.optin),ke(e._zod,"optout",()=>t.out._zod.optout),ke(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=>Yn(i,t.in,r)):Yn(s,t.in,r)}const o=t.in._zod.run(n,r);return o instanceof Promise?o.then(s=>Yn(s,t.out,r)):Yn(o,t.out,r)}});function Yn(e,t,n){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},n)}const uh=K("$ZodReadonly",(e,t)=>{ze.init(e,t),ke(e._zod,"propValues",()=>t.innerType._zod.propValues),ke(e._zod,"values",()=>t.innerType._zod.values),ke(e._zod,"optin",()=>t.innerType?._zod?.optin),ke(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(Ys):Ys(o)}});function Ys(e){return e.value=Object.freeze(e.value),e}const dh=K("$ZodLazy",(e,t)=>{ze.init(e,t),ke(e._zod,"innerType",()=>t.getter()),ke(e._zod,"pattern",()=>e._zod.innerType?._zod?.pattern),ke(e._zod,"propValues",()=>e._zod.innerType?._zod?.propValues),ke(e._zod,"optin",()=>e._zod.innerType?._zod?.optin??void 0),ke(e._zod,"optout",()=>e._zod.innerType?._zod?.optout??void 0),e._zod.parse=(n,r)=>e._zod.innerType._zod.run(n,r)}),fh=K("$ZodCustom",(e,t)=>{qe.init(e,t),ze.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=>Xs(s,n,r,e));Xs(o,n,r,e)}});function Xs(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(In(o))}}var Qs;class hh{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 ph(){return new hh}(Qs=globalThis).__zod_globalRegistry??(Qs.__zod_globalRegistry=ph());const Nn=globalThis.__zod_globalRegistry;function mh(e,t){return new e({type:"string",...de(t)})}function gh(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...de(t)})}function ei(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...de(t)})}function xh(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...de(t)})}function vh(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...de(t)})}function yh(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...de(t)})}function bh(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...de(t)})}function wh(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...de(t)})}function _h(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...de(t)})}function kh(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...de(t)})}function Ch(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...de(t)})}function Sh(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...de(t)})}function jh(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...de(t)})}function Eh(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...de(t)})}function Nh(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...de(t)})}function Th(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...de(t)})}function Ah(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...de(t)})}function zh(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...de(t)})}function Oh(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...de(t)})}function Ih(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...de(t)})}function Rh(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...de(t)})}function Ph(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...de(t)})}function Mh(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...de(t)})}function Dh(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...de(t)})}function Lh(e,t){return new e({type:"string",format:"date",check:"string_format",...de(t)})}function Fh(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...de(t)})}function $h(e,t){return new e({type:"string",format:"duration",check:"string_format",...de(t)})}function Bh(e,t){return new e({type:"number",checks:[],...de(t)})}function Uh(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...de(t)})}function Zh(e,t){return new e({type:"boolean",...de(t)})}function Wh(e,t){return new e({type:"null",...de(t)})}function Vh(e){return new e({type:"unknown"})}function Hh(e,t){return new e({type:"never",...de(t)})}function ti(e,t){return new Oa({check:"less_than",...de(t),value:e,inclusive:!1})}function Qr(e,t){return new Oa({check:"less_than",...de(t),value:e,inclusive:!0})}function ni(e,t){return new Ia({check:"greater_than",...de(t),value:e,inclusive:!1})}function eo(e,t){return new Ia({check:"greater_than",...de(t),value:e,inclusive:!0})}function ri(e,t){return new rf({check:"multiple_of",...de(t),value:e})}function $a(e,t){return new sf({check:"max_length",...de(t),maximum:e})}function mr(e,t){return new af({check:"min_length",...de(t),minimum:e})}function Ba(e,t){return new lf({check:"length_equals",...de(t),length:e})}function qh(e,t){return new cf({check:"string_format",format:"regex",...de(t),pattern:e})}function Jh(e){return new uf({check:"string_format",format:"lowercase",...de(e)})}function Kh(e){return new df({check:"string_format",format:"uppercase",...de(e)})}function Gh(e,t){return new ff({check:"string_format",format:"includes",...de(t),includes:e})}function Yh(e,t){return new hf({check:"string_format",format:"starts_with",...de(t),prefix:e})}function Xh(e,t){return new pf({check:"string_format",format:"ends_with",...de(t),suffix:e})}function fn(e){return new mf({check:"overwrite",tx:e})}function Qh(e){return fn(t=>t.normalize(e))}function ep(){return fn(e=>e.trim())}function tp(){return fn(e=>e.toLowerCase())}function np(){return fn(e=>e.toUpperCase())}function rp(){return fn(e=>ad(e))}function op(e,t,n){return new e({type:"array",element:t,...de(n)})}function sp(e,t,n){return new e({type:"custom",check:"custom",fn:t,...de(n)})}function ip(e){const t=ap(n=>(n.addIssue=r=>{if(typeof r=="string")n.issues.push(In(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(In(o))}},e(n.value,n)));return t}function ap(e,t){const n=new qe({check:"custom",...de(t)});return n._zod.check=e,n}function Ua(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??Nn,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 Le(e,t,n={path:[],schemaPath:[]}){var r;const o=e._zod.def,s=t.seen.get(e);if(s)return s.count++,n.schemaPath.includes(e)&&(s.cycle=n.path),s.schema;const i={schema:{},count:1,cycle:void 0,path:n.path};t.seen.set(e,i);const l=e._zod.toJSONSchema?.();if(l)i.schema=l;else{const d={...n,schemaPath:[...n.schemaPath,e],path:n.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,i.schema,d);else{const m=i.schema,h=t.processors[o.type];if(!h)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${o.type}`);h(e,t,m,d)}const p=e._zod.parent;p&&(i.ref||(i.ref=p),Le(p,t,d),t.seen.get(p).isParent=!0)}const c=t.metadataRegistry.get(e);return c&&Object.assign(i.schema,c),t.io==="input"&&Ve(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 Za(e,t){const n=e.seen.get(t);if(!n)throw new Error("Unprocessed schema. This is a bug in Zod.");const r=new Map;for(const i of e.seen.entries()){const l=e.metadataRegistry.get(i[0])?.id;if(l){const c=r.get(l);if(c&&c!==i[0])throw new Error(`Duplicate schema id "${l}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);r.set(l,i[0])}}const o=i=>{const l=e.target==="draft-2020-12"?"$defs":"definitions";if(e.external){const p=e.external.registry.get(i[0])?.id,m=e.external.uri??(g=>g);if(p)return{ref:m(p)};const h=i[1].defId??i[1].schema.id??`schema${e.counter++}`;return i[1].defId=h,{defId:h,ref:`${m("__shared")}#/${l}/${h}`}}if(i[1]===n)return{ref:"#"};const u=`#/${l}/`,d=i[1].schema.id??`__schema${e.counter++}`;return{defId:d,ref:u+d}},s=i=>{if(i[1].schema.$ref)return;const l=i[1],{ref:c,defId:u}=o(i);l.def={...l.schema},u&&(l.defId=u);const d=l.schema;for(const p in d)delete d[p];d.$ref=c};if(e.cycles==="throw")for(const i of e.seen.entries()){const l=i[1];if(l.cycle)throw new Error(`Cycle detected: #/${l.cycle?.join("/")}/<root>
|
|
39
|
-
|
|
40
|
-
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(const i of e.seen.entries()){const l=i[1];if(t===i[0]){s(i);continue}if(e.external){const u=e.external.registry.get(i[0])?.id;if(t!==i[0]&&u){s(i);continue}}if(e.metadataRegistry.get(i[0])?.id){s(i);continue}if(l.cycle){s(i);continue}if(l.count>1&&e.reused==="ref"){s(i);continue}}}function Wa(e,t){const n=e.seen.get(t);if(!n)throw new Error("Unprocessed schema. This is a bug in Zod.");const r=i=>{const l=e.seen.get(i);if(l.ref===null)return;const c=l.def??l.schema,u={...c},d=l.ref;if(l.ref=null,d){r(d);const m=e.seen.get(d),h=m.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 f in c)f==="$ref"||f==="allOf"||f in u||delete c[f];if(h.$ref&&m.def)for(const f in c)f==="$ref"||f==="allOf"||f in m.def&&JSON.stringify(c[f])===JSON.stringify(m.def[f])&&delete c[f]}const p=i._zod.parent;if(p&&p!==d){r(p);const m=e.seen.get(p);if(m?.schema.$ref&&(c.$ref=m.schema.$ref,m.def))for(const h in c)h==="$ref"||h==="allOf"||h in m.def&&JSON.stringify(c[h])===JSON.stringify(m.def[h])&&delete c[h]}e.override({zodSchema:i,jsonSchema:c,path:l.path??[]})};for(const i of[...e.seen.entries()].reverse())r(i[0]);const o={};if(e.target==="draft-2020-12"?o.$schema="https://json-schema.org/draft/2020-12/schema":e.target==="draft-07"?o.$schema="http://json-schema.org/draft-07/schema#":e.target==="draft-04"?o.$schema="http://json-schema.org/draft-04/schema#":e.target,e.external?.uri){const i=e.external.registry.get(t)?.id;if(!i)throw new Error("Schema is missing an `id` property");o.$id=e.external.uri(i)}Object.assign(o,n.def??n.schema);const s=e.external?.defs??{};for(const i of e.seen.entries()){const l=i[1];l.def&&l.defId&&(s[l.defId]=l.def)}e.external||Object.keys(s).length>0&&(e.target==="draft-2020-12"?o.$defs=s:o.definitions=s);try{const i=JSON.parse(JSON.stringify(o));return Object.defineProperty(i,"~standard",{value:{...t["~standard"],jsonSchema:{input:gr(t,"input",e.processors),output:gr(t,"output",e.processors)}},enumerable:!1,writable:!1}),i}catch{throw new Error("Error converting schema to JSON.")}}function Ve(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 Ve(r.element,n);if(r.type==="set")return Ve(r.valueType,n);if(r.type==="lazy")return Ve(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 Ve(r.innerType,n);if(r.type==="intersection")return Ve(r.left,n)||Ve(r.right,n);if(r.type==="record"||r.type==="map")return Ve(r.keyType,n)||Ve(r.valueType,n);if(r.type==="pipe")return Ve(r.in,n)||Ve(r.out,n);if(r.type==="object"){for(const o in r.shape)if(Ve(r.shape[o],n))return!0;return!1}if(r.type==="union"){for(const o of r.options)if(Ve(o,n))return!0;return!1}if(r.type==="tuple"){for(const o of r.items)if(Ve(o,n))return!0;return!!(r.rest&&Ve(r.rest,n))}return!1}const lp=(e,t={})=>n=>{const r=Ua({...n,processors:t});return Le(e,r),Za(r,e),Wa(r,e)},gr=(e,t,n={})=>r=>{const{libraryOptions:o,target:s}=r??{},i=Ua({...o??{},target:s,io:t,processors:n});return Le(e,i),Za(i,e),Wa(i,e)},cp={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},up=(e,t,n,r)=>{const o=n;o.type="string";const{minimum:s,maximum:i,format:l,patterns:c,contentEncoding:u}=e._zod.bag;if(typeof s=="number"&&(o.minLength=s),typeof i=="number"&&(o.maxLength=i),l&&(o.format=cp[l]??l,o.format===""&&delete o.format,l==="time"&&delete o.format),u&&(o.contentEncoding=u),c&&c.size>0){const d=[...c];d.length===1?o.pattern=d[0].source:d.length>1&&(o.allOf=[...d.map(p=>({...t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0"?{type:"string"}:{},pattern:p.source}))])}},dp=(e,t,n,r)=>{const o=n,{minimum:s,maximum:i,format:l,multipleOf:c,exclusiveMaximum:u,exclusiveMinimum:d}=e._zod.bag;typeof l=="string"&&l.includes("int")?o.type="integer":o.type="number",typeof d=="number"&&(t.target==="draft-04"||t.target==="openapi-3.0"?(o.minimum=d,o.exclusiveMinimum=!0):o.exclusiveMinimum=d),typeof s=="number"&&(o.minimum=s,typeof d=="number"&&t.target!=="draft-04"&&(d>=s?delete o.minimum:delete o.exclusiveMinimum)),typeof u=="number"&&(t.target==="draft-04"||t.target==="openapi-3.0"?(o.maximum=u,o.exclusiveMaximum=!0):o.exclusiveMaximum=u),typeof i=="number"&&(o.maximum=i,typeof u=="number"&&t.target!=="draft-04"&&(u<=i?delete o.maximum:delete o.exclusiveMaximum)),typeof c=="number"&&(o.multipleOf=c)},fp=(e,t,n,r)=>{n.type="boolean"},hp=(e,t,n,r)=>{t.target==="openapi-3.0"?(n.type="string",n.nullable=!0,n.enum=[null]):n.type="null"},pp=(e,t,n,r)=>{n.not={}},mp=(e,t,n,r)=>{},gp=(e,t,n,r)=>{const o=e._zod.def,s=wa(o.entries);s.every(i=>typeof i=="number")&&(n.type="number"),s.every(i=>typeof i=="string")&&(n.type="string"),n.enum=s},xp=(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},vp=(e,t,n,r)=>{if(t.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema")},yp=(e,t,n,r)=>{if(t.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema")},bp=(e,t,n,r)=>{const o=n,s=e._zod.def,{minimum:i,maximum:l}=e._zod.bag;typeof i=="number"&&(o.minItems=i),typeof l=="number"&&(o.maxItems=l),o.type="array",o.items=Le(s.element,t,{...r,path:[...r.path,"items"]})},wp=(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]=Le(i[u],t,{...r,path:[...r.path,"properties",u]});const l=new Set(Object.keys(i)),c=new Set([...l].filter(u=>{const d=s.shape[u]._zod;return t.io==="input"?d.optin===void 0:d.optout===void 0}));c.size>0&&(o.required=Array.from(c)),s.catchall?._zod.def.type==="never"?o.additionalProperties=!1:s.catchall?s.catchall&&(o.additionalProperties=Le(s.catchall,t,{...r,path:[...r.path,"additionalProperties"]})):t.io==="output"&&(o.additionalProperties=!1)},_p=(e,t,n,r)=>{const o=e._zod.def,s=o.inclusive===!1,i=o.options.map((l,c)=>Le(l,t,{...r,path:[...r.path,s?"oneOf":"anyOf",c]}));s?n.oneOf=i:n.anyOf=i},kp=(e,t,n,r)=>{const o=e._zod.def,s=Le(o.left,t,{...r,path:[...r.path,"allOf",0]}),i=Le(o.right,t,{...r,path:[...r.path,"allOf",1]}),l=u=>"allOf"in u&&Object.keys(u).length===1,c=[...l(s)?s.allOf:[s],...l(i)?i.allOf:[i]];n.allOf=c},Cp=(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=Le(s.valueType,t,{...r,path:[...r.path,"patternProperties","*"]});o.patternProperties={};for(const p of c)o.patternProperties[p.source]=d}else(t.target==="draft-07"||t.target==="draft-2020-12")&&(o.propertyNames=Le(s.keyType,t,{...r,path:[...r.path,"propertyNames"]})),o.additionalProperties=Le(s.valueType,t,{...r,path:[...r.path,"additionalProperties"]});const u=i._zod.values;if(u){const d=[...u].filter(p=>typeof p=="string"||typeof p=="number");d.length>0&&(o.required=d)}},Sp=(e,t,n,r)=>{const o=e._zod.def,s=Le(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"}]},jp=(e,t,n,r)=>{const o=e._zod.def;Le(o.innerType,t,r);const s=t.seen.get(e);s.ref=o.innerType},Ep=(e,t,n,r)=>{const o=e._zod.def;Le(o.innerType,t,r);const s=t.seen.get(e);s.ref=o.innerType,n.default=JSON.parse(JSON.stringify(o.defaultValue))},Np=(e,t,n,r)=>{const o=e._zod.def;Le(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)))},Tp=(e,t,n,r)=>{const o=e._zod.def;Le(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},Ap=(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;Le(s,t,r);const i=t.seen.get(e);i.ref=s},zp=(e,t,n,r)=>{const o=e._zod.def;Le(o.innerType,t,r);const s=t.seen.get(e);s.ref=o.innerType,n.readOnly=!0},Va=(e,t,n,r)=>{const o=e._zod.def;Le(o.innerType,t,r);const s=t.seen.get(e);s.ref=o.innerType},Op=(e,t,n,r)=>{const o=e._zod.innerType;Le(o,t,r);const s=t.seen.get(e);s.ref=o},Ip=K("ZodISODateTime",(e,t)=>{Tf.init(e,t),Me.init(e,t)});function Rp(e){return Dh(Ip,e)}const Pp=K("ZodISODate",(e,t)=>{Af.init(e,t),Me.init(e,t)});function Mp(e){return Lh(Pp,e)}const Dp=K("ZodISOTime",(e,t)=>{zf.init(e,t),Me.init(e,t)});function Lp(e){return Fh(Dp,e)}const Fp=K("ZodISODuration",(e,t)=>{Of.init(e,t),Me.init(e,t)});function $p(e){return $h(Fp,e)}const Bp=(e,t)=>{Sa.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:n=>bd(e,n)},flatten:{value:n=>yd(e,n)},addIssue:{value:n=>{e.issues.push(n),e.message=JSON.stringify(e.issues,ko,2)}},addIssues:{value:n=>{e.issues.push(...n),e.message=JSON.stringify(e.issues,ko,2)}},isEmpty:{get(){return e.issues.length===0}}})},Xe=K("ZodError",Bp,{Parent:Error}),Up=ts(Xe),Zp=ns(Xe),Wp=Or(Xe),Vp=Ir(Xe),Hp=kd(Xe),qp=Cd(Xe),Jp=Sd(Xe),Kp=jd(Xe),Gp=Ed(Xe),Yp=Nd(Xe),Xp=Td(Xe),Qp=Ad(Xe),Oe=K("ZodType",(e,t)=>(ze.init(e,t),Object.assign(e["~standard"],{jsonSchema:{input:gr(e,"input"),output:gr(e,"output")}}),e.toJSONSchema=lp(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.check=(...n)=>e.clone(jt(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)=>Et(e,n,r),e.brand=()=>e,e.register=((n,r)=>(n.add(e,r),e)),e.parse=(n,r)=>Up(e,n,r,{callee:e.parse}),e.safeParse=(n,r)=>Wp(e,n,r),e.parseAsync=async(n,r)=>Zp(e,n,r,{callee:e.parseAsync}),e.safeParseAsync=async(n,r)=>Vp(e,n,r),e.spa=e.safeParseAsync,e.encode=(n,r)=>Hp(e,n,r),e.decode=(n,r)=>qp(e,n,r),e.encodeAsync=async(n,r)=>Jp(e,n,r),e.decodeAsync=async(n,r)=>Kp(e,n,r),e.safeEncode=(n,r)=>Gp(e,n,r),e.safeDecode=(n,r)=>Yp(e,n,r),e.safeEncodeAsync=async(n,r)=>Xp(e,n,r),e.safeDecodeAsync=async(n,r)=>Qp(e,n,r),e.refine=(n,r)=>e.check(Km(n,r)),e.superRefine=n=>e.check(Gm(n)),e.overwrite=n=>e.check(fn(n)),e.optional=()=>ii(e),e.exactOptional=()=>Rm(e),e.nullable=()=>ai(e),e.nullish=()=>ii(ai(e)),e.nonoptional=n=>$m(e,n),e.array=()=>_e(e),e.or=n=>vt([e,n]),e.and=n=>Nm(e,n),e.transform=n=>li(e,Om(n)),e.default=n=>Dm(e,n),e.prefault=n=>Fm(e,n),e.catch=n=>Um(e,n),e.pipe=n=>li(e,n),e.readonly=()=>Vm(e),e.describe=n=>{const r=e.clone();return Nn.add(r,{description:n}),r},Object.defineProperty(e,"description",{get(){return Nn.get(e)?.description},configurable:!0}),e.meta=(...n)=>{if(n.length===0)return Nn.get(e);const r=e.clone();return Nn.add(r,n[0]),r},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e.apply=n=>n(e),e)),Ha=K("_ZodString",(e,t)=>{rs.init(e,t),Oe.init(e,t),e._zod.processJSONSchema=(r,o,s)=>up(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(qh(...r)),e.includes=(...r)=>e.check(Gh(...r)),e.startsWith=(...r)=>e.check(Yh(...r)),e.endsWith=(...r)=>e.check(Xh(...r)),e.min=(...r)=>e.check(mr(...r)),e.max=(...r)=>e.check($a(...r)),e.length=(...r)=>e.check(Ba(...r)),e.nonempty=(...r)=>e.check(mr(1,...r)),e.lowercase=r=>e.check(Jh(r)),e.uppercase=r=>e.check(Kh(r)),e.trim=()=>e.check(ep()),e.normalize=(...r)=>e.check(Qh(...r)),e.toLowerCase=()=>e.check(tp()),e.toUpperCase=()=>e.check(np()),e.slugify=()=>e.check(rp())}),em=K("ZodString",(e,t)=>{rs.init(e,t),Ha.init(e,t),e.email=n=>e.check(gh(tm,n)),e.url=n=>e.check(wh(nm,n)),e.jwt=n=>e.check(Mh(xm,n)),e.emoji=n=>e.check(_h(rm,n)),e.guid=n=>e.check(ei(oi,n)),e.uuid=n=>e.check(xh(Xn,n)),e.uuidv4=n=>e.check(vh(Xn,n)),e.uuidv6=n=>e.check(yh(Xn,n)),e.uuidv7=n=>e.check(bh(Xn,n)),e.nanoid=n=>e.check(kh(om,n)),e.guid=n=>e.check(ei(oi,n)),e.cuid=n=>e.check(Ch(sm,n)),e.cuid2=n=>e.check(Sh(im,n)),e.ulid=n=>e.check(jh(am,n)),e.base64=n=>e.check(Ih(pm,n)),e.base64url=n=>e.check(Rh(mm,n)),e.xid=n=>e.check(Eh(lm,n)),e.ksuid=n=>e.check(Nh(cm,n)),e.ipv4=n=>e.check(Th(um,n)),e.ipv6=n=>e.check(Ah(dm,n)),e.cidrv4=n=>e.check(zh(fm,n)),e.cidrv6=n=>e.check(Oh(hm,n)),e.e164=n=>e.check(Ph(gm,n)),e.datetime=n=>e.check(Rp(n)),e.date=n=>e.check(Mp(n)),e.time=n=>e.check(Lp(n)),e.duration=n=>e.check($p(n))});function B(e){return mh(em,e)}const Me=K("ZodStringFormat",(e,t)=>{Re.init(e,t),Ha.init(e,t)}),tm=K("ZodEmail",(e,t)=>{bf.init(e,t),Me.init(e,t)}),oi=K("ZodGUID",(e,t)=>{vf.init(e,t),Me.init(e,t)}),Xn=K("ZodUUID",(e,t)=>{yf.init(e,t),Me.init(e,t)}),nm=K("ZodURL",(e,t)=>{wf.init(e,t),Me.init(e,t)}),rm=K("ZodEmoji",(e,t)=>{_f.init(e,t),Me.init(e,t)}),om=K("ZodNanoID",(e,t)=>{kf.init(e,t),Me.init(e,t)}),sm=K("ZodCUID",(e,t)=>{Cf.init(e,t),Me.init(e,t)}),im=K("ZodCUID2",(e,t)=>{Sf.init(e,t),Me.init(e,t)}),am=K("ZodULID",(e,t)=>{jf.init(e,t),Me.init(e,t)}),lm=K("ZodXID",(e,t)=>{Ef.init(e,t),Me.init(e,t)}),cm=K("ZodKSUID",(e,t)=>{Nf.init(e,t),Me.init(e,t)}),um=K("ZodIPv4",(e,t)=>{If.init(e,t),Me.init(e,t)}),dm=K("ZodIPv6",(e,t)=>{Rf.init(e,t),Me.init(e,t)}),fm=K("ZodCIDRv4",(e,t)=>{Pf.init(e,t),Me.init(e,t)}),hm=K("ZodCIDRv6",(e,t)=>{Mf.init(e,t),Me.init(e,t)}),pm=K("ZodBase64",(e,t)=>{Df.init(e,t),Me.init(e,t)}),mm=K("ZodBase64URL",(e,t)=>{Ff.init(e,t),Me.init(e,t)}),gm=K("ZodE164",(e,t)=>{$f.init(e,t),Me.init(e,t)}),xm=K("ZodJWT",(e,t)=>{Uf.init(e,t),Me.init(e,t)}),qa=K("ZodNumber",(e,t)=>{Pa.init(e,t),Oe.init(e,t),e._zod.processJSONSchema=(r,o,s)=>dp(e,r,o),e.gt=(r,o)=>e.check(ni(r,o)),e.gte=(r,o)=>e.check(eo(r,o)),e.min=(r,o)=>e.check(eo(r,o)),e.lt=(r,o)=>e.check(ti(r,o)),e.lte=(r,o)=>e.check(Qr(r,o)),e.max=(r,o)=>e.check(Qr(r,o)),e.int=r=>e.check(si(r)),e.safe=r=>e.check(si(r)),e.positive=r=>e.check(ni(0,r)),e.nonnegative=r=>e.check(eo(0,r)),e.negative=r=>e.check(ti(0,r)),e.nonpositive=r=>e.check(Qr(0,r)),e.multipleOf=(r,o)=>e.check(ri(r,o)),e.step=(r,o)=>e.check(ri(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 he(e){return Bh(qa,e)}const vm=K("ZodNumberFormat",(e,t)=>{Zf.init(e,t),qa.init(e,t)});function si(e){return Uh(vm,e)}const ym=K("ZodBoolean",(e,t)=>{Wf.init(e,t),Oe.init(e,t),e._zod.processJSONSchema=(n,r,o)=>fp(e,n,r)});function Ue(e){return Zh(ym,e)}const bm=K("ZodNull",(e,t)=>{Vf.init(e,t),Oe.init(e,t),e._zod.processJSONSchema=(n,r,o)=>hp(e,n,r)});function So(e){return Wh(bm,e)}const wm=K("ZodUnknown",(e,t)=>{Hf.init(e,t),Oe.init(e,t),e._zod.processJSONSchema=(n,r,o)=>mp()});function jo(){return Vh(wm)}const _m=K("ZodNever",(e,t)=>{qf.init(e,t),Oe.init(e,t),e._zod.processJSONSchema=(n,r,o)=>pp(e,n,r)});function km(e){return Hh(_m,e)}const Cm=K("ZodArray",(e,t)=>{Jf.init(e,t),Oe.init(e,t),e._zod.processJSONSchema=(n,r,o)=>bp(e,n,r,o),e.element=t.element,e.min=(n,r)=>e.check(mr(n,r)),e.nonempty=n=>e.check(mr(1,n)),e.max=(n,r)=>e.check($a(n,r)),e.length=(n,r)=>e.check(Ba(n,r)),e.unwrap=()=>e.element});function _e(e,t){return op(Cm,e,t)}const Sm=K("ZodObject",(e,t)=>{Gf.init(e,t),Oe.init(e,t),e._zod.processJSONSchema=(n,r,o)=>wp(e,n,r,o),ke(e,"shape",()=>t.shape),e.keyof=()=>Ze(Object.keys(e._zod.def.shape)),e.catchall=n=>e.clone({...e._zod.def,catchall:n}),e.passthrough=()=>e.clone({...e._zod.def,catchall:jo()}),e.loose=()=>e.clone({...e._zod.def,catchall:jo()}),e.strict=()=>e.clone({...e._zod.def,catchall:km()}),e.strip=()=>e.clone({...e._zod.def,catchall:void 0}),e.extend=n=>pd(e,n),e.safeExtend=n=>md(e,n),e.merge=n=>gd(e,n),e.pick=n=>fd(e,n),e.omit=n=>hd(e,n),e.partial=(...n)=>xd(Ka,e,n[0]),e.required=(...n)=>vd(Ga,e,n[0])});function ne(e,t){const n={type:"object",shape:e??{},...de(t)};return new Sm(n)}const Ja=K("ZodUnion",(e,t)=>{La.init(e,t),Oe.init(e,t),e._zod.processJSONSchema=(n,r,o)=>_p(e,n,r,o),e.options=t.options});function vt(e,t){return new Ja({type:"union",options:e,...de(t)})}const jm=K("ZodDiscriminatedUnion",(e,t)=>{Ja.init(e,t),Yf.init(e,t)});function Bt(e,t,n){return new jm({type:"union",options:t,discriminator:e,...de(n)})}const Em=K("ZodIntersection",(e,t)=>{Xf.init(e,t),Oe.init(e,t),e._zod.processJSONSchema=(n,r,o)=>kp(e,n,r,o)});function Nm(e,t){return new Em({type:"intersection",left:e,right:t})}const Tm=K("ZodRecord",(e,t)=>{Qf.init(e,t),Oe.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Cp(e,n,r,o),e.keyType=t.keyType,e.valueType=t.valueType});function mt(e,t,n){return new Tm({type:"record",keyType:e,valueType:t,...de(n)})}const Eo=K("ZodEnum",(e,t)=>{eh.init(e,t),Oe.init(e,t),e._zod.processJSONSchema=(r,o,s)=>gp(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 Eo({...t,checks:[],...de(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 Eo({...t,checks:[],...de(o),entries:s})}});function Ze(e,t){const n=Array.isArray(e)?Object.fromEntries(e.map(r=>[r,r])):e;return new Eo({type:"enum",entries:n,...de(t)})}const Am=K("ZodLiteral",(e,t)=>{th.init(e,t),Oe.init(e,t),e._zod.processJSONSchema=(n,r,o)=>xp(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 xe(e,t){return new Am({type:"literal",values:Array.isArray(e)?e:[e],...de(t)})}const zm=K("ZodTransform",(e,t)=>{nh.init(e,t),Oe.init(e,t),e._zod.processJSONSchema=(n,r,o)=>yp(e,n),e._zod.parse=(n,r)=>{if(r.direction==="backward")throw new ya(e.constructor.name);n.addIssue=s=>{if(typeof s=="string")n.issues.push(In(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(In(i))}};const o=t.transform(n.value,n);return o instanceof Promise?o.then(s=>(n.value=s,n)):(n.value=o,n)}});function Om(e){return new zm({type:"transform",transform:e})}const Ka=K("ZodOptional",(e,t)=>{Fa.init(e,t),Oe.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Va(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function ii(e){return new Ka({type:"optional",innerType:e})}const Im=K("ZodExactOptional",(e,t)=>{rh.init(e,t),Oe.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Va(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function Rm(e){return new Im({type:"optional",innerType:e})}const Pm=K("ZodNullable",(e,t)=>{oh.init(e,t),Oe.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Sp(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function ai(e){return new Pm({type:"nullable",innerType:e})}const Mm=K("ZodDefault",(e,t)=>{sh.init(e,t),Oe.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Ep(e,n,r,o),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function Dm(e,t){return new Mm({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():ka(t)}})}const Lm=K("ZodPrefault",(e,t)=>{ih.init(e,t),Oe.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Np(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function Fm(e,t){return new Lm({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():ka(t)}})}const Ga=K("ZodNonOptional",(e,t)=>{ah.init(e,t),Oe.init(e,t),e._zod.processJSONSchema=(n,r,o)=>jp(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function $m(e,t){return new Ga({type:"nonoptional",innerType:e,...de(t)})}const Bm=K("ZodCatch",(e,t)=>{lh.init(e,t),Oe.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Tp(e,n,r,o),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function Um(e,t){return new Bm({type:"catch",innerType:e,catchValue:typeof t=="function"?t:()=>t})}const Zm=K("ZodPipe",(e,t)=>{ch.init(e,t),Oe.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Ap(e,n,r,o),e.in=t.in,e.out=t.out});function li(e,t){return new Zm({type:"pipe",in:e,out:t})}const Wm=K("ZodReadonly",(e,t)=>{uh.init(e,t),Oe.init(e,t),e._zod.processJSONSchema=(n,r,o)=>zp(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function Vm(e){return new Wm({type:"readonly",innerType:e})}const Hm=K("ZodLazy",(e,t)=>{dh.init(e,t),Oe.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Op(e,n,r,o),e.unwrap=()=>e._zod.def.getter()});function qm(e){return new Hm({type:"lazy",getter:e})}const Jm=K("ZodCustom",(e,t)=>{fh.init(e,t),Oe.init(e,t),e._zod.processJSONSchema=(n,r,o)=>vp(e,n)});function Km(e,t={}){return sp(Jm,e,t)}function Gm(e){return ip(e)}const an=qm(()=>vt([B(),he(),Ue(),So(),_e(an),mt(B(),an)]));function Ya(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function Ye(e,t){return e===null||typeof e!="object"||Array.isArray(e)?void 0:Object.getOwnPropertyDescriptor(e,t)?.value}const os=ne({type:B(),ttl:B().optional(),scope:B().optional()}),ss=ne({type:xe("text"),text:B(),cache_control:os.optional()}),Xa=ne({type:xe("thinking"),thinking:B(),signature:B().optional()}),Ym=ne({type:xe("think"),thinking:B(),signature:B().optional()}),Xm=ne({type:xe("base64"),media_type:B(),data:B()}),Qa=ne({type:xe("image"),source:Xm}),el=ne({type:xe("tool_use"),id:B(),name:B(),input:mt(B(),an)}),Qm=Bt("type",[ss,Qa]),eg=ne({type:xe("tool_result"),tool_use_id:B().optional(),content:vt([B(),_e(Qm)]),is_error:Ue().optional()}),tg=Bt("type",[ss,Xa,Qa,el,eg]),ng=vt([B(),_e(tg)]),rg=ne({role:Ze(["user","assistant"]),content:ng}),og=ne({type:xe("text"),text:B(),cache_control:os.optional()}),sg=ne({type:B(),properties:mt(B(),mt(B(),an)).optional(),required:_e(B()).optional(),additionalProperties:Ue().optional(),$schema:B().optional()}),ig=ne({name:B(),description:B().optional(),input_schema:sg.optional(),cache_control:os.optional()}),ag=Bt("type",[ne({type:xe("enabled"),budget_tokens:he()}),ne({type:xe("disabled")}),ne({type:xe("adaptive")})]),tl=ne({model:B(),messages:_e(rg),system:_e(og).optional(),tools:_e(ig).optional(),max_tokens:he().optional(),temperature:he().optional(),stream:Ue().optional(),thinking:ag.optional(),metadata:ne({user_id:B().optional()}).optional()}),is=Bt("type",[ss,Xa,Ym,el]),lg=ne({input_tokens:he().nullable().optional(),output_tokens:he().nullable().optional(),cache_creation_input_tokens:he().nullable().optional(),cache_read_input_tokens:he().nullable().optional()}).passthrough(),nl=ne({id:B(),type:xe("message"),model:B(),role:xe("assistant"),content:_e(is),stop_reason:B().nullable(),stop_sequence:B().nullable().optional(),usage:lg}).passthrough(),cg=ne({type:xe("message_start"),message:ne({id:B(),type:xe("message"),model:B(),role:xe("assistant"),content:_e(is),stop_reason:So(),stop_sequence:So(),usage:ne({input_tokens:he(),cache_creation_input_tokens:he().optional(),cache_read_input_tokens:he().optional()}).passthrough()})}),ug=ne({type:xe("content_block_start"),index:he(),content_block:is}),dg=Bt("type",[ne({type:xe("text_delta"),text:B()}),ne({type:xe("input_json_delta"),partial_json:B()}),ne({type:xe("thinking_delta"),thinking:B()}),ne({type:xe("signature_delta"),signature:B()})]),fg=ne({type:xe("content_block_delta"),index:he(),delta:dg}),hg=ne({type:xe("content_block_stop"),index:he()}),pg=ne({type:xe("message_delta"),delta:ne({stop_reason:B().nullable(),stop_sequence:B().nullable().optional()}),usage:ne({output_tokens:he(),input_tokens:he().optional(),cache_creation_input_tokens:he().optional(),cache_read_input_tokens:he().optional()}).passthrough()}),mg=ne({type:xe("message_stop")}),gg=ne({type:xe("ping")}),xg=ne({type:xe("error"),error:ne({type:B(),message:B()})}),vg=Bt("type",[cg,ug,fg,hg,pg,mg,gg,xg]),yg=vt([B(),_e(Bt("type",[ne({type:xe("text"),text:B()}),ne({type:xe("image_url"),image_url:ne({url:B(),detail:B().optional()})})]))]),rl=ne({role:Ze(["system","user","assistant","tool"]),content:yg,name:B().optional(),reasoning_content:B().optional(),thinking:B().optional(),think:B().optional()}),bg=ne({name:B(),arguments:B()}),ol=ne({index:he().optional(),id:B().optional(),type:xe("function").optional(),function:ne({name:B().optional(),arguments:B().optional()})});rl.extend({content:vt([B(),_e(ne({type:xe("text"),text:B()}))]).optional(),function_call:bg.optional(),tool_calls:_e(ol).optional()});const wg=ne({type:xe("function"),function:ne({name:B(),description:B().optional(),parameters:mt(B(),an)})}),sl=ne({model:B(),messages:_e(rl),temperature:he().optional(),max_tokens:he().optional(),stream:Ue().optional(),tools:_e(wg).optional(),tool_choice:vt([Ze(["auto","none","required"]),ne({type:xe("auto")}),ne({type:xe("none")}),ne({type:xe("function"),function:ne({name:B()})})]).optional(),user:B().optional()}),il=ne({role:Ze(["assistant"]).optional(),content:B().nullable().optional(),reasoning_content:B().nullable().optional(),thinking:B().nullable().optional(),think:B().nullable().optional(),function_call:ne({name:B().optional(),arguments:B().optional()}).nullable().optional(),tool_calls:_e(ne({index:he(),id:B().optional(),type:xe("function").optional(),function:ne({name:B().optional(),arguments:B().optional()})})).nullable().optional()}),_g=ne({index:he(),message:ne({role:Ze(["assistant"]),content:B().nullable(),reasoning_content:B().optional(),thinking:B().optional(),think:B().optional(),function_call:ne({name:B(),arguments:B()}).nullable().optional(),tool_calls:_e(ol).optional()}).optional(),delta:il.optional(),finish_reason:B().nullable()}),kg=ne({id:B(),object:xe("chat.completion"),created:he(),model:B(),choices:_e(_g),usage:ne({prompt_tokens:he().nullable().optional(),completion_tokens:he().nullable().optional(),total_tokens:he().nullable().optional()}).passthrough(),service_tier:B().nullable().optional(),system_fingerprint:B().nullable().optional()}).passthrough(),Cg=ne({id:B(),object:xe("chat.completion.chunk"),created:he(),model:B(),choices:_e(ne({index:he(),delta:il,finish_reason:B().nullable().optional()})),usage:ne({prompt_tokens:he().nullable().optional(),completion_tokens:he().nullable().optional(),total_tokens:he().nullable().optional()}).passthrough().nullable().optional()}).passthrough();function al(e){try{const t=JSON.parse(e),n=kg.safeParse(t);return n.success?n.data:null}catch{return null}}const ll=ne({index:he(),timestamp:he(),type:B(),data:an}),Sg=ne({chunks:_e(ll),truncated:Ue().optional().default(!1)}),ci=ne({id:he(),timestamp:B(),method:B(),path:B(),model:B().nullable(),sessionId:B().nullable(),rawRequestBody:B().nullable(),responseStatus:he().nullable(),responseText:B().nullable(),inputTokens:he().nullable(),outputTokens:he().nullable(),cacheCreationInputTokens:he().nullable(),cacheReadInputTokens:he().nullable(),elapsedMs:he().nullable(),streaming:Ue(),userAgent:B().nullable(),origin:B().nullable(),rawHeaders:mt(B(),B()).optional(),headers:mt(B(),B()).optional(),apiFormat:Ze(["anthropic","openai","unknown"]).default("unknown"),isTest:Ue().optional().default(!1),providerName:B().nullable().optional(),clientPort:he().nullable().optional(),clientPid:he().nullable().optional(),clientCwd:B().nullable().optional(),clientProjectFolder:B().nullable().optional(),streamingChunks:Sg.optional(),streamingChunksPath:B().nullable().optional(),error:B().nullable().optional()});ne({model:B()});ne({model:B().optional(),metadata:ne({user_id:B().optional()}).passthrough().optional()});const jg=ne({error:B()});async function Ot(e,t){const n=await e.json();return t.parse(n)}async function zn(e,t){try{const n=await e.json(),r=jg.safeParse(n);return r.success?r.data.error:t}catch{return t}}async function Bn(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 zn(o,s))}return Ot(o,t)}const xr=10,No=600,vr="time",cl=Ze(["time","full"]),Pr=ne({stripClaudeCodeBillingHeader:Ue(),hasSeenOnboarding:Ue().default(!1),slowResponseThresholdSeconds:he().int().min(0).max(No).default(xr),timeDisplayFormat:cl.default(vr)}),Tn="/api/config";async function Eg(e){return Bn(e,Pr,void 0,t=>`Failed to fetch ${e}: ${t.status}`)}async function to(e){return Bn(Tn,Pr,{method:"PATCH",headers:{"content-type":"application/json"},body:JSON.stringify(e)},t=>`PATCH failed with status ${t.status}`)}function ul(){const e=Yo(Tn,Eg,{revalidateOnFocus:!1,revalidateIfStale:!1}),{mutate:t}=xa(),n=e.data?.stripClaudeCodeBillingHeader??!1,r=e.data?.slowResponseThresholdSeconds??xr,o=e.data?.timeDisplayFormat??vr,s=u=>({stripClaudeCodeBillingHeader:e.data?.stripClaudeCodeBillingHeader??!1,hasSeenOnboarding:e.data?.hasSeenOnboarding??!1,slowResponseThresholdSeconds:e.data?.slowResponseThresholdSeconds??xr,timeDisplayFormat:e.data?.timeDisplayFormat??vr,...u}),i=async u=>{await t(Tn,to({stripClaudeCodeBillingHeader:u}),{optimisticData:s({stripClaudeCodeBillingHeader:u}),rollbackOnError:!0,revalidate:!1})},l=async u=>{await t(Tn,to({slowResponseThresholdSeconds:u}),{optimisticData:s({slowResponseThresholdSeconds:u}),rollbackOnError:!0,revalidate:!1})},c=async u=>{await t(Tn,to({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:l,setTimeDisplayFormat:c}}const dl=(...e)=>e.filter((t,n,r)=>!!t&&t.trim()!==""&&r.indexOf(t)===n).join(" ").trim();const Ng=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();const Tg=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(t,n,r)=>r?r.toUpperCase():n.toLowerCase());const ui=e=>{const t=Tg(e);return t.charAt(0).toUpperCase()+t.slice(1)};var Ag={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 zg=e=>{for(const t in e)if(t.startsWith("aria-")||t==="role"||t==="title")return!0;return!1};const Og=v.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:n=2,absoluteStrokeWidth:r,className:o="",children:s,iconNode:i,...l},c)=>v.createElement("svg",{ref:c,...Ag,width:t,height:t,stroke:e,strokeWidth:r?Number(n)*24/Number(t):n,className:dl("lucide",o),...!s&&!zg(l)&&{"aria-hidden":"true"},...l},[...i.map(([u,d])=>v.createElement(u,d)),...Array.isArray(s)?s:[s]]));const ge=(e,t)=>{const n=v.forwardRef(({className:r,...o},s)=>v.createElement(Og,{ref:s,iconNode:t,className:dl(`lucide-${Ng(ui(e))}`,`lucide-${e}`,r),...o}));return n.displayName=ui(e),n};const Ig=[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]],Rg=ge("arrow-down",Ig);const Pg=[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]],Mg=ge("arrow-left",Pg);const Dg=[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]],Lg=ge("arrow-up",Dg);const Fg=[["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"}]],$g=ge("brain",Fg);const Bg=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],Ut=ge("check",Bg);const Ug=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],hn=ge("chevron-down",Ug);const Zg=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],Un=ge("chevron-right",Zg);const Wg=[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]],Vg=ge("chevron-up",Wg);const Hg=[["path",{d:"m7 6 5 5 5-5",key:"1lc07p"}],["path",{d:"m7 13 5 5 5-5",key:"1d48rs"}]],qg=ge("chevrons-down",Hg);const Jg=[["path",{d:"m17 11-5-5-5 5",key:"e8nh98"}],["path",{d:"m17 18-5-5-5 5",key:"2avn1x"}]],Kg=ge("chevrons-up",Jg);const Gg=[["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"}]],Rn=ge("circle-alert",Gg);const Yg=[["path",{d:"M21.801 10A10 10 0 1 1 17 3.335",key:"yps3ct"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]],Xg=ge("circle-check-big",Yg);const Qg=[["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"}]],e0=ge("circle-question-mark",Qg);const t0=[["path",{d:"M12 6v6l4 2",key:"mmk7yg"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],Rt=ge("clock",t0);const n0=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M12 3v18",key:"108xh3"}]],r0=ge("columns-2",n0);const o0=[["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"}]],Zn=ge("copy",o0);const s0=[["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"}]],as=ge("download",s0);const i0=[["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"}]],fl=ge("external-link",i0);const a0=[["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"}]],ls=ge("eye-off",a0);const l0=[["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"}]],cs=ge("eye",l0);const c0=[["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"}]],u0=ge("file-diff",c0);const d0=[["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"}]],f0=ge("file-terminal",d0);const h0=[["path",{d:"m12 14 4-4",key:"9kzdfg"}],["path",{d:"M3.34 19a10 10 0 1 1 17.32 0",key:"19p75a"}]],p0=ge("gauge",h0);const m0=[["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"}]],g0=ge("git-compare-arrows",m0);const x0=[["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"}]],v0=ge("globe",x0);const y0=[["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"}]],b0=ge("history",y0);const w0=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],Pn=ge("loader-circle",w0);const _0=[["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"}]],k0=ge("lock",_0);const C0=[["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"}]],us=ge("message-square",C0);const S0=[["path",{d:"M5 12h14",key:"1ays0h"}]],j0=ge("minus",S0);const E0=[["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"}]],N0=ge("octagon-alert",E0);const T0=[["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"}]],A0=ge("pencil",T0);const z0=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],To=ge("plus",z0);const O0=[["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"}]],I0=ge("radio",O0);const R0=[["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"}]],P0=ge("rotate-ccw",R0);const M0=[["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"}]],hl=ge("rotate-cw",M0);const D0=[["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"}]],L0=ge("rows-3",D0);const F0=[["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"}]],$0=ge("scan",F0);const B0=[["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"}]],U0=ge("server",B0);const Z0=[["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"}]],W0=ge("settings",Z0);const V0=[["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"}]],pl=ge("trash-2",V0);const H0=[["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"}]],yr=ge("triangle-alert",H0);const q0=[["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"}]],J0=ge("upload",q0);const K0=[["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"}]],G0=ge("user",K0);const Y0=[["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"}]],X0=ge("wifi-off",Y0);const Q0=[["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"}]],ex=ge("wifi",Q0);const tx=[["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"}]],ds=ge("wrench",tx);const nx=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],ml=ge("x",nx);const rx=[["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"}]],Mn=ge("zap",rx),Ao="/api/config";async function ox(e){return Bn(e,Pr,void 0,t=>`Failed to fetch ${e}: ${t.status}`)}async function sx(e){return Bn(Ao,Pr,{method:"PATCH",headers:{"content-type":"application/json"},body:JSON.stringify(e)},t=>`PATCH failed with status ${t.status}`)}function ix(){const e=Yo(Ao,ox,{revalidateOnFocus:!1,revalidateIfStale:!1}),{mutate:t}=xa(),n=e.data?.hasSeenOnboarding??!1,r=async()=>{await t(Ao,sx({hasSeenOnboarding:!0}),{optimisticData:{stripClaudeCodeBillingHeader:e.data?.stripClaudeCodeBillingHeader??!1,hasSeenOnboarding:!0,slowResponseThresholdSeconds:e.data?.slowResponseThresholdSeconds??xr,timeDisplayFormat:e.data?.timeDisplayFormat??vr},rollbackOnError:!0,revalidate:!1})};return{hasSeenOnboarding:n,isLoading:e.isLoading,markSeen:r}}function ax(){const{hasSeenOnboarding:e,isLoading:t,markSeen:n}=ix();return t||e?null:a.jsxs("div",{role:"note","aria-label":"Onboarding tip",className:"mx-4 mt-2 mb-1 flex items-start gap-3 rounded-md border border-amber-500/30 bg-amber-500/5 px-4 py-3 text-sm",children:[a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsx("div",{className:"font-medium text-amber-600 dark:text-amber-400 mb-1",children:"Quick tour of the log tabs"}),a.jsxs("ul",{className:"space-y-0.5 text-muted-foreground text-xs leading-relaxed",children:[a.jsxs("li",{children:[a.jsx("strong",{children:"Request"})," / ",a.jsx("strong",{children:"Response"})," — structured views of what the proxy sent and received."]}),a.jsxs("li",{children:[a.jsx("strong",{children:"Headers"})," — request and response headers after proxy processing."]}),a.jsxs("li",{children:[a.jsx("strong",{children:"Raw Headers"})," / ",a.jsx("strong",{children:"Raw Request"})," /"," ",a.jsx("strong",{children:"Raw Response"})," — exact bytes from the upstream provider (visible in Full mode)."]})]})]}),a.jsxs("button",{type:"button",onClick:()=>{n()},className:"inline-flex items-center gap-1.5 text-xs h-8 px-3 rounded-md border border-amber-500/40 text-amber-700 dark:text-amber-300 hover:bg-amber-500/10 transition-colors shrink-0","aria-label":"Dismiss onboarding tip",children:[a.jsx(Ut,{className:"size-3.5"}),"Got it"]}),a.jsx("button",{type:"button",onClick:()=>{n()},className:"text-muted-foreground hover:text-foreground transition-colors shrink-0 p-1 -m-1","aria-label":"Dismiss",children:a.jsx(ml,{className:"size-3.5"})})]})}function Qn(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 no={exports:{}};var di;function lx(){return di||(di=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 p=typeof Qn=="function"&&Qn;if(!d&&p)return p(u,!0);if(l)return l(u,!0);var m=new Error("Cannot find module '"+u+"'");throw m.code="MODULE_NOT_FOUND",m}var h=o[u]={exports:{}};r[u][0].call(h.exports,function(g){var f=r[u][1][g];return i(f||g)},h,h.exports,n,r,o,s)}return o[u].exports}for(var l=typeof Qn=="function"&&Qn,c=0;c<s.length;c++)i(s[c]);return i})({1:[function(n,r,o){var s=n("./utils"),i=n("./support"),l="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";o.encode=function(c){for(var u,d,p,m,h,g,f,x=[],y=0,_=c.length,k=_,C=s.getTypeOf(c)!=="string";y<c.length;)k=_-y,p=C?(u=c[y++],d=y<_?c[y++]:0,y<_?c[y++]:0):(u=c.charCodeAt(y++),d=y<_?c.charCodeAt(y++):0,y<_?c.charCodeAt(y++):0),m=u>>2,h=(3&u)<<4|d>>4,g=1<k?(15&d)<<2|p>>6:64,f=2<k?63&p:64,x.push(l.charAt(m)+l.charAt(h)+l.charAt(g)+l.charAt(f));return x.join("")},o.decode=function(c){var u,d,p,m,h,g,f=0,x=0,y="data:";if(c.substr(0,y.length)===y)throw new Error("Invalid base64 input, it looks like a data url.");var _,k=3*(c=c.replace(/[^A-Za-z0-9+/=]/g,"")).length/4;if(c.charAt(c.length-1)===l.charAt(64)&&k--,c.charAt(c.length-2)===l.charAt(64)&&k--,k%1!=0)throw new Error("Invalid base64 input, bad content length.");for(_=i.uint8array?new Uint8Array(0|k):new Array(0|k);f<c.length;)u=l.indexOf(c.charAt(f++))<<2|(m=l.indexOf(c.charAt(f++)))>>4,d=(15&m)<<4|(h=l.indexOf(c.charAt(f++)))>>2,p=(3&h)<<6|(g=l.indexOf(c.charAt(f++))),_[x++]=u,h!==64&&(_[x++]=d),g!==64&&(_[x++]=p);return _}},{"./support":30,"./utils":32}],2:[function(n,r,o){var s=n("./external"),i=n("./stream/DataWorker"),l=n("./stream/Crc32Probe"),c=n("./stream/DataLengthProbe");function u(d,p,m,h,g){this.compressedSize=d,this.uncompressedSize=p,this.crc32=m,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")),p=this;return d.on("end",function(){if(this.streamInfo.data_length!==p.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,p,m){return d.pipe(new l).pipe(new c("uncompressedSize")).pipe(p.compressWorker(m)).pipe(new c("compressedSize")).withStreamInfo("compression",p)},r.exports=u},{"./external":6,"./stream/Crc32Probe":25,"./stream/DataLengthProbe":26,"./stream/DataWorker":27}],3:[function(n,r,o){var s=n("./stream/GenericWorker");o.STORE={magic:"\0\0",compressWorker:function(){return new s("STORE compression")},uncompressWorker:function(){return new s("STORE decompression")}},o.DEFLATE=n("./flate")},{"./flate":7,"./stream/GenericWorker":28}],4:[function(n,r,o){var s=n("./utils"),i=(function(){for(var l,c=[],u=0;u<256;u++){l=u;for(var d=0;d<8;d++)l=1&l?3988292384^l>>>1:l>>>1;c[u]=l}return c})();r.exports=function(l,c){return l!==void 0&&l.length?s.getTypeOf(l)!=="string"?(function(u,d,p,m){var h=i,g=m+p;u^=-1;for(var f=m;f<g;f++)u=u>>>8^h[255&(u^d[f])];return-1^u})(0|c,l,l.length,0):(function(u,d,p,m){var h=i,g=m+p;u^=-1;for(var f=m;f<g;f++)u=u>>>8^h[255&(u^d.charCodeAt(f))];return-1^u})(0|c,l,l.length,0):0}},{"./utils":32}],5:[function(n,r,o){o.base64=!1,o.binary=!1,o.dir=!1,o.createFolders=!0,o.date=null,o.compression=null,o.compressionOptions=null,o.comment=null,o.unixPermissions=null,o.dosPermissions=null},{}],6:[function(n,r,o){var s=null;s=typeof Promise<"u"?Promise:n("lie"),r.exports={Promise:s}},{lie:37}],7:[function(n,r,o){var s=typeof Uint8Array<"u"&&typeof Uint16Array<"u"&&typeof Uint32Array<"u",i=n("pako"),l=n("./utils"),c=n("./stream/GenericWorker"),u=s?"uint8array":"array";function d(p,m){c.call(this,"FlateWorker/"+p),this._pako=null,this._pakoAction=p,this._pakoOptions=m,this.meta={}}o.magic="\b\0",l.inherits(d,c),d.prototype.processChunk=function(p){this.meta=p.meta,this._pako===null&&this._createPako(),this._pako.push(l.transformTo(u,p.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 p=this;this._pako.onData=function(m){p.push({data:m,meta:p.meta})}},o.compressWorker=function(p){return new d("Deflate",p)},o.uncompressWorker=function(){return new d("Inflate",{})}},{"./stream/GenericWorker":28,"./utils":32,pako:38}],8:[function(n,r,o){function s(h,g){var f,x="";for(f=0;f<g;f++)x+=String.fromCharCode(255&h),h>>>=8;return x}function i(h,g,f,x,y,_){var k,C,S=h.file,z=h.compression,N=_!==u.utf8encode,A=l.transformTo("string",_(S.name)),O=l.transformTo("string",u.utf8encode(S.name)),R=S.comment,G=l.transformTo("string",_(R)),j=l.transformTo("string",u.utf8encode(R)),I=O.length!==S.name.length,b=j.length!==R.length,M="",V="",P="",F=S.dir,W=S.date,oe={crc32:0,compressedSize:0,uncompressedSize:0};g&&!f||(oe.crc32=h.crc32,oe.compressedSize=h.compressedSize,oe.uncompressedSize=h.uncompressedSize);var Z=0;g&&(Z|=8),N||!I&&!b||(Z|=2048);var U=0,te=0;F&&(U|=16),y==="UNIX"?(te=798,U|=(function(J,ue){var X=J;return J||(X=ue?16893:33204),(65535&X)<<16})(S.unixPermissions,F)):(te=20,U|=(function(J){return 63&(J||0)})(S.dosPermissions)),k=W.getUTCHours(),k<<=6,k|=W.getUTCMinutes(),k<<=5,k|=W.getUTCSeconds()/2,C=W.getUTCFullYear()-1980,C<<=4,C|=W.getUTCMonth()+1,C<<=5,C|=W.getUTCDate(),I&&(V=s(1,1)+s(d(A),4)+O,M+="up"+s(V.length,2)+V),b&&(P=s(1,1)+s(d(G),4)+j,M+="uc"+s(P.length,2)+P);var ee="";return ee+=`
|
|
41
|
-
\0`,ee+=s(Z,2),ee+=z.magic,ee+=s(k,2),ee+=s(C,2),ee+=s(oe.crc32,4),ee+=s(oe.compressedSize,4),ee+=s(oe.uncompressedSize,4),ee+=s(A.length,2),ee+=s(M.length,2),{fileRecord:p.LOCAL_FILE_HEADER+ee+A+M,dirRecord:p.CENTRAL_FILE_HEADER+s(te,2)+ee+s(G.length,2)+"\0\0\0\0"+s(U,4)+s(x,4)+A+M+G}}var l=n("../utils"),c=n("../stream/GenericWorker"),u=n("../utf8"),d=n("../crc32"),p=n("../signature");function m(h,g,f,x){c.call(this,"ZipFileWorker"),this.bytesWritten=0,this.zipComment=g,this.zipPlatform=f,this.encodeFileName=x,this.streamFiles=h,this.accumulate=!1,this.contentBuffer=[],this.dirRecords=[],this.currentSourceOffset=0,this.entriesCount=0,this.currentFile=null,this._sources=[]}l.inherits(m,c),m.prototype.push=function(h){var g=h.meta.percent||0,f=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:f?(g+100*(f-x-1))/f:100}}))},m.prototype.openedSource=function(h){this.currentSourceOffset=this.bytesWritten,this.currentFile=h.file.name;var g=this.streamFiles&&!h.file.dir;if(g){var f=i(h,g,!1,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);this.push({data:f.fileRecord,meta:{percent:0}})}else this.accumulate=!0},m.prototype.closedSource=function(h){this.accumulate=!1;var g=this.streamFiles&&!h.file.dir,f=i(h,g,!0,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);if(this.dirRecords.push(f.dirRecord),g)this.push({data:(function(x){return p.DATA_DESCRIPTOR+s(x.crc32,4)+s(x.compressedSize,4)+s(x.uncompressedSize,4)})(h),meta:{percent:100}});else for(this.push({data:f.fileRecord,meta:{percent:0}});this.contentBuffer.length;)this.push(this.contentBuffer.shift());this.currentFile=null},m.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 f=this.bytesWritten-h,x=(function(y,_,k,C,S){var z=l.transformTo("string",S(C));return p.CENTRAL_DIRECTORY_END+"\0\0\0\0"+s(y,2)+s(y,2)+s(_,4)+s(k,4)+s(z.length,2)+z})(this.dirRecords.length,f,h,this.zipComment,this.encodeFileName);this.push({data:x,meta:{percent:100}})},m.prototype.prepareNextSource=function(){this.previous=this._sources.shift(),this.openedSource(this.previous.streamInfo),this.isPaused?this.previous.pause():this.previous.resume()},m.prototype.registerPrevious=function(h){this._sources.push(h);var g=this;return h.on("data",function(f){g.processChunk(f)}),h.on("end",function(){g.closedSource(g.previous.streamInfo),g._sources.length?g.prepareNextSource():g.end()}),h.on("error",function(f){g.error(f)}),this},m.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))},m.prototype.error=function(h){var g=this._sources;if(!c.prototype.error.call(this,h))return!1;for(var f=0;f<g.length;f++)try{g[f].error(h)}catch{}return!0},m.prototype.lock=function(){c.prototype.lock.call(this);for(var h=this._sources,g=0;g<h.length;g++)h[g].lock()},r.exports=m},{"../crc32":4,"../signature":23,"../stream/GenericWorker":28,"../utf8":31,"../utils":32}],9:[function(n,r,o){var s=n("../compressions"),i=n("./ZipFileWorker");o.generateWorker=function(l,c,u){var d=new i(c.streamFiles,u,c.platform,c.encodeFileName),p=0;try{l.forEach(function(m,h){p++;var g=(function(_,k){var C=_||k,S=s[C];if(!S)throw new Error(C+" is not a valid compression method !");return S})(h.options.compression,c.compression),f=h.options.compressionOptions||c.compressionOptions||{},x=h.dir,y=h.date;h._compressWorker(g,f).withStreamInfo("file",{name:m,dir:x,date:y,comment:h.comment||"",unixPermissions:h.unixPermissions,dosPermissions:h.dosPermissions}).pipe(d)}),d.entriesCount=p}catch(m){d.error(m)}return d}},{"../compressions":3,"./ZipFileWorker":8}],10:[function(n,r,o){function s(){if(!(this instanceof s))return new s;if(arguments.length)throw new Error("The constructor with parameters has been removed in JSZip 3.0, please check the upgrade guide.");this.files=Object.create(null),this.comment=null,this.root="",this.clone=function(){var i=new s;for(var l in this)typeof this[l]!="function"&&(i[l]=this[l]);return i}}(s.prototype=n("./object")).loadAsync=n("./load"),s.support=n("./support"),s.defaults=n("./defaults"),s.version="3.10.1",s.loadAsync=function(i,l){return new s().loadAsync(i,l)},s.external=n("./external"),r.exports=s},{"./defaults":5,"./external":6,"./load":11,"./object":15,"./support":30}],11:[function(n,r,o){var s=n("./utils"),i=n("./external"),l=n("./utf8"),c=n("./zipEntries"),u=n("./stream/Crc32Probe"),d=n("./nodejsUtils");function p(m){return new i.Promise(function(h,g){var f=m.decompressed.getContentWorker().pipe(new u);f.on("error",function(x){g(x)}).on("end",function(){f.streamInfo.crc32!==m.decompressed.crc32?g(new Error("Corrupted zip : CRC32 mismatch")):h()}).resume()})}r.exports=function(m,h){var g=this;return h=s.extend(h||{},{base64:!1,checkCRC32:!1,optimizedBinaryString:!1,createFolders:!1,decodeFileName:l.utf8decode}),d.isNode&&d.isStream(m)?i.Promise.reject(new Error("JSZip can't accept a stream when loading a zip file.")):s.prepareContent("the loaded zip file",m,!0,h.optimizedBinaryString,h.base64).then(function(f){var x=new c(h);return x.load(f),x}).then(function(f){var x=[i.Promise.resolve(f)],y=f.files;if(h.checkCRC32)for(var _=0;_<y.length;_++)x.push(p(y[_]));return i.Promise.all(x)}).then(function(f){for(var x=f.shift(),y=x.files,_=0;_<y.length;_++){var k=y[_],C=k.fileNameStr,S=s.resolve(k.fileNameStr);g.file(S,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(S).unsafeOriginalName=C)}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 l(c,u){i.call(this,"Nodejs stream input adapter for "+c),this._upstreamEnded=!1,this._bindStream(u)}s.inherits(l,i),l.prototype._bindStream=function(c){var u=this;(this._stream=c).pause(),c.on("data",function(d){u.push({data:d,meta:{percent:0}})}).on("error",function(d){u.isPaused?this.generatedError=d:u.error(d)}).on("end",function(){u.isPaused?u._upstreamEnded=!0:u.end()})},l.prototype.pause=function(){return!!i.prototype.pause.call(this)&&(this._stream.pause(),!0)},l.prototype.resume=function(){return!!i.prototype.resume.call(this)&&(this._upstreamEnded?this.end():this._stream.resume(),!0)},r.exports=l},{"../stream/GenericWorker":28,"../utils":32}],13:[function(n,r,o){var s=n("readable-stream").Readable;function i(l,c,u){s.call(this,c),this._helper=l;var d=this;l.on("data",function(p,m){d.push(p)||d._helper.pause(),u&&u(m)}).on("error",function(p){d.emit("error",p)}).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(S,z,N){var A,O=l.getTypeOf(z),R=l.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&&(S=y(S)),R.createFolders&&(A=x(S))&&_.call(this,A,!0);var G=O==="string"&&R.binary===!1&&R.base64===!1;N&&N.binary!==void 0||(R.binary=!G),(z instanceof p&&z.uncompressedSize===0||R.dir||!z||z.length===0)&&(R.base64=!1,R.binary=!0,z="",R.compression="STORE",O="string");var j=null;j=z instanceof p||z instanceof c?z:g.isNode&&g.isStream(z)?new f(S,z):l.prepareContent(S,z,R.binary,R.optimizedBinaryString,R.base64);var I=new m(S,j,R);this.files[S]=I}var i=n("./utf8"),l=n("./utils"),c=n("./stream/GenericWorker"),u=n("./stream/StreamHelper"),d=n("./defaults"),p=n("./compressedObject"),m=n("./zipObject"),h=n("./generate"),g=n("./nodejsUtils"),f=n("./nodejs/NodejsStreamInputAdapter"),x=function(S){S.slice(-1)==="/"&&(S=S.substring(0,S.length-1));var z=S.lastIndexOf("/");return 0<z?S.substring(0,z):""},y=function(S){return S.slice(-1)!=="/"&&(S+="/"),S},_=function(S,z){return z=z!==void 0?z:d.createFolders,S=y(S),this.files[S]||s.call(this,S,null,{dir:!0,createFolders:z}),this.files[S]};function k(S){return Object.prototype.toString.call(S)==="[object RegExp]"}var C={load:function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},forEach:function(S){var z,N,A;for(z in this.files)A=this.files[z],(N=z.slice(this.root.length,z.length))&&z.slice(0,this.root.length)===this.root&&S(N,A)},filter:function(S){var z=[];return this.forEach(function(N,A){S(N,A)&&z.push(A)}),z},file:function(S,z,N){if(arguments.length!==1)return S=this.root+S,s.call(this,S,z,N),this;if(k(S)){var A=S;return this.filter(function(R,G){return!G.dir&&A.test(R)})}var O=this.files[this.root+S];return O&&!O.dir?O:null},folder:function(S){if(!S)return this;if(k(S))return this.filter(function(O,R){return R.dir&&S.test(O)});var z=this.root+S,N=_.call(this,z),A=this.clone();return A.root=N.name,A},remove:function(S){S=this.root+S;var z=this.files[S];if(z||(S.slice(-1)!=="/"&&(S+="/"),z=this.files[S]),z&&!z.dir)delete this.files[S];else for(var N=this.filter(function(O,R){return R.name.slice(0,S.length)===S}),A=0;A<N.length;A++)delete this.files[N[A].name];return this},generate:function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},generateInternalStream:function(S){var z,N={};try{if((N=l.extend(S||{},{streamFiles:!1,compression:"STORE",compressionOptions:null,type:"",platform:"DOS",comment:null,mimeType:"application/zip",encodeFileName:i.utf8encode})).type=N.type.toLowerCase(),N.compression=N.compression.toUpperCase(),N.type==="binarystring"&&(N.type="string"),!N.type)throw new Error("No output type specified.");l.checkSupport(N.type),N.platform!=="darwin"&&N.platform!=="freebsd"&&N.platform!=="linux"&&N.platform!=="sunos"||(N.platform="UNIX"),N.platform==="win32"&&(N.platform="DOS");var A=N.comment||this.comment||"";z=h.generateWorker(this,N,A)}catch(O){(z=new c("error")).error(O)}return new u(z,N.type||"string",N.mimeType)},generateAsync:function(S,z){return this.generateInternalStream(S).accumulate(z)},generateNodeStream:function(S,z){return(S=S||{}).type||(S.type="nodebuffer"),this.generateInternalStream(S).toNodejsStream(z)}};r.exports=C},{"./compressedObject":2,"./defaults":5,"./generate":9,"./nodejs/NodejsStreamInputAdapter":12,"./nodejsUtils":14,"./stream/GenericWorker":28,"./stream/StreamHelper":29,"./utf8":31,"./utils":32,"./zipObject":35}],16:[function(n,r,o){r.exports=n("stream")},{stream:void 0}],17:[function(n,r,o){var s=n("./DataReader");function i(l){s.call(this,l);for(var c=0;c<this.data.length;c++)l[c]=255&l[c]}n("../utils").inherits(i,s),i.prototype.byteAt=function(l){return this.data[this.zero+l]},i.prototype.lastIndexOfSignature=function(l){for(var c=l.charCodeAt(0),u=l.charCodeAt(1),d=l.charCodeAt(2),p=l.charCodeAt(3),m=this.length-4;0<=m;--m)if(this.data[m]===c&&this.data[m+1]===u&&this.data[m+2]===d&&this.data[m+3]===p)return m-this.zero;return-1},i.prototype.readAndCheckSignature=function(l){var c=l.charCodeAt(0),u=l.charCodeAt(1),d=l.charCodeAt(2),p=l.charCodeAt(3),m=this.readData(4);return c===m[0]&&u===m[1]&&d===m[2]&&p===m[3]},i.prototype.readData=function(l){if(this.checkOffset(l),l===0)return[];var c=this.data.slice(this.zero+this.index,this.zero+this.index+l);return this.index+=l,c},r.exports=i},{"../utils":32,"./DataReader":18}],18:[function(n,r,o){var s=n("../utils");function i(l){this.data=l,this.length=l.length,this.index=0,this.zero=0}i.prototype={checkOffset:function(l){this.checkIndex(this.index+l)},checkIndex:function(l){if(this.length<this.zero+l||l<0)throw new Error("End of data reached (data length = "+this.length+", asked index = "+l+"). Corrupted zip ?")},setIndex:function(l){this.checkIndex(l),this.index=l},skip:function(l){this.setIndex(this.index+l)},byteAt:function(){},readInt:function(l){var c,u=0;for(this.checkOffset(l),c=this.index+l-1;c>=this.index;c--)u=(u<<8)+this.byteAt(c);return this.index+=l,u},readString:function(l){return s.transformTo("string",this.readData(l))},readData:function(){},lastIndexOfSignature:function(){},readAndCheckSignature:function(){},readDate:function(){var l=this.readInt(4);return new Date(Date.UTC(1980+(l>>25&127),(l>>21&15)-1,l>>16&31,l>>11&31,l>>5&63,(31&l)<<1))}},r.exports=i},{"../utils":32}],19:[function(n,r,o){var s=n("./Uint8ArrayReader");function i(l){s.call(this,l)}n("../utils").inherits(i,s),i.prototype.readData=function(l){this.checkOffset(l);var c=this.data.slice(this.zero+this.index,this.zero+this.index+l);return this.index+=l,c},r.exports=i},{"../utils":32,"./Uint8ArrayReader":21}],20:[function(n,r,o){var s=n("./DataReader");function i(l){s.call(this,l)}n("../utils").inherits(i,s),i.prototype.byteAt=function(l){return this.data.charCodeAt(this.zero+l)},i.prototype.lastIndexOfSignature=function(l){return this.data.lastIndexOf(l)-this.zero},i.prototype.readAndCheckSignature=function(l){return l===this.readData(4)},i.prototype.readData=function(l){this.checkOffset(l);var c=this.data.slice(this.zero+this.index,this.zero+this.index+l);return this.index+=l,c},r.exports=i},{"../utils":32,"./DataReader":18}],21:[function(n,r,o){var s=n("./ArrayReader");function i(l){s.call(this,l)}n("../utils").inherits(i,s),i.prototype.readData=function(l){if(this.checkOffset(l),l===0)return new Uint8Array(0);var c=this.data.subarray(this.zero+this.index,this.zero+this.index+l);return this.index+=l,c},r.exports=i},{"../utils":32,"./ArrayReader":17}],22:[function(n,r,o){var s=n("../utils"),i=n("../support"),l=n("./ArrayReader"),c=n("./StringReader"),u=n("./NodeBufferReader"),d=n("./Uint8ArrayReader");r.exports=function(p){var m=s.getTypeOf(p);return s.checkSupport(m),m!=="string"||i.uint8array?m==="nodebuffer"?new u(p):i.uint8array?new d(s.transformTo("uint8array",p)):new l(s.transformTo("array",p)):new c(p)}},{"../support":30,"../utils":32,"./ArrayReader":17,"./NodeBufferReader":19,"./StringReader":20,"./Uint8ArrayReader":21}],23:[function(n,r,o){o.LOCAL_FILE_HEADER="PK",o.CENTRAL_FILE_HEADER="PK",o.CENTRAL_DIRECTORY_END="PK",o.ZIP64_CENTRAL_DIRECTORY_LOCATOR="PK\x07",o.ZIP64_CENTRAL_DIRECTORY_END="PK",o.DATA_DESCRIPTOR="PK\x07\b"},{}],24:[function(n,r,o){var s=n("./GenericWorker"),i=n("../utils");function l(c){s.call(this,"ConvertWorker to "+c),this.destType=c}i.inherits(l,s),l.prototype.processChunk=function(c){this.push({data:i.transformTo(this.destType,c.data),meta:c.meta})},r.exports=l},{"../utils":32,"./GenericWorker":28}],25:[function(n,r,o){var s=n("./GenericWorker"),i=n("../crc32");function l(){s.call(this,"Crc32Probe"),this.withStreamInfo("crc32",0)}n("../utils").inherits(l,s),l.prototype.processChunk=function(c){this.streamInfo.crc32=i(c.data,this.streamInfo.crc32||0),this.push(c)},r.exports=l},{"../crc32":4,"../utils":32,"./GenericWorker":28}],26:[function(n,r,o){var s=n("../utils"),i=n("./GenericWorker");function l(c){i.call(this,"DataLengthProbe for "+c),this.propName=c,this.withStreamInfo(c,0)}s.inherits(l,i),l.prototype.processChunk=function(c){if(c){var u=this.streamInfo[this.propName]||0;this.streamInfo[this.propName]=u+c.data.length}i.prototype.processChunk.call(this,c)},r.exports=l},{"../utils":32,"./GenericWorker":28}],27:[function(n,r,o){var s=n("../utils"),i=n("./GenericWorker");function l(c){i.call(this,"DataWorker");var u=this;this.dataIsReady=!1,this.index=0,this.max=0,this.data=null,this.type="",this._tickScheduled=!1,c.then(function(d){u.dataIsReady=!0,u.data=d,u.max=d&&d.length||0,u.type=s.getTypeOf(d),u.isPaused||u._tickAndRepeat()},function(d){u.error(d)})}s.inherits(l,i),l.prototype.cleanUp=function(){i.prototype.cleanUp.call(this),this.data=null},l.prototype.resume=function(){return!!i.prototype.resume.call(this)&&(!this._tickScheduled&&this.dataIsReady&&(this._tickScheduled=!0,s.delay(this._tickAndRepeat,[],this)),!0)},l.prototype._tickAndRepeat=function(){this._tickScheduled=!1,this.isPaused||this.isFinished||(this._tick(),this.isFinished||(s.delay(this._tickAndRepeat,[],this),this._tickScheduled=!0))},l.prototype._tick=function(){if(this.isPaused||this.isFinished)return!1;var c=null,u=Math.min(this.max,this.index+16384);if(this.index>=this.max)return this.end();switch(this.type){case"string":c=this.data.substring(this.index,u);break;case"uint8array":c=this.data.subarray(this.index,u);break;case"array":case"nodebuffer":c=this.data.slice(this.index,u)}return this.index=u,this.push({data:c,meta:{percent:this.max?this.index/this.max*100:0}})},r.exports=l},{"../utils":32,"./GenericWorker":28}],28:[function(n,r,o){function s(i){this.name=i||"default",this.streamInfo={},this.generatedError=null,this.extraStreamInfo={},this.isPaused=!0,this.isFinished=!1,this.isLocked=!1,this._listeners={data:[],end:[],error:[]},this.previous=null}s.prototype={push:function(i){this.emit("data",i)},end:function(){if(this.isFinished)return!1;this.flush();try{this.emit("end"),this.cleanUp(),this.isFinished=!0}catch(i){this.emit("error",i)}return!0},error:function(i){return!this.isFinished&&(this.isPaused?this.generatedError=i:(this.isFinished=!0,this.emit("error",i),this.previous&&this.previous.error(i),this.cleanUp()),!0)},on:function(i,l){return this._listeners[i].push(l),this},cleanUp:function(){this.streamInfo=this.generatedError=this.extraStreamInfo=null,this._listeners=[]},emit:function(i,l){if(this._listeners[i])for(var c=0;c<this._listeners[i].length;c++)this._listeners[i][c].call(this,l)},pipe:function(i){return i.registerPrevious(this)},registerPrevious:function(i){if(this.isLocked)throw new Error("The stream '"+this+"' has already been used.");this.streamInfo=i.streamInfo,this.mergeStreamInfo(),this.previous=i;var l=this;return i.on("data",function(c){l.processChunk(c)}),i.on("end",function(){l.end()}),i.on("error",function(c){l.error(c)}),this},pause:function(){return!this.isPaused&&!this.isFinished&&(this.isPaused=!0,this.previous&&this.previous.pause(),!0)},resume:function(){if(!this.isPaused||this.isFinished)return!1;var i=this.isPaused=!1;return this.generatedError&&(this.error(this.generatedError),i=!0),this.previous&&this.previous.resume(),!i},flush:function(){},processChunk:function(i){this.push(i)},withStreamInfo:function(i,l){return this.extraStreamInfo[i]=l,this.mergeStreamInfo(),this},mergeStreamInfo:function(){for(var i in this.extraStreamInfo)Object.prototype.hasOwnProperty.call(this.extraStreamInfo,i)&&(this.streamInfo[i]=this.extraStreamInfo[i])},lock:function(){if(this.isLocked)throw new Error("The stream '"+this+"' has already been used.");this.isLocked=!0,this.previous&&this.previous.lock()},toString:function(){var i="Worker "+this.name;return this.previous?this.previous+" -> "+i:i}},r.exports=s},{}],29:[function(n,r,o){var s=n("../utils"),i=n("./ConvertWorker"),l=n("./GenericWorker"),c=n("../base64"),u=n("../support"),d=n("../external"),p=null;if(u.nodestream)try{p=n("../nodejs/NodejsStreamOutputAdapter")}catch{}function m(g,f){return new d.Promise(function(x,y){var _=[],k=g._internalType,C=g._outputType,S=g._mimeType;g.on("data",function(z,N){_.push(z),f&&f(N)}).on("error",function(z){_=[],y(z)}).on("end",function(){try{var z=(function(N,A,O){switch(N){case"blob":return s.newBlob(s.transformTo("arraybuffer",A),O);case"base64":return c.encode(A);default:return s.transformTo(N,A)}})(C,(function(N,A){var O,R=0,G=null,j=0;for(O=0;O<A.length;O++)j+=A[O].length;switch(N){case"string":return A.join("");case"array":return Array.prototype.concat.apply([],A);case"uint8array":for(G=new Uint8Array(j),O=0;O<A.length;O++)G.set(A[O],R),R+=A[O].length;return G;case"nodebuffer":return Buffer.concat(A);default:throw new Error("concat : unsupported type '"+N+"'")}})(k,_),S);x(z)}catch(N){y(N)}_=[]}).resume()})}function h(g,f,x){var y=f;switch(f){case"blob":case"arraybuffer":y="uint8array";break;case"base64":y="string"}try{this._internalType=y,this._outputType=f,this._mimeType=x,s.checkSupport(y),this._worker=g.pipe(new i(y)),g.lock()}catch(_){this._worker=new l("error"),this._worker.error(_)}}h.prototype={accumulate:function(g){return m(this,g)},on:function(g,f){var x=this;return g==="data"?this._worker.on(g,function(y){f.call(x,y.data,y.meta)}):this._worker.on(g,function(){s.delay(f,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 p(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"),l=n("./nodejsUtils"),c=n("./stream/GenericWorker"),u=new Array(256),d=0;d<256;d++)u[d]=252<=d?6:248<=d?5:240<=d?4:224<=d?3:192<=d?2:1;u[254]=u[254]=1;function p(){c.call(this,"utf-8 decode"),this.leftOver=null}function m(){c.call(this,"utf-8 encode")}o.utf8encode=function(h){return i.nodebuffer?l.newBufferFrom(h,"utf-8"):(function(g){var f,x,y,_,k,C=g.length,S=0;for(_=0;_<C;_++)(64512&(x=g.charCodeAt(_)))==55296&&_+1<C&&(64512&(y=g.charCodeAt(_+1)))==56320&&(x=65536+(x-55296<<10)+(y-56320),_++),S+=x<128?1:x<2048?2:x<65536?3:4;for(f=i.uint8array?new Uint8Array(S):new Array(S),_=k=0;k<S;_++)(64512&(x=g.charCodeAt(_)))==55296&&_+1<C&&(64512&(y=g.charCodeAt(_+1)))==56320&&(x=65536+(x-55296<<10)+(y-56320),_++),x<128?f[k++]=x:(x<2048?f[k++]=192|x>>>6:(x<65536?f[k++]=224|x>>>12:(f[k++]=240|x>>>18,f[k++]=128|x>>>12&63),f[k++]=128|x>>>6&63),f[k++]=128|63&x);return f})(h)},o.utf8decode=function(h){return i.nodebuffer?s.transformTo("nodebuffer",h).toString("utf-8"):(function(g){var f,x,y,_,k=g.length,C=new Array(2*k);for(f=x=0;f<k;)if((y=g[f++])<128)C[x++]=y;else if(4<(_=u[y]))C[x++]=65533,f+=_-1;else{for(y&=_===2?31:_===3?15:7;1<_&&f<k;)y=y<<6|63&g[f++],_--;1<_?C[x++]=65533:y<65536?C[x++]=y:(y-=65536,C[x++]=55296|y>>10&1023,C[x++]=56320|1023&y)}return C.length!==x&&(C.subarray?C=C.subarray(0,x):C.length=x),s.applyFromCharCode(C)})(h=s.transformTo(i.uint8array?"uint8array":"array",h))},s.inherits(p,c),p.prototype.processChunk=function(h){var g=s.transformTo(i.uint8array?"uint8array":"array",h.data);if(this.leftOver&&this.leftOver.length){if(i.uint8array){var f=g;(g=new Uint8Array(f.length+this.leftOver.length)).set(this.leftOver,0),g.set(f,this.leftOver.length)}else g=this.leftOver.concat(g);this.leftOver=null}var x=(function(_,k){var C;for((k=k||_.length)>_.length&&(k=_.length),C=k-1;0<=C&&(192&_[C])==128;)C--;return C<0||C===0?k:C+u[_[C]]>k?C:k})(g),y=g;x!==g.length&&(i.uint8array?(y=g.subarray(0,x),this.leftOver=g.subarray(x,g.length)):(y=g.slice(0,x),this.leftOver=g.slice(x,g.length))),this.push({data:o.utf8decode(y),meta:h.meta})},p.prototype.flush=function(){this.leftOver&&this.leftOver.length&&(this.push({data:o.utf8decode(this.leftOver),meta:{}}),this.leftOver=null)},o.Utf8DecodeWorker=p,s.inherits(m,c),m.prototype.processChunk=function(h){this.push({data:o.utf8encode(h.data),meta:h.meta})},o.Utf8EncodeWorker=m},{"./nodejsUtils":14,"./stream/GenericWorker":28,"./support":30,"./utils":32}],32:[function(n,r,o){var s=n("./support"),i=n("./base64"),l=n("./nodejsUtils"),c=n("./external");function u(f){return f}function d(f,x){for(var y=0;y<f.length;++y)x[y]=255&f.charCodeAt(y);return x}n("setimmediate"),o.newBlob=function(f,x){o.checkSupport("blob");try{return new Blob([f],{type:x})}catch{try{var y=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);return y.append(f),y.getBlob(x)}catch{throw new Error("Bug : can't construct the Blob.")}}};var p={stringifyByChunk:function(f,x,y){var _=[],k=0,C=f.length;if(C<=y)return String.fromCharCode.apply(null,f);for(;k<C;)x==="array"||x==="nodebuffer"?_.push(String.fromCharCode.apply(null,f.slice(k,Math.min(k+y,C)))):_.push(String.fromCharCode.apply(null,f.subarray(k,Math.min(k+y,C)))),k+=y;return _.join("")},stringifyByChar:function(f){for(var x="",y=0;y<f.length;y++)x+=String.fromCharCode(f[y]);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,l.allocBuffer(1)).length===1}catch{return!1}})()}};function m(f){var x=65536,y=o.getTypeOf(f),_=!0;if(y==="uint8array"?_=p.applyCanBeUsed.uint8array:y==="nodebuffer"&&(_=p.applyCanBeUsed.nodebuffer),_)for(;1<x;)try{return p.stringifyByChunk(f,y,x)}catch{x=Math.floor(x/2)}return p.stringifyByChar(f)}function h(f,x){for(var y=0;y<f.length;y++)x[y]=f[y];return x}o.applyFromCharCode=m;var g={};g.string={string:u,array:function(f){return d(f,new Array(f.length))},arraybuffer:function(f){return g.string.uint8array(f).buffer},uint8array:function(f){return d(f,new Uint8Array(f.length))},nodebuffer:function(f){return d(f,l.allocBuffer(f.length))}},g.array={string:m,array:u,arraybuffer:function(f){return new Uint8Array(f).buffer},uint8array:function(f){return new Uint8Array(f)},nodebuffer:function(f){return l.newBufferFrom(f)}},g.arraybuffer={string:function(f){return m(new Uint8Array(f))},array:function(f){return h(new Uint8Array(f),new Array(f.byteLength))},arraybuffer:u,uint8array:function(f){return new Uint8Array(f)},nodebuffer:function(f){return l.newBufferFrom(new Uint8Array(f))}},g.uint8array={string:m,array:function(f){return h(f,new Array(f.length))},arraybuffer:function(f){return f.buffer},uint8array:u,nodebuffer:function(f){return l.newBufferFrom(f)}},g.nodebuffer={string:m,array:function(f){return h(f,new Array(f.length))},arraybuffer:function(f){return g.nodebuffer.uint8array(f).buffer},uint8array:function(f){return h(f,new Uint8Array(f.length))},nodebuffer:u},o.transformTo=function(f,x){if(x=x||"",!f)return x;o.checkSupport(f);var y=o.getTypeOf(x);return g[y][f](x)},o.resolve=function(f){for(var x=f.split("/"),y=[],_=0;_<x.length;_++){var k=x[_];k==="."||k===""&&_!==0&&_!==x.length-1||(k===".."?y.pop():y.push(k))}return y.join("/")},o.getTypeOf=function(f){return typeof f=="string"?"string":Object.prototype.toString.call(f)==="[object Array]"?"array":s.nodebuffer&&l.isBuffer(f)?"nodebuffer":s.uint8array&&f instanceof Uint8Array?"uint8array":s.arraybuffer&&f instanceof ArrayBuffer?"arraybuffer":void 0},o.checkSupport=function(f){if(!s[f.toLowerCase()])throw new Error(f+" is not supported by this platform")},o.MAX_VALUE_16BITS=65535,o.MAX_VALUE_32BITS=-1,o.pretty=function(f){var x,y,_="";for(y=0;y<(f||"").length;y++)_+="\\x"+((x=f.charCodeAt(y))<16?"0":"")+x.toString(16).toUpperCase();return _},o.delay=function(f,x,y){setImmediate(function(){f.apply(y||null,x||[])})},o.inherits=function(f,x){function y(){}y.prototype=x.prototype,f.prototype=new y},o.extend=function(){var f,x,y={};for(f=0;f<arguments.length;f++)for(x in arguments[f])Object.prototype.hasOwnProperty.call(arguments[f],x)&&y[x]===void 0&&(y[x]=arguments[f][x]);return y},o.prepareContent=function(f,x,y,_,k){return c.Promise.resolve(x).then(function(C){return s.blob&&(C instanceof Blob||["[object File]","[object Blob]"].indexOf(Object.prototype.toString.call(C))!==-1)&&typeof FileReader<"u"?new c.Promise(function(S,z){var N=new FileReader;N.onload=function(A){S(A.target.result)},N.onerror=function(A){z(A.target.error)},N.readAsArrayBuffer(C)}):C}).then(function(C){var S=o.getTypeOf(C);return S?(S==="arraybuffer"?C=o.transformTo("uint8array",C):S==="string"&&(k?C=i.decode(C):y&&_!==!0&&(C=(function(z){return d(z,s.uint8array?new Uint8Array(z.length):new Array(z.length))})(C))),C):c.Promise.reject(new Error("Can't read the data of '"+f+"'. Is it in a supported JavaScript type (String, Blob, ArrayBuffer, etc) ?"))})}},{"./base64":1,"./external":6,"./nodejsUtils":14,"./support":30,setimmediate:54}],33:[function(n,r,o){var s=n("./reader/readerFor"),i=n("./utils"),l=n("./signature"),c=n("./zipEntry"),u=n("./support");function d(p){this.files=[],this.loadOptions=p}d.prototype={checkSignature:function(p){if(!this.reader.readAndCheckSignature(p)){this.reader.index-=4;var m=this.reader.readString(4);throw new Error("Corrupted zip or bug: unexpected signature ("+i.pretty(m)+", expected "+i.pretty(p)+")")}},isSignature:function(p,m){var h=this.reader.index;this.reader.setIndex(p);var g=this.reader.readString(4)===m;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 p=this.reader.readData(this.zipCommentLength),m=u.uint8array?"uint8array":"array",h=i.transformTo(m,p);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 p,m,h,g=this.zip64EndOfCentralSize-44;0<g;)p=this.reader.readInt(2),m=this.reader.readInt(4),h=this.reader.readData(m),this.zip64ExtensibleData[p]={id:p,length:m,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 p,m;for(p=0;p<this.files.length;p++)m=this.files[p],this.reader.setIndex(m.localHeaderOffset),this.checkSignature(l.LOCAL_FILE_HEADER),m.readLocalPart(this.reader),m.handleUTF8(),m.processAttributes()},readCentralDir:function(){var p;for(this.reader.setIndex(this.centralDirOffset);this.reader.readAndCheckSignature(l.CENTRAL_FILE_HEADER);)(p=new c({zip64:this.zip64},this.loadOptions)).readCentralPart(this.reader),this.files.push(p);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 p=this.reader.lastIndexOfSignature(l.CENTRAL_DIRECTORY_END);if(p<0)throw this.isSignature(0,l.LOCAL_FILE_HEADER)?new Error("Corrupted zip: can't find end of central directory"):new Error("Can't find end of central directory : is this a zip file ? If it is, see https://stuk.github.io/jszip/documentation/howto/read_zip.html");this.reader.setIndex(p);var m=p;if(this.checkSignature(l.CENTRAL_DIRECTORY_END),this.readBlockEndOfCentral(),this.diskNumber===i.MAX_VALUE_16BITS||this.diskWithCentralDirStart===i.MAX_VALUE_16BITS||this.centralDirRecordsOnThisDisk===i.MAX_VALUE_16BITS||this.centralDirRecords===i.MAX_VALUE_16BITS||this.centralDirSize===i.MAX_VALUE_32BITS||this.centralDirOffset===i.MAX_VALUE_32BITS){if(this.zip64=!0,(p=this.reader.lastIndexOfSignature(l.ZIP64_CENTRAL_DIRECTORY_LOCATOR))<0)throw new Error("Corrupted zip: can't find the ZIP64 end of central directory locator");if(this.reader.setIndex(p),this.checkSignature(l.ZIP64_CENTRAL_DIRECTORY_LOCATOR),this.readBlockZip64EndOfCentralLocator(),!this.isSignature(this.relativeOffsetEndOfZip64CentralDir,l.ZIP64_CENTRAL_DIRECTORY_END)&&(this.relativeOffsetEndOfZip64CentralDir=this.reader.lastIndexOfSignature(l.ZIP64_CENTRAL_DIRECTORY_END),this.relativeOffsetEndOfZip64CentralDir<0))throw new Error("Corrupted zip: can't find the ZIP64 end of central directory");this.reader.setIndex(this.relativeOffsetEndOfZip64CentralDir),this.checkSignature(l.ZIP64_CENTRAL_DIRECTORY_END),this.readBlockZip64EndOfCentral()}var h=this.centralDirOffset+this.centralDirSize;this.zip64&&(h+=20,h+=12+this.zip64EndOfCentralSize);var g=m-h;if(0<g)this.isSignature(m,l.CENTRAL_FILE_HEADER)||(this.reader.zero=g);else if(g<0)throw new Error("Corrupted zip: missing "+Math.abs(g)+" bytes.")},prepareReader:function(p){this.reader=s(p)},load:function(p){this.prepareReader(p),this.readEndOfCentral(),this.readCentralDir(),this.readLocalFiles()}},r.exports=d},{"./reader/readerFor":22,"./signature":23,"./support":30,"./utils":32,"./zipEntry":34}],34:[function(n,r,o){var s=n("./reader/readerFor"),i=n("./utils"),l=n("./compressedObject"),c=n("./crc32"),u=n("./utf8"),d=n("./compressions"),p=n("./support");function m(h,g){this.options=h,this.loadOptions=g}m.prototype={isEncrypted:function(){return(1&this.bitFlag)==1},useUTF8:function(){return(2048&this.bitFlag)==2048},readLocalPart:function(h){var g,f;if(h.skip(22),this.fileNameLength=h.readInt(2),f=h.readInt(2),this.fileName=h.readData(this.fileNameLength),h.skip(f),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 y in d)if(Object.prototype.hasOwnProperty.call(d,y)&&d[y].magic===x)return d[y];return null})(this.compressionMethod))===null)throw new Error("Corrupted zip : compression "+i.pretty(this.compressionMethod)+" unknown (inner file : "+i.transformTo("string",this.fileName)+")");this.decompressed=new l(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,f,x,y=h.index+this.extraFieldsLength;for(this.extraFields||(this.extraFields={});h.index+4<y;)g=h.readInt(2),f=h.readInt(2),x=h.readData(f),this.extraFields[g]={id:g,length:f,value:x};h.setIndex(y)},handleUTF8:function(){var h=p.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 f=i.transformTo(h,this.fileName);this.fileNameStr=this.loadOptions.decodeFileName(f)}var x=this.findExtraFieldUnicodeComment();if(x!==null)this.fileCommentStr=x;else{var y=i.transformTo(h,this.fileComment);this.fileCommentStr=this.loadOptions.decodeFileName(y)}}},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=m},{"./compressedObject":2,"./compressions":3,"./crc32":4,"./reader/readerFor":22,"./support":30,"./utf8":31,"./utils":32}],35:[function(n,r,o){function s(g,f,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=f,this._dataBinary=x.binary,this.options={compression:x.compression,compressionOptions:x.compressionOptions}}var i=n("./stream/StreamHelper"),l=n("./stream/DataWorker"),c=n("./utf8"),u=n("./compressedObject"),d=n("./stream/GenericWorker");s.prototype={internalStream:function(g){var f=null,x="string";try{if(!g)throw new Error("No output type specified.");var y=(x=g.toLowerCase())==="string"||x==="text";x!=="binarystring"&&x!=="text"||(x="string"),f=this._decompressWorker();var _=!this._dataBinary;_&&!y&&(f=f.pipe(new c.Utf8EncodeWorker)),!_&&y&&(f=f.pipe(new c.Utf8DecodeWorker))}catch(k){(f=new d("error")).error(k)}return new i(f,x,"")},async:function(g,f){return this.internalStream(g).accumulate(f)},nodeStream:function(g,f){return this.internalStream(g||"nodebuffer").toNodejsStream(f)},_compressWorker:function(g,f){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,f)},_decompressWorker:function(){return this._data instanceof u?this._data.getContentWorker():this._data instanceof d?this._data:new l(this._data)}};for(var p=["asText","asBinary","asNodeBuffer","asUint8Array","asArrayBuffer"],m=function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},h=0;h<p.length;h++)s.prototype[p[h]]=m;r.exports=s},{"./compressedObject":2,"./stream/DataWorker":27,"./stream/GenericWorker":28,"./stream/StreamHelper":29,"./utf8":31}],36:[function(n,r,o){(function(s){var i,l,c=s.MutationObserver||s.WebKitMutationObserver;if(c){var u=0,d=new c(g),p=s.document.createTextNode("");d.observe(p,{characterData:!0}),i=function(){p.data=u=++u%2}}else if(s.setImmediate||s.MessageChannel===void 0)i="document"in s&&"onreadystatechange"in s.document.createElement("script")?function(){var f=s.document.createElement("script");f.onreadystatechange=function(){g(),f.onreadystatechange=null,f.parentNode.removeChild(f),f=null},s.document.documentElement.appendChild(f)}:function(){setTimeout(g,0)};else{var m=new s.MessageChannel;m.port1.onmessage=g,i=function(){m.port2.postMessage(0)}}var h=[];function g(){var f,x;l=!0;for(var y=h.length;y;){for(x=h,h=[],f=-1;++f<y;)x[f]();y=h.length}l=!1}r.exports=function(f){h.push(f)!==1||l||i()}}).call(this,typeof Kn<"u"?Kn:typeof self<"u"?self:typeof window<"u"?window:{})},{}],37:[function(n,r,o){var s=n("immediate");function i(){}var l={},c=["REJECTED"],u=["FULFILLED"],d=["PENDING"];function p(y){if(typeof y!="function")throw new TypeError("resolver must be a function");this.state=d,this.queue=[],this.outcome=void 0,y!==i&&f(this,y)}function m(y,_,k){this.promise=y,typeof _=="function"&&(this.onFulfilled=_,this.callFulfilled=this.otherCallFulfilled),typeof k=="function"&&(this.onRejected=k,this.callRejected=this.otherCallRejected)}function h(y,_,k){s(function(){var C;try{C=_(k)}catch(S){return l.reject(y,S)}C===y?l.reject(y,new TypeError("Cannot resolve promise with itself")):l.resolve(y,C)})}function g(y){var _=y&&y.then;if(y&&(typeof y=="object"||typeof y=="function")&&typeof _=="function")return function(){_.apply(y,arguments)}}function f(y,_){var k=!1;function C(N){k||(k=!0,l.reject(y,N))}function S(N){k||(k=!0,l.resolve(y,N))}var z=x(function(){_(S,C)});z.status==="error"&&C(z.value)}function x(y,_){var k={};try{k.value=y(_),k.status="success"}catch(C){k.status="error",k.value=C}return k}(r.exports=p).prototype.finally=function(y){if(typeof y!="function")return this;var _=this.constructor;return this.then(function(k){return _.resolve(y()).then(function(){return k})},function(k){return _.resolve(y()).then(function(){throw k})})},p.prototype.catch=function(y){return this.then(null,y)},p.prototype.then=function(y,_){if(typeof y!="function"&&this.state===u||typeof _!="function"&&this.state===c)return this;var k=new this.constructor(i);return this.state!==d?h(k,this.state===u?y:_,this.outcome):this.queue.push(new m(k,y,_)),k},m.prototype.callFulfilled=function(y){l.resolve(this.promise,y)},m.prototype.otherCallFulfilled=function(y){h(this.promise,this.onFulfilled,y)},m.prototype.callRejected=function(y){l.reject(this.promise,y)},m.prototype.otherCallRejected=function(y){h(this.promise,this.onRejected,y)},l.resolve=function(y,_){var k=x(g,_);if(k.status==="error")return l.reject(y,k.value);var C=k.value;if(C)f(y,C);else{y.state=u,y.outcome=_;for(var S=-1,z=y.queue.length;++S<z;)y.queue[S].callFulfilled(_)}return y},l.reject=function(y,_){y.state=c,y.outcome=_;for(var k=-1,C=y.queue.length;++k<C;)y.queue[k].callRejected(_);return y},p.resolve=function(y){return y instanceof this?y:l.resolve(new this(i),y)},p.reject=function(y){var _=new this(i);return l.reject(_,y)},p.all=function(y){var _=this;if(Object.prototype.toString.call(y)!=="[object Array]")return this.reject(new TypeError("must be an array"));var k=y.length,C=!1;if(!k)return this.resolve([]);for(var S=new Array(k),z=0,N=-1,A=new this(i);++N<k;)O(y[N],N);return A;function O(R,G){_.resolve(R).then(function(j){S[G]=j,++z!==k||C||(C=!0,l.resolve(A,S))},function(j){C||(C=!0,l.reject(A,j))})}},p.race=function(y){var _=this;if(Object.prototype.toString.call(y)!=="[object Array]")return this.reject(new TypeError("must be an array"));var k=y.length,C=!1;if(!k)return this.resolve([]);for(var S=-1,z=new this(i);++S<k;)N=y[S],_.resolve(N).then(function(A){C||(C=!0,l.resolve(z,A))},function(A){C||(C=!0,l.reject(z,A))});var N;return z}},{immediate:36}],38:[function(n,r,o){var s={};(0,n("./lib/utils/common").assign)(s,n("./lib/deflate"),n("./lib/inflate"),n("./lib/zlib/constants")),r.exports=s},{"./lib/deflate":39,"./lib/inflate":40,"./lib/utils/common":41,"./lib/zlib/constants":44}],39:[function(n,r,o){var s=n("./zlib/deflate"),i=n("./utils/common"),l=n("./utils/strings"),c=n("./zlib/messages"),u=n("./zlib/zstream"),d=Object.prototype.toString,p=0,m=-1,h=0,g=8;function f(y){if(!(this instanceof f))return new f(y);this.options=i.assign({level:m,method:g,chunkSize:16384,windowBits:15,memLevel:8,strategy:h,to:""},y||{});var _=this.options;_.raw&&0<_.windowBits?_.windowBits=-_.windowBits:_.gzip&&0<_.windowBits&&_.windowBits<16&&(_.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,_.level,_.method,_.windowBits,_.memLevel,_.strategy);if(k!==p)throw new Error(c[k]);if(_.header&&s.deflateSetHeader(this.strm,_.header),_.dictionary){var C;if(C=typeof _.dictionary=="string"?l.string2buf(_.dictionary):d.call(_.dictionary)==="[object ArrayBuffer]"?new Uint8Array(_.dictionary):_.dictionary,(k=s.deflateSetDictionary(this.strm,C))!==p)throw new Error(c[k]);this._dict_set=!0}}function x(y,_){var k=new f(_);if(k.push(y,!0),k.err)throw k.msg||c[k.err];return k.result}f.prototype.push=function(y,_){var k,C,S=this.strm,z=this.options.chunkSize;if(this.ended)return!1;C=_===~~_?_:_===!0?4:0,typeof y=="string"?S.input=l.string2buf(y):d.call(y)==="[object ArrayBuffer]"?S.input=new Uint8Array(y):S.input=y,S.next_in=0,S.avail_in=S.input.length;do{if(S.avail_out===0&&(S.output=new i.Buf8(z),S.next_out=0,S.avail_out=z),(k=s.deflate(S,C))!==1&&k!==p)return this.onEnd(k),!(this.ended=!0);S.avail_out!==0&&(S.avail_in!==0||C!==4&&C!==2)||(this.options.to==="string"?this.onData(l.buf2binstring(i.shrinkBuf(S.output,S.next_out))):this.onData(i.shrinkBuf(S.output,S.next_out)))}while((0<S.avail_in||S.avail_out===0)&&k!==1);return C===4?(k=s.deflateEnd(this.strm),this.onEnd(k),this.ended=!0,k===p):C!==2||(this.onEnd(p),!(S.avail_out=0))},f.prototype.onData=function(y){this.chunks.push(y)},f.prototype.onEnd=function(y){y===p&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=i.flattenChunks(this.chunks)),this.chunks=[],this.err=y,this.msg=this.strm.msg},o.Deflate=f,o.deflate=x,o.deflateRaw=function(y,_){return(_=_||{}).raw=!0,x(y,_)},o.gzip=function(y,_){return(_=_||{}).gzip=!0,x(y,_)}},{"./utils/common":41,"./utils/strings":42,"./zlib/deflate":46,"./zlib/messages":51,"./zlib/zstream":53}],40:[function(n,r,o){var s=n("./zlib/inflate"),i=n("./utils/common"),l=n("./utils/strings"),c=n("./zlib/constants"),u=n("./zlib/messages"),d=n("./zlib/zstream"),p=n("./zlib/gzheader"),m=Object.prototype.toString;function h(f){if(!(this instanceof h))return new h(f);this.options=i.assign({chunkSize:16384,windowBits:0,to:""},f||{});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)||f&&f.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 y=s.inflateInit2(this.strm,x.windowBits);if(y!==c.Z_OK)throw new Error(u[y]);this.header=new p,s.inflateGetHeader(this.strm,this.header)}function g(f,x){var y=new h(x);if(y.push(f,!0),y.err)throw y.msg||u[y.err];return y.result}h.prototype.push=function(f,x){var y,_,k,C,S,z,N=this.strm,A=this.options.chunkSize,O=this.options.dictionary,R=!1;if(this.ended)return!1;_=x===~~x?x:x===!0?c.Z_FINISH:c.Z_NO_FLUSH,typeof f=="string"?N.input=l.binstring2buf(f):m.call(f)==="[object ArrayBuffer]"?N.input=new Uint8Array(f):N.input=f,N.next_in=0,N.avail_in=N.input.length;do{if(N.avail_out===0&&(N.output=new i.Buf8(A),N.next_out=0,N.avail_out=A),(y=s.inflate(N,c.Z_NO_FLUSH))===c.Z_NEED_DICT&&O&&(z=typeof O=="string"?l.string2buf(O):m.call(O)==="[object ArrayBuffer]"?new Uint8Array(O):O,y=s.inflateSetDictionary(this.strm,z)),y===c.Z_BUF_ERROR&&R===!0&&(y=c.Z_OK,R=!1),y!==c.Z_STREAM_END&&y!==c.Z_OK)return this.onEnd(y),!(this.ended=!0);N.next_out&&(N.avail_out!==0&&y!==c.Z_STREAM_END&&(N.avail_in!==0||_!==c.Z_FINISH&&_!==c.Z_SYNC_FLUSH)||(this.options.to==="string"?(k=l.utf8border(N.output,N.next_out),C=N.next_out-k,S=l.buf2string(N.output,k),N.next_out=C,N.avail_out=A-C,C&&i.arraySet(N.output,N.output,k,C,0),this.onData(S)):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)&&y!==c.Z_STREAM_END);return y===c.Z_STREAM_END&&(_=c.Z_FINISH),_===c.Z_FINISH?(y=s.inflateEnd(this.strm),this.onEnd(y),this.ended=!0,y===c.Z_OK):_!==c.Z_SYNC_FLUSH||(this.onEnd(c.Z_OK),!(N.avail_out=0))},h.prototype.onData=function(f){this.chunks.push(f)},h.prototype.onEnd=function(f){f===c.Z_OK&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=i.flattenChunks(this.chunks)),this.chunks=[],this.err=f,this.msg=this.strm.msg},o.Inflate=h,o.inflate=g,o.inflateRaw=function(f,x){return(x=x||{}).raw=!0,g(f,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 p in d)d.hasOwnProperty(p)&&(c[p]=d[p])}}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,p,m){if(u.subarray&&c.subarray)c.set(u.subarray(d,d+p),m);else for(var h=0;h<p;h++)c[m+h]=u[d+h]},flattenChunks:function(c){var u,d,p,m,h,g;for(u=p=0,d=c.length;u<d;u++)p+=c[u].length;for(g=new Uint8Array(p),u=m=0,d=c.length;u<d;u++)h=c[u],g.set(h,m),m+=h.length;return g}},l={arraySet:function(c,u,d,p,m){for(var h=0;h<p;h++)c[m+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,l))},o.setTyped(s)},{}],42:[function(n,r,o){var s=n("./common"),i=!0,l=!0;try{String.fromCharCode.apply(null,[0])}catch{i=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch{l=!1}for(var c=new s.Buf8(256),u=0;u<256;u++)c[u]=252<=u?6:248<=u?5:240<=u?4:224<=u?3:192<=u?2:1;function d(p,m){if(m<65537&&(p.subarray&&l||!p.subarray&&i))return String.fromCharCode.apply(null,s.shrinkBuf(p,m));for(var h="",g=0;g<m;g++)h+=String.fromCharCode(p[g]);return h}c[254]=c[254]=1,o.string2buf=function(p){var m,h,g,f,x,y=p.length,_=0;for(f=0;f<y;f++)(64512&(h=p.charCodeAt(f)))==55296&&f+1<y&&(64512&(g=p.charCodeAt(f+1)))==56320&&(h=65536+(h-55296<<10)+(g-56320),f++),_+=h<128?1:h<2048?2:h<65536?3:4;for(m=new s.Buf8(_),f=x=0;x<_;f++)(64512&(h=p.charCodeAt(f)))==55296&&f+1<y&&(64512&(g=p.charCodeAt(f+1)))==56320&&(h=65536+(h-55296<<10)+(g-56320),f++),h<128?m[x++]=h:(h<2048?m[x++]=192|h>>>6:(h<65536?m[x++]=224|h>>>12:(m[x++]=240|h>>>18,m[x++]=128|h>>>12&63),m[x++]=128|h>>>6&63),m[x++]=128|63&h);return m},o.buf2binstring=function(p){return d(p,p.length)},o.binstring2buf=function(p){for(var m=new s.Buf8(p.length),h=0,g=m.length;h<g;h++)m[h]=p.charCodeAt(h);return m},o.buf2string=function(p,m){var h,g,f,x,y=m||p.length,_=new Array(2*y);for(h=g=0;h<y;)if((f=p[h++])<128)_[g++]=f;else if(4<(x=c[f]))_[g++]=65533,h+=x-1;else{for(f&=x===2?31:x===3?15:7;1<x&&h<y;)f=f<<6|63&p[h++],x--;1<x?_[g++]=65533:f<65536?_[g++]=f:(f-=65536,_[g++]=55296|f>>10&1023,_[g++]=56320|1023&f)}return d(_,g)},o.utf8border=function(p,m){var h;for((m=m||p.length)>p.length&&(m=p.length),h=m-1;0<=h&&(192&p[h])==128;)h--;return h<0||h===0?m:h+c[p[h]]>m?h:m}},{"./common":41}],43:[function(n,r,o){r.exports=function(s,i,l,c){for(var u=65535&s|0,d=s>>>16&65535|0,p=0;l!==0;){for(l-=p=2e3<l?2e3:l;d=d+(u=u+i[c++]|0)|0,--p;);u%=65521,d%=65521}return u|d<<16|0}},{}],44:[function(n,r,o){r.exports={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8}},{}],45:[function(n,r,o){var s=(function(){for(var i,l=[],c=0;c<256;c++){i=c;for(var u=0;u<8;u++)i=1&i?3988292384^i>>>1:i>>>1;l[c]=i}return l})();r.exports=function(i,l,c,u){var d=s,p=u+c;i^=-1;for(var m=u;m<p;m++)i=i>>>8^d[255&(i^l[m])];return-1^i}},{}],46:[function(n,r,o){var s,i=n("../utils/common"),l=n("./trees"),c=n("./adler32"),u=n("./crc32"),d=n("./messages"),p=0,m=4,h=0,g=-2,f=-1,x=4,y=2,_=8,k=9,C=286,S=30,z=19,N=2*C+1,A=15,O=3,R=258,G=R+O+1,j=42,I=113,b=1,M=2,V=3,P=4;function F(w,Y){return w.msg=d[Y],Y}function W(w){return(w<<1)-(4<w?9:0)}function oe(w){for(var Y=w.length;0<=--Y;)w[Y]=0}function Z(w){var Y=w.state,q=Y.pending;q>w.avail_out&&(q=w.avail_out),q!==0&&(i.arraySet(w.output,Y.pending_buf,Y.pending_out,q,w.next_out),w.next_out+=q,Y.pending_out+=q,w.total_out+=q,w.avail_out-=q,Y.pending-=q,Y.pending===0&&(Y.pending_out=0))}function U(w,Y){l._tr_flush_block(w,0<=w.block_start?w.block_start:-1,w.strstart-w.block_start,Y),w.block_start=w.strstart,Z(w.strm)}function te(w,Y){w.pending_buf[w.pending++]=Y}function ee(w,Y){w.pending_buf[w.pending++]=Y>>>8&255,w.pending_buf[w.pending++]=255&Y}function J(w,Y){var q,T,E=w.max_chain_length,L=w.strstart,$=w.prev_length,H=w.nice_match,D=w.strstart>w.w_size-G?w.strstart-(w.w_size-G):0,Q=w.window,se=w.w_mask,re=w.prev,me=w.strstart+R,Ae=Q[L+$-1],Ce=Q[L+$];w.prev_length>=w.good_match&&(E>>=2),H>w.lookahead&&(H=w.lookahead);do if(Q[(q=Y)+$]===Ce&&Q[q+$-1]===Ae&&Q[q]===Q[L]&&Q[++q]===Q[L+1]){L+=2,q++;do;while(Q[++L]===Q[++q]&&Q[++L]===Q[++q]&&Q[++L]===Q[++q]&&Q[++L]===Q[++q]&&Q[++L]===Q[++q]&&Q[++L]===Q[++q]&&Q[++L]===Q[++q]&&Q[++L]===Q[++q]&&L<me);if(T=R-(me-L),L=me-R,$<T){if(w.match_start=Y,H<=($=T))break;Ae=Q[L+$-1],Ce=Q[L+$]}}while((Y=re[Y&se])>D&&--E!=0);return $<=w.lookahead?$:w.lookahead}function ue(w){var Y,q,T,E,L,$,H,D,Q,se,re=w.w_size;do{if(E=w.window_size-w.lookahead-w.strstart,w.strstart>=re+(re-G)){for(i.arraySet(w.window,w.window,re,re,0),w.match_start-=re,w.strstart-=re,w.block_start-=re,Y=q=w.hash_size;T=w.head[--Y],w.head[Y]=re<=T?T-re:0,--q;);for(Y=q=re;T=w.prev[--Y],w.prev[Y]=re<=T?T-re:0,--q;);E+=re}if(w.strm.avail_in===0)break;if($=w.strm,H=w.window,D=w.strstart+w.lookahead,Q=E,se=void 0,se=$.avail_in,Q<se&&(se=Q),q=se===0?0:($.avail_in-=se,i.arraySet(H,$.input,$.next_in,se,D),$.state.wrap===1?$.adler=c($.adler,H,se,D):$.state.wrap===2&&($.adler=u($.adler,H,se,D)),$.next_in+=se,$.total_in+=se,se),w.lookahead+=q,w.lookahead+w.insert>=O)for(L=w.strstart-w.insert,w.ins_h=w.window[L],w.ins_h=(w.ins_h<<w.hash_shift^w.window[L+1])&w.hash_mask;w.insert&&(w.ins_h=(w.ins_h<<w.hash_shift^w.window[L+O-1])&w.hash_mask,w.prev[L&w.w_mask]=w.head[w.ins_h],w.head[w.ins_h]=L,L++,w.insert--,!(w.lookahead+w.insert<O)););}while(w.lookahead<G&&w.strm.avail_in!==0)}function X(w,Y){for(var q,T;;){if(w.lookahead<G){if(ue(w),w.lookahead<G&&Y===p)return b;if(w.lookahead===0)break}if(q=0,w.lookahead>=O&&(w.ins_h=(w.ins_h<<w.hash_shift^w.window[w.strstart+O-1])&w.hash_mask,q=w.prev[w.strstart&w.w_mask]=w.head[w.ins_h],w.head[w.ins_h]=w.strstart),q!==0&&w.strstart-q<=w.w_size-G&&(w.match_length=J(w,q)),w.match_length>=O)if(T=l._tr_tally(w,w.strstart-w.match_start,w.match_length-O),w.lookahead-=w.match_length,w.match_length<=w.max_lazy_match&&w.lookahead>=O){for(w.match_length--;w.strstart++,w.ins_h=(w.ins_h<<w.hash_shift^w.window[w.strstart+O-1])&w.hash_mask,q=w.prev[w.strstart&w.w_mask]=w.head[w.ins_h],w.head[w.ins_h]=w.strstart,--w.match_length!=0;);w.strstart++}else w.strstart+=w.match_length,w.match_length=0,w.ins_h=w.window[w.strstart],w.ins_h=(w.ins_h<<w.hash_shift^w.window[w.strstart+1])&w.hash_mask;else T=l._tr_tally(w,0,w.window[w.strstart]),w.lookahead--,w.strstart++;if(T&&(U(w,!1),w.strm.avail_out===0))return b}return w.insert=w.strstart<O-1?w.strstart:O-1,Y===m?(U(w,!0),w.strm.avail_out===0?V:P):w.last_lit&&(U(w,!1),w.strm.avail_out===0)?b:M}function ie(w,Y){for(var q,T,E;;){if(w.lookahead<G){if(ue(w),w.lookahead<G&&Y===p)return b;if(w.lookahead===0)break}if(q=0,w.lookahead>=O&&(w.ins_h=(w.ins_h<<w.hash_shift^w.window[w.strstart+O-1])&w.hash_mask,q=w.prev[w.strstart&w.w_mask]=w.head[w.ins_h],w.head[w.ins_h]=w.strstart),w.prev_length=w.match_length,w.prev_match=w.match_start,w.match_length=O-1,q!==0&&w.prev_length<w.max_lazy_match&&w.strstart-q<=w.w_size-G&&(w.match_length=J(w,q),w.match_length<=5&&(w.strategy===1||w.match_length===O&&4096<w.strstart-w.match_start)&&(w.match_length=O-1)),w.prev_length>=O&&w.match_length<=w.prev_length){for(E=w.strstart+w.lookahead-O,T=l._tr_tally(w,w.strstart-1-w.prev_match,w.prev_length-O),w.lookahead-=w.prev_length-1,w.prev_length-=2;++w.strstart<=E&&(w.ins_h=(w.ins_h<<w.hash_shift^w.window[w.strstart+O-1])&w.hash_mask,q=w.prev[w.strstart&w.w_mask]=w.head[w.ins_h],w.head[w.ins_h]=w.strstart),--w.prev_length!=0;);if(w.match_available=0,w.match_length=O-1,w.strstart++,T&&(U(w,!1),w.strm.avail_out===0))return b}else if(w.match_available){if((T=l._tr_tally(w,0,w.window[w.strstart-1]))&&U(w,!1),w.strstart++,w.lookahead--,w.strm.avail_out===0)return b}else w.match_available=1,w.strstart++,w.lookahead--}return w.match_available&&(T=l._tr_tally(w,0,w.window[w.strstart-1]),w.match_available=0),w.insert=w.strstart<O-1?w.strstart:O-1,Y===m?(U(w,!0),w.strm.avail_out===0?V:P):w.last_lit&&(U(w,!1),w.strm.avail_out===0)?b:M}function ae(w,Y,q,T,E){this.good_length=w,this.max_lazy=Y,this.nice_length=q,this.max_chain=T,this.func=E}function pe(){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=_,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*S+1)),this.bl_tree=new i.Buf16(2*(2*z+1)),oe(this.dyn_ltree),oe(this.dyn_dtree),oe(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new i.Buf16(A+1),this.heap=new i.Buf16(2*C+1),oe(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new i.Buf16(2*C+1),oe(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 fe(w){var Y;return w&&w.state?(w.total_in=w.total_out=0,w.data_type=y,(Y=w.state).pending=0,Y.pending_out=0,Y.wrap<0&&(Y.wrap=-Y.wrap),Y.status=Y.wrap?j:I,w.adler=Y.wrap===2?0:1,Y.last_flush=p,l._tr_init(Y),h):F(w,g)}function we(w){var Y=fe(w);return Y===h&&(function(q){q.window_size=2*q.w_size,oe(q.head),q.max_lazy_match=s[q.level].max_lazy,q.good_match=s[q.level].good_length,q.nice_match=s[q.level].nice_length,q.max_chain_length=s[q.level].max_chain,q.strstart=0,q.block_start=0,q.lookahead=0,q.insert=0,q.match_length=q.prev_length=O-1,q.match_available=0,q.ins_h=0})(w.state),Y}function Te(w,Y,q,T,E,L){if(!w)return g;var $=1;if(Y===f&&(Y=6),T<0?($=0,T=-T):15<T&&($=2,T-=16),E<1||k<E||q!==_||T<8||15<T||Y<0||9<Y||L<0||x<L)return F(w,g);T===8&&(T=9);var H=new pe;return(w.state=H).strm=w,H.wrap=$,H.gzhead=null,H.w_bits=T,H.w_size=1<<H.w_bits,H.w_mask=H.w_size-1,H.hash_bits=E+7,H.hash_size=1<<H.hash_bits,H.hash_mask=H.hash_size-1,H.hash_shift=~~((H.hash_bits+O-1)/O),H.window=new i.Buf8(2*H.w_size),H.head=new i.Buf16(H.hash_size),H.prev=new i.Buf16(H.w_size),H.lit_bufsize=1<<E+6,H.pending_buf_size=4*H.lit_bufsize,H.pending_buf=new i.Buf8(H.pending_buf_size),H.d_buf=1*H.lit_bufsize,H.l_buf=3*H.lit_bufsize,H.level=Y,H.strategy=L,H.method=q,we(w)}s=[new ae(0,0,0,0,function(w,Y){var q=65535;for(q>w.pending_buf_size-5&&(q=w.pending_buf_size-5);;){if(w.lookahead<=1){if(ue(w),w.lookahead===0&&Y===p)return b;if(w.lookahead===0)break}w.strstart+=w.lookahead,w.lookahead=0;var T=w.block_start+q;if((w.strstart===0||w.strstart>=T)&&(w.lookahead=w.strstart-T,w.strstart=T,U(w,!1),w.strm.avail_out===0)||w.strstart-w.block_start>=w.w_size-G&&(U(w,!1),w.strm.avail_out===0))return b}return w.insert=0,Y===m?(U(w,!0),w.strm.avail_out===0?V:P):(w.strstart>w.block_start&&(U(w,!1),w.strm.avail_out),b)}),new ae(4,4,8,4,X),new ae(4,5,16,8,X),new ae(4,6,32,32,X),new ae(4,4,16,16,ie),new ae(8,16,32,32,ie),new ae(8,16,128,128,ie),new ae(8,32,128,256,ie),new ae(32,128,258,1024,ie),new ae(32,258,258,4096,ie)],o.deflateInit=function(w,Y){return Te(w,Y,_,15,8,0)},o.deflateInit2=Te,o.deflateReset=we,o.deflateResetKeep=fe,o.deflateSetHeader=function(w,Y){return w&&w.state?w.state.wrap!==2?g:(w.state.gzhead=Y,h):g},o.deflate=function(w,Y){var q,T,E,L;if(!w||!w.state||5<Y||Y<0)return w?F(w,g):g;if(T=w.state,!w.output||!w.input&&w.avail_in!==0||T.status===666&&Y!==m)return F(w,w.avail_out===0?-5:g);if(T.strm=w,q=T.last_flush,T.last_flush=Y,T.status===j)if(T.wrap===2)w.adler=0,te(T,31),te(T,139),te(T,8),T.gzhead?(te(T,(T.gzhead.text?1:0)+(T.gzhead.hcrc?2:0)+(T.gzhead.extra?4:0)+(T.gzhead.name?8:0)+(T.gzhead.comment?16:0)),te(T,255&T.gzhead.time),te(T,T.gzhead.time>>8&255),te(T,T.gzhead.time>>16&255),te(T,T.gzhead.time>>24&255),te(T,T.level===9?2:2<=T.strategy||T.level<2?4:0),te(T,255&T.gzhead.os),T.gzhead.extra&&T.gzhead.extra.length&&(te(T,255&T.gzhead.extra.length),te(T,T.gzhead.extra.length>>8&255)),T.gzhead.hcrc&&(w.adler=u(w.adler,T.pending_buf,T.pending,0)),T.gzindex=0,T.status=69):(te(T,0),te(T,0),te(T,0),te(T,0),te(T,0),te(T,T.level===9?2:2<=T.strategy||T.level<2?4:0),te(T,3),T.status=I);else{var $=_+(T.w_bits-8<<4)<<8;$|=(2<=T.strategy||T.level<2?0:T.level<6?1:T.level===6?2:3)<<6,T.strstart!==0&&($|=32),$+=31-$%31,T.status=I,ee(T,$),T.strstart!==0&&(ee(T,w.adler>>>16),ee(T,65535&w.adler)),w.adler=1}if(T.status===69)if(T.gzhead.extra){for(E=T.pending;T.gzindex<(65535&T.gzhead.extra.length)&&(T.pending!==T.pending_buf_size||(T.gzhead.hcrc&&T.pending>E&&(w.adler=u(w.adler,T.pending_buf,T.pending-E,E)),Z(w),E=T.pending,T.pending!==T.pending_buf_size));)te(T,255&T.gzhead.extra[T.gzindex]),T.gzindex++;T.gzhead.hcrc&&T.pending>E&&(w.adler=u(w.adler,T.pending_buf,T.pending-E,E)),T.gzindex===T.gzhead.extra.length&&(T.gzindex=0,T.status=73)}else T.status=73;if(T.status===73)if(T.gzhead.name){E=T.pending;do{if(T.pending===T.pending_buf_size&&(T.gzhead.hcrc&&T.pending>E&&(w.adler=u(w.adler,T.pending_buf,T.pending-E,E)),Z(w),E=T.pending,T.pending===T.pending_buf_size)){L=1;break}L=T.gzindex<T.gzhead.name.length?255&T.gzhead.name.charCodeAt(T.gzindex++):0,te(T,L)}while(L!==0);T.gzhead.hcrc&&T.pending>E&&(w.adler=u(w.adler,T.pending_buf,T.pending-E,E)),L===0&&(T.gzindex=0,T.status=91)}else T.status=91;if(T.status===91)if(T.gzhead.comment){E=T.pending;do{if(T.pending===T.pending_buf_size&&(T.gzhead.hcrc&&T.pending>E&&(w.adler=u(w.adler,T.pending_buf,T.pending-E,E)),Z(w),E=T.pending,T.pending===T.pending_buf_size)){L=1;break}L=T.gzindex<T.gzhead.comment.length?255&T.gzhead.comment.charCodeAt(T.gzindex++):0,te(T,L)}while(L!==0);T.gzhead.hcrc&&T.pending>E&&(w.adler=u(w.adler,T.pending_buf,T.pending-E,E)),L===0&&(T.status=103)}else T.status=103;if(T.status===103&&(T.gzhead.hcrc?(T.pending+2>T.pending_buf_size&&Z(w),T.pending+2<=T.pending_buf_size&&(te(T,255&w.adler),te(T,w.adler>>8&255),w.adler=0,T.status=I)):T.status=I),T.pending!==0){if(Z(w),w.avail_out===0)return T.last_flush=-1,h}else if(w.avail_in===0&&W(Y)<=W(q)&&Y!==m)return F(w,-5);if(T.status===666&&w.avail_in!==0)return F(w,-5);if(w.avail_in!==0||T.lookahead!==0||Y!==p&&T.status!==666){var H=T.strategy===2?(function(D,Q){for(var se;;){if(D.lookahead===0&&(ue(D),D.lookahead===0)){if(Q===p)return b;break}if(D.match_length=0,se=l._tr_tally(D,0,D.window[D.strstart]),D.lookahead--,D.strstart++,se&&(U(D,!1),D.strm.avail_out===0))return b}return D.insert=0,Q===m?(U(D,!0),D.strm.avail_out===0?V:P):D.last_lit&&(U(D,!1),D.strm.avail_out===0)?b:M})(T,Y):T.strategy===3?(function(D,Q){for(var se,re,me,Ae,Ce=D.window;;){if(D.lookahead<=R){if(ue(D),D.lookahead<=R&&Q===p)return b;if(D.lookahead===0)break}if(D.match_length=0,D.lookahead>=O&&0<D.strstart&&(re=Ce[me=D.strstart-1])===Ce[++me]&&re===Ce[++me]&&re===Ce[++me]){Ae=D.strstart+R;do;while(re===Ce[++me]&&re===Ce[++me]&&re===Ce[++me]&&re===Ce[++me]&&re===Ce[++me]&&re===Ce[++me]&&re===Ce[++me]&&re===Ce[++me]&&me<Ae);D.match_length=R-(Ae-me),D.match_length>D.lookahead&&(D.match_length=D.lookahead)}if(D.match_length>=O?(se=l._tr_tally(D,1,D.match_length-O),D.lookahead-=D.match_length,D.strstart+=D.match_length,D.match_length=0):(se=l._tr_tally(D,0,D.window[D.strstart]),D.lookahead--,D.strstart++),se&&(U(D,!1),D.strm.avail_out===0))return b}return D.insert=0,Q===m?(U(D,!0),D.strm.avail_out===0?V:P):D.last_lit&&(U(D,!1),D.strm.avail_out===0)?b:M})(T,Y):s[T.level].func(T,Y);if(H!==V&&H!==P||(T.status=666),H===b||H===V)return w.avail_out===0&&(T.last_flush=-1),h;if(H===M&&(Y===1?l._tr_align(T):Y!==5&&(l._tr_stored_block(T,0,0,!1),Y===3&&(oe(T.head),T.lookahead===0&&(T.strstart=0,T.block_start=0,T.insert=0))),Z(w),w.avail_out===0))return T.last_flush=-1,h}return Y!==m?h:T.wrap<=0?1:(T.wrap===2?(te(T,255&w.adler),te(T,w.adler>>8&255),te(T,w.adler>>16&255),te(T,w.adler>>24&255),te(T,255&w.total_in),te(T,w.total_in>>8&255),te(T,w.total_in>>16&255),te(T,w.total_in>>24&255)):(ee(T,w.adler>>>16),ee(T,65535&w.adler)),Z(w),0<T.wrap&&(T.wrap=-T.wrap),T.pending!==0?h:1)},o.deflateEnd=function(w){var Y;return w&&w.state?(Y=w.state.status)!==j&&Y!==69&&Y!==73&&Y!==91&&Y!==103&&Y!==I&&Y!==666?F(w,g):(w.state=null,Y===I?F(w,-3):h):g},o.deflateSetDictionary=function(w,Y){var q,T,E,L,$,H,D,Q,se=Y.length;if(!w||!w.state||(L=(q=w.state).wrap)===2||L===1&&q.status!==j||q.lookahead)return g;for(L===1&&(w.adler=c(w.adler,Y,se,0)),q.wrap=0,se>=q.w_size&&(L===0&&(oe(q.head),q.strstart=0,q.block_start=0,q.insert=0),Q=new i.Buf8(q.w_size),i.arraySet(Q,Y,se-q.w_size,q.w_size,0),Y=Q,se=q.w_size),$=w.avail_in,H=w.next_in,D=w.input,w.avail_in=se,w.next_in=0,w.input=Y,ue(q);q.lookahead>=O;){for(T=q.strstart,E=q.lookahead-(O-1);q.ins_h=(q.ins_h<<q.hash_shift^q.window[T+O-1])&q.hash_mask,q.prev[T&q.w_mask]=q.head[q.ins_h],q.head[q.ins_h]=T,T++,--E;);q.strstart=T,q.lookahead=O-1,ue(q)}return q.strstart+=q.lookahead,q.block_start=q.strstart,q.insert=q.lookahead,q.lookahead=0,q.match_length=q.prev_length=O-1,q.match_available=0,w.next_in=H,w.input=D,w.avail_in=$,q.wrap=L,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 l,c,u,d,p,m,h,g,f,x,y,_,k,C,S,z,N,A,O,R,G,j,I,b,M;l=s.state,c=s.next_in,b=s.input,u=c+(s.avail_in-5),d=s.next_out,M=s.output,p=d-(i-s.avail_out),m=d+(s.avail_out-257),h=l.dmax,g=l.wsize,f=l.whave,x=l.wnext,y=l.window,_=l.hold,k=l.bits,C=l.lencode,S=l.distcode,z=(1<<l.lenbits)-1,N=(1<<l.distbits)-1;e:do{k<15&&(_+=b[c++]<<k,k+=8,_+=b[c++]<<k,k+=8),A=C[_&z];t:for(;;){if(_>>>=O=A>>>24,k-=O,(O=A>>>16&255)===0)M[d++]=65535&A;else{if(!(16&O)){if((64&O)==0){A=C[(65535&A)+(_&(1<<O)-1)];continue t}if(32&O){l.mode=12;break e}s.msg="invalid literal/length code",l.mode=30;break e}R=65535&A,(O&=15)&&(k<O&&(_+=b[c++]<<k,k+=8),R+=_&(1<<O)-1,_>>>=O,k-=O),k<15&&(_+=b[c++]<<k,k+=8,_+=b[c++]<<k,k+=8),A=S[_&N];n:for(;;){if(_>>>=O=A>>>24,k-=O,!(16&(O=A>>>16&255))){if((64&O)==0){A=S[(65535&A)+(_&(1<<O)-1)];continue n}s.msg="invalid distance code",l.mode=30;break e}if(G=65535&A,k<(O&=15)&&(_+=b[c++]<<k,(k+=8)<O&&(_+=b[c++]<<k,k+=8)),h<(G+=_&(1<<O)-1)){s.msg="invalid distance too far back",l.mode=30;break e}if(_>>>=O,k-=O,(O=d-p)<G){if(f<(O=G-O)&&l.sane){s.msg="invalid distance too far back",l.mode=30;break e}if(I=y,(j=0)===x){if(j+=g-O,O<R){for(R-=O;M[d++]=y[j++],--O;);j=d-G,I=M}}else if(x<O){if(j+=g+x-O,(O-=x)<R){for(R-=O;M[d++]=y[j++],--O;);if(j=0,x<R){for(R-=O=x;M[d++]=y[j++],--O;);j=d-G,I=M}}}else if(j+=x-O,O<R){for(R-=O;M[d++]=y[j++],--O;);j=d-G,I=M}for(;2<R;)M[d++]=I[j++],M[d++]=I[j++],M[d++]=I[j++],R-=3;R&&(M[d++]=I[j++],1<R&&(M[d++]=I[j++]))}else{for(j=d-G;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<m);c-=R=k>>3,_&=(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<m?m-d+257:257-(d-m),l.hold=_,l.bits=k}},{}],49:[function(n,r,o){var s=n("../utils/common"),i=n("./adler32"),l=n("./crc32"),c=n("./inffast"),u=n("./inftrees"),d=1,p=2,m=0,h=-2,g=1,f=852,x=592;function y(j){return(j>>>24&255)+(j>>>8&65280)+((65280&j)<<8)+((255&j)<<24)}function _(){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 I;return j&&j.state?(I=j.state,j.total_in=j.total_out=I.total=0,j.msg="",I.wrap&&(j.adler=1&I.wrap),I.mode=g,I.last=0,I.havedict=0,I.dmax=32768,I.head=null,I.hold=0,I.bits=0,I.lencode=I.lendyn=new s.Buf32(f),I.distcode=I.distdyn=new s.Buf32(x),I.sane=1,I.back=-1,m):h}function C(j){var I;return j&&j.state?((I=j.state).wsize=0,I.whave=0,I.wnext=0,k(j)):h}function S(j,I){var b,M;return j&&j.state?(M=j.state,I<0?(b=0,I=-I):(b=1+(I>>4),I<48&&(I&=15)),I&&(I<8||15<I)?h:(M.window!==null&&M.wbits!==I&&(M.window=null),M.wrap=b,M.wbits=I,C(j))):h}function z(j,I){var b,M;return j?(M=new _,(j.state=M).window=null,(b=S(j,I))!==m&&(j.state=null),b):h}var N,A,O=!0;function R(j){if(O){var I;for(N=new s.Buf32(512),A=new s.Buf32(32),I=0;I<144;)j.lens[I++]=8;for(;I<256;)j.lens[I++]=9;for(;I<280;)j.lens[I++]=7;for(;I<288;)j.lens[I++]=8;for(u(d,j.lens,0,288,N,0,j.work,{bits:9}),I=0;I<32;)j.lens[I++]=5;u(p,j.lens,0,32,A,0,j.work,{bits:5}),O=!1}j.lencode=N,j.lenbits=9,j.distcode=A,j.distbits=5}function G(j,I,b,M){var V,P=j.state;return P.window===null&&(P.wsize=1<<P.wbits,P.wnext=0,P.whave=0,P.window=new s.Buf8(P.wsize)),M>=P.wsize?(s.arraySet(P.window,I,b-P.wsize,P.wsize,0),P.wnext=0,P.whave=P.wsize):(M<(V=P.wsize-P.wnext)&&(V=M),s.arraySet(P.window,I,b-M,V,P.wnext),(M-=V)?(s.arraySet(P.window,I,b-M,M,0),P.wnext=M,P.whave=P.wsize):(P.wnext+=V,P.wnext===P.wsize&&(P.wnext=0),P.whave<P.wsize&&(P.whave+=V))),0}o.inflateReset=C,o.inflateReset2=S,o.inflateResetKeep=k,o.inflateInit=function(j){return z(j,15)},o.inflateInit2=z,o.inflate=function(j,I){var b,M,V,P,F,W,oe,Z,U,te,ee,J,ue,X,ie,ae,pe,fe,we,Te,w,Y,q,T,E=0,L=new s.Buf8(4),$=[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;(b=j.state).mode===12&&(b.mode=13),F=j.next_out,V=j.output,oe=j.avail_out,P=j.next_in,M=j.input,W=j.avail_in,Z=b.hold,U=b.bits,te=W,ee=oe,Y=m;e:for(;;)switch(b.mode){case g:if(b.wrap===0){b.mode=13;break}for(;U<16;){if(W===0)break e;W--,Z+=M[P++]<<U,U+=8}if(2&b.wrap&&Z===35615){L[b.check=0]=255&Z,L[1]=Z>>>8&255,b.check=l(b.check,L,2,0),U=Z=0,b.mode=2;break}if(b.flags=0,b.head&&(b.head.done=!1),!(1&b.wrap)||(((255&Z)<<8)+(Z>>8))%31){j.msg="incorrect header check",b.mode=30;break}if((15&Z)!=8){j.msg="unknown compression method",b.mode=30;break}if(U-=4,w=8+(15&(Z>>>=4)),b.wbits===0)b.wbits=w;else if(w>b.wbits){j.msg="invalid window size",b.mode=30;break}b.dmax=1<<w,j.adler=b.check=1,b.mode=512&Z?10:12,U=Z=0;break;case 2:for(;U<16;){if(W===0)break e;W--,Z+=M[P++]<<U,U+=8}if(b.flags=Z,(255&b.flags)!=8){j.msg="unknown compression method",b.mode=30;break}if(57344&b.flags){j.msg="unknown header flags set",b.mode=30;break}b.head&&(b.head.text=Z>>8&1),512&b.flags&&(L[0]=255&Z,L[1]=Z>>>8&255,b.check=l(b.check,L,2,0)),U=Z=0,b.mode=3;case 3:for(;U<32;){if(W===0)break e;W--,Z+=M[P++]<<U,U+=8}b.head&&(b.head.time=Z),512&b.flags&&(L[0]=255&Z,L[1]=Z>>>8&255,L[2]=Z>>>16&255,L[3]=Z>>>24&255,b.check=l(b.check,L,4,0)),U=Z=0,b.mode=4;case 4:for(;U<16;){if(W===0)break e;W--,Z+=M[P++]<<U,U+=8}b.head&&(b.head.xflags=255&Z,b.head.os=Z>>8),512&b.flags&&(L[0]=255&Z,L[1]=Z>>>8&255,b.check=l(b.check,L,2,0)),U=Z=0,b.mode=5;case 5:if(1024&b.flags){for(;U<16;){if(W===0)break e;W--,Z+=M[P++]<<U,U+=8}b.length=Z,b.head&&(b.head.extra_len=Z),512&b.flags&&(L[0]=255&Z,L[1]=Z>>>8&255,b.check=l(b.check,L,2,0)),U=Z=0}else b.head&&(b.head.extra=null);b.mode=6;case 6:if(1024&b.flags&&(W<(J=b.length)&&(J=W),J&&(b.head&&(w=b.head.extra_len-b.length,b.head.extra||(b.head.extra=new Array(b.head.extra_len)),s.arraySet(b.head.extra,M,P,J,w)),512&b.flags&&(b.check=l(b.check,M,J,P)),W-=J,P+=J,b.length-=J),b.length))break e;b.length=0,b.mode=7;case 7:if(2048&b.flags){if(W===0)break e;for(J=0;w=M[P+J++],b.head&&w&&b.length<65536&&(b.head.name+=String.fromCharCode(w)),w&&J<W;);if(512&b.flags&&(b.check=l(b.check,M,J,P)),W-=J,P+=J,w)break e}else b.head&&(b.head.name=null);b.length=0,b.mode=8;case 8:if(4096&b.flags){if(W===0)break e;for(J=0;w=M[P+J++],b.head&&w&&b.length<65536&&(b.head.comment+=String.fromCharCode(w)),w&&J<W;);if(512&b.flags&&(b.check=l(b.check,M,J,P)),W-=J,P+=J,w)break e}else b.head&&(b.head.comment=null);b.mode=9;case 9:if(512&b.flags){for(;U<16;){if(W===0)break e;W--,Z+=M[P++]<<U,U+=8}if(Z!==(65535&b.check)){j.msg="header crc mismatch",b.mode=30;break}U=Z=0}b.head&&(b.head.hcrc=b.flags>>9&1,b.head.done=!0),j.adler=b.check=0,b.mode=12;break;case 10:for(;U<32;){if(W===0)break e;W--,Z+=M[P++]<<U,U+=8}j.adler=b.check=y(Z),U=Z=0,b.mode=11;case 11:if(b.havedict===0)return j.next_out=F,j.avail_out=oe,j.next_in=P,j.avail_in=W,b.hold=Z,b.bits=U,2;j.adler=b.check=1,b.mode=12;case 12:if(I===5||I===6)break e;case 13:if(b.last){Z>>>=7&U,U-=7&U,b.mode=27;break}for(;U<3;){if(W===0)break e;W--,Z+=M[P++]<<U,U+=8}switch(b.last=1&Z,U-=1,3&(Z>>>=1)){case 0:b.mode=14;break;case 1:if(R(b),b.mode=20,I!==6)break;Z>>>=2,U-=2;break e;case 2:b.mode=17;break;case 3:j.msg="invalid block type",b.mode=30}Z>>>=2,U-=2;break;case 14:for(Z>>>=7&U,U-=7&U;U<32;){if(W===0)break e;W--,Z+=M[P++]<<U,U+=8}if((65535&Z)!=(Z>>>16^65535)){j.msg="invalid stored block lengths",b.mode=30;break}if(b.length=65535&Z,U=Z=0,b.mode=15,I===6)break e;case 15:b.mode=16;case 16:if(J=b.length){if(W<J&&(J=W),oe<J&&(J=oe),J===0)break e;s.arraySet(V,M,P,J,F),W-=J,P+=J,oe-=J,F+=J,b.length-=J;break}b.mode=12;break;case 17:for(;U<14;){if(W===0)break e;W--,Z+=M[P++]<<U,U+=8}if(b.nlen=257+(31&Z),Z>>>=5,U-=5,b.ndist=1+(31&Z),Z>>>=5,U-=5,b.ncode=4+(15&Z),Z>>>=4,U-=4,286<b.nlen||30<b.ndist){j.msg="too many length or distance symbols",b.mode=30;break}b.have=0,b.mode=18;case 18:for(;b.have<b.ncode;){for(;U<3;){if(W===0)break e;W--,Z+=M[P++]<<U,U+=8}b.lens[$[b.have++]]=7&Z,Z>>>=3,U-=3}for(;b.have<19;)b.lens[$[b.have++]]=0;if(b.lencode=b.lendyn,b.lenbits=7,q={bits:b.lenbits},Y=u(0,b.lens,0,19,b.lencode,0,b.work,q),b.lenbits=q.bits,Y){j.msg="invalid code lengths set",b.mode=30;break}b.have=0,b.mode=19;case 19:for(;b.have<b.nlen+b.ndist;){for(;ae=(E=b.lencode[Z&(1<<b.lenbits)-1])>>>16&255,pe=65535&E,!((ie=E>>>24)<=U);){if(W===0)break e;W--,Z+=M[P++]<<U,U+=8}if(pe<16)Z>>>=ie,U-=ie,b.lens[b.have++]=pe;else{if(pe===16){for(T=ie+2;U<T;){if(W===0)break e;W--,Z+=M[P++]<<U,U+=8}if(Z>>>=ie,U-=ie,b.have===0){j.msg="invalid bit length repeat",b.mode=30;break}w=b.lens[b.have-1],J=3+(3&Z),Z>>>=2,U-=2}else if(pe===17){for(T=ie+3;U<T;){if(W===0)break e;W--,Z+=M[P++]<<U,U+=8}U-=ie,w=0,J=3+(7&(Z>>>=ie)),Z>>>=3,U-=3}else{for(T=ie+7;U<T;){if(W===0)break e;W--,Z+=M[P++]<<U,U+=8}U-=ie,w=0,J=11+(127&(Z>>>=ie)),Z>>>=7,U-=7}if(b.have+J>b.nlen+b.ndist){j.msg="invalid bit length repeat",b.mode=30;break}for(;J--;)b.lens[b.have++]=w}}if(b.mode===30)break;if(b.lens[256]===0){j.msg="invalid code -- missing end-of-block",b.mode=30;break}if(b.lenbits=9,q={bits:b.lenbits},Y=u(d,b.lens,0,b.nlen,b.lencode,0,b.work,q),b.lenbits=q.bits,Y){j.msg="invalid literal/lengths set",b.mode=30;break}if(b.distbits=6,b.distcode=b.distdyn,q={bits:b.distbits},Y=u(p,b.lens,b.nlen,b.ndist,b.distcode,0,b.work,q),b.distbits=q.bits,Y){j.msg="invalid distances set",b.mode=30;break}if(b.mode=20,I===6)break e;case 20:b.mode=21;case 21:if(6<=W&&258<=oe){j.next_out=F,j.avail_out=oe,j.next_in=P,j.avail_in=W,b.hold=Z,b.bits=U,c(j,ee),F=j.next_out,V=j.output,oe=j.avail_out,P=j.next_in,M=j.input,W=j.avail_in,Z=b.hold,U=b.bits,b.mode===12&&(b.back=-1);break}for(b.back=0;ae=(E=b.lencode[Z&(1<<b.lenbits)-1])>>>16&255,pe=65535&E,!((ie=E>>>24)<=U);){if(W===0)break e;W--,Z+=M[P++]<<U,U+=8}if(ae&&(240&ae)==0){for(fe=ie,we=ae,Te=pe;ae=(E=b.lencode[Te+((Z&(1<<fe+we)-1)>>fe)])>>>16&255,pe=65535&E,!(fe+(ie=E>>>24)<=U);){if(W===0)break e;W--,Z+=M[P++]<<U,U+=8}Z>>>=fe,U-=fe,b.back+=fe}if(Z>>>=ie,U-=ie,b.back+=ie,b.length=pe,ae===0){b.mode=26;break}if(32&ae){b.back=-1,b.mode=12;break}if(64&ae){j.msg="invalid literal/length code",b.mode=30;break}b.extra=15&ae,b.mode=22;case 22:if(b.extra){for(T=b.extra;U<T;){if(W===0)break e;W--,Z+=M[P++]<<U,U+=8}b.length+=Z&(1<<b.extra)-1,Z>>>=b.extra,U-=b.extra,b.back+=b.extra}b.was=b.length,b.mode=23;case 23:for(;ae=(E=b.distcode[Z&(1<<b.distbits)-1])>>>16&255,pe=65535&E,!((ie=E>>>24)<=U);){if(W===0)break e;W--,Z+=M[P++]<<U,U+=8}if((240&ae)==0){for(fe=ie,we=ae,Te=pe;ae=(E=b.distcode[Te+((Z&(1<<fe+we)-1)>>fe)])>>>16&255,pe=65535&E,!(fe+(ie=E>>>24)<=U);){if(W===0)break e;W--,Z+=M[P++]<<U,U+=8}Z>>>=fe,U-=fe,b.back+=fe}if(Z>>>=ie,U-=ie,b.back+=ie,64&ae){j.msg="invalid distance code",b.mode=30;break}b.offset=pe,b.extra=15&ae,b.mode=24;case 24:if(b.extra){for(T=b.extra;U<T;){if(W===0)break e;W--,Z+=M[P++]<<U,U+=8}b.offset+=Z&(1<<b.extra)-1,Z>>>=b.extra,U-=b.extra,b.back+=b.extra}if(b.offset>b.dmax){j.msg="invalid distance too far back",b.mode=30;break}b.mode=25;case 25:if(oe===0)break e;if(J=ee-oe,b.offset>J){if((J=b.offset-J)>b.whave&&b.sane){j.msg="invalid distance too far back",b.mode=30;break}ue=J>b.wnext?(J-=b.wnext,b.wsize-J):b.wnext-J,J>b.length&&(J=b.length),X=b.window}else X=V,ue=F-b.offset,J=b.length;for(oe<J&&(J=oe),oe-=J,b.length-=J;V[F++]=X[ue++],--J;);b.length===0&&(b.mode=21);break;case 26:if(oe===0)break e;V[F++]=b.length,oe--,b.mode=21;break;case 27:if(b.wrap){for(;U<32;){if(W===0)break e;W--,Z|=M[P++]<<U,U+=8}if(ee-=oe,j.total_out+=ee,b.total+=ee,ee&&(j.adler=b.check=b.flags?l(b.check,V,ee,F-ee):i(b.check,V,ee,F-ee)),ee=oe,(b.flags?Z:y(Z))!==b.check){j.msg="incorrect data check",b.mode=30;break}U=Z=0}b.mode=28;case 28:if(b.wrap&&b.flags){for(;U<32;){if(W===0)break e;W--,Z+=M[P++]<<U,U+=8}if(Z!==(4294967295&b.total)){j.msg="incorrect length check",b.mode=30;break}U=Z=0}b.mode=29;case 29:Y=1;break e;case 30:Y=-3;break e;case 31:return-4;default:return h}return j.next_out=F,j.avail_out=oe,j.next_in=P,j.avail_in=W,b.hold=Z,b.bits=U,(b.wsize||ee!==j.avail_out&&b.mode<30&&(b.mode<27||I!==4))&&G(j,j.output,j.next_out,ee-j.avail_out)?(b.mode=31,-4):(te-=j.avail_in,ee-=j.avail_out,j.total_in+=te,j.total_out+=ee,b.total+=ee,b.wrap&&ee&&(j.adler=b.check=b.flags?l(b.check,V,ee,j.next_out-ee):i(b.check,V,ee,j.next_out-ee)),j.data_type=b.bits+(b.last?64:0)+(b.mode===12?128:0)+(b.mode===20||b.mode===15?256:0),(te==0&&ee===0||I===4)&&Y===m&&(Y=-5),Y)},o.inflateEnd=function(j){if(!j||!j.state)return h;var I=j.state;return I.window&&(I.window=null),j.state=null,m},o.inflateGetHeader=function(j,I){var b;return j&&j.state?(2&(b=j.state).wrap)==0?h:((b.head=I).done=!1,m):h},o.inflateSetDictionary=function(j,I){var b,M=I.length;return j&&j.state?(b=j.state).wrap!==0&&b.mode!==11?h:b.mode===11&&i(1,I,M,0)!==b.check?-3:G(j,I,M,M)?(b.mode=31,-4):(b.havedict=1,m):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],l=[16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78],c=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0],u=[16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64];r.exports=function(d,p,m,h,g,f,x,y){var _,k,C,S,z,N,A,O,R,G=y.bits,j=0,I=0,b=0,M=0,V=0,P=0,F=0,W=0,oe=0,Z=0,U=null,te=0,ee=new s.Buf16(16),J=new s.Buf16(16),ue=null,X=0;for(j=0;j<=15;j++)ee[j]=0;for(I=0;I<h;I++)ee[p[m+I]]++;for(V=G,M=15;1<=M&&ee[M]===0;M--);if(M<V&&(V=M),M===0)return g[f++]=20971520,g[f++]=20971520,y.bits=1,0;for(b=1;b<M&&ee[b]===0;b++);for(V<b&&(V=b),j=W=1;j<=15;j++)if(W<<=1,(W-=ee[j])<0)return-1;if(0<W&&(d===0||M!==1))return-1;for(J[1]=0,j=1;j<15;j++)J[j+1]=J[j]+ee[j];for(I=0;I<h;I++)p[m+I]!==0&&(x[J[p[m+I]]++]=I);if(N=d===0?(U=ue=x,19):d===1?(U=i,te-=257,ue=l,X-=257,256):(U=c,ue=u,-1),j=b,z=f,F=I=Z=0,C=-1,S=(oe=1<<(P=V))-1,d===1&&852<oe||d===2&&592<oe)return 1;for(;;){for(A=j-F,R=x[I]<N?(O=0,x[I]):x[I]>N?(O=ue[X+x[I]],U[te+x[I]]):(O=96,0),_=1<<j-F,b=k=1<<P;g[z+(Z>>F)+(k-=_)]=A<<24|O<<16|R|0,k!==0;);for(_=1<<j-1;Z&_;)_>>=1;if(_!==0?(Z&=_-1,Z+=_):Z=0,I++,--ee[j]==0){if(j===M)break;j=p[m+x[I]]}if(V<j&&(Z&S)!==C){for(F===0&&(F=V),z+=b,W=1<<(P=j-F);P+F<M&&!((W-=ee[P+F])<=0);)P++,W<<=1;if(oe+=1<<P,d===1&&852<oe||d===2&&592<oe)return 1;g[C=Z&S]=V<<24|P<<16|z-f|0}}return Z!==0&&(g[z+Z]=j-F<<24|64<<16|0),y.bits=V,0}},{"../utils/common":41}],51:[function(n,r,o){r.exports={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"}},{}],52:[function(n,r,o){var s=n("../utils/common"),i=0,l=1;function c(E){for(var L=E.length;0<=--L;)E[L]=0}var u=0,d=29,p=256,m=p+1+d,h=30,g=19,f=2*m+1,x=15,y=16,_=7,k=256,C=16,S=17,z=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],A=[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],O=[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],G=new Array(2*(m+2));c(G);var j=new Array(2*h);c(j);var I=new Array(512);c(I);var b=new Array(256);c(b);var M=new Array(d);c(M);var V,P,F,W=new Array(h);function oe(E,L,$,H,D){this.static_tree=E,this.extra_bits=L,this.extra_base=$,this.elems=H,this.max_length=D,this.has_stree=E&&E.length}function Z(E,L){this.dyn_tree=E,this.max_code=0,this.stat_desc=L}function U(E){return E<256?I[E]:I[256+(E>>>7)]}function te(E,L){E.pending_buf[E.pending++]=255&L,E.pending_buf[E.pending++]=L>>>8&255}function ee(E,L,$){E.bi_valid>y-$?(E.bi_buf|=L<<E.bi_valid&65535,te(E,E.bi_buf),E.bi_buf=L>>y-E.bi_valid,E.bi_valid+=$-y):(E.bi_buf|=L<<E.bi_valid&65535,E.bi_valid+=$)}function J(E,L,$){ee(E,$[2*L],$[2*L+1])}function ue(E,L){for(var $=0;$|=1&E,E>>>=1,$<<=1,0<--L;);return $>>>1}function X(E,L,$){var H,D,Q=new Array(x+1),se=0;for(H=1;H<=x;H++)Q[H]=se=se+$[H-1]<<1;for(D=0;D<=L;D++){var re=E[2*D+1];re!==0&&(E[2*D]=ue(Q[re]++,re))}}function ie(E){var L;for(L=0;L<m;L++)E.dyn_ltree[2*L]=0;for(L=0;L<h;L++)E.dyn_dtree[2*L]=0;for(L=0;L<g;L++)E.bl_tree[2*L]=0;E.dyn_ltree[2*k]=1,E.opt_len=E.static_len=0,E.last_lit=E.matches=0}function ae(E){8<E.bi_valid?te(E,E.bi_buf):0<E.bi_valid&&(E.pending_buf[E.pending++]=E.bi_buf),E.bi_buf=0,E.bi_valid=0}function pe(E,L,$,H){var D=2*L,Q=2*$;return E[D]<E[Q]||E[D]===E[Q]&&H[L]<=H[$]}function fe(E,L,$){for(var H=E.heap[$],D=$<<1;D<=E.heap_len&&(D<E.heap_len&&pe(L,E.heap[D+1],E.heap[D],E.depth)&&D++,!pe(L,H,E.heap[D],E.depth));)E.heap[$]=E.heap[D],$=D,D<<=1;E.heap[$]=H}function we(E,L,$){var H,D,Q,se,re=0;if(E.last_lit!==0)for(;H=E.pending_buf[E.d_buf+2*re]<<8|E.pending_buf[E.d_buf+2*re+1],D=E.pending_buf[E.l_buf+re],re++,H===0?J(E,D,L):(J(E,(Q=b[D])+p+1,L),(se=N[Q])!==0&&ee(E,D-=M[Q],se),J(E,Q=U(--H),$),(se=A[Q])!==0&&ee(E,H-=W[Q],se)),re<E.last_lit;);J(E,k,L)}function Te(E,L){var $,H,D,Q=L.dyn_tree,se=L.stat_desc.static_tree,re=L.stat_desc.has_stree,me=L.stat_desc.elems,Ae=-1;for(E.heap_len=0,E.heap_max=f,$=0;$<me;$++)Q[2*$]!==0?(E.heap[++E.heap_len]=Ae=$,E.depth[$]=0):Q[2*$+1]=0;for(;E.heap_len<2;)Q[2*(D=E.heap[++E.heap_len]=Ae<2?++Ae:0)]=1,E.depth[D]=0,E.opt_len--,re&&(E.static_len-=se[2*D+1]);for(L.max_code=Ae,$=E.heap_len>>1;1<=$;$--)fe(E,Q,$);for(D=me;$=E.heap[1],E.heap[1]=E.heap[E.heap_len--],fe(E,Q,1),H=E.heap[1],E.heap[--E.heap_max]=$,E.heap[--E.heap_max]=H,Q[2*D]=Q[2*$]+Q[2*H],E.depth[D]=(E.depth[$]>=E.depth[H]?E.depth[$]:E.depth[H])+1,Q[2*$+1]=Q[2*H+1]=D,E.heap[1]=D++,fe(E,Q,1),2<=E.heap_len;);E.heap[--E.heap_max]=E.heap[1],(function(Ce,Ge){var bn,ot,wn,De,qn,Xr,ut=Ge.dyn_tree,$s=Ge.max_code,ed=Ge.stat_desc.static_tree,td=Ge.stat_desc.has_stree,nd=Ge.stat_desc.extra_bits,Bs=Ge.stat_desc.extra_base,_n=Ge.stat_desc.max_length,Jn=0;for(De=0;De<=x;De++)Ce.bl_count[De]=0;for(ut[2*Ce.heap[Ce.heap_max]+1]=0,bn=Ce.heap_max+1;bn<f;bn++)_n<(De=ut[2*ut[2*(ot=Ce.heap[bn])+1]+1]+1)&&(De=_n,Jn++),ut[2*ot+1]=De,$s<ot||(Ce.bl_count[De]++,qn=0,Bs<=ot&&(qn=nd[ot-Bs]),Xr=ut[2*ot],Ce.opt_len+=Xr*(De+qn),td&&(Ce.static_len+=Xr*(ed[2*ot+1]+qn)));if(Jn!==0){do{for(De=_n-1;Ce.bl_count[De]===0;)De--;Ce.bl_count[De]--,Ce.bl_count[De+1]+=2,Ce.bl_count[_n]--,Jn-=2}while(0<Jn);for(De=_n;De!==0;De--)for(ot=Ce.bl_count[De];ot!==0;)$s<(wn=Ce.heap[--bn])||(ut[2*wn+1]!==De&&(Ce.opt_len+=(De-ut[2*wn+1])*ut[2*wn],ut[2*wn+1]=De),ot--)}})(E,L),X(Q,Ae,E.bl_count)}function w(E,L,$){var H,D,Q=-1,se=L[1],re=0,me=7,Ae=4;for(se===0&&(me=138,Ae=3),L[2*($+1)+1]=65535,H=0;H<=$;H++)D=se,se=L[2*(H+1)+1],++re<me&&D===se||(re<Ae?E.bl_tree[2*D]+=re:D!==0?(D!==Q&&E.bl_tree[2*D]++,E.bl_tree[2*C]++):re<=10?E.bl_tree[2*S]++:E.bl_tree[2*z]++,Q=D,Ae=(re=0)===se?(me=138,3):D===se?(me=6,3):(me=7,4))}function Y(E,L,$){var H,D,Q=-1,se=L[1],re=0,me=7,Ae=4;for(se===0&&(me=138,Ae=3),H=0;H<=$;H++)if(D=se,se=L[2*(H+1)+1],!(++re<me&&D===se)){if(re<Ae)for(;J(E,D,E.bl_tree),--re!=0;);else D!==0?(D!==Q&&(J(E,D,E.bl_tree),re--),J(E,C,E.bl_tree),ee(E,re-3,2)):re<=10?(J(E,S,E.bl_tree),ee(E,re-3,3)):(J(E,z,E.bl_tree),ee(E,re-11,7));Q=D,Ae=(re=0)===se?(me=138,3):D===se?(me=6,3):(me=7,4)}}c(W);var q=!1;function T(E,L,$,H){ee(E,(u<<1)+(H?1:0),3),(function(D,Q,se,re){ae(D),te(D,se),te(D,~se),s.arraySet(D.pending_buf,D.window,Q,se,D.pending),D.pending+=se})(E,L,$)}o._tr_init=function(E){q||((function(){var L,$,H,D,Q,se=new Array(x+1);for(D=H=0;D<d-1;D++)for(M[D]=H,L=0;L<1<<N[D];L++)b[H++]=D;for(b[H-1]=D,D=Q=0;D<16;D++)for(W[D]=Q,L=0;L<1<<A[D];L++)I[Q++]=D;for(Q>>=7;D<h;D++)for(W[D]=Q<<7,L=0;L<1<<A[D]-7;L++)I[256+Q++]=D;for($=0;$<=x;$++)se[$]=0;for(L=0;L<=143;)G[2*L+1]=8,L++,se[8]++;for(;L<=255;)G[2*L+1]=9,L++,se[9]++;for(;L<=279;)G[2*L+1]=7,L++,se[7]++;for(;L<=287;)G[2*L+1]=8,L++,se[8]++;for(X(G,m+1,se),L=0;L<h;L++)j[2*L+1]=5,j[2*L]=ue(L,5);V=new oe(G,N,p+1,m,x),P=new oe(j,A,0,h,x),F=new oe(new Array(0),O,0,g,_)})(),q=!0),E.l_desc=new Z(E.dyn_ltree,V),E.d_desc=new Z(E.dyn_dtree,P),E.bl_desc=new Z(E.bl_tree,F),E.bi_buf=0,E.bi_valid=0,ie(E)},o._tr_stored_block=T,o._tr_flush_block=function(E,L,$,H){var D,Q,se=0;0<E.level?(E.strm.data_type===2&&(E.strm.data_type=(function(re){var me,Ae=4093624447;for(me=0;me<=31;me++,Ae>>>=1)if(1&Ae&&re.dyn_ltree[2*me]!==0)return i;if(re.dyn_ltree[18]!==0||re.dyn_ltree[20]!==0||re.dyn_ltree[26]!==0)return l;for(me=32;me<p;me++)if(re.dyn_ltree[2*me]!==0)return l;return i})(E)),Te(E,E.l_desc),Te(E,E.d_desc),se=(function(re){var me;for(w(re,re.dyn_ltree,re.l_desc.max_code),w(re,re.dyn_dtree,re.d_desc.max_code),Te(re,re.bl_desc),me=g-1;3<=me&&re.bl_tree[2*R[me]+1]===0;me--);return re.opt_len+=3*(me+1)+5+5+4,me})(E),D=E.opt_len+3+7>>>3,(Q=E.static_len+3+7>>>3)<=D&&(D=Q)):D=Q=$+5,$+4<=D&&L!==-1?T(E,L,$,H):E.strategy===4||Q===D?(ee(E,2+(H?1:0),3),we(E,G,j)):(ee(E,4+(H?1:0),3),(function(re,me,Ae,Ce){var Ge;for(ee(re,me-257,5),ee(re,Ae-1,5),ee(re,Ce-4,4),Ge=0;Ge<Ce;Ge++)ee(re,re.bl_tree[2*R[Ge]+1],3);Y(re,re.dyn_ltree,me-1),Y(re,re.dyn_dtree,Ae-1)})(E,E.l_desc.max_code+1,E.d_desc.max_code+1,se+1),we(E,E.dyn_ltree,E.dyn_dtree)),ie(E),H&&ae(E)},o._tr_tally=function(E,L,$){return E.pending_buf[E.d_buf+2*E.last_lit]=L>>>8&255,E.pending_buf[E.d_buf+2*E.last_lit+1]=255&L,E.pending_buf[E.l_buf+E.last_lit]=255&$,E.last_lit++,L===0?E.dyn_ltree[2*$]++:(E.matches++,L--,E.dyn_ltree[2*(b[$]+p+1)]++,E.dyn_dtree[2*U(L)]++),E.last_lit===E.lit_bufsize-1},o._tr_align=function(E){ee(E,2,3),J(E,k,G),(function(L){L.bi_valid===16?(te(L,L.bi_buf),L.bi_buf=0,L.bi_valid=0):8<=L.bi_valid&&(L.pending_buf[L.pending++]=255&L.bi_buf,L.bi_buf>>=8,L.bi_valid-=8)})(E)}},{"../utils/common":41}],53:[function(n,r,o){r.exports=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}},{}],54:[function(n,r,o){(function(s){(function(i,l){if(!i.setImmediate){var c,u,d,p,m=1,h={},g=!1,f=i.document,x=Object.getPrototypeOf&&Object.getPrototypeOf(i);x=x&&x.setTimeout?x:i,c={}.toString.call(i.process)==="[object process]"?function(C){process.nextTick(function(){_(C)})}:(function(){if(i.postMessage&&!i.importScripts){var C=!0,S=i.onmessage;return i.onmessage=function(){C=!1},i.postMessage("","*"),i.onmessage=S,C}})()?(p="setImmediate$"+Math.random()+"$",i.addEventListener?i.addEventListener("message",k,!1):i.attachEvent("onmessage",k),function(C){i.postMessage(p+C,"*")}):i.MessageChannel?((d=new MessageChannel).port1.onmessage=function(C){_(C.data)},function(C){d.port2.postMessage(C)}):f&&"onreadystatechange"in f.createElement("script")?(u=f.documentElement,function(C){var S=f.createElement("script");S.onreadystatechange=function(){_(C),S.onreadystatechange=null,u.removeChild(S),S=null},u.appendChild(S)}):function(C){setTimeout(_,0,C)},x.setImmediate=function(C){typeof C!="function"&&(C=new Function(""+C));for(var S=new Array(arguments.length-1),z=0;z<S.length;z++)S[z]=arguments[z+1];var N={callback:C,args:S};return h[m]=N,c(m),m++},x.clearImmediate=y}function y(C){delete h[C]}function _(C){if(g)setTimeout(_,0,C);else{var S=h[C];if(S){g=!0;try{(function(z){var N=z.callback,A=z.args;switch(A.length){case 0:N();break;case 1:N(A[0]);break;case 2:N(A[0],A[1]);break;case 3:N(A[0],A[1],A[2]);break;default:N.apply(l,A)}})(S)}finally{y(C),g=!1}}}}function k(C){C.source===i&&typeof C.data=="string"&&C.data.indexOf(p)===0&&_(+C.data.slice(p.length))}})(typeof self>"u"?s===void 0?this:s:self)}).call(this,typeof Kn<"u"?Kn:typeof self<"u"?self:typeof window<"u"?window:{})},{}]},{},[10])(10)})})(no)),no.exports}var cx=lx();const ux=rd(cx);async function dx(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 fx(e){const t=new ux;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 l=await dx(i.id);l!==null&&t.file(`#${i.id}.SSE.Response.json`,l)}));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 zo(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 fs(e,t,n){return`${zo(e,n)} - ${zo(t,n)}`}function gl(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=gl(e[t]))&&(r&&(r+=" "),r+=n)}else for(n in e)e[n]&&(r&&(r+=" "),r+=n);return r}function xl(){for(var e,t,n=0,r="",o=arguments.length;n<o;n++)(e=arguments[n])&&(t=gl(e))&&(r&&(r+=" "),r+=t);return r}const hx=(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},px=(e,t)=>({classGroupId:e,validator:t}),vl=(e=new Map,t=null,n)=>({nextPart:e,validators:t,classGroupId:n}),br="-",fi=[],mx="arbitrary..",gx=e=>{const t=vx(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=e;return{getClassGroupId:i=>{if(i.startsWith("[")&&i.endsWith("]"))return xx(i);const l=i.split(br),c=l[0]===""&&l.length>1?1:0;return yl(l,c,t)},getConflictingClassGroupIds:(i,l)=>{if(l){const c=r[i],u=n[i];return c?u?hx(u,c):c:u||fi}return n[i]||fi}}},yl=(e,t,n)=>{if(e.length-t===0)return n.classGroupId;const o=e[t],s=n.nextPart.get(o);if(s){const u=yl(e,t+1,s);if(u)return u}const i=n.validators;if(i===null)return;const l=t===0?e.join(br):e.slice(t).join(br),c=i.length;for(let u=0;u<c;u++){const d=i[u];if(d.validator(l))return d.classGroupId}},xx=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?mx+r:void 0})(),vx=e=>{const{theme:t,classGroups:n}=e;return yx(n,t)},yx=(e,t)=>{const n=vl();for(const r in e){const o=e[r];hs(o,n,r,t)}return n},hs=(e,t,n,r)=>{const o=e.length;for(let s=0;s<o;s++){const i=e[s];bx(i,t,n,r)}},bx=(e,t,n,r)=>{if(typeof e=="string"){wx(e,t,n);return}if(typeof e=="function"){_x(e,t,n,r);return}kx(e,t,n,r)},wx=(e,t,n)=>{const r=e===""?t:bl(t,e);r.classGroupId=n},_x=(e,t,n,r)=>{if(Cx(e)){hs(e(r),t,n,r);return}t.validators===null&&(t.validators=[]),t.validators.push(px(n,e))},kx=(e,t,n,r)=>{const o=Object.entries(e),s=o.length;for(let i=0;i<s;i++){const[l,c]=o[i];hs(c,bl(t,l),n,r)}},bl=(e,t)=>{let n=e;const r=t.split(br),o=r.length;for(let s=0;s<o;s++){const i=r[s];let l=n.nextPart.get(i);l||(l=vl(),n.nextPart.set(i,l)),n=l}return n},Cx=e=>"isThemeGetter"in e&&e.isThemeGetter===!0,Sx=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)}}},Oo="!",hi=":",jx=[],pi=(e,t,n,r,o)=>({modifiers:e,hasImportantModifier:t,baseClassName:n,maybePostfixModifierPosition:r,isExternal:o}),Ex=e=>{const{prefix:t,experimentalParseClassName:n}=e;let r=o=>{const s=[];let i=0,l=0,c=0,u;const d=o.length;for(let f=0;f<d;f++){const x=o[f];if(i===0&&l===0){if(x===hi){s.push(o.slice(c,f)),c=f+1;continue}if(x==="/"){u=f;continue}}x==="["?i++:x==="]"?i--:x==="("?l++:x===")"&&l--}const p=s.length===0?o:o.slice(c);let m=p,h=!1;p.endsWith(Oo)?(m=p.slice(0,-1),h=!0):p.startsWith(Oo)&&(m=p.slice(1),h=!0);const g=u&&u>c?u-c:void 0;return pi(s,h,m,g)};if(t){const o=t+hi,s=r;r=i=>i.startsWith(o)?s(i.slice(o.length)):pi(jx,!1,i,void 0,!0)}if(n){const o=r;r=s=>n({className:s,parseClassName:o})}return r},Nx=e=>{const t=new Map;return e.orderSensitiveModifiers.forEach((n,r)=>{t.set(n,1e6+r)}),n=>{const r=[];let o=[];for(let s=0;s<n.length;s++){const i=n[s],l=i[0]==="[",c=t.has(i);l||c?(o.length>0&&(o.sort(),r.push(...o),o=[]),r.push(i)):o.push(i)}return o.length>0&&(o.sort(),r.push(...o)),r}},Tx=e=>({cache:Sx(e.cacheSize),parseClassName:Ex(e),sortModifiers:Nx(e),...gx(e)}),Ax=/\s+/,zx=(e,t)=>{const{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:o,sortModifiers:s}=t,i=[],l=e.trim().split(Ax);let c="";for(let u=l.length-1;u>=0;u-=1){const d=l[u],{isExternal:p,modifiers:m,hasImportantModifier:h,baseClassName:g,maybePostfixModifierPosition:f}=n(d);if(p){c=d+(c.length>0?" "+c:c);continue}let x=!!f,y=r(x?g.substring(0,f):g);if(!y){if(!x){c=d+(c.length>0?" "+c:c);continue}if(y=r(g),!y){c=d+(c.length>0?" "+c:c);continue}x=!1}const _=m.length===0?"":m.length===1?m[0]:s(m).join(":"),k=h?_+Oo:_,C=k+y;if(i.indexOf(C)>-1)continue;i.push(C);const S=o(y,x);for(let z=0;z<S.length;++z){const N=S[z];i.push(k+N)}c=d+(c.length>0?" "+c:c)}return c},Ox=(...e)=>{let t=0,n,r,o="";for(;t<e.length;)(n=e[t++])&&(r=wl(n))&&(o&&(o+=" "),o+=r);return o},wl=e=>{if(typeof e=="string")return e;let t,n="";for(let r=0;r<e.length;r++)e[r]&&(t=wl(e[r]))&&(n&&(n+=" "),n+=t);return n},Ix=(e,...t)=>{let n,r,o,s;const i=c=>{const u=t.reduce((d,p)=>p(d),e());return n=Tx(u),r=n.cache.get,o=n.cache.set,s=l,l(c)},l=c=>{const u=r(c);if(u)return u;const d=zx(c,n);return o(c,d),d};return s=i,(...c)=>s(Ox(...c))},Rx=[],Fe=e=>{const t=n=>n[e]||Rx;return t.isThemeGetter=!0,t},_l=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,kl=/^\((?:(\w[\w-]*):)?(.+)\)$/i,Px=/^\d+\/\d+$/,Mx=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,Dx=/\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$/,Lx=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,Fx=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,$x=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Ht=e=>Px.test(e),be=e=>!!e&&!Number.isNaN(Number(e)),yt=e=>!!e&&Number.isInteger(Number(e)),ro=e=>e.endsWith("%")&&be(e.slice(0,-1)),dt=e=>Mx.test(e),Bx=()=>!0,Ux=e=>Dx.test(e)&&!Lx.test(e),Cl=()=>!1,Zx=e=>Fx.test(e),Wx=e=>$x.test(e),Vx=e=>!le(e)&&!ce(e),Hx=e=>pn(e,El,Cl),le=e=>_l.test(e),zt=e=>pn(e,Nl,Ux),oo=e=>pn(e,Yx,be),mi=e=>pn(e,Sl,Cl),qx=e=>pn(e,jl,Wx),er=e=>pn(e,Tl,Zx),ce=e=>kl.test(e),kn=e=>mn(e,Nl),Jx=e=>mn(e,Xx),gi=e=>mn(e,Sl),Kx=e=>mn(e,El),Gx=e=>mn(e,jl),tr=e=>mn(e,Tl,!0),pn=(e,t,n)=>{const r=_l.exec(e);return r?r[1]?t(r[1]):n(r[2]):!1},mn=(e,t,n=!1)=>{const r=kl.exec(e);return r?r[1]?t(r[1]):n:!1},Sl=e=>e==="position"||e==="percentage",jl=e=>e==="image"||e==="url",El=e=>e==="length"||e==="size"||e==="bg-size",Nl=e=>e==="length",Yx=e=>e==="number",Xx=e=>e==="family-name",Tl=e=>e==="shadow",Qx=()=>{const e=Fe("color"),t=Fe("font"),n=Fe("text"),r=Fe("font-weight"),o=Fe("tracking"),s=Fe("leading"),i=Fe("breakpoint"),l=Fe("container"),c=Fe("spacing"),u=Fe("radius"),d=Fe("shadow"),p=Fe("inset-shadow"),m=Fe("text-shadow"),h=Fe("drop-shadow"),g=Fe("blur"),f=Fe("perspective"),x=Fe("aspect"),y=Fe("ease"),_=Fe("animate"),k=()=>["auto","avoid","all","avoid-page","page","left","right","column"],C=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],S=()=>[...C(),ce,le],z=()=>["auto","hidden","clip","visible","scroll"],N=()=>["auto","contain","none"],A=()=>[ce,le,c],O=()=>[Ht,"full","auto",...A()],R=()=>[yt,"none","subgrid",ce,le],G=()=>["auto",{span:["full",yt,ce,le]},yt,ce,le],j=()=>[yt,"auto",ce,le],I=()=>["auto","min","max","fr",ce,le],b=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],M=()=>["start","end","center","stretch","center-safe","end-safe"],V=()=>["auto",...A()],P=()=>[Ht,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...A()],F=()=>[e,ce,le],W=()=>[...C(),gi,mi,{position:[ce,le]}],oe=()=>["no-repeat",{repeat:["","x","y","space","round"]}],Z=()=>["auto","cover","contain",Kx,Hx,{size:[ce,le]}],U=()=>[ro,kn,zt],te=()=>["","none","full",u,ce,le],ee=()=>["",be,kn,zt],J=()=>["solid","dashed","dotted","double"],ue=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],X=()=>[be,ro,gi,mi],ie=()=>["","none",g,ce,le],ae=()=>["none",be,ce,le],pe=()=>["none",be,ce,le],fe=()=>[be,ce,le],we=()=>[Ht,"full",...A()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[dt],breakpoint:[dt],color:[Bx],container:[dt],"drop-shadow":[dt],ease:["in","out","in-out"],font:[Vx],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[dt],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[dt],shadow:[dt],spacing:["px",be],text:[dt],"text-shadow":[dt],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",Ht,le,ce,x]}],container:["container"],columns:[{columns:[be,le,ce,l]}],"break-after":[{"break-after":k()}],"break-before":[{"break-before":k()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:S()}],overflow:[{overflow:z()}],"overflow-x":[{"overflow-x":z()}],"overflow-y":[{"overflow-y":z()}],overscroll:[{overscroll:N()}],"overscroll-x":[{"overscroll-x":N()}],"overscroll-y":[{"overscroll-y":N()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:O()}],"inset-x":[{"inset-x":O()}],"inset-y":[{"inset-y":O()}],start:[{start:O()}],end:[{end:O()}],top:[{top:O()}],right:[{right:O()}],bottom:[{bottom:O()}],left:[{left:O()}],visibility:["visible","invisible","collapse"],z:[{z:[yt,"auto",ce,le]}],basis:[{basis:[Ht,"full","auto",l,...A()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[be,Ht,"auto","initial","none",le]}],grow:[{grow:["",be,ce,le]}],shrink:[{shrink:["",be,ce,le]}],order:[{order:[yt,"first","last","none",ce,le]}],"grid-cols":[{"grid-cols":R()}],"col-start-end":[{col:G()}],"col-start":[{"col-start":j()}],"col-end":[{"col-end":j()}],"grid-rows":[{"grid-rows":R()}],"row-start-end":[{row:G()}],"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":I()}],"auto-rows":[{"auto-rows":I()}],gap:[{gap:A()}],"gap-x":[{"gap-x":A()}],"gap-y":[{"gap-y":A()}],"justify-content":[{justify:[...b(),"normal"]}],"justify-items":[{"justify-items":[...M(),"normal"]}],"justify-self":[{"justify-self":["auto",...M()]}],"align-content":[{content:["normal",...b()]}],"align-items":[{items:[...M(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...M(),{baseline:["","last"]}]}],"place-content":[{"place-content":b()}],"place-items":[{"place-items":[...M(),"baseline"]}],"place-self":[{"place-self":["auto",...M()]}],p:[{p:A()}],px:[{px:A()}],py:[{py:A()}],ps:[{ps:A()}],pe:[{pe:A()}],pt:[{pt:A()}],pr:[{pr:A()}],pb:[{pb:A()}],pl:[{pl:A()}],m:[{m:V()}],mx:[{mx:V()}],my:[{my:V()}],ms:[{ms:V()}],me:[{me:V()}],mt:[{mt:V()}],mr:[{mr:V()}],mb:[{mb:V()}],ml:[{ml:V()}],"space-x":[{"space-x":A()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":A()}],"space-y-reverse":["space-y-reverse"],size:[{size:P()}],w:[{w:[l,"screen",...P()]}],"min-w":[{"min-w":[l,"screen","none",...P()]}],"max-w":[{"max-w":[l,"screen","none","prose",{screen:[i]},...P()]}],h:[{h:["screen","lh",...P()]}],"min-h":[{"min-h":["screen","lh","none",...P()]}],"max-h":[{"max-h":["screen","lh",...P()]}],"font-size":[{text:["base",n,kn,zt]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[r,ce,oo]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",ro,le]}],"font-family":[{font:[Jx,le,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,ce,le]}],"line-clamp":[{"line-clamp":[be,"none",ce,oo]}],leading:[{leading:[s,...A()]}],"list-image":[{"list-image":["none",ce,le]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",ce,le]}],"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:[...J(),"wavy"]}],"text-decoration-thickness":[{decoration:[be,"from-font","auto",ce,zt]}],"text-decoration-color":[{decoration:F()}],"underline-offset":[{"underline-offset":[be,"auto",ce,le]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:A()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",ce,le]}],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",ce,le]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:W()}],"bg-repeat":[{bg:oe()}],"bg-size":[{bg:Z()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},yt,ce,le],radial:["",ce,le],conic:[yt,ce,le]},Gx,qx]}],"bg-color":[{bg:F()}],"gradient-from-pos":[{from:U()}],"gradient-via-pos":[{via:U()}],"gradient-to-pos":[{to:U()}],"gradient-from":[{from:F()}],"gradient-via":[{via:F()}],"gradient-to":[{to:F()}],rounded:[{rounded:te()}],"rounded-s":[{"rounded-s":te()}],"rounded-e":[{"rounded-e":te()}],"rounded-t":[{"rounded-t":te()}],"rounded-r":[{"rounded-r":te()}],"rounded-b":[{"rounded-b":te()}],"rounded-l":[{"rounded-l":te()}],"rounded-ss":[{"rounded-ss":te()}],"rounded-se":[{"rounded-se":te()}],"rounded-ee":[{"rounded-ee":te()}],"rounded-es":[{"rounded-es":te()}],"rounded-tl":[{"rounded-tl":te()}],"rounded-tr":[{"rounded-tr":te()}],"rounded-br":[{"rounded-br":te()}],"rounded-bl":[{"rounded-bl":te()}],"border-w":[{border:ee()}],"border-w-x":[{"border-x":ee()}],"border-w-y":[{"border-y":ee()}],"border-w-s":[{"border-s":ee()}],"border-w-e":[{"border-e":ee()}],"border-w-t":[{"border-t":ee()}],"border-w-r":[{"border-r":ee()}],"border-w-b":[{"border-b":ee()}],"border-w-l":[{"border-l":ee()}],"divide-x":[{"divide-x":ee()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":ee()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...J(),"hidden","none"]}],"divide-style":[{divide:[...J(),"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:[...J(),"none","hidden"]}],"outline-offset":[{"outline-offset":[be,ce,le]}],"outline-w":[{outline:["",be,kn,zt]}],"outline-color":[{outline:F()}],shadow:[{shadow:["","none",d,tr,er]}],"shadow-color":[{shadow:F()}],"inset-shadow":[{"inset-shadow":["none",p,tr,er]}],"inset-shadow-color":[{"inset-shadow":F()}],"ring-w":[{ring:ee()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:F()}],"ring-offset-w":[{"ring-offset":[be,zt]}],"ring-offset-color":[{"ring-offset":F()}],"inset-ring-w":[{"inset-ring":ee()}],"inset-ring-color":[{"inset-ring":F()}],"text-shadow":[{"text-shadow":["none",m,tr,er]}],"text-shadow-color":[{"text-shadow":F()}],opacity:[{opacity:[be,ce,le]}],"mix-blend":[{"mix-blend":[...ue(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":ue()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[be]}],"mask-image-linear-from-pos":[{"mask-linear-from":X()}],"mask-image-linear-to-pos":[{"mask-linear-to":X()}],"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":X()}],"mask-image-t-to-pos":[{"mask-t-to":X()}],"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":X()}],"mask-image-r-to-pos":[{"mask-r-to":X()}],"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":X()}],"mask-image-b-to-pos":[{"mask-b-to":X()}],"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":X()}],"mask-image-l-to-pos":[{"mask-l-to":X()}],"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":X()}],"mask-image-x-to-pos":[{"mask-x-to":X()}],"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":X()}],"mask-image-y-to-pos":[{"mask-y-to":X()}],"mask-image-y-from-color":[{"mask-y-from":F()}],"mask-image-y-to-color":[{"mask-y-to":F()}],"mask-image-radial":[{"mask-radial":[ce,le]}],"mask-image-radial-from-pos":[{"mask-radial-from":X()}],"mask-image-radial-to-pos":[{"mask-radial-to":X()}],"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":C()}],"mask-image-conic-pos":[{"mask-conic":[be]}],"mask-image-conic-from-pos":[{"mask-conic-from":X()}],"mask-image-conic-to-pos":[{"mask-conic-to":X()}],"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:W()}],"mask-repeat":[{mask:oe()}],"mask-size":[{mask:Z()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",ce,le]}],filter:[{filter:["","none",ce,le]}],blur:[{blur:ie()}],brightness:[{brightness:[be,ce,le]}],contrast:[{contrast:[be,ce,le]}],"drop-shadow":[{"drop-shadow":["","none",h,tr,er]}],"drop-shadow-color":[{"drop-shadow":F()}],grayscale:[{grayscale:["",be,ce,le]}],"hue-rotate":[{"hue-rotate":[be,ce,le]}],invert:[{invert:["",be,ce,le]}],saturate:[{saturate:[be,ce,le]}],sepia:[{sepia:["",be,ce,le]}],"backdrop-filter":[{"backdrop-filter":["","none",ce,le]}],"backdrop-blur":[{"backdrop-blur":ie()}],"backdrop-brightness":[{"backdrop-brightness":[be,ce,le]}],"backdrop-contrast":[{"backdrop-contrast":[be,ce,le]}],"backdrop-grayscale":[{"backdrop-grayscale":["",be,ce,le]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[be,ce,le]}],"backdrop-invert":[{"backdrop-invert":["",be,ce,le]}],"backdrop-opacity":[{"backdrop-opacity":[be,ce,le]}],"backdrop-saturate":[{"backdrop-saturate":[be,ce,le]}],"backdrop-sepia":[{"backdrop-sepia":["",be,ce,le]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":A()}],"border-spacing-x":[{"border-spacing-x":A()}],"border-spacing-y":[{"border-spacing-y":A()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",ce,le]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[be,"initial",ce,le]}],ease:[{ease:["linear","initial",y,ce,le]}],delay:[{delay:[be,ce,le]}],animate:[{animate:["none",_,ce,le]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[f,ce,le]}],"perspective-origin":[{"perspective-origin":S()}],rotate:[{rotate:ae()}],"rotate-x":[{"rotate-x":ae()}],"rotate-y":[{"rotate-y":ae()}],"rotate-z":[{"rotate-z":ae()}],scale:[{scale:pe()}],"scale-x":[{"scale-x":pe()}],"scale-y":[{"scale-y":pe()}],"scale-z":[{"scale-z":pe()}],"scale-3d":["scale-3d"],skew:[{skew:fe()}],"skew-x":[{"skew-x":fe()}],"skew-y":[{"skew-y":fe()}],transform:[{transform:[ce,le,"","none","gpu","cpu"]}],"transform-origin":[{origin:S()}],"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",ce,le]}],"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":A()}],"scroll-mx":[{"scroll-mx":A()}],"scroll-my":[{"scroll-my":A()}],"scroll-ms":[{"scroll-ms":A()}],"scroll-me":[{"scroll-me":A()}],"scroll-mt":[{"scroll-mt":A()}],"scroll-mr":[{"scroll-mr":A()}],"scroll-mb":[{"scroll-mb":A()}],"scroll-ml":[{"scroll-ml":A()}],"scroll-p":[{"scroll-p":A()}],"scroll-px":[{"scroll-px":A()}],"scroll-py":[{"scroll-py":A()}],"scroll-ps":[{"scroll-ps":A()}],"scroll-pe":[{"scroll-pe":A()}],"scroll-pt":[{"scroll-pt":A()}],"scroll-pr":[{"scroll-pr":A()}],"scroll-pb":[{"scroll-pb":A()}],"scroll-pl":[{"scroll-pl":A()}],"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",ce,le]}],fill:[{fill:["none",...F()]}],"stroke-w":[{stroke:[be,kn,zt,oo]}],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"]}},e1=Ix(Qx);function ve(...e){return e1(xl(e))}function Be(e){return e>=1e6?(e/1e6).toFixed(1).replace(/\.0$/,"")+"M":(e/1e3).toFixed(1).replace(/\.0$/,"")+"K"}function t1(e){return e===null?"pending":e>=200&&e<300?"success":e>=400&&e<500?"client_error":e>=500?"server_error":"pending"}const n1="2.0.4",r1={version:n1},xi=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,vi=xl,ps=(e,t)=>n=>{var r;if(t?.variants==null)return vi(e,n?.class,n?.className);const{variants:o,defaultVariants:s}=t,i=Object.keys(o).map(u=>{const d=n?.[u],p=s?.[u];if(d===null)return null;const m=xi(d)||xi(p);return o[u][m]}),l=n&&Object.entries(n).reduce((u,d)=>{let[p,m]=d;return m===void 0||(u[p]=m),u},{}),c=t==null||(r=t.compoundVariants)===null||r===void 0?void 0:r.reduce((u,d)=>{let{class:p,className:m,...h}=d;return Object.entries(h).every(g=>{let[f,x]=g;return Array.isArray(x)?x.includes({...s,...l}[f]):{...s,...l}[f]===x})?[...u,p,m]:u},[]);return vi(e,i,c,n?.class,n?.className)};function yi(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function Al(...e){return t=>{let n=!1;const r=e.map(o=>{const s=yi(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():yi(e[o],null)}}}}function Ie(...e){return v.useCallback(Al(...e),e)}function ln(e){const t=s1(e),n=v.forwardRef((r,o)=>{const{children:s,...i}=r,l=v.Children.toArray(s),c=l.find(a1);if(c){const u=c.props.children,d=l.map(p=>p===c?v.Children.count(u)>1?v.Children.only(null):v.isValidElement(u)?u.props.children:null:p);return a.jsx(t,{...i,ref:o,children:v.isValidElement(u)?v.cloneElement(u,void 0,d):null})}return a.jsx(t,{...i,ref:o,children:s})});return n.displayName=`${e}.Slot`,n}var o1=ln("Slot");function s1(e){const t=v.forwardRef((n,r)=>{const{children:o,...s}=n;if(v.isValidElement(o)){const i=c1(o),l=l1(s,o.props);return o.type!==v.Fragment&&(l.ref=r?Al(r,i):i),v.cloneElement(o,l)}return v.Children.count(o)>1?v.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var zl=Symbol("radix.slottable");function i1(e){const t=({children:n})=>a.jsx(a.Fragment,{children:n});return t.displayName=`${e}.Slottable`,t.__radixId=zl,t}function a1(e){return v.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===zl}function l1(e,t){const n={...t};for(const r in t){const o=e[r],s=t[r];/^on[A-Z]/.test(r)?o&&s?n[r]=(...l)=>{const c=s(...l);return o(...l),c}:o&&(n[r]=o):r==="style"?n[r]={...o,...s}:r==="className"&&(n[r]=[o,s].filter(Boolean).join(" "))}return{...e,...n}}function c1(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 u1=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Se=u1.reduce((e,t)=>{const n=ln(`Primitive.${t}`),r=v.forwardRef((o,s)=>{const{asChild:i,...l}=o,c=i?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),a.jsx(c,{...l,ref:s})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{});function d1(e,t){e&&$n.flushSync(()=>e.dispatchEvent(t))}var Ol=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"}),f1="VisuallyHidden",Il=v.forwardRef((e,t)=>a.jsx(Se.span,{...e,ref:t,style:{...Ol,...e.style}}));Il.displayName=f1;var h1=Il;function p1(e,t){const n=v.createContext(t),r=s=>{const{children:i,...l}=s,c=v.useMemo(()=>l,Object.values(l));return a.jsx(n.Provider,{value:c,children:i})};r.displayName=e+"Provider";function o(s){const i=v.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 Zt(e,t=[]){let n=[];function r(s,i){const l=v.createContext(i),c=n.length;n=[...n,i];const u=p=>{const{scope:m,children:h,...g}=p,f=m?.[e]?.[c]||l,x=v.useMemo(()=>g,Object.values(g));return a.jsx(f.Provider,{value:x,children:h})};u.displayName=s+"Provider";function d(p,m){const h=m?.[e]?.[c]||l,g=v.useContext(h);if(g)return g;if(i!==void 0)return i;throw new Error(`\`${p}\` must be used within \`${s}\``)}return[u,d]}const o=()=>{const s=n.map(i=>v.createContext(i));return function(l){const c=l?.[e]||s;return v.useMemo(()=>({[`__scope${e}`]:{...l,[e]:c}}),[l,c])}};return o.scopeName=e,[r,m1(o,...t)]}function m1(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const r=e.map(o=>({useScope:o(),scopeName:o.scopeName}));return function(s){const i=r.reduce((l,{useScope:c,scopeName:u})=>{const p=c(s)[`__scope${u}`];return{...l,...p}},{});return v.useMemo(()=>({[`__scope${t.scopeName}`]:i}),[i])}};return n.scopeName=t.scopeName,n}function Rl(e){const t=e+"CollectionProvider",[n,r]=Zt(t),[o,s]=n(t,{collectionRef:{current:null},itemMap:new Map}),i=f=>{const{scope:x,children:y}=f,_=He.useRef(null),k=He.useRef(new Map).current;return a.jsx(o,{scope:x,itemMap:k,collectionRef:_,children:y})};i.displayName=t;const l=e+"CollectionSlot",c=ln(l),u=He.forwardRef((f,x)=>{const{scope:y,children:_}=f,k=s(l,y),C=Ie(x,k.collectionRef);return a.jsx(c,{ref:C,children:_})});u.displayName=l;const d=e+"CollectionItemSlot",p="data-radix-collection-item",m=ln(d),h=He.forwardRef((f,x)=>{const{scope:y,children:_,...k}=f,C=He.useRef(null),S=Ie(x,C),z=s(d,y);return He.useEffect(()=>(z.itemMap.set(C,{ref:C,...k}),()=>{z.itemMap.delete(C)})),a.jsx(m,{[p]:"",ref:S,children:_})});h.displayName=d;function g(f){const x=s(e+"CollectionConsumer",f);return He.useCallback(()=>{const _=x.collectionRef.current;if(!_)return[];const k=Array.from(_.querySelectorAll(`[${p}]`));return Array.from(x.itemMap.values()).sort((z,N)=>k.indexOf(z.ref.current)-k.indexOf(N.ref.current))},[x.collectionRef,x.itemMap])}return[{Provider:i,Slot:u,ItemSlot:h},g,r]}function ye(e,t,{checkForDefaultPrevented:n=!0}={}){return function(o){if(e?.(o),n===!1||!o.defaultPrevented)return t?.(o)}}var We=globalThis?.document?v.useLayoutEffect:()=>{},g1=va[" useInsertionEffect ".trim().toString()]||We;function cn({prop:e,defaultProp:t,onChange:n=()=>{},caller:r}){const[o,s,i]=x1({defaultProp:t,onChange:n}),l=e!==void 0,c=l?e:o;{const d=v.useRef(e!==void 0);v.useEffect(()=>{const p=d.current;p!==l&&console.warn(`${r} is changing from ${p?"controlled":"uncontrolled"} to ${l?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),d.current=l},[l,r])}const u=v.useCallback(d=>{if(l){const p=v1(d)?d(e):d;p!==e&&i.current?.(p)}else s(d)},[l,e,s,i]);return[c,u]}function x1({defaultProp:e,onChange:t}){const[n,r]=v.useState(e),o=v.useRef(n),s=v.useRef(t);return g1(()=>{s.current=t},[t]),v.useEffect(()=>{o.current!==n&&(s.current?.(n),o.current=n)},[n,o]),[n,r,s]}function v1(e){return typeof e=="function"}function y1(e,t){return v.useReducer((n,r)=>t[n][r]??n,e)}var Wt=e=>{const{present:t,children:n}=e,r=b1(t),o=typeof n=="function"?n({present:r.isPresent}):v.Children.only(n),s=Ie(r.ref,w1(o));return typeof n=="function"||r.isPresent?v.cloneElement(o,{ref:s}):null};Wt.displayName="Presence";function b1(e){const[t,n]=v.useState(),r=v.useRef(null),o=v.useRef(e),s=v.useRef("none"),i=e?"mounted":"unmounted",[l,c]=y1(i,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return v.useEffect(()=>{const u=nr(r.current);s.current=l==="mounted"?u:"none"},[l]),We(()=>{const u=r.current,d=o.current;if(d!==e){const m=s.current,h=nr(u);e?c("MOUNT"):h==="none"||u?.display==="none"?c("UNMOUNT"):c(d&&m!==h?"ANIMATION_OUT":"UNMOUNT"),o.current=e}},[e,c]),We(()=>{if(t){let u;const d=t.ownerDocument.defaultView??window,p=h=>{const f=nr(r.current).includes(CSS.escape(h.animationName));if(h.target===t&&f&&(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)})}},m=h=>{h.target===t&&(s.current=nr(r.current))};return t.addEventListener("animationstart",m),t.addEventListener("animationcancel",p),t.addEventListener("animationend",p),()=>{d.clearTimeout(u),t.removeEventListener("animationstart",m),t.removeEventListener("animationcancel",p),t.removeEventListener("animationend",p)}}else c("ANIMATION_END")},[t,c]),{isPresent:["mounted","unmountSuspended"].includes(l),ref:v.useCallback(u=>{r.current=u?getComputedStyle(u):null,n(u)},[])}}function nr(e){return e?.animationName||"none"}function w1(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 _1=va[" useId ".trim().toString()]||(()=>{}),k1=0;function pt(e){const[t,n]=v.useState(_1());return We(()=>{n(r=>r??String(k1++))},[e]),e||(t?`radix-${t}`:"")}var C1=v.createContext(void 0);function ms(e){const t=v.useContext(C1);return e||t||"ltr"}function kt(e){const t=v.useRef(e);return v.useEffect(()=>{t.current=e}),v.useMemo(()=>(...n)=>t.current?.(...n),[])}function S1(e,t=globalThis?.document){const n=kt(e);v.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 j1="DismissableLayer",Io="dismissableLayer.update",E1="dismissableLayer.pointerDownOutside",N1="dismissableLayer.focusOutside",bi,Pl=v.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),Mr=v.forwardRef((e,t)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:r,onPointerDownOutside:o,onFocusOutside:s,onInteractOutside:i,onDismiss:l,...c}=e,u=v.useContext(Pl),[d,p]=v.useState(null),m=d?.ownerDocument??globalThis?.document,[,h]=v.useState({}),g=Ie(t,N=>p(N)),f=Array.from(u.layers),[x]=[...u.layersWithOutsidePointerEventsDisabled].slice(-1),y=f.indexOf(x),_=d?f.indexOf(d):-1,k=u.layersWithOutsidePointerEventsDisabled.size>0,C=_>=y,S=z1(N=>{const A=N.target,O=[...u.branches].some(R=>R.contains(A));!C||O||(o?.(N),i?.(N),N.defaultPrevented||l?.())},m),z=O1(N=>{const A=N.target;[...u.branches].some(R=>R.contains(A))||(s?.(N),i?.(N),N.defaultPrevented||l?.())},m);return S1(N=>{_===u.layers.size-1&&(r?.(N),!N.defaultPrevented&&l&&(N.preventDefault(),l()))},m),v.useEffect(()=>{if(d)return n&&(u.layersWithOutsidePointerEventsDisabled.size===0&&(bi=m.body.style.pointerEvents,m.body.style.pointerEvents="none"),u.layersWithOutsidePointerEventsDisabled.add(d)),u.layers.add(d),wi(),()=>{n&&u.layersWithOutsidePointerEventsDisabled.size===1&&(m.body.style.pointerEvents=bi)}},[d,m,n,u]),v.useEffect(()=>()=>{d&&(u.layers.delete(d),u.layersWithOutsidePointerEventsDisabled.delete(d),wi())},[d,u]),v.useEffect(()=>{const N=()=>h({});return document.addEventListener(Io,N),()=>document.removeEventListener(Io,N)},[]),a.jsx(Se.div,{...c,ref:g,style:{pointerEvents:k?C?"auto":"none":void 0,...e.style},onFocusCapture:ye(e.onFocusCapture,z.onFocusCapture),onBlurCapture:ye(e.onBlurCapture,z.onBlurCapture),onPointerDownCapture:ye(e.onPointerDownCapture,S.onPointerDownCapture)})});Mr.displayName=j1;var T1="DismissableLayerBranch",A1=v.forwardRef((e,t)=>{const n=v.useContext(Pl),r=v.useRef(null),o=Ie(t,r);return v.useEffect(()=>{const s=r.current;if(s)return n.branches.add(s),()=>{n.branches.delete(s)}},[n.branches]),a.jsx(Se.div,{...e,ref:o})});A1.displayName=T1;function z1(e,t=globalThis?.document){const n=kt(e),r=v.useRef(!1),o=v.useRef(()=>{});return v.useEffect(()=>{const s=l=>{if(l.target&&!r.current){let c=function(){Ml(E1,n,u,{discrete:!0})};const u={originalEvent:l};l.pointerType==="touch"?(t.removeEventListener("click",o.current),o.current=c,t.addEventListener("click",o.current,{once:!0})):c()}else t.removeEventListener("click",o.current);r.current=!1},i=window.setTimeout(()=>{t.addEventListener("pointerdown",s)},0);return()=>{window.clearTimeout(i),t.removeEventListener("pointerdown",s),t.removeEventListener("click",o.current)}},[t,n]),{onPointerDownCapture:()=>r.current=!0}}function O1(e,t=globalThis?.document){const n=kt(e),r=v.useRef(!1);return v.useEffect(()=>{const o=s=>{s.target&&!r.current&&Ml(N1,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 wi(){const e=new CustomEvent(Io);document.dispatchEvent(e)}function Ml(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?d1(o,s):o.dispatchEvent(s)}var so="focusScope.autoFocusOnMount",io="focusScope.autoFocusOnUnmount",_i={bubbles:!1,cancelable:!0},I1="FocusScope",gs=v.forwardRef((e,t)=>{const{loop:n=!1,trapped:r=!1,onMountAutoFocus:o,onUnmountAutoFocus:s,...i}=e,[l,c]=v.useState(null),u=kt(o),d=kt(s),p=v.useRef(null),m=Ie(t,f=>c(f)),h=v.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;v.useEffect(()=>{if(r){let f=function(k){if(h.paused||!l)return;const C=k.target;l.contains(C)?p.current=C:bt(p.current,{select:!0})},x=function(k){if(h.paused||!l)return;const C=k.relatedTarget;C!==null&&(l.contains(C)||bt(p.current,{select:!0}))},y=function(k){if(document.activeElement===document.body)for(const S of k)S.removedNodes.length>0&&bt(l)};document.addEventListener("focusin",f),document.addEventListener("focusout",x);const _=new MutationObserver(y);return l&&_.observe(l,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",f),document.removeEventListener("focusout",x),_.disconnect()}}},[r,l,h.paused]),v.useEffect(()=>{if(l){Ci.add(h);const f=document.activeElement;if(!l.contains(f)){const y=new CustomEvent(so,_i);l.addEventListener(so,u),l.dispatchEvent(y),y.defaultPrevented||(R1(F1(Dl(l)),{select:!0}),document.activeElement===f&&bt(l))}return()=>{l.removeEventListener(so,u),setTimeout(()=>{const y=new CustomEvent(io,_i);l.addEventListener(io,d),l.dispatchEvent(y),y.defaultPrevented||bt(f??document.body,{select:!0}),l.removeEventListener(io,d),Ci.remove(h)},0)}}},[l,u,d,h]);const g=v.useCallback(f=>{if(!n&&!r||h.paused)return;const x=f.key==="Tab"&&!f.altKey&&!f.ctrlKey&&!f.metaKey,y=document.activeElement;if(x&&y){const _=f.currentTarget,[k,C]=P1(_);k&&C?!f.shiftKey&&y===C?(f.preventDefault(),n&&bt(k,{select:!0})):f.shiftKey&&y===k&&(f.preventDefault(),n&&bt(C,{select:!0})):y===_&&f.preventDefault()}},[n,r,h.paused]);return a.jsx(Se.div,{tabIndex:-1,...i,ref:m,onKeyDown:g})});gs.displayName=I1;function R1(e,{select:t=!1}={}){const n=document.activeElement;for(const r of e)if(bt(r,{select:t}),document.activeElement!==n)return}function P1(e){const t=Dl(e),n=ki(t,e),r=ki(t.reverse(),e);return[n,r]}function Dl(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 ki(e,t){for(const n of e)if(!M1(n,{upTo:t}))return n}function M1(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 D1(e){return e instanceof HTMLInputElement&&"select"in e}function bt(e,{select:t=!1}={}){if(e&&e.focus){const n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&D1(e)&&t&&e.select()}}var Ci=L1();function L1(){let e=[];return{add(t){const n=e[0];t!==n&&n?.pause(),e=Si(e,t),e.unshift(t)},remove(t){e=Si(e,t),e[0]?.resume()}}}function Si(e,t){const n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}function F1(e){return e.filter(t=>t.tagName!=="A")}var $1="Portal",Dr=v.forwardRef((e,t)=>{const{container:n,...r}=e,[o,s]=v.useState(!1);We(()=>s(!0),[]);const i=n||o&&globalThis?.document?.body;return i?od.createPortal(a.jsx(Se.div,{...r,ref:t}),i):null});Dr.displayName=$1;var ao=0;function Ll(){v.useEffect(()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??ji()),document.body.insertAdjacentElement("beforeend",e[1]??ji()),ao++,()=>{ao===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(t=>t.remove()),ao--}},[])}function ji(){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 st=function(){return st=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},st.apply(this,arguments)};function Fl(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 B1(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 ur="right-scroll-bar-position",dr="width-before-scroll-bar",U1="with-scroll-bars-hidden",Z1="--removed-body-scroll-bar-size";function lo(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}function W1(e,t){var n=v.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 V1=typeof window<"u"?v.useLayoutEffect:v.useEffect,Ei=new WeakMap;function H1(e,t){var n=W1(null,function(r){return e.forEach(function(o){return lo(o,r)})});return V1(function(){var r=Ei.get(n);if(r){var o=new Set(r),s=new Set(e),i=n.current;o.forEach(function(l){s.has(l)||lo(l,null)}),s.forEach(function(l){o.has(l)||lo(l,i)})}Ei.set(n,e)},[e]),n}function q1(e){return e}function J1(e,t){t===void 0&&(t=q1);var n=[],r=!1,o={read:function(){if(r)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return n.length?n[n.length-1]:e},useMedium:function(s){var i=t(s,r);return n.push(i),function(){n=n.filter(function(l){return l!==i})}},assignSyncMedium:function(s){for(r=!0;n.length;){var i=n;n=[],i.forEach(s)}n={push:function(l){return s(l)},filter:function(){return n}}},assignMedium:function(s){r=!0;var i=[];if(n.length){var l=n;n=[],l.forEach(s),i=n}var c=function(){var d=i;i=[],d.forEach(s)},u=function(){return Promise.resolve().then(c)};u(),n={push:function(d){i.push(d),u()},filter:function(d){return i=i.filter(d),n}}}};return o}function K1(e){e===void 0&&(e={});var t=J1(null);return t.options=st({async:!0,ssr:!1},e),t}var $l=function(e){var t=e.sideCar,n=Fl(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 v.createElement(r,st({},n))};$l.isSideCarExport=!0;function G1(e,t){return e.useMedium(t),$l}var Bl=K1(),co=function(){},Lr=v.forwardRef(function(e,t){var n=v.useRef(null),r=v.useState({onScrollCapture:co,onWheelCapture:co,onTouchMoveCapture:co}),o=r[0],s=r[1],i=e.forwardProps,l=e.children,c=e.className,u=e.removeScrollBar,d=e.enabled,p=e.shards,m=e.sideCar,h=e.noRelative,g=e.noIsolation,f=e.inert,x=e.allowPinchZoom,y=e.as,_=y===void 0?"div":y,k=e.gapMode,C=Fl(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),S=m,z=H1([n,t]),N=st(st({},C),o);return v.createElement(v.Fragment,null,d&&v.createElement(S,{sideCar:Bl,removeScrollBar:u,shards:p,noRelative:h,noIsolation:g,inert:f,setCallbacks:s,allowPinchZoom:!!x,lockRef:n,gapMode:k}),i?v.cloneElement(v.Children.only(l),st(st({},N),{ref:z})):v.createElement(_,st({},N,{className:c,ref:z}),l))});Lr.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};Lr.classNames={fullWidth:dr,zeroRight:ur};var Y1=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function X1(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=Y1();return t&&e.setAttribute("nonce",t),e}function Q1(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function ev(e){var t=document.head||document.getElementsByTagName("head")[0];t.appendChild(e)}var tv=function(){var e=0,t=null;return{add:function(n){e==0&&(t=X1())&&(Q1(t,n),ev(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},nv=function(){var e=tv();return function(t,n){v.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},Ul=function(){var e=nv(),t=function(n){var r=n.styles,o=n.dynamic;return e(r,o),null};return t},rv={left:0,top:0,right:0,gap:0},uo=function(e){return parseInt(e||"",10)||0},ov=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[uo(n),uo(r),uo(o)]},sv=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return rv;var t=ov(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])}},iv=Ul(),tn="data-scroll-locked",av=function(e,t,n,r){var o=e.left,s=e.top,i=e.right,l=e.gap;return n===void 0&&(n="margin"),`
|
|
42
|
-
.`.concat(U1,` {
|
|
43
|
-
overflow: hidden `).concat(r,`;
|
|
44
|
-
padding-right: `).concat(l,"px ").concat(r,`;
|
|
45
|
-
}
|
|
46
|
-
body[`).concat(tn,`] {
|
|
47
|
-
overflow: hidden `).concat(r,`;
|
|
48
|
-
overscroll-behavior: contain;
|
|
49
|
-
`).concat([t&&"position: relative ".concat(r,";"),n==="margin"&&`
|
|
50
|
-
padding-left: `.concat(o,`px;
|
|
51
|
-
padding-top: `).concat(s,`px;
|
|
52
|
-
padding-right: `).concat(i,`px;
|
|
53
|
-
margin-left:0;
|
|
54
|
-
margin-top:0;
|
|
55
|
-
margin-right: `).concat(l,"px ").concat(r,`;
|
|
56
|
-
`),n==="padding"&&"padding-right: ".concat(l,"px ").concat(r,";")].filter(Boolean).join(""),`
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
.`).concat(ur,` {
|
|
60
|
-
right: `).concat(l,"px ").concat(r,`;
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
.`).concat(dr,` {
|
|
64
|
-
margin-right: `).concat(l,"px ").concat(r,`;
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
.`).concat(ur," .").concat(ur,` {
|
|
68
|
-
right: 0 `).concat(r,`;
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
.`).concat(dr," .").concat(dr,` {
|
|
72
|
-
margin-right: 0 `).concat(r,`;
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
body[`).concat(tn,`] {
|
|
76
|
-
`).concat(Z1,": ").concat(l,`px;
|
|
77
|
-
}
|
|
78
|
-
`)},Ni=function(){var e=parseInt(document.body.getAttribute(tn)||"0",10);return isFinite(e)?e:0},lv=function(){v.useEffect(function(){return document.body.setAttribute(tn,(Ni()+1).toString()),function(){var e=Ni()-1;e<=0?document.body.removeAttribute(tn):document.body.setAttribute(tn,e.toString())}},[])},cv=function(e){var t=e.noRelative,n=e.noImportant,r=e.gapMode,o=r===void 0?"margin":r;lv();var s=v.useMemo(function(){return sv(o)},[o]);return v.createElement(iv,{styles:av(s,!t,o,n?"":"!important")})},Ro=!1;if(typeof window<"u")try{var rr=Object.defineProperty({},"passive",{get:function(){return Ro=!0,!0}});window.addEventListener("test",rr,rr),window.removeEventListener("test",rr,rr)}catch{Ro=!1}var qt=Ro?{passive:!1}:!1,uv=function(e){return e.tagName==="TEXTAREA"},Zl=function(e,t){if(!(e instanceof Element))return!1;var n=window.getComputedStyle(e);return n[t]!=="hidden"&&!(n.overflowY===n.overflowX&&!uv(e)&&n[t]==="visible")},dv=function(e){return Zl(e,"overflowY")},fv=function(e){return Zl(e,"overflowX")},Ti=function(e,t){var n=t.ownerDocument,r=t;do{typeof ShadowRoot<"u"&&r instanceof ShadowRoot&&(r=r.host);var o=Wl(e,r);if(o){var s=Vl(e,r),i=s[1],l=s[2];if(i>l)return!0}r=r.parentNode}while(r&&r!==n.body);return!1},hv=function(e){var t=e.scrollTop,n=e.scrollHeight,r=e.clientHeight;return[t,n,r]},pv=function(e){var t=e.scrollLeft,n=e.scrollWidth,r=e.clientWidth;return[t,n,r]},Wl=function(e,t){return e==="v"?dv(t):fv(t)},Vl=function(e,t){return e==="v"?hv(t):pv(t)},mv=function(e,t){return e==="h"&&t==="rtl"?-1:1},gv=function(e,t,n,r,o){var s=mv(e,window.getComputedStyle(t).direction),i=s*r,l=n.target,c=t.contains(l),u=!1,d=i>0,p=0,m=0;do{if(!l)break;var h=Vl(e,l),g=h[0],f=h[1],x=h[2],y=f-x-s*g;(g||y)&&Wl(e,l)&&(p+=y,m+=g);var _=l.parentNode;l=_&&_.nodeType===Node.DOCUMENT_FRAGMENT_NODE?_.host:_}while(!c&&l!==document.body||c&&(t.contains(l)||t===l));return(d&&Math.abs(p)<1||!d&&Math.abs(m)<1)&&(u=!0),u},or=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},Ai=function(e){return[e.deltaX,e.deltaY]},zi=function(e){return e&&"current"in e?e.current:e},xv=function(e,t){return e[0]===t[0]&&e[1]===t[1]},vv=function(e){return`
|
|
79
|
-
.block-interactivity-`.concat(e,` {pointer-events: none;}
|
|
80
|
-
.allow-interactivity-`).concat(e,` {pointer-events: all;}
|
|
81
|
-
`)},yv=0,Jt=[];function bv(e){var t=v.useRef([]),n=v.useRef([0,0]),r=v.useRef(),o=v.useState(yv++)[0],s=v.useState(Ul)[0],i=v.useRef(e);v.useEffect(function(){i.current=e},[e]),v.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(o));var f=B1([e.lockRef.current],(e.shards||[]).map(zi),!0).filter(Boolean);return f.forEach(function(x){return x.classList.add("allow-interactivity-".concat(o))}),function(){document.body.classList.remove("block-interactivity-".concat(o)),f.forEach(function(x){return x.classList.remove("allow-interactivity-".concat(o))})}}},[e.inert,e.lockRef.current,e.shards]);var l=v.useCallback(function(f,x){if("touches"in f&&f.touches.length===2||f.type==="wheel"&&f.ctrlKey)return!i.current.allowPinchZoom;var y=or(f),_=n.current,k="deltaX"in f?f.deltaX:_[0]-y[0],C="deltaY"in f?f.deltaY:_[1]-y[1],S,z=f.target,N=Math.abs(k)>Math.abs(C)?"h":"v";if("touches"in f&&N==="h"&&z.type==="range")return!1;var A=window.getSelection(),O=A&&A.anchorNode,R=O?O===z||O.contains(z):!1;if(R)return!1;var G=Ti(N,z);if(!G)return!0;if(G?S=N:(S=N==="v"?"h":"v",G=Ti(N,z)),!G)return!1;if(!r.current&&"changedTouches"in f&&(k||C)&&(r.current=S),!S)return!0;var j=r.current||S;return gv(j,x,f,j==="h"?k:C)},[]),c=v.useCallback(function(f){var x=f;if(!(!Jt.length||Jt[Jt.length-1]!==s)){var y="deltaY"in x?Ai(x):or(x),_=t.current.filter(function(S){return S.name===x.type&&(S.target===x.target||x.target===S.shadowParent)&&xv(S.delta,y)})[0];if(_&&_.should){x.cancelable&&x.preventDefault();return}if(!_){var k=(i.current.shards||[]).map(zi).filter(Boolean).filter(function(S){return S.contains(x.target)}),C=k.length>0?l(x,k[0]):!i.current.noIsolation;C&&x.cancelable&&x.preventDefault()}}},[]),u=v.useCallback(function(f,x,y,_){var k={name:f,delta:x,target:y,should:_,shadowParent:wv(y)};t.current.push(k),setTimeout(function(){t.current=t.current.filter(function(C){return C!==k})},1)},[]),d=v.useCallback(function(f){n.current=or(f),r.current=void 0},[]),p=v.useCallback(function(f){u(f.type,Ai(f),f.target,l(f,e.lockRef.current))},[]),m=v.useCallback(function(f){u(f.type,or(f),f.target,l(f,e.lockRef.current))},[]);v.useEffect(function(){return Jt.push(s),e.setCallbacks({onScrollCapture:p,onWheelCapture:p,onTouchMoveCapture:m}),document.addEventListener("wheel",c,qt),document.addEventListener("touchmove",c,qt),document.addEventListener("touchstart",d,qt),function(){Jt=Jt.filter(function(f){return f!==s}),document.removeEventListener("wheel",c,qt),document.removeEventListener("touchmove",c,qt),document.removeEventListener("touchstart",d,qt)}},[]);var h=e.removeScrollBar,g=e.inert;return v.createElement(v.Fragment,null,g?v.createElement(s,{styles:vv(o)}):null,h?v.createElement(cv,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function wv(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const _v=G1(Bl,bv);var xs=v.forwardRef(function(e,t){return v.createElement(Lr,st({},e,{ref:t,sideCar:_v}))});xs.classNames=Lr.classNames;var kv=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},Kt=new WeakMap,sr=new WeakMap,ir={},fo=0,Hl=function(e){return e&&(e.host||Hl(e.parentNode))},Cv=function(e,t){return t.map(function(n){if(e.contains(n))return n;var r=Hl(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})},Sv=function(e,t,n,r){var o=Cv(t,Array.isArray(e)?e:[e]);ir[n]||(ir[n]=new WeakMap);var s=ir[n],i=[],l=new Set,c=new Set(o),u=function(p){!p||l.has(p)||(l.add(p),u(p.parentNode))};o.forEach(u);var d=function(p){!p||c.has(p)||Array.prototype.forEach.call(p.children,function(m){if(l.has(m))d(m);else try{var h=m.getAttribute(r),g=h!==null&&h!=="false",f=(Kt.get(m)||0)+1,x=(s.get(m)||0)+1;Kt.set(m,f),s.set(m,x),i.push(m),f===1&&g&&sr.set(m,!0),x===1&&m.setAttribute(n,"true"),g||m.setAttribute(r,"true")}catch(y){console.error("aria-hidden: cannot operate on ",m,y)}})};return d(t),l.clear(),fo++,function(){i.forEach(function(p){var m=Kt.get(p)-1,h=s.get(p)-1;Kt.set(p,m),s.set(p,h),m||(sr.has(p)||p.removeAttribute(r),sr.delete(p)),h||p.removeAttribute(n)}),fo--,fo||(Kt=new WeakMap,Kt=new WeakMap,sr=new WeakMap,ir={})}},ql=function(e,t,n){n===void 0&&(n="data-aria-hidden");var r=Array.from(Array.isArray(e)?e:[e]),o=kv(e);return o?(r.push.apply(r,Array.from(o.querySelectorAll("[aria-live], script"))),Sv(r,o,n,"aria-hidden")):function(){return null}},Fr="Dialog",[Jl]=Zt(Fr),[jv,rt]=Jl(Fr),Kl=e=>{const{__scopeDialog:t,children:n,open:r,defaultOpen:o,onOpenChange:s,modal:i=!0}=e,l=v.useRef(null),c=v.useRef(null),[u,d]=cn({prop:r,defaultProp:o??!1,onChange:s,caller:Fr});return a.jsx(jv,{scope:t,triggerRef:l,contentRef:c,contentId:pt(),titleId:pt(),descriptionId:pt(),open:u,onOpenChange:d,onOpenToggle:v.useCallback(()=>d(p=>!p),[d]),modal:i,children:n})};Kl.displayName=Fr;var Gl="DialogTrigger",Yl=v.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=rt(Gl,n),s=Ie(t,o.triggerRef);return a.jsx(Se.button,{type:"button","aria-haspopup":"dialog","aria-expanded":o.open,"aria-controls":o.contentId,"data-state":bs(o.open),...r,ref:s,onClick:ye(e.onClick,o.onOpenToggle)})});Yl.displayName=Gl;var vs="DialogPortal",[Ev,Xl]=Jl(vs,{forceMount:void 0}),Ql=e=>{const{__scopeDialog:t,forceMount:n,children:r,container:o}=e,s=rt(vs,t);return a.jsx(Ev,{scope:t,forceMount:n,children:v.Children.map(r,i=>a.jsx(Wt,{present:n||s.open,children:a.jsx(Dr,{asChild:!0,container:o,children:i})}))})};Ql.displayName=vs;var wr="DialogOverlay",ec=v.forwardRef((e,t)=>{const n=Xl(wr,e.__scopeDialog),{forceMount:r=n.forceMount,...o}=e,s=rt(wr,e.__scopeDialog);return s.modal?a.jsx(Wt,{present:r||s.open,children:a.jsx(Tv,{...o,ref:t})}):null});ec.displayName=wr;var Nv=ln("DialogOverlay.RemoveScroll"),Tv=v.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=rt(wr,n);return a.jsx(xs,{as:Nv,allowPinchZoom:!0,shards:[o.contentRef],children:a.jsx(Se.div,{"data-state":bs(o.open),...r,ref:t,style:{pointerEvents:"auto",...r.style}})})}),Pt="DialogContent",tc=v.forwardRef((e,t)=>{const n=Xl(Pt,e.__scopeDialog),{forceMount:r=n.forceMount,...o}=e,s=rt(Pt,e.__scopeDialog);return a.jsx(Wt,{present:r||s.open,children:s.modal?a.jsx(Av,{...o,ref:t}):a.jsx(zv,{...o,ref:t})})});tc.displayName=Pt;var Av=v.forwardRef((e,t)=>{const n=rt(Pt,e.__scopeDialog),r=v.useRef(null),o=Ie(t,n.contentRef,r);return v.useEffect(()=>{const s=r.current;if(s)return ql(s)},[]),a.jsx(nc,{...e,ref:o,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:ye(e.onCloseAutoFocus,s=>{s.preventDefault(),n.triggerRef.current?.focus()}),onPointerDownOutside:ye(e.onPointerDownOutside,s=>{const i=s.detail.originalEvent,l=i.button===0&&i.ctrlKey===!0;(i.button===2||l)&&s.preventDefault()}),onFocusOutside:ye(e.onFocusOutside,s=>s.preventDefault())})}),zv=v.forwardRef((e,t)=>{const n=rt(Pt,e.__scopeDialog),r=v.useRef(!1),o=v.useRef(!1);return a.jsx(nc,{...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()}})}),nc=v.forwardRef((e,t)=>{const{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:o,onCloseAutoFocus:s,...i}=e,l=rt(Pt,n),c=v.useRef(null),u=Ie(t,c);return Ll(),a.jsxs(a.Fragment,{children:[a.jsx(gs,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:o,onUnmountAutoFocus:s,children:a.jsx(Mr,{role:"dialog",id:l.contentId,"aria-describedby":l.descriptionId,"aria-labelledby":l.titleId,"data-state":bs(l.open),...i,ref:u,onDismiss:()=>l.onOpenChange(!1)})}),a.jsxs(a.Fragment,{children:[a.jsx(Iv,{titleId:l.titleId}),a.jsx(Pv,{contentRef:c,descriptionId:l.descriptionId})]})]})}),ys="DialogTitle",rc=v.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=rt(ys,n);return a.jsx(Se.h2,{id:o.titleId,...r,ref:t})});rc.displayName=ys;var oc="DialogDescription",Ov=v.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=rt(oc,n);return a.jsx(Se.p,{id:o.descriptionId,...r,ref:t})});Ov.displayName=oc;var sc="DialogClose",ic=v.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=rt(sc,n);return a.jsx(Se.button,{type:"button",...r,ref:t,onClick:ye(e.onClick,()=>o.onOpenChange(!1))})});ic.displayName=sc;function bs(e){return e?"open":"closed"}var ac="DialogTitleWarning",[y5,lc]=p1(ac,{contentName:Pt,titleName:ys,docsSlug:"dialog"}),Iv=({titleId:e})=>{const t=lc(ac),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 v.useEffect(()=>{e&&(document.getElementById(e)||console.error(n))},[n,e]),null},Rv="DialogDescriptionWarning",Pv=({contentRef:e,descriptionId:t})=>{const r=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${lc(Rv).contentName}}.`;return v.useEffect(()=>{const o=e.current?.getAttribute("aria-describedby");t&&o&&(document.getElementById(t)||console.warn(r))},[r,e,t]),null},Mv=Kl,Dv=Yl,Lv=Ql,Fv=ec,$v=tc,Bv=rc,Uv=ic;function Zv(e){const t=v.useRef({value:e,previous:e});return v.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}function Wv(e){const[t,n]=v.useState(void 0);return We(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});const r=new ResizeObserver(o=>{if(!Array.isArray(o)||!o.length)return;const s=o[0];let i,l;if("borderBoxSize"in s){const c=s.borderBoxSize,u=Array.isArray(c)?c[0]:c;i=u.inlineSize,l=u.blockSize}else i=e.offsetWidth,l=e.offsetHeight;n({width:i,height:l})});return r.observe(e,{box:"border-box"}),()=>r.unobserve(e)}else n(void 0)},[e]),t}const Vv=["top","right","bottom","left"],Ct=Math.min,Je=Math.max,_r=Math.round,ar=Math.floor,at=e=>({x:e,y:e}),Hv={left:"right",right:"left",bottom:"top",top:"bottom"},qv={start:"end",end:"start"};function Po(e,t,n){return Je(e,Ct(t,n))}function gt(e,t){return typeof e=="function"?e(t):e}function xt(e){return e.split("-")[0]}function gn(e){return e.split("-")[1]}function ws(e){return e==="x"?"y":"x"}function _s(e){return e==="y"?"height":"width"}const Jv=new Set(["top","bottom"]);function it(e){return Jv.has(xt(e))?"y":"x"}function ks(e){return ws(it(e))}function Kv(e,t,n){n===void 0&&(n=!1);const r=gn(e),o=ks(e),s=_s(o);let i=o==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[s]>t.floating[s]&&(i=kr(i)),[i,kr(i)]}function Gv(e){const t=kr(e);return[Mo(e),t,Mo(t)]}function Mo(e){return e.replace(/start|end/g,t=>qv[t])}const Oi=["left","right"],Ii=["right","left"],Yv=["top","bottom"],Xv=["bottom","top"];function Qv(e,t,n){switch(e){case"top":case"bottom":return n?t?Ii:Oi:t?Oi:Ii;case"left":case"right":return t?Yv:Xv;default:return[]}}function ey(e,t,n,r){const o=gn(e);let s=Qv(xt(e),n==="start",r);return o&&(s=s.map(i=>i+"-"+o),t&&(s=s.concat(s.map(Mo)))),s}function kr(e){return e.replace(/left|right|bottom|top/g,t=>Hv[t])}function ty(e){return{top:0,right:0,bottom:0,left:0,...e}}function cc(e){return typeof e!="number"?ty(e):{top:e,right:e,bottom:e,left:e}}function Cr(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 Ri(e,t,n){let{reference:r,floating:o}=e;const s=it(t),i=ks(t),l=_s(i),c=xt(t),u=s==="y",d=r.x+r.width/2-o.width/2,p=r.y+r.height/2-o.height/2,m=r[l]/2-o[l]/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:p};break;case"left":h={x:r.x-o.width,y:p};break;default:h={x:r.x,y:r.y}}switch(gn(t)){case"start":h[i]-=m*(n&&u?-1:1);break;case"end":h[i]+=m*(n&&u?-1:1);break}return h}async function ny(e,t){var n;t===void 0&&(t={});const{x:r,y:o,platform:s,rects:i,elements:l,strategy:c}=e,{boundary:u="clippingAncestors",rootBoundary:d="viewport",elementContext:p="floating",altBoundary:m=!1,padding:h=0}=gt(t,e),g=cc(h),x=l[m?p==="floating"?"reference":"floating":p],y=Cr(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(l.floating)),boundary:u,rootBoundary:d,strategy:c})),_=p==="floating"?{x:r,y:o,width:i.floating.width,height:i.floating.height}:i.reference,k=await(s.getOffsetParent==null?void 0:s.getOffsetParent(l.floating)),C=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},S=Cr(s.convertOffsetParentRelativeRectToViewportRelativeRect?await s.convertOffsetParentRelativeRectToViewportRelativeRect({elements:l,rect:_,offsetParent:k,strategy:c}):_);return{top:(y.top-S.top+g.top)/C.y,bottom:(S.bottom-y.bottom+g.bottom)/C.y,left:(y.left-S.left+g.left)/C.x,right:(S.right-y.right+g.right)/C.x}}const ry=async(e,t,n)=>{const{placement:r="bottom",strategy:o="absolute",middleware:s=[],platform:i}=n,l=s.filter(Boolean),c=await(i.isRTL==null?void 0:i.isRTL(t));let u=await i.getElementRects({reference:e,floating:t,strategy:o}),{x:d,y:p}=Ri(u,r,c),m=r,h={},g=0;for(let x=0;x<l.length;x++){var f;const{name:y,fn:_}=l[x],{x:k,y:C,data:S,reset:z}=await _({x:d,y:p,initialPlacement:r,placement:m,strategy:o,middlewareData:h,rects:u,platform:{...i,detectOverflow:(f=i.detectOverflow)!=null?f:ny},elements:{reference:e,floating:t}});d=k??d,p=C??p,h={...h,[y]:{...h[y],...S}},z&&g<=50&&(g++,typeof z=="object"&&(z.placement&&(m=z.placement),z.rects&&(u=z.rects===!0?await i.getElementRects({reference:e,floating:t,strategy:o}):z.rects),{x:d,y:p}=Ri(u,m,c)),x=-1)}return{x:d,y:p,placement:m,strategy:o,middlewareData:h}},oy=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:r,placement:o,rects:s,platform:i,elements:l,middlewareData:c}=t,{element:u,padding:d=0}=gt(e,t)||{};if(u==null)return{};const p=cc(d),m={x:n,y:r},h=ks(o),g=_s(h),f=await i.getDimensions(u),x=h==="y",y=x?"top":"left",_=x?"bottom":"right",k=x?"clientHeight":"clientWidth",C=s.reference[g]+s.reference[h]-m[h]-s.floating[g],S=m[h]-s.reference[h],z=await(i.getOffsetParent==null?void 0:i.getOffsetParent(u));let N=z?z[k]:0;(!N||!await(i.isElement==null?void 0:i.isElement(z)))&&(N=l.floating[k]||s.floating[g]);const A=C/2-S/2,O=N/2-f[g]/2-1,R=Ct(p[y],O),G=Ct(p[_],O),j=R,I=N-f[g]-G,b=N/2-f[g]/2+A,M=Po(j,b,I),V=!c.arrow&&gn(o)!=null&&b!==M&&s.reference[g]/2-(b<j?R:G)-f[g]/2<0,P=V?b<j?b-j:b-I:0;return{[h]:m[h]+P,data:{[h]:M,centerOffset:b-M-P,...V&&{alignmentOffset:P}},reset:V}}}),sy=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,r;const{placement:o,middlewareData:s,rects:i,initialPlacement:l,platform:c,elements:u}=t,{mainAxis:d=!0,crossAxis:p=!0,fallbackPlacements:m,fallbackStrategy:h="bestFit",fallbackAxisSideDirection:g="none",flipAlignment:f=!0,...x}=gt(e,t);if((n=s.arrow)!=null&&n.alignmentOffset)return{};const y=xt(o),_=it(l),k=xt(l)===l,C=await(c.isRTL==null?void 0:c.isRTL(u.floating)),S=m||(k||!f?[kr(l)]:Gv(l)),z=g!=="none";!m&&z&&S.push(...ey(l,f,g,C));const N=[l,...S],A=await c.detectOverflow(t,x),O=[];let R=((r=s.flip)==null?void 0:r.overflows)||[];if(d&&O.push(A[y]),p){const b=Kv(o,i,C);O.push(A[b[0]],A[b[1]])}if(R=[...R,{placement:o,overflows:O}],!O.every(b=>b<=0)){var G,j;const b=(((G=s.flip)==null?void 0:G.index)||0)+1,M=N[b];if(M&&(!(p==="alignment"?_!==it(M):!1)||R.every(F=>it(F.placement)===_?F.overflows[0]>0:!0)))return{data:{index:b,overflows:R},reset:{placement:M}};let V=(j=R.filter(P=>P.overflows[0]<=0).sort((P,F)=>P.overflows[1]-F.overflows[1])[0])==null?void 0:j.placement;if(!V)switch(h){case"bestFit":{var I;const P=(I=R.filter(F=>{if(z){const W=it(F.placement);return W===_||W==="y"}return!0}).map(F=>[F.placement,F.overflows.filter(W=>W>0).reduce((W,oe)=>W+oe,0)]).sort((F,W)=>F[1]-W[1])[0])==null?void 0:I[0];P&&(V=P);break}case"initialPlacement":V=l;break}if(o!==V)return{reset:{placement:V}}}return{}}}};function Pi(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function Mi(e){return Vv.some(t=>e[t]>=0)}const iy=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n,platform:r}=t,{strategy:o="referenceHidden",...s}=gt(e,t);switch(o){case"referenceHidden":{const i=await r.detectOverflow(t,{...s,elementContext:"reference"}),l=Pi(i,n.reference);return{data:{referenceHiddenOffsets:l,referenceHidden:Mi(l)}}}case"escaped":{const i=await r.detectOverflow(t,{...s,altBoundary:!0}),l=Pi(i,n.floating);return{data:{escapedOffsets:l,escaped:Mi(l)}}}default:return{}}}}},uc=new Set(["left","top"]);async function ay(e,t){const{placement:n,platform:r,elements:o}=e,s=await(r.isRTL==null?void 0:r.isRTL(o.floating)),i=xt(n),l=gn(n),c=it(n)==="y",u=uc.has(i)?-1:1,d=s&&c?-1:1,p=gt(t,e);let{mainAxis:m,crossAxis:h,alignmentAxis:g}=typeof p=="number"?{mainAxis:p,crossAxis:0,alignmentAxis:null}:{mainAxis:p.mainAxis||0,crossAxis:p.crossAxis||0,alignmentAxis:p.alignmentAxis};return l&&typeof g=="number"&&(h=l==="end"?g*-1:g),c?{x:h*d,y:m*u}:{x:m*u,y:h*d}}const ly=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,r;const{x:o,y:s,placement:i,middlewareData:l}=t,c=await ay(t,e);return i===((n=l.offset)==null?void 0:n.placement)&&(r=l.arrow)!=null&&r.alignmentOffset?{}:{x:o+c.x,y:s+c.y,data:{...c,placement:i}}}}},cy=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:r,placement:o,platform:s}=t,{mainAxis:i=!0,crossAxis:l=!1,limiter:c={fn:y=>{let{x:_,y:k}=y;return{x:_,y:k}}},...u}=gt(e,t),d={x:n,y:r},p=await s.detectOverflow(t,u),m=it(xt(o)),h=ws(m);let g=d[h],f=d[m];if(i){const y=h==="y"?"top":"left",_=h==="y"?"bottom":"right",k=g+p[y],C=g-p[_];g=Po(k,g,C)}if(l){const y=m==="y"?"top":"left",_=m==="y"?"bottom":"right",k=f+p[y],C=f-p[_];f=Po(k,f,C)}const x=c.fn({...t,[h]:g,[m]:f});return{...x,data:{x:x.x-n,y:x.y-r,enabled:{[h]:i,[m]:l}}}}}},uy=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:n,y:r,placement:o,rects:s,middlewareData:i}=t,{offset:l=0,mainAxis:c=!0,crossAxis:u=!0}=gt(e,t),d={x:n,y:r},p=it(o),m=ws(p);let h=d[m],g=d[p];const f=gt(l,t),x=typeof f=="number"?{mainAxis:f,crossAxis:0}:{mainAxis:0,crossAxis:0,...f};if(c){const k=m==="y"?"height":"width",C=s.reference[m]-s.floating[k]+x.mainAxis,S=s.reference[m]+s.reference[k]-x.mainAxis;h<C?h=C:h>S&&(h=S)}if(u){var y,_;const k=m==="y"?"width":"height",C=uc.has(xt(o)),S=s.reference[p]-s.floating[k]+(C&&((y=i.offset)==null?void 0:y[p])||0)+(C?0:x.crossAxis),z=s.reference[p]+s.reference[k]+(C?0:((_=i.offset)==null?void 0:_[p])||0)-(C?x.crossAxis:0);g<S?g=S:g>z&&(g=z)}return{[m]:h,[p]:g}}}},dy=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var n,r;const{placement:o,rects:s,platform:i,elements:l}=t,{apply:c=()=>{},...u}=gt(e,t),d=await i.detectOverflow(t,u),p=xt(o),m=gn(o),h=it(o)==="y",{width:g,height:f}=s.floating;let x,y;p==="top"||p==="bottom"?(x=p,y=m===(await(i.isRTL==null?void 0:i.isRTL(l.floating))?"start":"end")?"left":"right"):(y=p,x=m==="end"?"top":"bottom");const _=f-d.top-d.bottom,k=g-d.left-d.right,C=Ct(f-d[x],_),S=Ct(g-d[y],k),z=!t.middlewareData.shift;let N=C,A=S;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(A=k),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(N=_),z&&!m){const R=Je(d.left,0),G=Je(d.right,0),j=Je(d.top,0),I=Je(d.bottom,0);h?A=g-2*(R!==0||G!==0?R+G:Je(d.left,d.right)):N=f-2*(j!==0||I!==0?j+I:Je(d.top,d.bottom))}await c({...t,availableWidth:A,availableHeight:N});const O=await i.getDimensions(l.floating);return g!==O.width||f!==O.height?{reset:{rects:!0}}:{}}}};function $r(){return typeof window<"u"}function xn(e){return dc(e)?(e.nodeName||"").toLowerCase():"#document"}function Ke(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function ct(e){var t;return(t=(dc(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function dc(e){return $r()?e instanceof Node||e instanceof Ke(e).Node:!1}function tt(e){return $r()?e instanceof Element||e instanceof Ke(e).Element:!1}function lt(e){return $r()?e instanceof HTMLElement||e instanceof Ke(e).HTMLElement:!1}function Di(e){return!$r()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof Ke(e).ShadowRoot}const fy=new Set(["inline","contents"]);function Wn(e){const{overflow:t,overflowX:n,overflowY:r,display:o}=nt(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&!fy.has(o)}const hy=new Set(["table","td","th"]);function py(e){return hy.has(xn(e))}const my=[":popover-open",":modal"];function Br(e){return my.some(t=>{try{return e.matches(t)}catch{return!1}})}const gy=["transform","translate","scale","rotate","perspective"],xy=["transform","translate","scale","rotate","perspective","filter"],vy=["paint","layout","strict","content"];function Cs(e){const t=Ss(),n=tt(e)?nt(e):e;return gy.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)||xy.some(r=>(n.willChange||"").includes(r))||vy.some(r=>(n.contain||"").includes(r))}function yy(e){let t=St(e);for(;lt(t)&&!un(t);){if(Cs(t))return t;if(Br(t))return null;t=St(t)}return null}function Ss(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const by=new Set(["html","body","#document"]);function un(e){return by.has(xn(e))}function nt(e){return Ke(e).getComputedStyle(e)}function Ur(e){return tt(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function St(e){if(xn(e)==="html")return e;const t=e.assignedSlot||e.parentNode||Di(e)&&e.host||ct(e);return Di(t)?t.host:t}function fc(e){const t=St(e);return un(t)?e.ownerDocument?e.ownerDocument.body:e.body:lt(t)&&Wn(t)?t:fc(t)}function Dn(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);const o=fc(e),s=o===((r=e.ownerDocument)==null?void 0:r.body),i=Ke(o);if(s){const l=Do(i);return t.concat(i,i.visualViewport||[],Wn(o)?o:[],l&&n?Dn(l):[])}return t.concat(o,Dn(o,[],n))}function Do(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function hc(e){const t=nt(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const o=lt(e),s=o?e.offsetWidth:n,i=o?e.offsetHeight:r,l=_r(n)!==s||_r(r)!==i;return l&&(n=s,r=i),{width:n,height:r,$:l}}function js(e){return tt(e)?e:e.contextElement}function nn(e){const t=js(e);if(!lt(t))return at(1);const n=t.getBoundingClientRect(),{width:r,height:o,$:s}=hc(t);let i=(s?_r(n.width):n.width)/r,l=(s?_r(n.height):n.height)/o;return(!i||!Number.isFinite(i))&&(i=1),(!l||!Number.isFinite(l))&&(l=1),{x:i,y:l}}const wy=at(0);function pc(e){const t=Ke(e);return!Ss()||!t.visualViewport?wy:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function _y(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==Ke(e)?!1:t}function Mt(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const o=e.getBoundingClientRect(),s=js(e);let i=at(1);t&&(r?tt(r)&&(i=nn(r)):i=nn(e));const l=_y(s,n,r)?pc(s):at(0);let c=(o.left+l.x)/i.x,u=(o.top+l.y)/i.y,d=o.width/i.x,p=o.height/i.y;if(s){const m=Ke(s),h=r&&tt(r)?Ke(r):r;let g=m,f=Do(g);for(;f&&r&&h!==g;){const x=nn(f),y=f.getBoundingClientRect(),_=nt(f),k=y.left+(f.clientLeft+parseFloat(_.paddingLeft))*x.x,C=y.top+(f.clientTop+parseFloat(_.paddingTop))*x.y;c*=x.x,u*=x.y,d*=x.x,p*=x.y,c+=k,u+=C,g=Ke(f),f=Do(g)}}return Cr({width:d,height:p,x:c,y:u})}function Zr(e,t){const n=Ur(e).scrollLeft;return t?t.left+n:Mt(ct(e)).left+n}function mc(e,t){const n=e.getBoundingClientRect(),r=n.left+t.scrollLeft-Zr(e,n),o=n.top+t.scrollTop;return{x:r,y:o}}function ky(e){let{elements:t,rect:n,offsetParent:r,strategy:o}=e;const s=o==="fixed",i=ct(r),l=t?Br(t.floating):!1;if(r===i||l&&s)return n;let c={scrollLeft:0,scrollTop:0},u=at(1);const d=at(0),p=lt(r);if((p||!p&&!s)&&((xn(r)!=="body"||Wn(i))&&(c=Ur(r)),lt(r))){const h=Mt(r);u=nn(r),d.x=h.x+r.clientLeft,d.y=h.y+r.clientTop}const m=i&&!p&&!s?mc(i,c):at(0);return{width:n.width*u.x,height:n.height*u.y,x:n.x*u.x-c.scrollLeft*u.x+d.x+m.x,y:n.y*u.y-c.scrollTop*u.y+d.y+m.y}}function Cy(e){return Array.from(e.getClientRects())}function Sy(e){const t=ct(e),n=Ur(e),r=e.ownerDocument.body,o=Je(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),s=Je(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let i=-n.scrollLeft+Zr(e);const l=-n.scrollTop;return nt(r).direction==="rtl"&&(i+=Je(t.clientWidth,r.clientWidth)-o),{width:o,height:s,x:i,y:l}}const Li=25;function jy(e,t){const n=Ke(e),r=ct(e),o=n.visualViewport;let s=r.clientWidth,i=r.clientHeight,l=0,c=0;if(o){s=o.width,i=o.height;const d=Ss();(!d||d&&t==="fixed")&&(l=o.offsetLeft,c=o.offsetTop)}const u=Zr(r);if(u<=0){const d=r.ownerDocument,p=d.body,m=getComputedStyle(p),h=d.compatMode==="CSS1Compat"&&parseFloat(m.marginLeft)+parseFloat(m.marginRight)||0,g=Math.abs(r.clientWidth-p.clientWidth-h);g<=Li&&(s-=g)}else u<=Li&&(s+=u);return{width:s,height:i,x:l,y:c}}const Ey=new Set(["absolute","fixed"]);function Ny(e,t){const n=Mt(e,!0,t==="fixed"),r=n.top+e.clientTop,o=n.left+e.clientLeft,s=lt(e)?nn(e):at(1),i=e.clientWidth*s.x,l=e.clientHeight*s.y,c=o*s.x,u=r*s.y;return{width:i,height:l,x:c,y:u}}function Fi(e,t,n){let r;if(t==="viewport")r=jy(e,n);else if(t==="document")r=Sy(ct(e));else if(tt(t))r=Ny(t,n);else{const o=pc(e);r={x:t.x-o.x,y:t.y-o.y,width:t.width,height:t.height}}return Cr(r)}function gc(e,t){const n=St(e);return n===t||!tt(n)||un(n)?!1:nt(n).position==="fixed"||gc(n,t)}function Ty(e,t){const n=t.get(e);if(n)return n;let r=Dn(e,[],!1).filter(l=>tt(l)&&xn(l)!=="body"),o=null;const s=nt(e).position==="fixed";let i=s?St(e):e;for(;tt(i)&&!un(i);){const l=nt(i),c=Cs(i);!c&&l.position==="fixed"&&(o=null),(s?!c&&!o:!c&&l.position==="static"&&!!o&&Ey.has(o.position)||Wn(i)&&!c&&gc(e,i))?r=r.filter(d=>d!==i):o=l,i=St(i)}return t.set(e,r),r}function Ay(e){let{element:t,boundary:n,rootBoundary:r,strategy:o}=e;const i=[...n==="clippingAncestors"?Br(t)?[]:Ty(t,this._c):[].concat(n),r],l=i[0],c=i.reduce((u,d)=>{const p=Fi(t,d,o);return u.top=Je(p.top,u.top),u.right=Ct(p.right,u.right),u.bottom=Ct(p.bottom,u.bottom),u.left=Je(p.left,u.left),u},Fi(t,l,o));return{width:c.right-c.left,height:c.bottom-c.top,x:c.left,y:c.top}}function zy(e){const{width:t,height:n}=hc(e);return{width:t,height:n}}function Oy(e,t,n){const r=lt(t),o=ct(t),s=n==="fixed",i=Mt(e,!0,s,t);let l={scrollLeft:0,scrollTop:0};const c=at(0);function u(){c.x=Zr(o)}if(r||!r&&!s)if((xn(t)!=="body"||Wn(o))&&(l=Ur(t)),r){const h=Mt(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?mc(o,l):at(0),p=i.left+l.scrollLeft-c.x-d.x,m=i.top+l.scrollTop-c.y-d.y;return{x:p,y:m,width:i.width,height:i.height}}function ho(e){return nt(e).position==="static"}function $i(e,t){if(!lt(e)||nt(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return ct(e)===n&&(n=n.ownerDocument.body),n}function xc(e,t){const n=Ke(e);if(Br(e))return n;if(!lt(e)){let o=St(e);for(;o&&!un(o);){if(tt(o)&&!ho(o))return o;o=St(o)}return n}let r=$i(e,t);for(;r&&py(r)&&ho(r);)r=$i(r,t);return r&&un(r)&&ho(r)&&!Cs(r)?n:r||yy(e)||n}const Iy=async function(e){const t=this.getOffsetParent||xc,n=this.getDimensions,r=await n(e.floating);return{reference:Oy(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function Ry(e){return nt(e).direction==="rtl"}const Py={convertOffsetParentRelativeRectToViewportRelativeRect:ky,getDocumentElement:ct,getClippingRect:Ay,getOffsetParent:xc,getElementRects:Iy,getClientRects:Cy,getDimensions:zy,getScale:nn,isElement:tt,isRTL:Ry};function vc(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function My(e,t){let n=null,r;const o=ct(e);function s(){var l;clearTimeout(r),(l=n)==null||l.disconnect(),n=null}function i(l,c){l===void 0&&(l=!1),c===void 0&&(c=1),s();const u=e.getBoundingClientRect(),{left:d,top:p,width:m,height:h}=u;if(l||t(),!m||!h)return;const g=ar(p),f=ar(o.clientWidth-(d+m)),x=ar(o.clientHeight-(p+h)),y=ar(d),k={rootMargin:-g+"px "+-f+"px "+-x+"px "+-y+"px",threshold:Je(0,Ct(1,c))||1};let C=!0;function S(z){const N=z[0].intersectionRatio;if(N!==c){if(!C)return i();N?i(!1,N):r=setTimeout(()=>{i(!1,1e-7)},1e3)}N===1&&!vc(u,e.getBoundingClientRect())&&i(),C=!1}try{n=new IntersectionObserver(S,{...k,root:o.ownerDocument})}catch{n=new IntersectionObserver(S,k)}n.observe(e)}return i(!0),s}function Dy(e,t,n,r){r===void 0&&(r={});const{ancestorScroll:o=!0,ancestorResize:s=!0,elementResize:i=typeof ResizeObserver=="function",layoutShift:l=typeof IntersectionObserver=="function",animationFrame:c=!1}=r,u=js(e),d=o||s?[...u?Dn(u):[],...Dn(t)]:[];d.forEach(y=>{o&&y.addEventListener("scroll",n,{passive:!0}),s&&y.addEventListener("resize",n)});const p=u&&l?My(u,n):null;let m=-1,h=null;i&&(h=new ResizeObserver(y=>{let[_]=y;_&&_.target===u&&h&&(h.unobserve(t),cancelAnimationFrame(m),m=requestAnimationFrame(()=>{var k;(k=h)==null||k.observe(t)})),n()}),u&&!c&&h.observe(u),h.observe(t));let g,f=c?Mt(e):null;c&&x();function x(){const y=Mt(e);f&&!vc(f,y)&&n(),f=y,g=requestAnimationFrame(x)}return n(),()=>{var y;d.forEach(_=>{o&&_.removeEventListener("scroll",n),s&&_.removeEventListener("resize",n)}),p?.(),(y=h)==null||y.disconnect(),h=null,c&&cancelAnimationFrame(g)}}const Ly=ly,Fy=cy,$y=sy,By=dy,Uy=iy,Bi=oy,Zy=uy,Wy=(e,t,n)=>{const r=new Map,o={platform:Py,...n},s={...o.platform,_c:r};return ry(e,t,{...o,platform:s})};var Vy=typeof document<"u",Hy=function(){},fr=Vy?v.useLayoutEffect:Hy;function Sr(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(!Sr(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)&&!Sr(e[s],t[s]))return!1}return!0}return e!==e&&t!==t}function yc(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function Ui(e,t){const n=yc(e);return Math.round(t*n)/n}function po(e){const t=v.useRef(e);return fr(()=>{t.current=e}),t}function qy(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:r=[],platform:o,elements:{reference:s,floating:i}={},transform:l=!0,whileElementsMounted:c,open:u}=e,[d,p]=v.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[m,h]=v.useState(r);Sr(m,r)||h(r);const[g,f]=v.useState(null),[x,y]=v.useState(null),_=v.useCallback(F=>{F!==z.current&&(z.current=F,f(F))},[]),k=v.useCallback(F=>{F!==N.current&&(N.current=F,y(F))},[]),C=s||g,S=i||x,z=v.useRef(null),N=v.useRef(null),A=v.useRef(d),O=c!=null,R=po(c),G=po(o),j=po(u),I=v.useCallback(()=>{if(!z.current||!N.current)return;const F={placement:t,strategy:n,middleware:m};G.current&&(F.platform=G.current),Wy(z.current,N.current,F).then(W=>{const oe={...W,isPositioned:j.current!==!1};b.current&&!Sr(A.current,oe)&&(A.current=oe,$n.flushSync(()=>{p(oe)}))})},[m,t,n,G,j]);fr(()=>{u===!1&&A.current.isPositioned&&(A.current.isPositioned=!1,p(F=>({...F,isPositioned:!1})))},[u]);const b=v.useRef(!1);fr(()=>(b.current=!0,()=>{b.current=!1}),[]),fr(()=>{if(C&&(z.current=C),S&&(N.current=S),C&&S){if(R.current)return R.current(C,S,I);I()}},[C,S,I,R,O]);const M=v.useMemo(()=>({reference:z,floating:N,setReference:_,setFloating:k}),[_,k]),V=v.useMemo(()=>({reference:C,floating:S}),[C,S]),P=v.useMemo(()=>{const F={position:n,left:0,top:0};if(!V.floating)return F;const W=Ui(V.floating,d.x),oe=Ui(V.floating,d.y);return l?{...F,transform:"translate("+W+"px, "+oe+"px)",...yc(V.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:W,top:oe}},[n,l,V.floating,d.x,d.y]);return v.useMemo(()=>({...d,update:I,refs:M,elements:V,floatingStyles:P}),[d,I,M,V,P])}const Jy=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?Bi({element:r.current,padding:o}).fn(n):{}:r?Bi({element:r,padding:o}).fn(n):{}}}},Ky=(e,t)=>({...Ly(e),options:[e,t]}),Gy=(e,t)=>({...Fy(e),options:[e,t]}),Yy=(e,t)=>({...Zy(e),options:[e,t]}),Xy=(e,t)=>({...$y(e),options:[e,t]}),Qy=(e,t)=>({...By(e),options:[e,t]}),eb=(e,t)=>({...Uy(e),options:[e,t]}),tb=(e,t)=>({...Jy(e),options:[e,t]});var nb="Arrow",bc=v.forwardRef((e,t)=>{const{children:n,width:r=10,height:o=5,...s}=e;return a.jsx(Se.svg,{...s,ref:t,width:r,height:o,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?n:a.jsx("polygon",{points:"0,0 30,0 15,10"})})});bc.displayName=nb;var rb=bc,Es="Popper",[wc,Wr]=Zt(Es),[ob,_c]=wc(Es),kc=e=>{const{__scopePopper:t,children:n}=e,[r,o]=v.useState(null);return a.jsx(ob,{scope:t,anchor:r,onAnchorChange:o,children:n})};kc.displayName=Es;var Cc="PopperAnchor",Sc=v.forwardRef((e,t)=>{const{__scopePopper:n,virtualRef:r,...o}=e,s=_c(Cc,n),i=v.useRef(null),l=Ie(t,i),c=v.useRef(null);return v.useEffect(()=>{const u=c.current;c.current=r?.current||i.current,u!==c.current&&s.onAnchorChange(c.current)}),r?null:a.jsx(Se.div,{...o,ref:l})});Sc.displayName=Cc;var Ns="PopperContent",[sb,ib]=wc(Ns),jc=v.forwardRef((e,t)=>{const{__scopePopper:n,side:r="bottom",sideOffset:o=0,align:s="center",alignOffset:i=0,arrowPadding:l=0,avoidCollisions:c=!0,collisionBoundary:u=[],collisionPadding:d=0,sticky:p="partial",hideWhenDetached:m=!1,updatePositionStrategy:h="optimized",onPlaced:g,...f}=e,x=_c(Ns,n),[y,_]=v.useState(null),k=Ie(t,X=>_(X)),[C,S]=v.useState(null),z=Wv(C),N=z?.width??0,A=z?.height??0,O=r+(s!=="center"?"-"+s:""),R=typeof d=="number"?d:{top:0,right:0,bottom:0,left:0,...d},G=Array.isArray(u)?u:[u],j=G.length>0,I={padding:R,boundary:G.filter(lb),altBoundary:j},{refs:b,floatingStyles:M,placement:V,isPositioned:P,middlewareData:F}=qy({strategy:"fixed",placement:O,whileElementsMounted:(...X)=>Dy(...X,{animationFrame:h==="always"}),elements:{reference:x.anchor},middleware:[Ky({mainAxis:o+A,alignmentAxis:i}),c&&Gy({mainAxis:!0,crossAxis:!1,limiter:p==="partial"?Yy():void 0,...I}),c&&Xy({...I}),Qy({...I,apply:({elements:X,rects:ie,availableWidth:ae,availableHeight:pe})=>{const{width:fe,height:we}=ie.reference,Te=X.floating.style;Te.setProperty("--radix-popper-available-width",`${ae}px`),Te.setProperty("--radix-popper-available-height",`${pe}px`),Te.setProperty("--radix-popper-anchor-width",`${fe}px`),Te.setProperty("--radix-popper-anchor-height",`${we}px`)}}),C&&tb({element:C,padding:l}),cb({arrowWidth:N,arrowHeight:A}),m&&eb({strategy:"referenceHidden",...I})]}),[W,oe]=Tc(V),Z=kt(g);We(()=>{P&&Z?.()},[P,Z]);const U=F.arrow?.x,te=F.arrow?.y,ee=F.arrow?.centerOffset!==0,[J,ue]=v.useState();return We(()=>{y&&ue(window.getComputedStyle(y).zIndex)},[y]),a.jsx("div",{ref:b.setFloating,"data-radix-popper-content-wrapper":"",style:{...M,transform:P?M.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:J,"--radix-popper-transform-origin":[F.transformOrigin?.x,F.transformOrigin?.y].join(" "),...F.hide?.referenceHidden&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:a.jsx(sb,{scope:n,placedSide:W,onArrowChange:S,arrowX:U,arrowY:te,shouldHideArrow:ee,children:a.jsx(Se.div,{"data-side":W,"data-align":oe,...f,ref:k,style:{...f.style,animation:P?void 0:"none"}})})})});jc.displayName=Ns;var Ec="PopperArrow",ab={top:"bottom",right:"left",bottom:"top",left:"right"},Nc=v.forwardRef(function(t,n){const{__scopePopper:r,...o}=t,s=ib(Ec,r),i=ab[s.placedSide];return a.jsx("span",{ref:s.onArrowChange,style:{position:"absolute",left:s.arrowX,top:s.arrowY,[i]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[s.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[s.placedSide],visibility:s.shouldHideArrow?"hidden":void 0},children:a.jsx(rb,{...o,ref:n,style:{...o.style,display:"block"}})})});Nc.displayName=Ec;function lb(e){return e!==null}var cb=e=>({name:"transformOrigin",options:e,fn(t){const{placement:n,rects:r,middlewareData:o}=t,i=o.arrow?.centerOffset!==0,l=i?0:e.arrowWidth,c=i?0:e.arrowHeight,[u,d]=Tc(n),p={start:"0%",center:"50%",end:"100%"}[d],m=(o.arrow?.x??0)+l/2,h=(o.arrow?.y??0)+c/2;let g="",f="";return u==="bottom"?(g=i?p:`${m}px`,f=`${-c}px`):u==="top"?(g=i?p:`${m}px`,f=`${r.floating.height+c}px`):u==="right"?(g=`${-c}px`,f=i?p:`${h}px`):u==="left"&&(g=`${r.floating.width+c}px`,f=i?p:`${h}px`),{data:{x:g,y:f}}}});function Tc(e){const[t,n="center"]=e.split("-");return[t,n]}var Ac=kc,zc=Sc,Oc=jc,Ic=Nc,mo="rovingFocusGroup.onEntryFocus",ub={bubbles:!1,cancelable:!0},Vn="RovingFocusGroup",[Lo,Rc,db]=Rl(Vn),[fb,Pc]=Zt(Vn,[db]),[hb,pb]=fb(Vn),Mc=v.forwardRef((e,t)=>a.jsx(Lo.Provider,{scope:e.__scopeRovingFocusGroup,children:a.jsx(Lo.Slot,{scope:e.__scopeRovingFocusGroup,children:a.jsx(mb,{...e,ref:t})})}));Mc.displayName=Vn;var mb=v.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,orientation:r,loop:o=!1,dir:s,currentTabStopId:i,defaultCurrentTabStopId:l,onCurrentTabStopIdChange:c,onEntryFocus:u,preventScrollOnEntryFocus:d=!1,...p}=e,m=v.useRef(null),h=Ie(t,m),g=ms(s),[f,x]=cn({prop:i,defaultProp:l??null,onChange:c,caller:Vn}),[y,_]=v.useState(!1),k=kt(u),C=Rc(n),S=v.useRef(!1),[z,N]=v.useState(0);return v.useEffect(()=>{const A=m.current;if(A)return A.addEventListener(mo,k),()=>A.removeEventListener(mo,k)},[k]),a.jsx(hb,{scope:n,orientation:r,dir:g,loop:o,currentTabStopId:f,onItemFocus:v.useCallback(A=>x(A),[x]),onItemShiftTab:v.useCallback(()=>_(!0),[]),onFocusableItemAdd:v.useCallback(()=>N(A=>A+1),[]),onFocusableItemRemove:v.useCallback(()=>N(A=>A-1),[]),children:a.jsx(Se.div,{tabIndex:y||z===0?-1:0,"data-orientation":r,...p,ref:h,style:{outline:"none",...e.style},onMouseDown:ye(e.onMouseDown,()=>{S.current=!0}),onFocus:ye(e.onFocus,A=>{const O=!S.current;if(A.target===A.currentTarget&&O&&!y){const R=new CustomEvent(mo,ub);if(A.currentTarget.dispatchEvent(R),!R.defaultPrevented){const G=C().filter(V=>V.focusable),j=G.find(V=>V.active),I=G.find(V=>V.id===f),M=[j,I,...G].filter(Boolean).map(V=>V.ref.current);Fc(M,d)}}S.current=!1}),onBlur:ye(e.onBlur,()=>_(!1))})})}),Dc="RovingFocusGroupItem",Lc=v.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,focusable:r=!0,active:o=!1,tabStopId:s,children:i,...l}=e,c=pt(),u=s||c,d=pb(Dc,n),p=d.currentTabStopId===u,m=Rc(n),{onFocusableItemAdd:h,onFocusableItemRemove:g,currentTabStopId:f}=d;return v.useEffect(()=>{if(r)return h(),()=>g()},[r,h,g]),a.jsx(Lo.ItemSlot,{scope:n,id:u,focusable:r,active:o,children:a.jsx(Se.span,{tabIndex:p?0:-1,"data-orientation":d.orientation,...l,ref:t,onMouseDown:ye(e.onMouseDown,x=>{r?d.onItemFocus(u):x.preventDefault()}),onFocus:ye(e.onFocus,()=>d.onItemFocus(u)),onKeyDown:ye(e.onKeyDown,x=>{if(x.key==="Tab"&&x.shiftKey){d.onItemShiftTab();return}if(x.target!==x.currentTarget)return;const y=vb(x,d.orientation,d.dir);if(y!==void 0){if(x.metaKey||x.ctrlKey||x.altKey||x.shiftKey)return;x.preventDefault();let k=m().filter(C=>C.focusable).map(C=>C.ref.current);if(y==="last")k.reverse();else if(y==="prev"||y==="next"){y==="prev"&&k.reverse();const C=k.indexOf(x.currentTarget);k=d.loop?yb(k,C+1):k.slice(C+1)}setTimeout(()=>Fc(k))}}),children:typeof i=="function"?i({isCurrentTabStop:p,hasTabStop:f!=null}):i})})});Lc.displayName=Dc;var gb={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function xb(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function vb(e,t,n){const r=xb(e.key,n);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(r))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(r)))return gb[r]}function Fc(e,t=!1){const n=document.activeElement;for(const r of e)if(r===n||(r.focus({preventScroll:t}),document.activeElement!==n))return}function yb(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var bb=Mc,wb=Lc;function Zi(e,[t,n]){return Math.min(n,Math.max(t,e))}var _b=[" ","Enter","ArrowUp","ArrowDown"],kb=[" ","Enter"],Dt="Select",[Vr,Hr,Cb]=Rl(Dt),[vn]=Zt(Dt,[Cb,Wr]),qr=Wr(),[Sb,Nt]=vn(Dt),[jb,Eb]=vn(Dt),$c=e=>{const{__scopeSelect:t,children:n,open:r,defaultOpen:o,onOpenChange:s,value:i,defaultValue:l,onValueChange:c,dir:u,name:d,autoComplete:p,disabled:m,required:h,form:g}=e,f=qr(t),[x,y]=v.useState(null),[_,k]=v.useState(null),[C,S]=v.useState(!1),z=ms(u),[N,A]=cn({prop:r,defaultProp:o??!1,onChange:s,caller:Dt}),[O,R]=cn({prop:i,defaultProp:l,onChange:c,caller:Dt}),G=v.useRef(null),j=x?g||!!x.closest("form"):!0,[I,b]=v.useState(new Set),M=Array.from(I).map(V=>V.props.value).join(";");return a.jsx(Ac,{...f,children:a.jsxs(Sb,{required:h,scope:t,trigger:x,onTriggerChange:y,valueNode:_,onValueNodeChange:k,valueNodeHasChildren:C,onValueNodeHasChildrenChange:S,contentId:pt(),value:O,onValueChange:R,open:N,onOpenChange:A,dir:z,triggerPointerDownPosRef:G,disabled:m,children:[a.jsx(Vr.Provider,{scope:t,children:a.jsx(jb,{scope:e.__scopeSelect,onNativeOptionAdd:v.useCallback(V=>{b(P=>new Set(P).add(V))},[]),onNativeOptionRemove:v.useCallback(V=>{b(P=>{const F=new Set(P);return F.delete(V),F})},[]),children:n})}),j?a.jsxs(lu,{"aria-hidden":!0,required:h,tabIndex:-1,name:d,autoComplete:p,value:O,onChange:V=>R(V.target.value),disabled:m,form:g,children:[O===void 0?a.jsx("option",{value:""}):null,Array.from(I)]},M):null]})})};$c.displayName=Dt;var Bc="SelectTrigger",Uc=v.forwardRef((e,t)=>{const{__scopeSelect:n,disabled:r=!1,...o}=e,s=qr(n),i=Nt(Bc,n),l=i.disabled||r,c=Ie(t,i.onTriggerChange),u=Hr(n),d=v.useRef("touch"),[p,m,h]=uu(f=>{const x=u().filter(k=>!k.disabled),y=x.find(k=>k.value===i.value),_=du(x,f,y);_!==void 0&&i.onValueChange(_.value)}),g=f=>{l||(i.onOpenChange(!0),h()),f&&(i.triggerPointerDownPosRef.current={x:Math.round(f.pageX),y:Math.round(f.pageY)})};return a.jsx(zc,{asChild:!0,...s,children:a.jsx(Se.button,{type:"button",role:"combobox","aria-controls":i.contentId,"aria-expanded":i.open,"aria-required":i.required,"aria-autocomplete":"none",dir:i.dir,"data-state":i.open?"open":"closed",disabled:l,"data-disabled":l?"":void 0,"data-placeholder":cu(i.value)?"":void 0,...o,ref:c,onClick:ye(o.onClick,f=>{f.currentTarget.focus(),d.current!=="mouse"&&g(f)}),onPointerDown:ye(o.onPointerDown,f=>{d.current=f.pointerType;const x=f.target;x.hasPointerCapture(f.pointerId)&&x.releasePointerCapture(f.pointerId),f.button===0&&f.ctrlKey===!1&&f.pointerType==="mouse"&&(g(f),f.preventDefault())}),onKeyDown:ye(o.onKeyDown,f=>{const x=p.current!=="";!(f.ctrlKey||f.altKey||f.metaKey)&&f.key.length===1&&m(f.key),!(x&&f.key===" ")&&_b.includes(f.key)&&(g(),f.preventDefault())})})})});Uc.displayName=Bc;var Zc="SelectValue",Wc=v.forwardRef((e,t)=>{const{__scopeSelect:n,className:r,style:o,children:s,placeholder:i="",...l}=e,c=Nt(Zc,n),{onValueNodeHasChildrenChange:u}=c,d=s!==void 0,p=Ie(t,c.onValueNodeChange);return We(()=>{u(d)},[u,d]),a.jsx(Se.span,{...l,ref:p,style:{pointerEvents:"none"},children:cu(c.value)?a.jsx(a.Fragment,{children:i}):s})});Wc.displayName=Zc;var Nb="SelectIcon",Vc=v.forwardRef((e,t)=>{const{__scopeSelect:n,children:r,...o}=e;return a.jsx(Se.span,{"aria-hidden":!0,...o,ref:t,children:r||"▼"})});Vc.displayName=Nb;var Tb="SelectPortal",Hc=e=>a.jsx(Dr,{asChild:!0,...e});Hc.displayName=Tb;var Lt="SelectContent",qc=v.forwardRef((e,t)=>{const n=Nt(Lt,e.__scopeSelect),[r,o]=v.useState();if(We(()=>{o(new DocumentFragment)},[]),!n.open){const s=r;return s?$n.createPortal(a.jsx(Jc,{scope:e.__scopeSelect,children:a.jsx(Vr.Slot,{scope:e.__scopeSelect,children:a.jsx("div",{children:e.children})})}),s):null}return a.jsx(Kc,{...e,ref:t})});qc.displayName=Lt;var et=10,[Jc,Tt]=vn(Lt),Ab="SelectContentImpl",zb=ln("SelectContent.RemoveScroll"),Kc=v.forwardRef((e,t)=>{const{__scopeSelect:n,position:r="item-aligned",onCloseAutoFocus:o,onEscapeKeyDown:s,onPointerDownOutside:i,side:l,sideOffset:c,align:u,alignOffset:d,arrowPadding:p,collisionBoundary:m,collisionPadding:h,sticky:g,hideWhenDetached:f,avoidCollisions:x,...y}=e,_=Nt(Lt,n),[k,C]=v.useState(null),[S,z]=v.useState(null),N=Ie(t,X=>C(X)),[A,O]=v.useState(null),[R,G]=v.useState(null),j=Hr(n),[I,b]=v.useState(!1),M=v.useRef(!1);v.useEffect(()=>{if(k)return ql(k)},[k]),Ll();const V=v.useCallback(X=>{const[ie,...ae]=j().map(we=>we.ref.current),[pe]=ae.slice(-1),fe=document.activeElement;for(const we of X)if(we===fe||(we?.scrollIntoView({block:"nearest"}),we===ie&&S&&(S.scrollTop=0),we===pe&&S&&(S.scrollTop=S.scrollHeight),we?.focus(),document.activeElement!==fe))return},[j,S]),P=v.useCallback(()=>V([A,k]),[V,A,k]);v.useEffect(()=>{I&&P()},[I,P]);const{onOpenChange:F,triggerPointerDownPosRef:W}=_;v.useEffect(()=>{if(k){let X={x:0,y:0};const ie=pe=>{X={x:Math.abs(Math.round(pe.pageX)-(W.current?.x??0)),y:Math.abs(Math.round(pe.pageY)-(W.current?.y??0))}},ae=pe=>{X.x<=10&&X.y<=10?pe.preventDefault():k.contains(pe.target)||F(!1),document.removeEventListener("pointermove",ie),W.current=null};return W.current!==null&&(document.addEventListener("pointermove",ie),document.addEventListener("pointerup",ae,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",ie),document.removeEventListener("pointerup",ae,{capture:!0})}}},[k,F,W]),v.useEffect(()=>{const X=()=>F(!1);return window.addEventListener("blur",X),window.addEventListener("resize",X),()=>{window.removeEventListener("blur",X),window.removeEventListener("resize",X)}},[F]);const[oe,Z]=uu(X=>{const ie=j().filter(fe=>!fe.disabled),ae=ie.find(fe=>fe.ref.current===document.activeElement),pe=du(ie,X,ae);pe&&setTimeout(()=>pe.ref.current.focus())}),U=v.useCallback((X,ie,ae)=>{const pe=!M.current&&!ae;(_.value!==void 0&&_.value===ie||pe)&&(O(X),pe&&(M.current=!0))},[_.value]),te=v.useCallback(()=>k?.focus(),[k]),ee=v.useCallback((X,ie,ae)=>{const pe=!M.current&&!ae;(_.value!==void 0&&_.value===ie||pe)&&G(X)},[_.value]),J=r==="popper"?Fo:Gc,ue=J===Fo?{side:l,sideOffset:c,align:u,alignOffset:d,arrowPadding:p,collisionBoundary:m,collisionPadding:h,sticky:g,hideWhenDetached:f,avoidCollisions:x}:{};return a.jsx(Jc,{scope:n,content:k,viewport:S,onViewportChange:z,itemRefCallback:U,selectedItem:A,onItemLeave:te,itemTextRefCallback:ee,focusSelectedItem:P,selectedItemText:R,position:r,isPositioned:I,searchRef:oe,children:a.jsx(xs,{as:zb,allowPinchZoom:!0,children:a.jsx(gs,{asChild:!0,trapped:_.open,onMountAutoFocus:X=>{X.preventDefault()},onUnmountAutoFocus:ye(o,X=>{_.trigger?.focus({preventScroll:!0}),X.preventDefault()}),children:a.jsx(Mr,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:s,onPointerDownOutside:i,onFocusOutside:X=>X.preventDefault(),onDismiss:()=>_.onOpenChange(!1),children:a.jsx(J,{role:"listbox",id:_.contentId,"data-state":_.open?"open":"closed",dir:_.dir,onContextMenu:X=>X.preventDefault(),...y,...ue,onPlaced:()=>b(!0),ref:N,style:{display:"flex",flexDirection:"column",outline:"none",...y.style},onKeyDown:ye(y.onKeyDown,X=>{const ie=X.ctrlKey||X.altKey||X.metaKey;if(X.key==="Tab"&&X.preventDefault(),!ie&&X.key.length===1&&Z(X.key),["ArrowUp","ArrowDown","Home","End"].includes(X.key)){let pe=j().filter(fe=>!fe.disabled).map(fe=>fe.ref.current);if(["ArrowUp","End"].includes(X.key)&&(pe=pe.slice().reverse()),["ArrowUp","ArrowDown"].includes(X.key)){const fe=X.target,we=pe.indexOf(fe);pe=pe.slice(we+1)}setTimeout(()=>V(pe)),X.preventDefault()}})})})})})})});Kc.displayName=Ab;var Ob="SelectItemAlignedPosition",Gc=v.forwardRef((e,t)=>{const{__scopeSelect:n,onPlaced:r,...o}=e,s=Nt(Lt,n),i=Tt(Lt,n),[l,c]=v.useState(null),[u,d]=v.useState(null),p=Ie(t,N=>d(N)),m=Hr(n),h=v.useRef(!1),g=v.useRef(!0),{viewport:f,selectedItem:x,selectedItemText:y,focusSelectedItem:_}=i,k=v.useCallback(()=>{if(s.trigger&&s.valueNode&&l&&u&&f&&x&&y){const N=s.trigger.getBoundingClientRect(),A=u.getBoundingClientRect(),O=s.valueNode.getBoundingClientRect(),R=y.getBoundingClientRect();if(s.dir!=="rtl"){const fe=R.left-A.left,we=O.left-fe,Te=N.left-we,w=N.width+Te,Y=Math.max(w,A.width),q=window.innerWidth-et,T=Zi(we,[et,Math.max(et,q-Y)]);l.style.minWidth=w+"px",l.style.left=T+"px"}else{const fe=A.right-R.right,we=window.innerWidth-O.right-fe,Te=window.innerWidth-N.right-we,w=N.width+Te,Y=Math.max(w,A.width),q=window.innerWidth-et,T=Zi(we,[et,Math.max(et,q-Y)]);l.style.minWidth=w+"px",l.style.right=T+"px"}const G=m(),j=window.innerHeight-et*2,I=f.scrollHeight,b=window.getComputedStyle(u),M=parseInt(b.borderTopWidth,10),V=parseInt(b.paddingTop,10),P=parseInt(b.borderBottomWidth,10),F=parseInt(b.paddingBottom,10),W=M+V+I+F+P,oe=Math.min(x.offsetHeight*5,W),Z=window.getComputedStyle(f),U=parseInt(Z.paddingTop,10),te=parseInt(Z.paddingBottom,10),ee=N.top+N.height/2-et,J=j-ee,ue=x.offsetHeight/2,X=x.offsetTop+ue,ie=M+V+X,ae=W-ie;if(ie<=ee){const fe=G.length>0&&x===G[G.length-1].ref.current;l.style.bottom="0px";const we=u.clientHeight-f.offsetTop-f.offsetHeight,Te=Math.max(J,ue+(fe?te:0)+we+P),w=ie+Te;l.style.height=w+"px"}else{const fe=G.length>0&&x===G[0].ref.current;l.style.top="0px";const Te=Math.max(ee,M+f.offsetTop+(fe?U:0)+ue)+ae;l.style.height=Te+"px",f.scrollTop=ie-ee+f.offsetTop}l.style.margin=`${et}px 0`,l.style.minHeight=oe+"px",l.style.maxHeight=j+"px",r?.(),requestAnimationFrame(()=>h.current=!0)}},[m,s.trigger,s.valueNode,l,u,f,x,y,s.dir,r]);We(()=>k(),[k]);const[C,S]=v.useState();We(()=>{u&&S(window.getComputedStyle(u).zIndex)},[u]);const z=v.useCallback(N=>{N&&g.current===!0&&(k(),_?.(),g.current=!1)},[k,_]);return a.jsx(Rb,{scope:n,contentWrapper:l,shouldExpandOnScrollRef:h,onScrollButtonChange:z,children:a.jsx("div",{ref:c,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:C},children:a.jsx(Se.div,{...o,ref:p,style:{boxSizing:"border-box",maxHeight:"100%",...o.style}})})})});Gc.displayName=Ob;var Ib="SelectPopperPosition",Fo=v.forwardRef((e,t)=>{const{__scopeSelect:n,align:r="start",collisionPadding:o=et,...s}=e,i=qr(n);return a.jsx(Oc,{...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)"}})});Fo.displayName=Ib;var[Rb,Ts]=vn(Lt,{}),$o="SelectViewport",Yc=v.forwardRef((e,t)=>{const{__scopeSelect:n,nonce:r,...o}=e,s=Tt($o,n),i=Ts($o,n),l=Ie(t,s.onViewportChange),c=v.useRef(0);return a.jsxs(a.Fragment,{children:[a.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}"},nonce:r}),a.jsx(Vr.Slot,{scope:n,children:a.jsx(Se.div,{"data-radix-select-viewport":"",role:"presentation",...o,ref:l,style:{position:"relative",flex:1,overflow:"hidden auto",...o.style},onScroll:ye(o.onScroll,u=>{const d=u.currentTarget,{contentWrapper:p,shouldExpandOnScrollRef:m}=i;if(m?.current&&p){const h=Math.abs(c.current-d.scrollTop);if(h>0){const g=window.innerHeight-et*2,f=parseFloat(p.style.minHeight),x=parseFloat(p.style.height),y=Math.max(f,x);if(y<g){const _=y+h,k=Math.min(g,_),C=_-k;p.style.height=k+"px",p.style.bottom==="0px"&&(d.scrollTop=C>0?C:0,p.style.justifyContent="flex-end")}}}c.current=d.scrollTop})})})]})});Yc.displayName=$o;var Xc="SelectGroup",[Pb,Mb]=vn(Xc),Db=v.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,o=pt();return a.jsx(Pb,{scope:n,id:o,children:a.jsx(Se.div,{role:"group","aria-labelledby":o,...r,ref:t})})});Db.displayName=Xc;var Qc="SelectLabel",Lb=v.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,o=Mb(Qc,n);return a.jsx(Se.div,{id:o.id,...r,ref:t})});Lb.displayName=Qc;var jr="SelectItem",[Fb,eu]=vn(jr),tu=v.forwardRef((e,t)=>{const{__scopeSelect:n,value:r,disabled:o=!1,textValue:s,...i}=e,l=Nt(jr,n),c=Tt(jr,n),u=l.value===r,[d,p]=v.useState(s??""),[m,h]=v.useState(!1),g=Ie(t,_=>c.itemRefCallback?.(_,r,o)),f=pt(),x=v.useRef("touch"),y=()=>{o||(l.onValueChange(r),l.onOpenChange(!1))};if(r==="")throw new Error("A <Select.Item /> must have a value prop that is not an empty string. This is because the Select value can be set to an empty string to clear the selection and show the placeholder.");return a.jsx(Fb,{scope:n,value:r,disabled:o,textId:f,isSelected:u,onItemTextChange:v.useCallback(_=>{p(k=>k||(_?.textContent??"").trim())},[]),children:a.jsx(Vr.ItemSlot,{scope:n,value:r,disabled:o,textValue:d,children:a.jsx(Se.div,{role:"option","aria-labelledby":f,"data-highlighted":m?"":void 0,"aria-selected":u&&m,"data-state":u?"checked":"unchecked","aria-disabled":o||void 0,"data-disabled":o?"":void 0,tabIndex:o?void 0:-1,...i,ref:g,onFocus:ye(i.onFocus,()=>h(!0)),onBlur:ye(i.onBlur,()=>h(!1)),onClick:ye(i.onClick,()=>{x.current!=="mouse"&&y()}),onPointerUp:ye(i.onPointerUp,()=>{x.current==="mouse"&&y()}),onPointerDown:ye(i.onPointerDown,_=>{x.current=_.pointerType}),onPointerMove:ye(i.onPointerMove,_=>{x.current=_.pointerType,o?c.onItemLeave?.():x.current==="mouse"&&_.currentTarget.focus({preventScroll:!0})}),onPointerLeave:ye(i.onPointerLeave,_=>{_.currentTarget===document.activeElement&&c.onItemLeave?.()}),onKeyDown:ye(i.onKeyDown,_=>{c.searchRef?.current!==""&&_.key===" "||(kb.includes(_.key)&&y(),_.key===" "&&_.preventDefault())})})})})});tu.displayName=jr;var An="SelectItemText",nu=v.forwardRef((e,t)=>{const{__scopeSelect:n,className:r,style:o,...s}=e,i=Nt(An,n),l=Tt(An,n),c=eu(An,n),u=Eb(An,n),[d,p]=v.useState(null),m=Ie(t,y=>p(y),c.onItemTextChange,y=>l.itemTextRefCallback?.(y,c.value,c.disabled)),h=d?.textContent,g=v.useMemo(()=>a.jsx("option",{value:c.value,disabled:c.disabled,children:h},c.value),[c.disabled,c.value,h]),{onNativeOptionAdd:f,onNativeOptionRemove:x}=u;return We(()=>(f(g),()=>x(g)),[f,x,g]),a.jsxs(a.Fragment,{children:[a.jsx(Se.span,{id:c.textId,...s,ref:m}),c.isSelected&&i.valueNode&&!i.valueNodeHasChildren?$n.createPortal(s.children,i.valueNode):null]})});nu.displayName=An;var ru="SelectItemIndicator",ou=v.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e;return eu(ru,n).isSelected?a.jsx(Se.span,{"aria-hidden":!0,...r,ref:t}):null});ou.displayName=ru;var Bo="SelectScrollUpButton",su=v.forwardRef((e,t)=>{const n=Tt(Bo,e.__scopeSelect),r=Ts(Bo,e.__scopeSelect),[o,s]=v.useState(!1),i=Ie(t,r.onScrollButtonChange);return We(()=>{if(n.viewport&&n.isPositioned){let l=function(){const u=c.scrollTop>0;s(u)};const c=n.viewport;return l(),c.addEventListener("scroll",l),()=>c.removeEventListener("scroll",l)}},[n.viewport,n.isPositioned]),o?a.jsx(au,{...e,ref:i,onAutoScroll:()=>{const{viewport:l,selectedItem:c}=n;l&&c&&(l.scrollTop=l.scrollTop-c.offsetHeight)}}):null});su.displayName=Bo;var Uo="SelectScrollDownButton",iu=v.forwardRef((e,t)=>{const n=Tt(Uo,e.__scopeSelect),r=Ts(Uo,e.__scopeSelect),[o,s]=v.useState(!1),i=Ie(t,r.onScrollButtonChange);return We(()=>{if(n.viewport&&n.isPositioned){let l=function(){const u=c.scrollHeight-c.clientHeight,d=Math.ceil(c.scrollTop)<u;s(d)};const c=n.viewport;return l(),c.addEventListener("scroll",l),()=>c.removeEventListener("scroll",l)}},[n.viewport,n.isPositioned]),o?a.jsx(au,{...e,ref:i,onAutoScroll:()=>{const{viewport:l,selectedItem:c}=n;l&&c&&(l.scrollTop=l.scrollTop+c.offsetHeight)}}):null});iu.displayName=Uo;var au=v.forwardRef((e,t)=>{const{__scopeSelect:n,onAutoScroll:r,...o}=e,s=Tt("SelectScrollButton",n),i=v.useRef(null),l=Hr(n),c=v.useCallback(()=>{i.current!==null&&(window.clearInterval(i.current),i.current=null)},[]);return v.useEffect(()=>()=>c(),[c]),We(()=>{l().find(d=>d.ref.current===document.activeElement)?.ref.current?.scrollIntoView({block:"nearest"})},[l]),a.jsx(Se.div,{"aria-hidden":!0,...o,ref:t,style:{flexShrink:0,...o.style},onPointerDown:ye(o.onPointerDown,()=>{i.current===null&&(i.current=window.setInterval(r,50))}),onPointerMove:ye(o.onPointerMove,()=>{s.onItemLeave?.(),i.current===null&&(i.current=window.setInterval(r,50))}),onPointerLeave:ye(o.onPointerLeave,()=>{c()})})}),$b="SelectSeparator",Bb=v.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e;return a.jsx(Se.div,{"aria-hidden":!0,...r,ref:t})});Bb.displayName=$b;var Zo="SelectArrow",Ub=v.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,o=qr(n),s=Nt(Zo,n),i=Tt(Zo,n);return s.open&&i.position==="popper"?a.jsx(Ic,{...o,...r,ref:t}):null});Ub.displayName=Zo;var Zb="SelectBubbleInput",lu=v.forwardRef(({__scopeSelect:e,value:t,...n},r)=>{const o=v.useRef(null),s=Ie(r,o),i=Zv(t);return v.useEffect(()=>{const l=o.current;if(!l)return;const c=window.HTMLSelectElement.prototype,d=Object.getOwnPropertyDescriptor(c,"value").set;if(i!==t&&d){const p=new Event("change",{bubbles:!0});d.call(l,t),l.dispatchEvent(p)}},[i,t]),a.jsx(Se.select,{...n,style:{...Ol,...n.style},ref:s,defaultValue:t})});lu.displayName=Zb;function cu(e){return e===""||e===void 0}function uu(e){const t=kt(e),n=v.useRef(""),r=v.useRef(0),o=v.useCallback(i=>{const l=n.current+i;t(l),(function c(u){n.current=u,window.clearTimeout(r.current),u!==""&&(r.current=window.setTimeout(()=>c(""),1e3))})(l)},[t]),s=v.useCallback(()=>{n.current="",window.clearTimeout(r.current)},[]);return v.useEffect(()=>()=>window.clearTimeout(r.current),[]),[n,o,s]}function du(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=Wb(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 Wb(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var Vb=$c,Hb=Uc,qb=Wc,Jb=Vc,Kb=Hc,Gb=qc,Yb=Yc,Xb=tu,Qb=nu,e2=ou,t2=su,n2=iu,Jr="Tabs",[r2]=Zt(Jr,[Pc]),fu=Pc(),[o2,As]=r2(Jr),hu=v.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,onValueChange:o,defaultValue:s,orientation:i="horizontal",dir:l,activationMode:c="automatic",...u}=e,d=ms(l),[p,m]=cn({prop:r,onChange:o,defaultProp:s??"",caller:Jr});return a.jsx(o2,{scope:n,baseId:pt(),value:p,onValueChange:m,orientation:i,dir:d,activationMode:c,children:a.jsx(Se.div,{dir:d,"data-orientation":i,...u,ref:t})})});hu.displayName=Jr;var pu="TabsList",mu=v.forwardRef((e,t)=>{const{__scopeTabs:n,loop:r=!0,...o}=e,s=As(pu,n),i=fu(n);return a.jsx(bb,{asChild:!0,...i,orientation:s.orientation,dir:s.dir,loop:r,children:a.jsx(Se.div,{role:"tablist","aria-orientation":s.orientation,...o,ref:t})})});mu.displayName=pu;var gu="TabsTrigger",xu=v.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,disabled:o=!1,...s}=e,i=As(gu,n),l=fu(n),c=bu(i.baseId,r),u=wu(i.baseId,r),d=r===i.value;return a.jsx(wb,{asChild:!0,...l,focusable:!o,active:d,children:a.jsx(Se.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:ye(e.onMouseDown,p=>{!o&&p.button===0&&p.ctrlKey===!1?i.onValueChange(r):p.preventDefault()}),onKeyDown:ye(e.onKeyDown,p=>{[" ","Enter"].includes(p.key)&&i.onValueChange(r)}),onFocus:ye(e.onFocus,()=>{const p=i.activationMode!=="manual";!d&&!o&&p&&i.onValueChange(r)})})})});xu.displayName=gu;var vu="TabsContent",yu=v.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,forceMount:o,children:s,...i}=e,l=As(vu,n),c=bu(l.baseId,r),u=wu(l.baseId,r),d=r===l.value,p=v.useRef(d);return v.useEffect(()=>{const m=requestAnimationFrame(()=>p.current=!1);return()=>cancelAnimationFrame(m)},[]),a.jsx(Wt,{present:o||d,children:({present:m})=>a.jsx(Se.div,{"data-state":d?"active":"inactive","data-orientation":l.orientation,role:"tabpanel","aria-labelledby":c,hidden:!m,id:u,tabIndex:0,...i,ref:t,style:{...e.style,animationDuration:p.current?"0s":void 0},children:m&&s})})});yu.displayName=vu;function bu(e,t){return`${e}-trigger-${t}`}function wu(e,t){return`${e}-content-${t}`}var s2=hu,i2=mu,a2=xu,l2=yu,[Kr]=Zt("Tooltip",[Wr]),Gr=Wr(),_u="TooltipProvider",c2=700,Wo="tooltip.open",[u2,zs]=Kr(_u),ku=e=>{const{__scopeTooltip:t,delayDuration:n=c2,skipDelayDuration:r=300,disableHoverableContent:o=!1,children:s}=e,i=v.useRef(!0),l=v.useRef(!1),c=v.useRef(0);return v.useEffect(()=>{const u=c.current;return()=>window.clearTimeout(u)},[]),a.jsx(u2,{scope:t,isOpenDelayedRef:i,delayDuration:n,onOpen:v.useCallback(()=>{window.clearTimeout(c.current),i.current=!1},[]),onClose:v.useCallback(()=>{window.clearTimeout(c.current),c.current=window.setTimeout(()=>i.current=!0,r)},[r]),isPointerInTransitRef:l,onPointerInTransitChange:v.useCallback(u=>{l.current=u},[]),disableHoverableContent:o,children:s})};ku.displayName=_u;var Ln="Tooltip",[d2,Hn]=Kr(Ln),Cu=e=>{const{__scopeTooltip:t,children:n,open:r,defaultOpen:o,onOpenChange:s,disableHoverableContent:i,delayDuration:l}=e,c=zs(Ln,e.__scopeTooltip),u=Gr(t),[d,p]=v.useState(null),m=pt(),h=v.useRef(0),g=i??c.disableHoverableContent,f=l??c.delayDuration,x=v.useRef(!1),[y,_]=cn({prop:r,defaultProp:o??!1,onChange:N=>{N?(c.onOpen(),document.dispatchEvent(new CustomEvent(Wo))):c.onClose(),s?.(N)},caller:Ln}),k=v.useMemo(()=>y?x.current?"delayed-open":"instant-open":"closed",[y]),C=v.useCallback(()=>{window.clearTimeout(h.current),h.current=0,x.current=!1,_(!0)},[_]),S=v.useCallback(()=>{window.clearTimeout(h.current),h.current=0,_(!1)},[_]),z=v.useCallback(()=>{window.clearTimeout(h.current),h.current=window.setTimeout(()=>{x.current=!0,_(!0),h.current=0},f)},[f,_]);return v.useEffect(()=>()=>{h.current&&(window.clearTimeout(h.current),h.current=0)},[]),a.jsx(Ac,{...u,children:a.jsx(d2,{scope:t,contentId:m,open:y,stateAttribute:k,trigger:d,onTriggerChange:p,onTriggerEnter:v.useCallback(()=>{c.isOpenDelayedRef.current?z():C()},[c.isOpenDelayedRef,z,C]),onTriggerLeave:v.useCallback(()=>{g?S():(window.clearTimeout(h.current),h.current=0)},[S,g]),onOpen:C,onClose:S,disableHoverableContent:g,children:n})})};Cu.displayName=Ln;var Vo="TooltipTrigger",Su=v.forwardRef((e,t)=>{const{__scopeTooltip:n,...r}=e,o=Hn(Vo,n),s=zs(Vo,n),i=Gr(n),l=v.useRef(null),c=Ie(t,l,o.onTriggerChange),u=v.useRef(!1),d=v.useRef(!1),p=v.useCallback(()=>u.current=!1,[]);return v.useEffect(()=>()=>document.removeEventListener("pointerup",p),[p]),a.jsx(zc,{asChild:!0,...i,children:a.jsx(Se.button,{"aria-describedby":o.open?o.contentId:void 0,"data-state":o.stateAttribute,...r,ref:c,onPointerMove:ye(e.onPointerMove,m=>{m.pointerType!=="touch"&&!d.current&&!s.isPointerInTransitRef.current&&(o.onTriggerEnter(),d.current=!0)}),onPointerLeave:ye(e.onPointerLeave,()=>{o.onTriggerLeave(),d.current=!1}),onPointerDown:ye(e.onPointerDown,()=>{o.open&&o.onClose(),u.current=!0,document.addEventListener("pointerup",p,{once:!0})}),onFocus:ye(e.onFocus,()=>{u.current||o.onOpen()}),onBlur:ye(e.onBlur,o.onClose),onClick:ye(e.onClick,o.onClose)})})});Su.displayName=Vo;var Os="TooltipPortal",[f2,h2]=Kr(Os,{forceMount:void 0}),ju=e=>{const{__scopeTooltip:t,forceMount:n,children:r,container:o}=e,s=Hn(Os,t);return a.jsx(f2,{scope:t,forceMount:n,children:a.jsx(Wt,{present:n||s.open,children:a.jsx(Dr,{asChild:!0,container:o,children:r})})})};ju.displayName=Os;var dn="TooltipContent",Eu=v.forwardRef((e,t)=>{const n=h2(dn,e.__scopeTooltip),{forceMount:r=n.forceMount,side:o="top",...s}=e,i=Hn(dn,e.__scopeTooltip);return a.jsx(Wt,{present:r||i.open,children:i.disableHoverableContent?a.jsx(Nu,{side:o,...s,ref:t}):a.jsx(p2,{side:o,...s,ref:t})})}),p2=v.forwardRef((e,t)=>{const n=Hn(dn,e.__scopeTooltip),r=zs(dn,e.__scopeTooltip),o=v.useRef(null),s=Ie(t,o),[i,l]=v.useState(null),{trigger:c,onClose:u}=n,d=o.current,{onPointerInTransitChange:p}=r,m=v.useCallback(()=>{l(null),p(!1)},[p]),h=v.useCallback((g,f)=>{const x=g.currentTarget,y={x:g.clientX,y:g.clientY},_=v2(y,x.getBoundingClientRect()),k=y2(y,_),C=b2(f.getBoundingClientRect()),S=_2([...k,...C]);l(S),p(!0)},[p]);return v.useEffect(()=>()=>m(),[m]),v.useEffect(()=>{if(c&&d){const g=x=>h(x,d),f=x=>h(x,c);return c.addEventListener("pointerleave",g),d.addEventListener("pointerleave",f),()=>{c.removeEventListener("pointerleave",g),d.removeEventListener("pointerleave",f)}}},[c,d,h,m]),v.useEffect(()=>{if(i){const g=f=>{const x=f.target,y={x:f.clientX,y:f.clientY},_=c?.contains(x)||d?.contains(x),k=!w2(y,i);_?m():k&&(m(),u())};return document.addEventListener("pointermove",g),()=>document.removeEventListener("pointermove",g)}},[c,d,i,u,m]),a.jsx(Nu,{...e,ref:s})}),[m2,g2]=Kr(Ln,{isInside:!1}),x2=i1("TooltipContent"),Nu=v.forwardRef((e,t)=>{const{__scopeTooltip:n,children:r,"aria-label":o,onEscapeKeyDown:s,onPointerDownOutside:i,...l}=e,c=Hn(dn,n),u=Gr(n),{onClose:d}=c;return v.useEffect(()=>(document.addEventListener(Wo,d),()=>document.removeEventListener(Wo,d)),[d]),v.useEffect(()=>{if(c.trigger){const p=m=>{m.target?.contains(c.trigger)&&d()};return window.addEventListener("scroll",p,{capture:!0}),()=>window.removeEventListener("scroll",p,{capture:!0})}},[c.trigger,d]),a.jsx(Mr,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:s,onPointerDownOutside:i,onFocusOutside:p=>p.preventDefault(),onDismiss:d,children:a.jsxs(Oc,{"data-state":c.stateAttribute,...u,...l,ref:t,style:{...l.style,"--radix-tooltip-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-tooltip-content-available-width":"var(--radix-popper-available-width)","--radix-tooltip-content-available-height":"var(--radix-popper-available-height)","--radix-tooltip-trigger-width":"var(--radix-popper-anchor-width)","--radix-tooltip-trigger-height":"var(--radix-popper-anchor-height)"},children:[a.jsx(x2,{children:r}),a.jsx(m2,{scope:n,isInside:!0,children:a.jsx(h1,{id:c.contentId,role:"tooltip",children:o||r})})]})})});Eu.displayName=dn;var Tu="TooltipArrow",Au=v.forwardRef((e,t)=>{const{__scopeTooltip:n,...r}=e,o=Gr(n);return g2(Tu,n).isInside?null:a.jsx(Ic,{...o,...r,ref:t})});Au.displayName=Tu;function v2(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 y2(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 b2(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 w2(e,t){const{x:n,y:r}=e;let o=!1;for(let s=0,i=t.length-1;s<t.length;i=s++){const l=t[s],c=t[i],u=l.x,d=l.y,p=c.x,m=c.y;d>r!=m>r&&n<(p-u)*(r-d)/(m-d)+u&&(o=!o)}return o}function _2(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),k2(t)}function k2(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 C2=ku,S2=Cu,j2=Su,E2=ju,N2=Eu,T2=Au;const A2=ps("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 Yr({className:e,variant:t="default",asChild:n=!1,...r}){const o=n?o1:"span";return a.jsx(o,{"data-slot":"badge","data-variant":t,className:ve(A2({variant:t}),e),...r})}function Is({...e}){return a.jsx(Mv,{"data-slot":"dialog",...e})}function z2({...e}){return a.jsx(Dv,{"data-slot":"dialog-trigger",...e})}function O2({...e}){return a.jsx(Lv,{"data-slot":"dialog-portal",...e})}function I2({className:e,...t}){return a.jsx(Fv,{"data-slot":"dialog-overlay",className:ve("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",e),...t})}function Rs({className:e,children:t,...n}){return a.jsxs(O2,{children:[a.jsx(I2,{}),a.jsxs($v,{"data-slot":"dialog-content",className:ve("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] rounded-lg",e),...n,children:[t,a.jsxs(Uv,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground",children:[a.jsx(ml,{className:"size-4"}),a.jsx("span",{className:"sr-only",children:"Close"})]})]})]})}function Ps({className:e,...t}){return a.jsx("div",{"data-slot":"dialog-header",className:ve("flex flex-col space-y-1.5 text-center sm:text-left",e),...t})}function Ms({className:e,...t}){return a.jsx(Bv,{"data-slot":"dialog-title",className:ve("text-lg font-semibold leading-none tracking-tight",e),...t})}const R2=ps("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 Pe({className:e,variant:t,size:n,...r}){return a.jsx("button",{"data-slot":"button",className:ve(R2({variant:t,size:n,className:e})),...r})}function zu({open:e,onOpenChange:t,title:n,description:r,confirmLabel:o="Confirm",variant:s="default",onConfirm:i}){return a.jsx(Is,{open:e,onOpenChange:t,children:a.jsxs(Rs,{children:[a.jsx(Ps,{children:a.jsx(Ms,{children:n})}),a.jsx("p",{className:"text-sm text-muted-foreground",children:r}),a.jsxs("div",{className:"flex justify-end gap-2 pt-2",children:[a.jsx(Pe,{variant:"outline",size:"sm",onClick:()=>t(!1),children:"Cancel"}),a.jsx(Pe,{variant:s,size:"sm",onClick:()=>{i(),t(!1)},children:o})]})]})})}const P2={anthropic:"Anthropic",openai:"OpenAI",unknown:"Unknown"};function M2({conversationId:e,startTime:t,endTime:n,totalCalls:r,totalInputTokens:o,totalOutputTokens:s,apiFormat:i,expanded:l,onToggle:c,hideApiFormat:u=!1,isLoading:d=!1,userAgent:p,timeDisplayFormat:m,onClear:h}){const[g,f]=v.useState(!1),x=_=>{_.stopPropagation(),h!==void 0&&f(!0)},y=v.useCallback(_=>{_.stopPropagation(),window.open(sd(e),"_blank","noopener,noreferrer")},[e]);return a.jsxs("div",{role:"button",tabIndex:0,"data-nav-id":`conv-${e}`,"data-nav-action":l?"collapse":"expand",className:ve("flex items-center gap-3 px-3 py-2 cursor-pointer transition-colors","hover:bg-muted/50","select-none","border border-border rounded-lg mb-2 bg-background sticky top-0 z-10","focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1 focus-visible:outline-none"),onClick:c,onKeyDown:_=>{_.target===_.currentTarget&&(_.key==="Enter"||_.key===" ")&&(_.preventDefault(),c())},children:[l?a.jsx(hn,{className:"size-4 text-muted-foreground shrink-0"}):d?a.jsx(Pn,{className:"size-4 animate-spin text-muted-foreground shrink-0"}):a.jsx(Un,{className:"size-4 text-muted-foreground shrink-0"}),a.jsx("span",{className:"text-purple-400/90 font-mono text-xs font-semibold shrink-0",title:e,children:e.startsWith("PID:")||e.includes("|")?e:e.length>24?e.slice(0,12)+"..."+e.slice(-12):e}),p!=null&&p!==""&&a.jsxs("span",{className:"flex items-center gap-1 text-muted-foreground text-xs shrink-0",title:p,children:[a.jsx(G0,{className:"size-3"}),a.jsx("span",{className:"font-mono tabular-nums truncate max-w-[120px]",children:p})]}),!u&&a.jsx(Yr,{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:P2[i]}),a.jsxs("span",{className:"flex items-center gap-1 text-muted-foreground text-xs shrink-0",children:[a.jsx(Rt,{className:"size-3"}),a.jsx("span",{className:"font-mono tabular-nums",children:fs(t,n,m)})]}),a.jsxs("span",{className:"flex items-center gap-1 text-muted-foreground text-xs shrink-0",children:[a.jsx(us,{className:"size-3"}),a.jsxs("span",{className:"font-mono tabular-nums",children:[r," call",r!==1?"s":""]})]}),a.jsxs("span",{className:"flex items-center gap-1 text-xs shrink-0",children:[a.jsx(Mn,{className:"size-3 text-muted-foreground"}),a.jsxs("span",{className:"font-mono tabular-nums",children:[a.jsx("span",{className:"text-blue-400",children:Be(o)})," / ",a.jsx("span",{className:"text-amber-400",children:Be(s)})]})]}),a.jsx("span",{className:"flex-1 min-w-0"}),a.jsx("button",{type:"button",onClick:y,onKeyDown:_=>{(_.key==="Enter"||_.key===" ")&&y(_)},"aria-label":`Open session ${e} in a new tab`,title:"Open this session in a new tab",className:"text-muted-foreground hover:text-foreground transition-colors shrink-0 inline-flex items-center justify-center size-8 rounded hover:bg-muted cursor-pointer",children:a.jsx(fl,{className:"size-3.5"})}),h!==void 0&&a.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:a.jsx(pl,{className:"size-3.5"})}),a.jsx(zu,{open:g,onOpenChange:f,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 D2(e){const t=e.find(n=>n.apiFormat!=="unknown");return t!==void 0?t.apiFormat:e[0]?.apiFormat??"unknown"}function L2(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 F2(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 $2(e){const t=new Map;for(const r of e){const o=F2(r),s=t.get(o);s!==void 0?s.push(r):t.set(o,[r])}const n=[];for(const[r,o]of t){const s=[...o].sort((i,l)=>i.timestamp.localeCompare(l.timestamp));n.push({id:r,conversationId:r,logs:s})}return n.sort((r,o)=>(r.logs[0]?.timestamp??"").localeCompare(o.logs[0]?.timestamp??"")),n}function Wi(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function B2(e){if(e.responseText===null)return null;try{let t=JSON.parse(e.responseText);return typeof t=="string"&&(t=JSON.parse(t)),Wi(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&&Wi(t.choices[0])&&typeof t.choices[0].finish_reason=="string"&&t.choices[0].finish_reason==="stop"?"stop":null:null}catch{return null}}function Ou(e){return e==="end_turn"||e==="stop"}function Qe({className:e,style:t,d:n,eyeStalks:r,eyes:o,legs:s,extras:i}){return a.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",style:t,className:ve("inline-block size-5",e),children:[a.jsx("path",{d:n}),r,o,s,i]})}const At=a.jsxs(a.Fragment,{children:[a.jsx("line",{x1:"6.5",y1:"16",x2:"4.5",y2:"19.5"}),a.jsx("line",{x1:"9",y1:"17.5",x2:"8",y2:"20.5"}),a.jsx("line",{x1:"15",y1:"17.5",x2:"16",y2:"20.5"}),a.jsx("line",{x1:"17.5",y1:"16",x2:"19.5",y2:"19.5"})]}),Iu=a.jsxs(a.Fragment,{children:[a.jsx("line",{x1:"7",y1:"16",x2:"5.5",y2:"18.5"}),a.jsx("line",{x1:"9.5",y1:"17",x2:"8.5",y2:"19.5"}),a.jsx("line",{x1:"14.5",y1:"17",x2:"15.5",y2:"19.5"}),a.jsx("line",{x1:"17",y1:"16",x2:"18.5",y2:"18.5"})]});function Ru({className:e}){return a.jsx(Qe,{className:e,d:"M5 13 C5 9 8 7 12 7 C16 7 19 9 19 13 C19 16 16 18 12 18 C8 18 5 16 5 13 Z",eyeStalks:a.jsxs(a.Fragment,{children:[a.jsx("line",{x1:"10",y1:"7",x2:"9.5",y2:"5"}),a.jsx("line",{x1:"14",y1:"7",x2:"14.5",y2:"5"})]}),eyes:a.jsxs(a.Fragment,{children:[a.jsx("circle",{cx:"9.5",cy:"4.5",r:"0.9",fill:"currentColor",stroke:"none"}),a.jsx("circle",{cx:"14.5",cy:"4.5",r:"0.9",fill:"currentColor",stroke:"none"})]}),legs:At,extras:a.jsxs(a.Fragment,{children:[a.jsx("path",{d:"M5 11 C3.5 9.5 1.5 10 2 12.5 C2.5 14 4 13.5 5 12.5"}),a.jsx("path",{d:"M19 11 C20.5 9.5 22.5 10 22 12.5 C21.5 14 20 13.5 19 12.5"})]})})}function U2({className:e}){return a.jsx(Qe,{className:e,d:"M4 13 C4 7 7.5 5.5 12 5.5 C16.5 5.5 20 7 20 13 C20 17.5 16.5 19 12 19 C7.5 19 4 17.5 4 13 Z",eyeStalks:a.jsxs(a.Fragment,{children:[a.jsx("line",{x1:"9.5",y1:"6.5",x2:"9.5",y2:"4.5"}),a.jsx("line",{x1:"14.5",y1:"6.5",x2:"14.5",y2:"4.5"})]}),eyes:a.jsxs(a.Fragment,{children:[a.jsx("circle",{cx:"9.5",cy:"4",r:"1.1",fill:"currentColor",stroke:"none"}),a.jsx("circle",{cx:"14.5",cy:"4",r:"1.1",fill:"currentColor",stroke:"none"})]}),legs:Iu,extras:a.jsxs(a.Fragment,{children:[a.jsx("path",{d:"M5 11 C4 9.5 2.5 10 3 12 C3.5 13.5 4.5 13 5 12"}),a.jsx("path",{d:"M19 11 C20 9.5 21.5 10 21 12 C20.5 13.5 19.5 13 19 12"})]})})}function Z2({className:e}){return a.jsx(Qe,{className:e,d:"M3 13.5 C3 8 7 6 12 6 C17 6 21 8 21 13.5 C21 17 17 19 12 19 C7 19 3 17 3 13.5 Z",eyeStalks:a.jsxs(a.Fragment,{children:[a.jsx("line",{x1:"7",y1:"7",x2:"6.5",y2:"4.5"}),a.jsx("line",{x1:"17",y1:"7",x2:"17.5",y2:"4.5"})]}),eyes:a.jsxs(a.Fragment,{children:[a.jsx("circle",{cx:"6.5",cy:"4",r:"0.8",fill:"currentColor",stroke:"none"}),a.jsx("circle",{cx:"17.5",cy:"4",r:"0.8",fill:"currentColor",stroke:"none"})]}),legs:At,extras:a.jsxs(a.Fragment,{children:[a.jsx("path",{d:"M4 12 C2.5 10.5 1 11 1.5 13 C2 14.5 3.5 14 4.5 13"}),a.jsx("path",{d:"M20 12 C21.5 10.5 23 11 22.5 13 C22 14.5 20.5 14 19.5 13"})]})})}function W2({className:e}){return a.jsx(Qe,{className:e,d:"M6 14 C6 8 9 5.5 12 5.5 C15 5.5 18 8 18 14 C18 18 15 20 12 20 C9 20 6 18 6 14 Z",eyeStalks:a.jsxs(a.Fragment,{children:[a.jsx("line",{x1:"10",y1:"6.5",x2:"10",y2:"3.5"}),a.jsx("line",{x1:"14",y1:"6.5",x2:"14",y2:"3.5"})]}),eyes:a.jsxs(a.Fragment,{children:[a.jsx("circle",{cx:"10",cy:"3",r:"0.7",fill:"currentColor",stroke:"none"}),a.jsx("circle",{cx:"14",cy:"3",r:"0.7",fill:"currentColor",stroke:"none"})]}),legs:a.jsxs(a.Fragment,{children:[a.jsx("line",{x1:"7",y1:"17",x2:"5",y2:"20.5"}),a.jsx("line",{x1:"9.5",y1:"18.5",x2:"8.5",y2:"21.5"}),a.jsx("line",{x1:"14.5",y1:"18.5",x2:"15.5",y2:"21.5"}),a.jsx("line",{x1:"17",y1:"17",x2:"19",y2:"20.5"})]}),extras:a.jsxs(a.Fragment,{children:[a.jsx("path",{d:"M6.5 11 C5 8.5 3 9 3.5 11.5 C4 13.5 5 13 6 12"}),a.jsx("path",{d:"M17.5 11 C19 8.5 21 9 20.5 11.5 C20 13.5 19 13 18 12"})]})})}function V2({className:e}){return a.jsx(Qe,{className:e,d:"M5 13 C5 9 8 7 12 7 L13 4 L14 7 C16 7 19 9 19 13 C19 16 16 18 13 18 L12 21 L11 18 C8 18 5 16 5 13 Z",eyeStalks:a.jsxs(a.Fragment,{children:[a.jsx("line",{x1:"10",y1:"7",x2:"9.5",y2:"5"}),a.jsx("line",{x1:"14",y1:"7",x2:"14.5",y2:"5"})]}),eyes:a.jsxs(a.Fragment,{children:[a.jsx("circle",{cx:"9.5",cy:"4.5",r:"0.8",fill:"currentColor",stroke:"none"}),a.jsx("circle",{cx:"14.5",cy:"4.5",r:"0.8",fill:"currentColor",stroke:"none"})]}),legs:At,extras:a.jsxs(a.Fragment,{children:[a.jsx("path",{d:"M5 11 C3.5 9.5 1.5 10 2 12.5 C2.5 14 4 13.5 5 12.5"}),a.jsx("path",{d:"M19 11 C20.5 9.5 22.5 10 22 12.5 C21.5 14 20 13.5 19 12.5"})]})})}function H2({className:e}){return a.jsx(Qe,{className:e,d:"M5 13 C5 9 8 7 12 7 C16 7 19 9 19 13 C19 16 16 18 12 18 C8 18 5 16 5 13 Z",eyeStalks:a.jsxs(a.Fragment,{children:[a.jsx("line",{x1:"10",y1:"7",x2:"9.5",y2:"5"}),a.jsx("line",{x1:"14",y1:"7",x2:"14.5",y2:"5"})]}),eyes:a.jsxs(a.Fragment,{children:[a.jsx("circle",{cx:"9.5",cy:"4.5",r:"0.9",fill:"currentColor",stroke:"none"}),a.jsx("line",{x1:"13.5",y1:"4",x2:"15.5",y2:"5"})]}),legs:At,extras:a.jsxs(a.Fragment,{children:[a.jsx("path",{d:"M5 11 C3.5 9.5 1.5 10 2 12.5 C2.5 14 4 13.5 5 12.5"}),a.jsx("path",{d:"M19 11 C20.5 9.5 22.5 10 22 12.5 C21.5 14 20 13.5 19 12.5"})]})})}function q2({className:e}){return a.jsx(Qe,{className:e,d:"M5.5 13.5 C5.5 10 8.5 8 12 8 C15.5 8 18.5 10 18.5 13.5 C18.5 16 15.5 17.5 12 17.5 C8.5 17.5 5.5 16 5.5 13.5 Z",eyeStalks:a.jsxs(a.Fragment,{children:[a.jsx("line",{x1:"10",y1:"8",x2:"10",y2:"6"}),a.jsx("line",{x1:"14",y1:"8",x2:"14",y2:"6"})]}),eyes:a.jsxs(a.Fragment,{children:[a.jsx("line",{x1:"9",y1:"6",x2:"11",y2:"6.5"}),a.jsx("line",{x1:"13",y1:"6",x2:"15",y2:"6.5"})]}),legs:Iu,extras:a.jsxs(a.Fragment,{children:[a.jsx("path",{d:"M6 11.5 C4.5 10.5 3 11 3.5 12.5 C4 13.5 5 13 5.5 12.5"}),a.jsx("path",{d:"M18 11.5 C19.5 10.5 21 11 20.5 12.5 C20 13.5 19 13 18.5 12.5"})]})})}function J2({className:e}){return a.jsx(Qe,{className:e,d:"M5 13 C5 9 8 7 12 7 C16 7 19 9 19 13 C19 16 16 18 12 18 C8 18 5 16 5 13 Z",eyeStalks:a.jsxs(a.Fragment,{children:[a.jsx("line",{x1:"10",y1:"7",x2:"9.5",y2:"5"}),a.jsx("line",{x1:"14",y1:"7",x2:"14.5",y2:"5"})]}),eyes:a.jsxs(a.Fragment,{children:[a.jsx("circle",{cx:"9.5",cy:"4.5",r:"0.7",fill:"currentColor",stroke:"none"}),a.jsx("circle",{cx:"14.5",cy:"4.5",r:"0.7",fill:"currentColor",stroke:"none"})]}),legs:At,extras:a.jsxs(a.Fragment,{children:[a.jsx("path",{d:"M5 11 C3.5 9.5 1.5 10 2 12.5 C2.5 14 4 13.5 5 12.5"}),a.jsx("path",{d:"M19 11 C20.5 9.5 22.5 10 22 12.5 C21.5 14 20 13.5 19 12.5"}),a.jsx("line",{x1:"8.5",y1:"4",x2:"10.5",y2:"4.5"}),a.jsx("line",{x1:"15.5",y1:"4",x2:"13.5",y2:"4.5"}),a.jsx("path",{d:"M9 15.5 C10 14.5 14 14.5 15 15.5"})]})})}function K2({className:e}){return a.jsx(Qe,{className:e,d:"M5 13 C5 9 8 7 12 7 C16 7 19 9 19 13 C19 16 16 18 12 18 C8 18 5 16 5 13 Z",eyeStalks:a.jsxs(a.Fragment,{children:[a.jsx("line",{x1:"10",y1:"7",x2:"9.5",y2:"5"}),a.jsx("line",{x1:"14",y1:"7",x2:"14.5",y2:"5"})]}),eyes:a.jsxs(a.Fragment,{children:[a.jsx("circle",{cx:"9.5",cy:"4.5",r:"1.2",fill:"none",stroke:"currentColor"}),a.jsx("circle",{cx:"14.5",cy:"4.5",r:"1.2",fill:"none",stroke:"currentColor"})]}),legs:At,extras:a.jsxs(a.Fragment,{children:[a.jsx("path",{d:"M5 11 C3.5 9.5 1.5 10 2 12.5 C2.5 14 4 13.5 5 12.5"}),a.jsx("path",{d:"M19 11 C20.5 9.5 22.5 10 22 12.5 C21.5 14 20 13.5 19 12.5"}),a.jsx("ellipse",{cx:"12",cy:"15",rx:"2",ry:"1.5",fill:"currentColor",stroke:"none"})]})})}function G2({className:e}){return a.jsx(Qe,{className:e,d:"M4.5 13 C4.5 8 7.5 6 12 6 C16.5 6 19.5 8 19.5 13 C19.5 17 16.5 18.5 12 18.5 C7.5 18.5 4.5 17 4.5 13 Z",eyeStalks:a.jsxs(a.Fragment,{children:[a.jsx("line",{x1:"9.5",y1:"7",x2:"9",y2:"5"}),a.jsx("line",{x1:"14.5",y1:"7",x2:"15",y2:"5"})]}),eyes:a.jsxs(a.Fragment,{children:[a.jsx("circle",{cx:"9",cy:"4.5",r:"1",fill:"currentColor",stroke:"none"}),a.jsx("circle",{cx:"15",cy:"4.5",r:"1",fill:"currentColor",stroke:"none"})]}),legs:At,extras:a.jsxs(a.Fragment,{children:[a.jsx("path",{d:"M5 11 C3.5 9 2 9.5 2.5 12 C3 14 4 13 5 12"}),a.jsx("path",{d:"M19 11 C20.5 9 22 9.5 21.5 12 C21 14 20 13 19 12"}),a.jsx("path",{d:"M9 14.5 C10 16 14 16 15 14.5"}),a.jsx("circle",{cx:"7",cy:"13",r:"1",fill:"currentColor",stroke:"none",opacity:"0.3"}),a.jsx("circle",{cx:"17",cy:"13",r:"1",fill:"currentColor",stroke:"none",opacity:"0.3"})]})})}function Y2({className:e}){return a.jsx(Qe,{className:e,d:"M5 13 C5 9 8 7 12 7 C16 7 19 9 19 13 C19 16 16 18 12 18 C8 18 5 16 5 13 Z",eyeStalks:a.jsxs(a.Fragment,{children:[a.jsx("line",{x1:"10",y1:"7",x2:"9.5",y2:"5.5"}),a.jsx("line",{x1:"14",y1:"7",x2:"14.5",y2:"5.5"})]}),eyes:a.jsxs(a.Fragment,{children:[a.jsx("line",{x1:"7.5",y1:"5.5",x2:"16.5",y2:"5.5"}),a.jsx("rect",{x:"7",y:"5",width:"4",height:"2",rx:"0.5",fill:"currentColor",stroke:"none"}),a.jsx("rect",{x:"13",y:"5",width:"4",height:"2",rx:"0.5",fill:"currentColor",stroke:"none"})]}),legs:At,extras:a.jsxs(a.Fragment,{children:[a.jsx("path",{d:"M5 11 C3.5 9.5 1.5 10 2 12.5 C2.5 14 4 13.5 5 12.5"}),a.jsx("path",{d:"M19 11 C20.5 9.5 22.5 10 22 12.5 C21.5 14 20 13.5 19 12.5"}),a.jsx("path",{d:"M9.5 15 C10.5 16 13.5 16 14.5 15"})]})})}function X2({className:e}){return a.jsx(Qe,{className:e,d:"M7 13.5 C7 10.5 9.5 9 12 9 C14.5 9 17 10.5 17 13.5 C17 16 14.5 17.5 12 17.5 C9.5 17.5 7 16 7 13.5 Z",eyeStalks:a.jsxs(a.Fragment,{children:[a.jsx("line",{x1:"10.5",y1:"9.5",x2:"10.5",y2:"8"}),a.jsx("line",{x1:"13.5",y1:"9.5",x2:"13.5",y2:"8"})]}),eyes:a.jsxs(a.Fragment,{children:[a.jsx("circle",{cx:"10.5",cy:"7.5",r:"0.8",fill:"currentColor",stroke:"none"}),a.jsx("circle",{cx:"13.5",cy:"7.5",r:"0.8",fill:"currentColor",stroke:"none"})]}),legs:a.jsxs(a.Fragment,{children:[a.jsx("line",{x1:"8",y1:"16",x2:"6.5",y2:"18"}),a.jsx("line",{x1:"10",y1:"17",x2:"9.5",y2:"19"}),a.jsx("line",{x1:"14",y1:"17",x2:"14.5",y2:"19"}),a.jsx("line",{x1:"16",y1:"16",x2:"17.5",y2:"18"})]}),extras:a.jsxs(a.Fragment,{children:[a.jsx("path",{d:"M7.5 12 C6.5 11 5.5 11.5 6 13 C6.5 14 7 13.5 7.5 13"}),a.jsx("path",{d:"M16.5 12 C17.5 11 18.5 11.5 18 13 C17.5 14 17 13.5 16.5 13"})]})})}const Fn=[Ru,U2,Z2,W2,V2,H2,q2,J2,K2,G2,Y2,X2];function Er(e){return Fn[Math.abs(e)%Fn.length]??Ru}function Q2(e){const t=Fn.length-2;return t<=0?0:1+((Number.isFinite(e)?Math.trunc(e):0)%t+t)%t}function ew(e){return Er(Q2(e))}const tw="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",nw="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",rw="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",ow="/assets/minimax-BPMzvuL-.jpeg",sw="/assets/alibaba-TTwafVwX.svg",iw="/assets/qwen-CONDcHqt.png",aw="/assets/zhipuai-BPNAnxo-.svg",lw={"claude-":"anthropic","gpt-":"openai","o1-":"openai","o3-":"openai","deepseek-":"deepseek",MiniMax:"minimax",qwen:"qwen","glm-":"zhipuai"};function Pu(e){if(e===null)return"unknown";const t=e.toLowerCase();for(const[n,r]of Object.entries(lw))if(t.startsWith(n.toLowerCase()))return r;return"unknown"}const Vt={width:24,height:24,objectFit:"contain"},cw=He.memo(({className:e})=>a.jsx("img",{src:tw,alt:"Anthropic",className:e,style:Vt})),uw=He.memo(({className:e})=>a.jsx("img",{src:nw,alt:"OpenAI",className:e,style:{...Vt,background:"white",borderRadius:"4px"}})),dw=He.memo(({className:e})=>a.jsx("img",{src:rw,alt:"DeepSeek",className:e,style:Vt})),fw=He.memo(({className:e})=>a.jsx("img",{src:ow,alt:"MiniMax",className:e,style:Vt})),hw=He.memo(({className:e})=>a.jsx("img",{src:sw,alt:"Alibaba",className:e,style:Vt})),pw=He.memo(({className:e})=>a.jsx("img",{src:iw,alt:"Qwen",className:e,style:Vt})),mw=He.memo(({className:e})=>a.jsx("img",{src:aw,alt:"ZhipuAI",className:e,style:Vt}));function Mu({provider:e,className:t}){switch(e){case"anthropic":return a.jsx(cw,{className:t});case"openai":return a.jsx(uw,{className:t});case"deepseek":return a.jsx(dw,{className:t});case"minimax":return a.jsx(fw,{className:t});case"alibaba":return a.jsx(hw,{className:t});case"qwen":return a.jsx(pw,{className:t});case"zhipuai":return a.jsx(mw,{className:t});case"unknown":return null}}function $e({delayDuration:e=0,...t}){return a.jsx(C2,{"data-slot":"tooltip-provider",delayDuration:e,...t})}function je({...e}){return a.jsx(S2,{"data-slot":"tooltip",...e})}function Ee({...e}){return a.jsx(j2,{"data-slot":"tooltip-trigger",...e})}function Ne({className:e,sideOffset:t=0,children:n,...r}){return a.jsx(E2,{children:a.jsxs(N2,{"data-slot":"tooltip-content",sideOffset:t,className:ve("bg-foreground text-background animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 w-fit origin-(--radix-tooltip-content-transform-origin) rounded-md px-3 py-1.5 text-xs text-balance",e),...r,children:[n,a.jsx(T2,{className:"bg-foreground fill-foreground z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px]"})]})})}const gw="x-anthropic-billing-header:";function xw(e){return e.trimStart().toLowerCase().startsWith(gw)}function vw(e){return Ya(e)?Object.prototype.hasOwnProperty.call(e,"system"):!1}function yw(e){if(!Ya(e))return!1;const t=Ye(e,"type"),n=Ye(e,"text");return typeof t!="string"||t!=="text"||typeof n!="string"?!1:xw(n)}function bw(e){let t;try{t=JSON.parse(e)}catch{return{body:e,removed:0}}if(!vw(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(yw(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 ww(e){return{depth:Number.POSITIVE_INFINITY}}function _w(e){try{const t=JSON.parse(e);return{kind:"json",data:Ho(t)}}catch{return{kind:"text"}}}function go(e){const t=v.useMemo(()=>e===null?null:_w(e),[e]),n=t?.kind==="json"?t.data:null,r=v.useMemo(()=>n===null?null:ww(),[n]),[o,s]=v.useState(!1),[i,l]=v.useState(0),[c,u]=v.useState(0),[d,p]=v.useTransition(),m=v.useCallback(()=>{const h=!o,g=h&&r!==null?r.depth:0;p(()=>{s(h),l(g),u(f=>f+1)})},[o,r]);return{parsedData:n,policy:r,isExpanded:o,toggle:m,isPending:d,bulkDepth:i,bulkRevision:c}}function Ho(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=>Ho(n));const t={};for(const n of Object.keys(e)){const r=Object.getOwnPropertyDescriptor(e,n);t[n]=Ho(r?.value)}return t}case"bigint":case"symbol":case"function":case"undefined":return String(e)}return null}function Du({className:e,orientation:t="horizontal",...n}){return a.jsx(s2,{"data-slot":"tabs","data-orientation":t,orientation:t,className:ve("group/tabs flex gap-2 data-[orientation=horizontal]:flex-col",e),...n})}const kw=ps("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 Lu({className:e,variant:t="default",...n}){return a.jsx(i2,{"data-slot":"tabs-list","data-variant":t,className:ve(kw({variant:t}),e),...n})}function ft({className:e,...t}){return a.jsx(a2,{"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 ht({className:e,...t}){return a.jsx(l2,{"data-slot":"tabs-content",className:ve("flex-1 outline-none",e),...t})}function Cn(e){const[t,n]=v.useState(!1),r=v.useRef(null);v.useEffect(()=>()=>{r.current!==null&&clearTimeout(r.current)},[]);const o=v.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 Cw=v.lazy(()=>Ft(()=>import("./CompareDrawer-BCH_fsLm.js"),__vite__mapDeps([0,1,2])).then(e=>({default:e.CompareDrawer}))),Sw=v.lazy(()=>Ft(()=>import("./ReplayDialog-DTeaHHit.js"),__vite__mapDeps([3,1,4,2])).then(e=>({default:e.ReplayDialog}))),jw=v.lazy(()=>Ft(()=>import("./RequestAnatomy-DZ8grAih.js"),__vite__mapDeps([5,1])).then(e=>({default:e.RequestAnatomy}))),Ew=v.lazy(()=>Ft(()=>import("./ResponseView-Cldm6RCi.js"),__vite__mapDeps([4,1,2])).then(e=>({default:e.ResponseView}))),Nw=v.lazy(()=>Ft(()=>import("./StreamingChunkSequence-3x4p-yT7.js"),__vite__mapDeps([6,1,2])).then(e=>({default:e.StreamingChunkSequence}))),Vi=v.lazy(()=>Ft(()=>import("./json-viewer-BrzjD7qI.js").then(e=>e.j),__vite__mapDeps([2,1])).then(e=>({default:e.JsonViewer}))),Tw=v.lazy(()=>Ft(()=>import("./json-viewer-BrzjD7qI.js").then(e=>e.j),__vite__mapDeps([2,1])).then(e=>({default:e.JsonViewerFromString}))),Aw=1200,zw=12;function Ow(e){const{containerRef:t,setExpandToPath:n,ensureTabActive:r,highlightMs:o}=e,s=v.useRef(null);return v.useCallback(i=>{r?.(),n(i.path);const l=p=>{p.scrollIntoView({behavior:"smooth",block:"center"}),p.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(()=>{p.classList.remove("ring-2","ring-primary/60","ring-offset-1","ring-offset-background","rounded-sm","transition-shadow"),n(null)},o??Aw)},u=`[data-anatomy-path="${(p=>typeof CSS<"u"&&typeof CSS.escape=="function"?CSS.escape(p):p.replace(/(["'\\[\](){}])/g,"\\$1"))(i.path)}"]`,d=p=>{const m=t.current;if(m!==null){const h=m.querySelector(u);if(h!==null){l(h);return}}p>0?window.requestAnimationFrame(()=>d(p-1)):n(null)};window.requestAnimationFrame(()=>d(zw))},[t,r,o,n])}class Fu{diff(t,n,r={}){let o;typeof r=="function"?(o=r,r={}):"callback"in r&&(o=r.callback);const s=this.castInput(t,r),i=this.castInput(n,r),l=this.removeEmpty(this.tokenize(s,r)),c=this.removeEmpty(this.tokenize(i,r));return this.diffWithOptionsObj(l,c,r,o)}diffWithOptionsObj(t,n,r,o){var s;const i=_=>{if(_=this.postProcess(_,r),o){setTimeout(function(){o(_)},0);return}else return _},l=n.length,c=t.length;let u=1,d=l+c;r.maxEditLength!=null&&(d=Math.min(d,r.maxEditLength));const p=(s=r.timeout)!==null&&s!==void 0?s:1/0,m=Date.now()+p,h=[{oldPos:-1,lastComponent:void 0}];let g=this.extractCommon(h[0],n,t,0,r);if(h[0].oldPos+1>=c&&g+1>=l)return i(this.buildValues(h[0].lastComponent,n,t));let f=-1/0,x=1/0;const y=()=>{for(let _=Math.max(f,-u);_<=Math.min(x,u);_+=2){let k;const C=h[_-1],S=h[_+1];C&&(h[_-1]=void 0);let z=!1;if(S){const A=S.oldPos-_;z=S&&0<=A&&A<l}const N=C&&C.oldPos+1<c;if(!z&&!N){h[_]=void 0;continue}if(!N||z&&C.oldPos<S.oldPos?k=this.addToPath(S,!0,!1,0,r):k=this.addToPath(C,!1,!0,1,r),g=this.extractCommon(k,n,t,_,r),k.oldPos+1>=c&&g+1>=l)return i(this.buildValues(k.lastComponent,n,t))||!0;h[_]=k,k.oldPos+1>=c&&(x=Math.min(x,_-1)),g+1>=l&&(f=Math.max(f,_+1))}u++};if(o)(function _(){setTimeout(function(){if(u>d||Date.now()>m)return o(void 0);y()||_()},0)})();else for(;u<=d&&Date.now()<=m;){const _=y();if(_)return _}}addToPath(t,n,r,o,s){const i=t.lastComponent;return i&&!s.oneChangePerToken&&i.added===n&&i.removed===r?{oldPos:t.oldPos+o,lastComponent:{count:i.count+1,added:n,removed:r,previousComponent:i.previousComponent}}:{oldPos:t.oldPos+o,lastComponent:{count:1,added:n,removed:r,previousComponent:i}}}extractCommon(t,n,r,o,s){const i=n.length,l=r.length;let c=t.oldPos,u=c-o,d=0;for(;u+1<i&&c+1<l&&this.equals(r[c+1],n[u+1],s);)u++,c++,d++,s.oneChangePerToken&&(t.lastComponent={count:1,previousComponent:t.lastComponent,added:!1,removed:!1});return d&&!s.oneChangePerToken&&(t.lastComponent={count:d,previousComponent:t.lastComponent,added:!1,removed:!1}),t.oldPos=c,u}equals(t,n,r){return r.comparator?r.comparator(t,n):t===n||!!r.ignoreCase&&t.toLowerCase()===n.toLowerCase()}removeEmpty(t){const n=[];for(let r=0;r<t.length;r++)t[r]&&n.push(t[r]);return n}castInput(t,n){return t}tokenize(t,n){return Array.from(t)}join(t){return t.join("")}postProcess(t,n){return t}get useLongestToken(){return!1}buildValues(t,n,r){const o=[];let s;for(;t;)o.push(t),s=t.previousComponent,delete t.previousComponent,t=s;o.reverse();const i=o.length;let l=0,c=0,u=0;for(;l<i;l++){const d=o[l];if(d.removed)d.value=this.join(r.slice(u,u+d.count)),u+=d.count;else{if(!d.added&&this.useLongestToken){let p=n.slice(c,c+d.count);p=p.map(function(m,h){const g=r[u+h];return g.length>m.length?g:m}),d.value=this.join(p)}else d.value=this.join(n.slice(c,c+d.count));c+=d.count,d.added||(u+=d.count)}}return o}}class Iw extends Fu{constructor(){super(...arguments),this.tokenize=Bu}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 Rw=new Iw;function $u(e,t,n){return Rw.diff(e,t,n)}function Bu(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 Pw extends Fu{constructor(){super(...arguments),this.tokenize=Bu}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(qo(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 Mw=new Pw;function Dw(e,t,n){return Mw.diff(e,t,n)}function qo(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]=qo(e[s],t,n,r,String(s));return t.pop(),n.pop(),i}if(e&&e.toJSON&&(e=e.toJSON()),typeof e=="object"&&e!==null){t.push(e),i={},n.push(i);const l=[];let c;for(c in e)Object.prototype.hasOwnProperty.call(e,c)&&l.push(c);for(l.sort(),s=0;s<l.length;s+=1)c=l[s],i[c]=qo(e[c],t,n,r,c);t.pop(),n.pop()}else i=e;return i}function Hi(e){return e===void 0?[]:Object.entries(e).map(t=>[t[0].toLowerCase(),t[1]]).sort(([t],[n])=>t.localeCompare(n))}function qi([e,t]){return`${e}: ${t}`}function Jo(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 Lw(e,t){const n=Hi(e).map(qi).join(`
|
|
92
|
-
`),r=Hi(t).map(qi).join(`
|
|
93
|
-
`);if(n===r)return{lines:[],isEmpty:!0};const o=$u(n,r);return{lines:Jo(o),isEmpty:!1}}function Ji(e){try{const t=JSON.parse(e);return t===null||typeof t=="string"||typeof t=="object"?t:null}catch{return null}}function Fw(e,t){const n=e??"",r=t??"";if(n===r)return{lines:[],isEmpty:!0};const o=Ji(n),s=Ji(r);if(o!==null&&s!==null){const l=Dw(o,s)??[];if(l.length===1){const c=l[0];if(c!==void 0&&!c.added&&!c.removed)return{lines:[],isEmpty:!0}}return{lines:Jo(l),isEmpty:!1}}const i=$u(n,r);return{lines:Jo(i),isEmpty:!1}}function $w(e,t,n){const r=new Array(e);return new Proxy(r,{get(o,s,i){if(typeof s=="string"){const l=s.charCodeAt(0);if(l>=48&&l<=57){const c=+s;if(Number.isInteger(c)&&c>=0&&c<e){let u=o[c];if(!u){const d=t[c*2];u=o[c]={index:c,key:n(c),start:d,size:t[c*2+1],end:d+t[c*2+1],lane:0}}return u}}if(s==="length")return e}return Reflect.get(o,s,i)}})}function Gt(e,t,n){let r=n.initialDeps??[],o,s=!0;function i(){const l=e();return(l.length!==r.length||l.some((u,d)=>r[d]!==u))&&(r=l,o=t(...l),n?.onChange&&!(s&&n.skipInitialOnChange)&&n.onChange(o),s=!1),o}return i.updateDeps=l=>{r=l},i}function Ki(e,t){if(e===void 0)throw new Error("Unexpected undefined");return e}const Gi=(e,t)=>Math.abs(e-t)<1.01,Bw=(e,t,n)=>{let r;return function(...o){e.clearTimeout(r),r=e.setTimeout(()=>t.apply(this,o),n)}};let Sn;const Yi=()=>{if(Sn!==void 0)return Sn;if(typeof navigator>"u")return Sn=!1;if(/iP(hone|od|ad)/.test(navigator.userAgent))return Sn=!0;const e=navigator.maxTouchPoints;return Sn=navigator.platform==="MacIntel"&&e!==void 0&&e>0},Xi=e=>{const{offsetWidth:t,offsetHeight:n}=e;return{width:t,height:n}},Uw=e=>e,Zw=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},Ww=(e,t)=>{const n=e.scrollElement;if(!n)return;const r=e.targetWindow;if(!r)return;const o=i=>{const{width:l,height:c}=i;t({width:Math.round(l),height:Math.round(c)})};if(o(Xi(n)),!r.ResizeObserver)return()=>{};const s=new r.ResizeObserver(i=>{const l=()=>{const c=i[0];if(c?.borderBoxSize){const u=c.borderBoxSize[0];if(u){o({width:u.inlineSize,height:u.blockSize});return}}o(Xi(n))};e.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(l):l()});return s.observe(n,{box:"border-box"}),()=>{s.unobserve(n)}},Nr={passive:!0},Vw=typeof window>"u"?!0:"onscrollend"in window,Hw=(e,t,n)=>{const r=e.scrollElement;if(!r)return;const o=e.targetWindow;if(!o)return;const s=e.options.useScrollendEvent&&Vw;let i=0;const l=s?null:Bw(o,()=>t(i,!1),e.options.isScrollingResetDelay),c=p=>()=>{i=n(r),l?.(),t(i,p)},u=c(!0),d=c(!1);return r.addEventListener("scroll",u,Nr),s&&r.addEventListener("scrollend",d,Nr),()=>{r.removeEventListener("scroll",u),s&&r.removeEventListener("scrollend",d)}},qw=(e,t)=>Hw(e,t,n=>{const{horizontal:r,isRtl:o}=e.options;return r?n.scrollLeft*(o&&-1||1):n.scrollTop}),Jw=(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"]},Kw=(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})},Gw=Kw;class Yw{constructor(t){this.unsubs=[],this.scrollElement=null,this.targetWindow=null,this.isScrolling=!1,this.scrollState=null,this.measurementsCache=[],this._flatMeasurements=null,this.itemSizeCache=new Map,this.itemSizeCacheVersion=0,this.laneAssignments=new Map,this.pendingMin=null,this.prevLanes=void 0,this.lanesChangedFlag=!1,this.lanesSettling=!1,this.pendingScrollAnchor=null,this.scrollRect=null,this.scrollOffset=null,this.scrollDirection=null,this.scrollAdjustments=0,this._iosDeferredAdjustment=0,this._iosTouching=!1,this._iosJustTouchEnded=!1,this._iosTouchEndTimerId=null,this._intendedScrollOffset=null,this.elementsCache=new Map,this.now=()=>{var n,r,o;return((o=(r=(n=this.targetWindow)==null?void 0:n.performance)==null?void 0:r.now)==null?void 0:o.call(r))??Date.now()},this.observer=(()=>{let n=null;const r=()=>n||(!this.targetWindow||!this.targetWindow.ResizeObserver?null:n=new this.targetWindow.ResizeObserver(o=>{o.forEach(s=>{const i=()=>{const l=s.target,c=this.indexFromElement(l);if(!l.isConnected){this.observer.unobserve(l);for(const[u,d]of this.elementsCache)if(d===l){this.elementsCache.delete(u);break}return}this.shouldMeasureDuringScroll(c)&&this.resizeItem(c,this.options.measureElement(l,s,this))};this.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(i):i()})}));return{disconnect:()=>{var o;(o=r())==null||o.disconnect(),n=null},observe:o=>{var s;return(s=r())==null?void 0:s.observe(o,{box:"border-box"})},unobserve:o=>{var s;return(s=r())==null?void 0:s.unobserve(o)}}})(),this.range=null,this.setOptions=n=>{var r,o;const s={debug:!1,initialOffset:0,overscan:1,paddingStart:0,paddingEnd:0,scrollPaddingStart:0,scrollPaddingEnd:0,horizontal:!1,getItemKey:Uw,rangeExtractor:Zw,onChange:()=>{},measureElement:Jw,initialRect:{width:0,height:0},scrollMargin:0,gap:0,indexAttribute:"data-index",initialMeasurementsCache:[],lanes:1,anchorTo:"start",followOnAppend:!1,scrollEndThreshold:1,isScrollingResetDelay:150,enabled:!0,isRtl:!1,useScrollendEvent:!1,useAnimationFrameWithResizeObserver:!1,laneAssignmentMode:"estimate"};for(const u in n){const d=n[u];d!==void 0&&(s[u]=d)}const i=this.options;let l=null,c=null;if(i!==void 0&&i.enabled&&s.enabled&&s.anchorTo==="end"&&this.scrollElement!==null){const u=i.count,d=s.count,p=this.getMeasurements(),m=u>0?((r=p[0])==null?void 0:r.key)??i.getItemKey(0):null,h=u>0?((o=p[u-1])==null?void 0:o.key)??i.getItemKey(u-1):null;if(d!==u||u>0&&d>0&&(s.getItemKey(0)!==m||s.getItemKey(d-1)!==h)){const x=u>0?this.getVirtualItemForOffset(this.getScrollOffset())??p[0]:null;x&&(l=[x.key,this.getScrollOffset()-x.start]);const y=s.followOnAppend===!0?"auto":s.followOnAppend||null;y&&d>u&&this.isAtEnd(i.scrollEndThreshold)&&(u===0||s.getItemKey(d-1)!==h)&&(c=y)}}this.options=s,(l||c)&&(this.pendingScrollAnchor=[l?.[0]??null,l?.[1]??0,c])},this.notify=n=>{var r,o;(o=(r=this.options).onChange)==null||o.call(r,this,n)},this.maybeNotify=Gt(()=>(this.calculateRange(),[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]),n=>{this.notify(n)},{key:!1,debug:()=>this.options.debug,initialDeps:[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]}),this.cleanup=()=>{this.unsubs.filter(Boolean).forEach(n=>n()),this.unsubs=[],this.observer.disconnect(),this.rafId!=null&&this.targetWindow&&(this.targetWindow.cancelAnimationFrame(this.rafId),this.rafId=null),this.scrollState=null,this.scrollElement=null,this.targetWindow=null},this._didMount=()=>()=>{this.cleanup()},this._willUpdate=()=>{var n;const r=this.options.enabled?this.options.getScrollElement():null;if(this.scrollElement!==r){if(this.cleanup(),!r){this.maybeNotify();return}if(this.scrollElement=r,this.scrollElement&&"ownerDocument"in this.scrollElement?this.targetWindow=this.scrollElement.ownerDocument.defaultView:this.targetWindow=((n=this.scrollElement)==null?void 0:n.window)??null,this.elementsCache.forEach(s=>{this.observer.observe(s)}),this.unsubs.push(this.options.observeElementRect(this,s=>{this.scrollRect=s,this.maybeNotify()})),this.unsubs.push(this.options.observeElementOffset(this,(s,i)=>{this._intendedScrollOffset!==null&&Math.abs(s-this._intendedScrollOffset)<1.5&&(s=this._intendedScrollOffset),this._intendedScrollOffset=null,this.scrollAdjustments=0,this.scrollDirection=i?this.getScrollOffset()<s?"forward":"backward":null,this.scrollOffset=s,this.isScrolling=i,this._flushIosDeferredIfReady(),this.scrollState&&this.scheduleScrollReconcile(),this.maybeNotify()})),"addEventListener"in this.scrollElement){const s=this.scrollElement,i=()=>{this._iosTouching=!0,this._iosJustTouchEnded=!1,this._iosTouchEndTimerId!==null&&this.targetWindow!=null&&(this.targetWindow.clearTimeout(this._iosTouchEndTimerId),this._iosTouchEndTimerId=null)},l=()=>{this._iosTouching=!1,!(!Yi()||this.targetWindow==null)&&(this._iosJustTouchEnded=!0,this._iosTouchEndTimerId=this.targetWindow.setTimeout(()=>{this._iosJustTouchEnded=!1,this._iosTouchEndTimerId=null,this._flushIosDeferredIfReady()},150))};s.addEventListener("touchstart",i,Nr),s.addEventListener("touchend",l,Nr),this.unsubs.push(()=>{s.removeEventListener("touchstart",i),s.removeEventListener("touchend",l),this._iosTouchEndTimerId!==null&&this.targetWindow!=null&&(this.targetWindow.clearTimeout(this._iosTouchEndTimerId),this._iosTouchEndTimerId=null)})}this._scrollToOffset(this.getScrollOffset(),{adjustments:void 0,behavior:void 0})}const o=this.pendingScrollAnchor;if(this.pendingScrollAnchor=null,o&&this.scrollElement&&this.options.enabled){const[s,i,l]=o;if(s!==null){const{count:c,getItemKey:u}=this.options;let d=0;for(;d<c&&u(d)!==s;)d++;const p=d<c?this.getMeasurements()[d]:void 0;if(p){const m=p.start+i-this.getScrollOffset();Gi(m,0)||this.applyScrollAdjustment(m)}}l&&this.scrollToEnd({behavior:l})}},this._flushIosDeferredIfReady=()=>{if(this._iosDeferredAdjustment===0||this.isScrolling||this._iosTouching||this._iosJustTouchEnded)return;const n=this.getScrollOffset(),r=this.getMaxScrollOffset();if(n<0||n>r)return;const o=this._iosDeferredAdjustment;this._iosDeferredAdjustment=0,this._scrollToOffset(n,{adjustments:this.scrollAdjustments+=o,behavior:void 0})},this.rafId=null,this.getSize=()=>this.options.enabled?(this.scrollRect=this.scrollRect??this.options.initialRect,this.scrollRect[this.options.horizontal?"width":"height"]):(this.scrollRect=null,0),this.getScrollOffset=()=>this.options.enabled?(this.scrollOffset=this.scrollOffset??(typeof this.options.initialOffset=="function"?this.options.initialOffset():this.options.initialOffset),this.scrollOffset):(this.scrollOffset=null,0),this.getFurthestMeasurement=(n,r)=>{const o=new Map,s=new Map;for(let i=r-1;i>=0;i--){const l=n[i];if(o.has(l.lane))continue;const c=s.get(l.lane);if(c==null||l.end>c.end?s.set(l.lane,l):l.end<c.end&&o.set(l.lane,!0),o.size===this.options.lanes)break}return s.size===this.options.lanes?Array.from(s.values()).sort((i,l)=>i.end===l.end?i.index-l.index:i.end-l.end)[0]:void 0},this.getMeasurementOptions=Gt(()=>[this.options.count,this.options.paddingStart,this.options.scrollMargin,this.options.getItemKey,this.options.enabled,this.options.lanes,this.options.laneAssignmentMode],(n,r,o,s,i,l,c)=>(this.prevLanes!==void 0&&this.prevLanes!==l&&(this.lanesChangedFlag=!0),this.prevLanes=l,this.pendingMin=null,{count:n,paddingStart:r,scrollMargin:o,getItemKey:s,enabled:i,lanes:l,laneAssignmentMode:c}),{key:!1}),this.getMeasurements=Gt(()=>[this.getMeasurementOptions(),this.itemSizeCacheVersion],({count:n,paddingStart:r,scrollMargin:o,getItemKey:s,enabled:i,lanes:l,laneAssignmentMode:c},u)=>{const d=this.itemSizeCache;if(!i)return this.measurementsCache=[],this.itemSizeCache.clear(),this.laneAssignments.clear(),[];if(this.laneAssignments.size>n)for(const 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 p=this.lanesSettling?0:this.pendingMin??0;if(this.pendingMin=null,this.lanesSettling&&this.measurementsCache.length===n&&(this.lanesSettling=!1),l===1){const g=this.options.gap,f=n*2;let x=this._flatMeasurements;if(!x||x.length<f){const k=new Float64Array(f);x&&p>0&&k.set(x.subarray(0,p*2)),x=k,this._flatMeasurements=x}let y;if(p===0)y=r+o;else{const k=p-1;y=x[k*2]+x[k*2+1]+g}for(let k=p;k<n;k++){const C=s(k),S=d.get(C),z=typeof S=="number"?S:this.options.estimateSize(k);x[k*2]=y,x[k*2+1]=z,y+=z+g}const _=$w(n,x,s);return this.measurementsCache=_,_}const m=this.measurementsCache.slice(0,p),h=new Array(l).fill(void 0);for(let g=0;g<p;g++){const f=m[g];f&&(h[f.lane]=g)}for(let g=p;g<n;g++){const f=s(g),x=this.laneAssignments.get(g);let y,_;const k=c==="estimate"||d.has(f);if(x!==void 0&&this.options.lanes>1){y=x;const N=h[y],A=N!==void 0?m[N]:void 0;_=A?A.end+this.options.gap:r+o}else{const N=this.options.lanes===1?m[g-1]:this.getFurthestMeasurement(m,g);_=N?N.end+this.options.gap:r+o,y=N?N.lane:g%this.options.lanes,this.options.lanes>1&&k&&this.laneAssignments.set(g,y)}const C=d.get(f),S=typeof C=="number"?C:this.options.estimateSize(g),z=_+S;m[g]={index:g,start:_,size:S,end:z,key:f,lane:y},h[y]=g}return this.measurementsCache=m,m},{key:!1,debug:()=>this.options.debug}),this.calculateRange=Gt(()=>[this.getMeasurements(),this.getSize(),this.getScrollOffset(),this.options.lanes],(n,r,o,s)=>this.range=n.length>0&&r>0?Xw({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=Gt(()=>{let n=null,r=null;const o=this.calculateRange();return o&&(n=o.startIndex,r=o.endIndex),this.maybeNotify.updateDeps([this.isScrolling,n,r]),[this.options.rangeExtractor,this.options.overscan,this.options.count,n,r]},(n,r,o,s,i)=>s===null||i===null?[]:n({startIndex:s,endIndex:i,overscan:r,count:o}),{key:!1,debug:()=>this.options.debug}),this.indexFromElement=n=>{const r=this.options.indexAttribute,o=n.getAttribute(r);return o?parseInt(o,10):(console.warn(`Missing attribute name '${r}={index}' on measured element.`),-1)},this.shouldMeasureDuringScroll=n=>{var r;if(!this.scrollState||this.scrollState.behavior!=="smooth")return!0;const o=this.scrollState.index??((r=this.getVirtualItemForOffset(this.scrollState.lastTargetOffset))==null?void 0:r.index);if(o!==void 0&&this.range){const s=Math.max(this.options.overscan,Math.ceil((this.range.endIndex-this.range.startIndex)/2)),i=Math.max(0,o-s),l=Math.min(this.options.count-1,o+s);return n>=i&&n<=l}return!0},this.measureElement=n=>{if(!n){this.elementsCache.forEach((i,l)=>{i.isConnected||(this.observer.unobserve(i),this.elementsCache.delete(l))});return}const r=this.indexFromElement(n),o=this.options.getItemKey(r),s=this.elementsCache.get(o);s!==n&&(s&&this.observer.unobserve(s),this.observer.observe(n),this.elementsCache.set(o,n)),(!this.isScrolling||this.scrollState)&&this.shouldMeasureDuringScroll(r)&&this.resizeItem(r,this.options.measureElement(n,void 0,this))},this.resizeItem=(n,r)=>{var o,s;if(n<0||n>=this.options.count)return;let i,l,c;const u=this._flatMeasurements;if(this.options.lanes===1&&u!==null)c=this.options.getItemKey(n),l=u[n*2],i=u[n*2+1];else{const m=this.measurementsCache[n];if(!m)return;c=m.key,l=m.start,i=m.size}const d=this.itemSizeCache.get(c)??i,p=r-d;if(p!==0){const m=this.options.anchorTo==="end"&&((o=this.scrollState)==null?void 0:o.behavior)!=="smooth"&&this.getVirtualDistanceFromEnd()<=this.options.scrollEndThreshold,h=m?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:l,size:i,end:l+i,lane:0},p,this):l<this.getScrollOffset()+this.scrollAdjustments&&this.scrollDirection!=="backward");(this.pendingMin===null||n<this.pendingMin)&&(this.pendingMin=n),this.itemSizeCache.set(c,r),this.itemSizeCacheVersion++,m?this.applyScrollAdjustment(this.getTotalSize()-h):g&&this.applyScrollAdjustment(p),this.notify(!1)}},this.getVirtualItems=Gt(()=>[this.getVirtualIndexes(),this.getMeasurements()],(n,r)=>{const o=[];for(let s=0,i=n.length;s<i;s++){const l=n[s],c=r[l];o.push(c)}return o},{key:!1,debug:()=>this.options.debug}),this.getVirtualItemForOffset=n=>{const r=this.getMeasurements();if(r.length===0)return;const o=this._flatMeasurements,s=this.options.lanes===1&&o!=null,i=Uu(0,r.length-1,s?l=>o[l*2]:l=>Ki(r[l]).start,n);return Ki(r[i])},this.getMaxScrollOffset=()=>{if(!this.scrollElement)return 0;if("scrollHeight"in this.scrollElement)return this.options.horizontal?this.scrollElement.scrollWidth-this.scrollElement.clientWidth:this.scrollElement.scrollHeight-this.scrollElement.clientHeight;{const n=this.scrollElement.document.documentElement;return this.options.horizontal?n.scrollWidth-this.scrollElement.innerWidth:n.scrollHeight-this.scrollElement.innerHeight}},this.getVirtualDistanceFromEnd=()=>Math.max(this.getTotalSize()-this.getSize()-this.getScrollOffset(),0),this.getDistanceFromEnd=()=>Math.max(this.getMaxScrollOffset()-this.getScrollOffset(),0),this.isAtEnd=(n=this.options.scrollEndThreshold)=>this.getDistanceFromEnd()<=n,this.getOffsetForAlignment=(n,r,o=0)=>{if(!this.scrollElement)return 0;const s=this.getSize(),i=this.getScrollOffset();r==="auto"&&(r=n>=i+s?"end":"start"),r==="center"?n+=(o-s)/2:r==="end"&&(n-=s);const l=this.getMaxScrollOffset();return Math.max(Math.min(l,n),0)},this.getOffsetForIndex=(n,r="auto")=>{n=Math.max(0,Math.min(n,this.options.count-1));const o=this.getSize(),s=this.getScrollOffset(),i=this.measurementsCache[n];if(!i)return;if(r==="auto")if(i.end>=s+o-this.options.scrollPaddingEnd)r="end";else if(i.start<=s+this.options.scrollPaddingStart)r="start";else return[s,r];if(r==="end"&&n===this.options.count-1)return[this.getMaxScrollOffset(),r];const l=r==="end"?i.end+this.options.scrollPaddingEnd:i.start-this.options.scrollPaddingStart;return[this.getOffsetForAlignment(l,r,i.size),r]},this.scrollToOffset=(n,{align:r="start",behavior:o="auto"}={})=>{const s=this.getOffsetForAlignment(n,r),i=this.now();this.scrollState={index:null,align:r,behavior:o,startedAt:i,lastTargetOffset:s,stableFrames:0},this._scrollToOffset(s,{adjustments:void 0,behavior:o}),this.scheduleScrollReconcile()},this.scrollToIndex=(n,{align:r="auto",behavior:o="auto"}={})=>{n=Math.max(0,Math.min(n,this.options.count-1));const s=this.getOffsetForIndex(n,r);if(!s)return;const[i,l]=s,c=this.now();this.scrollState={index:n,align:l,behavior:o,startedAt:c,lastTargetOffset:i,stableFrames:0},this._scrollToOffset(i,{adjustments:void 0,behavior:o}),this.scheduleScrollReconcile()},this.scrollBy=(n,{behavior:r="auto"}={})=>{const o=this.getScrollOffset()+n,s=this.now();this.scrollState={index:null,align:"start",behavior:r,startedAt:s,lastTargetOffset:o,stableFrames:0},this._scrollToOffset(o,{adjustments:void 0,behavior:r}),this.scheduleScrollReconcile()},this.scrollToEnd=({behavior:n="auto"}={})=>{if(this.options.count>0){this.scrollToIndex(this.options.count-1,{align:"end",behavior:n});return}this.scrollToOffset(Math.max(this.getTotalSize()-this.getSize(),0),{behavior:n})},this.getTotalSize=()=>{var n;const r=this.getMeasurements();let o;if(r.length===0)o=this.options.paddingStart;else if(this.options.lanes===1){const s=r.length-1,i=this._flatMeasurements;i!=null?o=i[s*2]+i[s*2+1]:o=((n=r[s])==null?void 0:n.end)??0}else{const s=Array(this.options.lanes).fill(null);let i=r.length-1;for(;i>=0&&s.some(l=>l===null);){const l=r[i];s[l.lane]===null&&(s[l.lane]=l.end),i--}o=Math.max(...s.filter(l=>l!==null))}return Math.max(o-this.options.scrollMargin+this.options.paddingEnd,0)},this.takeSnapshot=()=>{const n=[];if(this.itemSizeCache.size===0)return n;const r=this.getMeasurements();for(const o of r)o&&this.itemSizeCache.has(o.key)&&n.push({index:o.index,key:o.key,start:o.start,size:o.size,end:o.end,lane:o.lane});return n},this._scrollToOffset=(n,{adjustments:r,behavior:o})=>{this._intendedScrollOffset=n+(r??0),this.options.scrollToFn(n,{behavior:o,adjustments:r},this)},this.measure=()=>{this.pendingMin=null,this.itemSizeCache.clear(),this.laneAssignments.clear(),this.itemSizeCacheVersion++,this.notify(!1)},this.setOptions(t)}applyScrollAdjustment(t,n){t!==0&&(Yi()&&(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&&Gi(o,this.getScrollOffset())){if(this.scrollState.stableFrames++,this.scrollState.stableFrames>=s){this.getScrollOffset()!==o&&this._scrollToOffset(o,{adjustments:void 0,behavior:"auto"}),this.scrollState=null;return}}else if(this.scrollState.stableFrames=0,i){const l=this.getSize()||600,c=Math.abs(o-this.getScrollOffset()),u=this.scrollState.behavior==="smooth"&&c>l;this.scrollState.lastTargetOffset=o,u||(this.scrollState.behavior="auto"),this._scrollToOffset(o,{adjustments:void 0,behavior:u?"smooth":"auto"})}this.scheduleScrollReconcile()}}const Uu=(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 Xw({measurements:e,outerSize:t,scrollOffset:n,lanes:r,flat:o}){const s=e.length-1,i=o?d=>o[d*2]:d=>e[d].start,l=o?d=>o[d*2]+o[d*2+1]:d=>e[d].end;if(e.length<=r)return{startIndex:0,endIndex:s};let c=Uu(0,s,i,n),u=c;if(r===1)for(;u<s&&l(u)<n+t;)u++;else if(r>1){const d=Array(r).fill(0);for(;u<s&&d.some(m=>m<n+t);){const m=e[u];d[m.lane]=m.end,u++}const p=Array(r).fill(n+t);for(;c>=0&&p.some(m=>m>=n);){const m=e[c];p[m.lane]=m.start,c--}c=Math.max(0,c-c%r),u=Math.min(s,u+(r-1-u%r))}return{startIndex:c,endIndex:u}}const Qi=typeof document<"u"?v.useLayoutEffect:v.useEffect;function Qw({useFlushSync:e=!0,...t}){const n=v.useReducer(s=>s+1,0)[1],r={...t,onChange:(s,i)=>{var l;e&&i?$n.flushSync(n):n(),(l=t.onChange)==null||l.call(t,s,i)}},[o]=v.useState(()=>new Yw(r));return o.setOptions(r),Qi(()=>o._didMount(),[]),Qi(()=>o._willUpdate()),o}function e_(e){return Qw({observeElementRect:Ww,observeElementOffset:qw,scrollToFn:Gw,...e})}const t_=22,xo=1e4;function n_(e){return e==="added"?"+":e==="removed"?"-":" "}function r_(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 o_=function({result:t,emptyLabel:n}){const[r,o]=v.useState("unified"),s=v.useRef(null),i=e_({count:t.lines.length,getScrollElement:()=>s.current,estimateSize:()=>t_,overscan:10});if(t.isEmpty)return a.jsx("div",{className:"rounded border border-dashed border-border bg-muted/30 px-4 py-6 text-center text-xs text-muted-foreground","data-testid":"diff-empty",children:n??"No transformation applied — raw and processed are identical."});const l=t.lines.length,c=l>xo,u=c?t.lines.slice(0,xo):t.lines;return a.jsxs("div",{className:"space-y-2",children:[a.jsxs("div",{className:"flex items-center justify-between text-xs text-muted-foreground",children:[a.jsxs("span",{children:[l.toLocaleString()," line",l===1?"":"s",c&&` (showing first ${xo.toLocaleString()})`]}),a.jsxs("div",{className:"inline-flex rounded-md border border-border overflow-hidden",children:[a.jsxs("button",{type:"button",onClick:()=>o("unified"),"aria-pressed":r==="unified",className:ve("flex items-center gap-1 px-2 py-1 transition-colors",r==="unified"?"bg-muted text-foreground":"hover:bg-muted/50"),title:"Unified diff (single column)",children:[a.jsx(L0,{className:"size-3"}),"Unified"]}),a.jsxs("button",{type:"button",onClick:()=>o("split"),"aria-pressed":r==="split",className:ve("flex items-center gap-1 px-2 py-1 transition-colors border-l border-border",r==="split"?"bg-muted text-foreground":"hover:bg-muted/50"),title:"Split diff (side by side)",children:[a.jsx(r0,{className:"size-3"}),"Split"]})]})]}),a.jsx("div",{ref:s,className:"max-h-[60vh] overflow-auto rounded border border-border bg-background font-mono text-xs","data-testid":"diff-viewport",children:r==="unified"?a.jsx(s_,{virtualizer:i,lines:u}):a.jsx(l_,{lines:u})})]})};function s_({virtualizer:e,lines:t}){return a.jsx("div",{style:{height:`${e.getTotalSize()}px`,width:"100%",position:"relative"},children:e.getVirtualItems().map(n=>{const r=t[n.index];return r===void 0?null:a.jsxs("div",{"data-index":n.index,ref:e.measureElement,className:ve("flex items-start gap-3 px-2",r_(r.kind)),style:{position:"absolute",top:0,left:0,width:"100%",transform:`translateY(${n.start}px)`},children:[a.jsx("span",{className:"select-none text-muted-foreground/60 w-10 text-right tabular-nums",children:r.oldLineNumber??""}),a.jsx("span",{className:"select-none text-muted-foreground/60 w-10 text-right tabular-nums",children:r.newLineNumber??""}),a.jsx("span",{className:ve("select-none w-3 text-right font-bold",r.kind==="added"&&"text-green-600 dark:text-green-400",r.kind==="removed"&&"text-red-600 dark:text-red-400"),children:n_(r.kind)}),a.jsx("span",{className:"whitespace-pre-wrap break-all flex-1",children:r.text})]},n.key)})})}function i_(e){const t=[];let n=0;for(;n<e.length;){const r=e[n];if(r===void 0)break;if(r.kind==="context"){t.push({left:{text:r.text,lineNumber:r.oldLineNumber},right:{text:r.text,lineNumber:r.newLineNumber},kind:"equal"}),n+=1;continue}const o=[],s=[];for(;n<e.length&&e[n]?.kind==="removed";){const l=e[n];l!==void 0&&o.push(l),n+=1}for(;n<e.length&&e[n]?.kind==="added";){const l=e[n];l!==void 0&&s.push(l),n+=1}const i=Math.max(o.length,s.length);for(let l=0;l<i;l+=1){const c=o[l],u=s[l];c!==void 0&&u!==void 0?t.push({left:{text:c.text,lineNumber:c.oldLineNumber},right:{text:u.text,lineNumber:u.newLineNumber},kind:"changed"}):c!==void 0?t.push({left:{text:c.text,lineNumber:c.oldLineNumber},right:null,kind:"removed"}):u!==void 0&&t.push({left:null,right:{text:u.text,lineNumber:u.newLineNumber},kind:"added"})}}return t}function a_(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 l_({lines:e}){const t=i_(e);return a.jsx("div",{"data-testid":"diff-split",children:t.map((n,r)=>a.jsxs("div",{className:ve("grid grid-cols-2 font-mono text-xs",a_(n.kind)),children:[a.jsxs("div",{className:"flex items-start gap-2 px-2 border-r border-border/50",children:[a.jsx("span",{className:"select-none text-muted-foreground/60 w-8 text-right tabular-nums",children:n.left?.lineNumber??""}),a.jsx("span",{className:ve("select-none w-3 text-right font-bold",(n.kind==="removed"||n.kind==="changed")&&"text-red-600 dark:text-red-400"),children:n.left!==null?"-":" "}),a.jsx("span",{className:"whitespace-pre-wrap break-all flex-1",children:n.left?.text??""})]}),a.jsxs("div",{className:"flex items-start gap-2 px-2",children:[a.jsx("span",{className:"select-none text-muted-foreground/60 w-8 text-right tabular-nums",children:n.right?.lineNumber??""}),a.jsx("span",{className:ve("select-none w-3 text-right font-bold",(n.kind==="added"||n.kind==="changed")&&"text-green-600 dark:text-green-400"),children:n.right!==null?"+":" "}),a.jsx("span",{className:"whitespace-pre-wrap break-all flex-1",children:n.right?.text??""})]})]},r))})}const Zu=v.memo(o_),c_={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 vo(e){return e<1e3?`${e}ms`:`${(e/1e3).toFixed(1)}s`}function ea({trend:e}){if(e===null)return null;const t=e.direction==="up",n=t?Lg:Rg,r=t?"+":"-";return a.jsxs("span",{className:"flex items-center gap-0.5 text-muted-foreground tabular-nums",children:[a.jsx(n,{className:t?"size-3 text-emerald-400":"size-3 text-rose-400"}),a.jsxs("span",{className:"font-mono",children:[r,Be(e.delta)]})]})}const u_=v.memo(function({log:e,messageCount:t=null,toolCount:n=null,expanded:r,onToggle:o,cacheTrend:s=null,activeTab:i,tabActions:l,onReplay:c,slowResponseThresholdSeconds:u=0,timeDisplayFormat:d}){const p=t1(e.responseStatus),m=e.elapsedMs!==null&&u>0&&e.elapsedMs>u*1e3,h=e.inputTokens!==null||e.outputTokens!==null;return a.jsx($e,{children:a.jsxs("div",{id:`log-${e.id}`,role:"button",tabIndex:0,"data-nav-id":`log-${e.id}`,"data-nav-action":r?"collapse":"expand",className:ve("flex items-center gap-2 px-3 py-1 cursor-pointer transition-colors","hover:bg-muted/50","select-none","focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1 focus-visible:outline-none"),onClick:o,onKeyDown:g=>{(g.key==="Enter"||g.key===" ")&&(g.preventDefault(),o())},children:[a.jsxs("span",{className:"text-blue-400/80 font-mono text-xs font-semibold tabular-nums shrink-0",children:["#",e.id]}),a.jsxs("span",{className:"flex items-center gap-1 text-muted-foreground text-xs shrink-0",children:[a.jsx(Rt,{className:"size-3"}),a.jsx("span",{className:"font-mono tabular-nums",title:e.timestamp,children:zo(e.timestamp,d)})]}),e.model!==null&&a.jsxs(je,{children:[a.jsx(Ee,{asChild:!0,children:a.jsx("span",{className:"shrink-0",children:a.jsx(Mu,{provider:Pu(e.model),className:"size-4"})})}),a.jsx(Ne,{children:e.model})]}),p!=="success"&&a.jsxs(Yr,{variant:"outline",className:ve("text-[10px] px-1.5 py-0 h-5 font-mono tabular-nums gap-1",c_[p]),children:[p==="server_error"?a.jsx(N0,{className:"size-3","aria-label":"Server error"}):p==="client_error"?a.jsx(yr,{className:"size-3","aria-label":"Client error"}):p==="pending"?a.jsx(Pn,{className:"size-3 animate-spin","aria-label":"Pending"}):null,e.responseStatus]}),e.elapsedMs!==null&&a.jsxs(je,{children:[a.jsx(Ee,{asChild:!0,children:a.jsxs("span",{className:ve("flex items-center gap-1 text-xs shrink-0",m?"text-amber-400":"text-muted-foreground"),children:[a.jsx(Rt,{className:"size-3"}),a.jsx("span",{className:"font-mono tabular-nums",children:vo(e.elapsedMs)}),m&&a.jsx(yr,{className:"size-3","aria-label":"Slow response"})]})}),a.jsx(Ne,{children:m?`Slow response: ${vo(e.elapsedMs)} exceeds ${vo(u*1e3)}`:"Elapsed response time"})]}),h&&a.jsxs("span",{className:"flex items-center gap-1 text-xs shrink-0",children:[a.jsx(Mn,{className:"size-3 text-muted-foreground"}),a.jsxs("span",{className:"font-mono tabular-nums",children:[a.jsxs("span",{className:e.inputTokens!==null?"text-blue-400":"text-muted-foreground",children:["IN ",e.inputTokens!==null?Be(e.inputTokens):"—"]})," / ",a.jsxs("span",{className:e.outputTokens!==null?"text-amber-400":"text-muted-foreground",children:["OUT ",e.outputTokens!==null?Be(e.outputTokens):"—"]})]})]}),e.cacheCreationInputTokens!==null&&e.cacheCreationInputTokens>0&&a.jsxs(je,{children:[a.jsx(Ee,{asChild:!0,children:a.jsxs("span",{className:"flex items-center gap-1 text-xs shrink-0",children:[a.jsx(ea,{trend:s?.creation??null}),a.jsxs("span",{className:"font-mono tabular-nums text-emerald-400",children:["Cache +",Be(e.cacheCreationInputTokens)]})]})}),a.jsx(Ne,{children:"Tokens cached for reuse, reducing future API cost"})]}),e.cacheReadInputTokens!==null&&e.cacheReadInputTokens>0&&a.jsxs(je,{children:[a.jsx(Ee,{asChild:!0,children:a.jsxs("span",{className:"flex items-center gap-1 text-xs shrink-0",children:[a.jsx(ea,{trend:s?.read??null}),a.jsxs("span",{className:"font-mono tabular-nums text-purple-400",children:["Cache ~",Be(e.cacheReadInputTokens)]})]})}),a.jsx(Ne,{children:"Tokens served from cache, reducing API cost"})]}),t!==null&&a.jsxs("span",{className:"flex items-center gap-1 text-muted-foreground text-xs shrink-0",children:[a.jsx(us,{className:"size-3"}),a.jsx("span",{className:"font-mono tabular-nums",children:t})]}),n!==null&&a.jsxs("span",{className:"flex items-center gap-1 text-muted-foreground text-xs shrink-0",children:[a.jsx(ds,{className:"size-3"}),a.jsx("span",{className:"font-mono tabular-nums",children:n})]}),e.origin!==null&&a.jsxs("span",{className:"hidden xl:flex items-center gap-1 text-muted-foreground text-xs shrink-0",title:`Origin: ${e.origin}`,children:[a.jsx(v0,{className:"size-3"}),a.jsx("span",{className:"font-mono tabular-nums truncate max-w-[120px]",title:e.origin,children:e.origin})]}),(e.clientPid!==null||e.clientProjectFolder!==null)&&a.jsxs(je,{children:[a.jsx(Ee,{asChild:!0,children:a.jsxs("span",{className:"hidden xl:flex items-center gap-1 text-purple-400/80 text-xs shrink-0",children:[a.jsx(f0,{className:"size-3"}),e.clientProjectFolder!==null?a.jsx("span",{className:"font-mono tabular-nums",children:e.clientProjectFolder}):a.jsxs("span",{className:"font-mono tabular-nums",children:["PID ",e.clientPid]})]})}),a.jsx(Ne,{children:e.clientCwd!==null?`PID: ${e.clientPid??"?"} CWD: ${e.clientCwd}`:`Process ID: ${e.clientPid??"?"}`})]}),e.streaming&&a.jsxs(je,{children:[a.jsx(Ee,{asChild:!0,children:a.jsx(I0,{className:"size-3 text-muted-foreground/60 shrink-0"})}),a.jsx(Ne,{children:"Request used SSE streaming"})]}),a.jsx("span",{className:"flex-1 min-w-0"}),r&&a.jsxs("span",{className:"flex items-center gap-1.5 shrink-0",onClick:g=>g.stopPropagation(),onKeyDown:g=>g.stopPropagation(),children:[l!==void 0&&i!==void 0&&(()=>{const g=l[i];return g===void 0?null:a.jsxs(a.Fragment,{children:[g.expansion!==null&&a.jsxs(je,{children:[a.jsx(Ee,{asChild:!0,children:a.jsx(Pe,{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?a.jsx(Kg,{className:"size-3.5"}):a.jsx(qg,{className:"size-3.5"})})}),a.jsx(Ne,{children:g.expansion.isExpanded?"Collapse all JSON nodes":"Expand all JSON nodes"})]}),g.diffWithRaw!==void 0&&a.jsxs(je,{children:[a.jsx(Ee,{asChild:!0,children:a.jsx(Pe,{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:a.jsx(u0,{className:"size-3.5"})})}),a.jsx(Ne,{children:g.diffWithRaw.active?"Hide diff with raw request":"Show diff between displayed and raw request body"})]}),g.diffWithPrevious!==void 0&&a.jsxs(je,{children:[a.jsx(Ee,{asChild:!0,children:a.jsx(Pe,{variant:"outline",size:"icon",className:"size-8",onClick:g.diffWithPrevious,"aria-label":"Diff with previous",children:a.jsx(b0,{className:"size-3.5"})})}),a.jsx(Ne,{children:"Compare this request with the immediately preceding one"})]}),g.copyText!==null&&a.jsxs(je,{children:[a.jsx(Ee,{asChild:!0,children:a.jsx(Pe,{variant:"outline",size:"icon",className:"size-8",onClick:g.onCopy,"aria-label":g.copyCopied?"Copied":g.copyLabel,children:g.copyCopied?a.jsx(Ut,{className:"size-3.5 text-emerald-500"}):a.jsx(Zn,{className:"size-3.5"})})}),a.jsx(Ne,{children:g.copyCopied?"Copied to clipboard":g.copyLabel})]})]})})(),c!==void 0&&a.jsxs(je,{children:[a.jsx(Ee,{asChild:!0,children:a.jsx(Pe,{variant:"outline",size:"icon",className:"size-8",onClick:c,"aria-label":"Replay request",children:a.jsx(P0,{className:"size-3.5"})})}),a.jsx(Ne,{children:"Re-send this request to the provider"})]})]}),r?a.jsx(hn,{className:"size-4 text-muted-foreground shrink-0"}):a.jsx(Un,{className:"size-4 text-muted-foreground shrink-0"})]})})}),d_="/v1/chat/completions",f_="/chat/completions",h_="/v1/messages";class p_{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 yn=new p_;function m_(e){return yn.getByPath(e)??null}function g_(e){return m_(e)?.format??"unknown"}yn.registerPath(h_,"anthropic");yn.registerPath(d_,"openai");yn.registerPath(f_,"openai");function x_(e){if(e==="")return{};try{const t=JSON.parse(e);return t!==null&&typeof t=="object"&&!Array.isArray(t)?{...t}:{}}catch{return{}}}function v_(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:x_(e.inputJson)}}}function Wu(e,t,n,r){const o=new Map;let s="",i="",l=null,c=null,u=0,d=0;const p=1e3;let m=0,h=0;const g=[];for(const x of e.split(`
|
|
94
|
-
`)){const y=x.trim();if(y.startsWith("data: "))try{const _=JSON.parse(y.slice(6)),k=vg.safeParse(_);if(!k.success)continue;const C=k.data;switch(m===0&&(h=Date.now()),r===!0&&g.length<p&&g.push({index:m,timestamp:Date.now()-h,type:C.type,data:C}),m++,C.type){case"message_start":s=C.message.id,i=C.message.model,u=C.message.usage.input_tokens,t.inputTokens=u,t.cacheCreationInputTokens=C.message.usage.cache_creation_input_tokens??null,t.cacheReadInputTokens=C.message.usage.cache_read_input_tokens??null,t.model===null&&(t.model=i);break;case"content_block_start":{const S=C.content_block;switch(S.type){case"text":o.set(C.index,{type:"text",text:S.text??""});break;case"thinking":o.set(C.index,{type:"thinking",thinking:S.thinking??"",signature:S.signature??""});break;case"think":o.set(C.index,{type:"think",thinking:S.thinking??"",signature:S.signature??""});break;case"tool_use":o.set(C.index,{type:"tool_use",id:S.id,name:S.name,inputJson:""});break}break}case"content_block_delta":{const S=o.get(C.index);if(S===void 0)break;const z=C.delta;z.type==="text_delta"&&S.type==="text"?S.text+=z.text:z.type==="thinking_delta"&&(S.type==="thinking"||S.type==="think")?S.thinking+=z.thinking:z.type==="signature_delta"&&(S.type==="thinking"||S.type==="think")?S.signature+=z.signature:z.type==="input_json_delta"&&S.type==="tool_use"&&(S.inputJson+=z.partial_json);break}case"message_delta":l=C.delta.stop_reason,c=C.delta.stop_sequence??null,d=C.usage.output_tokens,t.outputTokens=d,C.usage.cache_creation_input_tokens!==void 0&&(t.cacheCreationInputTokens=C.usage.cache_creation_input_tokens),C.usage.cache_read_input_tokens!==void 0&&(t.cacheReadInputTokens=C.usage.cache_read_input_tokens);break;case"error":t.error=C.error.message;break;case"content_block_stop":case"message_stop":case"ping":break}}catch{}}r===!0&&(t.streamingChunks={chunks:g,truncated:m>p});const f=[...o.entries()].sort(([x],[y])=>x-y).map(([,x])=>v_(x));return JSON.stringify({id:s,type:"message",model:i!==""?i:n??"",role:"assistant",content:f,stop_reason:l,stop_sequence:c,usage:{input_tokens:u,output_tokens:d}})}const y_={format:"anthropic",parseRequest(e,t){try{const n=JSON.parse(e),r=tl.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=nl.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 Wu(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}}};yn.register(y_);class b_{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 Ds=new b_,w_="https://api.anthropic.com",__={MiniMax:"https://api.minimaxi.com/anthropic"},k_={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(__))if(t.startsWith(n.toLowerCase()))return!0;return!0},getUpstreamBase(e,t){return t?.baseUrl!==void 0?t.baseUrl:w_},extractStream(e,t,n,r){return Wu(e,t,n,r)}};Ds.register(k_);function Ls(e,t,n,r=!0){let o="",s="",i="",l="",c=null,u=0,d=0,p=!1,m=!1;const h=new Map,g=1e3;let f=0,x=0;const y=[];for(const k of e.split(`
|
|
95
|
-
`)){const C=k.trim();if(!C.startsWith("data: "))continue;const S=C.slice(6);if(S==="[DONE]")break;try{const z=JSON.parse(S);if(typeof z=="object"&&z!==null&&!Array.isArray(z)){const O=Object.getOwnPropertyDescriptor(z,"error");if(O!==void 0&&typeof O.value=="object"&&O.value!==null){const R=Object.getOwnPropertyDescriptor(O.value,"message");R!==void 0&&typeof R.value=="string"&&(t.error=R.value);continue}}const N=Cg.safeParse(z);if(!N.success)continue;const A=N.data;if(f===0&&(x=Date.now()),r===!0&&y.length<g&&y.push({index:f,timestamp:Date.now()-x,type:"chat.completion.chunk",data:A}),f++,m||(o=A.id,s=A.model,m=!0),!p&&A.usage!==void 0&&A.usage!==null){if(u=A.usage.prompt_tokens??0,d=A.usage.completion_tokens??0,t.inputTokens=u,typeof z=="object"&&z!==null&&!Array.isArray(z)){const O=Object.getOwnPropertyDescriptor(z,"usage");if(O!==void 0&&typeof O.value=="object"&&O.value!==null){const R=Object.getOwnPropertyDescriptor(O.value,"prompt_tokens_details");if(R!==void 0&&typeof R.value=="object"&&R.value!==null){const G=Object.getOwnPropertyDescriptor(R.value,"cached_tokens");G!==void 0&&typeof G.value=="number"&&(t.cacheReadInputTokens=G.value)}}}p=!0}for(const O of A.choices){const R=O.delta;R.content!==void 0&&R.content!==null&&(i+=R.content),R.reasoning_content!==void 0&&R.reasoning_content!==null&&(l+=R.reasoning_content),R.thinking!==void 0&&R.thinking!==null&&(l+=R.thinking);const G=R.think;if(G!=null&&(l+=G),O.finish_reason!==void 0&&O.finish_reason!==null&&(c=O.finish_reason),R.tool_calls!==void 0&&R.tool_calls!==null)for(const j of R.tool_calls){let I=h.get(j.index);I===void 0&&(I={index:j.index,type:"function",function:{name:"",arguments:""}},h.set(j.index,I)),j.id!==void 0&&(I.id=j.id),j.function?.name!==void 0&&(I.function.name+=j.function.name),j.function?.arguments!==void 0&&(I.function.arguments+=j.function.arguments)}}}catch{}}r===!0&&(t.streamingChunks={chunks:y,truncated:f>g}),p||(d=Math.ceil(i.length/4)),t.outputTokens=d;const _={role:"assistant",content:i};return l&&(_.reasoning_content=l),h.size>0&&(_.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:_,finish_reason:c}],usage:{prompt_tokens:u,completion_tokens:d,total_tokens:u+d}})}const C_={format:"openai",parseRequest(e,t){try{const n=JSON.parse(e),r=sl.safeParse(n);return r.success?{model:r.data.model,sessionId:t?.get("x-session-affinity")??null}:null}catch{return null}},extractTokens(e){const t=al(e);if(t){let n=null;try{const r=JSON.parse(e);if(r!==null&&typeof r=="object"&&!Array.isArray(r)){const o=Object.getOwnPropertyDescriptor(r,"usage");if(o!==void 0&&typeof o.value=="object"&&o.value!==null){const s=Object.getOwnPropertyDescriptor(o.value,"prompt_tokens_details");if(s!==void 0&&typeof s.value=="object"&&s.value!==null){const i=Object.getOwnPropertyDescriptor(s.value,"cached_tokens");i!==void 0&&typeof i.value=="number"&&(n=i.value)}}}}catch{}return{inputTokens:t.usage.prompt_tokens??null,outputTokens:t.usage.completion_tokens??null,cacheCreationInputTokens:null,cacheReadInputTokens:n}}return{inputTokens:null,outputTokens:null,cacheCreationInputTokens:null,cacheReadInputTokens:null}},extractStream(e,t,n,r){return Ls(e,t,n,r)},detectFormat(e){if(e===null)return!1;try{const t=JSON.parse(e);if(typeof t=="object"&&t!==null&&!Array.isArray(t)){const n=Object.keys(t);return n.includes("model")&&n.includes("messages")&&!n.includes("system")}return!1}catch{return!1}}};yn.register(C_);const S_="https://api.openai.com/v1",j_={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:S_},extractStream(e,t,n,r){return Ls(e,t,n,r)}};Ds.register(j_);const E_="https://dashscope.aliyuncs.com/compatible-mode/v1",N_={name:"alibaba",matches(e){const t=e.toLowerCase().replace(/\s+/g,"-");return!!(t.startsWith("glm-5")||t.startsWith("qwen"))},getUpstreamBase(e,t){return E_},extractStream(e,t,n){return Ls(e,t,n)}};Ds.register(N_);function Vu(e,t){for(const n of Array.from(e))t(n)}const T_=/[\u3000-\u9FFF\uAC00-\uD7FF\uF900-\uFAFF\uFF00-\uFFEF\u{1F300}-\u{1FAFF}]/u;function Hu(e){if(e.length===0)return 0;let t=0,n=0;return Vu(e,r=>{T_.test(r)?t+=1:n+=1}),Math.ceil(t*1)+Math.ceil(n/4)}function qu(e){if(e.length===0)return 0;let t=0;return Vu(e,()=>{t+=1}),t}function It(e){return{parsed:null,comparisonValue:e,messageCount:null,toolCount:null}}const rn={parsed:null,toolNames:null};function A_(e){if(typeof e=="string")return e;if(!Array.isArray(e))return"";const t=[];for(const n of e){if(n===null||typeof n!="object")continue;const r=n;switch(r.type){case"text":typeof r.text=="string"&&t.push(r.text);break;case"thinking":case"think":typeof r.thinking=="string"&&t.push(r.thinking);break;case"tool_use":{const s=typeof r.name=="string"?r.name:"",i=r.input!==void 0?JSON.stringify(r.input):"";t.push(`${s} ${i}`.trim());break}case"tool_result":{const s=r.content;if(typeof s=="string")t.push(s);else if(Array.isArray(s)){for(const i of s)if(i!==null&&typeof i=="object"){const l=i.text;typeof l=="string"&&t.push(l)}}break}case"image":t.push("[image]");break}}return t.join(`
|
|
96
|
-
`)}function z_(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(`
|
|
97
|
-
`)}function O_(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(`
|
|
98
|
-
`)}function yo(e,t,n,r){return{role:e,label:t,text:n,size:Hu(n),characters:qu(n),path:r}}const I_={format:"anthropic",analyzeRequest(e){if(e===null)return It(e);try{const t=tl.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}:It(e)}catch{return It(e)}},analyzeResponse(e){if(e===null)return rn;try{let t=JSON.parse(e);typeof t=="string"&&(t=JSON.parse(t));const n=nl.safeParse(t);if(!n.success)return rn;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 rn}},anatomySegments(e){if(e===null||typeof e!="object")return null;const t=e,n=[];if(t.system!==void 0){const r=z_(t.system);r.length>0&&n.push(yo("system","system",r,"/system"))}if(Array.isArray(t.messages)&&t.messages.forEach((r,o)=>{if(r===null||typeof r!="object")return;const s=r,i=s.role==="user"||s.role==="assistant"?s.role:"user",l=A_(s.content);n.push(yo(i,`[${o}] ${i}`,l,`/messages/${o}`))}),Array.isArray(t.tools)&&t.tools.length>0){const r=O_(t.tools);n.push(yo("tools","tools",r,"/tools"))}return n.length>0?n:null}};function R_(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(`
|
|
99
|
-
`)}function P_(e){const t=[],n=R_(e.content);n.length>0&&t.push(n);const r=typeof e.reasoning_content=="string"?e.reasoning_content:typeof e.thinking=="string"?e.thinking:typeof e.think=="string"?e.think:"";r.length>0&&t.push(r);const o=e.tool_calls;if(Array.isArray(o))for(const s of o){if(s===null||typeof s!="object")continue;const i=s.function;if(i===void 0)continue;const l=typeof i.name=="string"?i.name:"",c=typeof i.arguments=="string"?i.arguments:"";t.push(`${l} ${c}`.trim())}return t.join(`
|
|
100
|
-
`)}function M_(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(`
|
|
101
|
-
`)}function ta(e,t,n,r){return{role:e,label:t,text:n,size:Hu(n),characters:qu(n),path:r}}const D_={format:"openai",analyzeRequest(e){if(e===null)return It(e);try{const t=sl.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}:It(e)}catch{return It(e)}},analyzeResponse(e){if(e===null)return rn;const t=al(e);if(t===null)return rn;const n=t.choices[0]?.message?.tool_calls?.map(r=>r.function?.name??"").filter(r=>r!=="")??[];return{parsed:t,toolNames:n.length>0?n:null}},anatomySegments(e){if(e===null||typeof e!="object")return null;const t=e,n=[];if(Array.isArray(t.messages)&&t.messages.forEach((r,o)=>{if(r===null||typeof r!="object")return;const s=r,i=s.role==="user"||s.role==="assistant"||s.role==="system"||s.role==="tool"?s.role:"user",l=P_(s);n.push(ta(i,`[${o}] ${i}`,l,`/messages/${o}`))}),Array.isArray(t.tools)&&t.tools.length>0){const r=M_(t.tools);n.push(ta("tools","tools",r,"/tools"))}return n.length>0?n:null}},L_={format:"unknown",analyzeRequest(e){return It(e)},analyzeResponse(){return rn},anatomySegments(){return null}},F_={anthropic:I_,openai:D_,unknown:L_};function $_(e){return F_[e]}function Tr(e){const t=g_(e.path);return t==="unknown"?e.apiFormat:t}function na(e,t,n){return e==="anthropic"&&t==="full"&&n}function B_(e,t){return e==="full"&&t}function U_(e,t,n,r){return e==="anthropic"&&t==="full"&&n&&r}function Yt(){return a.jsx("div",{className:"h-1","aria-hidden":"true"})}function Z_({active:e,onClick:t}){return a.jsxs(je,{children:[a.jsx(Ee,{asChild:!0,children:a.jsxs(Pe,{variant:e?"default":"outline",size:"sm",className:"h-8 text-xs",onClick:t,"aria-pressed":e,children:[a.jsx(g0,{className:"size-3.5 mr-1"}),e?"Showing diff":"Diff with Raw"]})}),a.jsx(Ne,{children:e?"Hide diff view":"Compare proxy output against the original raw version"})]})}const W_=v.memo(function({rawBody:e,displayedBody:t,emptyLabel:n}){const r=v.useMemo(()=>Fw(e,t),[e,t]);return a.jsx(Zu,{result:r,emptyLabel:n})}),V_=v.memo(function({rawHeaders:e,headers:t,emptyLabel:n}){const r=v.useMemo(()=>Lw(e,t),[e,t]);return a.jsx(Zu,{result:r,emptyLabel:n})}),H_=v.memo(function({log:e,viewMode:t="simple",strip:n,slowResponseThresholdSeconds:r,timeDisplayFormat:o,cacheTrend:s=null,onCompareWithPrevious:i}){const[l,c]=v.useState(!1),[u,d]=v.useState(!1),[p,m]=v.useState(!1),[h,g]=v.useState(!1),[f,x]=v.useState("request"),[y,_]=v.useState(null),k=v.useRef(null),C=Tr(e),S=$_(C),z=v.useMemo(()=>S.analyzeRequest(e.rawRequestBody),[S,e.rawRequestBody]),A=v.useMemo(()=>!n||C!=="anthropic"||e.rawRequestBody===null?null:bw(e.rawRequestBody).body,[e.rawRequestBody,C,n])??e.rawRequestBody,O=go(A),R=go(e.rawRequestBody),G=go(e.responseText),j=v.useMemo(()=>e.headers&&Object.keys(e.headers).length>0?JSON.stringify(e.headers,null,2):null,[e.headers]),I=v.useMemo(()=>e.rawHeaders&&Object.keys(e.rawHeaders).length>0?JSON.stringify(e.rawHeaders,null,2):null,[e.rawHeaders]),b=Cn(A),M=Cn(e.rawRequestBody),V=Cn(j),P=Cn(I),F=Cn(e.responseText),W=v.useMemo(()=>({request:{copyLabel:"Copy request body",copyText:A,copyCopied:b.copied,onCopy:b.copy,expansion:{isExpanded:O.isExpanded,isPending:O.isPending,onToggle:O.toggle},diffWithRaw:U_(C,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:M.copied,onCopy:M.copy,expansion:{isExpanded:R.isExpanded,isPending:R.isPending,onToggle:R.toggle}},headers:{copyLabel:"Copy headers",copyText:j,copyCopied:V.copied,onCopy:V.copy,expansion:null},"raw-headers":{copyLabel:"Copy raw headers",copyText:I,copyCopied:P.copied,onCopy:P.copy,expansion:null},raw:{copyLabel:"Copy response",copyText:e.responseText,copyCopied:F.copied,onCopy:F.copy,expansion:{isExpanded:G.isExpanded,isPending:G.isPending,onToggle:G.toggle}}}),[A,b,O,h,e.rawRequestBody,M,R,j,V,I,P,e.responseText,F,G,C,t,n,i]),oe=v.useMemo(()=>O.parsedData!==null?S.anatomySegments(O.parsedData):null,[S,O.parsedData]),Z=v.useMemo(()=>{if(oe!==null)return new Set(oe.map(te=>te.path))},[oe]),U=Ow({containerRef:k,setExpandToPath:_,ensureTabActive:()=>{f!=="request"&&x("request")}});return a.jsxs($e,{children:[a.jsxs("div",{className:"border border-border rounded-lg mb-1 overflow-hidden",children:[a.jsx(u_,{log:e,messageCount:z.messageCount,toolCount:z.toolCount,expanded:l,onToggle:()=>c(!l),cacheTrend:s,slowResponseThresholdSeconds:r,timeDisplayFormat:o,activeTab:f,tabActions:W,onReplay:i===void 0?void 0:()=>{d(!0)}}),l&&a.jsx("div",{onClick:te=>te.stopPropagation(),onKeyDown:te=>te.stopPropagation(),children:a.jsxs(Du,{value:f,onValueChange:x,children:[a.jsxs(Lu,{className:"mx-4 mt-2",children:[t==="full"&&a.jsx(ft,{value:"raw-headers",children:"Raw Headers"}),t==="full"&&a.jsx(ft,{value:"headers",children:"Headers"}),na(C,t,n)&&a.jsx(ft,{value:"raw-request",children:"Raw Request"}),a.jsx(ft,{value:"request",children:"Request"}),oe!==null&&a.jsx(ft,{value:"anatomy",children:"Anatomy"}),t==="full"&&a.jsx(ft,{value:"raw",children:"Raw Response"}),a.jsx(ft,{value:"parsed",children:"Response"})]}),na(C,t,n)&&a.jsx(ht,{value:"raw-request",children:f==="raw-request"&&a.jsx("div",{className:"px-4 pt-1 pb-3",children:e.rawRequestBody===null?a.jsx("p",{className:"text-xs text-muted-foreground italic",children:"No request body"}):R.parsedData!==null?a.jsx(v.Suspense,{fallback:a.jsx(Yt,{}),children:a.jsx(Vi,{data:R.parsedData,bulkDepth:R.bulkDepth,bulkRevision:R.bulkRevision})}):a.jsx("pre",{className:"font-mono text-xs whitespace-pre-wrap break-words",children:e.rawRequestBody})})}),a.jsx(ht,{value:"request",children:f==="request"&&a.jsx("div",{className:"px-4 pt-1 pb-3",children:h?a.jsx(W_,{rawBody:e.rawRequestBody,displayedBody:A,emptyLabel:"No transformation applied — raw and sent request bodies are identical."}):a.jsx("div",{ref:k,children:A===null?a.jsx("p",{className:"text-xs text-muted-foreground italic",children:"No request body"}):O.parsedData!==null?a.jsx(v.Suspense,{fallback:a.jsx(Yt,{}),children:a.jsx(Vi,{data:O.parsedData,bulkDepth:O.bulkDepth,bulkRevision:O.bulkRevision,anatomyPaths:Z,expandToPath:y})}):a.jsx("pre",{className:"font-mono text-xs whitespace-pre-wrap break-words",children:A})})})}),oe!==null&&a.jsx(ht,{value:"anatomy",children:f==="anatomy"&&a.jsx(v.Suspense,{fallback:a.jsx(Yt,{}),children:a.jsx(jw,{parsed:null,inputTokens:e.inputTokens??null,segments:oe,onSegmentActivate:U})})}),t==="full"&&a.jsx(ht,{value:"headers",children:f==="headers"&&a.jsxs("div",{className:"px-4 pt-1 pb-3",children:[a.jsx("div",{className:"flex justify-end gap-2 mb-2",children:B_(t,e.rawHeaders!==void 0&&Object.keys(e.rawHeaders).length>0)&&a.jsx(Z_,{active:p,onClick:te=>{te.stopPropagation(),m(!p)}})}),p?a.jsx(V_,{rawHeaders:e.rawHeaders,headers:e.headers,emptyLabel:"No transformation applied — raw and processed headers are identical."}):e.headers&&Object.keys(e.headers).length>0?a.jsx("div",{className:"space-y-1 font-mono text-xs",children:Object.entries(e.headers).sort(([te],[ee])=>te.localeCompare(ee)).map(([te,ee])=>a.jsxs("div",{className:"flex gap-2",children:[a.jsxs("span",{className:"text-blue-600 dark:text-blue-400 font-semibold shrink-0",children:[te,":"]}),a.jsx("span",{className:"text-muted-foreground truncate",title:ee,children:ee})]},te))}):a.jsx("p",{className:"text-xs text-muted-foreground italic",children:"No headers captured"})]})}),t==="full"&&a.jsx(ht,{value:"raw-headers",children:f==="raw-headers"&&a.jsx("div",{className:"px-4 pt-1 pb-3",children:e.rawHeaders&&Object.keys(e.rawHeaders).length>0?a.jsx("div",{className:"space-y-1 font-mono text-xs",children:Object.entries(e.rawHeaders).sort(([te],[ee])=>te.localeCompare(ee)).map(([te,ee])=>a.jsxs("div",{className:"flex gap-2",children:[a.jsxs("span",{className:"text-blue-600 dark:text-blue-400 font-semibold shrink-0",children:[te,":"]}),a.jsx("span",{className:"text-muted-foreground truncate",title:ee,children:ee})]},te))}):a.jsx("p",{className:"text-xs text-muted-foreground italic",children:"No raw headers captured"})})}),a.jsx(ht,{value:"raw",children:f==="raw"&&a.jsxs("div",{className:"px-4 pt-1 pb-3 space-y-3",children:[e.error!==void 0&&e.error!==null&&a.jsxs("div",{className:"rounded border border-destructive/50 bg-destructive/10 p-3 text-xs",children:[a.jsx("div",{className:"font-semibold text-destructive mb-1",children:"SSE Error"}),a.jsx("div",{className:"text-muted-foreground font-mono",children:e.error})]}),e.responseText!==null?a.jsx(v.Suspense,{fallback:a.jsx(Yt,{}),children:a.jsx(Tw,{text:e.responseText,defaultExpandDepth:0,bulkDepth:G.bulkDepth,bulkRevision:G.bulkRevision})}):a.jsx("p",{className:"text-xs text-muted-foreground italic",children:"No response"}),e.streaming===!0&&a.jsx(v.Suspense,{fallback:a.jsx(Yt,{}),children:a.jsx(Nw,{logId:e.id,truncated:e.streamingChunksPath!==null})})]})}),a.jsx(ht,{value:"parsed",children:f==="parsed"&&a.jsx("div",{className:"px-4 pt-1 pb-3",children:a.jsx(v.Suspense,{fallback:a.jsx(Yt,{}),children:a.jsx(Ew,{responseText:e.responseText,responseStatus:e.responseStatus,streaming:e.streaming,inputTokens:e.inputTokens,outputTokens:e.outputTokens,cacheCreationInputTokens:e.cacheCreationInputTokens,cacheReadInputTokens:e.cacheReadInputTokens,apiFormat:C,error:e.error})})})})]})})]}),a.jsx(v.Suspense,{fallback:null,children:a.jsx(Sw,{log:e,open:u,onOpenChange:d})})]})});function q_({stopReason:e,isPending:t,isFirst:n,isTurnStart:r,isOnlyEntry:o=!1,crabIndex:s=0,collapsible:i=!1,onToggle:l}){const c=e==="end_turn"||e==="stop",u=o&&r&&c,d=t&&!c,p=v.useMemo(()=>Er(s),[s]),m=v.useMemo(()=>ew(s),[s]),h=i&&l?{role:"button",tabIndex:0,className:"cursor-pointer",onClick:g=>{g.stopPropagation(),l()},onKeyDown:g=>{(g.key==="Enter"||g.key===" ")&&(g.preventDefault(),l())}}:{};return a.jsxs("div",{className:"flex flex-col items-center w-6 shrink-0 pt-0.5 pb-0.5",children:[a.jsx("div",{className:"flex justify-center h-[calc(0.75rem-8px)]",children:!n&&a.jsx("div",{className:"w-0.5 bg-muted-foreground/30 h-full"})}),u?a.jsx("span",{title:"Start and end of turn",children:a.jsx(m,{className:ve("size-3.5 text-[#80FF00]","animate-crab-settle","drop-shadow-[0_0_4px_rgba(128,255,0,0.5)]")})}):c?a.jsx("span",{title:e==="end_turn"?"End of Turn (Anthropic)":"End of Turn (OpenAI)",...h,children:a.jsx(p,{className:ve("size-3.5 text-amber-400","animate-crab-settle","drop-shadow-[0_0_4px_rgba(251,191,36,0.5)]")})}):r?a.jsx("span",{title:"Start of turn",...h,children:a.jsx(p,{className:ve("size-3.5 text-emerald-400","animate-crab-appear","drop-shadow-[0_0_4px_rgba(52,211,153,0.5)]")})}):d?a.jsx("span",{title:"Processing…",children:a.jsx(p,{className:ve("size-3.5 text-amber-300/80","animate-crab-crawl")})}):a.jsx("span",{children:a.jsx(p,{className:"size-3.5 text-muted-foreground/40"})}),a.jsx("div",{className:"flex-1 flex justify-center min-h-0",children:!c&&a.jsx("div",{className:ve("w-0.5 h-full",t?"border-dashed bg-transparent border-l-2 border-muted-foreground/20":"bg-muted-foreground/30")})})]})}function J_({events:e}){return e.length===0?null:a.jsx("div",{className:"mx-3 mb-2 grid gap-1.5",children:e.map(t=>a.jsxs("div",{className:"flex min-w-0 items-center gap-2 rounded-md border border-border/70 bg-muted/20 px-2.5 py-1.5 text-xs",children:[a.jsx(ds,{className:"size-3.5 shrink-0 text-sky-400/70"}),a.jsx("span",{className:"font-mono font-semibold text-foreground/80",children:t.name}),t.argumentsPreview!==null&&a.jsxs(a.Fragment,{children:[a.jsx(Un,{className:"size-3 shrink-0 text-muted-foreground/60"}),a.jsx("span",{className:"min-w-0 truncate font-mono text-muted-foreground",children:t.argumentsPreview})]})]},t.id))})}const ra=180;function K_(e,t){return e||t}function G_(e,t,n){return e>1&&t&&!n}function Y_(e){const t=[];let n=[],r=0;for(const o of e){n.push({log:o,stopReason:B2(o)});const s=n[n.length-1];s!==void 0&&Ou(s.stopReason)&&(t.push({entries:n,turnIndex:r}),n=[],r+=1)}return n.length>0&&t.push({entries:n,turnIndex:r}),t}function X_(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=Tr(o),l=Tr(s);i==="unknown"||i!==l||t.set(o.id,s)}return t}function Ju(e){if(e===null)return null;try{const t=JSON.parse(e);return typeof t=="string"?JSON.parse(t):t}catch{return null}}function Ku(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>ra?`${n.slice(0,ra-1)}...`:n}function Q_(e){const t=Ju(e.responseText),n=Ye(t,"content");if(!Array.isArray(n))return[];const r=[];for(const o of n){if(Ye(o,"type")!=="tool_use")continue;const i=Ye(o,"name");typeof i!="string"||i.length===0||r.push({id:`${String(e.id)}-anthropic-tool-${String(r.length)}`,logId:e.id,index:r.length,provider:"anthropic",name:i,argumentsPreview:Ku(Ye(o,"input"))})}return r}function ek(e){const t=Ju(e.responseText),n=Ye(t,"choices");if(!Array.isArray(n))return[];const r=[];for(const o of n){const s=Ye(o,"message"),i=Ye(s,"tool_calls");if(Array.isArray(i))for(const l of i){const c=Ye(l,"function"),u=Ye(c,"name");typeof u!="string"||u.length===0||r.push({id:`${String(e.id)}-openai-tool-${String(r.length)}`,logId:e.id,index:r.length,provider:"openai",name:u,argumentsPreview:Ku(Ye(c,"arguments"))})}}return r}function Gu(e){switch(Tr(e)){case"anthropic":return Q_(e);case"openai":return ek(e);case"unknown":return[]}}function tk(e,t,n=0){let r=0,o=0,s=0,i=0,l=0,c=0,u=0,d=0,p=null,m=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&&(l+=h.outputTokens),h.cacheCreationInputTokens!==null&&(c+=h.cacheCreationInputTokens),h.cacheReadInputTokens!==null&&(u+=h.cacheReadInputTokens),h.elapsedMs!==null&&(d+=h.elapsedMs,p=p===null?h.elapsedMs:Math.max(p,h.elapsedMs)),m+=Gu(h).length;return{llmCallCount:e.length,toolCallCount:m,failedCallCount:r,pendingCallCount:o,slowCallCount:s,totalInputTokens:i,totalOutputTokens:l,totalCacheCreationInputTokens:c,totalCacheReadInputTokens:u,totalElapsedMs:d,maxElapsedMs:p,startedAt:e[0]?.timestamp??null,endedAt:e[e.length-1]?.timestamp??null,knowledgeCandidateCount:n}}function bo(e){return e<1e3?`${e}ms`:`${(e/1e3).toFixed(1)}s`}const nk=v.memo(function({entries:t,viewMode:n,strip:r,slowResponseThresholdSeconds:o,cacheTrends:s,onCompareWithPrevious:i,comparisonPredecessors:l,turnIndex:c=0,timeDisplayFormat:u}){const d=t.length-1,p=t[d]?.stopReason??null,m=p!==null?Ou(p):!1,h=t[d]?.log.responseStatus===null,g=t.length===1,f=G_(t.length,m,h),[x,y]=v.useState(!1),_=v.useRef(!1);v.useEffect(()=>{f?m&&!_.current&&y(!0):y(!1),_.current=m},[f,m]);const k=v.useCallback(()=>{f&&y(b=>!b)},[f]),C=v.useMemo(()=>{let b=0,M=0,V=null,P=!1;for(const F of t)F.log.inputTokens!==null&&(b+=F.log.inputTokens,P=!0),F.log.outputTokens!==null&&(M+=F.log.outputTokens,P=!0),F.log.elapsedMs!==null&&(V=V===null?F.log.elapsedMs:Math.max(V,F.log.elapsedMs));return{totalInput:b,totalOutput:M,hasTokens:P,maxElapsed:V}},[t,d]),S=v.useMemo(()=>{const b=new Set;for(const M of t){const V=Pu(M.log.model);V!=="unknown"&&b.add(V)}return[...b]},[t]),z=v.useMemo(()=>Er(t[0]?.log.id??0),[t]),N=v.useMemo(()=>Er(t[d]?.log.id??0),[t,d]),A=c%2===0?"bg-muted/10":"bg-muted/25",O=C.maxElapsed!==null&&o>0&&C.maxElapsed>o*1e3,R=v.useMemo(()=>{const b=new Map;for(const M of t){const V=Gu(M.log);V.length>0&&b.set(M.log.id,V)}return b},[t]),[G,j]=v.useState(0),I=v.useRef(null);return v.useEffect(()=>{const b=I.current;if(!b)return;let M=0;const V=new ResizeObserver(()=>{window.cancelAnimationFrame(M),M=window.requestAnimationFrame(()=>j(P=>P+1))});return V.observe(b),()=>{V.disconnect(),window.cancelAnimationFrame(M)}},[]),a.jsx("div",{ref:I,className:ve("border rounded-lg",h?"border-amber-500/10":"border-transparent"),children:x?a.jsxs("div",{"data-nav-id":`turn-collapsed-${t[0]?.log.id??c}`,"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:b=>{(b.key==="Enter"||b.key===" ")&&(b.preventDefault(),k())},children:[a.jsx("div",{className:"w-5 shrink-0 flex items-start pt-1.5",children:a.jsx("span",{className:"text-[10px] text-muted-foreground/50 font-mono tabular-nums leading-none select-none",children:c+1})}),a.jsxs("div",{className:"w-6 shrink-0 flex flex-col items-center pt-0.5 pb-0.5",children:[a.jsx("div",{className:"flex justify-center h-[calc(0.75rem-8px)]"}),a.jsx("span",{role:"button",tabIndex:0,title:"Start of turn — click to expand",className:"cursor-pointer",onClick:b=>{b.stopPropagation(),k()},onKeyDown:b=>{(b.key==="Enter"||b.key===" ")&&(b.preventDefault(),k())},children:a.jsx(z,{className:ve("size-3.5 text-emerald-400","animate-crab-appear drop-shadow-[0_0_4px_rgba(52,211,153,0.5)]")})}),a.jsx("div",{className:"flex-1 flex justify-center min-h-0",children:a.jsx("div",{className:"w-0.5 bg-muted-foreground/30 h-full"})}),a.jsx("span",{role:"button",tabIndex:0,title:"End of Turn — click to expand",className:"cursor-pointer",onClick:b=>{b.stopPropagation(),k()},onKeyDown:b=>{(b.key==="Enter"||b.key===" ")&&(b.preventDefault(),k())},children:a.jsx(N,{className:ve("size-3.5 text-amber-400","animate-crab-settle drop-shadow-[0_0_4px_rgba(251,191,36,0.5)]")})})]}),t.length>1&&a.jsxs("div",{className:ve("flex-1 min-w-0 mb-0.5 rounded-lg border border-border py-1 px-3 flex items-center gap-3 text-xs",A),children:[a.jsxs("span",{className:"text-blue-400/80 font-mono font-semibold tabular-nums shrink-0",children:["#",t[0]?.log.id??"?"," ~ #",t[d]?.log.id??"?"]}),a.jsxs("span",{className:"text-muted-foreground shrink-0",children:[t.length," request",t.length>1?"s":""]}),S.length>0&&a.jsx("span",{className:"flex items-center gap-0.5 shrink-0",children:S.map(b=>a.jsx(Mu,{provider:b,className:"size-4"},b))}),C.maxElapsed!==null&&a.jsx($e,{children:a.jsxs(je,{children:[a.jsx(Ee,{asChild:!0,children:a.jsxs("span",{className:ve("flex items-center gap-1 shrink-0",O?"text-amber-400":"text-muted-foreground"),children:[a.jsx(Rt,{className:"size-3"}),a.jsx("span",{className:"font-mono tabular-nums",children:bo(C.maxElapsed)}),O&&a.jsx(yr,{className:"size-3","aria-label":"Slow response"})]})}),a.jsx(Ne,{children:O?`Slow response: ${bo(C.maxElapsed)} exceeds ${bo(o*1e3)}`:"Slowest request in this turn"})]})}),C.hasTokens&&a.jsxs("span",{className:"flex items-center gap-1 shrink-0",children:[a.jsx(Mn,{className:"size-3 text-muted-foreground"}),a.jsxs("span",{className:"font-mono tabular-nums",children:[a.jsxs("span",{className:"text-blue-400",children:["IN ",Be(C.totalInput)]})," / ",a.jsxs("span",{className:"text-amber-400",children:["OUT ",Be(C.totalOutput)]})]})]}),a.jsx("span",{className:"flex-1 min-w-0"}),a.jsx(Un,{className:"size-4 text-muted-foreground shrink-0"})]})]}):t.map((b,M)=>{const{log:V,stopReason:P}=b,F=M===0;return a.jsxs("div",{className:"flex items-stretch",children:[F?a.jsx("div",{className:"w-5 shrink-0 flex items-start pt-1.5",children:a.jsx("span",{className:"text-[10px] text-muted-foreground/50 font-mono tabular-nums leading-none select-none",children:c+1})}):a.jsx("div",{className:"w-5 shrink-0"}),a.jsx(q_,{stopReason:P,isPending:V.responseStatus===null,isFirst:M===0,isTurnStart:F,isOnlyEntry:g,crabIndex:V.id%12,collapsible:f&&F,onToggle:k}),a.jsxs("div",{className:ve("flex-1 min-w-0 mb-0.5 rounded-lg",A),children:[a.jsx(H_,{log:V,viewMode:n,strip:r,slowResponseThresholdSeconds:o,timeDisplayFormat:u,cacheTrend:s?.get(V.id)??null,onCompareWithPrevious:l.has(V.id)?i:void 0}),a.jsx(J_,{events:R.get(V.id)??[]})]})]},V.id)})})}),Fs=Ze(["episode","procedure","preference","project-fact"]),rk=Ze(["draft","promoted","failed"]),Yu=ne({source:xe("agent-inspector"),sessionId:B(),logIds:_e(he().int().positive()),project:B().nullable(),models:_e(B())}),ok=ne({redacted:Ue(),patterns:_e(B())}),sk=ne({id:B(),type:Fs,title:B(),content:B(),tags:_e(B()),source:xe("agent-inspector"),sessionId:B(),logIds:_e(he().int().positive()),evidence:Yu,status:rk,createdAt:B(),updatedAt:B(),openClawMemoryId:B().nullable(),error:B().nullable(),redaction:ok});ne({idempotencyKey:B(),type:Fs,title:B(),content:B(),tags:_e(B()),source:xe("agent-inspector"),project:B().nullable(),evidence:Yu});const ik=ne({id:B(),type:Fs.or(B()),title:B(),content:B(),score:he().nullable(),source:B().nullable(),project:B().nullable(),evidence:jo().optional()});ne({results:_e(ik),warning:B().nullable()});const ak=ne({candidates:_e(sk)});function oa(e){return e===null?"-":e<1e3?`${String(e)}ms`:`${(e/1e3).toFixed(1)}s`}function lk(e,t,n){return e===null||t===null?null:fs(e,t,n)}function ck(e){return`${String(e)} candidate${e===1?"":"s"}`}function Xu(e){return`log-${String(e)}`}function uk(e){const t=Xu(e),n=document.getElementById(t);window.history.replaceState(null,"",`#${t}`),n instanceof HTMLElement&&(n.scrollIntoView({block:"center",behavior:"smooth"}),n.focus({preventScroll:!0}))}function dk({candidates:e}){return e.length===0?null:a.jsx("div",{className:"mt-2 grid gap-1.5",children:e.map(t=>a.jsxs("div",{className:"rounded-md border border-border/80 bg-background/60 px-2.5 py-2",children:[a.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[a.jsx(Yr,{variant:"outline",className:"h-5 px-1.5 text-[10px] font-mono",children:t.type}),a.jsx("span",{className:"min-w-0 flex-1 truncate text-xs font-medium",title:t.title,children:t.title}),a.jsx("span",{className:"shrink-0 font-mono text-[10px] text-muted-foreground",children:t.status})]}),a.jsx("div",{className:"mt-1 flex flex-wrap items-center gap-1.5",children:t.logIds.map(n=>a.jsxs("a",{href:`#${Xu(n)}`,onClick:r=>{r.preventDefault(),uk(n)},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(n)}`,children:["#",n]},n))})]},t.id))})}function fk({logs:e,scopeId:t,slowResponseThresholdSeconds:n,showRollupMetrics:r,timeDisplayFormat:o}){const[s,i]=v.useState([]),[l,c]=v.useState(!0),[u,d]=v.useState({status:"idle",error:null}),p=s.length>0,m=v.useMemo(()=>tk(e,n,s.length),[s.length,e,n]),h=r||m.maxElapsedMs!==null,g=v.useMemo(()=>lk(m.startedAt,m.endedAt,o),[m.endedAt,m.startedAt,o]),f=v.useCallback(()=>{e.length===0||u.status==="loading"||(d({status:"loading",error:null}),(async()=>{try{const x=await fetch(`/api/knowledge/sessions/${encodeURIComponent(t)}/candidates`,{method:"POST"});if(!x.ok){const _=await zn(x,`Candidate generation failed with ${String(x.status)}`);d({status:"failed",error:_});return}const y=await Ot(x,ak);i(y.candidates),c(y.candidates.length>0),d({status:"ready",error:null})}catch(x){d({status:"failed",error:x instanceof Error?x.message:"Candidate response was invalid"})}})())},[u.status,e.length,t]);return e.length===0?null:a.jsxs("section",{className:"mb-2 rounded-lg border border-border bg-muted/10 px-3 py-2",children:[a.jsxs("div",{className:"flex flex-wrap items-center gap-x-3 gap-y-2 text-xs",children:[r&&a.jsxs("span",{className:"inline-flex items-center gap-1.5 font-semibold text-foreground",children:[a.jsx(us,{className:"size-3.5 text-blue-400"}),m.llmCallCount," LLM"]}),a.jsxs("span",{className:"inline-flex items-center gap-1.5 text-muted-foreground",children:[a.jsx(ds,{className:"size-3.5 text-sky-400/70"}),m.toolCallCount," tools"]}),r&&a.jsxs("span",{className:"inline-flex items-center gap-1.5 text-muted-foreground",children:[a.jsx(Mn,{className:"size-3.5 text-emerald-400"}),a.jsxs("span",{className:"font-mono",children:[Be(m.totalInputTokens)," / ",Be(m.totalOutputTokens)]})]}),(m.totalCacheCreationInputTokens>0||m.totalCacheReadInputTokens>0)&&a.jsxs("span",{className:"inline-flex items-center gap-1.5 text-muted-foreground",children:[a.jsx(Mn,{className:"size-3.5 text-purple-400"}),a.jsxs("span",{className:"font-mono",children:["+",Be(m.totalCacheCreationInputTokens)," / ~",Be(m.totalCacheReadInputTokens)]})]}),h&&a.jsxs("span",{className:"inline-flex items-center gap-1.5 text-muted-foreground",children:[a.jsx(Rt,{className:"size-3.5"}),r&&a.jsx("span",{className:"font-mono",children:oa(m.totalElapsedMs)}),m.maxElapsedMs!==null&&a.jsxs("span",{className:"font-mono text-muted-foreground/70",children:["max ",oa(m.maxElapsedMs)]})]}),r&&g!==null&&a.jsx("span",{className:"font-mono text-muted-foreground/70",children:g}),(m.failedCallCount>0||m.pendingCallCount>0||m.slowCallCount>0)&&a.jsxs("span",{className:"inline-flex items-center gap-1.5 text-amber-400",children:[a.jsx(yr,{className:"size-3.5"}),a.jsxs("span",{className:"font-mono",children:[m.failedCallCount," fail / ",m.pendingCallCount," pending /"," ",m.slowCallCount," slow"]})]}),a.jsx("span",{className:"flex-1"}),p&&a.jsx(Yr,{variant:"outline",className:"h-6 px-2 text-[10px] font-mono",children:ck(m.knowledgeCandidateCount)}),a.jsxs(Pe,{type:"button",variant:"outline",size:"sm",className:"h-7 gap-1.5 px-2 text-xs",onClick:f,disabled:u.status==="loading",children:[u.status==="loading"?a.jsx(Pn,{className:"size-3.5 animate-spin"}):a.jsx($g,{className:"size-3.5"}),"Candidate"]}),p&&a.jsx(Pe,{type:"button",variant:"ghost",size:"icon",className:"size-7 text-muted-foreground",onClick:()=>c(x=>!x),"aria-expanded":l,"aria-label":l?"Collapse memory candidates":"Expand memory candidates",children:l?a.jsx(hn,{className:"size-3.5"}):a.jsx(Un,{className:"size-3.5"})})]}),u.status==="failed"&&a.jsx("p",{className:"mt-2 text-xs text-destructive",children:u.error}),l&&a.jsx(dk,{candidates:s})]})}function hk(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 pk=v.memo(function({group:e,viewMode:t="simple",strip:n,slowResponseThresholdSeconds:r,cacheTrends:o,onCompareWithPrevious:s,comparisonPredecessors:i,onClearGroup:l,standalone:c=!1,hasPinnedSessionContext:u=!1,timeDisplayFormat:d}){const[p,m]=v.useState(!1),h=v.useMemo(()=>hk(e.logs),[e.logs]),g=e.logs[0]?.timestamp??new Date().toISOString(),f=e.logs[e.logs.length-1]?.timestamp??new Date().toISOString(),x=L2(e.logs),y=e.logs.some(C=>C.responseStatus===null),_=c&&!u,k=v.useMemo(()=>Y_(e.logs),[e.logs]);return a.jsxs("div",{className:"mb-2",children:[!c&&a.jsx(M2,{conversationId:e.conversationId,startTime:g,endTime:f,totalCalls:e.logs.length,totalInputTokens:h.totalInputTokens,totalOutputTokens:h.totalOutputTokens,apiFormat:D2(e.logs),expanded:p,onToggle:()=>m(!p),hideApiFormat:x,isLoading:y,userAgent:e.logs[0]?.userAgent??null,timeDisplayFormat:d,onClear:()=>l(e.logs.map(C=>C.id))}),K_(c,p)&&a.jsxs("div",{children:[a.jsx(fk,{logs:e.logs,scopeId:e.conversationId,slowResponseThresholdSeconds:r,showRollupMetrics:_,timeDisplayFormat:d}),k.map(C=>a.jsx(nk,{entries:C.entries,viewMode:t,strip:n,slowResponseThresholdSeconds:r,timeDisplayFormat:d,cacheTrends:o,onCompareWithPrevious:s,comparisonPredecessors:i,turnIndex:C.turnIndex},C.turnIndex))]})]})});function mk({className:e}){return a.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",className:ve("inline-block size-5",e),children:[a.jsx("path",{d:"M5 13 C5 9 8 7 12 7 C16 7 19 9 19 13 C19 16 16 18 12 18 C8 18 5 16 5 13 Z"}),a.jsx("path",{d:"M5 11 C3.5 9.5 1.5 10 2 12.5 C2.5 14 4 13.5 5 12.5"}),a.jsx("path",{d:"M19 11 C20.5 9.5 22.5 10 22 12.5 C21.5 14 20 13.5 19 12.5"}),a.jsx("line",{x1:"10",y1:"7",x2:"9.5",y2:"5"}),a.jsx("line",{x1:"14",y1:"7",x2:"14.5",y2:"5"}),a.jsx("circle",{cx:"9.5",cy:"4.5",r:"0.9",fill:"currentColor",stroke:"none"}),a.jsx("circle",{cx:"14.5",cy:"4.5",r:"0.9",fill:"currentColor",stroke:"none"}),a.jsx("line",{x1:"6.5",y1:"16",x2:"4.5",y2:"19.5"}),a.jsx("line",{x1:"9",y1:"17.5",x2:"8",y2:"20.5"}),a.jsx("line",{x1:"15",y1:"17.5",x2:"16",y2:"20.5"}),a.jsx("line",{x1:"17.5",y1:"16",x2:"19.5",y2:"19.5"}),a.jsxs("g",{children:[a.jsx("path",{d:"M5.6 17.7 L8.4 15.4 L10.8 18 C9.1 18.9 7.2 18.8 5.6 17.7 Z",fill:"#2f6b3f",stroke:"none",opacity:"0.95"}),a.jsx("path",{d:"M6.9 17.5 L8.4 16 L9.8 17.7 C8.9 18.1 7.8 18.1 6.9 17.5 Z",fill:"#6fb36f",stroke:"none",opacity:"0.95"}),a.jsx("path",{d:"M8.4 16 L8.4 18.4",stroke:"#d6b45f",strokeWidth:"0.34"}),a.jsx("circle",{cx:"10.6",cy:"17.75",r:"0.36",fill:"#c2412d",stroke:"none"})]}),a.jsxs("g",{children:[a.jsx("path",{d:"M8 16.5 L11.9 13.6 L15.8 16.8 C13.3 18.4 10.4 18.3 8 16.5 Z",fill:"#2f6b3f",stroke:"none",opacity:"0.97"}),a.jsx("path",{d:"M9.8 16.3 L11.9 14.4 L14.3 16.5 C12.8 17.4 11.3 17.4 9.8 16.3 Z",fill:"#6fb36f",stroke:"none",opacity:"0.95"}),a.jsx("path",{d:"M11.9 14.3 L11.9 17.8",stroke:"#d6b45f",strokeWidth:"0.42"}),a.jsx("path",{d:"M9.8 16.3 C11.2 15.8 12.9 15.9 14.3 16.5",stroke:"#9fca78",strokeWidth:"0.36"}),a.jsx("circle",{cx:"15.6",cy:"16.75",r:"0.43",fill:"#c2412d",stroke:"none"})]}),a.jsxs("g",{children:[a.jsx("path",{d:"M13.6 18.1 L16.2 15.7 L18.5 18.2 C17.1 19.1 15.2 19 13.6 18.1 Z",fill:"#2f6b3f",stroke:"none",opacity:"0.95"}),a.jsx("path",{d:"M14.8 17.9 L16.2 16.3 L17.5 18 C16.6 18.4 15.7 18.4 14.8 17.9 Z",fill:"#6fb36f",stroke:"none",opacity:"0.95"}),a.jsx("path",{d:"M16.2 16.3 L16.2 18.6",stroke:"#d6b45f",strokeWidth:"0.34"}),a.jsx("circle",{cx:"18.35",cy:"18.15",r:"0.36",fill:"#c2412d",stroke:"none"})]})]})}const gk="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 xk({className:e}){return a.jsx("img",{src:gk,alt:"Model Context Protocol","aria-hidden":"true",className:ve("inline-block size-8 object-contain invert",e)})}function sa({...e}){return a.jsx(Vb,{"data-slot":"select",...e})}function ia({...e}){return a.jsx(qb,{"data-slot":"select-value",...e})}function aa({className:e,size:t="default",children:n,...r}){return a.jsxs(Hb,{"data-slot":"select-trigger","data-size":t,className:ve("border-input data-[placeholder]:text-muted-foreground [&_svg:not([class*='text-'])]:text-muted-foreground focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:bg-input/30 dark:hover:bg-input/50 flex w-fit items-center justify-between gap-2 rounded-md border bg-transparent px-3 py-2 text-sm whitespace-nowrap shadow-xs transition-[color,box-shadow] outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50 data-[size=default]:h-9 data-[size=sm]:h-8 *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-2 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",e),...r,children:[n,a.jsx(Jb,{asChild:!0,children:a.jsx(hn,{className:"size-4 opacity-50"})})]})}function la({className:e,children:t,position:n="popper",align:r="center",...o}){return a.jsx(Kb,{children:a.jsxs(Gb,{"data-slot":"select-content",className:ve("bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 relative z-50 max-h-(--radix-select-content-available-height) min-w-[8rem] origin-(--radix-select-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border shadow-md",n==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",e),position:n,align:r,...o,children:[a.jsx(vk,{}),a.jsx(Yb,{className:ve("p-1",n==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)] scroll-my-1"),children:t}),a.jsx(yk,{})]})})}function lr({className:e,children:t,...n}){return a.jsxs(Xb,{"data-slot":"select-item",className:ve("focus:bg-accent focus:text-accent-foreground [&_svg:not([class*='text-'])]:text-muted-foreground relative flex w-full cursor-default items-center gap-2 rounded-sm py-1.5 pr-8 pl-2 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2",e),...n,children:[a.jsx("span",{className:"absolute right-2 flex size-3.5 items-center justify-center",children:a.jsx(e2,{children:a.jsx(Ut,{className:"size-4"})})}),a.jsx(Qb,{children:t})]})}function vk({className:e,...t}){return a.jsx(t2,{"data-slot":"select-scroll-up-button",className:ve("flex cursor-default items-center justify-center py-1",e),...t,children:a.jsx(Vg,{className:"size-4"})})}function yk({className:e,...t}){return a.jsx(n2,{"data-slot":"select-scroll-down-button",className:ve("flex cursor-default items-center justify-center py-1",e),...t,children:a.jsx(hn,{className:"size-4"})})}function bk(){return a.jsxs("svg",{fill:"currentColor",fillRule:"evenodd",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",className:"size-6 shrink-0",children:[a.jsx("title",{children:"Claude Code"}),a.jsx("path",{clipRule:"evenodd",d:"M20.998 10.949H24v3.102h-3v3.028h-1.487V20H18v-2.921h-1.487V20H15v-2.921H9V20H7.488v-2.921H6V20H4.487v-2.921H3V14.05H0V10.95h3V5h17.998v5.949zM6 10.949h1.488V8.102H6v2.847zm10.51 0H18V8.102h-1.49v2.847z"})]})}function wk(){return a.jsxs("svg",{fill:"currentColor",fillRule:"evenodd",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",className:"size-6 shrink-0",children:[a.jsx("title",{children:"OpenCode"}),a.jsx("path",{d:"M16 6H8v12h8V6zm4 16H4V2h16v20z"})]})}function _k(){return a.jsxs("svg",{fill:"currentColor",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",className:"size-6 shrink-0",children:[a.jsx("title",{children:"MiMo Code"}),a.jsx("text",{x:"12",y:"18",textAnchor:"middle",fontSize:"16",fontWeight:"800",fontFamily:"system-ui, sans-serif",children:"M"})]})}const kk=ne({name:B(),apiKey:B(),format:Ze(["anthropic","openai"]),anthropicBaseUrl:B(),openaiBaseUrl:B(),models:_e(B()),sourceTool:Ze(["claude-code","opencode","mimo-code"]),alreadyExists:Ue()}),Ck=ne({providers:_e(kk),warnings:_e(B()).optional()}),Sk=ne({success:Ue().optional(),imported:he().optional(),message:B().optional(),errors:_e(B()).optional()}),jk={"claude-code":bk,opencode:wk,"mimo-code":_k};function Ek({open:e,onOpenChange:t,onImportComplete:n}){const[r,o]=v.useState(!1),[s,i]=v.useState(null),[l,c]=v.useState([]),[u,d]=v.useState([]),[p,m]=v.useState(new Set),[h,g]=v.useState(!1),[f,x]=v.useState(null),[y,_]=v.useState(null),k=v.useCallback(()=>{o(!0),i(null),d([]),c([]),m(new Set),x(null),_(null),fetch("/api/providers/scan").then(N=>N.ok?N.json().then(A=>{const O=Ck.safeParse(A);if(!O.success){i(`Invalid response: ${O.error.message}`);return}c(O.data.providers),d(O.data.warnings??[]);const R=new Set;O.data.providers.forEach((G,j)=>{G.alreadyExists||R.add(j)}),m(R)}):N.text().then(A=>{i(`Scan failed (${N.status}): ${A}`)})).catch(N=>{i(N instanceof Error?N.message:String(N))}).finally(()=>{o(!1)})},[]);v.useEffect(()=>{e&&k()},[e,k]);const C=v.useCallback(N=>{m(A=>{const O=new Set(A);return O.has(N)?O.delete(N):O.add(N),O})},[]),S=v.useCallback(()=>{const N=l.filter((R,G)=>p.has(G));if(N.length===0)return;g(!0),_(null),x(null);const A=new Date().toISOString(),O=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:A,updatedAt:A}));fetch("/api/providers/import",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({providers:O})}).then(R=>R.json()).then(R=>{const G=Sk.safeParse(R);if(!G.success){_(`Invalid response: ${G.error.message}`);return}const j=G.data;c(I=>I.map((b,M)=>p.has(M)?{...b,alreadyExists:!0}:b)),m(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=>{_(R instanceof Error?R.message:String(R))}).finally(()=>{g(!1)})},[l,p,n]),z=l.some(N=>!N.alreadyExists);return a.jsx(Is,{open:e,onOpenChange:t,children:a.jsxs(Rs,{className:"max-w-xl max-h-[80vh] overflow-hidden flex flex-col",children:[a.jsxs(Ps,{children:[a.jsx(Ms,{children:"Import from External Tools"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"Detect provider configurations from Claude Code, OpenCode, and MiMo Code."})]}),a.jsxs("div",{className:"flex-1 overflow-y-auto space-y-3",children:[r&&a.jsxs("div",{className:"flex items-center justify-center py-8 gap-2 text-muted-foreground",children:[a.jsx(Pn,{className:"size-4 animate-spin"}),a.jsx("span",{className:"text-sm",children:"Scanning for external providers..."})]}),s!==null&&a.jsxs("div",{className:"flex items-center gap-2 text-destructive text-sm py-4",children:[a.jsx(Rn,{className:"size-4"}),s]}),!r&&s===null&&l.length===0&&a.jsxs("p",{className:"text-sm text-muted-foreground py-8 text-center",children:["No external provider configurations found.",a.jsx("br",{}),a.jsx("span",{className:"text-xs",children:"Supported tools: Claude Code (~/.claude/settings.json), OpenCode (~/.config/opencode/opencode.json), MiMo Code (~/.config/mimocode/mimocode.jsonc)"})]}),!r&&l.map((N,A)=>a.jsxs("label",{className:`flex items-start gap-3 p-3 border rounded-md ${N.alreadyExists?"":"cursor-pointer hover:bg-muted/50"}`,children:[!N.alreadyExists&&a.jsx("input",{type:"checkbox",checked:p.has(A),disabled:h,onChange:()=>C(A),className:"mt-0.5 size-4"}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[(()=>{const O=jk[N.sourceTool];return O===void 0?null:a.jsx(O,{})})(),N.alreadyExists&&a.jsx("span",{className:"text-[10px] text-muted-foreground",children:"Already added"})]}),a.jsxs("div",{className:"text-xs text-muted-foreground mt-1 truncate",children:[N.models.slice(0,4).join(", "),N.models.length>4?` +${N.models.length-4} more`:""]}),a.jsx("div",{className:"text-xs text-muted-foreground mt-0.5 truncate",children:N.format==="anthropic"?N.anthropicBaseUrl:N.openaiBaseUrl}),a.jsx("div",{className:"text-xs text-muted-foreground mt-0.5 font-mono",children:N.apiKey.length>8?`${N.apiKey.slice(0,4)}••••${N.apiKey.slice(-4)}`:"••••"})]})]},`${N.sourceTool}-${N.name}`)),u.length>0&&a.jsx("div",{className:"text-xs text-muted-foreground space-y-1 border-t pt-2",children:u.map((N,A)=>a.jsxs("div",{className:"flex items-center gap-1",children:[a.jsx(Rn,{className:"size-3"}),N]},A))}),f!==null&&a.jsx("div",{className:"text-sm text-green-500 border-t pt-2",children:f}),y!==null&&a.jsx("div",{className:"text-sm text-destructive border-t pt-2",children:y})]}),a.jsxs("div",{className:"flex items-center justify-between pt-3 border-t",children:[a.jsxs(Pe,{variant:"outline",size:"sm",onClick:k,disabled:r,children:[a.jsx(Pn,{className:`size-3 mr-1 ${r?"animate-spin":""}`}),"Rescan"]}),a.jsxs(Pe,{size:"sm",onClick:S,disabled:!z||p.size===0||h,children:[a.jsx(as,{className:"size-3 mr-1"}),h?"Importing...":`Import Selected (${p.size})`]})]})]})})}function Qu(e){return e.length<=8?"••••••••":e.slice(0,4)+"••••••••"+e.slice(-4)}const Nk={deepseek:"https://api-docs.deepseek.com/zh-cn/"};function Tk(e){return Object.prototype.hasOwnProperty.call(e,"success")}function Ak(e){return Object.prototype.hasOwnProperty.call(e,"notConfigured")}function zk(e){const t={className:"size-3",strokeWidth:2};switch(e){case"timeout":return a.jsx(Rt,{...t});case"network_unreachable":return a.jsx(X0,{...t});case"connection_refused":return a.jsx(ex,{...t});case"auth_failed":return a.jsx(k0,{...t});case"rate_limited":return a.jsx(p0,{...t});case"server_error":return a.jsx(U0,{...t});case"invalid_response":return a.jsx(e0,{...t});case"unknown":return a.jsx(Rn,{...t});default:return a.jsx(Rn,{...t})}}function cr({result:e}){const[t,n]=v.useState(!1);if(!Tk(e))return Ak(e)?a.jsxs("div",{className:"flex items-center gap-1 text-xs text-muted-foreground shrink-0",children:[a.jsx(j0,{className:"size-3"}),a.jsx("span",{children:"Not configured"})]}):a.jsxs("div",{className:"flex items-center gap-1 text-xs text-muted-foreground shrink-0",children:[a.jsx(hl,{className:"size-3 animate-spin"}),a.jsx("span",{children:"Testing..."})]});if(e.success){const c=[];e.inputTokens!==void 0&&c.push(a.jsxs("span",{children:[e.inputTokens," in"]},"in")),e.outputTokens!==void 0&&c.push(a.jsxs("span",{children:[e.outputTokens," out"]},"out")),e.cacheCreationInputTokens!==void 0&&e.cacheCreationInputTokens>0&&c.push(a.jsx($e,{children:a.jsxs(je,{children:[a.jsx(Ee,{asChild:!0,children:a.jsxs("span",{className:"font-mono tabular-nums text-emerald-400",children:["+",e.cacheCreationInputTokens," cache"]})}),a.jsx(Ne,{children:"Tokens cached for reuse, reducing future API cost"})]})},"cache-create")),e.cacheReadInputTokens!==void 0&&e.cacheReadInputTokens>0&&c.push(a.jsx($e,{children:a.jsxs(je,{children:[a.jsx(Ee,{asChild:!0,children:a.jsxs("span",{className:"font-mono tabular-nums text-purple-400",children:["~",e.cacheReadInputTokens," cached"]})}),a.jsx(Ne,{children:"Tokens served from cache, reducing API cost"})]})},"cache-read"));const u=[];for(let d=0;d<c.length;d++)d>0&&u.push(", "),u.push(c[d]);return a.jsx($e,{children:a.jsxs(je,{children:[a.jsx(Ee,{asChild:!0,children:a.jsxs("div",{className:"flex items-center gap-1 text-xs text-green-600 shrink-0",children:[a.jsx(Xg,{className:"size-3"}),a.jsx("span",{children:"Connected"}),c.length>0&&a.jsxs("span",{className:"text-muted-foreground",children:["(",u,")"]})]})}),a.jsx(Ne,{children:"Connection test passed"})]})})}const r=e.error,o=r?.message??"Connection failed",s=r?.hint,i=r?.details,l=r?.type??"unknown";return a.jsxs("div",{className:"flex flex-col gap-1 shrink-0",children:[a.jsxs("div",{className:"flex items-center gap-1 text-xs text-red-600 max-w-[200px]",children:[zk(l),a.jsx($e,{children:a.jsxs(je,{children:[a.jsx(Ee,{asChild:!0,children:a.jsx("span",{className:"truncate",children:o})}),a.jsx(Ne,{children:"Connection test failed"})]})}),i!==void 0&&a.jsx($e,{children:a.jsxs(je,{children:[a.jsx(Ee,{asChild:!0,children:a.jsx("button",{type:"button",onClick:()=>n(!t),className:"shrink-0 text-muted-foreground hover:text-foreground transition-colors",children:t?a.jsx(ls,{className:"size-3"}):a.jsx(cs,{className:"size-3"})})}),a.jsx(Ne,{children:t?"Hide error details":"Show detailed error information"})]})})]}),t&&i!==void 0&&a.jsxs("div",{className:"text-xs text-muted-foreground bg-muted/50 rounded p-2 max-w-[300px]",children:[s!==void 0&&a.jsx("div",{className:"mb-1",children:s}),a.jsx("div",{className:"font-mono whitespace-pre-wrap break-all text-red-400/80",children:i})]})]})}function Ok(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 Ik({provider:e,testResults:t,isTesting:n,testingTimeLeft:r,isHighlighted:o,onEdit:s,onDelete:i,onTest:l}){const[c,u]=v.useState(!1),[d,p]=v.useState(!1),[m,h]=v.useState(!1);function g(){navigator.clipboard.writeText(e.apiKey).catch(()=>{}),p(!0),setTimeout(()=>p(!1),2e3)}const f=e.apiDocsUrl??Object.entries(Nk).find(([x])=>e.name.toLowerCase().includes(x))?.[1];return a.jsxs("div",{className:`border rounded-lg p-4 flex flex-col gap-3 bg-card transition-all duration-500 ${o===!0?"ring-2 ring-primary shadow-md":""}`,children:[a.jsxs("div",{className:"flex items-start justify-between gap-2",children:[a.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[a.jsx("span",{className:"font-medium truncate",children:e.name}),e.source==="company"&&a.jsx($e,{children:a.jsxs(je,{children:[a.jsx(Ee,{asChild:!0,children:a.jsx("span",{className:"text-xs px-1.5 py-0.5 rounded bg-blue-100 text-blue-700 dark:bg-blue-900/30 dark:text-blue-400 shrink-0",children:"公司"})}),a.jsx(Ne,{children:"Company-provided API key"})]})}),e.source==="personal"&&a.jsx($e,{children:a.jsxs(je,{children:[a.jsx(Ee,{asChild:!0,children:a.jsx("span",{className:"text-xs px-1.5 py-0.5 rounded bg-green-100 text-green-700 dark:bg-green-900/30 dark:text-green-400 shrink-0",children:"个人"})}),a.jsx(Ne,{children:"Your personal API key"})]})})]}),f!==void 0&&a.jsxs("a",{href:f,target:"_blank",rel:"noopener noreferrer",className:"text-muted-foreground hover:text-foreground transition-colors flex items-center gap-1 text-xs",title:"View API documentation",children:[a.jsx(fl,{className:"size-3"}),a.jsx("span",{className:"sr-only",children:"Docs"})]})]}),e.models!==void 0&&e.models.length>0&&a.jsx("div",{className:"flex flex-wrap gap-1",children:e.models.map(x=>a.jsx("span",{className:"text-xs px-1.5 py-0.5 rounded bg-muted text-muted-foreground",children:x},x))}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("code",{className:"text-xs text-muted-foreground bg-muted px-2 py-1 rounded flex-1 truncate",children:c?e.apiKey:Qu(e.apiKey)}),a.jsx("button",{type:"button",onClick:()=>u(x=>!x),className:"text-muted-foreground hover:text-foreground transition-colors p-1","aria-label":c?"Hide API key":"Show API key",children:c?a.jsx(ls,{className:"size-4"}):a.jsx(cs,{className:"size-4"})}),a.jsx("button",{type:"button",onClick:g,className:"text-muted-foreground hover:text-foreground transition-colors p-1","aria-label":"Copy API key",children:d?a.jsx(Ut,{className:"size-4 text-green-500"}):a.jsx(Zn,{className:"size-4"})})]}),e.anthropicBaseUrl!==void 0&&e.anthropicBaseUrl!==""&&a.jsxs("div",{className:"flex items-center justify-between gap-2",children:[a.jsxs("div",{className:"text-xs text-muted-foreground min-w-0 flex-1",children:[a.jsx("span",{className:"font-medium",children:"Anthropic:"})," ",a.jsx("span",{className:"truncate",children:e.anthropicBaseUrl})]}),t&&a.jsx(cr,{result:t.anthropic.nonStreaming})]}),e.openaiBaseUrl!==void 0&&e.openaiBaseUrl!==""&&a.jsxs("div",{className:"flex items-center justify-between gap-2",children:[a.jsxs("div",{className:"text-xs text-muted-foreground min-w-0 flex-1",children:[a.jsx("span",{className:"font-medium",children:"OpenAI:"})," ",a.jsx("span",{className:"truncate",children:e.openaiBaseUrl})]}),t&&a.jsx(cr,{result:t.openai.nonStreaming})]}),t?.testedAt!==void 0&&a.jsxs("div",{className:"text-xs text-muted-foreground flex items-center gap-1",children:[a.jsx(Rt,{className:"size-3"}),a.jsxs("span",{children:["Tested ",Ok(t.testedAt)]})]}),t?.models!==void 0&&Object.keys(t.models).length>0&&a.jsxs("div",{className:"border-t pt-2",children:[a.jsxs("button",{type:"button",onClick:()=>h(x=>!x),className:"text-xs text-muted-foreground hover:text-foreground transition-colors flex items-center gap-1",children:[a.jsx("span",{className:"font-mono",children:m?"▾":"▸"}),"Model Test Results (",Object.keys(t.models).length,")"]}),m&&a.jsx("div",{className:"mt-2 overflow-x-auto",children:a.jsxs("table",{className:"w-full text-xs border-collapse",children:[a.jsx("thead",{children:a.jsxs("tr",{className:"border-b border-border",children:[a.jsx("th",{className:"text-left py-1 px-2 font-medium text-muted-foreground",children:"Model"}),e.anthropicBaseUrl!==void 0&&e.anthropicBaseUrl!==""&&a.jsx("th",{className:"text-left py-1 px-2 font-medium text-muted-foreground",children:"Anthropic"}),e.openaiBaseUrl!==void 0&&e.openaiBaseUrl!==""&&a.jsx("th",{className:"text-left py-1 px-2 font-medium text-muted-foreground",children:"OpenAI"})]})}),a.jsx("tbody",{children:Object.entries(t.models).map(([x,y])=>a.jsxs("tr",{className:"border-b border-border/50 last:border-0",children:[a.jsx("td",{className:"py-1 px-2 font-medium",children:x}),e.anthropicBaseUrl!==void 0&&e.anthropicBaseUrl!==""&&a.jsx("td",{className:"py-1 px-2",children:a.jsx(cr,{result:y.anthropic.nonStreaming})}),e.openaiBaseUrl!==void 0&&e.openaiBaseUrl!==""&&a.jsx("td",{className:"py-1 px-2",children:a.jsx(cr,{result:y.openai.nonStreaming})})]},x))})]})})]}),a.jsxs("div",{className:"flex gap-2 pt-1 border-t",children:[l!==void 0&&a.jsxs(Pe,{variant:"outline",size:"sm",onClick:()=>l(e.id),className:"text-xs h-7 gap-1",disabled:n??!1,children:[a.jsx(hl,{className:`size-3 ${n??!1?"animate-spin":""}`}),n??!1?r!==void 0?`Testing (${r}s)`:"Testing...":"Test"]}),a.jsxs(Pe,{variant:"outline",size:"sm",onClick:()=>s(e),className:"text-xs h-7 gap-1",disabled:n??!1,children:[a.jsx(A0,{className:"size-3"}),"Edit"]}),a.jsxs(Pe,{variant:"outline",size:"sm",onClick:()=>i(e.id),className:"text-xs h-7 gap-1 text-destructive hover:text-destructive",disabled:n??!1,children:[a.jsx(pl,{className:"size-3"}),"Delete"]})]})]})}const Rk={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"}},ca=["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"],ua=["glm-5","glm-5.1","qwen3.6-plus","qwen3.7-max"];function Pk({provider:e,onSubmit:t,onCancel:n}){const[r,o]=v.useState(e?.name??""),[s,i]=v.useState(e?.apiKey??""),[l,c]=v.useState(!1),[u,d]=v.useState(!1),p=e?.models,[m,h]=v.useState(p!==void 0&&p.length>0?p:[""]),[g,f]=v.useState("anthropic"),[x,y]=v.useState(e?.anthropicBaseUrl??""),[_,k]=v.useState(e?.openaiBaseUrl??""),[C,S]=v.useState(e?.apiDocsUrl??""),[z,N]=v.useState(e?.source),[A,O]=v.useState({}),[R,G]=v.useState(!1),[j,I]=v.useState(null),b=v.useRef([]);v.useEffect(()=>{if(j===null)return;const J=j;function ue(X){if(!(X.target instanceof Node))return;const ie=b.current[J];ie!=null&&!ie.contains(X.target)&&I(null)}return document.addEventListener("mousedown",ue),()=>document.removeEventListener("mousedown",ue)},[j]);const[M,V]=v.useState(!1),[P,F]=v.useState(!1),W=r.toLowerCase().includes("minimax"),oe=r.toLowerCase().includes("alibaba");function Z(){navigator.clipboard.writeText(s).catch(()=>{}),d(!0),setTimeout(()=>d(!1),2e3)}v.useEffect(()=>{e&&(o(e.name),i(e.apiKey),h((e.models?.length??0)>0?e.models:[""]),y(e.anthropicBaseUrl??""),k(e.openaiBaseUrl??""),S(e.apiDocsUrl??""),N(e.source),V(!1),F(!1))},[e]),v.useEffect(()=>{const J=r.toLowerCase();for(const[ue,X]of Object.entries(Rk))if(J.includes(ue)){X.format==="anthropic"&&!M?y(X.baseUrl):X.format==="openai"&&!P&&k(X.baseUrl),X.apiDocsUrl!==void 0&&!C&&S(X.apiDocsUrl),ue==="minimax"&&m.length===1&&m[0]===""&&h([ca[0]??""]),ue==="alibaba"&&m.length===1&&m[0]===""&&h([ua[0]??""]);break}},[r]);function U(){const J={};return r.trim()||(J.name="Name is required"),s.trim()||(J.apiKey="API key is required"),(m.length===0||m.every(ue=>!ue.trim()))&&(J.models="At least one model is required"),x.trim()&&!te(x.trim())&&(J.anthropicBaseUrl="Invalid URL format"),_.trim()&&!te(_.trim())&&(J.openaiBaseUrl="Invalid URL format"),!x.trim()&&!_.trim()&&(J.format="At least one format URL (Anthropic or OpenAI) is required"),O(J),Object.keys(J).length===0}function te(J){try{return new URL(J),!0}catch{return!1}}function ee(J){if(J.preventDefault(),!!U()){G(!0);try{t({name:r.trim(),apiKey:s.trim(),models:m.map(ue=>ue.trim()).filter(ue=>ue!==""),anthropicBaseUrl:x.trim()||void 0,openaiBaseUrl:_.trim()||void 0,apiDocsUrl:C.trim()||void 0,source:z})}finally{G(!1)}}}return a.jsxs("form",{onSubmit:ee,className:"space-y-4",children:[a.jsxs("div",{className:"space-y-2",children:[a.jsxs("label",{htmlFor:"provider-name",className:"text-sm font-medium",children:["Name ",a.jsx("span",{className:"text-destructive",children:"*"})]}),a.jsx("input",{id:"provider-name",type:"text",value:r,onChange:J=>o(J.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"}),A.name!==void 0&&a.jsx("p",{className:"text-xs text-destructive",children:A.name})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx("label",{htmlFor:"provider-source",className:"text-sm font-medium",children:"Token Source"}),a.jsxs("select",{id:"provider-source",value:z??"",onChange:J=>N(J.target.value==="company"||J.target.value==="personal"?J.target.value:void 0),className:"w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background focus-visible:border-ring focus-visible:outline-ring focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50",children:[a.jsx("option",{value:"",children:"—"}),a.jsx("option",{value:"personal",children:"个人 (Personal)"}),a.jsx("option",{value:"company",children:"公司 (Company)"})]}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"Label whether this API key is company-provided or personal."})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsxs("label",{htmlFor:"provider-apikey",className:"text-sm font-medium",children:["API Key ",a.jsx("span",{className:"text-destructive",children:"*"})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("input",{id:"provider-apikey",type:"text",value:l||s.length===0?s:Qu(s),onChange:J=>i(J.target.value),onFocus:()=>{!l&&s.length>0&&c(!0)},placeholder:"sk-ant-...",readOnly:!l&&s.length>0,className:"flex-1 rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus-visible:border-ring focus-visible:outline-ring focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50"}),a.jsx("button",{type:"button",onClick:()=>c(J=>!J),className:"text-muted-foreground hover:text-foreground transition-colors p-1 shrink-0","aria-label":l?"Hide API key":"Show API key",children:l?a.jsx(ls,{className:"size-4"}):a.jsx(cs,{className:"size-4"})}),a.jsx("button",{type:"button",onClick:Z,className:"text-muted-foreground hover:text-foreground transition-colors p-1 shrink-0","aria-label":"Copy API key",children:u?a.jsx(Ut,{className:"size-4 text-green-500"}):a.jsx(Zn,{className:"size-4"})})]}),A.apiKey!==void 0&&a.jsx("p",{className:"text-xs text-destructive",children:A.apiKey})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsxs("label",{className:"text-sm font-medium",children:["Models ",a.jsx("span",{className:"text-destructive",children:"*"})]}),m.map((J,ue)=>a.jsxs("div",{ref:X=>{b.current[ue]=X},className:"flex items-center gap-2",children:[a.jsxs("div",{className:"relative flex-1",children:[a.jsx("input",{type:"text",value:J,onChange:X=>{h(ie=>{const ae=[...ie];return ae[ue]=X.target.value,ae})},placeholder:W||oe?"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"}),(W||oe)&&a.jsxs(a.Fragment,{children:[a.jsx("button",{type:"button",onClick:()=>I(j===ue?null:ue),className:"absolute right-1 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground transition-colors p-1 z-10","aria-label":"Show model suggestions",children:a.jsx(hn,{className:"size-4"})}),j===ue&&a.jsx("div",{className:"absolute left-0 right-0 top-full mt-1 z-50 bg-popover border border-border rounded-md shadow-md max-h-48 overflow-y-auto",children:(W?ca:ua).map(X=>a.jsx("button",{type:"button",onClick:()=>{h(ie=>{const ae=[...ie];return ae[ue]=X,ae}),I(null)},className:"w-full text-left px-3 py-2 text-sm hover:bg-muted transition-colors",children:X},X))})]})]}),m.length>1&&a.jsx("button",{type:"button",onClick:()=>h(X=>X.filter((ie,ae)=>ae!==ue)),className:"text-muted-foreground hover:text-destructive transition-colors p-1 shrink-0","aria-label":"Remove model",children:a.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[a.jsx("path",{d:"M3 6h18"}),a.jsx("path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6"}),a.jsx("path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2"})]})})]},ue)),a.jsx("button",{type:"button",onClick:()=>h(J=>[...J,""]),className:"text-xs text-primary hover:underline flex items-center gap-1",children:"+ Add Model"}),A.models!==void 0&&a.jsx("p",{className:"text-xs text-destructive",children:A.models})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsxs("div",{className:"flex gap-1 border-b border-border",children:[a.jsx($e,{children:a.jsxs(je,{children:[a.jsx(Ee,{asChild:!0,children:a.jsx("button",{type:"button",onClick:()=>f("anthropic"),className:`px-3 py-2 text-sm font-medium border-b-2 transition-colors ${g==="anthropic"?"border-primary text-primary":"border-transparent text-muted-foreground hover:text-foreground"}`,children:"Anthropic Format"})}),a.jsx(Ne,{children:"Anthropic Messages API protocol"})]})}),a.jsx($e,{children:a.jsxs(je,{children:[a.jsx(Ee,{asChild:!0,children:a.jsx("button",{type:"button",onClick:()=>f("openai"),className:`px-3 py-2 text-sm font-medium border-b-2 transition-colors ${g==="openai"?"border-primary text-primary":"border-transparent text-muted-foreground hover:text-foreground"}`,children:"OpenAI Format"})}),a.jsx(Ne,{children:"OpenAI Chat Completions API protocol"})]})})]}),A.format!==void 0&&a.jsx("p",{className:"text-xs text-destructive",children:A.format})]}),g==="anthropic"&&a.jsxs("div",{className:"space-y-2",children:[a.jsx("label",{htmlFor:"provider-anthropic-base-url",className:"text-sm font-medium",children:"Anthropic Base URL"}),a.jsx("input",{id:"provider-anthropic-base-url",type:"text",value:x,onChange:J=>{V(!0),y(J.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"}),A.anthropicBaseUrl!==void 0&&a.jsx("p",{className:"text-xs text-destructive",children:A.anthropicBaseUrl}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"Anthropic-compatible endpoint URL. Leave empty if this provider does not support Anthropic format."})]}),g==="openai"&&a.jsxs("div",{className:"space-y-2",children:[a.jsx("label",{htmlFor:"provider-openai-base-url",className:"text-sm font-medium",children:"OpenAI Base URL"}),a.jsx("input",{id:"provider-openai-base-url",type:"text",value:_,onChange:J=>{F(!0),k(J.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"}),A.openaiBaseUrl!==void 0&&a.jsx("p",{className:"text-xs text-destructive",children:A.openaiBaseUrl}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"OpenAI-compatible endpoint URL. Leave empty if this provider does not support OpenAI format."})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx("label",{htmlFor:"provider-api-docs-url",className:"text-sm font-medium",children:"API Docs URL"}),a.jsx("input",{id:"provider-api-docs-url",type:"text",value:C,onChange:J=>S(J.target.value),placeholder:"https://api.example.com/docs",className:"w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus-visible:border-ring focus-visible:outline-ring focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"Optional API documentation URL. If not set, uses known provider docs."})]}),a.jsxs("div",{className:"sticky bottom-0 bg-card border-t flex gap-2 justify-end pt-2 pb-2",children:[a.jsx(Pe,{type:"button",variant:"outline",onClick:n,disabled:R,children:"Cancel"}),a.jsx(Pe,{type:"submit",disabled:R,children:R?"Saving...":e?"Update Provider":"Add Provider"})]})]})}const Ko=ne({id:B(),name:B(),apiKey:B(),model:B().optional(),models:_e(B()).min(1),format:Ze(["anthropic","openai"]).optional(),baseUrl:B().optional(),anthropicBaseUrl:B().optional(),openaiBaseUrl:B().optional(),authHeader:Ze(["bearer","x-api-key"]).optional().default("bearer"),apiDocsUrl:B().optional(),source:Ze(["company","personal"]).optional(),createdAt:B(),updatedAt:B()}),Mk=Ze(["timeout","network_unreachable","connection_refused","auth_failed","rate_limited","server_error","invalid_response","unknown"]),Dk=ne({message:B(),type:Mk,details:B().optional(),hint:B().optional()}),Lk=ne({type:Ze(["text","thinking"]),text:B().optional(),thinking:B().optional()}),Fk=ne({success:Ue(),error:Dk.optional(),model:B().optional(),inputTokens:he().optional(),outputTokens:he().optional(),cacheCreationInputTokens:he().optional(),cacheReadInputTokens:he().optional(),latencyMs:he().optional(),content:_e(Lk).optional(),rawResponse:B().optional(),streaming:Ue().optional(),streamingChunks:ne({chunks:_e(ll),truncated:Ue().default(!1)}).optional(),requestHeaders:mt(B(),B()).optional()}),da=vt([Fk,ne({notConfigured:xe(!0)}),ne({testing:xe(!0)})]),Ar=ne({nonStreaming:da,streaming:da}),$k=ne({anthropic:Ar,openai:Ar}),Bk=ne({anthropic:Ar,openai:Ar,models:mt(B(),$k).optional(),testedAt:B().optional()});function Uk(){return{anthropic:{nonStreaming:{testing:!0},streaming:{testing:!0}},openai:{nonStreaming:{testing:!0},streaming:{testing:!0}}}}function fa(e,t){const n=()=>({nonStreaming:{success:!1,error:{message:e,type:t}},streaming:{notConfigured:!0}});return{anthropic:n(),openai:n()}}const Zk=ne({providerConfig:B()}),Wk=ne({success:Ue().optional(),imported:he().optional(),message:B().optional(),errors:_e(B()).optional()}),Vk=30,wo="Network error: could not reach the server. Is the proxy running?";function ha(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,source:e.source}}async function Hk(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 qk({externalProviders:e,isLoading:t=!1,externalTestResults:n,externalTestingProviders:r,externalTestingTimeLeft:o,onProvidersMutate:s,onTestResultsChange:i,onTestingProvidersChange:l,onTestingTimeLeftChange:c}){const[u,d]=v.useState(!1),[p,m]=v.useState(),[h,g]=v.useState(null),[f,x]=v.useState({}),[y,_]=v.useState(new Set),[k,C]=v.useState({}),[S,z]=v.useState(null),[N,A]=v.useState(!1),[O,R]=v.useState(null),[G,j]=v.useState(!1),[I,b]=v.useState(!1),[M,V]=v.useState(null),[P,F]=v.useState("all"),W=v.useRef(null),oe=v.useRef(null),Z=e??[],U=v.useMemo(()=>{const $=P==="all"?Z:Z.filter(H=>H.source===P);return P==="all"?[...$].sort((H,D)=>{const Q={personal:0,company:1};return(Q[H.source??""]??2)-(Q[D.source??""]??2)}):$},[Z,P]),te=n??f,ee=r??y,J=o??k,ue=c?($,H)=>c($,H):($,H)=>{C(H===void 0?D=>{const Q={...D};return delete Q[$],Q}:D=>({...D,[$]:H}))};v.useEffect(()=>{(async()=>{try{const $=await fetch("/api/config/paths");if($.ok){const H=await Ot($,Zk);z(H.providerConfig)}}catch{}})()},[]);const X=v.useCallback($=>{oe.current!==null&&clearTimeout(oe.current),R($),W.current?.scrollTo({top:W.current.scrollHeight,behavior:"smooth"}),oe.current=setTimeout(()=>{R(null),oe.current=null},2e3)},[]);v.useEffect(()=>()=>{oe.current!==null&&clearTimeout(oe.current)},[]);const ie=v.useCallback(()=>{s?.().catch(()=>{})},[s]),ae=v.useCallback(($,H)=>{i?i($,H):x(D=>({...D,[$]:H}))},[i]),pe=v.useCallback(($,H)=>{if(l){l($,H);return}_(D=>{const Q=new Set(D);return H?Q.add($):Q.delete($),Q})},[l]),fe=v.useCallback(async $=>{ae($,Uk()),pe($,!0);const H=new AbortController;let D=Vk;ue($,D);const Q=setInterval(()=>{D--,ue($,D),D<=0&&(clearInterval(Q),H.abort())},1e3);try{const se=await fetch(`/api/providers/${$}/test`,{method:"POST",signal:H.signal});if(se.ok){const re=await Ot(se,Bk);ae($,re),await Hk($,re)}else ae($,fa(`HTTP ${se.status}: ${se.statusText}`,"server_error"))}catch(se){se instanceof Error&&se.name==="AbortError"&&ae($,fa("Request timed out","timeout"))}finally{clearInterval(Q),ue($,void 0),pe($,!1)}},[ue,ae,pe]);function we($){(async()=>{try{const H=await fetch("/api/providers",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(ha($))});if(!H.ok){g(await zn(H,"Failed to add provider"));return}const D=await Ot(H,Ko);d(!1),X(D.id),ie(),await fe(D.id)}catch{g(wo)}})()}function Te($){p&&(async()=>{try{const H=await fetch(`/api/providers/${p.id}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(ha($))});if(!H.ok){g(await zn(H,"Failed to update provider"));return}const D=await Ot(H,Ko);m(void 0),X(D.id),ie(),(($.apiKey??"")!==(p.apiKey??"")||JSON.stringify($.models)!==JSON.stringify(p.models)||($.anthropicBaseUrl??"")!==(p.anthropicBaseUrl??"")||($.openaiBaseUrl??"")!==(p.openaiBaseUrl??""))&&await fe(D.id)}catch{g(wo)}})()}function w($){V($),b(!0)}function Y(){const $=M;$!==null&&(async()=>{let H;try{H=await fetch(`/api/providers/${$}`,{method:"DELETE"})}catch{g(wo);return}if(!H.ok){g(await zn(H,"Failed to delete provider"));return}ie()})()}const q=v.useRef(null);function T($){const H="/api/providers/export";(async()=>{try{const D=await fetch(H);if(!D.ok){g("Failed to export providers");return}const Q=await D.blob(),se=URL.createObjectURL(Q),re=document.createElement("a");re.href=se,re.download=D.headers.get("Content-Disposition")?.match(/filename="(.+)"/)?.[1]??"providers.json",document.body.appendChild(re),re.click(),document.body.removeChild(re),URL.revokeObjectURL(se)}catch{g("Failed to export providers")}})()}function E(){q.current?.click()}function L($){const H=$.target.files?.[0];H&&(async()=>{try{const D=await H.text(),Q=await fetch("/api/providers/import",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(D)}),se=await Ot(Q,Wk);Q.ok&&se.imported!==void 0&&se.imported>0?(ie(),g(null)):se.errors&&se.errors.length>0?g(se.errors.join("; ")):g(se.message??"Import failed")}catch{g("Failed to import providers")}$.target.value=""})()}return t?a.jsx("div",{className:"flex items-center justify-center py-8",children:a.jsx("p",{className:"text-sm text-muted-foreground",children:"Loading providers..."})}):u||p?a.jsxs("div",{className:"space-y-4",children:[a.jsx("div",{className:"flex items-center justify-between sticky top-0 bg-background z-10 pb-2",children:a.jsx("h3",{className:"text-lg font-medium",children:p?"Edit Provider":"Add New Provider"})}),a.jsx(Pk,{provider:p,onSubmit:p?Te:we,onCancel:()=>{d(!1),m(void 0)}})]}):a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"flex items-center justify-between sticky top-0 z-10 bg-background pb-2",children:[a.jsx("h3",{className:"text-lg font-medium",children:"Providers"}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx($e,{children:a.jsxs(je,{children:[a.jsx(Ee,{asChild:!0,children:a.jsxs(Pe,{variant:"outline",size:"sm",onClick:()=>T(),className:"gap-1 hover:bg-muted",children:[a.jsx(as,{className:"size-3"}),"Export"]})}),a.jsx(Ne,{children:"Download providers as JSON for backup or sharing"})]})}),a.jsx($e,{children:a.jsxs(je,{children:[a.jsx(Ee,{asChild:!0,children:a.jsxs(Pe,{variant:"outline",size:"sm",onClick:E,className:"gap-1 hover:bg-muted",children:[a.jsx(J0,{className:"size-3"}),"Import"]})}),a.jsx(Ne,{children:"Import providers from an exported JSON file"})]})}),a.jsx("input",{type:"file",ref:q,accept:".json",onChange:L,style:{display:"none"}}),a.jsx($e,{children:a.jsxs(je,{children:[a.jsx(Ee,{asChild:!0,children:a.jsxs(Pe,{variant:"outline",size:"sm",onClick:()=>j(!0),className:"gap-1",children:[a.jsx($0,{className:"size-3"}),"Scan"]})}),a.jsx(Ne,{children:"Detect and import provider configs from Claude Code and OpenCode"})]})}),a.jsxs(Pe,{onClick:()=>d(!0),size:"sm",className:"gap-1",children:[a.jsx(To,{className:"size-4"}),"Add Provider"]})]})]}),S!==null&&a.jsxs("div",{className:"flex items-center gap-2 text-xs text-muted-foreground bg-muted/30 rounded-md px-3 py-2",children:[a.jsx("span",{className:"shrink-0",children:"Config:"}),a.jsx("span",{className:"font-mono truncate",title:S,children:S}),a.jsx($e,{children:a.jsxs(je,{children:[a.jsx(Ee,{asChild:!0,children:a.jsx("button",{type:"button",onClick:()=>{window.navigator.clipboard.writeText(S).then(()=>{A(!0),setTimeout(()=>A(!1),2e3)})},className:"shrink-0 ml-auto text-muted-foreground hover:text-foreground transition-colors",children:N?a.jsx(Ut,{className:"size-3 text-green-500"}):a.jsx(Zn,{className:"size-3"})})}),a.jsx(Ne,{children:"Copy config file path to clipboard"})]})})]}),h!==null&&a.jsxs("div",{className:"flex items-center gap-2 text-sm text-destructive bg-destructive/10 rounded-md px-3 py-2",children:[a.jsx(Rn,{className:"size-4 shrink-0"}),h]}),Z.length===0?a.jsxs("div",{className:"text-center py-12 space-y-3",children:[a.jsx("p",{className:"text-sm text-muted-foreground",children:"No providers configured yet."}),a.jsxs(Pe,{onClick:()=>d(!0),variant:"outline",size:"sm",children:[a.jsx(To,{className:"size-4"}),"Add Your First Provider"]})]}):a.jsxs("div",{className:"space-y-3",children:[a.jsx("div",{className:"flex gap-1 border-b border-border",children:["all","personal","company"].map($=>a.jsx($e,{children:a.jsxs(je,{children:[a.jsx(Ee,{asChild:!0,children:a.jsx("button",{type:"button",onClick:()=>F($),className:`px-3 py-2 text-sm font-medium border-b-2 transition-colors ${P===$?"border-primary text-primary":"border-transparent text-muted-foreground hover:text-foreground"}`,children:$==="all"?"All":$==="personal"?"Personal":"Company"})}),a.jsx(Ne,{children:$==="all"?"Show all providers":$==="personal"?"Providers you configured yourself":"Providers set by your organization"})]})},$))}),a.jsx("div",{ref:W,className:"space-y-3",children:U.map($=>a.jsx(Ik,{provider:$,testResults:te[$.id],isTesting:ee.has($.id),testingTimeLeft:J[$.id],isHighlighted:$.id===O,onEdit:H=>m(H),onDelete:w,onTest:H=>{fe(H)}},$.id))})]}),a.jsx(Ek,{open:G,onOpenChange:j,onImportComplete:()=>{s!==void 0&&s()}}),a.jsx(zu,{open:I,onOpenChange:b,title:"Delete Provider",description:"Are you sure you want to delete this provider? This action cannot be undone.",confirmLabel:"Delete",variant:"destructive",onConfirm:Y})]})}async function Jk(e){return Bn(e,Ko.array(),void 0,t=>`Failed to fetch ${e}: ${t.status}`)}function Kk(){const e=Yo("/api/providers",Jk,{revalidateOnFocus:!1,revalidateIfStale:!1});return{providers:e.data??[],isLoading:e.isLoading,isError:e.error,mutate:e.mutate}}function Gk(){const[e,t]=v.useState(!1),[n,r]=v.useState("providers"),{providers:o,isLoading:s,mutate:i}=Kk(),[l,c]=v.useState({}),[u,d]=v.useState(new Set),[p,m]=v.useState({}),h=v.useCallback((x,y)=>{c(_=>({..._,[x]:y}))},[]),g=v.useCallback((x,y)=>{d(_=>{const k=new Set(_);return y?k.add(x):k.delete(x),k})},[]),f=v.useCallback((x,y)=>{m(_=>{if(y===void 0){const k={..._};return delete k[x],k}return{..._,[x]:y}})},[]);return a.jsxs(Is,{open:e,onOpenChange:t,children:[a.jsx(z2,{asChild:!0,children:a.jsxs(Pe,{variant:"ghost",size:"icon",className:"size-8",children:[a.jsx(W0,{className:"size-4"}),a.jsx("span",{className:"sr-only",children:"Settings"})]})}),a.jsxs(Rs,{className:"max-w-2xl max-h-[80vh] overflow-hidden flex flex-col",children:[a.jsx(Ps,{children:a.jsx(Ms,{children:"Settings"})}),a.jsxs(Du,{value:n,onValueChange:r,className:"flex-1 overflow-hidden",children:[a.jsxs(Lu,{children:[a.jsx(ft,{value:"providers",children:"Providers"}),a.jsx(ft,{value:"proxy",children:"Proxy"})]}),a.jsxs("div",{className:"mt-4 overflow-y-auto flex-1 pr-3",children:[a.jsx(ht,{value:"providers",children:a.jsx(qk,{externalProviders:o,isLoading:s,externalTestResults:l,externalTestingProviders:u,externalTestingTimeLeft:p,onProvidersMutate:()=>i(),onTestResultsChange:h,onTestingProvidersChange:g,onTestingTimeLeftChange:f})}),a.jsx(ht,{value:"proxy",children:a.jsx(Yk,{})})]})]})]})]})}function Yk(){const{strip:e,slowResponseThresholdSeconds:t,timeDisplayFormat:n,isLoading:r,setStrip:o,setSlowResponseThresholdSeconds:s,setTimeDisplayFormat:i}=ul(),[l,c]=v.useState(null),[u,d]=v.useState(!1),p=v.useCallback(async g=>{c(null),d(!0);try{await o(g)}catch(f){c(f instanceof Error?f.message:String(f))}finally{d(!1)}},[o]),m=v.useCallback(async g=>{c(null),d(!0);try{await s(g)}catch(f){c(f instanceof Error?f.message:String(f))}finally{d(!1)}},[s]),h=v.useCallback(async g=>{c(null),d(!0);try{await i(g)}catch(f){c(f instanceof Error?f.message:String(f))}finally{d(!1)}},[i]);return a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"space-y-1",children:[a.jsx("h3",{className:"text-sm font-semibold",children:"Claude Code billing header"}),a.jsxs("p",{className:"text-xs text-muted-foreground",children:["When enabled, the proxy strips the synthetic ",a.jsx("code",{children:"x-anthropic-billing-header"})," text block that Claude Code prepends to the system prompt before forwarding to upstream. Improves prefix-cache hit rates against third-party upstreams. The default at startup is controlled by the ",a.jsx("code",{children:"AGENT_INSPECTOR_STRIP_CLAUDE_CODE_BILLING_HEADER"})," ","environment variable; your choice is persisted to ",a.jsx("code",{children:"config.json"})," and overrides the env var for subsequent requests."]})]}),a.jsxs("label",{className:"flex items-center gap-3",children:[a.jsx("input",{type:"checkbox",role:"switch",checked:e,disabled:r||u,onChange:g=>{p(g.currentTarget.checked)},className:"size-4 cursor-pointer disabled:cursor-not-allowed disabled:opacity-50"}),a.jsx("span",{className:"text-sm",children:r?"Loading…":e?"Stripping enabled":"Stripping disabled"})]}),a.jsxs("div",{className:"space-y-1",children:[a.jsx("label",{htmlFor:"slow-response-threshold",className:"text-sm font-semibold",children:"Slow response threshold"}),a.jsxs("p",{className:"text-xs text-muted-foreground",children:["Logs whose elapsed time exceeds this many seconds show a warning icon next to the duration. Set to ",a.jsx("code",{children:"0"})," to disable the indicator."]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("input",{id:"slow-response-threshold",type:"number",min:0,max:No,step:1,value:t,disabled:r||u,onChange:g=>{const f=Number(g.currentTarget.value);Number.isInteger(f)&&(f<0||f>No||m(f))},className:"h-8 w-24 rounded-md border border-input bg-transparent px-2 text-sm font-mono disabled:cursor-not-allowed disabled:opacity-50"}),a.jsx("span",{className:"text-xs text-muted-foreground",children:"seconds"})]})]}),a.jsxs("div",{className:"space-y-1",children:[a.jsx("label",{htmlFor:"time-display-format",className:"text-sm font-semibold",children:"Time display"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"Controls timestamps in session summaries, conversation headers, and log rows."}),a.jsxs("select",{id:"time-display-format",value:n,disabled:r||u,onChange:g=>{const f=cl.safeParse(g.currentTarget.value);f.success&&h(f.data)},className:"h-8 rounded-md border border-input bg-background px-2 text-sm disabled:cursor-not-allowed disabled:opacity-50",children:[a.jsx("option",{value:"time",children:"Time only"}),a.jsx("option",{value:"full",children:"Full ISO"})]})]}),l!==null&&a.jsxs("p",{className:"text-xs text-destructive",children:["Failed to save: ",l]})]})}function Xk(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:pa(s.cacheCreationInputTokens,i.cacheCreationInputTokens),read:pa(s.cacheReadInputTokens,i.cacheReadInputTokens)})}}return t}function pa(e,t){return t===null||e===null?null:t>e?{direction:"up",delta:t-e}:t<e?{direction:"down",delta:e-t}:null}const Go="data-nav-id",Qk="data-nav-action";function ma(e){return Array.from(e.querySelectorAll(`[${Go}]`))}function ga(e){return e instanceof HTMLElement}function e5(e,t){let n=e;for(;n!==null&&n!==t;){if(n.hasAttribute(Go))return n;n=n.parentElement}return e.hasAttribute(Go)?e:null}function _o(e){const t=e.getAttribute(Qk);return t==="toggle"||t==="expand"||t==="collapse"?t:null}function jn(e){e.focus({preventScroll:!0}),e.scrollIntoView({block:"nearest",behavior:"smooth"})}function En(e,t){return e[t]??null}function t5(e){const t=e.tagName;return!!(t==="INPUT"||t==="TEXTAREA"||e.isContentEditable)}function n5(e,t){const n=t??e,r=v.useCallback(o=>{const s=e.current;if(!s)return;const i=o.target;if(!ga(i)||i!==n.current||!s.contains(i))return;const l=ma(s),c=En(l,0);c!==null&&jn(c)},[e,n]);v.useEffect(()=>{const o=n.current,s=e.current;if(!o||!s)return;const i=l=>{const c=l.target;if(!ga(c)||!s.contains(c)||t5(c))return;const u=ma(s);if(u.length===0)return;const d=e5(c,s),p=d!==null?u.indexOf(d):-1;let m=!1;switch(l.key){case"ArrowUp":case"W":{if(l.key==="W"&&!l.shiftKey)break;l.preventDefault();const h=p>0?p-1:p===-1?u.length-1:-1;if(h!==-1){const g=En(u,h);g!==null&&jn(g)}m=!0;break}case"ArrowDown":case"S":{if(l.key==="S"&&!l.shiftKey)break;l.preventDefault();const h=p<u.length-1?p+1:p===-1?0:-1;if(h!==-1){const g=En(u,h);g!==null&&jn(g)}m=!0;break}case"ArrowLeft":case"A":{if(l.key==="A"&&!l.shiftKey||d===null)break;if(l.preventDefault(),_o(d)==="collapse")d.click();else if(p>0){const g=En(u,p-1);g!==null&&jn(g)}m=!0;break}case"ArrowRight":case"D":{if(l.key==="D"&&!l.shiftKey||d===null)break;if(l.preventDefault(),_o(d)==="expand")d.click();else if(p<u.length-1){const g=En(u,p+1);g!==null&&jn(g)}m=!0;break}case" ":{if(d===null)break;l.preventDefault(),_o(d)!==null&&d.click(),m=!0;break}}m&&l.stopPropagation()};return document.addEventListener("keydown",i,{capture:!0}),()=>document.removeEventListener("keydown",i,{capture:!0})},[e,n]),v.useEffect(()=>{const o=n.current;if(o)return o.addEventListener("focus",r),()=>o.removeEventListener("focus",r)},[r,n])}function hr(e){return e.length<=30?e:e.slice(0,12)+"…"+e.slice(-12)}function r5(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 o5(e,t){const n=e[0],r=e[e.length-1];return n===void 0||r===void 0?null:fs(n.timestamp,r.timestamp,t)}function s5(e){for(const t of e)if(t.userAgent!==null&&t.userAgent!==void 0&&t.userAgent!=="")return t.userAgent;return null}function i5({command:e}){const[t,n]=v.useState(!1),r=v.useCallback(()=>{window.navigator.clipboard.writeText(e).then(()=>{n(!0),setTimeout(()=>n(!1),2e3)})},[e]);return a.jsxs("div",{className:"inline-flex items-center gap-2 bg-muted rounded-md px-3 py-2",children:[a.jsx("pre",{className:"text-blue-500 font-mono text-sm m-0",children:e}),a.jsx("button",{type:"button",onClick:r,className:"text-muted-foreground hover:text-foreground transition-colors shrink-0 cursor-pointer","aria-label":"Copy command",children:t?a.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:a.jsx("path",{d:"M20 6 9 17l-5-5"})}):a.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[a.jsx("rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2"}),a.jsx("path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2"})]})})]})}function a5(){return a.jsx($e,{children:a.jsxs(je,{children:[a.jsx(Ee,{asChild:!0,children:a.jsxs("span",{className:"inline-flex h-7 items-center gap-2 rounded-md border border-cyan-400/30 bg-cyan-500/10 px-2.5 font-mono text-[11px] font-medium text-cyan-300 shadow-[0_0_16px_rgba(34,211,238,0.08)]",children:[a.jsx("span",{className:"size-1.5 rounded-full bg-emerald-300 shadow-[0_0_8px_rgba(110,231,183,0.8)]"}),"MCP Ready",a.jsx("span",{className:"hidden text-cyan-200/70 sm:inline",children:"/api/mcp"})]})}),a.jsx(Ne,{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 l5({sessionId:e,logs:t,totalIn:n,totalOut:r,timeDisplayFormat:o}){const[s,i]=v.useState(!1),l=v.useMemo(()=>o5(t,o),[t,o]),c=v.useMemo(()=>s5(t),[t]),u=v.useCallback(()=>{window.navigator.clipboard.writeText(window.location.href).then(()=>{i(!0),setTimeout(()=>i(!1),2e3)})},[]);return a.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:[a.jsx("a",{href:"/",className:"inline-flex size-8 shrink-0 items-center justify-center rounded-md text-muted-foreground transition-colors hover:bg-muted hover:text-foreground","aria-label":"Back to all sessions",title:"Back to all sessions",children:a.jsx(Mg,{className:"size-3.5"})}),a.jsxs("div",{className:"min-w-0 flex-1",children:[a.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[a.jsx("span",{className:"font-mono font-semibold text-purple-400/90 truncate",title:e,children:hr(e)}),c!==null&&a.jsx("span",{className:"font-mono text-muted-foreground truncate max-w-[220px]",title:c,children:c})]}),a.jsxs("div",{className:"mt-1 flex flex-wrap items-center gap-x-3 gap-y-1 text-muted-foreground",children:[a.jsxs("span",{children:[t.length," request",t.length!==1?"s":""]}),l!==null&&a.jsx("span",{children:l}),(n>0||r>0)&&a.jsxs("span",{className:"font-mono",children:[Be(n)," in / ",Be(r)," out"]})]})]}),a.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?a.jsx(Ut,{className:"size-3.5"}):a.jsx(Zn,{className:"size-3.5"})})]})}function c5({logs:e,sessions:t,models:n,selectedSession:r,selectedModel:o,onSessionChange:s,onModelChange:i,onClearAll:l,onClearGroup:c,viewMode:u,onViewModeChange:d,strip:p,slowResponseThresholdSeconds:m,timeDisplayFormat:h,hideSessionFilter:g=!1,pinnedSessionId:f}){const{totalIn:x,totalOut:y}=v.useMemo(()=>r5(e),[e]),[_,k]=v.useState(!1),[C,S]=v.useState(null),[z,N]=v.useState("hidden"),A=v.useRef(null),O=v.useRef(null);n5(A,O),v.useEffect(()=>{const W=50+Fn.length*400,oe=setTimeout(()=>N("playing"),50),Z=setTimeout(()=>N("done"),W);return()=>{clearTimeout(oe),clearTimeout(Z)}},[]),v.useEffect(()=>{if(f===void 0){document.title="Agent Inspector";return}const P=e.length===1?"1 req":`${e.length} req`;document.title=`${hr(f)} - ${P} - Agent Inspector`},[e.length,f]);const R=v.useCallback(async()=>{k(!0);try{await fx(e)}finally{k(!1)}},[e]);v.useEffect(()=>{S(null)},[r,o]);const G=v.useCallback(()=>{S(null)},[]),j=v.useMemo(()=>$2(e),[e]),I=f!==void 0,b=v.useMemo(()=>Xk(j),[j]),M=v.useMemo(()=>X_(j),[j]),V=v.useCallback(P=>{const F=M.get(P.id);F!==void 0&&S([F,P])},[M]);return a.jsxs("div",{className:"max-w-[1400px] xl:max-w-[1600px] 2xl:max-w-[1800px] mx-auto px-6 pb-6",children:[a.jsxs("div",{className:"sticky top-0 z-30 bg-background pt-6",children:[a.jsxs("div",{className:"grid grid-cols-[1fr_auto_1fr] items-start gap-3 pb-8",children:[a.jsx("div",{}),a.jsxs("h1",{className:"flex min-w-0 flex-col items-center gap-2 text-center",children:[a.jsxs("span",{className:"flex max-w-[calc(100vw-7rem)] items-end gap-2 whitespace-nowrap",children:[a.jsxs("span",{className:"flex shrink-0 items-end gap-1 group cursor-default","aria-hidden":"true",children:[a.jsx(mk,{className:"size-10 text-amber-500 transition-all duration-300 group-hover:scale-125 group-hover:-translate-y-1.5"}),a.jsx("span",{className:"hidden items-end gap-0.5 sm:flex",children:Fn.map((P,F)=>{const W=["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],oe=z==="hidden"?"opacity-0 scale-0":z==="playing"?"animate-crab-piano-pop":"";return a.jsx(P,{className:`size-5 ${W} transition-all duration-300 ease-out group-hover:scale-125 group-hover:-translate-y-1 ${oe}`,style:{transitionDelay:`${F*50}ms`,...z==="playing"?{animationDelay:`${F*400}ms`}:{}}},F)})})]}),a.jsxs("span",{className:"flex min-w-0 items-baseline gap-2 pl-1",children:[a.jsx("span",{className:"truncate text-lg font-bold",children:"Agent Inspector"}),a.jsxs("span",{className:"shrink-0 font-mono text-xs font-semibold text-muted-foreground",children:["v",r1.version]})]}),a.jsx(To,{className:"size-4 shrink-0 text-muted-foreground/70","aria-hidden":"true"}),a.jsx(xk,{className:"size-10 shrink-0"})]}),a.jsx(a5,{})]}),a.jsx("div",{className:"justify-self-end",children:a.jsx(Gk,{})})]}),f!==void 0&&a.jsx(l5,{sessionId:f,logs:e,totalIn:x,totalOut:y,timeDisplayFormat:h}),a.jsxs("div",{className:"flex items-center gap-3 mb-4",children:[!g&&a.jsxs(sa,{value:r,onValueChange:s,children:[a.jsx(aa,{className:"flex-1 max-w-[350px] text-xs",children:a.jsx(ia,{placeholder:"All sessions"})}),a.jsxs(la,{children:[a.jsx(lr,{value:"__all__",children:"All sessions"}),t.map(P=>a.jsx(lr,{value:P,children:hr(P)},P))]})]}),a.jsxs(sa,{value:o,onValueChange:i,children:[a.jsx(aa,{className:"flex-1 max-w-[250px] text-xs",children:a.jsx(ia,{placeholder:"All models"})}),a.jsxs(la,{children:[a.jsx(lr,{value:"__all__",children:"All models"}),n.map(P=>a.jsx(lr,{value:P,children:P},P))]})]}),a.jsxs("div",{className:"flex items-center border border-border rounded-md overflow-hidden",children:[a.jsx("button",{type:"button",onClick:()=>d("simple"),className:`h-8 px-3 cursor-pointer transition-colors text-xs ${u==="simple"?"bg-muted text-foreground":"text-muted-foreground hover:bg-muted/50"}`,children:"Simple"}),a.jsx("button",{type:"button",onClick:()=>d("full"),className:`h-8 px-3 cursor-pointer transition-colors text-xs ${u==="full"?"bg-muted text-foreground":"text-muted-foreground hover:bg-muted/50"}`,children:"Full"})]}),a.jsx("div",{className:"flex-1"}),!I&&a.jsxs("span",{className:"text-muted-foreground text-xs font-mono",children:[e.length," request",e.length!==1?"s":"",x>0||y>0?` · ${Be(x)} in / ${Be(y)} out`:""]}),e.length>0&&a.jsx("button",{type:"button",onClick:()=>{R()},disabled:_,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:_?a.jsx("span",{children:"Exporting..."}):a.jsxs(a.Fragment,{children:[a.jsx(as,{className:"size-3.5"}),a.jsx("span",{children:"Export"})]})}),a.jsx("button",{type:"button",onClick:l,className:"h-8 px-3 text-xs text-muted-foreground hover:text-foreground transition-colors cursor-pointer rounded-md hover:bg-muted",title:"Clear all logs",children:"Clear"})]})]}),a.jsx("div",{children:e.length===0?r!=="__all__"?a.jsxs("div",{className:"text-center text-muted-foreground py-16 space-y-4",children:[a.jsx("p",{className:"text-sm font-medium",children:"Session not found"}),a.jsx("p",{className:"text-xs font-mono bg-muted px-3 py-1 rounded inline-block max-w-[500px] break-all",children:hr(r)}),a.jsxs("p",{className:"text-xs",children:["This session may have been cleared or never existed."," ",g?a.jsx("a",{href:"/",className:"underline hover:text-foreground transition-colors",children:"Back to all sessions"}):a.jsx("button",{type:"button",onClick:()=>s("__all__"),className:"underline hover:text-foreground transition-colors",children:"Show all sessions"})]})]}):a.jsxs("div",{className:"text-center text-muted-foreground py-16 space-y-4",children:[a.jsx("p",{className:"text-sm",children:"No requests captured yet."}),a.jsx("p",{className:"text-xs",children:"Route AI coding tools through the proxy:"}),a.jsx(i5,{command:"LLM_BASE_URL=http://localhost:25947/proxy <your-tool>"})]}):a.jsx("div",{ref:O,tabIndex:0,className:"flex flex-col gap-2 focus:outline-none",children:a.jsx("div",{ref:A,children:j.map(P=>a.jsx(pk,{group:P,viewMode:u,strip:p,slowResponseThresholdSeconds:m,cacheTrends:b,onCompareWithPrevious:V,comparisonPredecessors:M,onClearGroup:c,standalone:j.length===1,hasPinnedSessionContext:I,timeDisplayFormat:h},P.id))})})}),C!==null&&a.jsx(v.Suspense,{fallback:null,children:a.jsx(Cw,{left:C[0],right:C[1],onClose:G})})]})}const u5=vt([ne({type:xe("init"),logs:_e(ci)}),ne({type:xe("update"),log:ci})]);function d5(e){const t=new Set;for(const n of e)n.sessionId!==null&&n.sessionId!==""&&t.add(n.sessionId);return[...t]}function f5(e){const t=new Set;for(const n of e)n.model!==null&&n.model!==""&&t.add(n.model);return[...t]}function h5(e,t,n){return t==="__all__"&&n==="__all__"?e:e.filter(r=>!(t!=="__all__"&&r.sessionId!==t||n!=="__all__"&&r.model!==n))}const p5=50,m5=12,g5=1800;function x5(e){return e===void 0?"/api/logs/stream":`/api/logs/stream?${new URLSearchParams({sessionId:e}).toString()}`}function b5({initialSessionId:e}={}){const[t,n]=v.useState([]),[r,o]=v.useState(e??"__all__"),[s,i]=v.useState("__all__"),[l,c]=v.useState("simple"),[u,d]=v.useState(null),p=v.useRef(null),m=v.useRef(null),h=v.useRef(null),g=v.useRef(new Map),f=v.useRef([]),x=v.useRef(null),y=v.useMemo(()=>h5(t,r,s),[t,r,s]),_=v.useMemo(()=>d5(t),[t]),k=v.useMemo(()=>f5(t),[t]),C=v.useCallback(()=>{x.current=null;const j=f.current;f.current=[],j.length!==0&&n(I=>{let b=I;for(const M of j){const V=g.current.get(M.id);V!==void 0?b=[...b.slice(0,V),M,...b.slice(V+1)]:(g.current.set(M.id,b.length),b=[...b,M])}return b})},[]),S=v.useCallback(j=>{f.current.push(j),x.current===null&&(x.current=setTimeout(C,p5))},[C]),z=v.useCallback(()=>{p.current&&p.current.close();const j=new EventSource(x5(e));p.current=j,j.onmessage=I=>{try{const b=String(I.data),M=JSON.parse(b),V=u5.safeParse(M);if(!V.success){d("Failed to parse SSE data");return}const P=V.data;if(P.type==="init"){x.current!==null&&(clearTimeout(x.current),x.current=null),f.current=[];const F=new Map;for(let W=0;W<P.logs.length;W++){const oe=P.logs[W];oe!==void 0&&F.set(oe.id,W)}g.current=F,n(P.logs),d(null)}else P.type==="update"&&S(P.log)}catch{d("Failed to parse SSE data")}},j.onerror=()=>{d("SSE connection lost, reconnecting..."),j.close(),m.current!==null&&clearTimeout(m.current),m.current=setTimeout(z,3e3)}},[e,S]);v.useEffect(()=>(z(),()=>{p.current&&(p.current.close(),p.current=null),m.current!==null&&(clearTimeout(m.current),m.current=null),x.current!==null&&(clearTimeout(x.current),x.current=null)}),[z]),v.useEffect(()=>{const j=window.location.hash;if(!j.startsWith("#log-")||h.current===j)return;const I=j.slice(1);let b=!1,M=0,V=null,P=null;const F=()=>{if(b)return;const W=document.getElementById(I);if(W!==null){h.current=j,W.scrollIntoView({block:"center",behavior:"smooth"}),W instanceof HTMLElement&&(V=W,W.setAttribute("data-deep-link-highlight","true"),P=window.setTimeout(()=>{W.removeAttribute("data-deep-link-highlight")},g5),W.focus({preventScroll:!0}),W.getAttribute("data-nav-action")==="expand"&&W.click());return}M+=1,M<m5&&window.setTimeout(F,100)};return F(),()=>{b=!0,P!==null&&window.clearTimeout(P),V!==null&&V.removeAttribute("data-deep-link-highlight")}},[y.length]);const N=v.useCallback(()=>{e!==void 0&&t.length===0||(async()=>{try{const j=e===void 0?void 0:JSON.stringify({ids:t.map(b=>b.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]),A=v.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 b=new Set(j);n(M=>{const V=M.filter(F=>!b.has(F.id)),P=new Map;for(let F=0;F<V.length;F++){const W=V[F];W!==void 0&&P.set(W.id,F)}return g.current=P,V}),d(null)}catch(I){d(I instanceof Error?I.message:"Unknown error clearing group")}})()},[]),{strip:O,slowResponseThresholdSeconds:R,timeDisplayFormat:G}=ul();return a.jsxs(a.Fragment,{children:[u!==null&&a.jsx("div",{className:"fixed top-4 right-4 bg-destructive text-destructive-foreground px-4 py-2 rounded-md text-sm z-50",children:u}),a.jsx(ax,{}),a.jsx(c5,{logs:y,sessions:_,models:k,selectedSession:r,selectedModel:s,onSessionChange:o,onModelChange:i,onClearAll:N,onClearGroup:A,viewMode:l,onViewModeChange:c,strip:O,slowResponseThresholdSeconds:R,timeDisplayFormat:G,hideSessionFilter:e!==void 0,pinnedSessionId:e})]})}export{_w as $,B as A,Yr as B,r0 as C,Is as D,cn as E,Se as F,pt as G,ye as H,Wt as I,Ie as J,We as K,Zt as L,j0 as M,ms as N,kt as O,b5 as P,Zi as Q,L0 as R,$g as S,Du as T,hn as U,Ho as V,yr as W,ml as X,t1 as Y,Mn as Z,Pn as _,F2 as a,qg as a0,ve as b,ge as c,To as d,A0 as e,Be as f,$_ as g,Un as h,Ut as i,Zn as j,Rs as k,Ps as l,Ms as m,P0 as n,Lu as o,ft as p,ht as q,Tr as r,$e as s,je as t,Ee as u,Ne as v,Pe as w,ne as x,Ue as y,he as z};
|